Changeset 1093
- Timestamp:
- 10/31/07 19:08:35 (2 years ago)
- Location:
- branches/athena
- Files:
-
- 6 added
- 125 modified
-
MANIFEST.SKIP (modified) (1 diff)
-
build/mt-dists/make-js (modified) (2 diffs)
-
build/sample.pm (modified) (8 diffs)
-
build/theme_templates/modules/content.css.tt (modified) (2 diffs)
-
build/theme_templates/modules/default/screen.css.tt (modified) (1 diff)
-
build/theme_templates/modules/header/basic.css.tt (modified) (1 diff)
-
build/theme_templates/modules/header/unity.css.tt (modified) (1 diff)
-
build/theme_templates/modules/layout.css.tt (modified) (1 diff)
-
default_templates/atom.mtml (modified) (1 diff)
-
default_templates/base_theme.mtml (modified) (4 diffs)
-
default_templates/categories.mtml (modified) (1 diff)
-
default_templates/entry_detail.mtml (modified) (1 diff)
-
default_templates/entry_listing.mtml (modified) (1 diff)
-
default_templates/page_detail.mtml (modified) (1 diff)
-
default_templates/rss.mtml (modified) (1 diff)
-
default_templates/search_results.mtml (modified) (2 diffs)
-
default_templates/sidebar_2col.mtml (modified) (4 diffs)
-
default_templates/sidebar_3col.mtml (modified) (4 diffs)
-
default_templates/tags.mtml (modified) (1 diff)
-
extras/examples/plugins/reCaptcha/README (added)
-
lib/MT.pm.pre (modified) (5 diffs)
-
lib/MT/App.pm (modified) (6 diffs)
-
lib/MT/App/CMS.pm (modified) (72 diffs)
-
lib/MT/App/Comments.pm (modified) (12 diffs)
-
lib/MT/App/NotifyList.pm (modified) (2 diffs)
-
lib/MT/App/Wizard.pm (modified) (8 diffs)
-
lib/MT/Asset.pm (modified) (1 diff)
-
lib/MT/Asset/Image.pm (modified) (1 diff)
-
lib/MT/Compat/v3.pm (modified) (1 diff)
-
lib/MT/Component.pm (modified) (3 diffs)
-
lib/MT/ConfigMgr.pm (modified) (1 diff)
-
lib/MT/Core.pm (modified) (3 diffs)
-
lib/MT/L10N/de.pm (modified) (9 diffs)
-
lib/MT/L10N/en_us.pm (modified) (7 diffs)
-
lib/MT/L10N/es.pm (modified) (9 diffs)
-
lib/MT/L10N/fr.pm (modified) (9 diffs)
-
lib/MT/L10N/ja.pm (modified) (8 diffs)
-
lib/MT/L10N/nl.pm (modified) (9 diffs)
-
lib/MT/Object.pm (modified) (1 diff)
-
lib/MT/ObjectDriver/DDL.pm (modified) (3 diffs)
-
lib/MT/ObjectDriverFactory.pm (modified) (1 diff)
-
lib/MT/Permission.pm (modified) (1 diff)
-
lib/MT/Template/Context.pm (modified) (1 diff)
-
lib/MT/Template/ContextHandlers.pm (modified) (7 diffs)
-
lib/MT/TemplateMap.pm (modified) (1 diff)
-
lib/MT/Upgrade.pm (modified) (1 diff)
-
lib/MT/Util.pm (modified) (1 diff)
-
lib/MT/XMLRPCServer.pm (modified) (1 diff)
-
mt-check.cgi.pre (modified) (7 diffs)
-
mt-static/css/structure.css (modified) (4 diffs)
-
mt-static/js/edit.js (modified) (1 diff)
-
mt-static/mt.js (modified) (1 diff)
-
mt-static/themes/cityscape-austin/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-boston/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-chicago/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-dc/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-houston/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-kiev/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-la/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-london/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-miami/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-nashville/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-nyc/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-paris/screen.css (modified) (4 diffs)
-
mt-static/themes/cityscape-philadelphia/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-portland/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-seattle/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-sf/screen.css (modified) (4 diffs)
-
mt-static/themes/cityscape-sydney/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-tokyo/screen.css (modified) (4 diffs)
-
mt-static/themes/cityscape-toronto/screen.css (modified) (6 diffs)
-
mt-static/themes/cityscape-vegas/screen.css (modified) (6 diffs)
-
mt-static/themes/hills-dusk/screen.css (modified) (6 diffs)
-
mt-static/themes/hills-green/screen.css (modified) (4 diffs)
-
mt-static/themes/hills-midnight/screen.css (modified) (6 diffs)
-
mt-static/themes/hills-pink/screen.css (modified) (4 diffs)
-
mt-static/themes/minimalist-blue/screen.css (modified) (7 diffs)
-
mt-static/themes/minimalist-brown/screen.css (modified) (7 diffs)
-
mt-static/themes/minimalist-green/screen.css (modified) (4 diffs)
-
mt-static/themes/minimalist-grey/screen.css (modified) (7 diffs)
-
mt-static/themes/minimalist-light-blue/screen.css (modified) (7 diffs)
-
mt-static/themes/minimalist-light-green/screen.css (modified) (7 diffs)
-
mt-static/themes/minimalist-pink/screen.css (modified) (7 diffs)
-
mt-static/themes/minimalist-purple/screen.css (modified) (7 diffs)
-
mt-static/themes/minimalist-red/screen.css (modified) (4 diffs)
-
mt-static/themes/minimalist-white/screen.css (modified) (7 diffs)
-
mt-static/themes/unity-blue/screen.css (modified) (5 diffs)
-
mt-static/themes/unity-green/screen.css (modified) (6 diffs)
-
mt-static/themes/unity-purple/screen.css (modified) (6 diffs)
-
mt-static/themes/unity-tricolor/screen.css (modified) (5 diffs)
-
php/extlib/ezsql/ezsql_mysql.php (modified) (1 diff)
-
php/lib/MTUtil.php (modified) (1 diff)
-
php/lib/MTViewer.php (modified) (3 diffs)
-
php/lib/function.mtarchivetypelabel.php (added)
-
php/mt.php.pre (modified) (1 diff)
-
plugins/MultiBlog/lib/MultiBlog.pm (modified) (3 diffs)
-
plugins/MultiBlog/lib/MultiBlog/L10N/ja.pm (modified) (1 diff)
-
plugins/MultiBlog/multiblog.pl (modified) (1 diff)
-
plugins/TemplateRefresh/TemplateRefresh.pl (modified) (1 diff)
-
plugins/WXRImporter/lib/WXRImporter/WXRHandler.pm (modified) (1 diff)
-
plugins/WidgetManager/default_widgets/signin.tmpl (modified) (1 diff)
-
readme.html (modified) (1 diff)
-
tmpl/cms/cfg_comments.tmpl (modified) (1 diff)
-
tmpl/cms/cfg_plugin.tmpl (modified) (2 diffs)
-
tmpl/cms/cfg_registration.tmpl (modified) (4 diffs)
-
tmpl/cms/cfg_system_users.tmpl (modified) (2 diffs)
-
tmpl/cms/dialog/asset_list.tmpl (modified) (1 diff)
-
tmpl/cms/edit_author.tmpl (modified) (5 diffs)
-
tmpl/cms/edit_role.tmpl (modified) (1 diff)
-
tmpl/cms/edit_template.tmpl (modified) (1 diff)
-
tmpl/cms/include/author_table.tmpl (modified) (2 diffs)
-
tmpl/cms/include/blog-left-nav.tmpl (modified) (1 diff)
-
tmpl/cms/include/calendar.tmpl (modified) (2 diffs)
-
tmpl/cms/include/cfg_content_nav.tmpl (modified) (1 diff)
-
tmpl/cms/include/entry_table.tmpl (modified) (3 diffs)
-
tmpl/cms/include/list_associations (added)
-
tmpl/cms/include/list_associations/page_title.tmpl (added)
-
tmpl/cms/include/list_associations/table_role_view.tmpl (added)
-
tmpl/cms/include/list_associations/table_user_view.tmpl (added)
-
tmpl/cms/include/member_table.tmpl (modified) (2 diffs)
-
tmpl/cms/include/users_content_nav.tmpl (modified) (3 diffs)
-
tmpl/cms/list_asset.tmpl (modified) (1 diff)
-
tmpl/cms/list_association.tmpl (modified) (5 diffs)
-
tmpl/cms/list_category.tmpl (modified) (1 diff)
-
tmpl/cms/list_folder.tmpl (modified) (1 diff)
-
tmpl/cms/list_role.tmpl (modified) (4 diffs)
-
tmpl/cms/list_template.tmpl (modified) (1 diff)
-
tmpl/cms/search_replace.tmpl (modified) (3 diffs)
-
tmpl/comment/login.tmpl (modified) (1 diff)
-
tmpl/comment/signup.tmpl (modified) (3 diffs)
-
tmpl/wizard/configure.tmpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/athena/MANIFEST.SKIP
r1090 r1093 39 39 #mt-static/themes/unity-tricolor 40 40 41 ^addons41 #^addons 42 42 43 43 ^schemas -
branches/athena/build/mt-dists/make-js
r1086 r1093 9 9 10 10 my $js = `cat mt-static/mt.js`; 11 $js .= `cat mt-static/js/edit.js`; 11 12 $js .= `cat mt-static/js/dialog.js`; 12 13 $js .= `cat mt-static/js/assetdetail.js`; … … 15 16 $js .= `cat tmpl/cms/widget/blog_stats.tmpl`; 16 17 $js .= `cat tmpl/cms/list_tag.tmpl`; 18 $js .= `cat tmpl/cms/include/calendar.tmpl`; 17 19 18 20 foreach my $lang (qw(ja de nl fr es)) { -
branches/athena/build/sample.pm
r1089 r1093 75 75 '[_1] Editing Menu' => '', 76 76 'Entries' => '', 77 'Create NewEntry' => '',77 'Create Entry' => '', 78 78 'List & Edit Entries' => '', 79 79 'Upload File' => '', … … 313 313 'You must set your Site URL.' => '', 314 314 'You did not select a timezone.' => '', 315 'Create newweblog' => '',315 'Create weblog' => '', 316 316 'Your weblog configuration has been saved.' => '', 317 317 'Name your weblog. The weblog name can be changed at any time.' => '', … … 431 431 'Delete, view, and edit authors via a complete list of authors in the system.' => '', 432 432 'General Permissions' => '', 433 'User can create newweblogs' => '',433 'User can create weblogs' => '', 434 434 'User can view activity log' => '', 435 435 'Weblog:' => '', … … 457 457 ## Template-editing screen (edit_template.tmpl) 458 458 'List Templates' => '', 459 'Create NewTemplate' => '',459 'Create Template' => '', 460 460 'Edit Template' => '', 461 461 'Template Name' => '', … … 512 512 ## Main Menu screen (list_blog.tmpl) 513 513 '[_1]: Welcome to the Main Menu' => '', 514 'Select an existing weblog to edit, create newweblogs, 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.' => '', 515 515 'Your selected weblog has been deleted.' => '', 516 516 'Your existing weblogs:' => '', … … 522 522 'Manage Weblog' => '', 523 523 'Delete Weblog' => '', 524 'Create newWeblog' => '',524 'Create Weblog' => '', 525 525 'Add/Edit Weblog authors' => '', 526 526 'Add authors, set permissions' => '', … … 570 570 'You have successfully deleted the checked template(s).' => '', 571 571 'Index templates' => '', 572 'Create newindex template' => '',572 'Create index template' => '', 573 573 'Rebuild?' => '', 574 574 'Archive-Related Templates' => '', 575 'Create newarchive template' => '',575 'Create archive template' => '', 576 576 'Miscellaneous Templates' => '', 577 577 'Template Modules' => '', 578 'Create newtemplate module' => '',578 'Create template module' => '', 579 579 580 580 ## Login screen (login.tmpl) … … 825 825 "You do not have export permissions" => "", 826 826 "Export failed on entry '[_1]': [_2]" => "", 827 "You need to provide a password if you are going to\ncreate newauthors 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" => "", 828 828 "Can't open directory '[_1]': [_2]" => "", 829 829 "Can't open file '[_1]': [_2]" => "", -
branches/athena/build/theme_templates/modules/content.css.tt
r1090 r1093 36 36 } 37 37 38 .asset-footer,39 .asset-footer a,40 38 .comment-footer, 41 39 .comment-footer a, … … 54 52 .search-form-header, 55 53 .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 %]; 57 55 } 58 56 -
branches/athena/build/theme_templates/modules/default/screen.css.tt
r1092 r1093 61 61 62 62 .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 } 66 65 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 %]; 70 68 } 71 69 -
branches/athena/build/theme_templates/modules/header/basic.css.tt
r1089 r1093 15 15 } 16 16 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 -%] 17 22 #header-content { 23 width: [% theme.header.text.width || '842px' %]; 24 [% IF theme.header.text.height %] 25 min-height: [% theme.header.text.height %]; 26 [% END %] 18 27 margin: [% theme.header.content.margin || '20px 0 60px 20px' %]; 19 28 } -
branches/athena/build/theme_templates/modules/header/unity.css.tt
r1089 r1093 24 24 25 25 #header-content { 26 margin -top: 10px;26 margin: 10px 20px 0; 27 27 } 28 28 -
branches/athena/build/theme_templates/modules/layout.css.tt
r1089 r1093 9 9 } 10 10 11 # beta-inner, #gamma-inner {11 #header-inner, #beta-inner, #gamma-inner { 12 12 padding-right: 0; 13 13 padding-left: 0; -
branches/athena/default_templates/atom.mtml
r1088 r1093 28 28 </MTEntryTags></MTEntryIfTagged> 29 29 <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"$> 32 32 </content> 33 33 </entry> -
branches/athena/default_templates/base_theme.mtml
r1092 r1093 214 214 /* Assets */ 215 215 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 216 249 .asset, 217 250 .comments, … … 226 259 .asset-content, 227 260 .asset-body, 228 .entry-categories,229 .entry-tags,230 261 .comments-header, 231 262 .comment-header, … … 253 284 } 254 285 286 .entry-categories, 287 .entry-tags { 288 margin-bottom: .5em; 289 } 290 255 291 .asset-name { 256 292 margin-bottom: .25em; 257 293 } 258 294 295 .asset-footer, 259 296 .asset-meta { 260 297 font-size: 11px; 261 298 } 262 299 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 263 312 .content-nav { 264 313 text-align: center; 265 314 } 266 315 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; 298 334 } 299 335 … … 407 443 width: 70px; 408 444 } 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 1 1 <MTIfNonEmpty tag="EntryCategory"> 2 2 <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> 9 7 </div> 10 8 </MTIfNonEmpty> -
branches/athena/default_templates/entry_detail.mtml
r1092 r1093 15 15 </div> 16 16 </MTIfNonEmpty> 17 <MTIf name="entry_template">18 <$MTInclude module="<__trans phrase="Categories">"$>19 </MTIf>20 <$MTInclude module="<__trans phrase="Tags">"$>21 17 </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> 23 24 </div> -
branches/athena/default_templates/entry_listing.mtml
r1088 r1093 26 26 </MTEntries> 27 27 <MTElse> 28 <MTEntries limit="auto">28 <MTEntries limit="auto"> 29 29 <$MTEntryTrackbackData$> 30 30 <$MTInclude module="<__trans phrase="Entry Summary">"$> 31 </MTEntries>31 </MTEntries> 32 32 </MTIf> 33 33 -
branches/athena/default_templates/page_detail.mtml
r1088 r1093 15 15 </MTIfNonEmpty> 16 16 </div> 17 <div class="asset-footer"></div> 17 18 </div> -
branches/athena/default_templates/rss.mtml
r1088 r1093 13 13 <item> 14 14 <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> 16 16 <link><$MTEntryPermalink encode_xml="1"$></link> 17 17 <guid><$MTEntryPermalink encode_xml="1"$></guid> -
branches/athena/default_templates/search_results.mtml
r1090 r1093 11 11 <$MTInclude module="<__trans phrase="Header">"$> 12 12 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  26 <input type="checkbox" name="RegexSearch" /> <__trans phrase="Regex search">27 </div>28 </form>29 </div>30 </div>31 </MTIfStraightSearch>32 33 13 <MTSearchResults> 34 14 <MTBlogResultHeader> 35 15 <h1 class="search-results-header"> 36 16 <MTIfStraightSearch> 37 <__trans phrase=" Matching entries matching “[_1]” from [_2]" params="<$MTSearchString$>%%<$MTBlogName$>">17 <__trans phrase="Results matching “[_1]” from [_2]" params="<$MTSearchString$>%%<$MTBlogName encode_html="1"$>"> 38 18 </MTIfStraightSearch> 39 19 <MTIfTagSearch> 40 <__trans phrase=" Entries tagged with “[_1]” from [_2]" params="<$MTSearchString$>%%<$MTBlogName$>">20 <__trans phrase="Results tagged “[_1]” from [_2]" params="<$MTSearchString$>%%<$MTBlogName encode_html="1"$>"> 41 21 </MTIfTagSearch> 42 22 </h1> … … 52 32 <h1 class="search-results-header"> 53 33 <MTIfStraightSearch> 54 <__trans phrase=" Entries matching “[_1]”" params="<$MTSearchString$>">34 <__trans phrase="Results matching “[_1]”" params="<$MTSearchString$>"> 55 35 </MTIfStraightSearch> 56 36 <MTIfTagSearch> 57 <__trans phrase=" Entries tagged with“[_1]”" params="<$MTSearchString$>">37 <__trans phrase="Results tagged “[_1]”" params="<$MTSearchString$>"> 58 38 </MTIfTagSearch> 59 39 </h1> 60 <p><__trans phrase="No pages were found containing“[_1]”." params="<$MTSearchString$>"></p>40 <p><__trans phrase="No results found for “[_1]”." params="<$MTSearchString$>"></p> 61 41 </MTNoSearchResults> 62 42 -
branches/athena/default_templates/sidebar_2col.mtml
r1091 r1093 1 1 <div id="beta"> 2 2 <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> 3 21 <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 “<$MTSearchString$>”."></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 “<$MTSearchString$>”."></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"$>&Template=feed&IncludeBlogs=<$MTSearchIncludeBlogs$>" title="<__trans phrase="Subscribe to feed">"><__trans phrase="Subscribe to feed"></a></p>16 </div>17 </div>18 22 <MTIfTagSearch> 19 23 <div class="widget-tags widget"> … … 29 33 </MTIfTagSearch> 30 34 </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>41 35 <MTIf name="module_about_context"> 42 36 <div class="widget-welcome widget"> … … 202 196 <MTArchiveListHeader> 203 197 <div class="widget-archives widget"> 204 <h3 class="widget-header"><__trans phrase="[_1] <a href="[_2]">Archives</a>" params="<$MTArchive Label$>%%<$MTBlogURL$>archives.html"></h3>198 <h3 class="widget-header"><__trans phrase="[_1] <a href="[_2]">Archives</a>" params="<$MTArchiveTypeLabel$>%%<$MTBlogURL$>archives.html"></h3> 205 199 <div class="widget-content"> 206 200 <ul class="widget-list"> … … 253 247 <div class="widget-syndicate widget"> 254 248 <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"$>&Template=feed&IncludeBlogs=<$MTSearchIncludeBlogs$>" title="<__trans phrase="Subscribe to feed">"><__trans phrase="Search results matching “<$MTSearchString$>”"></a></li> 254 </mt:ifnonempty> 255 </MTIf> 256 </ul> 257 257 </div> 258 258 </div> -
branches/athena/default_templates/sidebar_3col.mtml
r1091 r1093 112 112 <MTArchiveListHeader> 113 113 <div class="widget-archives widget"> 114 <h3 class="widget-header"><__trans phrase="[_1] <a href="[_2]">Archives</a>" params="<$MTArchive Label$>%%<$MTBlogURL$>archives.html"></h3>114 <h3 class="widget-header"><__trans phrase="[_1] <a href="[_2]">Archives</a>" params="<$MTArchiveTypeLabel$>%%<$MTBlogURL$>archives.html"></h3> 115 115 <div class="widget-content"> 116 116 <ul class="widget-list"> … … 163 163 <div class="widget-syndicate widget"> 164 164 <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"$>&Template=feed&IncludeBlogs=<$MTSearchIncludeBlogs$>" title="<__trans phrase="Subscribe to feed">"><__trans phrase="Search results matching “<$MTSearchString$>”"></a></li> 170 </mt:ifnonempty> 171 </MTIf> 172 </ul> 167 173 </div> 168 174 </div> … … 176 182 <div id="gamma"> 177 183 <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> 178 202 <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 “<$MTSearchString$>”."></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 “<$MTSearchString$>”."></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"$>&Template=feed&IncludeBlogs=<$MTSearchIncludeBlogs$>" title="<__trans phrase="Subscribe to feed">"><__trans phrase="Subscribe to feed"></a></p>191 </div>192 </div>193 203 <MTIfTagSearch> 194 204 <div class="widget-tags widget"> … … 204 214 </MTIfTagSearch> 205 215 </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>216 216 <MTIf name="module_recent_entries"> 217 217 <div class="widget-archives widget"> -
branches/athena/default_templates/tags.mtml
r1088 r1093 1 1 <MTEntryIfTagged> 2 2 <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> 4 4 <ul class="entry-tags-list"> 5 <MTEntryTags> 6 <li class="entry-tag"><a href="<$MTTagSearchLink$>&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$>&IncludeBlogs=<$MTBlogID$>" rel="tag"><$MTTagName$></a></MTEntryTags></li> 8 6 </ul> 9 7 </div> -
branches/athena/lib/MT.pm.pre
r1091 r1093 847 847 unless $cfg->ObjectDriver; 848 848 849 $cfg->read_config_db();850 851 # Tell any instantiated drivers to reconfigure themselves as necessary852 MT::ObjectDriverFactory->configure;853 854 849 if ( $MT::DebugMode = $cfg->DebugMode ) { 855 850 require Data::Dumper; … … 868 863 869 864 $mt->{cfg} = $cfg; 865 866 1; 867 } 868 869 sub 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; 870 877 871 878 1; … … 982 989 ## the rest of the initialization process. 983 990 $mt->init_config( \%param ) or return; 991 $mt->init_addons(@_) or return; 992 $mt->init_config_from_db( \%param ) or return; 984 993 $mt->init_plugins(@_) or return; 985 994 $plugins_installed = 1; … … 997 1006 MT->add_callback( 'build_file_filter', 5, $mt, 998 1007 sub { MT->publisher->queue_build_file_filter(@_) } ); 1008 } 1009 1010 sub 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); 999 1017 } 1000 1018 … … 1011 1029 my @PluginPaths = $cfg->PluginPath; 1012 1030 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 1034 sub _init_plugins_core { 1035 my $mt = shift; 1036 my ($PluginSwitch, $use_plugins, $PluginPaths) = @_; 1037 1038 foreach my $PluginPath (@$PluginPaths) { 1018 1039 my $plugin_lastdir = $PluginPath; 1019 1040 $plugin_lastdir =~ s![\\/]$!!; -
branches/athena/lib/MT/App.pm
r1091 r1093 40 40 41 41 sub core_widgets { 42 {} 43 } 44 45 sub core_search_apis { 42 46 {} 43 47 } … … 115 119 my $admin = ($user && $user->is_superuser()) 116 120 || ($perms && $perms->blog_id && $perms->has('administer_blog')); 121 my $system_perms = $user->permissions(0) unless $perms && $perms->blog_id; 117 122 118 123 my $test = sub { 119 124 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 } 120 136 if (my $p = $item->{permission}) { 121 137 my $allowed = 0; … … 207 223 @$filters = sort { $a->{order} <=> $b->{order} } @$filters; 208 224 return $filters; 225 } 226 227 sub 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; 209 244 } 210 245 … … 350 385 $args->{sort} = 'id' 351 386 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 352 391 my $iter = 353 392 ref($iter_method) eq 'CODE' … … 359 398 my $row = $obj->column_values(); 360 399 $hasher->( $obj, $row ) if $hasher; 400 #$app->run_callbacks( 'app_listing_'.$app->mode, 401 # $app, $obj, $row ); 361 402 push @data, $row; 362 403 last if (scalar @data == $limit) && (!$no_limit); … … 1898 1939 } 1899 1940 } 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 1900 1948 push @paths, File::Spec->catdir($path, $app->{template_dir}) 1901 1949 if $app->{template_dir}; 1902 1950 push @paths, $path; 1951 1903 1952 return @paths; 1904 1953 } -
branches/athena/lib/MT/App/CMS.pm
r1092 r1093 182 182 'recover_profile_password' => \&recover_profile_password, 183 183 'rename_tag' => \&rename_tag, 184 'synchronize' => \&synchronize,185 184 'remove_user_assoc' => \&remove_user_assoc, 186 185 'revoke_role' => \&revoke_role, … … 205 204 'dialog_post_comment' => \&dialog_post_comment, 206 205 'dialog_select_weblog' => \&dialog_select_weblog, 207 'dialog_select_user' => \&dialog_select_user,208 206 'dialog_select_sysadmin' => \&dialog_select_sysadmin, 209 207 'dialog_grant_role' => \&dialog_grant_role, … … 293 291 my $obj_class = $app->model($obj_ds) or return; 294 292 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 } 295 296 my $tag_obj = 296 297 $tag_class->load( { name => $tag_name }, { binary => { name => 1 } } ); … … 1315 1316 args => { _type => "author" }, 1316 1317 permission => "administer", 1318 condition => sub { 1319 return !MT->config->ExternalUserManagement; 1320 }, 1317 1321 }, 1318 1322 'create:entry' => { … … 1363 1367 mode => 'list_comments', 1364 1368 order => 2000, 1365 permission => ' post,edit_all_posts,manage_feedback,comment',1369 permission => 'create_post,edit_all_posts,manage_feedback,comment', 1366 1370 }, 1367 1371 'manage:asset' => { … … 1381 1385 mode => 'list_pings', 1382 1386 order => 5000, 1383 permission => ' post,edit_all_posts,manage_feedback',1387 permission => 'create_post,edit_all_posts,manage_feedback', 1384 1388 }, 1385 1389 'manage:category' => { … … 2127 2131 my $blog = $blogs{ $obj->blog_id } ||= $obj->blog; 2128 2132 $row->{blog_name} = $blog ? $blog->name : '-'; 2129 $row->{file_path} = $obj->file_path; # has to be called to calculate2130 2133 $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 ); 2136 2140 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; 2141 2142 if ( $size < 1024 ) { 2142 2143 $row->{file_size_formatted} = sprintf( "%d Bytes", $size ); … … 2152 2153 } 2153 2154 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 2156 2166 my $ts = $obj->created_on; 2157 2167 if ( my $by = $obj->created_by ) { … … 2239 2249 $app->return_to_dashboard( redirect => 1 ) if $app->param('blog_id'); 2240 2250 2241 my $group_id = $app->param('group_id');2242 my $author_id = $app->param('author_id');2243 2244 2251 my $pref = $app->list_pref('role'); 2245 2252 my $all_perms; … … 2252 2259 } 2253 2260 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 } 2267 2274 ); 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( 2285 2277 { 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 }, 2311 2284 } 2312 2285 ); 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( 2316 2310 { 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 ); 2461 2324 } 2462 2325 … … 2466 2329 my $blog_id = $app->param('blog_id'); 2467 2330 my $author_id = $app->param('author_id'); 2468 my $group_id = $app->param('group_id');2469 2331 my $role_id = $app->param('role_id'); 2470 2332 … … 2483 2345 } 2484 2346 2485 my ( $grp, $user, $role ); 2486 my $grp_class = $app->model('group'); 2347 my ( $user, $role ); 2487 2348 $app->error(undef); 2488 2349 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 }2505 2350 if ($author_id) { 2506 $app->add_breadcrumb( $app->translate('Users & Groups'),2351 $app->add_breadcrumb( $app->translate('Users'), 2507 2352 $app->user->is_superuser 2508 2353 ? $app->uri( mode => 'list_authors' ) … … 2538 2383 $app->add_breadcrumb( $app->translate("Role Users & Groups") ); 2539 2384 } 2540 if ( !$role_id && !$group_id&& !$author_id ) {2385 if ( !$role_id && !$author_id ) { 2541 2386 if ($blog_id) { 2542 $app->add_breadcrumb( $app->translate("Users & Groups") );2387 $app->add_breadcrumb( $app->translate("Users") ); 2543 2388 } 2544 2389 else { … … 2562 2407 my $hasher = sub { 2563 2408 my ( $obj, $row ) = @_; 2564 my $group;2565 2409 if ( my $user = $obj->user ) { 2566 2410 $row->{user_id} = $user->id; 2567 2411 $row->{user_name} = $user->name; 2568 }2569 elsif ( $grp_class && ( $group = $obj->group ) ) {2570 $row->{group_name} = $group->name;2571 2412 } 2572 2413 if ( my $role = $obj->role ) { … … 2611 2452 $app->model('association') or return; 2612 2453 my $types; 2613 if ( !$ group_id && !$author_id && !$blog_id ) {2454 if ( !$author_id && !$blog_id ) { 2614 2455 $types = [ 2615 2456 MT::Association::USER_BLOG_ROLE(), 2616 MT::Association::GROUP_BLOG_ROLE(),2617 2457 MT::Association::USER_ROLE(), 2618 MT::Association::GROUP_ROLE()2619 2458 ]; 2620 2459 } 2621 elsif ( !$ group_id && !$author_id ) {2460 elsif ( !$author_id ) { 2622 2461 $types = [ 2623 2462 MT::Association::USER_BLOG_ROLE(), 2624 MT::Association::GROUP_BLOG_ROLE()2625 2463 ]; 2626 2464 } … … 2628 2466 $types = 2629 2467 [ 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() ];2634 2468 } 2635 2469 … … 2665 2499 terms => { 2666 2500 type => $types, 2667 $group_id ? ( group_id => $group_id ) : (),2668 2501 $author_id ? ( author_id => $author_id ) : (), 2669 2502 $blog_id ? ( blog_id => $blog_id ) : (), 2670 2503 $role_id ? ( role_id => $role_id ) : (), 2671 2504 }, 2505 pre_build => $pre_build, 2672 2506 params => { 2673 2507 can_create_association => $app->user->is_superuser || ( $blog_id … … 2675 2509 has_expanded_mode => 1, 2676 2510 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 ) 2679 2513 && !$role_id, 2680 2514 blog_view => $blog_id ? 1 : 0, 2681 2515 user_view => $author_id ? 1 : 0, 2682 group_support => $grp_class ? 1 : 0,2683 group_view => $group_id ? 1 : 0,2684 2516 role_view => $role_id ? 1 : 0, 2685 2517 $role_id … … 2692 2524 ? ( 2693 2525 edit_author_id => $author_id, 2694 edit_ author_name => $user2526 edit_name => $user 2695 2527 ? ( $user->nickname ? $user->nickname : $user->name ) 2696 2528 : $app->translate('(newly created user)'), 2529 edit_object => $app->translate('The user'), 2697 2530 group_count => $user ? $user->group_count() : 0, 2698 2531 status_enabled => $user ? ( $user->is_active ? 1 : 0 ) : 0, … … 2702 2535 ) 2703 2536 : (), 2704 $group_id2705 ? (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 : (),2712 2537 saved => $app->param('saved') || 0, 2713 2538 saved_deleted => $app->param('saved_deleted') || 0, 2714 usergroup_view => !$author_id && !$group_id&& !$role_id,2539 usergroup_view => !$author_id && !$role_id, 2715 2540 blog_id => $blog_id, 2716 (2717 $grp_class2718 ? (2719 can_add_groups => !$app->config->ExternalGroupManagement2720 || (2721 $app->config->ExternalGroupManagement2722 && $grp_class->count(2723 { status => MT::Group::ACTIVE() }2724 ) > 02725 )2726 )2727 : ()2728 ),2729 2541 search_label => $app->translate('Users'), 2730 2542 object_type => 'association', 2543 pt_name => $app->translate('User'), 2731 2544 }, 2732 2545 } … … 3464 3277 my $menu = $menus->{$id}; 3465 3278 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 } 3466 3285 3467 3286 $menu->{allowed} = 1; … … 3471 3290 my @sub; 3472 3291 foreach my $sub_id (@sub_ids) { 3292 my $sub = $menus->{$sub_id}; 3473 3293 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; 3478 3304 } 3479 3305 … … 4302 4128 4303 4129 $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};4306 4130 $param->{search_label} = $app->translate('Users'); 4307 4131 $param->{object_type} = 'author'; … … 4417 4241 my %author_entry_count; 4418 4242 $param{tab_users} = 1; 4419 my ( $filter_col, $val , $group_id, $group);4243 my ( $filter_col, $val ); 4420 4244 $param{filter_args} = ""; 4421 4245 my %terms = ( type => MT::Author::AUTHOR() ); 4422 4423 my $grp_class = $app->model('group');4424 $param{group_support} = 1 if $grp_class;4425 4246 4426 4247 my $filter_key = $app->param('filter_key'); … … 4449 4270 } 4450 4271 $param{can_create_user} = $this_author->is_superuser; 4451 $param{external_user_management} = $app->config->ExternalUserManagement;4452 $param{external_group_management} = $app->config->ExternalGroupManagement;4453 4272 $param{synchronized} = 1 if $app->param('synchronized'); 4454 4273 $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 ); 4469 4275 my ( @data, %authors, %entry_count_refs ); 4470 4276 my $entry_class = $app->model('entry'); … … 4489 4295 if $au->created_by; 4490 4296 if ($parent_author) { 4491 $row->{created_by } = $parent_author->name;4297 $row->{created_by_name} = $parent_author->name; 4492 4298 } 4493 4299 else { 4494 $row->{created_by } = $app->translate('(user deleted)');4300 $row->{created_by_name} = $app->translate('(user deleted)'); 4495 4301 } 4496 4302 } … … 4902 4708 return $app->error( $app->translate("Permission denied.") ) 4903 4709 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 } 4916 4723 } 4917 4724 $app->add_return_arg( 'reset' => 1 ); … … 5302 5109 my $cfg = $app->config; 5303 5110 $param{styles} = ''; 5304 if ( $type eq 'author' || $type eq 'group') {5111 if ( $type eq 'author' ) { 5305 5112 if ( $perms || $blog_id ) { 5306 5113 return $app->return_to_dashboard( redirect => 1 ); … … 6180 5987 $param{search_label} = $app->translate('Users'); 6181 5988 $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; 6204 5990 } 6205 5991 $param{status_enabled} = $obj->is_active ? 1 : 0; 6206 5992 $param{status_pending} = 6207 5993 $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 }6222 5994 $param{can_modify_password} = 6223 5995 ( $param{editing_other_profile} || $param{is_me} ) … … 6446 6218 $app->config->NewUserAutoProvisioning ? 1 : 0 6447 6219 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 }6453 6220 $param{can_modify_password} = MT::Auth->password_exists; 6454 6221 $param{can_recover_password} = MT::Auth->can_recover_password; … … 6903 6670 } 6904 6671 elsif ( $type eq 'author' ) { 6905 $app->add_breadcrumb( $app->translate("Users & Groups"),6672 $app->add_breadcrumb( $app->translate("Users"), 6906 6673 $app->user->is_superuser 6907 6674 ? $app->uri( mode => 'list_authors' ) … … 6915 6682 } 6916 6683 else { 6917 $app->add_breadcrumb( $app->translate("Create NewUser") );6684 $app->add_breadcrumb( $app->translate("Create User") ); 6918 6685 $param{languages} = 6919 6686 $app->languages_list( $app->config('DefaultUserLanguage') ) … … 6939 6706 } 6940 6707 $param{'nav_authors'} = 1; 6941 $param{'external_user_management'} =6942 $app->config->ExternalUserManagement;6943 $param{'external_group_management'} =6944 $app->config->ExternalGroupManagement;6945 6708 } 6946 6709 if ( ( $q->param('msg') || "" ) eq 'nosuch' ) { … … 7569 7332 # the CMS app; COMMENTERs are created from the Comments app. 7570 7333 $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 }7607 7334 7608 7335 my $pass = $app->param('pass'); … … 11172 10899 plugin_compat_errors => $registry->{compat_errors}, 11173 10900 }; 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 11174 10907 $row->{plugin_tags} = listify( 11175 10908 [ … … 11181 10914 # Format all 'block' tags with <MT(name)> 11182 10915 map { s/\?$//; "<MT$_>" } 11183 ( keys %{ $ registry->{tags}{block}|| {} } )10916 ( keys %{ $block_tags || {} } ) 11184 10917 ), 11185 10918 ( … … 11187 10920 # Format all 'function' tags with <$MT(name)$> 11188 10921 map { "<\$MT$_\$>" } 11189 ( keys %{ $ registry->{tags}{function}|| {} } )10922 ( keys %{ $function_tags || {} } ) 11190 10923 ) 11191 10924 ) 11192 10925 ] 11193 ) if $ registry->{tags}{block} || $registry->{tags}{function};10926 ) if $block_tags || $function_tags; 11194 10927 $row->{plugin_attributes} = listify( 11195 10928 [ … … 11197 10930 # Filter out 'plugin' registry entry 11198 10931 grep { $_ ne 'plugin' } 11199 keys %{ $ registry->{tags}{modifier}|| {} }10932 keys %{ $modifiers || {} } 11200 10933 ] 11201 ) if $ registry->{tags}{modifier};10934 ) if $modifiers; 11202 10935 $row->{plugin_junk_filters} = listify( 11203 10936 [ … … 11205 10938 # Filter out 'plugin' registry entry 11206 10939 grep { $_ ne 'plugin' } 11207 keys %{ $ registry->{junk_filters}|| {} }10940 keys %{ $junk_filters || {} } 11208 10941 ] 11209 ) if $ registry->{junk_filters};10942 ) if $junk_filters; 11210 10943 $row->{plugin_text_filters} = listify( 11211 10944 [ … … 11213 10946 # Filter out 'plugin' registry entry 11214 10947 grep { $_ ne 'plugin' } 11215 keys %{ $ registry->{text_filters}|| {} }10948 keys %{ $text_filters || {} } 11216 10949 ] 11217 ) if $ registry->{text_filters};10950 ) if $text_filters; 11218 10951 if ( $row->{plugin_tags} 11219 10952 || $row->{plugin_attributes} … … 11243 10976 11244 10977 # no registered plugin objects-- 11245 # are there any tags/attributes/filters to expose?11246 my $registry = $plugin->{registry};11247 10978 $row = { 11248 10979 first => $next_is_first, … … 11254 10985 plugin_disabled => $profile->{enabled} ? 0 : 1, 11255 10986 plugin_id => $id, 11256 plugin_compat_errors => $registry->{compat_errors},11257 10987 }; 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 }11278 10988 push @$data, $row; 11279 10989 } … … 14711 14421 } 14712 14422 else { 14713 $app->add_breadcrumb( $app->translate('Create NewRole') );14423 $app->add_breadcrumb( $app->translate('Create Role') ); 14714 14424 } 14715 14425 $param{screen_class} = "settings-screen edit-role"; … … 15539 15249 my $app = shift; 15540 15250 my $param = $app->do_search_replace(@_) or return; 15251 my $blog_id = $app->param('blog_id'); 15541 15252 $app->add_breadcrumb( $app->translate('Search & Replace') ); 15542 15253 $param->{nav_search} = 1; 15543 15254 $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 15263 sub core_search_apis { 15264 my $app = shift; 15550 15265 my $q = $app->param; 15551 15266 my $blog_id = $q->param('blog_id'); … … 15562 15277 or return $app->error( $app->translate("No permissions") ); 15563 15278 } 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 { 15575 15280 'entry' => { 15281 'order' => 100, 15282 'permission' => 'create_post,publish_post,edit_all_posts', 15283 'label' => $app->translate('Entries'), 15576 15284 'perm_check' => sub { 15577 15285 grep { $_->can_edit_entry( $_[0], $author ) } @perms; 15578 15286 }, 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 }, 15581 15295 'replace_cols' => [qw(title text text_more keywords excerpt)], 15582 15296 'can_replace' => 1, … … 15584 15298 'date_column' => 'authored_on', 15585 15299 }, 15586 'page' => { 15300 'comment' => { 15301 'order' => 200, 15302 'permission' => 'publish_post,create_post,edit_all_posts,manage_feedback', 15303 'label' => $app->translate('Comments'), 15587 15304 '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; 15589 15308 }, 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)], 15593 15317 'can_replace' => 1, 15594 15318 'can_search_by_date' => 1, 15595 'date_column' => 'authored_on',15596 15319 }, 15597 15320 'ping' => { 15321 'order' => 300, 15322 'permission' => 'create_post,publish_post,edit_all_posts,manage_feedback', 15323 'label' => $app->translate('TrackBacks'), 15598 15324 'perm_check' => sub { 15599 15325 my $ping = shift; … … 15609 15335 } 15610 15336 }, 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 }, 15612 15344 'replace_cols' => [qw(title excerpt)], 15613 15345 'can_replace' => 1, 15614 15346 'can_search_by_date' => 1, 15615 15347 }, 15616 'comment' => { 15348 'page' => { 15349 'order' => 400, 15350 'permission' => 'manage_pages', 15351 'label' => $app->translate('Pages'), 15617 15352 '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; 15621 15354 }, 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)], 15624 15364 'can_replace' => 1, 15625 15365 'can_search_by_date' => 1, 15366 'date_column' => 'authored_on', 15367 'results_table_template' => '<mt:include name="include/entry_table.tmpl">', 15626 15368 }, 15627 15369 'template' => { 15370 'order' => 500, 15371 'permission' => 'edit_templates', 15372 'label' => $app->translate('Templates'), 15373 'view' => 'blog', 15628 15374 'perm_check' => sub { 15629 15375 my ($obj) = @_; … … 15638 15384 15639 15385 }, 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 }, 15641 15392 'replace_cols' => [qw(name text linked_file outfile)], 15642 15393 'can_replace' => 1, 15643 15394 'can_search_by_date' => 0, 15644 15395 }, 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 }, 15645 15416 'log' => { 15417 'order' => 700, 15418 'permission' => "view_blog_log", 15419 'system_permission' => "view_log", 15420 'label' => $app->translate('Activity Log'), 15646 15421 'perm_check' => sub { 15647 15422 my ($obj) = @_; … … 15650 15425 return $perm->can_view_blog_log; 15651 15426 }, 15652 'search_cols' => [qw(ip message)], 15427 'search_cols' => { 15428 'ip' => sub { $app->translate('Log Message') }, 15429 'message' => sub { $app->translate('IP Address') }, 15430 }, 15653 15431 'can_replace' => 0, 15654 15432 '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 } 15655 15438 }, 15656 15439 'author' => { 15440 'order' => 800, 15441 'system_permission' => 'administer', 15442 'label' => $app->translate('Users'), 15657 15443 'perm_check' => sub { 15658 15444 return 1 if $author->is_superuser; … … 15663 15449 return 0; 15664 15450 }, 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 }, 15666 15457 'can_replace' => 0, 15667 15458 '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>', 15668 15476 }, 15669 15477 'blog' => { 15478 'order' => 900, 15479 'system_permission' => 'administer', 15480 'label' => $app->translate('Blogs'), 15670 15481 'perm_check' => sub { 15671 15482 return 1 if $author->is_superuser; … … 15675 15486 && ( $perm->can_administer_blog || $perm->can_edit_config ); 15676 15487 }, 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 }, 15678 15494 'replace_cols' => [qw(name site_url site_path description)], 15679 15495 'can_replace' => $author->is_superuser(), 15680 15496 '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 } 15681 15503 } 15682 15504 }; 15505 15506 } 15507 15508 sub _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> 15522 TMPL 15523 } 15524 } 15525 15526 sub 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"); 15683 15533 15684 15534 my ( … … 15693 15543 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 ); 15694 15544 15545 15546 if ( !$type || ( 'category' eq $type ) || ( 'folder' eq $type ) ) { 15547 $type = 'entry'; 15548 } 15549 15695 15550 foreach my $obj_type (qw( role association )) { 15696 15551 if ( $type eq $obj_type ) { … … 15701 15556 $replace && ( $app->validate_magic() or return ); 15702 15557 $search = $orig_search if $do_replace; # for safety's sake 15703 15704 if ( !$type || ( 'category' eq $type ) || ( 'folder' eq $type ) ) {15705 $type = 'entry';15706 }15707 15558 my $list_pref = $app->list_pref($type); 15708 15559 … … 15727 15578 @cols = $q->param('search_cols'); 15728 15579 my %search_api_cols = 15729 map { $_ => 1 } @{ $search_api->{$type}{search_cols} };15580 map { $_ => 1 } keys %{ $search_api->{$type}{search_cols} }; 15730 15581 if ( @cols && ( $cols[0] =~ /,/ ) ) { 15731 15582 @cols = split /,/, $cols[0]; … … 15734 15585 } 15735 15586 else { 15736 @cols = @{ $search_api->{$type}->{search_cols} };15587 @cols = keys %{ $search_api->{$type}->{search_cols} }; 15737 15588 } 15738 15589 foreach ( … … 15790 15641 my %terms; 15791 15642 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); 15813 15646 } 15814 15647 else { … … 15845 15678 }; 15846 15679 } 15847 elsif ( $type eq 'blog' ) { 15848 $args{sort} = 'name'; 15849 $args{direction} = 'ascend'; 15680 if ( $blog_id || ($type eq 'blog') ) { 15850 15681 $iter = $class->load_iter( \%terms, \%args ) or die $class->errstr; 15851 15682 } 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 }15858 15683 else { 15859 15684 15860 # Get an iter for each accessible blog15861 15685 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 ) { 15876 15687 @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 } 15877 15708 } 15878 15709 … … 15988 15819 if (@data) { 15989 15820 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 ); 15991 15823 } else { 15992 15824 my $meth = 'build_' . $type . '_table'; … … 16001 15833 } 16002 15834 $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 } 16003 15849 } 16004 15850 if ($is_dateranged) { … … 16046 15892 ); 16047 15893 $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; 16049 15908 \%res; 16050 15909 } … … 17160 17019 $app->add_return_arg( 'saved' => 1 ); 17161 17020 $app->call_return; 17162 }17163 17164 sub synchronize {17165 my $app = shift;17166 $app->validate_magic or return;17167 $app->user->is_superuser17168 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 => $args17186 )17187 );17188 17021 } 17189 17022 … … 17373 17206 17374 17207 my $author_id = $app->param('author_id'); 17375 my $group_id = $app->param('group_id');17376 17208 my $blog_id = $app->param('blog_id'); 17377 17209 my $role_id = $app->param('role_id'); … … 17387 17219 17388 17220 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) { 17396 17223 $user = MT::Author->load($author_id); 17397 17224 } … … 17460 17287 ) 17461 17288 : (), 17462 $group_id17463 ? (17464 group_name => $grp->name,17465 group_id => $grp->id,17466 )17467 : (),17468 17289 $role_id 17469 17290 ? ( … … 17481 17302 push @panels, 'blog'; 17482 17303 } 17483 if ( !$author_id && !$group_id) {17304 if ( !$author_id ) { 17484 17305 if ( $type eq 'user' ) { 17485 17306 unshift @panels, 'author'; 17486 }17487 else {17488 unshift @panels, 'group';17489 17307 } 17490 17308 } … … 17505 17323 panel_description => $app->translate("Name"), 17506 17324 }, 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 },17514 17325 'role' => { 17515 17326 panel_title => $app->translate("Select Roles"), … … 17545 17356 $terms->{status} = MT::Author::ACTIVE(); 17546 17357 $terms->{type} = MT::Author::AUTHOR(); 17547 }17548 elsif ( $source eq 'group' ) {17549 $terms->{status} = $grp_class->ACTIVE();17550 17358 } 17551 17359 … … 17650 17458 my $blogs = $app->param('blog') || ''; 17651 17459 my $authors = $app->param('author') || ''; 17652 my $groups = $app->param('group') || '';17653 17460 my $roles = $app->param('role') || ''; 17654 17461 my $author_id = $app->param('author_id'); 17655 17462 my $blog_id = $app->param('blog_id'); 17656 my $group_id = $app->param('group_id');17657 17463 my $role_id = $app->param('role_id'); 17658 17464 17659 17465 my @blogs = split /,/, $blogs; 17660 17466 my @authors = split /,/, $authors; 17661 my @groups = split /,/, $groups;17662 17467 my @roles = split /,/, $roles; 17663 17468 17664 17469 require MT::Blog; 17665 17470 require MT::Role; 17666 my $grp_class = $app->model("group");17667 17471 17668 17472 foreach (@blogs) { … … 17670 17474 $id =~ s/\D//g; 17671 17475 $_ = MT::Blog->load($id); 17672 }17673 foreach (@groups) {17674 return unless $grp_class;
