Example #1
0
 /**
  * DOCUMENT ME
  * @param mixed $root
  * @param mixed $active
  * @param mixed $options
  */
 public function __construct($root, $active, $options = array())
 {
     $this->user = sfContext::getInstance()->getUser();
     $this->livingOnly = !(aTools::isPotentialEditor() && sfContext::getInstance()->getUser()->getAttribute('show-archived', true, 'apostrophe'));
     $this->root = $root;
     $this->active = $active;
     $this->options = $options;
     $this->buildNavigation();
 }
Example #2
0
 public function preExecute()
 {
     // Establish engine context
     parent::preExecute();
     // If this is the admin engine page for media, and you have no media uploading privileges
     // or page editing privileges, then you have no business being here. If it is not the admin page,
     // then the site admin has decided to add a public media engine page, and it's fine for anyone
     // to be here
     if (aTools::getCurrentPage()->admin) {
         if (!(aTools::isPotentialEditor() || aMediaTools::userHasUploadPrivilege())) {
             $this->forward(sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action'));
         }
     }
     //$this->getResponse()->addStylesheet('/apostrophePlugin/css/aToolkit.css', 'first'); // Merged into a.css 2/3/2010
     $this->getResponse()->addStylesheet('/apostrophePlugin/css/a.css', 'first');
     $this->getResponse()->addJavascript('/apostrophePlugin/js/aControls.js');
     $this->getResponse()->addJavascript('/apostrophePlugin/js/aUI.js');
     $this->getResponse()->addJavascript('/apostrophePlugin/js/jquery.hotkeys-0.7.9.min.js');
 }
 public function executeTabs(sfRequest $request)
 {
     $this->page = aTools::getCurrentPage();
     if (!$this->page) {
         // Tabs on non-CMS pages are relative to the home page
         $this->page = aPageTable::retrieveBySlug('/');
     }
     $ancestorsInfo = $this->page->getAncestorsInfo();
     if (!count($ancestorsInfo)) {
         $ancestorsInfo = array($this->page);
     }
     $homeInfo = $ancestorsInfo[0];
     // Show archived tabs only to those who are potential editors.
     $this->tabs = $this->page->getTabsInfo(!(aTools::isPotentialEditor() && $this->getUser()->getAttribute('show-archived', true, 'apostrophe')), $homeInfo);
     if (sfConfig::get('app_a_home_as_tab', true)) {
         array_unshift($this->tabs, $homeInfo);
     }
     $this->draggable = $this->page->userHasPrivilege('edit');
 }
Example #4
0
 /**
  * DOCUMENT ME
  * @param sfWebRequest $request
  */
 public function executeEngineSettings(sfWebRequest $request)
 {
     $id = $request->getParameter('id');
     if (!$id) {
         // In 1.5 you can design engine settings for a page that isn't there yet
         $this->flunkUnless(aTools::isPotentialEditor());
         $this->page = new aPage();
     } else {
         $this->page = $this->retrievePageForEditingByIdParameter();
     }
     // Output the form for a different engine in response to an AJAX call. This allows
     // the user to see an immediate change in that form when the engine dropdown is changed
     // to a different setting. Note that this means your engine forms must tolerate situations
     // in which they are not actually the selected engine for the page yet and should not
     // actually do anything until they are actually saved. Also they must cooperate if the
     // page is a new page and not make abt assumptions about where the new page will be
     // or what it will be called
     $engine = $request->getParameter('engine');
     // Don't let them inspect for the existence of weird class names that might make the
     // autoloader do unsafe things
     $this->forward404Unless(preg_match('/^\\w*/', $engine));
     if (strlen($engine)) {
         $engineFormClass = $engine . 'EngineForm';
         if (class_exists($engineFormClass)) {
             $form = new $engineFormClass($this->page);
             $this->form = $form;
             $this->partial = $engine . '/settings';
         }
     }
 }
Example #5
0
function _a_navcolumn_body($page)
{
    $sortHandle = "";
    $sf_user = sfContext::getInstance()->getUser();
    $admin = $page->userHasPrivilege('edit');
    if ($admin) {
        $sortHandle = "<div class='a-btn icon a-drag a-controls'></div>";
    }
    $result = "";
    // Inclusion of archived pages should be a bit generous to allow for tricky situations
    // in which those who can edit a subpage might not be able to find it otherwise.
    // We don't want the performance hit of checking for the right to edit each archived
    // subpage, so just allow those with potential-editor privs to see that archived pages
    // exist, whether or not they are allowed to actually edit them
    if (aTools::isPotentialEditor() && $sf_user->getAttribute('show-archived', true, 'apostrophe')) {
        $livingOnly = false;
    } else {
        $livingOnly = true;
    }
    $result = '<ul id="a-navcolumn" class="a-navcolumn">';
    $childrenInfo = $page->getChildrenInfo($livingOnly);
    if (!count($childrenInfo)) {
        $childrenInfo = $page->getPeerInfo($livingOnly);
    }
    $n = 1;
    foreach ($childrenInfo as $childInfo) {
        $class = "peer_item";
        if ($childInfo['id'] == $page->id) {
            $class = "self_item";
        }
        if ($n == 1) {
            $class .= ' first';
        }
        if ($n == count($childrenInfo)) {
            $class .= ' last';
        }
        // Specific format to please jQuery.sortable
        $result .= "<li id=\"a-navcolumn-item-" . $childInfo['id'] . "\" class=\"a-navcolumn-item {$class}\">\n";
        $title = $childInfo['title'];
        if ($childInfo['archived']) {
            $title = '<span class="a-archived-page" title="&quot;' . $title . '&quot; is Unpublished">' . $title . '</span>';
        }
        $result .= $sortHandle . link_to($title, aTools::urlForPage($childInfo['slug']));
        $result .= "</li>\n";
        $n++;
    }
    $result .= "</ul>\n";
    if ($admin) {
        $result .= jq_sortable_element('#a-navcolumn', array('url' => 'a/sort?page=' . $page->getId()));
    }
    return $result;
}
if ($thisPage) {
    ?>
	<div class="a-global-toolbar-this-page" id="a-global-toolbar-this-page">
 		<?php 
    include_component('a', 'breadcrumb');
    ?>
 		<div id="a-page-settings"></div>
	</div>
 	<?php 
}
?>
  	
</div>

<?php 
if (aTools::isPotentialEditor()) {
    ?>

<?php 
    include_partial('a/historyBrowser', array('page' => $page));
    ?>

<div class="a-page-overlay"></div>

<script type="text/javascript">
	$(document).ready(function() {
		var thisPageStatus = 0;
		var thisPage = $('#a-this-page-toggle');
		$('#a-global-toolbar-this-page').hide().addClass('ok');
		thisPage.click(function(){
			thisPage.toggleClass('open');
Example #7
0
?>

<?php 
// All real editors need the history browser, while real managers need
// access to the overlay and page settings features
?>

<?php 
if (aTools::isPotentialEditor() || $pageEdit) {
    ?>
	<?php 
    include_partial('a/historyBrowser');
}
?>

<?php 
if (aTools::isPotentialEditor() || $pageSettings) {
    ?>
	<div class="a-page-overlay"></div>
	<?php 
    if ($page) {
        ?>
		<?php 
        a_js_call('apostrophe.enablePageSettingsButtons(?)', array('aPageSettingsURL' => url_for('a/settings') . '?' . http_build_query(array('id' => $page->id)), 'aPageSettingsCreateURL' => url_for('a/settings') . '?' . http_build_query(array('new' => 1, 'parent' => $page->slug))));
        ?>
	<?php 
    }
    ?>
	
<?php 
}
Example #8
0
 /**
  * DOCUMENT ME
  */
 protected function hasPermissionsForSelect()
 {
     $this->forward404Unless(aTools::isPotentialEditor() || aMediaTools::userHasUploadPrivilege());
 }