[dev] Horde Portal Layout Editor tweak

Joe Jenkins joe at nerdnet.com
Wed Dec 3 14:03:34 PST 2003


I tweaked the code to the layout editor to draw a line around each of the
Edit boxes, it makes it more clear to me when I am rearranging my blocks to
see the shape and positions with the blocks... See if you like it (I am sure
it could be further refined)

Joe Jenkins

file:  horde/templates/portal/edit.inc

<table cellpadding="6" cellspacing="2" border="0" bordercolor="black"
width="99%"><tr><td>
<table cellpadding="2" cellspacing="0" border="1" bordercolor="black"
width="100%">

<?php
$rows = $layout->rows();
$columns = 0;
for ($row = 0; $row < $rows; $row++):
?>
  <tr>
<?php
$columns = $layout->columns($row);
for ($col = 0; $col < $columns; $col++):
    if ($layout->isCovered($row, $col)):
?>
    <!-- covered cell here -->
<?php else: ?>
    <td class="summary" valign="top" width="<?php echo floor(100 / ($columns
+ 1)) ?>%" rowspan="<?php echo $layout->getHeight($row, $col) ?>"
colspan="<?php echo $layout->getWidth($row, $col) ?>">
<?php
$blockInfo = $layout->getBlockInfo($row, $col);
if (!$layout->isEmpty($row, $col) && !is_a($blockInfo, 'PEAR_Error')) {
    if ($edit_row === $row && $edit_col === $col) {
        $edit_link = '&nbsp;';
    } else {
        $edit_link = Horde::link($layout->getActionUrl('edit', $row, $col),
_("Edit Block"), 'smallheader', '', '', _("Edit Block")) . _("Edit") .
'</a>';
    }

    $defaults = array();
    foreach ($blocks->getParams($blockInfo['app'], $blockInfo['block']) as
$param) {
        $defaults[$param] = $blocks->getDefaultValue($blockInfo['app'],
$blockInfo['block'], $param);
    }
    include HORDE_TEMPLATES . '/portal/layout.inc';
} else {
    include HORDE_TEMPLATES . '/portal/add.inc';
}
?>
    </td>
<?php endif; endfor; ?>
    <td valign="top" class="summary">
      <?php include HORDE_TEMPLATES . '/portal/add.inc'; ?>
    </td>
  </tr>
<?php endfor; ?>
  <tr>
<?php
for ($col = 0; $col <= $columns; $col++):
?>
    <td valign="top" class="summary">
      <?php include HORDE_TEMPLATES . '/portal/add.inc'; ?>
    </td>
<?php endfor; ?>
  </tr>
</table>

</td></tr></table>





More information about the dev mailing list