private function getJSON(&$aRequest)
 {
     if ($this->sAction === 'destroy') {
         foreach ($aRequest['session_key'] as $sSessionKey) {
             Session::getSession()->setArrayAttributeValueForKey(WidgetModule::WIDGET_SESSION_KEY, $sSessionKey, null);
         }
         return;
     }
     $sWidgetClass = WidgetModule::getClassNameByName($this->sWidgetType);
     $bIsPersistent = $sWidgetClass::isPersistent();
     if (!$bIsPersistent) {
         // Close session early on readonly calls
         Session::close();
     }
     if ($this->sAction == 'widgetInformation') {
         $aInformation = array();
         $sWidgetClass::includeResources();
         $aInformation['resources'] = ResourceIncluder::defaultIncluder()->getIncludes()->render();
         $aInformation['methods'] = $sWidgetClass::getCustomMethods();
         $aInformation['is_singleton'] = $sWidgetClass::isSingleton();
         $aInformation['is_persistent'] = $bIsPersistent;
         return $aInformation;
     }
     if ($this->sAction == 'staticMethodCall') {
         $this->checkPermissions($sWidgetClass);
         $sMethodName = isset($aRequest['method']) ? $aRequest['method'] : Manager::usePath();
         if (!method_exists($sWidgetClass, $sMethodName)) {
             throw new LocalizedException('wns.file.widget_json.method_does_not_exist', array('method' => $sMethodName, 'widget' => $sWidgetClass));
         }
         return array("result" => call_user_func_array(array($sWidgetClass, $sMethodName), isset($aRequest['method_parameters']) ? $aRequest['method_parameters'] : array()));
     }
     $aInstanceArgs = array(@$aRequest['session_key']);
     if (isset($aRequest['instance_args'])) {
         $aInstanceArgs = $aRequest['instance_args'];
     }
     $aNewArgs = array_merge(array($this->sWidgetType), $aInstanceArgs);
     $oWidget = call_user_func_array(array('WidgetModule', 'getWidget'), $aNewArgs);
     if ($this->sAction === 'instanciateWidget') {
         $this->checkPermissions($sWidgetClass);
         $aInformation = array();
         $aInformation['session_id'] = $oWidget->getSessionKey();
         $oWidgetContents = $oWidget->doWidget();
         if ($oWidgetContents instanceof Template) {
             $oWidgetContents = $oWidgetContents->render();
         }
         $aInformation['content'] = $oWidgetContents;
         $aInformation['is_new'] = $oWidget->isNew();
         $aInformation['initial_settings'] = $oWidget->allSettings();
         return $aInformation;
     }
     if ($this->sAction === 'methodCall') {
         $this->checkPermissions($sWidgetClass);
         $sMethodName = isset($aRequest['method']) ? $aRequest['method'] : Manager::usePath();
         if (!method_exists($oWidget, $sMethodName)) {
             throw new LocalizedException('wns.file.widget_json.method_does_not_exist', array('method' => $sMethodName, 'widget' => $oWidget->getName()));
         }
         return array("result" => call_user_func_array(array($oWidget, $sMethodName), isset($aRequest['method_parameters']) ? $aRequest['method_parameters'] : array()));
     }
 }
 public function __construct($sSessionId)
 {
     parent::__construct($sSessionId);
     $oRichtext = WidgetModule::getWidget('rich_text', null, null, 'documentation');
     $oRichtext->setTemplate(PagePeer::getRootPage()->getTemplate());
     $this->setSetting('richtext_session', $oRichtext->getSessionKey());
     $this->setSetting('international_option', LanguageInputWidgetModule::isMonolingual());
 }
 public function getWidget()
 {
     $oRichTextWidget = WidgetModule::getWidget('rich_text', null, $this->widgetData(), 'admin');
     $aToolbarSettings = Settings::getSetting('text_module', 'toolbar', null);
     $oRichTextWidget->setSetting('contentsLanguage', $this->oLanguageObject->getLanguageId());
     $oGenericWidget = WidgetModule::getWidget('generic_frontend_module', null, $this, $oRichTextWidget);
     $oGenericWidget->setSetting('preferred_width', $oRichTextWidget->getSettings('richtext_width', 600));
     return $oGenericWidget;
 }
 protected function createListWidget()
 {
     $oListWidget = new ListWidgetModule();
     $this->oDelegateProxy = new CriteriaListWidgetDelegate($this, "LinkCategory", 'name');
     $oListWidget->setDelegate($this->oDelegateProxy);
     $this->oExternallyManagedInputFilter = WidgetModule::getWidget('externally_managed_input', true);
     $this->oDelegateProxy->setInternallyManagedOnly(true);
     return $oListWidget;
 }
 protected function createListWidget()
 {
     $oListWidget = new ListWidgetModule();
     $this->oDelegateProxy = new CriteriaListWidgetDelegate($this, "User", 'full_name');
     $oListWidget->setDelegate($this->oDelegateProxy);
     $oListWidget->setSetting('row_model_drag_and_drop_identifier', 'id');
     $this->oDelegateProxy->setUserKind(CriteriaListWidgetDelegate::SELECT_ALL);
     $this->oUserKindFilter = WidgetModule::getWidget('user_kind_input', null, $this->oDelegateProxy->getUserKind());
     return $oListWidget;
 }
 protected function createListWidget()
 {
     $oListWidget = new ListWidgetModule();
     $this->oDelegateProxy = new CriteriaListWidgetDelegate($this, "Newsletter", 'updated_at', 'desc');
     $oListWidget->setDelegate($this->oDelegateProxy);
     if (!LanguageInputWidgetModule::isMonolingual()) {
         $this->oLanguageFilter = WidgetModule::getWidget('language_input', null, true);
     }
     return $oListWidget;
 }
 public function __construct($sSessionKey = null)
 {
     parent::__construct($sSessionKey);
     $oRichtextWidget = WidgetModule::getWidget('rich_text', null, '', 'newsletter');
     $oNewsletterPage = PageQuery::create()->findOneByIdentifier('newsletter');
     if ($oNewsletterPage) {
         $oRichtextWidget->setTemplate($oNewsletterPage->getTemplate());
     }
     $this->setSetting('rich_text_session', $oRichtextWidget->getSessionKey());
 }
 protected function createListWidget()
 {
     $oListWidget = new ListWidgetModule();
     $this->oDelegateProxy = new CriteriaListWidgetDelegate($this, "JournalEntry", "publish_at", "desc");
     $oListWidget->setDelegate($this->oDelegateProxy);
     $oListWidget->setSetting('row_model_drag_and_drop_identifier', 'id');
     $this->oTagFilter = WidgetModule::getWidget('tag_input', null, true);
     $this->oTagFilter->setSetting('model_name', 'JournalEntry');
     return $oListWidget;
 }
 private function content(Template $oTemplate, $sWidgetName)
 {
     $sWidgetClass = WidgetModule::getClassNameByName($sWidgetName);
     if (is_callable(array($sWidgetClass, 'testWidget'))) {
         $oWidget = $sWidgetClass::testWidget();
     } else {
         $oWidget = WidgetModule::getWidget($sWidgetName, null);
     }
     $oTemplate->replaceIdentifierMultiple('main_content', $oWidget->doWidget());
 }
 public function __construct($sSessionId)
 {
     parent::__construct($sSessionId);
     $iDocumentationPartCategory = 2;
     if (DocumentCategoryQuery::create()->filterById($iDocumentationPartCategory)->count() === 0) {
         throw new Exception(__METHOD__ . ': Please setup the exernally managed document category for this module');
     }
     $this->setSetting('documentation_image_category_id', $iDocumentationPartCategory);
     $oRichtext = WidgetModule::getWidget('rich_text', null, null, 'documentation_part');
     $oRichtext->setTemplate(PagePeer::getRootPage()->getTemplate());
     $this->setSetting('richtext_session', $oRichtext->getSessionKey());
 }
 protected function createListWidget()
 {
     $oListWidget = new ListWidgetModule();
     $this->oDelegateProxy = new CriteriaListWidgetDelegate($this, "Link", "name_truncated", "asc");
     $oListWidget->setDelegate($this->oDelegateProxy);
     $oListWidget->setSetting('row_model_drag_and_drop_identifier', 'id');
     if (!LanguageInputWidgetModule::isMonolingual()) {
         $this->oLanguageFilter = WidgetModule::getWidget('language_input', null, true);
     }
     $this->oTagFilter = WidgetModule::getWidget('tag_input', null, true);
     $this->oTagFilter->setSetting('model_name', 'Link');
     return $oListWidget;
 }
 public function __construct($sSessionKey = null, $oPage = null)
 {
     parent::__construct($sSessionKey);
     $this->oRichTextWidget = WidgetModule::getWidget('rich_text', null, null, 'journal');
     if ($oPage === null) {
         // get any blog page in site
         $oPage = PageQuery::create()->filterByPageType('journal')->joinPageProperty()->useQuery('PageProperty')->filterByName('journal:journal_id')->endUse()->findOne();
     }
     if ($oPage) {
         $this->oRichTextWidget->setTemplate($oPage->getTemplateNameUsed());
     }
     $this->setSetting('richtext_session', $this->oRichTextWidget->getSessionKey());
     $iJournalEntryImageCategory = Settings::getSetting('journal', 'externally_managed_images_category', null);
     $this->setSetting('journal_entry_images_category_id', $iJournalEntryImageCategory);
     $this->setSetting('date_today', date('d.m.Y'));
     $this->setSetting('date_format', 'dd.mm.yy');
 }
