/** * Call this after loading an object */ private function _prepare_toolbars($revision = '', $diff_view = false) { if ($revision == '') { return; } $before = $this->_backend->get_prev_version($revision); $before2 = $this->_backend->get_prev_version($before); $after = $this->_backend->get_next_version($revision); $show_previous = false; if ($diff_view) { if ($before != '' && $before2 != '') { // When browsing diffs we want to display buttons to previous instead of current $first = $before2; $second = $before; $show_previous = true; } } else { if ($before != '') { $first = $before; $second = $revision; $show_previous = true; } } if ($show_previous) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "__mfa/asgard/object/rcs/diff/{$this->_guid}/{$first}/{$second}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_get('view %s differences with previous (%s)'), $second, $first), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png')); } $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "__mfa/asgard/object/rcs/preview/{$this->_guid}/{$revision}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_get('view this revision (%s)'), $revision), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/search.png')); // Display restore and next buttons only if we're not in latest revision if ($after != '') { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "__mfa/asgard/object/rcs/restore/{$this->_guid}/{$revision}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_get('restore this revision (%s)'), $revision), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/editpaste.png', MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "__mfa/asgard/object/rcs/diff/{$this->_guid}/{$revision}/{$after}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_get('view %s differences with next (%s)'), $revision, $after), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_right.png')); } $this->bind_view_to_object($this->_object); }