public function setPermissionObject(Area $a)
 {
     $ax = $a;
     if ($a->isGlobalArea()) {
         $cx = Stack::getByName($a->getAreaHandle());
         $a = Area::get($cx, STACKS_AREA_NAME);
     }
     if ($a instanceof SubArea && !$a->overrideCollectionPermissions()) {
         $a = $a->getSubAreaParentPermissionsObject();
     }
     $this->permissionObject = $a;
     // if the area overrides the collection permissions explicitly (with a one on the override column) we check
     if ($a->overrideCollectionPermissions()) {
         $this->permissionObjectToCheck = $a;
     } else {
         if ($a->getAreaCollectionInheritID() > 0) {
             // in theory we're supposed to be inheriting some permissions from an area with the same handle,
             // set on the collection id specified above (inheritid). however, if someone's come along and
             // reverted that area to the page's permissions, there won't be any permissions, and we
             // won't see anything. so we have to check
             $areac = Page::getByID($a->getAreaCollectionInheritID());
             $inheritArea = Area::get($areac, $a->getAreaHandle());
             if (is_object($inheritArea) && $inheritArea->overrideCollectionPermissions()) {
                 // okay, so that area is still around, still has set permissions on it. So we
                 // pass our current area to our grouplist, userinfolist objects, knowing that they will
                 // smartly inherit the correct items.
                 $this->permissionObjectToCheck = $inheritArea;
             }
         }
         if (!$this->permissionObjectToCheck) {
             $this->permissionObjectToCheck = $a->getAreaCollectionObject();
         }
     }
 }
