Don't allow fixed block types to be changed.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 15 Jul 2010 16:17:25 +0000 (12:17 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 15 Jul 2010 16:17:25 +0000 (12:17 -0400)
Bug: 9141

framework/Block/lib/Horde/Block/Collection.php
horde/templates/portal/layout.inc

index 145d8b7..4568f57 100644 (file)
@@ -217,16 +217,21 @@ class Horde_Block_Collection
      *
      * @param string $cur_app    The block from this application gets selected.
      * @param string $cur_block  The block with this name gets selected.
+     * @param boolean $onchange  Include the onchange action
+     * @param boolean $readonly  Indicates if this block type is changeable.
      *
      * @return string  The select tag with all available blocks.
      */
     public function getBlocksWidget($cur_app = null, $cur_block = null,
-                                    $onchange = false)
+                                    $onchange = false, $readonly = false)
     {
         $widget = '<select name="app"';
         if ($onchange) {
             $widget .= ' onchange="document.blockform.action.value=\'save-resume\';document.blockform.submit()"';
         }
+        if ($readonly) {
+            $widget .= ' disabled="disabled"';
+        }
         $widget .= ">\n";
 
         foreach ($this->getBlocksList() as $id => $name) {
index 3587bad..1b63037 100644 (file)
@@ -73,7 +73,7 @@
           </tr>
           <tr>
             <td colspan="2">
-              <?php echo $blocks->getBlocksWidget($blockInfo['app'], $blockInfo['block'], true) ?>
+              <?php echo $blocks->getBlocksWidget($blockInfo['app'], $blockInfo['block'], ($layout->isRemovable($row, $col) ? false : true), ($layout->isRemovable($row, $col) ? false : true)) ?>
             </td>
           </tr>
 <?php