public function showMain()
 {
     // the Add/Edit form.
     $form = new Curry_Form_ModelForm('CronJobSchedule', array('withRelations' => array('CronJob'), 'columnElements' => array('relation__cronjob' => array('select', array('multiOptions' => array(null => '[ Select a job ]') + CronJobQuery::create()->find()->toKeyValue('PrimaryKey', 'FQJobHandler'), 'order' => 0))), 'onFillForm' => function ($cronJobSchedule, $form) {
     }));
     $list = new Curry_ModelView_List('CronJobSchedule', array('modelForm' => $form, 'columns' => array('fq_job_handler' => array('label' => 'Job handler', 'callback' => function ($cronJobSchedule) {
         return $cronJobSchedule->getCronJob()->getFQJobHandler();
     }, 'order' => 0, 'action' => 'edit')), 'actions' => array('action_edit_data' => array('label' => 'Edit job data', 'href' => (string) url('', array('module', 'view' => 'MainEditJobData')), 'single' => true))));
     $list->show($this);
 }
Ejemplo n.º 2
0
 /** {@inheritdoc} */
 public function showMain()
 {
     $modules = array();
     foreach (Curry_Module::getModuleList() as $className) {
         $parts = explode("_", str_replace("_Module_", "_", $className));
         $package = array_shift($parts);
         $modules[$package][$className] = join(" / ", $parts);
     }
     $templates = array('' => "[ None ]") + Curry_Backend_Template::getTemplateSelect();
     $form = new Curry_Form_ModelForm('Module', array('columnElements' => array('module_class' => array('select', array('multiOptions' => $modules)), 'content_visibility' => array('select', array('multiOptions' => PageModulePeer::$contentVisiblityOptions)), 'template' => array('select', array('multiOptions' => $templates)))));
     $list = new Curry_ModelView_List('Module', array('modelForm' => $form));
     $list->show($this);
 }
Ejemplo n.º 3
0
 public function __construct(Curry_Backend_Page $backend, PageRevision $pageRevision, $langcode = "")
 {
     $this->pageRevision = $pageRevision;
     $this->langcode = $langcode;
     parent::__construct('PageModule', array('title' => 'Content', 'maxPerPage' => 0, 'columns' => array('name' => array('sortable' => false, 'action' => 'edit', 'callback' => function ($wrapper) {
         return $wrapper->getName();
     }), 'target' => array('sortable' => false, 'callback' => function ($wrapper) {
         return $wrapper->getTarget();
     }), 'type' => array('sortable' => false, 'escape' => false, 'callback' => function ($wrapper) {
         return Curry_Html::createTag('span', array('title' => $wrapper->getClassName()), basename(str_replace('_', '/', $wrapper->getClassName())));
     })), 'addDefaultActions' => false, 'actions' => array('edit' => array('single' => true, 'class' => 'inline', 'action' => array($this, 'showEdit'))), 'sortable' => array($this, 'sortItems')));
     $user = User::getUser();
     $this->pagePermission = $backend->getPagePermission($pageRevision->getPage());
     if ($user->hasAccess('Curry_Backend_Template')) {
         $this->addColumn('template', array('sortable' => false, 'escape' => false, 'callback' => function ($wrapper) {
             if (!$wrapper->getTemplate()) {
                 return 'None';
             }
             $templateUrl = url('', array('module' => 'Curry_Backend_Template', 'view' => 'Edit', 'file' => $wrapper->getTemplate()));
             return Curry_Html::createTag('a', array('href' => $templateUrl, 'title' => $wrapper->getTemplate()), basename($wrapper->getTemplate()));
         }));
     }
     if ($this->pagePermission[PageAccessPeer::PERM_MODULES]) {
         $this->addColumn('info', array('sortable' => false, 'escape' => false, 'callback' => array($this, 'getInfo'), 'order' => 1));
         $this->addAction('properties', array('single' => true, 'class' => 'dialog', 'action' => array($this, 'showProperties')));
         $this->addAction('inheritance', array('label' => 'Inheritance details', 'general' => true, 'class' => 'dialog', 'action' => array($this, 'showInheritance')));
     }
     if ($this->pagePermission[PageAccessPeer::PERM_CREATE_MODULE]) {
         $this->addAction('new', array('general' => true, 'label' => 'New content', 'class' => 'dialog', 'href' => (string) url('', array('module' => 'Curry_Backend_Page', 'page_id' => $this->pageRevision->getPageId(), 'view' => 'NewModule'))));
         $this->addAction('delete', array('single' => true, 'class' => 'inline modelview-delete', 'action' => array($this, 'showDelete')));
     }
 }