Exemple #2
2
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$ag = \Concrete\Core\Http\ResponseAssetGroup::get();
$ag->requireAsset('core/style-customizer');
$pt = $c->getCollectionThemeObject();
$areaClasses = $pt->getThemeAreaClasses();
$customClasses = array();
// Use the area handle as the key to map against area classes
$areaHandle = $a->getAreaHandle();
// If its a SubArea, find the parent handle and use that
if ($a instanceof \Concrete\Core\Area\SubArea) {
    $areaHandle = \Concrete\Core\Area\Area::getAreaHandleFromID($a->getAreaParentID());
}
if (isset($areaClasses[$areaHandle])) {
    $customClasses = $areaClasses[$areaHandle];
}
$gf = $pt->getThemeGridFrameworkObject();
Loader::element("custom_style", array('saveAction' => $controller->action('submit'), 'resetAction' => $controller->action('reset'), 'customClasses' => $customClasses, 'gf' => $gf, 'style' => $c->getAreaCustomStyle($a, true)));
Exemple #3
2
 public function __construct(Application $app, $config, Block $b, Page $c, Area $a)
 {
     parent::__construct();
     $p = new \Permissions($b);
     $this->permissions = $p;
     $this->block = $b;
     $this->page = $c;
     $this->area = $a;
     $this->setAttribute('data-block-menu', 'block-menu-b' . $b->getBlockID());
     $this->setAttribute('class', 'ccm-edit-mode-block-menu');
     $btw = $b->getBlockTypeObject();
     $btOriginal = $btw;
     $bID = $b->getBlockID();
     $aID = $a->getAreaID();
     $heightPlus = 20;
     $btHandle = $btw->getBlockTypeHandle();
     $editInline = false;
     if ($btw->supportsInlineEdit()) {
         $editInline = true;
     }
     if ($btw->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
         $_bi = $b->getInstance();
         $_bo = Block::getByID($_bi->getOriginalBlockID());
         $btOriginal = BlockType::getByHandle($_bo->getBlockTypeHandle());
         $btHandle = $btOriginal->getBlockTypeHandle();
         $heightPlus = 80;
         if ($btOriginal->supportsInlineEdit()) {
             $editInline = true;
         }
     }
     $canDesign = $p->canEditBlockDesign() && $config->get('concrete.design.enable_custom') == true;
     $canModifyGroups = $p->canEditBlockPermissions() && $config->get('concrete.permissions.model') != 'simple' && !$a->isGlobalArea();
     $canEditName = $p->canEditBlockName();
     $canEditCacheSettings = $p->canEditBlockCacheSettings();
     $canEditCustomTemplate = $p->canEditBlockCustomTemplate();
     $canScheduleGuestAccess = $config->get('concrete.permissions.model') != 'simple' && $p->canGuestsViewThisBlock() && $p->canScheduleGuestAccess() && !$a->isGlobalArea();
     $canAliasBlockOut = $c->isMasterCollection() && !$a->isGlobalArea();
     if ($canAliasBlockOut) {
         $ct = Type::getByID($c->getPageTypeID());
     }
     $isAlias = $b->isAlias();
     $u = new \User();
     $numChildren = !$isAlias ? $b->getNumChildren() : 0;
     if ($isAlias) {
         $deleteMessage = t('Do you want to delete this block?');
     } elseif ($numChildren) {
         $deleteMessage = t('Do you want to delete this block? This item is an original. If you delete it, you will delete all blocks aliased to it');
     } else {
         $deleteMessage = t('Do you want to delete this block?');
     }
     if ($btOriginal->getBlockTypeHandle() == BLOCK_HANDLE_STACK_PROXY) {
         if (is_object($_bo)) {
             $bi = $_bo->getInstance();
         } else {
             $bi = $b->getInstance();
         }
         $stack = \Stack::getByID($bi->stID);
         if (is_object($stack)) {
             $sp = new \Permissions($stack);
             if ($sp->canWrite()) {
                 $this->addItem(new LinkItem(\URL::to('/dashboard/blocks/stacks', 'view_details', $stack->getCollectionID()), t('Manage Stack Contents')));
             }
         }
     } else {
         if ($p->canEditBlock() && $b->isEditable()) {
             if ($editInline) {
                 if ($b->getBlockTypeHandle() == BLOCK_HANDLE_LAYOUT_PROXY) {
                     $this->addItem(new LinkItem('javascript:void(0)', t('Edit Layout'), ['data-menu-action' => 'edit_inline', 'data-area-enable-grid-container' => $a->isGridContainerEnabled(), 'data-area-grid-maximum-columns' => $a->getAreaGridMaximumColumns()]));
                 } else {
                     $this->addItem(new LinkItem('javascript:void(0)', t('Edit Block'), ['data-menu-action' => 'edit_inline', 'data-area-enable-grid-container' => $a->isGridContainerEnabled(), 'data-area-grid-maximum-columns' => $a->getAreaGridMaximumColumns()]));
                 }
             } else {
                 $this->addItem(new LinkItem('javascript:void(0)', t('Edit Block'), ['data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/edit'), 'dialog-title' => t('Edit %s', t($btOriginal->getBlockTypeName())), 'dialog-width' => $btOriginal->getBlockTypeInterfaceWidth(), 'dialog-height' => $btOriginal->getBlockTypeInterfaceHeight() + $heightPlus]));
             }
         }
     }
     if ($b->getBlockTypeHandle() != BLOCK_HANDLE_LAYOUT_PROXY && $b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY) {
         $this->addItem(new LinkItem('javascript:void(0)', t('Copy to Clipboard'), ['data-menu-action' => 'block_scrapbook', 'data-token' => $app->make('token')->generate('tools/clipboard/to')]));
     }
     if ($p->canDeleteBlock()) {
         $this->addItem(new LinkItem('javascript:void(0)', t('Delete'), ['data-menu-action' => 'delete_block', 'data-menu-delete-message' => $deleteMessage]));
     }
     if ($b->getBlockTypeHandle() != BLOCK_HANDLE_LAYOUT_PROXY) {
         if ($canDesign || $canEditCustomTemplate || $canEditName || $canEditCacheSettings) {
             $this->addItem(new DividerItem());
             if ($canDesign || $canEditCustomTemplate) {
                 $this->addItem(new LinkItem('#', t('Design &amp; Custom Template'), ['data-menu-action' => 'block_design']));
             }
             if ($b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY && ($canEditName || $canEditCacheSettings)) {
                 $this->addItem(new LinkItem('#', t('Advanced'), ['dialog-title' => t('Advanced Block Settings'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/cache'), 'dialog-width' => 500, 'dialog-height' => 320]));
             }
         }
     }
     if ($b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY && ($canModifyGroups || $canScheduleGuestAccess || $canAliasBlockOut)) {
         $this->addItem(new DividerItem());
         if ($canModifyGroups) {
             $this->addItem(new LinkItem('#', t('Permissions'), ['dialog-title' => t('Block Permissions'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/permissions/list'), 'dialog-width' => 350, 'dialog-height' => 450]));
         }
         if ($canScheduleGuestAccess) {
             $this->addItem(new LinkItem('#', t('Schedule Guest Access'), ['dialog-title' => t('Schedule Guest Access'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/permissions/guest_access'), 'dialog-width' => 500, 'dialog-height' => 320]));
         }
         if ($canAliasBlockOut) {
             $this->addItem(new LinkItem('#', t('Setup on Child Pages'), ['dialog-title' => t('Setup on Child Pages'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/aliasing'), 'dialog-width' => 500, 'dialog-height' => 'auto']));
         }
     }
 }
 public function getInstalledTargetItems(Batch $batch)
 {
     $areas = \Concrete\Core\Area\Area::getHandleList();
     asort($areas);
     $items = array();
     foreach ($areas as $area) {
         $item = new TargetItem($this);
         $item->setItemId($area);
         $item->setItemName($area);
         $items[] = $item;
     }
     return $items;
 }
Exemple #5
1
 /**
  * @param Page $c
  * @param string $arHandle
  *
  * @return Area
  */
 public static function getOrCreate($c, $arHandle)
 {
     $area = Area::get($c, $arHandle);
     if (!is_object($area)) {
         $a = new Area($arHandle);
         $area = $a->create($c, $arHandle);
     }
     return $area;
 }
 public function __construct($arHandle, Area $parent)
 {
     $arHandle = $parent->getAreaHandle() . self::AREA_SUB_DELIMITER . $arHandle;
     $this->arParentID = $parent->getAreaID();
     parent::__construct($arHandle);
 }
 public function display()
 {
     $c = Page::getCurrentPage();
     parent::display($c);
 }
Exemple #8
1
 public function getAreaCustomTemplates($include_parent_templates = true)
 {
     $these_templates = parent::getAreaCustomTemplates();
     if ($include_parent_templates && $this->parentBlock && $this->parentBlock->a) {
         // include parent templates if instructed to do so
         $parent_templates = $this->parentBlock->a->getAreaCustomTemplates();
         // make sure that parent templates can be overwritten by
         // custom templates set on the subarea itself
         return array_merge($parent_templates, $these_templates);
     }
     return $these_templates;
 }
Exemple #9
1
 public function display($c = false, $fake = null)
 {
     parent::display($c, null);
 }
 public function add()
 {
     $pageTypes = array('' => t('** No Filtering'));
     $types = Type::getList();
     foreach ($types as $type) {
         $pageTypes[$type->getPageTypeID()] = $type->getPageTypeName();
     }
     $this->set('pageTypes', $pageTypes);
     $areas = Area::getHandleList();
     $select = array();
     foreach ($areas as $handle) {
         $select[$handle] = $handle;
     }
     $this->set('areas', $select);
 }
 public function setPropertiesFromArray($arr)
 {
     return parent::setPropertiesFromArray($arr);
 }
Exemple #12
0
 public function __construct(StyleSet $set = null, Area $area, $theme)
 {
     $this->arHandle = $area->getAreaHandle();
     $this->set = $set;
     $this->theme = $theme;
 }
Exemple #13
-1
 public function add()
 {
     $pageTypes = array('' => t('** No Filtering'));
     $types = Type::getList();
     foreach ($types as $type) {
         $pageTypes[$type->getPageTypeID()] = $type->getPageTypeDisplayName();
     }
     $this->set('pageTypes', $pageTypes);
     $attributeKeys = array();
     $keys = CollectionKey::getList();
     foreach ($keys as $ak) {
         if ($ak->getAttributeTypeHandle() == 'topics') {
             $attributeKeys[] = $ak;
         }
     }
     $this->set('topicAttributes', $attributeKeys);
     $areas = Area::getHandleList();
     $select = array();
     foreach ($areas as $handle) {
         $select[$handle] = $handle;
     }
     $this->set('areas', $select);
     $this->requireAsset('core/topics');
 }