[pLog-svn] r534 - in plog/trunk: class/action/admin class/view/admin templates/admin

oscar at devel.plogworld.net oscar at devel.plogworld.net
Sat Dec 18 23:46:42 GMT 2004


Author: oscar
Date: 2004-12-18 23:46:41 +0000 (Sat, 18 Dec 2004)
New Revision: 534

Added:
   plog/trunk/class/view/admin/adminsimpleresourceslistview.class.php
Modified:
   plog/trunk/class/action/admin/adminresourcelistaction.class.php
   plog/trunk/templates/admin/resourcelist.template
Log:
finished improving the list of resources. Now it uses the same colors as the rest of the interface and shows a drop-down list to select an album from the list at the top of the page. The amount of code has been reduced because most of the functionality of this view is also provided by AdminResourcesView.

Modified: plog/trunk/class/action/admin/adminresourcelistaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminresourcelistaction.class.php	2004-12-18 23:20:14 UTC (rev 533)
+++ plog/trunk/class/action/admin/adminresourcelistaction.class.php	2004-12-18 23:46:41 UTC (rev 534)
@@ -6,17 +6,16 @@
 
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresource.class.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
+    include_once( PLOG_CLASS_PATH."class/view/admin/adminsimpleresourceslistview.class.php" );
 
     /**
-     * Deletes a resource from the blog
+     * shows a simple list with the resources so that users can choose one
      */
     class AdminResourceListAction extends AdminAction
     {
 
     	var $_destination;
+		var $_albumId;
 
     	/**
          * Constructor. If nothing else, it also has to call the constructor of the parent
@@ -42,28 +41,8 @@
          */
         function perform()
         {
-        	$galleryAlbums = new GalleryAlbums();
-            if( $this->_albumId > 0 ) {
-            	$album = $galleryAlbums->getAlbum( $this->_albumId, $this->_blogInfo->getId());
-				$this->notifyEvent( EVENT_ALBUM_LOADED, Array( "album" => &$album ));
-			}
-        	// get the subalbums
-            $albums = $galleryAlbums->getChildAlbums( $this->_albumId, $this->_blogInfo->getId());
-			$this->notifyEvent( EVENT_ALBUMS_LOADED, Array( "albums" => &$albums ));
-            // and the resources in this album
-            $galleryResources = new GalleryResources();
-            $resources = $galleryResources->getUserResources( $this->_blogInfo->getId(), $this->_albumId );
-			$this->notifyEvent( EVENT_RESOURCES_LOADED, Array( "resources" => &$resources ));
-
-            $this->_view = new AdminTemplatedView( $this->_blogInfo, "resourcelist" );
-            $this->_view->setValue( "album", $album );
-            $this->_view->setValue( "albums", $albums );
-            $this->_view->setValue( "resources", $resources );
-            $this->_view->setValue( "destination", $this->_destination );
-            $this->_view->setValue( "blogname", StringUtils::text2url( $this->_blogInfo->getBlog() )); 			
-            $this->_view->setValue( "requestformat", $this->_config->getValue( "request_format_mode"));
-            $this->_view->setValue( "baseurl", $this->_config->getValue( "base_url" ));
-            $this->_view->setValue( "htmlarea", $this->_config->getValue( "htmlarea_enabled" ));
+			$this->_view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId));
+			$this->_view->setValue( "destination", $this->_destination );
             $this->setCommonData();
 
             return true;

Added: plog/trunk/class/view/admin/adminsimpleresourceslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminsimpleresourceslistview.class.php	2004-12-18 23:20:14 UTC (rev 533)
+++ plog/trunk/class/view/admin/adminsimpleresourceslistview.class.php	2004-12-18 23:46:41 UTC (rev 534)
@@ -0,0 +1,29 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/stringutils.class.php" );
+	
+	class AdminSimpleResourcesListView extends AdminResourcesListView
+	{
+	
+		function AdminSimpleResourcesListView( $blogInfo, $params = Array())
+		{
+			$this->AdminResourcesListView( $blogInfo, $params );
+			
+			// change the template, the one chosen by the view above is not
+			// exactly the one we needed
+			$this->_templateName = "resourcelist";
+		}
+		
+		function render()
+		{
+			$config =& Config::getConfig();
+            $this->setValue( "blogname", StringUtils::text2url( $this->_blogInfo->getBlog() )); 			
+            $this->setValue( "requestformat", $config->getValue( "request_format_mode"));
+            $this->setValue( "baseurl", $config->getValue( "base_url" ));
+            $this->setValue( "htmlarea", $config->getValue( "htmlarea_enabled" ));
+
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Modified: plog/trunk/templates/admin/resourcelist.template
===================================================================
--- plog/trunk/templates/admin/resourcelist.template	2004-12-18 23:20:14 UTC (rev 533)
+++ plog/trunk/templates/admin/resourcelist.template	2004-12-18 23:46:41 UTC (rev 534)
@@ -36,6 +36,34 @@
   {/literal}</style>
  </head>
 <body onLoad="resourceListWindowInit();" style="">
+        <div id="list_nav_bar">
+            <div id="list_nav_select"> 
+<form id="resourceListAlbum" action="admin.php" method="post">
+ <fieldset>
+  <legend>{$locale->tr("show_album")}</legend>
+   <div class="list_nav_option">
+    <label for="showCategory">{$locale->tr("album")}</label>
+	<br />
+    <select name="albumId">
+      <option value="0">{$locale->tr("root_album")}</option>
+   {foreach from=$albumsList item=albumItem}
+     {assign var=indentLevel value=$albumItem->getValue("level")}
+	 <option value="{$albumItem->getId()}" {if $album}{if $album->getName()==$albumItem->getName()}selected="selected"{/if}{/if}>
+	   {textformat indent=$indentLevel indent_char="&nbsp;&nbsp;&nbsp;"}{$albumItem->getName()}{/textformat}   
+	 </option>
+   {/foreach}
+   </select>
+   </div>
+   <div class="list_nav_option">
+    <br />
+    <input type="hidden" name="op" value="resourceList">
+    <input type="submit" name="Show" value="{$locale->tr("show")}">
+   </div>
+  </fieldset> 
+ </form> 
+ </div>
+ <br style="clear:both">
+ </div>
  <div id="container">
 <table class="info">
  <thead>




More information about the pLog-svn mailing list