[pLog-svn] r4979 - in plog/branches/lifetype-1.2: class/action/admin class/view/admin/chooser locale/admin templates/admin/chooser

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Mar 4 13:11:35 EST 2007


Author: oscar
Date: 2007-03-04 13:11:34 -0500 (Sun, 04 Mar 2007)
New Revision: 4979

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php
   plog/branches/lifetype-1.2/class/action/admin/adminnewresourceaction.class.php
   plog/branches/lifetype-1.2/class/view/admin/chooser/adminsimpleresourceslistview.class.php
   plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php
   plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php
   plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php
   plog/branches/lifetype-1.2/templates/admin/chooser/resourcelist.template
Log:
The resources_enabled configuration parameter was being ignored, so now we really disabllow the uploading of new resources if it is set to 'disabled'.


Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php	2007-03-04 13:13:31 UTC (rev 4978)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php	2007-03-04 18:11:34 UTC (rev 4979)
@@ -10,6 +10,7 @@
 	lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
     lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminsimpleresourceslistview.class.php" );
     lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminuserpictureselectview.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
     lt_include( PLOG_CLASS_PATH."class/file/fileupload.class.php" );
 
     /**
@@ -58,7 +59,17 @@
          * Carries out the specified action
          */
         function perform()
-        {
+        {	
+			// are resources enabled?
+			$config =& Config::getConfig();
+			if( !$config->getValue( "resources_enabled", true )) {
+            	$this->_view = new AdminResourcesListView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_resources_disabled"));
+                $this->setCommonData();
+            	return false;				
+			}
+	
+	
         	// fetch the information coming from the resource
         	$this->_description = Textfilter::filterAllHTML($this->_request->getValue( "resourceDescription" ));
             $this->_albumId     = $this->_request->getValue( "albumId" );

Modified: plog/branches/lifetype-1.2/class/action/admin/adminnewresourceaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminnewresourceaction.class.php	2007-03-04 13:13:31 UTC (rev 4978)
+++ plog/branches/lifetype-1.2/class/action/admin/adminnewresourceaction.class.php	2007-03-04 18:11:34 UTC (rev 4979)
@@ -4,6 +4,7 @@
 	lt_include( PLOG_CLASS_PATH."class/view/admin/adminnewresourceview.class.php" );
     lt_include( PLOG_CLASS_PATH."class/view/admin/adminnewalbumview.class.php" );	
     lt_include( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
     lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );
 
@@ -46,6 +47,15 @@
          */
         function perform()
         {
+			// are resources enabled?
+			$config =& Config::getConfig();
+			if( !$config->getValue( "resources_enabled", true )) {
+            	$this->_view = new AdminResourcesListView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_resources_disabled"));
+                $this->setCommonData();
+            	return false;				
+			}
+	
             // check that we have at least one album where to put our pictures
             $albums = new GalleryAlbums();
             $blogAlbums = $albums->getNestedAlbumList( $this->_blogInfo->getId());            

Modified: plog/branches/lifetype-1.2/class/view/admin/chooser/adminsimpleresourceslistview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/chooser/adminsimpleresourceslistview.class.php	2007-03-04 13:13:31 UTC (rev 4978)
+++ plog/branches/lifetype-1.2/class/view/admin/chooser/adminsimpleresourceslistview.class.php	2007-03-04 18:11:34 UTC (rev 4979)
@@ -25,6 +25,10 @@
             $this->setValue( "blogname", StringUtils::text2url( $this->_blogInfo->getBlog() )); 			
             $this->setValue( "requestformat", $config->getValue( "request_format_mode"));
             $this->setValue( "baseurl", $config->getValue( "base_url" ));
+
+			// whether resources are enabled or not
+			$this->setValue( "resources_enabled", $config->getValue( "resources_enabled", true ));
+			
             $destination = $this->getValue( "destination" );			
 			// check if htmlarea is enabled
 			$blogSettings = $this->_blogInfo->getSettings();

Modified: plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php	2007-03-04 13:13:31 UTC (rev 4978)
+++ plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php	2007-03-04 18:11:34 UTC (rev 4979)
@@ -1160,4 +1160,6 @@
 $messages['error_plugins_disabled'] = 'Plugins han estat desactivats en aquest lloc.';
 $messages['help_allow_php_code_in_templates'] = 'Permet incloure codi PHP a les plantilles d\'usuari mitjançant els tags {php}...{/php} [Valor per defecte = No]';
 $messages['logout_destination_url'] = 'Adreça web on els usuaris seràn enviats quan premin el botó "Sortir" a la interfície d\'administració, com per exemple la pàgina principal d\'aquest servei [ Valor per defecte = res ]';
+
+$messages['error_resources_disabled'] = 'El suport per a afegir nous fitxers al seu bloc ha estat desactivat en aquest lloc web";
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2007-03-04 13:13:31 UTC (rev 4978)
+++ plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2007-03-04 18:11:34 UTC (rev 4979)
@@ -1150,4 +1150,6 @@
 $messages['help_forbidden_blognames'] = 'List of strings separated by a blank space that are not allowed to be used as blog names. It is possible to use regular expressions instead of plain strings. [ Default = (empty) ]';
 
 $messages['version'] = 'Version';
+
+$messages['error_resources_disabled'] = 'Sorry, support for uploading new resources has been disabled in this site';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php	2007-03-04 13:13:31 UTC (rev 4978)
+++ plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php	2007-03-04 18:11:34 UTC (rev 4979)
@@ -1155,4 +1155,6 @@
 $messages['Plugins'] = 'Plugins';
 $messages['help_hard_recent_posts_max'] = 'Número máximo para el número de artículos recientes que aparecen en cada bitácora. Si los usuarios configuran un valor por encima de éste, el valor del usuario será ignorado y éste será usado. [ Valor por defecto = 25 ]';
 $messages['version'] = 'Versión';
-?>
+
+$messages['error_resources_disabled'] = 'El soporte para añadir nuevos ficheros a su bitácora ha sido desactivado en est servidor.';
+?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/templates/admin/chooser/resourcelist.template
===================================================================
--- plog/branches/lifetype-1.2/templates/admin/chooser/resourcelist.template	2007-03-04 13:13:31 UTC (rev 4978)
+++ plog/branches/lifetype-1.2/templates/admin/chooser/resourcelist.template	2007-03-04 18:11:34 UTC (rev 4979)
@@ -79,7 +79,12 @@
      <a href="admin.php?op=resourceList&amp;albumId={$album->getParentId()}&amp;mode={$destination}&amp;page=1">
      <img src="imgs/admin/icon_folder-72.png" border="0" alt="Parent" />&nbsp;<br/>..</a>
     </td>
-    <td><a onclick="_toggle('resource_list_upload');" href="#upload"><span style="font-size:13px;font-weight:bold">{$locale->tr("upload_here")}</span></a> </td>
+    <td>
+	{if $resources_enabled}
+	<a onclick="_toggle('resource_list_upload');" href="#upload">
+		<span style="font-size:13px;font-weight:bold">{$locale->tr("upload_here")}</span>
+	</a> </td>
+	{/if}
    </tr>
   {/if}
   {foreach from=$albums item=resalbum}
@@ -148,8 +153,8 @@
 {/foreach}
 </tbody>
 </table>
-{if $album}
-{** show this album only if we're not browsing the root album **}
+{if $album && $resources_enabled}
+{** show this album only if we're not browsing the root album and resources are enabled **}
 <a name="upload"></a>
 <div id="resource_list_upload" style="display: none;">
  <form name="uploadFile" method="post" action="admin.php" enctype="multipart/form-data">



More information about the pLog-svn mailing list