Ejemplo n.º 4
0
 public function showMain()
 {
     $user = User::getUser();
     $role = $user->getUserRole();
     if ($role->getPrimaryKey() != 1 && $role->getName() != 'Super') {
         throw new Exception('This module can be used by an administrator only.');
     }
     $this->renderMenu();
     $mfOwner = new Curry_Form_ModelForm('Managedfile', array('columnElements' => array('filepath' => false, 'type' => false, 'filemime' => false, 'deleted' => false, 'permission' => false, 'created_at' => false, 'updated_at' => false, 'relation__owner' => array('select', array('label' => 'File owner', 'multiOptions' => UserQuery::create()->find()->toKeyValue('UserId', 'Name'), 'required' => true))), 'withRelations' => array('Owner')));
     // create the list view
     $q = ManagedfileQuery::create();
     $list = new Curry_ModelView_List($q, array('title' => 'Managedfiles', 'modelForm' => array($this, 'showMainNewEntity'), 'hide' => array('type'), 'columns' => array('filepath' => array('action' => false), 'owner' => array('order' => 3, 'label' => 'Owner', 'callback' => function ($o) {
         return (string) $o->getOwner();
     }, 'action' => 'set_owner'), 'permission' => array('order' => 4, 'callback' => function ($o) {
         return $o->getHumanReadablePermissions();
     }, 'action' => 'set_permissions'), 'deleted' => array('order' => 5, 'label' => 'Expunged')), 'actions' => array('set_permissions' => array('label' => 'Change file permissions', 'href' => (string) url('', array('module', 'view' => 'MainFilePerm')), 'single' => true, 'class' => 'inline'), 'set_owner' => array('label' => 'Change file owner', 'action' => new Curry_ModelView_Form($mfOwner), 'single' => true, 'class' => 'inline'))));
     $list->removeAction('edit');
     $list->removeAction('delete');
     // render the list
     $list->show($this);
 }
Ejemplo n.º 5
0
 public function showRoles()
 {
     if (!$this->hasPermission(self::PERMISSION_ROLES)) {
         throw new Exception('You dont have permission to access this view.');
     }
     $this->addMenu();
     $user = User::getUser();
     $backendModules = Curry_Backend::getBackendList();
     $disable = array();
     $backend = array("*" => "All");
     if (!$user->hasAccess('*')) {
         $disable[] = '*';
     }
     foreach ($backendModules as $backendClass => $backendName) {
         $backend[$backendClass] = $backendName;
         $permissions = method_exists($backendClass, 'getPermissions') ? call_user_func(array($backendClass, 'getPermissions')) : array();
         foreach ($permissions as $permission) {
             $backend[$backendClass . "/" . $permission] = Curry_Core::SELECT_TREE_PREFIX . $permission;
             if (!$user->hasAccess($backendClass . "/" . $permission)) {
                 $disable[] = $backendClass . "/" . $permission;
             }
         }
         if (!$user->hasAccess($backendClass)) {
             $disable[] = $backendClass;
         }
     }
     $content = array();
     $contentAccess = array("*" => "All") + Curry_Module::getModuleList();
     $allContentAccess = $user->hasAccess('Curry_Backend_Content/*');
     foreach ($contentAccess as $k => $v) {
         $content['Curry_Backend_Content/' . $k] = $v;
         if (!$allContentAccess && !$user->hasAccess('Curry_Backend_Content/' . $k)) {
             $disable[] = 'Curry_Backend_Content/' . $k;
         }
     }
     $form = new Curry_ModelView_Form('UserRole', array('elements' => array('backend' => array('multiselect', array('label' => 'Backend access', 'multiOptions' => $backend, 'size' => 10, 'order' => 1, 'disable' => $disable, 'validators' => array(array('InArray', true, array(array_diff(array_keys($backend), $disable)))))), 'content' => array('multiselect', array('label' => 'Content access', 'multiOptions' => $content, 'size' => 10, 'order' => 2, 'disable' => $disable, 'validators' => array(array('InArray', true, array(array_diff(array_keys($content), $disable))))))), 'onFillForm' => function (UserRole $role, $form) {
         $access = UserRoleAccessQuery::create()->filterByUserRole($role)->select('Module')->find()->getArrayCopy();
         $form->backend->setValue($access);
         $form->content->setValue($access);
     }, 'onFillModel' => function (UserRole $role, $form, $values) {
         $access = array_merge((array) $values['backend'], (array) $values['content']);
         $collection = new PropelObjectCollection();
         $collection->setModel('UserRoleAccess');
         foreach ($access as $a) {
             $ura = new UserRoleAccess();
             $ura->setModule($a);
             $collection->append($ura);
         }
         $role->setUserRoleAccesss($collection);
     }));
     $q = UserRoleQuery::create();
     $list = new Curry_ModelView_List($q, array('modelForm' => $form));
     $list->addAction('file_permissions', array('action' => $this->getFileAccessList(), 'class' => 'inline', 'single' => true));
     $list->show($this);
 }
