Project: Movable Type
Revision: 3098
Author: bchoate
Date: 13 Oct 2008 17:56:13
Changes:Merging latest changes from fireball to trunk: svn merge -r 3089:3095 http://code.sixapart.com/svn/movabletype/branches/fireball .
Files:modified: /trunk/t/63-objectclasses.t (
try)
modified: /trunk/tmpl/cms/edit_entry.tmpl (
try)
modified: /trunk/lib/MT/CMS/Tools.pm (
try)
modified: /trunk/lib/MT/CMS/Entry.pm (
try)
modified: /trunk/lib/MT/App/Comments.pm (
try)
modified: /trunk/lib/MT/CMS/Blog.pm (
try)
modified: /trunk/lib/MT/Memcached.pm (
try)
modified: /trunk/lib/MT/Object.pm (
try)
modified: /trunk/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm (
try)
Diff:
| ... | ...@@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | use strict; |
| 4 | 4 | use lib 't/lib', 'extlib', 'lib'; |
| 5 | | use Test::More tests => 11; |
| 5 | use Test::More tests => 14; |
| 6 | 6 | |
| 7 | 7 | use MT::Test; |
| 8 | 8 | my $mt = new MT; |
| ... | ...@@ -56,3 +56,11 @@ |
| 56 | 56 | ok($audio->class_type eq 'audio', 'audio class_type is audio'); |
| 57 | 57 | ok(MT::TestAsset->class_type eq 'file', 'generic asset class_type is file'); |
| 58 | 58 | ok(MT::TestAsset::Image->class_type eq 'image', 'generic image asset class type is image'); |
| 59 | |
| 60 | # deflate/inflate tests; object should be re-blessed with proper package name |
| 61 | # upon inflation with base class |
| 62 | my $defl = $audio->deflate; |
| 63 | my $audio2 = MT::TestAsset->inflate( $defl ); |
| 64 | ok($audio2, "Object re-inflated okay"); |
| 65 | ok( ref($audio2) eq ref($audio), "Package name matches"); |
| 66 | ok( $audio->title eq $audio2->title, "Title restored okay"); |
| ... | ...@@ -494,7 +494,9 @@ |
| 494 | 494 | |
| 495 | 495 | <script type="text/javascript"> |
| 496 | 496 | /* <![CDATA[ */ |
| 497 | var orig_text_format; |
| 497 | 498 | var cur_text_format = '<mt:var name="convert_breaks" escape="js">'; |
| 499 | orig_text_format = cur_text_format; |
| 498 | 500 | var customizable_fields = new Array(<mt:unless name="object_type" eq="page">'category',</mt:unless>'excerpt','keywords','tags','publishing','feedback'); |
| 499 | 501 | var default_fields = new Array(); |
| 500 | 502 | <mt:loop name="disp_prefs_default_fields"> |
| ... | ...@@ -564,7 +566,7 @@ |
| 564 | 566 | |
| 565 | 567 | form.text.value = response.result.text; |
| 566 | 568 | form.text_more.value = response.result.text_more; |
| 567 | | cur_text_format = 'richtext'; |
| 569 | orig_text_format = cur_text_format = 'richtext'; |
| 568 | 570 | TC.removeClassName(TC.elementOrId("editor-content"), "editor-plaintext"); |
| 569 | 571 | app.setEditorIframeHTML(); |
| 570 | 572 | } |
| ... | ...@@ -597,7 +599,7 @@ |
| 597 | 599 | if (cur_text_format == 'richtext') { |
| 598 | 600 | // changing to plaintext editor |
| 599 | 601 | TC.addClassName(TC.elementOrId("editor-content"), "editor-plaintext"); |
| 600 | | cur_text_format = option; |
| 602 | orig_text_format = cur_text_format = option; |
| 601 | 603 | app.editor.setMode('textarea'); |
| 602 | 604 | app.editor.focus(); |
| 603 | 605 | } else if (option == 'richtext') { |
| ... | ...@@ -608,7 +610,7 @@ |
| 608 | 610 | '__mode': 'convert_to_html', |
| 609 | 611 | 'text': form.text.value, |
| 610 | 612 | 'text_more': form.text_more.value, |
| 611 | | 'format': cur_text_format |
| 613 | 'format': orig_text_format |
| 612 | 614 | }; |
| 613 | 615 | var params = { |
| 614 | 616 | uri: '<mt:var name="script_url">', method: 'POST', |
| ... | ...@@ -616,7 +618,7 @@ |
| 616 | 618 | }; |
| 617 | 619 | TC.Client.call(params); |
| 618 | 620 | } else { |
| 619 | | cur_text_format = option; |
| 621 | orig_text_format = cur_text_format = option; |
| 620 | 622 | app.editor.focus(); |
| 621 | 623 | } |
| 622 | 624 | } |
| ... | ...@@ -1434,13 +1434,14 @@ |
| 1434 | 1434 | |
| 1435 | 1435 | sub convert_to_html { |
| 1436 | 1436 | my $app = shift; |
| 1437 | | my $format = $app->param('format'); |
| 1437 | my $format = $app->param('format') || ''; |
| 1438 | my @formats = split /\s*,\s*/, $format; |
| 1438 | 1439 | my $text = $app->param('text') || ''; |
| 1439 | 1440 | my $text_more = $app->param('text_more') || ''; |
| 1440 | 1441 | my $result = { |
| 1441 | | text => $app->apply_text_filters( $text, [$format] ), |
| 1442 | | text_more => $app->apply_text_filters( $text_more, [$format] ), |
| 1443 | | format => $format, |
| 1442 | text => $app->apply_text_filters( $text, \@formats ), |
| 1443 | text_more => $app->apply_text_filters( $text_more, \@formats ), |
| 1444 | format => $formats[0], |
| 1444 | 1445 | }; |
| 1445 | 1446 | return $app->json_result($result); |
| 1446 | 1447 | } |
| ... | ...@@ -297,7 +297,8 @@ |
| 297 | 297 | ## Load text filters if user displays them |
| 298 | 298 | my %entry_filters; |
| 299 | 299 | if ( defined( my $filter = $q->param('convert_breaks') ) ) { |
| 300 | | $entry_filters{$filter} = 1; |
| 300 | my @filters = split /\s*,\s*/, $filter; |
| 301 | $entry_filters{$_} = 1 for @filters; |
| 301 | 302 | } |
| 302 | 303 | elsif ($obj) { |
| 303 | 304 | %entry_filters = map { $_ => 1 } @{ $obj->text_filters }; |
| ... | ...@@ -311,6 +312,10 @@ |
| 311 | 312 | my $filters = MT->all_text_filters; |
| 312 | 313 | $param->{text_filters} = []; |
| 313 | 314 | for my $filter ( keys %$filters ) { |
| 315 | if (my $cond = $filters->{$filter}{condition}) { |
| 316 | $cond = MT->handler_to_coderef($cond) if !ref($cond); |
| 317 | next unless $cond->( $type ); |
| 318 | } |
| 314 | 319 | push @{ $param->{text_filters} }, |
| 315 | 320 | { |
| 316 | 321 | filter_key => $filter, |
| ... | ...@@ -341,7 +346,7 @@ |
| 341 | 346 | } |
| 342 | 347 | |
| 343 | 348 | my $rte; |
| 344 | | if ($param->{convert_breaks} eq 'richtext') { |
| 349 | if ($param->{convert_breaks} =~ m/richtext/) { |
| 345 | 350 | ## Rich Text editor |
| 346 | 351 | $rte = lc($app->config('RichTextEditor')); |
| 347 | 352 | } |
| ... | ...@@ -1152,7 +1152,7 @@ |
| 1152 | 1152 | my %param = @_; |
| 1153 | 1153 | my %cookies = $app->cookies(); |
| 1154 | 1154 | my $cookie_name = $app->commenter_cookie; |
| 1155 | | my $session_key = $cookies{$cookie_name}->value() || ""; |
| 1155 | my $session_key = $app->cookie_val($cookie_name) || ""; |
| 1156 | 1156 | $session_key =~ y/+/ /; |
| 1157 | 1157 | my $sessobj = MT::Session->load( { id => $session_key, kind => 'SI' } ); |
| 1158 | 1158 | return |
| ... | ...@@ -19,7 +19,7 @@ |
| 19 | 19 | memcached => $driver_class->new({ |
| 20 | 20 | servers => \@servers, |
| 21 | 21 | ( $ns ? ( namespace => $ns ) : () ), |
| 22 | | debug => 0, |
| 22 | ( $driver_class eq 'Cache::Memcached' ? ( debug => 0 ) : () ), |
| 23 | 23 | }) |
| 24 | 24 | }, $class; |
| 25 | 25 | } else { |
| ... | ...@@ -118,6 +118,7 @@ |
| 118 | 118 | if (!$super_props || !$super_props->{class_column}) { |
| 119 | 119 | $class->add_trigger( pre_search => \&_pre_search_scope_terms_to_class ); |
| 120 | 120 | $class->add_trigger( post_load => \&_post_load_rebless_object ); |
| 121 | $class->add_trigger( post_inflate => \&_post_load_rebless_object ); |
| 121 | 122 | } |
| 122 | 123 | if (my $type = $props->{class_type}) { |
| 123 | 124 | $props->{defaults}{$col} = $type; |
| ... | ...@@ -257,8 +257,8 @@ |
| 257 | 257 | my $blog = MT->model('blog')->load($blog_id) |
| 258 | 258 | or return $app->json_error( $app->translate('No such blog [_1]', $blog_id) ); |
| 259 | 259 | |
| 260 | | my $r = MT->registry; |
| 261 | | my $base_css = $r->{"template_sets"}{$blog->template_set}{"base_css"}; |
| 260 | my $r = MT->registry("template_sets"); |
| 261 | my $base_css = $r->{$blog->template_set || 'mt_blog'}{"base_css"}; |
| 262 | 262 | |
| 263 | 263 | # Replacing the theme import or adding a new one at the beginning |
| 264 | 264 | my $template_text = $tmpl->text(); |
To list