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

oscar at devel.plogworld.net oscar at devel.plogworld.net
Sat Jan 8 23:20:20 GMT 2005


Author: oscar
Date: 2005-01-08 23:20:19 +0000 (Sat, 08 Jan 2005)
New Revision: 699

Modified:
   plog/trunk/class/view/admin/adminuserpictureselectview.class.php
   plog/trunk/templates/admin/userpictureselect.template
Log:
changed the look of this page to conform to the standard design. Also improved AdminUserPictureSelect to make it use less code.

Modified: plog/trunk/class/view/admin/adminuserpictureselectview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminuserpictureselectview.class.php	2005-01-08 23:00:44 UTC (rev 698)
+++ plog/trunk/class/view/admin/adminuserpictureselectview.class.php	2005-01-08 23:20:19 UTC (rev 699)
@@ -1,35 +1,28 @@
 <?php
 
-	include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
 	include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresource.class.php" );
 	include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
 
-	class AdminUserPictureSelectView extends AdminTemplatedView
+	/**
+	 * we can extend from AdminResourcesListView and we will save a lot of code...
+	 */
+	class AdminUserPictureSelectView extends AdminResourcesListView
 	{
 		var $_albumId;
 		
 		function AdminUserPictureSelectView( $blogInfo, $params = Array())
 		{
-			$this->AdminTemplatedView( $blogInfo, "userpictureselect" );
-			
-			$this->_albumId = $params["albumId"];
+			$this->AdminResourcesListView( $blogInfo, $params );
+		
+			$this->_templateName = "userpictureselect";
+			$this->_resourceType = GALLERY_RESOURCE_IMAGE;
 		}
 		
 		function render()
 		{
-			$galleryAlbums = new GalleryAlbums();
-			if( $this->_albumId > 0 )
-				$album = $galleryAlbums->getAlbum( $this->_albumId, $this->_blogInfo->getId());
+			$this->_pagerUrl = "?op=userPictureSelect&amp;page=";
 			
-			// get the subalbums
-			$albums = $galleryAlbums->getChildAlbums( $this->_albumId, $this->_blogInfo->getId());
-			// and the resources in this album
-			$galleryResources = new GalleryResources();
-			$resources = $galleryResources->getUserResources( $this->_blogInfo->getId(), $this->_albumId, GALLERY_RESOURCE_IMAGE );
-			$this->setValue( "album", $album );
-			$this->setValue( "albums", $albums );
-			$this->setValue( "resources", $resources );
-			
 			parent::render();
 		}
 	}

Modified: plog/trunk/templates/admin/userpictureselect.template
===================================================================
--- plog/trunk/templates/admin/userpictureselect.template	2005-01-08 23:00:44 UTC (rev 698)
+++ plog/trunk/templates/admin/userpictureselect.template	2005-01-08 23:20:19 UTC (rev 699)
@@ -1,3 +1,4 @@
+{assign var=htmlarea value=$blogsettings->getValue("htmlarea_enabled")}
 <html>
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset={$locale->getCharset()}"/> 
@@ -2,50 +3,106 @@
   <link rel="stylesheet" href="styles/admin.css" type="text/css" />
-  <title>{$locale->tr("select_picture")}</title>
+  <title>{$locale->tr("admin_interface_title")}</title>
   <script type="text/javascript" src="js/htmlarea/popups/popup.js"></script>
   <script type="text/javascript" src="js/htmlarea/htmlarea-plog-resourcelist.js"></script>
   <script type="text/javascript" src="js/ui/common.js"></script>
+  <script type="text/javascript">
+   var plogBaseUrl = '{$baseurl}';
+  </script>
+  <style>{literal}
+   html,body {
+    margin           : 0px;
+    padding          : 0px;
+    background       : #FFFFFF;
+   }
+   #container
+   {
+    width            : 300px;
+    text-align       : left;
+    margin-left      : auto;
+    margin-right     : auto;
+   }
+.info
+{
+    margin-bottom    : 10px;
+    width            : 285px;
+}
+#list_action_bar
+{
+    width            : 285px;
+    padding          : 4px;
+}
+  {/literal}</style>
  </head>
