Changeset 1093

Show
Ignore:
Timestamp:
10/31/07 19:08:35 (2 years ago)
Author:
hachi
Message:

Merging release-16 to athena branch. svn merge -r60295:61488 http://svn.sixapart.com/repos/eng/movabletype/branches/release-16 .

Location:
branches/athena
Files:
6 added
125 modified

Legend:

Unmodified
Added
Removed
  • branches/athena/MANIFEST.SKIP

    r1090 r1093  
    3939#mt-static/themes/unity-tricolor 
    4040 
    41 ^addons 
     41#^addons 
    4242 
    4343^schemas 
  • branches/athena/build/mt-dists/make-js

    r1086 r1093  
    99 
    1010my $js = `cat mt-static/mt.js`; 
     11$js .= `cat mt-static/js/edit.js`; 
    1112$js .= `cat mt-static/js/dialog.js`; 
    1213$js .= `cat mt-static/js/assetdetail.js`; 
     
    1516$js .= `cat tmpl/cms/widget/blog_stats.tmpl`; 
    1617$js .= `cat tmpl/cms/list_tag.tmpl`; 
     18$js .= `cat tmpl/cms/include/calendar.tmpl`; 
    1719 
    1820foreach my $lang (qw(ja de nl fr es)) { 
  • branches/athena/build/sample.pm

    r1089 r1093  
    7575    '[_1] Editing Menu' => '', 
    7676    'Entries' => '', 
    77     'Create New Entry' => '', 
     77    'Create Entry' => '', 
    7878    'List & Edit Entries' => '', 
    7979    'Upload File' => '', 
     
    313313    'You must set your Site URL.' => '', 
    314314    'You did not select a timezone.' => '', 
    315     'Create new weblog' => '', 
     315    'Create weblog' => '', 
    316316    'Your weblog configuration has been saved.' => '', 
    317317    'Name your weblog. The weblog name can be changed at any time.' => '', 
     
    431431    'Delete, view, and edit authors via a complete list of authors in the system.' => '', 
    432432    'General Permissions' => '', 
    433     'User can create new weblogs' => '', 
     433    'User can create weblogs' => '', 
    434434    'User can view activity log' => '', 
    435435    'Weblog:' => '', 
     
    457457    ## Template-editing screen (edit_template.tmpl) 
    458458    'List Templates' => '', 
    459     'Create New Template' => '', 
     459    'Create Template' => '', 
    460460    'Edit Template' => '', 
    461461    'Template Name' => '', 
     
    512512    ## Main Menu screen (list_blog.tmpl) 
    513513    '[_1]: Welcome to the Main Menu' => '', 
    514     'Select an existing weblog to edit, create new weblogs, add/edit authors, and edit your personal information.' => '', 
     514    'Select an existing weblog to edit, create weblogs, add/edit authors, and edit your personal information.' => '', 
    515515    'Your selected weblog has been deleted.' => '', 
    516516    'Your existing weblogs:' => '', 
     
    522522    'Manage Weblog' => '', 
    523523    'Delete Weblog' => '', 
    524     'Create new Weblog' => '', 
     524    'Create Weblog' => '', 
    525525    'Add/Edit Weblog authors' => '', 
    526526    'Add authors, set permissions' => '', 
     
    570570    'You have successfully deleted the checked template(s).' => '', 
    571571    'Index templates' => '', 
    572     'Create new index template' => '', 
     572    'Create index template' => '', 
    573573    'Rebuild?' => '', 
    574574    'Archive-Related Templates' => '', 
    575     'Create new archive template' => '', 
     575    'Create archive template' => '', 
    576576    'Miscellaneous Templates' => '', 
    577577    'Template Modules' => '', 
    578     'Create new template module' => '', 
     578    'Create template module' => '', 
    579579 
    580580    ## Login screen (login.tmpl) 
     
    825825    "You do not have export permissions" => "", 
    826826    "Export failed on entry '[_1]': [_2]" => "", 
    827     "You need to provide a password if you are going to\ncreate new authors for each author listed in your blog.\n" => "", 
     827    "You need to provide a password if you are going to\ncreate authors for each author listed in your blog.\n" => "", 
    828828    "Can't open directory '[_1]': [_2]" => "", 
    829829    "Can't open file '[_1]': [_2]" => "", 
  • branches/athena/build/theme_templates/modules/content.css.tt

    r1090 r1093  
    3636} 
    3737 
    38 .asset-footer, 
    39 .asset-footer a, 
    4038.comment-footer, 
    4139.comment-footer a, 
     
    5452.search-form-header, 
    5553.search-results-header { 
    56     color: [% theme.content.header2.color || theme.widget.header.color || theme.default.header.color %]; 
     54    color: [% theme.content.header2.color || theme.default.header.color %]; 
    5755} 
    5856 
  • branches/athena/build/theme_templates/modules/default/screen.css.tt

    r1092 r1093  
    6161 
    6262.asset-meta { 
    63     margin-top: .25em; 
    64     padding-top: 2px; 
    65     font-weight: normal; 
     63    border-top: [% theme.content.post_name.border.width || '1px' %] [% theme.content.post_name.border.style || 'solid' %] [% theme.content.post_name.border.color || theme.default.border.color %]; 
     64} 
    6665 
    67     display: block; 
    68     border-top: [% theme.content.post_name.border.width || '1px' %] [% theme.content.post_name.border.style || 'dashed' %] [% theme.content.post_name.border.color || theme.default.border.color %]; 
    69     padding-bottom: .3em; 
     66.asset-footer { 
     67    border-top: [% theme.content.post_name.border.width || '1px' %] [% theme.content.post_name.border.style || 'solid' %] [% theme.content.post_name.border.color || theme.default.border.color %]; 
    7068} 
    7169 
  • branches/athena/build/theme_templates/modules/header/basic.css.tt

    r1089 r1093  
    1515} 
    1616 
     17[%+ IF theme.header.text.height -%] 
     18* html #header-content {  /*HACK targets IE6 but not 7, instead of min-height*/ 
     19    height: [% theme.header.text.height %]; 
     20} 
     21[%+ END -%] 
    1722#header-content { 
     23    width: [% theme.header.text.width || '842px' %]; 
     24[% IF theme.header.text.height %] 
     25    min-height: [% theme.header.text.height %]; 
     26[% END %] 
    1827    margin: [% theme.header.content.margin || '20px 0 60px 20px' %]; 
    1928} 
  • branches/athena/build/theme_templates/modules/header/unity.css.tt

    r1089 r1093  
    2424 
    2525#header-content { 
    26     margin-top: 10px; 
     26    margin: 10px 20px 0; 
    2727} 
    2828 
  • branches/athena/build/theme_templates/modules/layout.css.tt

    r1089 r1093  
    99} 
    1010 
    11 #beta-inner, #gamma-inner { 
     11#header-inner, #beta-inner, #gamma-inner { 
    1212    padding-right: 0; 
    1313    padding-left: 0; 
  • branches/athena/default_templates/atom.mtml

    r1088 r1093  
    2828    </MTEntryTags></MTEntryIfTagged> 
    2929    <content type="html" xml:lang="<$MTBlogLanguage ietf="1"$>" xml:base="<$MTBlogURL encode_xml="1"$>"> 
    30         <$MTEntryBody encode_xml="1" convert_breaks="0"$> 
    31         <$MTEntryMore encode_xml="1" convert_breaks="0"$> 
     30        <$MTEntryBody encode_xml="1"$> 
     31        <$MTEntryMore encode_xml="1"$> 
    3232    </content> 
    3333</entry> 
  • branches/athena/default_templates/base_theme.mtml

    r1092 r1093  
    214214/* Assets */ 
    215215 
     216.asset-body, 
     217.asset-more, 
     218.asset-more-link, 
     219.asset-excerpt, 
     220.comment-content, 
     221.comment-footer, 
     222.comments-open-content, 
     223.comments-open-footer, 
     224.comments-closed, 
     225.trackbacks-info, 
     226.trackback-content, 
     227.trackback-footer, 
     228.archive-content { 
     229    clear: both; 
     230} 
     231 
     232.asset, 
     233.comments, 
     234.trackbacks, 
     235.archive { 
     236    overflow: hidden; 
     237    width: 100%; 
     238} 
     239 
     240.asset, 
     241.asset-content, 
     242.comments, 
     243.trackbacks, 
     244.archive { 
     245    position: static; 
     246    clear: both; 
     247} 
     248 
    216249.asset, 
    217250.comments, 
     
    226259.asset-content, 
    227260.asset-body, 
    228 .entry-categories, 
    229 .entry-tags, 
    230261.comments-header, 
    231262.comment-header, 
     
    253284} 
    254285 
     286.entry-categories, 
     287.entry-tags { 
     288    margin-bottom: .5em; 
     289} 
     290 
    255291.asset-name { 
    256292    margin-bottom: .25em; 
    257293} 
    258294 
     295.asset-footer, 
    259296.asset-meta { 
    260297    font-size: 11px; 
    261298} 
    262299 
     300.asset-meta { 
     301    margin-top: .25em; 
     302    padding-top: 2px; 
     303    padding-bottom: .3em; 
     304    font-weight: normal; 
     305} 
     306 
     307.asset-footer { 
     308    margin-top: 1.5em; 
     309    padding-top: .5em; 
     310} 
     311 
    263312.content-nav { 
    264313    text-align: center; 
    265314} 
    266315 
    267 .asset, 
    268 .comments, 
    269 .trackbacks, 
    270 .archive { 
    271     overflow: hidden; 
    272     width: 100%; 
    273 } 
    274  
    275 .asset, 
    276 .asset-content, 
    277 .comments, 
    278 .trackbacks, 
    279 .archive { 
    280     position: static; 
    281     clear: both; 
    282 } 
    283  
    284 .asset-body, 
    285 .asset-more, 
    286 .asset-more-link, 
    287 .asset-excerpt, 
    288 .comment-content, 
    289 .comment-footer, 
    290 .comments-open-content, 
    291 .comments-open-footer, 
    292 .comments-closed, 
    293 .trackbacks-info, 
    294 .trackback-content, 
    295 .trackback-footer, 
    296 .archive-content { 
    297     clear: both; 
     316.entry-tags-header, 
     317.entry-categories-header { 
     318    margin-bottom: 0; 
     319    margin-right: .25em; 
     320    display: inline; 
     321    font-weight: bold; 
     322} 
     323 
     324.entry-tags-list, 
     325.entry-categories-list { 
     326    display: inline; 
     327    list-style: none; 
     328    margin-left: 0; 
     329    padding-left: 0; 
     330} 
     331.entry-tags-list .entry-tag, 
     332.entry-categories-list .entry-category { 
     333    display: inline; 
    298334} 
    299335 
     
    407443    width: 70px; 
    408444} 
     445 
     446.widget-search .search-options, 
     447.widget-syndicate .blog-feeds  { 
     448    list-style: none; 
     449    margin: 5px 0; 
     450} 
  • branches/athena/default_templates/categories.mtml

    r1088 r1093  
    11<MTIfNonEmpty tag="EntryCategory"> 
    22<div class="entry-categories"> 
    3     <h4 class="entry-categories-header"><__trans phrase="Categories"></h4> 
    4     <span class="entry-categories-list"> 
    5     <MTEntryCategories glue=", "> 
    6         <span class="entry-category"><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></span> 
    7     </MTEntryCategories> 
    8     </span> 
     3    <h4 class="entry-categories-header"><__trans phrase="Categories"><span class="delimiter">:</span></h4> 
     4    <ul class="entry-categories-list"> 
     5        <li class="entry-category"><MTEntryCategories glue="<span class="delimiter">,</span></li> <li class="entry-category">"><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></MTEntryCategories></li> 
     6    </ul> 
    97</div> 
    108</MTIfNonEmpty> 
  • branches/athena/default_templates/entry_detail.mtml

    r1092 r1093  
    1515        </div> 
    1616</MTIfNonEmpty> 
    17 <MTIf name="entry_template"> 
    18         <$MTInclude module="<__trans phrase="Categories">"$> 
    19 </MTIf> 
    20         <$MTInclude module="<__trans phrase="Tags">"$> 
    2117    </div> 
    22     <div class="asset-footer"></div> 
     18    <div class="asset-footer"> 
     19        <MTIf name="entry_template"> 
     20                <$MTInclude module="<__trans phrase="Categories">"$> 
     21        </MTIf> 
     22                <$MTInclude module="<__trans phrase="Tags">"$> 
     23    </div> 
    2324</div> 
  • branches/athena/default_templates/entry_listing.mtml

    r1088 r1093  
    2626    </MTEntries> 
    2727<MTElse> 
    28         <MTEntries limit="auto"> 
     28    <MTEntries limit="auto"> 
    2929<$MTEntryTrackbackData$> 
    3030<$MTInclude module="<__trans phrase="Entry Summary">"$> 
    31         </MTEntries> 
     31    </MTEntries> 
    3232</MTIf> 
    3333 
  • branches/athena/default_templates/page_detail.mtml

    r1088 r1093  
    1515</MTIfNonEmpty> 
    1616    </div> 
     17    <div class="asset-footer"></div> 
    1718</div> 
  • branches/athena/default_templates/rss.mtml

    r1088 r1093  
    1313        <item> 
    1414            <title><$MTEntryTitle remove_html="1" encode_xml="1"$></title> 
    15             <description><$MTEntryBody encode_xml="1" convert_breaks="0"$></description> 
     15            <description><$MTEntryBody encode_xml="1"$></description> 
    1616            <link><$MTEntryPermalink encode_xml="1"$></link> 
    1717            <guid><$MTEntryPermalink encode_xml="1"$></guid> 
  • branches/athena/default_templates/search_results.mtml

    r1090 r1093  
    1111<$MTInclude module="<__trans phrase="Header">"$> 
    1212 
    13 <MTIfStraightSearch> 
    14 <div class="search-form"> 
    15     <div class="search-form-header"><__trans phrase="Search this site"></div> 
    16     <div class="search-form-content"> 
    17         <form method="post" action="<$MTCGIPath$><$MTSearchScript$>" id="search-form"> 
    18             <input type="hidden" name="IncludeBlogs" value="<$MTSearchIncludeBlogs$>" /> 
    19             <div> 
    20                 <input type="text" size="30" name="search" id="search" value="<$MTSearchString$>" /> 
    21                 <input type="submit" value="<__trans phrase="Search">" /> 
    22             </div> 
    23             <div id="search-options"> 
    24                 <input type="checkbox" name="CaseSearch" /> <__trans phrase="Match case"> 
    25                 &#160; 
    26                 <input type="checkbox" name="RegexSearch" /> <__trans phrase="Regex search"> 
    27             </div> 
    28         </form> 
    29     </div> 
    30 </div> 
    31 </MTIfStraightSearch> 
    32  
    3313<MTSearchResults> 
    3414    <MTBlogResultHeader> 
    3515<h1 class="search-results-header"> 
    3616        <MTIfStraightSearch> 
    37     <__trans phrase="Matching entries matching &ldquo;[_1]&rdquo; from [_2]" params="<$MTSearchString$>%%<$MTBlogName$>"> 
     17    <__trans phrase="Results matching &ldquo;[_1]&rdquo; from [_2]" params="<$MTSearchString$>%%<$MTBlogName encode_html="1"$>"> 
    3818        </MTIfStraightSearch> 
    3919        <MTIfTagSearch> 
    40     <__trans phrase="Entries tagged with &ldquo;[_1]&rdquo; from [_2]" params="<$MTSearchString$>%%<$MTBlogName$>"> 
     20    <__trans phrase="Results tagged &ldquo;[_1]&rdquo; from [_2]" params="<$MTSearchString$>%%<$MTBlogName encode_html="1"$>"> 
    4121        </MTIfTagSearch> 
    4222</h1> 
     
    5232<h1 class="search-results-header"> 
    5333    <MTIfStraightSearch> 
    54     <__trans phrase="Entries matching &ldquo;[_1]&rdquo;" params="<$MTSearchString$>"> 
     34    <__trans phrase="Results matching &ldquo;[_1]&rdquo;" params="<$MTSearchString$>"> 
    5535    </MTIfStraightSearch> 
    5636    <MTIfTagSearch> 
    57     <__trans phrase="Entries tagged with &ldquo;[_1]&rdquo;" params="<$MTSearchString$>"> 
     37    <__trans phrase="Results tagged &ldquo;[_1]&rdquo;" params="<$MTSearchString$>"> 
    5838    </MTIfTagSearch> 
    5939</h1> 
    60 <p><__trans phrase="No pages were found containing &ldquo;[_1]&rdquo;." params="<$MTSearchString$>"></p> 
     40<p><__trans phrase="No results found for &ldquo;[_1]&rdquo;." params="<$MTSearchString$>"></p> 
    6141</MTNoSearchResults> 
    6242 
  • branches/athena/default_templates/sidebar_2col.mtml

    r1091 r1093  
    11<div id="beta"> 
    22    <div id="beta-inner"> 
     3        <div class="widget-search widget"> 
     4            <h3 class="widget-header"><__trans phrase="Search"></h3> 
     5            <div class="widget-content"> 
     6                <form method="get" action="<$MTCGIPath$><$MTSearchScript$>"> 
     7                    <input id="search" name="search" size="20" value="<$MTSearchString$>" /> 
     8        <MTIf name="search_results_template"> 
     9                    <input type="hidden" name="IncludeBlogs" value="<$MTSearchIncludeBlogs$>" /> 
     10                    <ul class="search-options"> 
     11                        <li><input type="checkbox" name="CaseSearch" /> <__trans phrase="Case sensitive"></li> 
     12                        <li><input type="checkbox" name="RegexSearch" /> <__trans phrase="Regex search"></li> 
     13                    </ul> 
     14        <mt:else> 
     15                    <input type="hidden" name="IncludeBlogs" value="<$MTBlogID$>" /> 
     16        </mt:if> 
     17                    <input type="submit" value="<__trans phrase="Search">" /> 
     18                </form> 
     19            </div> 
     20        </div> 
    321<MTIf name="search_results_template"> 
    4     <MTIfTagSearch> 
    5         <MTSetVar name="search_feed_param" value="tag"> 
    6         <MTSetVarBlock name="search_feed_description"><__trans phrase="If you use an RSS reader, you can subscribe to a feed of all future entries tagged &ldquo;<$MTSearchString$>&rdquo;."></MTSetVarBlock> 
    7     <MTElse> 
    8         <MTSetVar name="search_feed_param" value="search"> 
    9         <MTSetVarBlock name="search_feed_description"><__trans phrase="If you use an RSS reader, you can subscribe to a feed of all future entries matching &ldquo;<$MTSearchString$>&rdquo;."></MTSetVarBlock> 
    10     </MTIfTagSearch> 
    11         <div class="widget-search-feed widget"> 
    12             <h3 class="widget-header"><__trans phrase="Feed Subscription"></h3> 
    13             <div class="widget-content"> 
    14                 <p><$MTGetVar name="search_feed_description"$></p> 
    15                 <p><img src="<$MTStaticWebPath$>images/status_icons/feed.gif" alt="<__trans phrase="Subscribe to feed">" width="9" height="9" /> <a href="<$MTCGIPath$><$MTSearchScript$>?<$MTGetVar name="search_feed_param"$>=<$MTSearchString encode_url="1"$>&amp;Template=feed&amp;IncludeBlogs=<$MTSearchIncludeBlogs$>" title="<__trans phrase="Subscribe to feed">"><__trans phrase="Subscribe to feed"></a></p> 
    16             </div> 
    17         </div> 
    1822    <MTIfTagSearch> 
    1923        <div class="widget-tags widget"> 
     
    2933    </MTIfTagSearch> 
    3034</MTIf> 
    31         <div class="widget-search widget"> 
    32             <h3 class="widget-header"><__trans phrase="Search"></h3> 
    33             <div class="widget-content"> 
    34                 <form method="get" action="<$MTCGIPath$><$MTSearchScript$>"> 
    35                     <input type="hidden" name="IncludeBlogs" value="<$MTBlogID$>" /> 
    36                     <input id="search" name="search" size="20" value="<$MTSearchString encode_html="1"$>" /> 
    37                     <input type="submit" value="<__trans phrase="Search">" /> 
    38                 </form> 
    39             </div> 
    40         </div> 
    4135<MTIf name="module_about_context"> 
    4236        <div class="widget-welcome widget"> 
     
    202196            <MTArchiveListHeader> 
    203197        <div class="widget-archives widget"> 
    204             <h3 class="widget-header"><__trans phrase="[_1] <a href="[_2]">Archives</a>" params="<$MTArchiveLabel$>%%<$MTBlogURL$>archives.html"></h3> 
     198            <h3 class="widget-header"><__trans phrase="[_1] <a href="[_2]">Archives</a>" params="<$MTArchiveTypeLabel$>%%<$MTBlogURL$>archives.html"></h3> 
    205199            <div class="widget-content"> 
    206200                <ul class="widget-list"> 
     
    253247        <div class="widget-syndicate widget"> 
    254248            <div class="widget-content"> 
    255                 <img src="<$MTStaticWebPath$>images/status_icons/feed.gif" alt="<__trans phrase="Subscribe to feed">" width="9" height="9" /> 
    256                 <a href="<$MTLink template="atom"$>"><__trans phrase="Subscribe to this blog's feed"></a> 
     249                <ul class="blog-feeds"> 
     250                    <li class="blog feed"><img src="<$MTStaticWebPath$>images/status_icons/feed.gif" alt="<__trans phrase="Subscribe to feed">" width="9" height="9" /> <a href="<$MTLink template="atom"$>"><__trans phrase="Subscribe to this blog's feed"></a></li> 
     251    <MTIf name="search_results_template"> 
     252        <mt:ifnonempty tag="MTSearchString"> 
     253                    <li class="search-results-feed"><img src="<$MTStaticWebPath$>images/status_icons/feed.gif" alt="<__trans phrase="Subscribe to feed">" width="9" height="9" /> <a href="<$MTCGIPath$><$MTSearchScript$>?<MTIfTagSearch>tag<MTElse>search</MTIfTagSearch>=<$MTSearchString encode_url="1"$>&amp;Template=feed&amp;IncludeBlogs=<$MTSearchIncludeBlogs$>" title="<__trans phrase="Subscribe to feed">"><__trans phrase="Search results matching &ldquo;<$MTSearchString$>&rdquo;"></a></li> 
     254        </mt:ifnonempty> 
     255    </MTIf> 
     256                </ul> 
    257257            </div> 
    258258        </div> 
  • branches/athena/default_templates/sidebar_3col.mtml

    r1091 r1093  
    112112            <MTArchiveListHeader> 
    113113        <div class="widget-archives widget"> 
    114             <h3 class="widget-header"><__trans phrase="[_1] <a href="[_2]">Archives</a>" params="<$MTArchiveLabel$>%%<$MTBlogURL$>archives.html"></h3> 
     114            <h3 class="widget-header"><__trans phrase="[_1] <a href="[_2]">Archives</a>" params="<$MTArchiveTypeLabel$>%%<$MTBlogURL$>archives.html"></h3> 
    115115            <div class="widget-content"> 
    116116                <ul class="widget-list"> 
     
    163163        <div class="widget-syndicate widget"> 
    164164            <div class="widget-content"> 
    165                 <img src="<$MTStaticWebPath$>images/status_icons/feed.gif" alt="<__trans phrase="Subscribe to feed">" width="9" height="9" /> 
    166                 <a href="<$MTLink template="atom"$>"><__trans phrase="Subscribe to this blog's feed"></a> 
     165                <ul class="blog-feeds"> 
     166                    <li class="blog feed"><img src="<$MTStaticWebPath$>images/status_icons/feed.gif" alt="<__trans phrase="Subscribe to feed">" width="9" height="9" /> <a href="<$MTLink template="atom"$>"><__trans phrase="Subscribe to this blog's feed"></a></li> 
     167    <MTIf name="search_results_template"> 
     168        <mt:ifnonempty tag="MTSearchString"> 
     169                    <li class="search-results-feed"><img src="<$MTStaticWebPath$>images/status_icons/feed.gif" alt="<__trans phrase="Subscribe to feed">" width="9" height="9" /> <a href="<$MTCGIPath$><$MTSearchScript$>?<MTIfTagSearch>tag<MTElse>search</MTIfTagSearch>=<$MTSearchString encode_url="1"$>&amp;Template=feed&amp;IncludeBlogs=<$MTSearchIncludeBlogs$>" title="<__trans phrase="Subscribe to feed">"><__trans phrase="Search results matching &ldquo;<$MTSearchString$>&rdquo;"></a></li> 
     170        </mt:ifnonempty> 
     171    </MTIf> 
     172                </ul> 
    167173            </div> 
    168174        </div> 
     
    176182<div id="gamma"> 
    177183    <div id="gamma-inner"> 
     184        <div class="widget-search widget"> 
     185            <h3 class="widget-header"><__trans phrase="Search"></h3> 
     186            <div class="widget-content"> 
     187                <form method="get" action="<$MTCGIPath$><$MTSearchScript$>"> 
     188                    <input id="search" name="search" size="20" value="<$MTSearchString$>" /> 
     189        <MTIf name="search_results_template"> 
     190                    <input type="hidden" name="IncludeBlogs" value="<$MTSearchIncludeBlogs$>" /> 
     191                    <ul class="search-options"> 
     192                        <li><input type="checkbox" name="CaseSearch" /> <__trans phrase="Case sensitive"></li> 
     193                        <li><input type="checkbox" name="RegexSearch" /> <__trans phrase="Regex search"></li> 
     194                    </ul> 
     195        <mt:else> 
     196                    <input type="hidden" name="IncludeBlogs" value="<$MTBlogID$>" /> 
     197        </mt:if> 
     198                    <input type="submit" value="<__trans phrase="Search">" /> 
     199                </form> 
     200            </div> 
     201        </div> 
    178202<MTIf name="search_results_template"> 
    179     <MTIfTagSearch> 
    180         <MTSetVar name="search_feed_param" value="tag"> 
    181         <MTSetVarBlock name="search_feed_description"><__trans phrase="If you use an RSS reader, you can subscribe to a feed of all future entries tagged &ldquo;<$MTSearchString$>&rdquo;."></MTSetVarBlock> 
    182     <MTElse> 
    183         <MTSetVar name="search_feed_param" value="search"> 
    184         <MTSetVarBlock name="search_feed_description"><__trans phrase="If you use an RSS reader, you can subscribe to a feed of all future entries matching &ldquo;<$MTSearchString$>&rdquo;."></MTSetVarBlock> 
    185     </MTIfTagSearch> 
    186         <div class="widget-search-feed widget"> 
    187             <h3 class="widget-header"><__trans phrase="Feed Subscription"></h3> 
    188             <div class="widget-content"> 
    189                 <p><$MTGetVar name="search_feed_description"$></p> 
    190                 <p><img src="<$MTStaticWebPath$>images/status_icons/feed.gif" alt="<__trans phrase="Subscribe to feed">" width="9" height="9" /> <a href="<$MTCGIPath$><$MTSearchScript$>?<$MTGetVar name="search_feed_param"$>=<$MTSearchString encode_url="1"$>&amp;Template=feed&amp;IncludeBlogs=<$MTSearchIncludeBlogs$>" title="<__trans phrase="Subscribe to feed">"><__trans phrase="Subscribe to feed"></a></p> 
    191             </div> 
    192         </div> 
    193203    <MTIfTagSearch> 
    194204        <div class="widget-tags widget"> 
     
    204214    </MTIfTagSearch> 
    205215</MTIf> 
    206         <div class="widget-search widget"> 
    207             <h3 class="widget-header"><__trans phrase="Search"></h3> 
    208             <div class="widget-content"> 
    209                 <form method="get" action="<$MTCGIPath$><$MTSearchScript$>"> 
    210                     <input type="hidden" name="IncludeBlogs" value="<$MTBlogID$>" /> 
    211                     <input id="search" name="search" size="20" value="<$MTSearchString encode_html="1"$>" /> 
    212                     <input type="submit" value="<__trans phrase="Search">" /> 
    213                 </form> 
    214             </div> 
    215         </div> 
    216216<MTIf name="module_recent_entries"> 
    217217        <div class="widget-archives widget"> 
  • branches/athena/default_templates/tags.mtml

    r1088 r1093  
    11<MTEntryIfTagged> 
    22<div class="entry-tags"> 
    3     <h4 class="entry-tags-header"><__trans phrase="Tags"></h4> 
     3    <h4 class="entry-tags-header"><__trans phrase="Tags"><span class="delimiter">:</span></h4> 
    44    <ul class="entry-tags-list"> 
    5     <MTEntryTags> 
    6         <li class="entry-tag"><a href="<$MTTagSearchLink$>&amp;IncludeBlogs=<$MTBlogID$>" rel="tag"><$MTTagName$></a></li> 
    7     </MTEntryTags> 
     5        <li class="entry-tag"><MTEntryTags glue="<span class="delimiter">,</span></li> <li class="entry-tag">"><a href="<$MTTagSearchLink$>&amp;IncludeBlogs=<$MTBlogID$>" rel="tag"><$MTTagName$></a></MTEntryTags></li> 
    86    </ul> 
    97</div> 
  • branches/athena/lib/MT.pm.pre

    r1091 r1093  
    847847      unless $cfg->ObjectDriver; 
    848848 
    849     $cfg->read_config_db(); 
    850  
    851     # Tell any instantiated drivers to reconfigure themselves as necessary 
    852     MT::ObjectDriverFactory->configure; 
    853  
    854849    if ( $MT::DebugMode = $cfg->DebugMode ) { 
    855850        require Data::Dumper; 
     
    868863 
    869864    $mt->{cfg} = $cfg; 
     865 
     866    1; 
     867} 
     868 
     869sub init_config_from_db { 
     870    my $mt = shift; 
     871    my ($param) = @_; 
     872    my $cfg = $mt->config; 
     873    $cfg->read_config_db(); 
     874 
     875    # Tell any instantiated drivers to reconfigure themselves as necessary 
     876    MT::ObjectDriverFactory->configure; 
    870877 
    871878    1; 
     
    982989    ## the rest of the initialization process. 
    983990    $mt->init_config( \%param ) or return; 
     991    $mt->init_addons(@_)       or return; 
     992    $mt->init_config_from_db( \%param ) or return; 
    984993    $mt->init_plugins(@_)       or return; 
    985994    $plugins_installed = 1; 
     
    9971006    MT->add_callback( 'build_file_filter', 5, $mt, 
    9981007        sub { MT->publisher->queue_build_file_filter(@_) } ); 
     1008} 
     1009 
     1010sub init_addons { 
     1011    my $mt = shift; 
     1012    my $cfg = $mt->config; 
     1013    my @PluginPaths; 
     1014 
     1015    unshift @PluginPaths, File::Spec->catdir( $MT_DIR, 'addons' ); 
     1016    return $mt->_init_plugins_core({}, 1, \@PluginPaths); 
    9991017} 
    10001018 
     
    10111029    my @PluginPaths  = $cfg->PluginPath; 
    10121030    my $PluginSwitch = $cfg->PluginSwitch || {}; 
    1013  
    1014     # Always process 'addons' directory 
    1015     unshift @PluginPaths, File::Spec->catdir( $MT_DIR, 'addons' ); 
    1016  
    1017     foreach my $PluginPath (@PluginPaths) { 
     1031    return $mt->_init_plugins_core($PluginSwitch, $use_plugins, \@PluginPaths); 
     1032} 
     1033 
     1034sub _init_plugins_core { 
     1035    my $mt = shift; 
     1036    my ($PluginSwitch, $use_plugins, $PluginPaths) = @_; 
     1037 
     1038    foreach my $PluginPath (@$PluginPaths) { 
    10181039        my $plugin_lastdir = $PluginPath; 
    10191040        $plugin_lastdir =~ s![\\/]$!!; 
  • branches/athena/lib/MT/App.pm

    r1091 r1093  
    4040 
    4141sub core_widgets { 
     42    {} 
     43} 
     44 
     45sub core_search_apis { 
    4246    {} 
    4347} 
     
    115119    my $admin = ($user && $user->is_superuser()) 
    116120        || ($perms && $perms->blog_id && $perms->has('administer_blog')); 
     121    my $system_perms = $user->permissions(0) unless $perms && $perms->blog_id; 
    117122 
    118123    my $test = sub { 
    119124        my ($item) = @_; 
     125        if ( $system_perms 
     126          && (my $sp = $item->{system_permission}) ) { 
     127            my $allowed = 0; 
     128            my @sp = split /,/, $sp; 
     129            foreach my $sp (@sp) { 
     130                my $perm = 'can_' . $sp; 
     131                $allowed = 1, last 
     132                    if $admin || ($system_perms && $system_perms->can($perm) && $system_perms->$perm()); 
     133            } 
     134            return 0 unless $allowed; 
     135        } 
    120136        if (my $p = $item->{permission}) { 
    121137            my $allowed = 0; 
     
    207223    @$filters = sort { $a->{order} <=> $b->{order} } @$filters; 
    208224    return $filters; 
     225} 
     226 
     227sub search_apis { 
     228    my $app = shift; 
     229    my ($view, @param) = @_; 
     230 
     231    my $apis = $app->registry("search_apis") or return; 
     232    my @apis; 
     233    foreach my $a (keys %$apis) { 
     234        next if $apis->{$a}->{view} && $apis->{$a}->{view} ne $view; 
     235        $apis->{$a}{key} = $a; 
     236        $apis->{$a}{core} = 1 
     237            unless UNIVERSAL::isa($apis->{$a}{plugin}, 'MT::Plugin'); 
     238        push @apis, $apis->{$a}; 
     239    } 
     240    $apis = $app->filter_conditional_list(\@apis, @param); 
     241    no warnings; 
     242    @$apis = sort { $a->{order} <=> $b->{order} } @$apis; 
     243    return $apis; 
    209244} 
    210245 
     
    350385        $args->{sort} = 'id' 
    351386          unless exists $args->{sort};    # must always provide sort column 
     387 
     388        $app->run_callbacks( 'app_pre_listing_'.$app->mode, 
     389                             $app, $terms, $args, $param, \$hasher ); 
     390 
    352391        my $iter = 
    353392          ref($iter_method) eq 'CODE' 
     
    359398            my $row = $obj->column_values(); 
    360399            $hasher->( $obj, $row ) if $hasher; 
     400            #$app->run_callbacks( 'app_listing_'.$app->mode, 
     401            #                     $app, $obj, $row ); 
    361402            push @data, $row; 
    362403            last if (scalar @data == $limit) && (!$no_limit); 
     
    18981939        } 
    18991940    } 
     1941  
     1942    for my $addon ( @{ $app->find_addons('pack') } ) { 
     1943        push @paths, File::Spec->catdir($addon->{path}, 'tmpl', $app->{template_dir}) 
     1944            if $app->{template_dir}; 
     1945        push @paths, File::Spec->catdir($addon->{path}, 'tmpl'); 
     1946    } 
     1947 
    19001948    push @paths, File::Spec->catdir($path, $app->{template_dir}) 
    19011949        if $app->{template_dir}; 
    19021950    push @paths, $path; 
     1951  
    19031952    return @paths; 
    19041953} 
  • branches/athena/lib/MT/App/CMS.pm

    r1092 r1093  
    182182        'recover_profile_password' => \&recover_profile_password, 
    183183        'rename_tag'               => \&rename_tag, 
    184         'synchronize'              => \&synchronize, 
    185184        'remove_user_assoc'        => \&remove_user_assoc, 
    186185        'revoke_role'              => \&revoke_role, 
     
    205204        'dialog_post_comment'    => \&dialog_post_comment, 
    206205        'dialog_select_weblog'   => \&dialog_select_weblog, 
    207         'dialog_select_user'     => \&dialog_select_user, 
    208206        'dialog_select_sysadmin' => \&dialog_select_sysadmin, 
    209207        'dialog_grant_role'      => \&dialog_grant_role, 
     
    293291    my $obj_class    = $app->model($obj_ds) or return; 
    294292    my $tag_name     = $app->param('tag') or return; 
     293    if ( 'utf-8' ne lc( $app->config->PublishCharset) ) { 
     294        $tag_name = MT::I18N::encode_text( $tag_name, 'utf-8', $app->config->PublishCharset ); 
     295    } 
    295296    my $tag_obj = 
    296297      $tag_class->load( { name => $tag_name }, { binary => { name => 1 } } ); 
     
    13151316            args       => { _type => "author" }, 
    13161317            permission => "administer", 
     1318            condition  => sub { 
     1319                return !MT->config->ExternalUserManagement; 
     1320            }, 
    13171321        }, 
    13181322        'create:entry' => { 
     
    13631367            mode       => 'list_comments', 
    13641368            order      => 2000, 
    1365             permission => 'post,edit_all_posts,manage_feedback,comment', 
     1369            permission => 'create_post,edit_all_posts,manage_feedback,comment', 
    13661370        }, 
    13671371        'manage:asset' => { 
     
    13811385            mode       => 'list_pings', 
    13821386            order      => 5000, 
    1383             permission => 'post,edit_all_posts,manage_feedback', 
     1387            permission => 'create_post,edit_all_posts,manage_feedback', 
    13841388        }, 
    13851389        'manage:category' => { 
     
    21272131        my $blog = $blogs{ $obj->blog_id } ||= $obj->blog; 
    21282132        $row->{blog_name} = $blog ? $blog->name : '-'; 
    2129         $row->{file_path} = $obj->file_path; # has to be called to calculate 
    21302133        $row->{url} = $obj->url; # this has to be called to calculate 
    2131         $row->{file_name} = File::Basename::basename( $row->{file_path} ); 
    2132         my $meta = $obj->metadata; 
    2133         $row->{file_label} = $obj->label; 
    2134         if ( -f $row->{file_path} ) { 
    2135             my @stat = stat( $row->{file_path} ); 
     2134        $row->{asset_class} = $obj->class_label; 
     2135        my $file_path = $obj->file_path; # has to be called to calculate 
     2136        if ( $file_path && ( -f $file_path ) ) { 
     2137            $row->{file_path} = $file_path; 
     2138            $row->{file_name} = File::Basename::basename( $file_path ); 
     2139            my @stat = stat( $file_path ); 
    21362140            my $size = $stat[7]; 
    2137             my ($thumb_file) = $obj->thumbnail_url( Height => 240, Width => 350 ); 
    2138             $row->{thumbnail_url} = $meta->{thumbnail_url} = $thumb_file; 
    2139             $row->{asset_class} = $obj->class_label; 
    2140             $row->{file_size}   = $size; 
     2141            $row->{file_size} = $size; 
    21412142            if ( $size < 1024 ) { 
    21422143                $row->{file_size_formatted} = sprintf( "%d Bytes", $size ); 
     
    21522153        } 
    21532154        else { 
    2154             $row->{file_is_missing} = 1; 
    2155         } 
     2155            $row->{file_is_missing} = 1 if $file_path; 
     2156        } 
     2157        $row->{file_label} = $row->{label} = $obj->label || $row->{file_name} || $app->translate('Untitled'); 
     2158 
     2159        my $meta = $obj->metadata; 
     2160        if ($obj->has_thumbnail) {  
     2161            $row->{has_thumbnail} = 1; 
     2162            my ($thumb_file) = $obj->thumbnail_url( Height => 240, Width => 350 ); 
     2163            $row->{thumbnail_url} = $meta->{thumbnail_url} = $thumb_file; 
     2164        } 
     2165 
    21562166        my $ts = $obj->created_on; 
    21572167        if ( my $by = $obj->created_by ) { 
     
    22392249    $app->return_to_dashboard( redirect => 1 ) if $app->param('blog_id'); 
    22402250 
    2241     my $group_id  = $app->param('group_id'); 
    2242     my $author_id = $app->param('author_id'); 
    2243  
    22442251    my $pref = $app->list_pref('role'); 
    22452252    my $all_perms; 
     
    22522259    } 
    22532260 
    2254     if ($group_id) { 
    2255         my $grp_class = $app->model('group') or return; 
    2256         if ( !$app->user->is_superuser ) { 
    2257             return $app->errtrans("Permission denied."); 
    2258         } 
    2259         my $grp = $grp_class->load($group_id) 
    2260           or return $app->error( $app->translate("Invalid group id") ); 
    2261         $app->add_breadcrumb( 
    2262             $app->translate("Users & Groups"), 
    2263             $app->uri( 
    2264                 mode => 'list_authors', 
    2265                 args => { group_id => $group_id } 
    2266             ) 
     2261    my $author_class = $app->model('author'); 
     2262    my $assoc_class  = $app->model('association'); 
     2263    my $hasher       = sub { 
     2264        my ( $obj, $row ) = @_; 
     2265        my $user_count = $assoc_class->count( 
     2266            { 
     2267                role_id   => $obj->id, 
     2268                author_id => [ 1, undef ], 
     2269            }, 
     2270            { 
     2271                unique     => 'author_id', 
     2272                range_incl => { author_id => 1 }, 
     2273            } 
    22672274        ); 
    2268         $app->add_breadcrumb( $app->translate("Group Roles") ); 
    2269         my $assoc_class = $app->model('association'); 
    2270         my $hasher      = sub { 
    2271             my ( $role, $param ) = @_; 
    2272  
    2273             # populate permissions for the expanded view 
    2274             if ( $pref->{view_expanded} ) { 
    2275                 my @perms; 
    2276                 foreach (@$all_perms) { 
    2277                     next unless length( $_->[1] || '' ); 
    2278                     push @perms, { name => $app->translate( $_->[1] ) } 
    2279                       if $role->has( $_->[0] ); 
    2280                 } 
    2281                 $param->{perm_loop} = \@perms; 
    2282             } 
    2283         }; 
    2284         $app->listing( 
     2275        $row->{members} = $user_count; 
     2276        $row->{weblogs} = $assoc_class->count( 
    22852277            { 
    2286                 type => 'role', 
    2287                 args => { 
    2288                     sort => 'name', 
    2289                     join => MT::Association->join_on( 
    2290                         'role_id', 
    2291                         { 
    2292                             type     => MT::Association::GROUP_BLOG_ROLE(), 
    2293                             group_id => $group_id, 
    2294                         } 
    2295                     ), 
    2296                 }, 
    2297                 code   => $hasher, 
    2298                 params => { 
    2299                     nav_authors        => 1, 
    2300                     edit_group_id      => $group_id, 
    2301                     group_display_name => $grp->display_name, 
    2302                     group_name         => $grp->name, 
    2303                     user_count         => $grp->user_count(), 
    2304                     list_noncron       => 1, 
    2305                     can_create_role    => $app->user->is_superuser, 
    2306                     has_expanded_mode  => 1, 
    2307                     search_label       => $app->translate('Users'), 
    2308                     object_type        => 'role', 
    2309                     group_support      => 1, 
    2310                 }, 
     2278                role_id => $obj->id, 
     2279                blog_id => [ 1, undef ], 
     2280            }, 
     2281            { 
     2282                unique     => 'blog_id', 
     2283                range_incl => { blog_id => 1 }, 
    23112284            } 
    23122285        ); 
    2313     } 
    2314     elsif ($author_id) { 
    2315         unless ( $app->user->is_superuser || ( $app->user->id == $author_id ) ) 
     2286        if ( $obj->created_by ) { 
     2287            my $user = $author_class->load( $obj->created_by ); 
     2288            $row->{created_by} = $user ? $user->name : ''; 
     2289        } 
     2290        else { 
     2291            $row->{created_by} = ''; 
     2292        } 
     2293 
     2294        # populate permissions for the expanded view 
     2295        if ( $pref->{view_expanded} ) { 
     2296            my @perms; 
     2297            foreach (@$all_perms) { 
     2298                next unless length( $_->[1] || '' ); 
     2299                push @perms, { name => $app->translate( $_->[1] ) } 
     2300                  if $obj->has( $_->[0] ); 
     2301            } 
     2302            $row->{perm_loop} = \@perms; 
     2303        } 
     2304    }; 
     2305    unless ( $app->user->is_superuser() ) { 
     2306        return $app->errtrans("Permission denied."); 
     2307    } 
     2308    $app->add_breadcrumb( $app->translate("Roles") ); 
     2309    $app->listing( 
    23162310        { 
    2317             return $app->errtrans("Permission denied."); 
    2318         } 
    2319         my $author_class = $app->model('author'); 
    2320         my $role_class   = $app->model('role'); 
    2321         my $assoc_class  = $app->model('association'); 
    2322         my $user         = $author_class->load($author_id) 
    2323           or return $app->error( $app->translate("Invalid user id") ); 
    2324         $app->add_breadcrumb( 
    2325             $app->translate("Users & Groups"), 
    2326             $app->user->is_superuser 
    2327             ? $app->uri( 
    2328                 mode => 'list_authors', 
    2329                 args => { author_id => $author_id } 
    2330               ) 
    2331             : undef 
    2332         ); 
    2333         $app->add_breadcrumb( $app->translate("User Roles") ); 
    2334         my $hasher = sub { 
    2335             my ( $obj, $param ) = @_; 
    2336             my $role = $obj->role; 
    2337             $param->{name} = $role->name; 
    2338             my $group = $obj->group; 
    2339             $param->{group_name} = 
    2340                 $group 
    2341               ? $group->display_name || $group->name 
    2342               : '-'; 
    2343             my $blog = $obj->blog; 
    2344             $param->{blog_name} = $blog ? $blog->name : '-'; 
    2345  
    2346             # populate permissions for the expanded view 
    2347             if ( $pref->{view_expanded} ) { 
    2348                 my @perms; 
    2349                 foreach (@$all_perms) { 
    2350                     next unless length( $_->[1] || '' ); 
    2351                     push @perms, { name => $app->translate( $_->[1] ) } 
    2352                       if $obj->has( $_->[0] ); 
    2353                 } 
    2354                 $param->{perm_loop} = \@perms; 
    2355             } 
    2356         }; 
    2357         $app->listing( 
    2358             { 
    2359                 args     => { sort => 'name' }, 
    2360                 type     => 'association', 
    2361                 template => 'list_role.tmpl', 
    2362                 terms    => { 
    2363                     type      => MT::Association::USER_BLOG_ROLE(), 
    2364                     author_id => $author_id 
    2365                 }, 
    2366                 code   => $hasher, 
    2367                 params => { 
    2368                     nav_authors      => 1, 
    2369                     edit_author_name => $user->nickname 
    2370                     ? $user->nickname 
    2371                     : $user->name, 
    2372                     edit_author_id    => $author_id, 
    2373                     list_noncron      => 1, 
    2374                     group_count       => $user->group_count, 
    2375                     can_create_role   => $app->user->is_superuser, 
    2376                     has_expanded_mode => 1, 
    2377                     search_label      => $app->translate('Users'), 
    2378                     object_type       => 'association', 
    2379                     group_support      => $app->model('group') ? 1 : 0, 
    2380                 }, 
    2381             } 
    2382         ); 
    2383     } 
    2384     else { 
    2385         my $author_class = $app->model('author'); 
    2386         my $assoc_class  = $app->model('association'); 
    2387         my $hasher       = sub { 
    2388             my ( $obj, $row ) = @_; 
    2389             my $user_count = $assoc_class->count( 
    2390                 { 
    2391                     role_id   => $obj->id, 
    2392                     author_id => [ 1, undef ], 
    2393                 }, 
    2394                 { 
    2395                     unique     => 'author_id', 
    2396                     range_incl => { author_id => 1 }, 
    2397                 } 
    2398             ); 
    2399             my $group_count = $assoc_class->count( 
    2400                 { 
    2401                     role_id  => $obj->id, 
    2402                     group_id => [ 1, undef ], 
    2403                 }, 
    2404                 { 
    2405                     unique     => 'group_id', 
    2406                     range_incl => { group_id => 1 }, 
    2407                 } 
    2408             ); 
    2409             $row->{members} = $user_count + $group_count; 
    2410             $row->{weblogs} = $assoc_class->count( 
    2411                 { 
    2412                     role_id => $obj->id, 
    2413                     blog_id => [ 1, undef ], 
    2414                 }, 
    2415                 { 
    2416                     unique     => 'blog_id', 
    2417                     range_incl => { blog_id => 1 }, 
    2418                 } 
    2419             ); 
    2420             if ( $obj->created_by ) { 
    2421                 my $user = $author_class->load( $obj->created_by ); 
    2422                 $row->{created_by} = $user ? $user->name : ''; 
    2423             } 
    2424             else { 
    2425                 $row->{created_by} = ''; 
    2426             } 
    2427  
    2428             # populate permissions for the expanded view 
    2429             if ( $pref->{view_expanded} ) { 
    2430                 my @perms; 
    2431                 foreach (@$all_perms) { 
    2432                     next unless length( $_->[1] || '' ); 
    2433                     push @perms, { name => $app->translate( $_->[1] ) } 
    2434                       if $obj->has( $_->[0] ); 
    2435                 } 
    2436                 $row->{perm_loop} = \@perms; 
    2437             } 
    2438         }; 
    2439         unless ( $app->user->is_superuser() ) { 
    2440             return $app->errtrans("Permission denied."); 
    2441         } 
    2442         $app->add_breadcrumb( $app->translate("Roles") ); 
    2443         $app->listing( 
    2444             { 
    2445                 args   => { sort => 'name' }, 
    2446                 type   => 'role', 
    2447                 code   => $hasher, 
    2448                 params => { 
    2449                     nav_privileges    => 1, 
    2450                     group_id          => $group_id, 
    2451                     list_noncron      => 1, 
    2452                     can_create_role   => $app->user->is_superuser, 
    2453                     has_expanded_mode => 1, 
    2454                     search_label      => $app->translate('Users'), 
    2455                     object_type       => 'role', 
    2456                     group_support      => $app->model('group') ? 1 : 0, 
    2457                 }, 
    2458             } 
    2459         ); 
    2460     } 
     2311            args   => { sort => 'name' }, 
     2312            type   => 'role', 
     2313            code   => $hasher, 
     2314            params => { 
     2315                nav_privileges    => 1, 
     2316                list_noncron      => 1, 
     2317                can_create_role   => $app->user->is_superuser, 
     2318                has_expanded_mode => 1, 
     2319                search_label      => $app->translate('Users'), 
     2320                object_type       => 'role', 
     2321            }, 
     2322        } 
     2323    ); 
    24612324} 
    24622325 
     
    24662329    my $blog_id   = $app->param('blog_id'); 
    24672330    my $author_id = $app->param('author_id'); 
    2468     my $group_id  = $app->param('group_id'); 
    24692331    my $role_id   = $app->param('role_id'); 
    24702332 
     
    24832345    } 
    24842346 
    2485     my ( $grp, $user, $role ); 
    2486     my $grp_class = $app->model('group'); 
     2347    my ( $user, $role ); 
    24872348    $app->error(undef); 
    24882349 
    2489     if ($group_id) { 
    2490         return unless $grp_class; 
    2491         $grp = $grp_class->load($group_id); 
    2492         $app->add_breadcrumb( 
    2493             $app->translate('Users & Groups'), 
    2494             $app->uri( mode => 'list_groups' ) 
    2495         ); 
    2496         $app->add_breadcrumb( 
    2497             $grp->name, 
    2498             $app->uri( 
    2499                 mode => 'view', 
    2500                 args => { _type => 'group', id => $group_id } 
    2501             ) 
    2502         ); 
    2503         $app->add_breadcrumb( $app->translate('Group Associations') ); 
    2504     } 
    25052350    if ($author_id) { 
    2506         $app->add_breadcrumb( $app->translate('Users & Groups'), 
     2351        $app->add_breadcrumb( $app->translate('Users'), 
    25072352              $app->user->is_superuser 
    25082353            ? $app->uri( mode => 'list_authors' ) 
     
    25382383        $app->add_breadcrumb( $app->translate("Role Users & Groups") ); 
    25392384    } 
    2540     if ( !$role_id && !$group_id && !$author_id ) { 
     2385    if ( !$role_id && !$author_id ) { 
    25412386        if ($blog_id) { 
    2542             $app->add_breadcrumb( $app->translate("Users & Groups") ); 
     2387            $app->add_breadcrumb( $app->translate("Users") ); 
    25432388        } 
    25442389        else { 
     
    25622407    my $hasher = sub { 
    25632408        my ( $obj, $row ) = @_; 
    2564         my $group; 
    25652409        if ( my $user = $obj->user ) { 
    25662410            $row->{user_id}   = $user->id; 
    25672411            $row->{user_name} = $user->name; 
    2568         } 
    2569         elsif ( $grp_class && ( $group = $obj->group ) ) { 
    2570             $row->{group_name} = $group->name; 
    25712412        } 
    25722413        if ( my $role = $obj->role ) { 
     
    26112452    $app->model('association') or return; 
    26122453    my $types; 
    2613     if ( !$group_id && !$author_id && !$blog_id ) { 
     2454    if ( !$author_id && !$blog_id ) { 
    26142455        $types = [ 
    26152456            MT::Association::USER_BLOG_ROLE(), 
    2616             MT::Association::GROUP_BLOG_ROLE(), 
    26172457            MT::Association::USER_ROLE(), 
    2618             MT::Association::GROUP_ROLE() 
    26192458        ]; 
    26202459    } 
    2621     elsif ( !$group_id && !$author_id ) { 
     2460    elsif ( !$author_id ) { 
    26222461        $types = [ 
    26232462            MT::Association::USER_BLOG_ROLE(), 
    2624             MT::Association::GROUP_BLOG_ROLE() 
    26252463        ]; 
    26262464    } 
     
    26282466        $types = 
    26292467          [ MT::Association::USER_BLOG_ROLE(), MT::Association::USER_ROLE() ]; 
    2630     } 
    2631     elsif ($group_id) { 
    2632         $types = 
    2633           [ MT::Association::GROUP_BLOG_ROLE(), MT::Association::GROUP_ROLE() ]; 
    26342468    } 
    26352469 
     
    26652499            terms => { 
    26662500                type => $types, 
    2667                 $group_id  ? ( group_id  => $group_id )  : (), 
    26682501                $author_id ? ( author_id => $author_id ) : (), 
    26692502                $blog_id   ? ( blog_id   => $blog_id )   : (), 
    26702503                $role_id   ? ( role_id   => $role_id )   : (), 
    26712504            }, 
     2505            pre_build => $pre_build, 
    26722506            params => { 
    26732507                can_create_association => $app->user->is_superuser || ( $blog_id 
     
    26752509                has_expanded_mode => 1, 
    26762510                nav_privileges => 
    2677                   ( $group_id || $author_id || $blog_id ? 0 : 1 ) || $role_id, 
    2678                 nav_authors => ( $group_id || $author_id || $blog_id ? 1 : 0 ) 
     2511                  ( $author_id || $blog_id ? 0 : 1 ) || $role_id, 
     2512                nav_authors => ( $author_id || $blog_id ? 1 : 0 ) 
    26792513                  && !$role_id, 
    26802514                blog_view     => $blog_id   ? 1 : 0, 
    26812515                user_view     => $author_id ? 1 : 0, 
    2682                 group_support => $grp_class ? 1 : 0, 
    2683                 group_view    => $group_id  ? 1 : 0, 
    26842516                role_view     => $role_id   ? 1 : 0, 
    26852517                $role_id 
     
    26922524                ? ( 
    26932525                    edit_author_id   => $author_id, 
    2694                     edit_author_name => $user 
     2526                    edit_name => $user 
    26952527                    ? ( $user->nickname ? $user->nickname : $user->name ) 
    26962528                    : $app->translate('(newly created user)'), 
     2529                    edit_object => $app->translate('The user'), 
    26972530                    group_count => $user ? $user->group_count() : 0, 
    26982531                    status_enabled => $user ? ( $user->is_active ? 1 : 0 ) : 0, 
     
    27022535                  ) 
    27032536                : (), 
    2704                 $group_id 
    2705                 ? ( 
    2706                     group_id       => $group_id, 
    2707                     group_name     => $grp->name, 
    2708                     user_count     => $grp->user_count(), 
    2709                     status_enabled => $grp->is_active ? 1 : 0, 
    2710                   ) 
    2711                 : (), 
    27122537                saved         => $app->param('saved')         || 0, 
    27132538                saved_deleted => $app->param('saved_deleted') || 0, 
    2714                 usergroup_view => !$author_id && !$group_id && !$role_id, 
     2539                usergroup_view => !$author_id && !$role_id, 
    27152540                blog_id => $blog_id, 
    2716                 ( 
    2717                     $grp_class 
    2718                     ? ( 
    2719                         can_add_groups => !$app->config->ExternalGroupManagement 
    2720                           || ( 
    2721                             $app->config->ExternalGroupManagement 
    2722                             && $grp_class->count( 
    2723                                 { status => MT::Group::ACTIVE() } 
    2724                             ) > 0 
    2725                           ) 
    2726                       ) 
    2727                     : () 
    2728                 ), 
    27292541                search_label => $app->translate('Users'), 
    27302542                object_type  => 'association', 
     2543                pt_name => $app->translate('User'), 
    27312544            }, 
    27322545        } 
     
    34643277        my $menu = $menus->{$id}; 
    34653278        next if $menu->{view} && $menu->{view} ne $view; 
     3279        if (my $cond = $menu->{condition}) { 
     3280            if (!ref($cond)) { 
     3281                $cond = $menu->{condition} = $app->handler_to_coderef($cond); 
     3282            } 
     3283            next unless $cond->(); 
     3284        } 
    34663285 
    34673286        $menu->{allowed} = 1; 
     
    34713290        my @sub; 
    34723291        foreach my $sub_id (@sub_ids) { 
     3292            my $sub = $menus->{$sub_id}; 
    34733293            next 
    3474               if $menus->{$sub_id}{view} 
    3475               && ( $menus->{$sub_id}{view} ne $view ); 
    3476             $menus->{$sub_id}->{'id'} = $sub_id; 
    3477             push @sub, $menus->{$sub_id}; 
     3294              if $sub->{view} 
     3295              && ( $sub->{view} ne $view ); 
     3296            $sub->{'id'} = $sub_id; 
     3297            if (my $cond = $sub->{condition}) { 
     3298                if (!ref($cond)) { 
     3299                    $cond = $sub->{condition} = $app->handler_to_coderef($cond); 
     3300                } 
     3301                next unless $cond->(); 
     3302            } 
     3303            push @sub, $sub; 
    34783304        } 
    34793305 
     
    43024128 
    43034129    $param->{saved} = 1 if $app->param('saved'); 
    4304     $param->{group_support} = $app->model('group') ? 1 : 0; 
    4305     $param->{can_add_groups} = 1 if $super_user && $param->{group_support}; 
    43064130    $param->{search_label} = $app->translate('Users'); 
    43074131    $param->{object_type} = 'author'; 
     
    44174241    my %author_entry_count; 
    44184242    $param{tab_users} = 1; 
    4419     my ( $filter_col, $val, $group_id, $group ); 
     4243    my ( $filter_col, $val ); 
    44204244    $param{filter_args} = ""; 
    44214245    my %terms = ( type => MT::Author::AUTHOR() ); 
    4422  
    4423     my $grp_class = $app->model('group'); 
    4424     $param{group_support} = 1 if $grp_class; 
    44254246 
    44264247    my $filter_key = $app->param('filter_key'); 
     
    44494270    } 
    44504271    $param{can_create_user}           = $this_author->is_superuser; 
    4451     $param{external_user_management}  = $app->config->ExternalUserManagement; 
    4452     $param{external_group_management} = $app->config->ExternalGroupManagement; 
    44534272    $param{synchronized}              = 1 if $app->param('synchronized'); 
    44544273    $param{error}                     = 1 if $app->param('error'); 
    4455     my $author_iter; 
    4456     if ( $group_id = $app->param('group_id') ) { 
    4457         return unless $grp_class; 
    4458         $group                     = $grp_class->load($group_id); 
    4459         $param{group_id}           = $group_id; 
    4460         $param{group_display_name} = $group->display_name; 
    4461         $param{group_name}         = $group->name; 
    4462         $param{user_count}         = $group->user_count; 
    4463         $param{status_enabled} = 1 if $group->is_active; 
    4464         $author_iter = $group->user_iter( \%terms, $args ); 
    4465     } 
    4466     else { 
    4467         $author_iter = MT::Author->load_iter( \%terms, $args ); 
    4468     } 
     4274    my $author_iter = MT::Author->load_iter( \%terms, $args ); 
    44694275    my ( @data, %authors, %entry_count_refs ); 
    44704276    my $entry_class = $app->model('entry'); 
     
    44894295              if $au->created_by; 
    44904296            if ($parent_author) { 
    4491                 $row->{created_by} = $parent_author->name; 
     4297                $row->{created_by_name} = $parent_author->name; 
    44924298            } 
    44934299            else { 
    4494                 $row->{created_by} = $app->translate('(user deleted)'); 
     4300                $row->{created_by_name} = $app->translate('(user deleted)'); 
    44954301            } 
    44964302        } 
     
    49024708        return $app->error( $app->translate("Permission denied.") ) 
    49034709          unless $author->can_view_log; 
    4904         $log_class->remove_all; 
    4905         $app->log( 
    4906             { 
    4907                 message => $app->translate( 
    4908                     "Activity log reset by '[_1]'", 
    4909                     $author->name 
    4910                 ), 
    4911                 level    => MT::Log::INFO(), 
    4912                 class    => 'system', 
    4913                 category => 'reset_log' 
    4914             } 
    4915         ); 
     4710        if ( $log_class->remove( { class => '*' } ) ) { 
     4711            $app->log( 
     4712                { 
     4713                    message => $app->translate( 
     4714                        "Activity log reset by '[_1]'", 
     4715                        $author->name 
     4716                    ), 
     4717                    level    => MT::Log::INFO(), 
     4718                    class    => 'system', 
     4719                    category => 'reset_log' 
     4720                } 
     4721            ); 
     4722        } 
    49164723    } 
    49174724    $app->add_return_arg( 'reset' => 1 ); 
     
    53025109    my $cfg    = $app->config; 
    53035110    $param{styles} = ''; 
    5304     if ( $type eq 'author' || $type eq 'group' ) { 
     5111    if ( $type eq 'author' ) { 
    53055112        if ( $perms || $blog_id ) { 
    53065113            return $app->return_to_dashboard( redirect => 1 ); 
     
    61805987                $param{search_label} = $app->translate('Users'); 
    61815988                $param{object_type}  = 'author'; 
    6182                 if ( $app->config->ExternalUserManagement ) { 
    6183                     if ( MT::Auth->synchronize_author( User => $obj ) ) { 
    6184                         $obj = $class->load($id); 
    6185                         ## we only sync name and status here 
    6186                         $param{name}   = $obj->name; 
    6187                         $param{status} = $obj->status; 
    6188                         if ( ( $id == $author->id ) && ( !$obj->is_active ) ) { 
    6189                             ## superuser has been attempted to disable herself - something bad 
    6190                             $obj->status( MT::Author::ACTIVE() ); 
    6191                             $obj->save; 
    6192                             $param{superuser_attempted_disabled} = 1; 
    6193                         } 
    6194                     } 
    6195                 } 
    6196                 else { 
    6197                     $param{can_edit_username} = 1; 
    6198                 } 
    6199             } 
    6200             else { 
    6201                 if ( !$app->config->ExternalUserManagement ) { 
    6202                     $param{can_edit_username} = 1; 
    6203                 } 
     5989                $param{can_edit_username} = 1; 
    62045990            } 
    62055991            $param{status_enabled} = $obj->is_active ? 1 : 0; 
    62065992            $param{status_pending} = 
    62075993              $obj->status == MT::Author::PENDING() ? 1 : 0; 
    6208             if ( $app->model('group') ) { 
    6209                 $param{group_support} = 1; 
    6210                 $param{group_count}   = $obj->group_count; 
    6211                 if ( $cfg->AuthenticationModule ne 'MT' ) { 
    6212                     if ( $cfg->ExternalGroupManagement ) { 
    6213                         my $id = $obj->external_id; 
    6214                         $id = '' unless defined $id; 
    6215                         if ( length($id) && ( $id !~ m/[\x00-\x1f\x80-\xff]/ ) ) 
    6216                         { 
    6217                             $param{show_external_id} = 1; 
    6218                         } 
    6219                     } 
    6220                 } 
    6221             } 
    62225994            $param{can_modify_password} = 
    62235995              ( $param{editing_other_profile} || $param{is_me} ) 
     
    64466218              $app->config->NewUserAutoProvisioning ? 1 : 0 
    64476219              unless exists $param{create_personal_weblog}; 
    6448             if ( !$app->config->ExternalUserManagement ) { 
    6449                 if ( $app->config->AuthenticationModule ne 'MT' ) { 
    6450                     $param{new_user_external_auth} = '1'; 
    6451                 } 
    6452             } 
    64536220            $param{can_modify_password}  = MT::Auth->password_exists; 
    64546221            $param{can_recover_password} = MT::Auth->can_recover_password; 
     
    69036670    } 
    69046671    elsif ( $type eq 'author' ) { 
    6905         $app->add_breadcrumb( $app->translate("Users & Groups"), 
     6672        $app->add_breadcrumb( $app->translate("Users"), 
    69066673              $app->user->is_superuser 
    69076674            ? $app->uri( mode => 'list_authors' ) 
     
    69156682        } 
    69166683        else { 
    6917             $app->add_breadcrumb( $app->translate("Create New User") ); 
     6684            $app->add_breadcrumb( $app->translate("Create User") ); 
    69186685            $param{languages} = 
    69196686              $app->languages_list( $app->config('DefaultUserLanguage') ) 
     
    69396706        } 
    69406707        $param{'nav_authors'} = 1; 
    6941         $param{'external_user_management'} = 
    6942           $app->config->ExternalUserManagement; 
    6943         $param{'external_group_management'} = 
    6944           $app->config->ExternalGroupManagement; 
    69456708    } 
    69466709    if ( ( $q->param('msg') || "" ) eq 'nosuch' ) { 
     
    75697332    # the CMS app; COMMENTERs are created from the Comments app. 
    75707333    $obj->type( MT::Author::AUTHOR() ); 
    7571  
    7572     if ( $app->config->ExternalUserManagement ) { 
    7573         if ( 'save_profile' eq $app->mode ) { 
    7574             if ( $obj->is_active ) { 
    7575                 require MT::Auth; 
    7576                 my $error = MT::Auth->sanity_check($app); 
    7577                 return $eh->error($error) 
    7578                   if ( defined $error ) && ( $error ne '' ); 
    7579             } 
    7580         } 
    7581         elsif ( $original->id && ( $original->name ne $obj->name ) ) { 
    7582             return $eh->error( 
    7583                 $app->translate( 
    7584 "A user can't change his/her own username in this environment." 
    7585                 ) 
    7586             ); 
    7587         } 
    7588  
    7589         if ( $obj->id ) { 
    7590             if ( $original->status != $obj->status ) { 
    7591                 if ( $obj->status == MT::Author::ACTIVE() ) { 
    7592  
    7593                     # trying to reactivate an author... 
    7594                     MT::Auth->synchronize_author( User => $obj ); 
    7595                     if ( $obj->status != MT::Author::ACTIVE() ) { 
    7596  
    7597                         # status was reverted for whatever reason... 
    7598                         return $eh->error( 
    7599                             $app->translate( 
    7600                                 "An errror occurred when enabling this user.") 
    7601                         ); 
    7602                     } 
    7603                 } 
    7604             } 
    7605         } 
    7606     } 
    76077334 
    76087335    my $pass = $app->param('pass'); 
     
    1117210899                plugin_compat_errors => $registry->{compat_errors}, 
    1117310900            }; 
     10901            my $block_tags = $plugin->registry('tags', 'block'); 
     10902            my $function_tags = $plugin->registry('tags', 'function'); 
     10903            my $modifiers = $plugin->registry('tags', 'modifier'); 
     10904            my $junk_filters = $plugin->registry('junk_filters'); 
     10905            my $text_filters = $plugin->registry('text_filters'); 
     10906 
    1117410907            $row->{plugin_tags} = listify( 
    1117510908                [ 
     
    1118110914                            # Format all 'block' tags with <MT(name)> 
    1118210915                            map { s/\?$//; "<MT$_>" } 
    11183                               ( keys %{ $registry->{tags}{block} || {} } ) 
     10916                              ( keys %{ $block_tags || {} } ) 
    1118410917                        ), 
    1118510918                        ( 
     
    1118710920                            # Format all 'function' tags with <$MT(name)$> 
    1118810921                            map { "<\$MT$_\$>" } 
    11189                               ( keys %{ $registry->{tags}{function} || {} } ) 
     10922                              ( keys %{ $function_tags || {} } ) 
    1119010923                        ) 
    1119110924                    ) 
    1119210925                ] 
    11193             ) if $registry->{tags}{block} || $registry->{tags}{function}; 
     10926            ) if $block_tags || $function_tags; 
    1119410927            $row->{plugin_attributes} = listify( 
    1119510928                [ 
     
    1119710930                    # Filter out 'plugin' registry entry 
    1119810931                    grep { $_ ne 'plugin' } 
    11199                       keys %{ $registry->{tags}{modifier} || {} } 
     10932                      keys %{ $modifiers || {} } 
    1120010933                ] 
    11201             ) if $registry->{tags}{modifier}; 
     10934            ) if $modifiers; 
    1120210935            $row->{plugin_junk_filters} = listify( 
    1120310936                [ 
     
    1120510938                    # Filter out 'plugin' registry entry 
    1120610939                    grep { $_ ne 'plugin' } 
    11207                       keys %{ $registry->{junk_filters} || {} } 
     10940                      keys %{ $junk_filters || {} } 
    1120810941                ] 
    11209             ) if $registry->{junk_filters}; 
     10942            ) if $junk_filters; 
    1121010943            $row->{plugin_text_filters} = listify( 
    1121110944                [ 
     
    1121310946                    # Filter out 'plugin' registry entry 
    1121410947                    grep { $_ ne 'plugin' } 
    11215                       keys %{ $registry->{text_filters} || {} } 
     10948                      keys %{ $text_filters || {} } 
    1121610949                ] 
    11217             ) if $registry->{text_filters}; 
     10950            ) if $text_filters; 
    1121810951            if (   $row->{plugin_tags} 
    1121910952                || $row->{plugin_attributes} 
     
    1124310976 
    1124410977            # no registered plugin objects-- 
    11245             # are there any tags/attributes/filters to expose? 
    11246             my $registry = $plugin->{registry}; 
    1124710978            $row = { 
    1124810979                first                => $next_is_first, 
     
    1125410985                plugin_disabled      => $profile->{enabled} ? 0 : 1, 
    1125510986                plugin_id            => $id, 
    11256                 plugin_compat_errors => $registry->{compat_errors}, 
    1125710987            }; 
    11258             $row->{plugin_tags} = listify( 
    11259                 [ keys %{ $registry->{tags}{block} || {} } ], 
    11260                 keys %{ $registry->{tags}{function} || {} } 
    11261             ) if $profile->{tags}{block} || $profile->{tags}{function}; 
    11262             $row->{plugin_attributes} = 
    11263               listify( [ keys %{ $registry->{tags}{modifier} || {} } ] ) 
    11264               if $profile->{tags}{modifier}; 
    11265             $row->{plugin_junk_filters} = 
    11266               listify( [ keys %{ $registry->{junk_filters} || {} } ] ) 
    11267               if $registry->{junk_filters}; 
    11268             $row->{plugin_text_filters} = 
    11269               listify( [ keys %{ $registry->{text_filters} || {} } ] ) 
    11270               if $registry->{text_filters}; 
    11271             if (   $row->{plugin_tags} 
    11272                 || $row->{plugin_attributes} 
    11273                 || $row->{plugin_junk_filters} 
    11274                 || $row->{plugin_text_filters} ) 
    11275             { 
    11276                 $row->{plugin_resources} = 1; 
    11277             } 
    1127810988            push @$data, $row; 
    1127910989        } 
     
    1471114421    } 
    1471214422    else { 
    14713         $app->add_breadcrumb( $app->translate('Create New Role') ); 
     14423        $app->add_breadcrumb( $app->translate('Create Role') ); 
    1471414424    } 
    1471514425    $param{screen_class}        = "settings-screen edit-role"; 
     
    1553915249    my $app = shift; 
    1554015250    my $param = $app->do_search_replace(@_) or return; 
     15251    my $blog_id = $app->param('blog_id'); 
    1554115252    $app->add_breadcrumb( $app->translate('Search & Replace') ); 
    1554215253    $param->{nav_search}   = 1; 
    1554315254    $param->{screen_class} = "search-replace"; 
    15544     $param->{screen_id} = "search-replace"; 
    15545     $app->load_tmpl( 'search_replace.tmpl', $param ); 
    15546 } 
    15547  
    15548 sub do_search_replace { 
    15549     my $app     = shift; 
     15255    $param->{screen_id}    = "search-replace"; 
     15256    $param->{search_tabs}  = $app->search_apis($blog_id ? 'blog' : 'system'); 
     15257    my $tmpl = $app->load_tmpl( 'search_replace.tmpl', $param ); 
     15258    my $placeholder = $tmpl->getElementById('search_results'); 
     15259    $placeholder->innerHTML(delete $param->{results_template}); 
     15260    return $tmpl; 
     15261} 
     15262 
     15263sub core_search_apis { 
     15264    my $app = shift; 
    1555015265    my $q       = $app->param; 
    1555115266    my $blog_id = $q->param('blog_id'); 
     
    1556215277          or return $app->error( $app->translate("No permissions") ); 
    1556315278    } 
    15564  
    15565     my $search_api = { 
    15566         'asset' => { 
    15567             'perm_check' => sub { 
    15568                 1; 
    15569             }, 
    15570             'search_cols'        => [qw(file_name description)], 
    15571             'replace_cols'       => [], 
    15572             'can_replace'        => 0, 
    15573             'can_search_by_date' => 1, 
    15574         }, 
     15279    return { 
    1557515280        'entry' => { 
     15281            'order' => 100, 
     15282            'permission' => 'create_post,publish_post,edit_all_posts', 
     15283            'label' => $app->translate('Entries'), 
    1557615284            'perm_check' => sub { 
    1557715285                grep { $_->can_edit_entry( $_[0], $author ) } @perms; 
    1557815286            }, 
    15579             'search_cols' => 
    15580               [qw(title text text_more keywords excerpt basename)], 
     15287            'search_cols' => { 
     15288                'title' => sub { $app->translate('Title') }, 
     15289                'text' => sub { $app->translate('Entry Body') }, 
     15290                'text_more' => sub { $app->translate('Extended Entry') }, 
     15291                'keywords' => sub { $app->translate('Keywords') }, 
     15292                'excerpt' => sub { $app->translate('Excerpt') }, 
     15293                'basename' => sub { $app->translate('Basename') }, 
     15294            }, 
    1558115295            'replace_cols'       => [qw(title text text_more keywords excerpt)], 
    1558215296            'can_replace'        => 1, 
     
    1558415298            'date_column'        => 'authored_on', 
    1558515299        }, 
    15586         'page' => { 
     15300        'comment' => { 
     15301            'order' => 200, 
     15302            'permission' => 'publish_post,create_post,edit_all_posts,manage_feedback', 
     15303            'label' => $app->translate('Comments'), 
    1558715304            'perm_check' => sub { 
    15588                 grep { $_->can_manage_pages( $_[0], $author ) } @perms; 
     15305                require MT::Entry; 
     15306                my $entry = MT::Entry->load( $_[0]->entry_id ); 
     15307                grep { $_->can_edit_entry( $entry, $author ) } @perms; 
    1558915308            }, 
    15590             'search_cols' => 
    15591               [qw(title text text_more keywords excerpt basename)], 
    15592             'replace_cols'       => [qw(title text text_more keywords excerpt)], 
     15309            'search_cols' => { 
     15310                'url' => sub { $app->translate('URL') }, 
     15311                'text' => sub { $app->translate('Comment Text') }, 
     15312                'email' => sub { $app->translate('Email Address') }, 
     15313                'ip' => sub { $app->translate('IP Address') }, 
     15314                'author' => sub { $app->translate('Name') }, 
     15315            }, 
     15316            'replace_cols'       => [qw(text)], 
    1559315317            'can_replace'        => 1, 
    1559415318            'can_search_by_date' => 1, 
    15595             'date_column'        => 'authored_on', 
    1559615319        }, 
    1559715320        'ping' => { 
     15321            'order' => 300, 
     15322            'permission' => 'create_post,publish_post,edit_all_posts,manage_feedback', 
     15323            'label' => $app->translate('TrackBacks'), 
    1559815324            'perm_check' => sub { 
    1559915325                my $ping = shift; 
     
    1560915335                } 
    1561015336            }, 
    15611             'search_cols'        => [qw(title excerpt source_url blog_name ip)], 
     15337            'search_cols' => { 
     15338                'title' => sub { $app->translate('Title') }, 
     15339                'excerpt' => sub { $app->translate('Excerpt') }, 
     15340                'source_url' => sub { $app->translate('Source URL') }, 
     15341                'ip' => sub { $app->translate('IP Address') }, 
     15342                'blog_name' => sub { $app->translate('Blog Name') }, 
     15343            }, 
    1561215344            'replace_cols'       => [qw(title excerpt)], 
    1561315345            'can_replace'        => 1, 
    1561415346            'can_search_by_date' => 1, 
    1561515347        }, 
    15616         'comment' => { 
     15348        'page' => { 
     15349            'order' => 400, 
     15350            'permission' => 'manage_pages', 
     15351            'label' => $app->translate('Pages'), 
    1561715352            'perm_check' => sub { 
    15618                 require MT::Entry; 
    15619                 my $entry = MT::Entry->load( $_[0]->entry_id ); 
    15620                 grep { $_->can_edit_entry( $entry, $author ) } @perms; 
     15353                grep { $_->can_manage_pages( $_[0], $author ) } @perms; 
    1562115354            }, 
    15622             'search_cols'        => [qw(text url email ip author)], 
    15623             'replace_cols'       => [qw(text)], 
     15355            'search_cols' => { 
     15356                'title' => sub { $app->translate('Title') }, 
     15357                'text' => sub { $app->translate('Page Body') }, 
     15358                'text_more' => sub { $app->translate('Extended Page') }, 
     15359                'keywords' => sub { $app->translate('Keywords') }, 
     15360                'excerpt' => sub { $app->translate('Excerpt') }, 
     15361                'basename' => sub { $app->translate('Basename') }, 
     15362            }, 
     15363            'replace_cols'       => [qw(title text text_more keywords excerpt)], 
    1562415364            'can_replace'        => 1, 
    1562515365            'can_search_by_date' => 1, 
     15366            'date_column'        => 'authored_on', 
     15367            'results_table_template' => '<mt:include name="include/entry_table.tmpl">', 
    1562615368        }, 
    1562715369        'template' => { 
     15370            'order'         => 500, 
     15371            'permission'    => 'edit_templates', 
     15372            'label'         => $app->translate('Templates'), 
     15373            'view'          => 'blog', 
    1562815374            'perm_check' => sub { 
    1562915375                my ($obj) = @_; 
     
    1563815384 
    1563915385            }, 
    15640             'search_cols'        => [qw(name text linked_file outfile)], 
     15386            'search_cols' => { 
     15387                'name' => sub { $app->translate('Template Name') }, 
     15388                'text' => sub { $app->translate('Text') }, 
     15389                'linked_file' => sub { $app->translate('Linked Filename') }, 
     15390                'outfile' => sub { $app->translate('Output Filename') }, 
     15391            }, 
    1564115392            'replace_cols'       => [qw(name text linked_file outfile)], 
    1564215393            'can_replace'        => 1, 
    1564315394            'can_search_by_date' => 0, 
    1564415395        }, 
     15396        'asset' => { 
     15397            'order' => 600, 
     15398            'permission' => 'manage_assets', 
     15399            'label' => $app->translate('Assets'), 
     15400            'perm_check' => sub { 
     15401                1; 
     15402            }, 
     15403            'search_cols' => { 
     15404                'file_name' => sub { $app->translate('Filename') }, 
     15405                'description' => sub { $app->translate('Description') }, 
     15406            }, 
     15407            'replace_cols'       => [], 
     15408            'can_replace'        => 0, 
     15409            'can_search_by_date' => 1, 
     15410            'setup_terms_args'   => sub { 
     15411                my ($terms, $args, $blog_id) = @_; 
     15412                $terms->{class} = '*'; 
     15413                $terms->{blog_id} = $blog_id if $blog_id; 
     15414            } 
     15415        }, 
    1564515416        'log' => { 
     15417            'order' => 700, 
     15418            'permission'        => "view_blog_log", 
     15419            'system_permission' => "view_log", 
     15420            'label' => $app->translate('Activity Log'), 
    1564615421            'perm_check' => sub { 
    1564715422                my ($obj) = @_; 
     
    1565015425                return $perm->can_view_blog_log; 
    1565115426            }, 
    15652             'search_cols'        => [qw(ip message)], 
     15427            'search_cols' => { 
     15428                'ip' => sub { $app->translate('Log Message') }, 
     15429                'message' => sub { $app->translate('IP Address') }, 
     15430            }, 
    1565315431            'can_replace'        => 0, 
    1565415432            'can_search_by_date' => 1, 
     15433            'setup_terms_args'   => sub { 
     15434                my ($terms, $args, $blog_id) = @_; 
     15435                $terms->{class} = '*'; 
     15436                $terms->{blog_id} = $blog_id if $blog_id; 
     15437            } 
    1565515438        }, 
    1565615439        'author' => { 
     15440            'order' => 800, 
     15441            'system_permission' => 'administer', 
     15442            'label' => $app->translate('Users'), 
    1565715443            'perm_check' => sub { 
    1565815444                return 1 if $author->is_superuser; 
     
    1566315449                return 0; 
    1566415450            }, 
    15665             'search_cols'        => [qw(name nickname email url)], 
     15451            'search_cols' => { 
     15452                'name'     => sub { $app->translate('Username') }, 
     15453                'nickname' => sub { $app->translate('Display Name') }, 
     15454                'email'    => sub { $app->translate('Email Address') }, 
     15455                'url'      => sub { $app->translate('URL') }, 
     15456            }, 
    1566615457            'can_replace'        => 0, 
    1566715458            'can_search_by_date' => 0, 
     15459            'setup_terms_args'   => sub { 
     15460                my ($terms, $args, $blog_id) = @_; 
     15461                if ($blog_id) { 
     15462                    $args->{'join'} = 
     15463                      MT::Permission->join_on( 'author_id', 
     15464                        { blog_id => $blog_id } ); 
     15465                } 
     15466                else { 
     15467                    $terms->{'type'} = MT::Author::AUTHOR(); 
     15468                } 
     15469            }, 
     15470            'results_table_template' => ' 
     15471<mt:if name="blog_id"> 
     15472    <mt:include name="include/member_table.tmpl"> 
     15473<mt:else> 
     15474    <mt:include name="include/author_table.tmpl"> 
     15475</mt:if>', 
    1566815476        }, 
    1566915477        'blog' => { 
     15478            'order' => 900, 
     15479            'system_permission' => 'administer', 
     15480            'label' => $app->translate('Blogs'), 
    1567015481            'perm_check' => sub { 
    1567115482                return 1 if $author->is_superuser; 
     
    1567515486                  && ( $perm->can_administer_blog || $perm->can_edit_config ); 
    1567615487            }, 
    15677             'search_cols'        => [qw(name site_url site_path description)], 
     15488            'search_cols' => { 
     15489                'name' => sub { $app->translate('Name') }, 
     15490                'site_url' => sub { $app->translate('Site URL') }, 
     15491                'site_path' => sub { $app->translate('Site Root') }, 
     15492                'description' => sub { $app->translate('Description') }, 
     15493            }, 
    1567815494            'replace_cols'       => [qw(name site_url site_path description)], 
    1567915495            'can_replace'        => $author->is_superuser(), 
    1568015496            'can_search_by_date' => 0, 
     15497            'view'               => 'system', 
     15498            'setup_terms_args'   => sub { 
     15499                my ($terms, $args, $blog_id) = @_; 
     15500                $args->{sort}      = 'name'; 
     15501                $args->{direction} = 'ascend'; 
     15502            } 
    1568115503        } 
    1568215504    }; 
     15505 
     15506} 
     15507 
     15508sub _default_results_table_template { 
     15509    my $app = shift; 
     15510    my ($type, $results, $plural) = @_; 
     15511    if ($results) { 
     15512        return "<mt:include name=\"include/${type}_table.tmpl\">"; 
     15513    } 
     15514    else { 
     15515        return <<TMPL;     
     15516        <mtapp:statusmsg 
     15517                id="no-$plural" 
     15518                class="info"> 
     15519                <__trans phrase="No [_1] were found that match the given criteria." params="$plural"> 
     15520            </mtapp:statusmsg> 
     15521        </mt:if> 
     15522TMPL 
     15523    } 
     15524} 
     15525 
     15526sub do_search_replace { 
     15527    my $app     = shift; 
     15528    my $q       = $app->param; 
     15529    my $blog_id = $q->param('blog_id'); 
     15530    my $author  = $app->user; 
     15531 
     15532    my $search_api = $app->registry("search_apis"); 
    1568315533 
    1568415534    my ( 
     
    1569315543      qw( search replace do_replace case is_regex is_limited _type is_junk is_dateranged replace_ids datefrom_year datefrom_month datefrom_day dateto_year dateto_month dateto_day from to show_all do_search orig_search ); 
    1569415544 
     15545 
     15546    if ( !$type || ( 'category' eq $type ) || ( 'folder' eq $type ) ) { 
     15547        $type = 'entry'; 
     15548    } 
     15549 
    1569515550    foreach my $obj_type (qw( role association )) { 
    1569615551        if ( $type eq $obj_type ) { 
     
    1570115556    $replace && ( $app->validate_magic() or return ); 
    1570215557    $search = $orig_search if $do_replace;    # for safety's sake 
    15703  
    15704     if ( !$type || ( 'category' eq $type ) || ( 'folder' eq $type ) ) { 
    15705         $type = 'entry'; 
    15706     } 
    1570715558    my $list_pref = $app->list_pref($type); 
    1570815559 
     
    1572715578        @cols = $q->param('search_cols'); 
    1572815579        my %search_api_cols = 
    15729           map { $_ => 1 } @{ $search_api->{$type}{search_cols} }; 
     15580          map { $_ => 1 } keys %{ $search_api->{$type}{search_cols} }; 
    1573015581        if ( @cols && ( $cols[0] =~ /,/ ) ) { 
    1573115582            @cols = split /,/, $cols[0]; 
     
    1573415585    } 
    1573515586    else { 
    15736         @cols = @{ $search_api->{$type}->{search_cols} }; 
     15587        @cols = keys %{ $search_api->{$type}->{search_cols} }; 
    1573715588    } 
    1573815589    foreach ( 
     
    1579015641        my %terms; 
    1579115642        my %args; 
    15792         if ( $type eq 'author' ) { 
    15793             $terms{'type'} = MT::Author::AUTHOR(); 
    15794             if ( 'dialog_grant_role' eq $app->param('__mode') ) { 
    15795                 @cols = qw(name nickname email url); 
    15796             } 
    15797             elsif ($blog_id) { 
    15798                 # Blog-level search covers both authors and commenters 
    15799                 delete $terms{'type'}; 
    15800                 $args{'join'} = 
    15801                   MT::Permission->join_on( 'author_id', 
    15802                     { blog_id => $blog_id } ); 
    15803             } 
    15804         } 
    15805         elsif ( $type eq 'asset' ) { 
    15806             $terms{class} = '*'; 
    15807         } 
    15808         elsif ( $type eq 'log' ) { 
    15809             $terms{class} = '*'; 
    15810             $terms{blog_id} = $blog_id if $blog_id; 
    15811         } 
    15812         elsif ( $type eq 'blog' ) { 
     15643        if (exists $api->{setup_terms_args}) { 
     15644            my $code = $app->handler_to_coderef($api->{setup_terms_args}); 
     15645            $code->(\%terms, \%args, $blog_id); 
    1581315646        } 
    1581415647        else { 
     
    1584515678            }; 
    1584615679        } 
    15847         elsif ( $type eq 'blog' ) { 
    15848             $args{sort}      = 'name'; 
    15849             $args{direction} = 'ascend'; 
     15680        if ( $blog_id || ($type eq 'blog') ) { 
    1585015681            $iter = $class->load_iter( \%terms, \%args ) or die $class->errstr; 
    1585115682        } 
    15852         elsif ( $type eq 'log' ) { 
    15853             $iter = $class->load_iter( \%terms, \%args ) or die $class->errstr; 
    15854         } 
    15855         elsif ($blog_id) { 
    15856             $iter = $class->load_iter( \%terms, \%args ) or die $class->errstr; 
    15857         } 
    1585815683        else { 
    1585915684 
    15860             # Get an iter for each accessible blog 
    1586115685            my @streams; 
    15862             if (@perms) { 
    15863                 @streams = map { 
    15864                     { 
    15865                         iter => $class->load_iter( 
    15866                             { 
    15867                                 blog_id => $_->blog_id, 
    15868                                 %terms 
    15869                             }, 
    15870                             \%args 
    15871                         ) 
    15872                     } 
    15873                 } @perms; 
    15874             } 
    15875             elsif ( $author->is_superuser ) { 
     15686            if ( $author->is_superuser ) { 
    1587615687                @streams = ( { iter => $class->load_iter( \%terms, \%args ) } ); 
     15688            }  
     15689            else { 
     15690                # Get an iter for each accessible blog 
     15691                my @perms = $app->model('permission')->load( 
     15692                    { blog_id => '0', author_id => $author->id }, 
     15693                    { not => { blog_id => 1 } }, 
     15694                ); 
     15695                if (@perms) { 
     15696                    @streams = map { 
     15697                        { 
     15698                            iter => $class->load_iter( 
     15699                                { 
     15700                                    blog_id => $_->blog_id, 
     15701                                    %terms 
     15702                                }, 
     15703                                \%args 
     15704                            ) 
     15705                        } 
     15706                    } @perms; 
     15707                } 
    1587715708            } 
    1587815709 
     
    1598815819    if (@data) { 
    1598915820        if (my $meth = $search_api->{$type}{handler}) { 
    15990             $meth->(items => \@data, param => \%param, type => $type ); 
     15821            $meth = $app->handler_to_coderef($meth); 
     15822            $meth->($app, items => \@data, param => \%param, type => $type ); 
    1599115823        } else { 
    1599215824            my $meth = 'build_' . $type . '_table'; 
     
    1600115833        } 
    1600215834        $param{object_type} = $type; 
     15835        if ( exists $api->{results_table_template} ) { 
     15836            $param{results_template} = $api->{results_table_template}; 
     15837        } 
     15838        else { 
     15839            $param{results_template} = $app->_default_results_table_template($type, 1, $class->class_label_plural); 
     15840        } 
     15841    } 
     15842    else { 
     15843        if ( exists $api->{no_results_template} ) { 
     15844            $param{results_template} = $api->{no_results_template}; 
     15845        } 
     15846        else { 
     15847            $param{results_template} = $app->_default_results_table_template($type, 0, $class->class_label_plural); 
     15848        } 
    1600315849    } 
    1600415850    if ($is_dateranged) { 
     
    1604615892    ); 
    1604715893    $res{'tab_junk'} = 1 if $is_junk; 
    16048     $res{ 'search_cols_' . $_ } = 1 foreach @cols; 
     15894     
     15895    my $search_cols = $search_api->{$type}{search_cols}; 
     15896    my %cols = map { $_ => 1 } @cols; 
     15897    my @search_cols; 
     15898    for my $field (keys %$search_cols) { 
     15899        my %search_field; 
     15900        $search_field{field}    = $field; 
     15901        $search_field{selected} = 1 if exists($cols{$field}); 
     15902        $search_field{label}    = 'CODE' eq ref($search_cols->{$field}) 
     15903          ? $search_cols->{$field}->() 
     15904          : $app->translate($search_cols->{$field}); 
     15905        push @search_cols, \%search_field; 
     15906    } 
     15907    $res{'search_cols'} = \@search_cols; 
    1604915908    \%res; 
    1605015909} 
     
    1716017019    $app->add_return_arg( 'saved' => 1 ); 
    1716117020    $app->call_return; 
    17162 } 
    17163  
    17164 sub synchronize { 
    17165     my $app = shift; 
    17166     $app->validate_magic or return; 
    17167     $app->user->is_superuser 
    17168       or return $app->errtrans("Permission denied."); 
    17169     my ($type) = $app->param('_type'); 
    17170  
    17171     my $method = "synchronize_$type"; 
    17172     require MT::Auth; 
    17173     my $count = MT::Auth->$method; 
    17174     my $args  = (); 
    17175     if ( defined $count ) { 
    17176         $args->{synchronized} = 1 if $count >= 0; 
    17177     } 
    17178     else { 
    17179         $args->{error} = 1; 
    17180     } 
    17181  
    17182     $app->redirect( 
    17183         $app->uri( 
    17184             'mode' => $type eq 'author' ? 'list_authors' : 'list_groups', 
    17185             args => $args 
    17186         ) 
    17187     ); 
    1718817021} 
    1718917022 
     
    1737317206 
    1737417207    my $author_id = $app->param('author_id'); 
    17375     my $group_id  = $app->param('group_id'); 
    1737617208    my $blog_id   = $app->param('blog_id'); 
    1737717209    my $role_id   = $app->param('role_id'); 
     
    1738717219 
    1738817220    my $type = $app->param('_type'); 
    17389     my ( $grp, $user, $role ); 
    17390     my $grp_class = $app->model("group"); 
    17391     if ($group_id) { 
    17392         return unless $grp_class; 
    17393         $grp = $grp_class->load($group_id); 
    17394     } 
    17395     elsif ($author_id) { 
     17221    my ( $user, $role ); 
     17222    if ($author_id) { 
    1739617223        $user = MT::Author->load($author_id); 
    1739717224    } 
     
    1746017287              ) 
    1746117288            : (), 
    17462             $group_id 
    17463             ? ( 
    17464                 group_name => $grp->name, 
    17465                 group_id   => $grp->id, 
    17466               ) 
    17467             : (), 
    1746817289            $role_id 
    1746917290            ? ( 
     
    1748117302            push @panels, 'blog'; 
    1748217303        } 
    17483         if ( !$author_id && !$group_id ) { 
     17304        if ( !$author_id ) { 
    1748417305            if ( $type eq 'user' ) { 
    1748517306                unshift @panels, 'author'; 
    17486             } 
    17487             else { 
    17488                 unshift @panels, 'group'; 
    1748917307            } 
    1749017308        } 
     
    1750517323                panel_description => $app->translate("Name"), 
    1750617324            }, 
    17507             'group' => { 
    17508                 panel_title       => $app->translate("Select Groups"), 
    17509                 panel_label       => $app->translate("Group Name"), 
    17510                 items_prompt      => $app->translate("Groups Selected"), 
    17511                 search_label      => $app->translate("Search Groups"), 
    17512                 panel_description => $app->translate("Description"), 
    17513             }, 
    1751417325            'role' => { 
    1751517326                panel_title       => $app->translate("Select Roles"), 
     
    1754517356                $terms->{status} = MT::Author::ACTIVE(); 
    1754617357                $terms->{type}   = MT::Author::AUTHOR(); 
    17547             } 
    17548             elsif ( $source eq 'group' ) { 
    17549                 $terms->{status} = $grp_class->ACTIVE(); 
    1755017358            } 
    1755117359 
     
    1765017458    my $blogs   = $app->param('blog')   || ''; 
    1765117459    my $authors = $app->param('author') || ''; 
    17652     my $groups  = $app->param('group')  || ''; 
    1765317460    my $roles   = $app->param('role')   || ''; 
    1765417461    my $author_id = $app->param('author_id'); 
    1765517462    my $blog_id   = $app->param('blog_id'); 
    17656     my $group_id  = $app->param('group_id'); 
    1765717463    my $role_id   = $app->param('role_id'); 
    1765817464 
    1765917465    my @blogs   = split /,/, $blogs; 
    1766017466    my @authors = split /,/, $authors; 
    17661     my @groups  = split /,/, $groups; 
    1766217467    my @roles   = split /,/, $roles; 
    1766317468 
    1766417469    require MT::Blog; 
    1766517470    require MT::Role; 
    17666     my $grp_class = $app->model("group"); 
    1766717471 
    1766817472    foreach (@blogs) { 
     
    1767017474        $id =~ s/\D//g; 
    1767117475        $_ = MT::Blog->load($id); 
    17672     } 
    17673     foreach (@groups) { 
    17674         return unless $grp_class;