Changeset 875
- Timestamp:
- 12/11/06 07:48:06 (2 years ago)
- Files:
-
- branches/wheeljack/lib/MT/App/CMS.pm (modified) (3 diffs)
- branches/wheeljack/tmpl/cms/cfg_archives.tmpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/wheeljack/lib/MT/App/CMS.pm
r873 r875 8199 8199 $param{dynamic_all} = $blog->custom_dynamic_templates eq 'all'; 8200 8200 $param{show_build_options} = $app->config('ObjectDriver') =~ m/^DBI::(postgres|sqlite|mysql)/; 8201 my $mtview_path = File::Spec->catfile($blog->site_path(), "mtview.php"); 8202 if (-f $mtview_path) { 8203 open my($fh), $mtview_path; 8204 while (my $line = <$fh>) { 8205 $param{dynamic_caching} = 1 if $line =~ m/^\s*\$mt->caching\s*=\s*true;/i; 8206 $param{dynamic_conditional} = 1 if $line =~ /^\s*\$mt->conditional\s*=\s*true;/i; 8207 } 8208 close $fh; 8209 } 8201 8210 $iter = MT::Template->load_iter({ blog_id => $blog->id }); 8202 8211 my(@tmpl); … … 10321 10330 open(my $mv, "<$mtview_path"); 10322 10331 while (my $line = <$mv>) { 10323 $mv_contents .= "//$line" if ($line !~ /<\?(?:php)?|\?>/);10332 $mv_contents .= $line if ($line !~ m!^//|<\?(?:php)?|\?>!); 10324 10333 } 10325 10334 close $mv; … … 10332 10341 my $cache_code = $cache ? "\n \$mt->caching = true;" : ''; 10333 10342 my $conditional_code = $conditional ? "\n \$mt->conditional = true;" : ''; 10334 my $mtview = <<MTVIEW; 10335 <?php 10336 $mv_contents 10343 my $new_mtview = <<NEW_MTVIEW; 10344 10337 10345 include('$mtphp_path'); 10338 10346 \$mt = new MT($blog_id, '$config');$cache_code$conditional_code 10339 10347 \$mt->view(); 10348 NEW_MTVIEW 10349 if ($new_mtview ne substr($mv_contents, 0, length($new_mtview))) { 10350 $mv_contents =~ s!\n!\n//!gs; 10351 my $mtview = <<MTVIEW; 10352 <?php 10353 $new_mtview 10354 $mv_contents 10340 10355 ?> 10341 10356 MTVIEW 10342 $blog->file_mgr->mkpath($blog->site_path); 10343 10344 open(my $mv, ">$mtview_path") 10345 || die "Couldn't open $mtview_path for appending"; 10346 print $mv $mtview || die "Couldn't write to $mtview_path"; 10347 close $mv; 10357 10358 $blog->file_mgr->mkpath($blog->site_path); 10359 open(my $mv, ">$mtview_path") 10360 || die "Couldn't open $mtview_path for appending"; 10361 print $mv $mtview || die "Couldn't write to $mtview_path"; 10362 close $mv; 10363 } 10348 10364 }; if ($@) { print STDERR $@; } 10349 10365 branches/wheeljack/tmpl/cms/cfg_archives.tmpl
r873 r875 121 121 } else { 122 122 fld.style.display = 'block'; 123 TC.Client.call({124 'load': function(c, response) {125 var result;126 try {127 result = eval('('+response+')');128 var cache = getByID("dynamic_cache");129 if (cache)130 cache.checked = result.cache;131 var condition = getByID("dynamic_conditional");132 if (condition)133 condition.checked = result.conditional;134 var progress = getByID("progress-bar");135 if (progress) {136 progress.style.display = "none";137 } else {138 }139 var area = getByID('dynamic_options');140 if (area) {141 area.style.display = "block";142 }143 } catch ( e ) {144 alert(e.message);145 }146 },147 'method': 'POST',148 'uri': '<TMPL_VAR NAME=MT_URL>',149 'arguments': { '__mode': 'js_check_mtview',150 'blog_id': '<TMPL_VAR NAME=BLOG_ID>',151 'magic_token': '<TMPL_VAR NAME=MAGIC_TOKEN>'}152 });153 123 } 154 124 } … … 363 333 <option value="all"<TMPL_IF NAME=DYNAMIC_ALL> selected="selected"</TMPL_IF>><MT_TRANS phrase="Build all templates dynamically"></option> 364 334 </select> 365 <div id="dynamic_options_area" style="display:none;"> 366 <div id="progress-bar"><p><img src="<TMPL_VAR NAME=STATIC_URI>images/indeterminate-progress-bar.gif" alt="" height="24" width="124" /></p></div> 367 <div id="dynamic_options" style="display:none;"> 335 <div id="dynamic_options_area"<TMPL_IF NAME=DYNAMIC_NONE> style="display:none;"</TMPL_IF>> 368 336 <p><MT_TRANS phrase="Optional Settings for Dynamic Publishing:"> <a href="#" onclick="return openManual('blog_settings_publishing', 'dynamic_publishing_options')" class="help">?</a></p> 369 337 <div class="field"> 370 <input type="checkbox" id="dynamic_cache" name="dynamic_cache" /><label for="dynamic_cache"><MT_TRANS phrase="Enable caching"></label> <input type="checkbox" id="dynamic_conditional" name="dynamic_conditional"/><label for="dynamic_conditional"><MT_TRANS phrase="Enable conditional retrieval"></label>338 <input type="checkbox" id="dynamic_cache" name="dynamic_cache" <TMPL_IF NAME=DYNAMIC_CACHING>checked="checked"</TMPL_IF>/><label for="dynamic_cache"><MT_TRANS phrase="Enable caching"></label> <input type="checkbox" id="dynamic_conditional" name="dynamic_conditional" <TMPL_IF NAME=DYNAMIC_CONDITIONAL>checked="checked"</TMPL_IF>/><label for="dynamic_conditional"><MT_TRANS phrase="Enable conditional retrieval"></label> 371 339 </div> 372 340 </div><a href="#" onclick="return openManual('blog_settings_publishing', 'dynamic_publishing')" class="help">?</a> 373 </div>374 341 </div> 375 342 </TMPL_IF>
