[pLog-svn] r3518 - plog/trunk/class/view
Mark Wu
markplace at gmail.com
Sat Jun 3 07:31:33 GMT 2006
Hi Oscar:
This commit just fixed the bug list here
http://bugs.lifetype.net/view.php?id=923
I need your confirmation about the method is doable or not.
If not, I will revert the change.
Mark
> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of
> mark at devel.lifetype.net
> Sent: Saturday, June 03, 2006 3:00 PM
> To: plog-svn at devel.lifetype.net
> Subject: [pLog-svn] r3518 - plog/trunk/class/view
>
> Author: mark
> Date: 2006-06-03 06:59:49 +0000 (Sat, 03 Jun 2006) New Revision: 3518
>
> Modified:
> plog/trunk/class/view/smartyview.class.php
> Log:
> Fixed bug http://bugs.lifetype.net/view.php?id=923.
>
> When site admin delete a site template. I don't think check
> the template used by any one is a good idea. It is very time
> consuming and waste our cpu resource.
>
> The better way is when we trigger the SmartyView, we check
> the templateSet that blog used exist or not.
>
> If yes, we jusy go ahead and use it. If not, we use the
> default_template and write the information back to blogInfo.
>
> Modified: plog/trunk/class/view/smartyview.class.php
> ===================================================================
> --- plog/trunk/class/view/smartyview.class.php
> 2006-06-03 06:44:16 UTC (rev 3517)
> +++ plog/trunk/class/view/smartyview.class.php
> 2006-06-03 06:59:49 UTC (rev 3518)
> @@ -26,6 +26,7 @@
>
> var $_cachingEnabled;
> var $_templateName;
> + var $_templateSetName;
> var $_template;
> var $_data;
> var $_viewId;
> @@ -60,13 +61,29 @@
>
> // name of the tepmlate
> $this->_templateName = $templateName;
> +
> + // name of the template set name
> + $blogSettings = $this->_blogInfo->getSettings();
> + $this->_templateSetName =
> $blogSettings->getValue( 'template' );
>
> + // Check the template exist or not
> + // If not, we use the defaule_template
> and also assign the default_template back to blogInfo
> + if ( !$this->isTemplateSetExist(
> $this->_templateSetName ) )
> + {
> + $config =& Config::getConfig();
>
> + $this->_templateSetName =
> $config->getValue( "default_template" );
> + $this->_blogInfo->setTemplate(
> $this->_templateSetName );
> +
> + include_once(
> PLOG_CLASS_PATH.'class/dao/blogs.class.php' );
> + $blogs = new Blogs();
> + $blogs->updateBlog( $this->_blogInfo );
> + }
> +
> // get the right CachedTemplate or
> Template object
> - $blogSettings = $this->_blogInfo->getSettings();
>
> $ts = new TemplateService();
> if( $this->isCachingEnabled()) {
> // get a CachedTemplate object
> - $this->_template =
> $ts->CachedTemplate( $this->_templateName,
> $blogSettings->getValue( 'template' ), $this->_blogInfo );
> + $this->_template =
> $ts->CachedTemplate( $this->_templateName,
> +$this->_templateSetName, $this->_blogInfo );
> // data used to calculate the view id
> $this->_data = $data;
> // and generate the right cache
> id for it @@ -102,9 +119,23 @@
>
> return $isCached;
> }
> -
>
> /**
> + * returns true if the current template set
> does exist or flase if it does not exist
> + *
> + * @return true if template set exist or false otherwise
> + */
> + function isTemplateSetExist( $templateSetName )
> + {
> + include_once(
> PLOG_CLASS_PATH.'class/template/templatesets/templatesets.clas
> s.php' );
> + $templateSets = new TemplateSets();
> + if( !$templateSets->isTemplate(
> $templateSetName ) && !$templateSets->isBlogTemplate(
> $templateSetName, $this->_blogInfo->getId() ) )
> + return false;
> + else
> + return true;
> + }
> +
> + /**
> * generates a unique identifier for this view.
> The cache identifier is generated
> * based on the last parameter passed to the
> view constructor
> *
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list