Exemple #13
0
 public function __construct($bShouldLogin = true)
 {
     parent::__construct();
     SanityCheck::basicCheck();
     if ($bShouldLogin && (!Session::getSession()->isAuthenticated() || !Session::getSession()->getUser()->getIsBackendLoginEnabled())) {
         LinkUtil::redirect(LinkUtil::link(array(), 'AdminManager', array('preview' => self::getRequestedPath())));
     }
     $oResourceIncluder = ResourceIncluder::defaultIncluder();
     $oResourceIncluder->addCustomJs('window.FILE_PREFIX = "' . MAIN_DIR_FE_PHP . Manager::getPrefixForManager('FileManager') . '";');
     //Fix JSON requests when using Prototype in the frontend
     $oResourceIncluder->addReverseDependency('lib_prototype', false, 'preview/prototype_json_fix.js');
     //Add jQuery and jQuery UI
     $oResourceIncluder->addJavaScriptLibrary('jquery', AdminManager::JQUERY_VERSION, null, true, null, ResourceIncluder::PRIORITY_FIRST);
     $oResourceIncluder->addJavaScriptLibrary('jqueryui', AdminManager::JQUERY_UI_VERSION);
     //Add client widget handling code
     $oResourceIncluder->addResource('widget/widget.js');
     $oResourceIncluder->addResource('widget/widget_skeleton.js');
     //Provides some basic overrides for tooltip, notifyuser and stuff
     //Override some site styles in specific regions
     $oResourceIncluder->addResource('preview/preview-reset.css');
     $oResourceIncluder->addResource('preview/preview-default.css');
     $oResourceIncluder->addResource('admin/theme/jquery-ui-1.10.2.custom.min.css');
     //Add the css that handles styles for all widgets but namespace it so it applies only to specific areas of the page (editable areas, dialogs, the admin menu, etc.)
     $this->addNamespacedCss(array('widget', 'widget.css'));
     $oResourceIncluder->addResource('backend/additions.js', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $oResourceIncluder->addResource('preview/additions.js', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $oResourceIncluder->addResource('backend/additions.css', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $oResourceIncluder->addResource('preview/additions.css', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     //preview-interface.css contains things like the edit buttons
     ResourceIncluder::defaultIncluder()->addResource('preview-interface.css', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     //Include the resources of widgets we know we’re gonna use.
     if ($bShouldLogin) {
         $oLoginWindowWidget = WidgetModule::getWidget('login_window');
         LoginWindowWidgetModule::includeResources();
     }
     $this->oAdminMenuWidget = WidgetModule::getWidget('admin_menu');
     AdminMenuWidgetModule::includeResources();
     $this->oPageTypeWidget = WidgetModule::getWidget('page_type');
     PageTypeWidgetModule::includeResources();
 }
 public function detailWidget()
 {
     $oWidget = WidgetModule::getWidget('journal_entry_detail', null, $this->oPage);
     return $oWidget->getSessionKey();
 }
Exemple #15
0
 /**
  * Returns the widget used to configure this particular frontend module. Default implementation outputs the contents of renderBackend as form and serializes that on save. If renderBackend returns a falsish value, the default widget is the one that’s named the same as this frontend module plus a suffix of “_frontend_config” and whose constructor, in addition to the session key, takes but one argument: the frontend module instance $this.
  * @return WidgetModule|string The configured widget or its bare name
  */
 public function getWidget()
 {
     $oBackend = $this->renderBackend();
     if ($oBackend) {
         return WidgetModule::getWidget("generic_frontend_module", null, $this, $this->renderBackend());
     }
     return WidgetModule::getWidget($this->getModuleName() . '_frontend_config', null, $this);
 }
 public function adminEdit($iObjectId, $sLanguageId = null)
 {
     if ($sLanguageId !== null) {
         $this->sLanguageId = $sLanguageId;
     }
     if ($this->sLanguageId === null) {
         $this->sLanguageId = AdminManager::getContentLanguage();
     }
     $oCurrentContentObject = $this->contentObjectById($iObjectId);
     $oCurrentLanguageObject = $oCurrentContentObject->getLanguageObject($this->sLanguageId);
     if ($oCurrentLanguageObject === null) {
         $oCurrentLanguageObject = new LanguageObject();
         $oCurrentLanguageObject->setLanguageId($this->sLanguageId);
         $oCurrentLanguageObject->setContentObject($oCurrentContentObject);
         $oCurrentLanguageObject->setData(null);
     }
     $oModuleInstance = $this->backendModuleInstanceByLanguageObject($oCurrentLanguageObject);
     $oWidget = WidgetModule::getWidget('language_object_control', null, $oCurrentLanguageObject, $oModuleInstance);
     $oResult = new stdClass();
     $oResult->control_session_key = $oWidget->getSessionKey();
     $oResult->type = $oCurrentContentObject->getObjectType();
     return $oResult;
 }
 protected function getModuleType()
 {
     return WidgetModule::getType();
 }
Exemple #18
0
 private function doAdmin($oTemplate)
 {
     $oAdminMenuWidget = new AdminMenuWidgetModule();
     AdminMenuWidgetModule::includeResources($this->oResourceIncluder);
     $oTemplate->replaceIdentifierMultiple('main_content', $this->oModule->mainContent());
     $mSidebarContent = $this->oModule->sidebarContent();
     if ($mSidebarContent === null) {
         $mSidebarContent = '';
     } else {
         if ($mSidebarContent === false) {
             $mSidebarContent = null;
         }
     }
     $oTemplate->replaceIdentifierMultiple('sidebar_content', $mSidebarContent);
     $oTemplate->replaceIdentifierMultiple('admin_menu', $oAdminMenuWidget->doWidget());
     foreach ($this->oModule->usedWidgets() as $mWidget) {
         if (!is_string($mWidget)) {
             $mWidget = get_class($mWidget);
         } else {
             $mWidget = WidgetModule::getClassNameByName($mWidget);
         }
         call_user_func(array($mWidget, 'includeResources'), $this->oResourceIncluder);
     }
     $this->oModule->includeCustomResources($this->oResourceIncluder);
 }
 public function setSetting($sSettingName, $mSettingValue)
 {
     parent::setSetting($sSettingName, $mSettingValue);
     // Duplicate settings onto the list widget
     $this->oListWidget->setSetting($sSettingName, $mSettingValue);
 }
 public function __construct($sSessionKey = null)
 {
     parent::__construct($sSessionKey);
     $oPopover = WidgetModule::getWidget('popover', null, $this);
     $this->setSetting('popover', $oPopover->getSessionKey());
 }
 public function __construct()
 {
     $this->oChooserList = WidgetModule::getWidget('list');
     $this->oChooserList->setDelegate($this);
     $this->addResourceParameter(ResourceIncluder::RESOURCE_TYPE_JS, 'chooser', $this->oChooserList->getSessionKey());
 }
 public function listDashboardModules($bFilterByAllowed = false)
 {
     $aResult = array();
     foreach (WidgetModule::listModulesByAspect('dashboard') as $aModuleInfo) {
         if ($bFilterByAllowed && !Module::isModuleAllowed('widget', $aModuleInfo['name'], Session::getSession()->getUser())) {
             continue;
         }
         $aResult[$aModuleInfo['name']] = Module::getDisplayNameByTypeAndName(WidgetModule::getType(), $aModuleInfo['name']);
     }
     return $aResult;
 }
Exemple #23
0
 public function getAdminWidget()
 {
     return WidgetModule::getWidget('language_object_control', null, $this, FrontendModule::getModuleInstance($this->getContentObject()->getObjectType(), $this));
 }