[pLog-svn] r3437 - in plog/trunk: class/summary/view js/cookie
templates/admin templates/summary
mark at devel.lifetype.net
mark at devel.lifetype.net
Fri May 19 03:42:52 GMT 2006
Author: mark
Date: 2006-05-19 03:42:50 +0000 (Fri, 19 May 2006)
New Revision: 3437
Modified:
plog/trunk/class/summary/view/summarycachedview.class.php
plog/trunk/class/summary/view/summaryusercreationview.class.php
plog/trunk/class/summary/view/summaryview.class.php
plog/trunk/js/cookie/cookie.js
plog/trunk/templates/admin/header.template
plog/trunk/templates/summary/header.template
plog/trunk/templates/summary/registerstep1.template
Log:
Some code re-arrange.
Add a new template variable baseurl to summarycacheview and summaryview. We can use it to get the basr_url of current installation.
Modified: plog/trunk/class/summary/view/summarycachedview.class.php
===================================================================
--- plog/trunk/class/summary/view/summarycachedview.class.php 2006-05-18 19:44:26 UTC (rev 3436)
+++ plog/trunk/class/summary/view/summarycachedview.class.php 2006-05-19 03:42:50 UTC (rev 3437)
@@ -7,7 +7,7 @@
* objects while the summary does not so we had to reimplement part of the functionality... This is
* ideal or optimal but it works so we will let it be for a while.
*/
- class SummaryCachedView extends View
+ class SummaryCachedView extends View
{
var $_templateName;
@@ -21,17 +21,17 @@
$this->_templateName = $templateName;
$this->_data = $data;
$this->_viewId = $this->generateCacheId();
-
- $this->generateTemplate();
+
+ $this->generateTemplate();
}
-
+
function generateTemplate()
{
include_once( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
$templateService = new TemplateService();
$this->_template = $templateService->customTemplate( $this->_templateName, "summary", true );
-
+
// set the summary custom time
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
$config =& Config::getConfig();
@@ -53,22 +53,22 @@
foreach( $this->_data as $key => $value )
$cacheId .= "$key=$value";
$cacheId = md5($cacheId);
-
+
return $cacheId;
}
-
+
function getBlogViewId()
{
return $this->_viewId;
}
-
+
function isCached()
{
$isCached = $this->_template->isCached( $this->_viewId );
-
+
return $isCached;
}
-
+
/**
* @private
*/
@@ -78,30 +78,34 @@
if( $this->_params->keyExists( "locale" )) {
$this->_locale = $this->_params->getValue( "locale" );
}
- else {
+ else {
$config =& Config::getConfig();
- $this->_locale =& Locales::getLocale( $config->getValue("default_locale" ));
+ $this->_locale =& Locales::getLocale( $config->getValue("default_locale" ));
}
}
-
+
function sendUncachedOutput()
{
include_once( PLOG_CLASS_PATH."class/xml/rssparser/rssparser.class.php" );
+ $config =& Config::getConfig();
+ $baseurl = $config->getValue( "base_url" );
+
$this->_getLocale();
$this->_params->setValue( "version", new Version());
$this->_params->setValue( "locale", $this->_locale);
$this->_params->setValue( "rss", new RssParser());
+ $this->_params->setValue( "baseurl", $baseurl);
$this->_template->assign( $this->_params->getAsArray());
- print $this->_template->fetch( $this->_viewId );
+ print $this->_template->fetch( $this->_viewId );
}
-
+
function getCacheTimeSeconds()
{
$config =& Config::getConfig();
-
+
$cacheTime = $config->getValue( "http_cache_lifetime", 1800 );
-
+
if( $cacheTime == "" || !is_numeric($cacheTime))
$cacheTime = 1; // [almost] no value, just one second of caching
if( $cacheTime == -1 )
@@ -110,7 +114,7 @@
$cacheTime = 788400000;
return( $cacheTime );
- }
+ }
function render()
{
@@ -120,25 +124,25 @@
// set the view character set based on the default locale
$this->_getLocale();
$this->setCharset( $this->_locale->getCharset());
-
+
$sendOutput = true;
-
+
// check if support for conditional HTTP requests is enabled
$config =& Config::getConfig();
if( $config->getValue( "template_http_cache_enabled" )) {
- include_once( PLOG_CLASS_PATH."class/net/http/httpcache.class.php" );
+ include_once( PLOG_CLASS_PATH."class/net/http/httpcache.class.php" );
// some debug information
$timestamp = $this->_template->getCreationTimestamp();
// and now send the correct headers
if( HttpCache::httpConditional( $timestamp, $this->getCacheTimeSeconds()))
$sendOutput = false;
-
- header( "Last-Modified: ".gmdate('D, d M Y H:i:s', $timestamp).' GMT');
+
+ header( "Last-Modified: ".gmdate('D, d M Y H:i:s', $timestamp).' GMT');
}
else {
$sendOutput = true;
}
-
+
if( $sendOutput ) {
View::render();
$this->sendUncachedOutput();
Modified: plog/trunk/class/summary/view/summaryusercreationview.class.php
===================================================================
--- plog/trunk/class/summary/view/summaryusercreationview.class.php 2006-05-18 19:44:26 UTC (rev 3436)
+++ plog/trunk/class/summary/view/summaryusercreationview.class.php 2006-05-19 03:42:50 UTC (rev 3437)
@@ -7,9 +7,9 @@
{
$this->SummaryView( "registerstep1" );
}
-
+
function render()
- {
+ {
$config =& Config::getConfig();
// check whether we should also display one of those authentication images
if( $config->getValue( "use_captcha_auth" )) {
@@ -23,11 +23,10 @@
$this->setValue( "useCaptchaAuth", true );
}
else {
- $this->setValue( "useCaptchaAuth", false );
+ $this->setValue( "useCaptchaAuth", false );
}
- $this->setValue( "summaryBaseUrl", $config->getValue( "base_url" )."/summary.php" );
-
- parent::render();
+
+ parent::render();
}
}
?>
\ No newline at end of file
Modified: plog/trunk/class/summary/view/summaryview.class.php
===================================================================
--- plog/trunk/class/summary/view/summaryview.class.php 2006-05-18 19:44:26 UTC (rev 3436)
+++ plog/trunk/class/summary/view/summaryview.class.php 2006-05-19 03:42:50 UTC (rev 3437)
@@ -5,7 +5,7 @@
include_once( PLOG_CLASS_PATH."class/locale/locales.class.php" );
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
- class SummaryView extends View
+ class SummaryView extends View
{
var $_templateName;
@@ -17,36 +17,41 @@
$this->_templateName = $templateName;
$this->_templateFolder = $templateFolder;
}
-
+
/**
* @private
*/
function _getLocale()
{
- // load the Locale object from the view context or initialize it now
+ // load the Locale object from the view context or initialize it now
if( $this->_params->keyExists( "locale" )) {
$this->_locale = $this->_params->getValue( "locale" );
}
- else {
+ else {
$config =& Config::getConfig();
- $this->_locale =& Locales::getLocale( $config->getValue("default_locale" ));
+ $this->_locale =& Locales::getLocale( $config->getValue("default_locale" ));
}
- }
+ }
function render()
{
+ // fetch the baseurl
+ $config =& Config::getConfig();
+ $baseurl = $config->getValue( "base_url" );
+
// load the locale
$this->_getLocale();
- // set the view character set based on the locale
+ // set the view character set based on the locale
$this->setCharset( $this->_locale->getCharset());
parent::render();
-
+
$templateService = new TemplateService();
$template = $templateService->customTemplate( $this->_templateName, $this->_templateFolder );
$this->_params->setValue( "version", new Version());
$this->_params->setValue( "locale", $this->_locale );
+ $this->_params->setValue( "baseurl", $baseurl);
$template->assign( $this->_params->getAsArray());
print $template->fetch();
}
Modified: plog/trunk/js/cookie/cookie.js
===================================================================
--- plog/trunk/js/cookie/cookie.js 2006-05-18 19:44:26 UTC (rev 3436)
+++ plog/trunk/js/cookie/cookie.js 2006-05-19 03:42:50 UTC (rev 3437)
@@ -28,7 +28,7 @@
setCookie(name,"",-1);
}
-// Make a unique cookie name for each blog.
+// Make a unique cookie name for each blog.
// If you change this, please remember change the cookie name in adminaddpostaction.class.php too.
var re = new RegExp("[^a-zA-Z0-9]", "g" );
-var LTCookieBaseName = "LT" + plogBaseUrl.replace( re, "" ) + plogAdminBlogId;
\ No newline at end of file
+var LTCookieBaseName = "LT" + plogBaseUrl.replace( re, "" ) + plogBlogId;
\ No newline at end of file
Modified: plog/trunk/templates/admin/header.template
===================================================================
--- plog/trunk/templates/admin/header.template 2006-05-18 19:44:26 UTC (rev 3436)
+++ plog/trunk/templates/admin/header.template 2006-05-19 03:42:50 UTC (rev 3437)
@@ -19,7 +19,7 @@
// base url where we can find the admin.php script
var plogBaseUrl = "{$url->getBaseUrl(false)}";
var plogAdminBaseUrl = "{$url->getBaseUrl(false)}/admin.php";
- var plogAdminBlogId = "{$blog->getId()}";
+ var plogBlogId = "{$blog->getId()}";
</script>
<script type="text/javascript" src="js/ui/default.js"></script>
<script type="text/javascript" src="js/ui/common.js"></script>
@@ -51,13 +51,13 @@
<div id="menu">
{if !$blogEnablePullDownMenu}
{$menu->generateAt("menu",1)}
- {/if}
+ {/if}
</div>
</div>
{if $blogEnablePullDownMenu}
{$menu->generateAt("menu","3","","JavaScript")}
{/if}
-
+
<div style="text-align: right; padding-right: 5px;">
<select name="userBlog" id="userBlog" onChange="MM_jumpMenu('parent',this,0)">
{foreach from=$userBlogs item=userBlog}
Modified: plog/trunk/templates/summary/header.template
===================================================================
--- plog/trunk/templates/summary/header.template 2006-05-18 19:44:26 UTC (rev 3436)
+++ plog/trunk/templates/summary/header.template 2006-05-19 03:42:50 UTC (rev 3437)
@@ -12,6 +12,13 @@
<!--[if IE ]>
<link rel="stylesheet" href="styles/summary-ie.css" type="text/css" media="screen" />
<![endif] -->
+<script type="text/javascript">
+ var blogLocale = '{$locale->getCharset()|upper}';
+ // base url where we can find the admin.php script
+ var plogBaseUrl = "{$baseurl}";
+ var plogSummaryBaseUrl = plogBaseUrl + "/summary.php";
+ var plogBlogId = "0";
+</script>
<script type="text/javascript" src="js/ui/default.js"></script>
<script type="text/javascript" src="js/ui/common.js"></script>
</head>
@@ -48,6 +55,6 @@
<h2>{$section}</h2>
</div>
<br style="clear:both;" />
- </div>
+ </div>
{/if}
<div id="content" >
Modified: plog/trunk/templates/summary/registerstep1.template
===================================================================
--- plog/trunk/templates/summary/registerstep1.template 2006-05-18 19:44:26 UTC (rev 3436)
+++ plog/trunk/templates/summary/registerstep1.template 2006-05-19 03:42:50 UTC (rev 3437)
@@ -2,7 +2,6 @@
<script type="text/javascript" src="js/prototype/prototype.js"></script>
<script type="text/javascript" src="js/ui/summary.js"></script>
<script type="text/javascript">
- var plogSummaryBaseUrl = "{$summaryBaseUrl}/summary.php";
var successCheckUserNameMessage = "{$locale->tr("check_username_ok")}";
var errorCheckUserNameMessage = "{$locale->tr("error_username_exist")}";
</script>
@@ -11,7 +10,7 @@
<legend>{$locale->tr("step1")}</legend>
<p>
{$locale->tr("register_step1_help")}
- </p>
+ </p>
{include file="summary/formvalidate.template" message=$locale->tr("error_adding_user")}
<div class="field">
<label for="userName">{$locale->tr("username")}</label>
@@ -25,19 +24,19 @@
<div class="field">
<label for="userFullName">{$locale->tr("full_name")}</label>
<span class="required">*</span>
- <div class="formHelp">{$locale->tr("full_name_help")}</div>
+ <div class="formHelp">{$locale->tr("full_name_help")}</div>
<input type="text" name="userFullName" value="{$userFullName}" id="userFullName" />
- </div>
+ </div>
<div class="field">
<label for="userPassword">{$locale->tr("password")}</label>
<span class="required">*</span>
<input type="password" name="userPassword" id="userPassword" value="{$userPassword}"/>
- {include file="summary/validate.template" field=userPassword message=$locale->tr("error_invalid_password")}
+ {include file="summary/validate.template" field=userPassword message=$locale->tr("error_invalid_password")}
<label for="userPasswordCheck">
{$locale->tr("confirm_password")}</label>
<span class="required">*</span>
<input type="password" name="userPasswordCheck" id="userPasswordCheck" value="{$userPasswordCheck}"/>
- {include file="summary/validate.template" field=userPasswordCheck message=$locale->tr("error_passwords_dont_match")}
+ {include file="summary/validate.template" field=userPasswordCheck message=$locale->tr("error_passwords_dont_match")}
</div>
<div class="field">
<label for="userPasswordCheck">{$locale->tr("email")}</label>
More information about the pLog-svn
mailing list