Ejemplo n.º 6
0
 /**
  * Show revisions for page.
  *
  */
 public function showPageRevisions()
 {
     $page = self::getPage(PageAccessPeer::PERM_REVISIONS);
     $ses = new \Zend\Session\Container(__CLASS__);
     $ses->pageView = 'PageRevisions';
     $this->addPageMenu($page);
     $query = PageRevisionQuery::create()->filterByPage($page);
     $list = new Curry_ModelView_List($query, array('columns' => array('template' => false, 'description' => array('escape' => false, 'callback' => function ($pageRevision) {
         $page = $pageRevision->getPage();
         $icon = '';
         if ($page->getActivePageRevision() === $pageRevision) {
             $icon .= ' <i class="icon-bolt" title="Active revision" />';
         }
         if ($page->getWorkingPageRevision() === $pageRevision) {
             $icon .= ' <i class="icon-wrench" title="Working revision"></i>';
         }
         return htmlspecialchars($pageRevision->getDescription()) . $icon;
     })), 'actions' => array('edit' => false, 'new' => array('href' => (string) url('', array("module", "page_id" => $page->getPageId(), "view" => "CreateRevision"))), 'make_working' => array('label' => 'Switch to working', 'single' => true, 'class' => 'post', 'action' => function ($revision, $backend) use($page) {
         if (isPost()) {
             $page->setWorkingPageRevision($revision);
             $page->save();
             $backend->createModelUpdateEvent('Page', $page->getPrimaryKey(), 'update');
             $backend->createModelUpdateEvent('PageRevision', $revision->getPrimaryKey(), 'update');
         }
     }))));
     if (self::getPagePermission($page, PageAccessPeer::PERM_PUBLISH)) {
         $list->addAction('publish_date', array('label' => 'Set publish date', 'single' => true, 'class' => 'inline', 'href' => (string) url('', array('module', 'view' => 'SetPublishDate'))));
         $list->addAction('publish', array('single' => true, 'class' => 'post', 'action' => function ($revision, Curry_Backend_Page $backend) use($page) {
             if (isPost()) {
                 $backend->publishRevision($revision);
                 $backend->createModelUpdateEvent('Page', $page->getPrimaryKey(), 'update');
                 $backend->createModelUpdateEvent('PageRevision', $revision->getPrimaryKey(), 'update');
             }
         }));
     }
     $this->addMainContent($list);
 }
Ejemplo n.º 7
0
 /**
  * Show edit fields.
  */
 public function showFields()
 {
     $this->addMainMenu();
     $form = new Curry_Form_ModelForm('LanguageString', array('ignorePks' => false, 'columnElements' => array('last_used' => false)));
     $list = new Curry_ModelView_List('LanguageString', array('modelForm' => $form, 'maxPerPage' => 0, 'defaultSortColumn' => 'id', 'columns' => array('id' => array('hide' => false))));
     $list->show($this);
 }