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 & 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 getSearchResultBulkMenus() { $group = new BulkMenu(); $group->setPropertyName('treeNodeTypeHandle'); $group->setPropertyValue('file'); $menu = new Menu(); $menu->addItem(new LinkItem('#', t('Download'), ['data-bulk-action' => 'download'])); $menu->addItem(new LinkItem('#', t('Properties'), ['data-bulk-action-type' => 'dialog', 'data-bulk-action-title' => t('Properties'), 'data-bulk-action-url' => \URL::to('/ccm/system/dialogs/file/bulk/properties'), 'data-bulk-action-dialog-width' => '630', 'data-bulk-action-dialog-height' => '450'])); $menu->addItem(new LinkItem('#', t('Sets'), ['data-bulk-action-type' => 'dialog', 'data-bulk-action-title' => t('Sets'), 'data-bulk-action-url' => \URL::to('/ccm/system/dialogs/file/bulk/sets'), 'data-bulk-action-dialog-width' => '500', 'data-bulk-action-dialog-height' => '400'])); $menu->addItem(new LinkItem('#', t('Rescan'), ['data-bulk-action-type' => 'progressive', 'data-bulk-action-url' => \URL::to('/ccm/system/file/rescan_multiple')])); $menu->addItem(new LinkItem('#', t('Storage Location'), ['data-bulk-action-type' => 'dialog', 'data-bulk-action-title' => t('Storage Location'), 'data-bulk-action-url' => \URL::to('/ccm/system/dialogs/file/bulk/storage'), 'data-bulk-action-dialog-width' => '500', 'data-bulk-action-dialog-height' => '400'])); $menu->addItem(new LinkItem('#', t('Delete'), ['data-bulk-action-type' => 'dialog', 'data-bulk-action-title' => t('Delete'), 'data-bulk-action-url' => \URL::to('/ccm/system/dialogs/file/bulk/delete'), 'data-bulk-action-dialog-width' => '500', 'data-bulk-action-dialog-height' => '400'])); $group->setMenu($menu); return $group; }
public function __construct(FileFolder $folder) { parent::__construct(); $p = new \Permissions($folder); if ($p->canEditTreeNode()) { $this->addItem(new EditFolderItem($folder)); } if ($p->canEditTreeNodePermissions() || $p->canDeleteTreeNode()) { $this->addItem(new DividerItem()); } if ($p->canEditTreeNodePermissions() && \Config::get('concrete.permissions.model') != 'simple') { $this->addItem(new EditPermissionsItem($folder)); } if ($p->canDeleteTreeNode()) { $this->addItem(new DeleteItem($folder)); } }
public function __construct(FileEntity $file) { parent::__construct(); $this->setAttribute('data-search-file-menu', $file->getFileID()); $this->addItem(new LinkItem('#', t('Clear'), ['data-file-manager-action' => 'clear'])); $this->addItem(new DividerItem()); $fp = new \Permissions($file); if ($fp->canViewFile() && $file->canView()) { $this->addItem(new DialogLinkItem(REL_DIR_FILES_TOOLS_REQUIRED . '/files/view?fID=' . $file->getFileID(), t('View'), t('View'), '90%', '75%')); } if ($fp->canViewFile() && $file->canView()) { $this->addItem(new LinkItem('#', t('Download'), ['data-file-manager-action' => 'download', 'data-file-id' => $file->getFileID()])); } if ($file->canEdit() && $fp->canEditFileContents()) { $this->addItem(new DialogLinkItem(REL_DIR_FILES_TOOLS_REQUIRED . '/files/edit?fID=' . $file->getFileID(), t('Edit'), t('Edit'), '90%', '75%')); $this->addItem(new DialogLinkItem(\URL::to('/ccm/system/dialogs/file/thumbnails?fID=' . $file->getFileID()), t('Thumbnails'), t('Thumbnails'), '90%', '75%')); } if ($fp->canViewFileInFileManager()) { $this->addItem(new DialogLinkItem(\URL::to('/ccm/system/dialogs/file/properties?fID=' . $file->getFileID()), t('Properties'), t('Properties'), '850', '450')); } if ($fp->canEditFileContents()) { $this->addItem(new DialogLinkItem(REL_DIR_FILES_TOOLS_REQUIRED . '/files/replace?fID=' . $file->getFileID(), t('Replace'), t('Replace'), '500', '200')); } if ($fp->canCopyFile()) { $this->addItem(new LinkItem('#', t('Duplicate'), ['data-file-manager-action' => 'duplicate', 'data-file-id' => $file->getFileID()])); } if ($fp->canViewFileInFileManager()) { $this->addItem(new DialogLinkItem(\URL::to('/ccm/system/dialogs/file/sets?fID=' . $file->getFileID()), t('Sets'), t('File Sets'), '500', '400')); } if ($fp->canEditFilePermissions() || $fp->canDeleteFile()) { $this->addItem(new DividerItem()); } if ($fp->canEditFilePermissions()) { $this->addItem(new DialogLinkItem(REL_DIR_FILES_TOOLS_REQUIRED . '/files/permissions?fID=' . $file->getFileID(), t('Permissions'), t('Permissions & Access'), '520', '450')); } $this->addItem(new DialogLinkItem(\URL::to('/ccm/system/dialogs/file/usage', $file->getFileID()), t('File Usage'), t('File Usage'), '90%', '75%')); if ($fp->canDeleteFile()) { $this->addItem(new DeleteItem($file->getFileNodeObject())); } }
public function __construct(SearchPreset $node) { parent::__construct(); $this->addItem(new DeleteItem($node)); }
public function __construct(Node $node) { parent::__construct(); $this->setAttribute('data-tree-menu', $node->getTreeID()); }