- <body>
+<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="albumId">{$locale->tr("album")}</label>
+	<br />
+    <select name="albumId" id="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="userPictureSelect">
+    <input type="submit" name="Show" value="{$locale->tr("show")}">
+   </div>
+  </fieldset> 
+ </form> 
+ </div>
+ <br style="clear:both">
+ </div>
  <div id="container">
- <h3>{$locale->tr("select_picture")}</h3>
-{assign var="counter" value=0} 
-<table width="100%">
-<tr>
-{if $album}
-{assign var="counter" value="`$counter+1`"}
- <td align="center" valign="center">
-  <a href="?op=userPictureSelect&amp;albumId={$album->getParentId()}">
-   <img src="imgs/folder.gif" border="0" alt="Parent" />&nbsp;<br/>..</a>
- </td>
-{/if}
-{foreach from=$albums item=resalbum}
- <td align="center" valign="center">
-  <a href="?op=userPictureSelect&amp;albumId={$resalbum->getId()}">
-   <img src="imgs/folder.gif" border="0" alt="folder" /><br/>{$resalbum->getName()}</a><br/>
- </td>
-  {assign var="counter" value="`$counter+1`"} 
-  {if $counter%2 == 0}
+<table class="info">
+ <thead>
+  <th style="width:200px";>{$locale->tr("resource")}</th>
+  <th style="width:85px;">{$locale->tr("actions")}</th>
+ </thead>  
+ <tbody>
+  {if $album && $pager->getCurrentPage()==1}
+   <tr class="{cycle values="odd,even"}">
+    <td>
+     <a href="admin.php?op=userPictureSelect&amp;albumId={$album->getParentId()}&amp;mode={$destination}&amp;page=1">
+     <img src="imgs/icon_folder-72.png" border="0" alt="Parent" />&nbsp;<br/>..</a>
+    </td>
+    <td>&nbsp;</td>
    </tr>
-   <tr>
- {/if} 
+  {/if}
+  {foreach from=$albums item=resalbum}
+   <tr class="{cycle values="odd,even"}">
+    <td>
+     <a href="admin.php?op=userPictureSelect&amp;albumId={$resalbum->getId()}&amp;mode={$destination}&amp;page=1">
+     <img src="imgs/icon_folder-72.png" border="0" alt="folder" /><br/>{$resalbum->getName()}</a><br/>
+    </td>
+   </tr>
 {/foreach}
 {foreach from=$resources item=resource}
- <td align="center" valign="center">
-  {if $resource->hasPreview()} 
+<tr class="{cycle values="odd,even"}">
+ <td>
+  {if $resource->hasPreview()}
    <img src="{$url->resourcePreviewLink($resource)}" alt="Preview" />
   {/if}
-  <a target="_blank" href="{$url->resourceLink($resource)}"><br/>{$resource->getFileName()}</a><br/>
+ <a target="_blank" href="{$url->resourceLink($resource)}"><br/>{$resource->getFileName()}</a><br/>
  <a href="javascript:returnResourceInformation('{$resource->getId()}','{$url->resourcePreviewLink($resource)}');window.close();">{$locale->tr("select")}</a><br/> 
-   {assign var="counter" value="`$counter+1`"} 
  </td>
-  {if $counter%2 == 0}
-   </tr>
-   <tr>
-  {/if} 
 {/foreach}
+</tbody>
 </table>
-<hr/>
-<a href="javascript:window.close()">{$locale->tr("close_window")}</a>
+<div id="list_action_bar">
+  {include file="$admintemplatepath/adminpager.template" style=list}
+  <a href="javascript:window.close()">{$locale->tr("close_window")}</a>
 </div>
+</div>
 </body>
-</html>
\ No newline at end of file
+</html>
+




More information about the pLog-svn mailing list