Don't hardcode float or other styles.
Use spans for internal elements.
return '';
}
- $col_headers = array('message_thread' => _("Subject"),
- 'message_thread_class_plain' => '',
- 'message_author' => _("Posted by"),
- 'message_author_class_plain' => '',
- 'message_timestamp' => _("Date"),
- 'message_timestamp_class_plain' => '');
+ $col_headers = array(
+ 'message_thread' => _("Subject"),
+ 'message_thread_class_plain' => 'msgThreadPlain',
+ 'message_author' => _("Posted by"),
+ 'message_author_class_plain' => 'msgAuthorPlain',
+ 'message_timestamp' => _("Date"),
+ 'message_timestamp_class_plain' => 'msgTimestampPlain'
+ );
$forums = &Agora_Messages::singleton($scope);
$forum_id = $forums->getForumId($forum_name);
}
$html .= '</div>';
- $col_headers = array('message_thread' => _("Subject"),
- 'message_thread_class_plain' => '',
- 'message_author' => _("Posted by"),
- 'message_author_class_plain' => '',
- 'message_timestamp' => _("Date"),
- 'message_timestamp_class_plain' => '');
+ $col_headers = array(
+ 'message_thread' => _("Subject"),
+ 'message_thread_class_plain' => 'msgThreadPlain',
+ 'message_author' => _("Posted by"),
+ 'message_author_class_plain' => 'msgAuthorPlain',
+ 'message_timestamp' => _("Date"),
+ 'message_timestamp_class_plain' => 'msgTimestampPlain'
+ );
if ($view_bodies == 1) {
$threads = $messages->getThreads(0, true, 'message_thread', 0, true, '', $base_url);
/* Render threaded lists with Horde_Tree. */
$current = key($threads);
if (!$template_file && isset($threads[$current]['indent'])) {
- $tree = $GLOBALS['injector']->getInstance('Horde_Tree')->getTree('threads', 'Html');
- $tree->setOption(array('multiline' => $bodies,
- 'lines' => !$bodies));
+ $tree = $GLOBALS['injector']->getInstance('Horde_Tree')->getTree('threads', 'Html', array(
+ 'multiline' => $bodies,
+ 'lines' => !$bodies
+ ));
+
$tree->setHeader(array(
- array('html' => '<strong>' . $col_headers['message_thread'] . '</strong>',
- 'width' => '50%',
- 'class' => $col_headers['message_thread_class_plain']),
- array('html' => '<strong>' . $col_headers['message_author'] . '</strong>',
- 'width' => '25%',
- 'class' => $col_headers['message_author_class_plain']),
- array('html' => '<strong>' . $col_headers['message_timestamp'] . '</strong>',
- 'width' => '24%',
- 'class' => $col_headers['message_timestamp_class_plain'])));
+ array(
+ 'class' => $col_headers['message_thread_class_plain'],
+ 'html' => '<strong>' . $col_headers['message_thread'] . '</strong>'
+ ),
+ array(
+ 'class' => $col_headers['message_author_class_plain'],
+ 'html' => '<strong>' . $col_headers['message_author'] . '</strong>'
+ ),
+ array(
+ 'class' => $col_headers['message_timestamp_class_plain'],
+ 'html' => '<strong>' . $col_headers['message_timestamp'] . '</strong>'
+ )
+ ));
foreach ($threads as &$thread) {
if ($bodies) {
}
}
- $tree->addNode($thread['message_id'],
- $thread['parent'],
- $text,
- $thread['indent'],
- true,
- array('icon' => '',
- 'class' => 'linedRow'),
- array($thread['message_author'],
- $thread['message_date']));
+ $tree->addNode(
+ $thread['message_id'],
+ $thread['parent'],
+ $text,
+ $thread['indent'],
+ true,
+ array(
+ 'class' => 'linedRow',
+ ),
+ array(
+ $thread['message_author'],
+ $thread['message_date']
+ )
+ );
}
return $tree->getTree(true);
.messageBody p {
padding: 1em;
}
+
+.msgThreadPlain {
+ width: 50%;
+}
+.msgAuthorPlain {
+ width: 25%;
+}
+.msgTimestampPlain {
+ width: 24%;
+}
'alternate' => true,
'hideHeaders' => true
));
- $tree->setHeader(array(array('width' => '50%')));
+ $tree->setHeader(array(
+ array(
+ 'class' => 'treeHdrSpacer'
+ )
+ ));
foreach ($nodes as $perm_id => $node) {
$node_class = ($current == $perm_id)
* <pre>
* alternate - (boolean) Alternate shading in the table?
* class - (string) The class to use for the table.
+ * hideHeaders - (boolean) Don't render any HTML for the header row, just
+ * use the widths.
* lines - (boolean) Show tree lines?
* multiline - (boolean) Do the node labels contain linebreaks?
* </pre>
* @param array $header An array containing hashes with header
* information. The following keys are allowed:
* <pre>
- * align - The alignment inside the header cell
* class - The CSS class of the header cell
* html - The HTML content of the header cell
- * width - The width of the header cell
* </pre>
*/
public function setHeader($header)
*/
protected function _buildHeader()
{
- if (!count($this->_header)) {
+ if (!count($this->_header) ||
+ $this->getOption('hideHeaders')) {
return '';
}
- $html = '<div';
+ $className = 'treeRowHeader';
+
/* If using alternating row shading, work out correct
* shade. */
if ($this->getOption('alternate')) {
- $html .= ' class="item' . $this->_alt_count . '"';
+ $className .= ' item' . $this->_alt_count;
$this->_alt_count = 1 - $this->_alt_count;
}
- $html .= '>';
+
+ $html = '<div class="' . $className . '">';
foreach ($this->_header as $header) {
- $html .= '<div class="leftFloat';
+ $html .= '<span';
if (!empty($header['class'])) {
- $html .= ' ' . $header['class'];
+ $html .= ' class="' . $header['class'] . '"';
}
- $html .= '"';
- $style = '';
- if (!empty($header['width'])) {
- $style .= 'width:' . $header['width'] . ';';
- }
- if (!empty($header['align'])) {
- $style .= 'text-align:' . $header['align'] . ';';
- }
- if (!empty($style)) {
- $html .= ' style="' . $style . '"';
- }
- $html .= '>';
- $html .= empty($header['html']) ? ' ' : $header['html'];
- $html .= '</div>';
+ $html .= '>' .
+ (empty($header['html']) ? ' ' : $header['html'])
+ . '</span>';
}
return $html . '</div>';
if (isset($this->_nodes[$node_id]['extra'][self::EXTRA_LEFT])) {
$extra = $this->_nodes[$node_id]['extra'][self::EXTRA_LEFT];
$cMax = count($extra);
- for ($c = 0; $c < $cMax; ++$c) {
- $style = '';
- if (isset($this->_header[$column]['width'])) {
- $style .= 'width:' . $this->_header[$column]['width'] . ';';
- }
-
- $line .= '<div class="leftFloat"';
- if (!empty($style)) {
- $line .= ' style="' . $style . '"';
- }
- $line .= '>' . $extra[$c] . '</div>';
-
+ while ($column < $cMax) {
+ $line .= $this->_addColumn($column) . $extra[$column] . '</span>';
$column++;
}
}
- $style = '';
- if (isset($this->_header[$column]['width'])) {
- $style .= 'width:' . $this->_header[$column]['width'] . ';';
- }
- $line .= '<div class="leftFloat"';
- if (!empty($style)) {
- $line .= ' style="' . $style . '"';
- }
- $line .= '>';
+ $line .= $this->_addColumn($column++);
if ($this->getOption('multiline')) {
$line .= '<table cellspacing="0"><tr><td>';
$line .= '</td></tr></table>';
}
- $line .= '</div>';
- ++$column;
+ $line .= '</span>';
if (isset($this->_nodes[$node_id]['extra'][self::EXTRA_RIGHT])) {
$extra = $this->_nodes[$node_id]['extra'][self::EXTRA_RIGHT];
$cMax = count($extra);
- for ($c = 0; $c < $cMax; ++$c) {
- $style = '';
- if (isset($this->_header[$column]['width'])) {
- $style .= 'width:' . $this->_header[$column]['width'] . ';';
- }
-
- $line .= '<div class="leftFloat"';
- if (!empty($style)) {
- $line .= ' style="' . $style . '"';
- }
- $line .= '>' . $extra[$c] . '</div>';
-
+ for ($c = 0, $cMax = count($extra); $c < $cMax; ++$c) {
+ $line .= $this->_addColumn($column) . $extra[$c] . '</span>';
$column++;
}
}
}
/**
+ */
+ protected function _addColumn($column)
+ {
+ $line = '<span';
+ if (isset($this->_header[$column]['class'])) {
+ $line .= ' class="' . $this->_header[$column]['class'] . '"';
+ }
+ return $line . '>';
+ }
+
+ /**
* Sets the label on the tree line.
*
* @param string $node_id The Node ID.
$user_node = array('icon' => strval(Horde_Themes::img('user.png')));
$users = array();
-$tree = $injector->getInstance('Horde_Tree')->getTree('admin_devices', 'Javascript');
-$tree->setOption(array('alternate' => true));
+$tree = $injector->getInstance('Horde_Tree')->getTree('admin_devices', 'Javascript', array(
+ 'alternate' => true
+));
+
$tree->setHeader(array(
- array('width' => '30%'),
- array('width' => '22%', 'html' => _("Last Sync Time")),
- array('html' => $spacer),
- array('width' => '6%', 'html' => _("Policy Key")),
- array('html' => $spacer),
- array('width' => '10%', 'html' => _("Status")),
- array('html' => $spacer),
- array('width' => '12%' , 'html' => _("Device ID")),
- array('html' => $spacer),
- array('width' => '10%', 'html' => _("Actions"))
- ));
+ array(
+ 'class' => 'activesyncHdr1'
+ ),
+ array(
+ 'class' => 'activesyncHdr2',
+ 'html' => _("Last Sync Time")
+ ),
+ array(
+ 'html' => $spacer
+ ),
+ array(
+ 'class' => 'activesyncHdr3',
+ 'html' => _("Policy Key")
+ ),
+ array(
+ 'html' => $spacer
+ ),
+ array(
+ 'class' => 'activesyncHdr4',
+ 'html' => _("Status")
+ ),
+ array(
+ 'html' => $spacer
+ ),
+ array(
+ 'class' => 'activesyncHdr5',
+ 'html' => _("Device ID")
+ ),
+ array(
+ 'html' => $spacer
+ ),
+ array(
+ 'class' => 'activesyncHdr6',
+ 'html' => _("Actions")
+ )
+));
/* Root tree node, and reprovision button */
-$tree->addNode('root',
- null,
- _("Registered User Devices"),
- 0,
- true,
- $base_node_params,
- array('--', $spacer, '--', $spacer, '--', $spacer, '--', $spacer, '<input class="button" type="button" value="' . _("Reprovision All Devices") . '" id="reset" />' ));
+$tree->addNode(
+ 'root',
+ null,
+ _("Registered User Devices"),
+ 0,
+ true,
+ $base_node_params,
+ array('--', $spacer, '--', $spacer, '--', $spacer, '--', $spacer, '<input class="button" type="button" value="' . _("Reprovision All Devices") . '" id="reset" />' )
+);
/* Build the device entry */
foreach ($devices as $key => $device) {
$node_params = array();
if (array_search($device['device_user'], $users) === false) {
$users[] = $device['device_user'];
- $tree->addNode($device['device_user'], 'root', $device['device_user'], 0, false, $user_node);
+ $tree->addNode(
+ $device['device_user'],
+ 'root',
+ $device['device_user'],
+ 0,
+ false,
+ $user_node
+ );
}
/* Load this device */
$actions .= ' <input class="button removeDevice" type="button" value="' . _("Remove") . '" id="remove_' . $key . '" />';
/* Add it */
- $tree->addNode($device['device_id'],
- $device['device_user'],
- $device['device_type']. ' | ' . $device['device_agent'],
- 0,
- true,
- $device_node + $node_params,
- array($ts->format('r'), $spacer, $device['device_policykey'], $spacer, $status, $spacer, $device['device_id'], $spacer, $actions));
+ $tree->addNode(
+ $device['device_id'],
+ $device['device_user'],
+ $device['device_type']. ' | ' . $device['device_agent'],
+ 0,
+ true,
+ $device_node + $node_params,
+ array($ts->format('r'), $spacer, $device['device_policykey'], $spacer, $status, $spacer, $device['device_id'], $spacer, $actions)
+ );
}
echo '<h1 class="header">' . Horde::img('group.png') . ' ' . _("ActiveSync Devices") . '</h1>';
$delete_img = Horde::img('delete.png', _("Delete Group"));
/* Set up the tree. */
-$tree = $injector->getInstance('Horde_Tree')->getTree('admin_groups', 'Javascript');
-$tree->setOption(array('alternate' => true, 'hideHeaders' => true));
-$tree->setHeader(array(array('width' => '50%')));
+$tree = $injector->getInstance('Horde_Tree')->getTree('admin_groups', 'Javascript', array(
+ 'alternate' => true,
+ 'hideHeaders' => true
+));
+$tree->setHeader(array(
+ array(
+ 'class' => 'treeHdrSpacer'
+ )
+));
/* Explicitly check for > 0 since we can be called with current = -1
* for the root node. */
foreach ($nodes as $id => $node) {
$node_params = ($cid == $id) ? array('class' => 'selected') : array();
+
if ($id == Horde_Group::ROOT) {
$add_link = Horde::link(Horde_Util::addParameter($add, 'cid', $id), _("Add a new group")) . $add_img . '</a>';
$base_node_params = array('icon' => strval(Horde_Themes::img('administration.png')));
- $tree->addNode($id, null, _("All Groups"), 0, true, $base_node_params + $node_params, array($spacer, $add_link));
+ $tree->addNode(
+ $id,
+ null,
+ _("All Groups"),
+ 0,
+ true,
+ $base_node_params + $node_params,
+ array($spacer, $add_link)
+ );
} else {
$name = $groups->getGroupShortName($node);
$node_params['url'] = Horde_Util::addParameter($edit, 'cid', $id);
$add_link = Horde::link(Horde_Util::addParameter($add, 'cid', $id), sprintf(_("Add a child group to \"%s\""), $name)) . $add_img . '</a>';
$delete_link = Horde::link(Horde_Util::addParameter($delete, 'cid', $id), sprintf(_("Delete \"%s\""), $name)) . $delete_img . '</a>';
- $parent_id = $groups->getGroupParent($id);
- $group_extra = array($spacer, $add_link, $delete_link);
- $tree->addNode($id, $parent_id, $groups->getGroupShortName($node), $groups->getLevel($id) + 1, (isset($cid_parents[$id])), $group_node + $node_params, $group_extra);
+ $tree->addNode(
+ $id,
+ $groups->getGroupParent($id),
+ $groups->getGroupShortName($node),
+ $groups->getLevel($id) + 1,
+ (isset($cid_parents[$id])),
+ $group_node + $node_params,
+ array($spacer, $add_link, $delete_link)
+ );
}
}
var div = new Element('DIV');
this.opts.header.each(function(h) {
- var tmp = new Element('DIV').insert(h.html ? h.html : ' ');
+ var tmp = new Element('SPAN').insert(h.html ? h.html : ' ');
if (h['class']) {
tmp.addClassName(h['class']);
}
- if (h.width) {
- tmp.setStyle({ width: h.width });
- }
-
- if (h.align) {
- tmp.setStyle({ textAlign: h.align });
- }
-
div.appendChild(tmp);
}, this);
// any given cell of content.
if (node.extra && node.extra[0]) {
node.extra[0].each(function(n) {
- div.insert(this._divWidth(new Element('DIV').update(n), column++));
+ div.insert(this._divClass(new Element('SPAN').update(n), column++));
}, this);
}
for (; column < this.opts.extraColsLeft; ++column) {
- div.insert(this._divWidth(new Element('DIV').update(' '), column));
+ div.insert(this._divClass(new Element('SPAN').update(' '), column));
}
- div.insert(this._divWidth(new Element('DIV'), column));
+ div.insert(this._divClass(new Element('SPAN'), column));
tmp = document.createDocumentFragment();
for (i = Number(this.renderStatic); i < node.indent; ++i) {
if (node.extra && node.extra[1]) {
node.extra[1].each(function(n) {
- div.insert(this._divWidth(new Element('DIV').update(n), column++));
+ div.insert(this._divClass(new Element('SPAN').update(n), column++));
}, this);
}
for (; column < this.opts.extraColsRight; ++column) {
- div.insert(this._divWidth(new Element('DIV').update(' '), column));
+ div.insert(this._divClass(new Element('SPAN').update(' '), column));
}
p.appendChild(div);
},
- _divWidth: function(div, c)
+ _divClass: function(div, c)
{
- if (this.opts.header[c] && this.opts.header[c]['width']) {
- c.setStyle({ width: this.opts.header[c].width });
+ if (this.opts.header[c] && this.opts.header[c]['class']) {
+ c.addClassName(this.opts.header[c]['class']);
}
+
+ return div;
},
_setNodeToggle: function(nodeId)
cursor: pointer;
}
+.treeHdrSpacer {
+ width: 50%;
+}
+
span.treeImg {
height: 20px;
width: 20px;
float: right;
}
+/* Activesync styles. */
+.activesyncHdr1 {
+ width: 30%;
+}
+.activesyncHdr2 {
+ width: 22%;
+}
+.activesyncHdr3 {
+ width: 6%;
+}
+.activesyncHdr4 {
+ width: 10%;
+}
+.activesyncHdr5 {
+ width: 12%;
+}
+.activesyncHdr6 {
+ width: 10%;
+}
+
+/* Toggle quote styles. */
.toggleQuoteHide, .toggleQuoteShow {
font-size: 80%;
cursor: pointer;