[pLog-svn] r2796 - plog/trunk/class/template/templatesets

mark at devel.lifetype.net mark at devel.lifetype.net
Mon Jan 16 10:50:14 GMT 2006


Author: mark
Date: 2006-01-16 10:50:13 +0000 (Mon, 16 Jan 2006)
New Revision: 2796

Modified:
   plog/trunk/class/template/templatesets/templatesets.class.php
   plog/trunk/class/template/templatesets/templatesetstorage.class.php
Log:
The addBlogTemplate/deletBlogTemplte should work again. But I have no idea how to solve the cache issue. Please follow the steps to reproduce my problem:

1. Add a template through addBlogTemplate (for example fdwan.zip)
2. Delete the fdwan template through deleteBlogTemplate
3. Okay, now goto BlogSettings, and update the settings.
4. You will see the fdwan apper again ... 

Weird, it seems I only add it or remove it from cache, not real DB update ...

Modified: plog/trunk/class/template/templatesets/templatesets.class.php
===================================================================
--- plog/trunk/class/template/templatesets/templatesets.class.php	2006-01-16 08:10:06 UTC (rev 2795)
+++ plog/trunk/class/template/templatesets/templatesets.class.php	2006-01-16 10:50:13 UTC (rev 2796)
@@ -184,7 +184,8 @@
         function isBlogTemplate( $templateName, $blogId )
         {
         	$blogs = new Blogs();
-            $blogSettings = $blogs->getBlogSettings( $blogId );
+        	$blog = $blogs->getBlogInfo( $blogId );
+            $blogSettings = $blog->getSettings( $blogId );
 
             // get the array with the template names stored in the settings
             $blogTemplates = $blogSettings->getValue( "blog_templates" );

Modified: plog/trunk/class/template/templatesets/templatesetstorage.class.php
===================================================================
--- plog/trunk/class/template/templatesets/templatesetstorage.class.php	2006-01-16 08:10:06 UTC (rev 2795)
+++ plog/trunk/class/template/templatesets/templatesetstorage.class.php	2006-01-16 10:50:13 UTC (rev 2796)
@@ -158,13 +158,12 @@
          */
         function removeBlogTemplate( $templateName, $blogId )
         {
-            die("removeBlogTemplate: FIXME!!!");
-        
         	$config =& Config::getConfig();
 
             // get the settings of this blog
-            $blogs = new Blogs();
-            $blogSettings = $blogs->getBlogSettings( $blogId );
+        	$blogs = new Blogs();
+            $blog = $blogs->getBlogInfo( $blogId );
+            $blogSettings = $blog->getSettings();
 
             // looks like the blog doesn't exist, so let's not bother...
             if( $blogSettings == false || $blogSettings == "" )
@@ -186,7 +185,8 @@
 
             // finally, save the settings
             $blogSettings->setValue( "blog_templates", $newTemplateList );
-            $blogs->updateBlogSettings( $blogId, $blogSettings );
+            $blog->setSettings( $blogSettings );
+            $blogs->updateBlog( $blog );            
 
             return true;
         }
@@ -281,11 +281,9 @@
          */
         function addLocalTemplate( $templateName, $blogId )
         {
-            die("addLocaleTemplatemplate: FIXME!!!");
-        
         	$blogs = new Blogs();
             $blog = $blogs->getBlogInfo( $blogId );
-            $blogSettings = $blog->getBlogSettings();
+            $blogSettings = $blog->getSettings();
             if( $blogSettings == "" || $blogSettings == false )
             	return false;
 
@@ -301,7 +299,8 @@
 
             array_push( $blogTemplates, $templateName );
             $blogSettings->setValue( "blog_templates", $blogTemplates );
-            $blogs->updateBlogSettings( $blogId, $blogSettings );
+            $blog->setSettings( $blogSettings );
+            $blogs->updateBlog( $blog );
 
             return true;
         }



More information about the pLog-svn mailing list