Beispiel #1
0
 /**
  * Logic for both create and update actions.
  */
 protected function createUpdateCommon()
 {
     $this->_action = get_class($this);
     // Recursively processing all forms.
     if (!isset($this->formSettings['forms']['id'])) {
         foreach ($this->formSettings['forms'] as $key => $value) {
             $this->formSettings['forms'][$key] = $this->processFormSettingsForm($this->formSettings['forms'][$key]);
         }
     } else {
         $this->formSettings['forms'] = $this->processFormSettingsForm($this->formSettings['forms']);
     }
     $formManager = new FormManager($this->formSettings);
     $formManager->process();
     // Render with form variables. Blocs type forms have a variable that is an array containing its sub-forms as well.
     $renderArray = array();
     foreach ($this->_formIds as $varName => $formIdArr) {
         if ($formIdArr[1] !== null) {
             $blocsForm = $formManager->getForm($formIdArr[0]);
             $renderArray[$varName] = array($formManager->getModels($formIdArr[0]));
             foreach ($blocsForm->forms as $blocsSubForm) {
                 $renderArray[$varName][substr($blocsSubForm->id, 18, -4)] = $blocsSubForm->models;
             }
         } else {
             $renderArray[$varName] = $formManager->getModels($formIdArr[0]);
         }
     }
     $this->controller->render(lcfirst($this->_action), $renderArray);
 }
Beispiel #2
0
 public function handle_request($get, $post, $cookie)
 {
     $env =& $this->server;
     $cfg =& $this->config;
     $sess =& $this->session;
     $action = empty($post['action']) ? empty($get['action']) ? '' : $get['action'] : $post['action'];
     if ($action === 'session-dump') {
         header("Content-Type: text/plain");
         print_r($_SESSION);
         return;
     }
     if ($action === 'logout') {
         foreach ($sess as $k => $v) {
             unset($sess[$k]);
         }
         return $this->redirect('');
     }
     if (empty($sess['user_id']) || !$sess['user_id']) {
         $ok = false;
         if ($action === 'login') {
             $ok = $this->handle_login($get, $post, $cookie);
         }
         if (!$ok) {
             return $this->show_login_form($get, $post, $cookie);
         }
     }
     $is_admin = $_SESSION['roles'][ROLE_ADMINISTRATOR];
     $parts = explode('/', $env['PATH_INFO']);
     if (empty($parts[0])) {
         array_shift($parts);
     }
     $component = array_shift($parts);
     $id = array_shift($parts);
     if (empty($component)) {
         return $this->redirect('client');
     } elseif ($component === 'client') {
         $crud = new ClientForm($is_admin, $this->config, $this);
         if ($id && !empty($parts[0])) {
             $form_id = $parts[0];
             return $crud->handle_form($id, $form_id, $get, $post, $cookie);
         } elseif ($id) {
             return $crud->handle_client($id, $get, $post, $cookie);
         } else {
             return $crud->handle_list($get, $post, $cookie);
         }
     } elseif ($component === 'form') {
         $crud = new FormManager($is_admin, $this->config, $this);
         if (strlen($id)) {
             return $crud->handle_form($id, $parts, $get, $post, $cookie);
         } else {
             return $crud->handle_list($parts, $get, $post, $cookie);
         }
     } elseif ($is_admin) {
         $crud = new CrudForm($component, $this->config, $this);
         return $id ? $crud->handle_item($id, $parts, $get, $post, $cookie) : $crud->handle_index($parts, $get, $post, $cookie);
     } else {
         return $this->error_message('Permission denied. Administrator access required.');
     }
 }
Beispiel #3
0
 public function actionIndex()
 {
     $flickrUsers = FlickrUser::model()->findAll('', array('index' => 'id'));
     $formManager = new FormManager(array('checkIfPosted' => false, 'redirect' => $this->createUrl('index'), 'forms' => array('id' => 'flickrUsersForm', 'models' => $flickrUsers)));
     if (isset($_POST['sent'])) {
         $formManager->process();
     }
     $this->render('index', array('flickrUsers' => $formManager->getModels('flickrUsersForm')));
 }
 public function displayPage()
 {
     $db =& $this->db;
     // Default options
     if (Kit::IsFilterPinned('mediamanager', 'Filter')) {
         $filter_pinned = 1;
         $filter_layout_name = Session::Get('mediamanager', 'filter_layout_name');
         $filter_region_name = Session::Get('mediamanager', 'filter_region_name');
         $filter_media_name = Session::Get('mediamanager', 'filter_media_name');
         $filter_type = Session::Get('mediamanager', 'filter_type');
     } else {
         $filter_pinned = 0;
         $filter_layout_name = NULL;
         $filter_region_name = NULL;
         $filter_media_name = NULL;
         $filter_type = 0;
     }
     $id = uniqid();
     Theme::Set('id', $id);
     Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter'));
     Theme::Set('pager', ResponseManager::Pager($id));
     Theme::Set('form_meta', '<input type="hidden" name="p" value="mediamanager"><input type="hidden" name="q" value="MediaManagerGrid">');
     $formFields = array();
     $formFields[] = FormManager::AddText('filter_layout_name', __('Layout'), $filter_layout_name, NULL, 'l');
     $formFields[] = FormManager::AddText('filter_region_name', __('Region'), $filter_region_name, NULL, 'r');
     $formFields[] = FormManager::AddText('filter_media_name', __('Media'), $filter_media_name, NULL, 'm');
     $types = $db->GetArray("SELECT moduleid AS moduleid, Name AS module FROM `module` WHERE Enabled = 1 ORDER BY 2");
     array_unshift($types, array('moduleid' => 0, 'module' => 'All'));
     $formFields[] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, $types, 'moduleid', 'module', NULL, 't');
     $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k');
     // Call to render the template
     Theme::Set('header_text', __('Media Manager'));
     Theme::Set('form_fields', $formFields);
     Theme::Render('grid_render');
 }
Beispiel #5
0
 /**
  * Constructor
  * @param string $model model name
  * @param int $id Primary key of the model. Ignored unless $this->model is set.
  * @param string $parent_container The parent container for the form elements
  */
 public function __construct($model, $id = null, $parent_container = null)
 {
     $this->model = $model;
     $element = ORM::factory($this->model, $id);
     $this->exclude_fields = $element->exclude_fields();
     parent::__construct($element, $parent_container);
 }
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     $db =& $this->db;
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $mediaid = $this->mediaid;
     // Permissions
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this assignment.');
         $this->response->keepOpen = true;
         return $this->response;
     }
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=EditMedia');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" id="iRegionId" name="regionid" value="' . $regionid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" /><input type="hidden" id="mediaid" name="mediaid" value="' . $mediaid . '">');
     $formFields = array();
     $formFields[] = FormManager::AddText('windowsCommand', __('Windows Command'), htmlentities(urldecode($this->GetOption('windowsCommand'))), __('Enter a Windows Command Line compatible command'), 'w');
     $formFields[] = FormManager::AddText('linuxCommand', __('Android / Linux Command'), htmlentities(urldecode($this->GetOption('linuxCommand'))), __('Enter an Android / Linux Command Line compatible command'), 'l');
     Theme::Set('form_fields', $formFields);
     if ($this->showRegionOptions) {
         $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
     } else {
         $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
     }
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     $this->response->dialogTitle = __('Edit Shell Command');
     $this->response->dialogSize = true;
     $this->response->dialogWidth = '450px';
     $this->response->dialogHeight = '250px';
     return $this->response;
 }
 public static function getHiddenFormHtml($action, $identifiant, $buttonText)
 {
     $htmlCode = FormManager::beginForm("post", $action);
     $htmlCode .= FormManager::addHiddenInput("login", "login", html_entity_decode($identifiant->getLogin(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addHiddenInput("mdp", "mdp", html_entity_decode($identifiant->getMdp(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addSubmitButton($buttonText, "class=\"sansLabel\"");
     $htmlCode .= FormManager::endForm();
     return $htmlCode;
 }
 public static function getHiddenFormHTML($action, $commentaire, $buttonText)
 {
     $htmlCode = FormManager::beginForm("POST", $action);
     $htmlCode .= FormManager::addHiddenInput("Contenu", "Contenu", HTMLUtilities::decode($commentaire->getContenu()));
     $htmlCode .= '<div class="submitWrapper">';
     $htmlCode .= FormManager::addSubmitButton();
     $htmlCode .= '</div>';
     $htmlCode .= FormManager::endForm($buttonText);
     return $htmlCode;
 }
 public static function getFormHtml($action, $commentaire)
 {
     $htmlCode = FormManager::beginForm("post", $action);
     $htmlCode .= FormManager::addHiddenInput("idArticle", "idArticle", html_entity_decode($commentaire->getIdArticle(), ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= FormManager::addTextInput("Login", "login", "login", "50", html_entity_decode($commentaire->getLogin(), ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= FormManager::addTextAreaInput("Texte", "texte", "texte", "5", "100", html_entity_decode($commentaire->getTexte(), ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= FormManager::addSubmitButton("Envoyer", "class =\"sansLabel \"") . "<br/>";
     $htmlCode .= FormManager::endForm();
     return $htmlCode;
 }
 public static function getFormHTML($action, $article)
 {
     $htmlCode = FormManager::beginForm("post", $action);
     $htmlCode .= FormManager::addTextInput("Titre de l'article", "Titre", "Titre", 100, html_entity_decode($article->getTitre, ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= FormManager::addTextInput("Chemin de l'image", "Image", "Image", 100, html_entity_decode($article->getImage, ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= FormManager::addTextAreaInput("Texte de l'article", "Contenu", "Contenu", 50, 100, html_entity_decode($article->getTitre, ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= FormManager::addSubmitButton("Envoyer", "class=\"sansLabel\"");
     $htmlCode .= FormManager::endForm();
     return $htmlCode;
 }
 public static function getLoginForm()
 {
     $htmlCode = "";
     if (!isset($_SERVER['HTTPS']) || ($_SERVER['HTTPS'] = "off")) {
         $htmlCode .= "<p><strong>Attention</strong>, votre connexion n'est pas chiffrée.</p>";
     }
     $htmlCode .= FormManager::beginForm("POST", "?action=validateAuth");
     $htmlCode .= FormManager::addTextInput("login", "login", "login", "25");
     $htmlCode .= FormManager::addPasswordInput("mot de passe", "password", "password", "25");
     $htmlCode .= FormManager::addSubmitButton("Connexion");
     $htmlCode .= FormManager::endForm();
     return $htmlCode;
 }
Beispiel #12
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     $formFields = array();
     if ($this->layoutid != '' && $this->regionid != '') {
         $formFields[] = FormManager::AddCheckbox('loop', __('Loop?'), $this->GetOption('loop', 0), __('Should the video loop if it finishes before the provided duration?'), 'l', 'loop-fields');
         $formFields[] = FormManager::AddCheckbox('mute', __('Mute?'), $this->GetOption('mute', 0), __('Should the video be muted?'), 'm', 'mute-fields');
         $this->response->AddFieldAction('duration', 'init', '0', array('.loop-fields' => array('display' => 'none')));
         $this->response->AddFieldAction('duration', 'change', '0', array('.loop-fields' => array('display' => 'none')));
         $this->response->AddFieldAction('duration', 'init', '0', array('.loop-fields' => array('display' => 'block')), 'not');
         $this->response->AddFieldAction('duration', 'change', '0', array('.loop-fields' => array('display' => 'block')), 'not');
     }
     return $this->EditFormForLibraryMedia($formFields);
 }
 public static function getHiddenFormHtml($action, $personnage, $buttonText)
 {
     $htmlCode = FormManager::beginForm("post", $action);
     $htmlCode .= FormManager::addHiddenInput("numDocteur", "numDocteur", html_entity_decode($personnage->getNumDocteur(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addHiddenInput("anneeDebut", "anneeDebut", html_entity_decode($personnage->getAnneeDebut(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addHiddenInput("anneeFin", "anneeFin", html_entity_decode($personnage->getAnneeFin(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addHiddenInput("acteur", "acteur", html_entity_decode($personnage->getActeur(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addHiddenInput("expFav", "expFav", html_entity_decode($personnage->getExpFav(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addHiddenInput("desc", "desc", html_entity_decode($personnage->getDesc(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addHiddenInput("urlImage", "urlImage", html_entity_decode($personnage->getUrlImage(), ENT_QUOTES, "UTF−8"));
     $htmlCode .= FormManager::addSubmitButton($buttonText, "class=\"sansLabel\"");
     $htmlCode .= FormManager::endForm();
     return $htmlCode;
 }
Beispiel #14
0
 public static function getFormErrorsHtmlEdition($action, $article, $dataErrors)
 {
     $htmlCode = FormManager::beginForm("post", $action);
     $htmlCode .= self::addErrorMsg($dataErrors, "id");
     $htmlCode .= FormManager::addHiddenInput("Id", "id", "id", "4", html_entity_decode($article->getId(), ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= self::addErrorMsg($dataErrors, "titre");
     $htmlCode .= FormManager::addTextInput("Titre", "titre", "titre", "50", html_entity_decode($article->getTitre(), ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= self::addErrorMsg($dataErrors, "urlImage");
     $htmlCode .= FormManager::addTextInput("UrlImage", "urlImage", "urlImage", "50", html_entity_decode($article->getUrlImage(), ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= self::addErrorMsg($dataErrors, "texte");
     $htmlCode .= FormManager::addTextAreaInput("Texte", "texte", "texte", "5", "100", html_entity_decode($article->getTexte(), ENT_QUOTES, "UTF-8")) . "<br/>";
     $htmlCode .= FormManager::addSubmitButton("Envoyer", "class=\"sansLabel\"") . "<br/>";
     $htmlCode .= FormManager::endForm();
     return $htmlCode;
 }
Beispiel #15
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     // Provide some extra form fields
     $formFields = array();
     $formFields[] = FormManager::AddCheckbox('replaceBackgroundImages', __('Replace background images?'), 0, __('If the current image is used as a background, should the new image replace it?'), '', 'replacement-controls');
     if ($this->layoutid != '' && $this->regionid != '') {
         $formFields[] = FormManager::AddCombo('scaleTypeId', __('Scale Type'), $this->GetOption('scaleType'), array(array('scaleTypeId' => 'center', 'scaleType' => __('Center')), array('scaleTypeId' => 'stretch', 'scaleType' => __('Stretch'))), 'scaleTypeId', 'scaleType', __('How should this image be scaled?'), 's');
         $formFields[] = FormManager::AddCombo('alignId', __('Align'), $this->GetOption('align', 'center'), array(array('alignId' => 'left', 'align' => __('Left')), array('alignId' => 'center', 'align' => __('Centre')), array('alignId' => 'right', 'align' => __('Right'))), 'alignId', 'align', __('How should this image be aligned?'), 'a', 'align-fields');
         $formFields[] = FormManager::AddCombo('valignId', __('Vertical Align'), $this->GetOption('valign', 'middle'), array(array('valignId' => 'top', 'valign' => __('Top')), array('valignId' => 'middle', 'valign' => __('Middle')), array('valignId' => 'bottom', 'valign' => __('Bottom'))), 'valignId', 'valign', __('How should this image be vertically aligned?'), 'v', 'align-fields');
         // Set some field dependencies
         $this->response->AddFieldAction('scaleTypeId', 'init', 'center', array('.align-fields' => array('display' => 'block')));
         $this->response->AddFieldAction('scaleTypeId', 'change', 'center', array('.align-fields' => array('display' => 'block')));
         $this->response->AddFieldAction('scaleTypeId', 'init', 'center', array('.align-fields' => array('display' => 'none')), 'not');
         $this->response->AddFieldAction('scaleTypeId', 'change', 'center', array('.align-fields' => array('display' => 'none')), 'not');
     }
     return $this->EditFormForLibraryMedia($formFields);
 }
Beispiel #16
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     $db =& $this->db;
     $user =& $this->user;
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $mediaid = $this->mediaid;
     // Permissions
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this assignment.');
         $this->response->keepOpen = true;
         return $this->response;
     }
     // Other properties
     $popupNotification = $this->GetOption('popupNotification');
     // Get the text out of RAW
     $rawXml = new DOMDocument();
     $rawXml->loadXML($this->GetRaw());
     Debug::LogEntry('audit', 'Raw XML returned: ' . $this->GetRaw());
     // Get the Text Node out of this
     $textNodes = $rawXml->getElementsByTagName('template');
     $textNode = $textNodes->item(0);
     $text = $textNode->nodeValue;
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=EditMedia');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" id="iRegionId" name="regionid" value="' . $regionid . '"><input type="hidden" name="mediaid" value="' . $mediaid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" />');
     $formFields = array();
     $formFields[] = FormManager::AddMessage(__('Ubuntu Client Only'));
     $formFields[] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this counter should be displayed'), 'd', 'required', '', $this->auth->modifyPermissions);
     $formFields[] = FormManager::AddCheckbox('popupNotification', __('Pop-up Notification?'), $popupNotification, __('Popup a notification when the counter changes?'), 'n');
     $formFields[] = FormManager::AddMultiText('ta_text', NULL, $text, __('Enter a format that should be applied to the counter when it is show.'), 't', 10);
     Theme::Set('form_fields', $formFields);
     if ($this->showRegionOptions) {
         $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
     } else {
         $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
     }
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->callBack = 'text_callback';
     $this->response->dialogTitle = __('Edit Counter');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     return $this->response;
 }
Beispiel #17
0
 function ConfirmLogout()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $userid = Kit::GetParam('userid', _GET, _INT);
     // Set some information about the form
     Theme::Set('form_id', 'SessionsLogoutForm');
     Theme::Set('form_action', 'index.php?p=sessions&q=LogoutUser');
     Theme::Set('form_meta', '<input type="hidden" name="userid" value="' . $userid . '" />');
     Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to logout this user?'))));
     $response->SetFormRequestResponse(NULL, __('Logout User'), '430px', '200px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Sessions', 'Logout') . '")');
     $response->AddButton(__('No'), 'XiboDialogClose()');
     $response->AddButton(__('Yes'), '$("#SessionsLogoutForm").submit()');
     $response->Respond();
 }
Beispiel #18
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $formFields = array();
     $formFields[] = FormManager::AddMessage(__('Renaming a font will cause existing layouts that use the font to break. Please be cautious.'));
     return $this->EditFormForLibraryMedia($formFields);
 }
Beispiel #19
0
 public function ImportForm()
 {
     global $session;
     $db =& $this->db;
     $response = new ResponseManager();
     // Set the Session / Security information
     $sessionId = session_id();
     $securityToken = CreateFormToken();
     $session->setSecurityToken($securityToken);
     // Find the max file size
     $maxFileSizeBytes = convertBytes(ini_get('upload_max_filesize'));
     // Set some information about the form
     Theme::Set('form_id', 'LayoutImportForm');
     Theme::Set('form_action', 'index.php?p=layout&q=Import');
     Theme::Set('form_meta', '<input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /><input type="hidden" name="hidFileID" id="hidFileID" value="" /><input type="hidden" name="template" value="' . Kit::GetParam('template', _GET, _STRING, 'false') . '" />');
     Theme::Set('form_upload_id', 'file_upload');
     Theme::Set('form_upload_action', 'index.php?p=content&q=FileUpload');
     Theme::Set('form_upload_meta', '<input type="hidden" id="PHPSESSID" value="' . $sessionId . '" /><input type="hidden" id="SecurityToken" value="' . $securityToken . '" /><input type="hidden" name="MAX_FILE_SIZE" value="' . $maxFileSizeBytes . '" />');
     Theme::Set('prepend', Theme::RenderReturn('form_file_upload_single'));
     $formFields = array();
     $formFields[] = FormManager::AddText('layout', __('Name'), NULL, __('The Name of the Layout - (1 - 50 characters). Leave blank to use the name from the import.'), 'n');
     $formFields[] = FormManager::AddCheckbox('replaceExisting', __('Replace Existing Media?'), NULL, __('If the import finds existing media with the same name, should it be replaced in the Layout or should the Layout use that media.'), 'r');
     if (Kit::GetParam('template', _GET, _STRING, 'false') != 'true') {
         $formFields[] = FormManager::AddCheckbox('importTags', __('Import Tags?'), NULL, __('Would you like to import any tags contained on the layout.'), 't');
     }
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Import Layout'), '350px', '200px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DataSet', 'ImportCsv') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Import'), '$("#LayoutImportForm").submit()');
     $response->Respond();
 }
Beispiel #20
0
 public function Step6()
 {
     // Form to collect the library location and server key
     $formFields = array();
     $formFields[] = FormManager::AddHidden('step', 7);
     $formFields[] = FormManager::AddText('library_location', __('Library Location'), NULL, sprintf(__('%s needs somewhere to store the things you upload to be shown. Ideally, this should be somewhere outside the root of your web server - that is such that is not accessible by a web browser. Please input the full path to this folder. If the folder does not already exist, we will attempt to create it for you.'), Theme::GetConfig('app_name')), 'n');
     $formFields[] = FormManager::AddText('server_key', __('Server Key'), Install::gen_secret(6), sprintf(__('%s needs you to choose a "key". This will be required each time you set-up a new client. It should be complicated, and hard to remember. It is visible in the CMS interface, so it need not be written down separately.'), Theme::GetConfig('app_name')), 'n');
     $formFields[] = FormManager::AddCheckbox('stats', __('Statistics'), 1, sprintf(__('We\'d love to know you\'re running %s. If you\'re happy for us to collect anonymous statistics (version number, number of displays) then please leave the box ticked. Please un tick the box if your server does not have direct access to the internet.'), Theme::GetConfig('app_name')), 'n');
     // Put up an error message if one has been set (and then unset it)
     if ($this->errorMessage != '') {
         Theme::Set('message', $this->errorMessage);
         Theme::Set('prepend', Theme::RenderReturn('message_box'));
         $this->errorMessage == '';
     }
     // Return a rendered form
     Theme::Set('form_action', 'install.php');
     Theme::Set('form_fields', $formFields);
     Theme::Set('form_buttons', array(FormManager::AddButton(__('Next'))));
     return Theme::RenderReturn('form_render');
 }
Beispiel #21
0
 /**
  * Edit Form
  */
 public function VerifyForm()
 {
     $user =& $this->user;
     $response = new ResponseManager();
     $helpManager = new HelpManager(NULL, $user);
     // Set some information about the form
     Theme::Set('form_id', 'VerifyForm');
     Theme::Set('form_action', 'index.php?p=module&q=Verify');
     $formFields = array();
     $formFields[] = FormManager::AddMessage(__('Verify all modules have been installed correctly by reinstalling any module related files'));
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Verify'), '350px', '325px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Module', 'Edit') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Verify'), '$("#VerifyForm").submit()');
     $response->Respond();
 }
 /**
  * Shows the Delete Group Form
  */
 function DeleteForm()
 {
     $displayProfile = new DisplayProfile();
     $displayProfile->displayProfileId = Kit::GetParam('displayprofileid', _GET, _INT);
     if (!$displayProfile->Load()) {
         trigger_error($displayProfile->GetErrorMessage(), E_USER_ERROR);
     }
     if ($this->user->usertypeid != 1 && $this->user->userid != $displayProfile->userId) {
         trigger_error(__('You do not have permission to edit this profile'), E_USER_ERROR);
     }
     // Set some information about the form
     Theme::Set('form_id', 'DisplayProfileDeleteForm');
     Theme::Set('form_action', 'index.php?p=displayprofile&q=Delete');
     Theme::Set('form_meta', '<input type="hidden" name="displayprofileid" value="' . $displayProfile->displayProfileId . '" />');
     Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete?'))));
     $response = new ResponseManager();
     $response->SetFormRequestResponse(NULL, __('Delete Display Profile'), '350px', '175px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DisplayProfile', 'Delete') . '")');
     $response->AddButton(__('No'), 'XiboDialogClose()');
     $response->AddButton(__('Yes'), '$("#DisplayProfileDeleteForm").submit()');
     $response->Respond();
 }
Beispiel #23
0
 /**
  * Form to Edit a transition
  */
 public function TransitionEditForm()
 {
     $this->response = new ResponseManager();
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this media.');
         $this->response->keepOpen = false;
         return $this->response;
     }
     // Are we dealing with an IN or an OUT
     $type = Kit::GetParam('type', _REQUEST, _WORD);
     switch ($type) {
         case 'in':
             $transition = $this->GetOption('transIn');
             $duration = $this->GetOption('transInDuration', 0);
             $direction = $this->GetOption('transInDirection');
             break;
         case 'out':
             $transition = $this->GetOption('transOut');
             $duration = $this->GetOption('transOutDuration', 0);
             $direction = $this->GetOption('transOutDirection');
             break;
         default:
             trigger_error(_('Unknown transition type'), E_USER_ERROR);
     }
     // Add none to the list
     $transitions = $this->user->TransitionAuth($type);
     $transitions[] = array('code' => '', 'transition' => 'None', 'class' => '');
     // Compass points for direction
     $compassPoints = array(array('id' => 'N', 'name' => __('North')), array('id' => 'NE', 'name' => __('North East')), array('id' => 'E', 'name' => __('East')), array('id' => 'SE', 'name' => __('South East')), array('id' => 'S', 'name' => __('South')), array('id' => 'SW', 'name' => __('South West')), array('id' => 'W', 'name' => __('West')), array('id' => 'NW', 'name' => __('North West')));
     Theme::Set('form_id', 'TransitionForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=TransitionEdit');
     Theme::Set('form_meta', '
         <input type="hidden" name="type" value="' . $type . '">
         <input type="hidden" name="layoutid" value="' . $this->layoutid . '">
         <input type="hidden" name="mediaid" value="' . $this->mediaid . '">
         <input type="hidden" name="lkid" value="' . $this->lkid . '">
         <input type="hidden" id="iRegionId" name="regionid" value="' . $this->regionid . '">
         <input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" />
         ');
     $formFields[] = FormManager::AddCombo('transitionType', __('Transition'), $transition, $transitions, 'code', 'transition', __('What transition should be applied when this region is finished?'), 't');
     $formFields[] = FormManager::AddNumber('transitionDuration', __('Duration'), $duration, __('The duration for this transition, in milliseconds.'), 'l', '', 'transition-group');
     $formFields[] = FormManager::AddCombo('transitionDirection', __('Direction'), $direction, $compassPoints, 'id', 'name', __('The direction for this transition. Only appropriate for transitions that move, such as Fly.'), 'd', 'transition-group transition-direction');
     // Add some dependencies
     $this->response->AddFieldAction('transitionType', 'init', '', array('.transition-group' => array('display' => 'none')));
     $this->response->AddFieldAction('transitionType', 'init', '', array('.transition-group' => array('display' => 'block')), 'not');
     $this->response->AddFieldAction('transitionType', 'change', '', array('.transition-group' => array('display' => 'none')));
     $this->response->AddFieldAction('transitionType', 'change', '', array('.transition-group' => array('display' => 'block')), 'not');
     // Decide where the cancel button will take us
     if ($this->showRegionOptions) {
         $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $this->layoutid . '&regionid=' . $this->regionid . '&q=RegionOptions")');
     } else {
         $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
     }
     // Always include the save button
     $this->response->AddButton(__('Save'), '$("#TransitionForm").submit()');
     // Output the form and dialog
     Theme::Set('form_fields', $formFields);
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->dialogTitle = sprintf(__('Edit %s Transition for %s'), $type, $this->displayType);
     $this->response->dialogSize = true;
     $this->response->dialogWidth = '450px';
     $this->response->dialogHeight = '280px';
     return $this->response;
 }
Beispiel #24
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     // This is the logged in user and can be used to assess permissions
     $user =& $this->user;
     // The CMS provides the region width and height in case they are needed
     $rWidth = Kit::GetParam('rWidth', _REQUEST, _STRING);
     $rHeight = Kit::GetParam('rHeight', _REQUEST, _STRING);
     // Augment settings with templates
     $this->loadTemplates();
     // All forms should set some meta data about the form.
     // Usually, you would want this meta data to remain the same.
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=EditMedia');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $this->layoutid . '"><input type="hidden" id="iRegionId" name="regionid" value="' . $this->regionid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" /><input type="hidden" id="mediaid" name="mediaid" value="' . $this->mediaid . '">');
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('template', __('Appearance'), array(array('name' => 'enlarge', 'value' => true)));
     $tabs[] = FormManager::AddTab('effect', __('Effect'));
     $tabs[] = FormManager::AddTab('advanced', __('Advanced'));
     Theme::Set('form_tabs', $tabs);
     $formFields['general'][] = FormManager::AddText('name', __('Name'), $this->GetOption('name'), __('An optional name for this media'), 'n');
     // Duration
     $formFields['general'][] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed.'), 'd', 'required');
     // Search Term
     $formFields['general'][] = FormManager::AddText('searchTerm', __('Search Term'), $this->GetOption('searchTerm'), __('Search term. You can test your search term in the twitter.com search box first.'), 's', 'required');
     // Type
     $formFields['general'][] = FormManager::AddCombo('resultType', __('Type'), $this->GetOption('resultType'), array(array('typeid' => 'mixed', 'type' => __('Mixed')), array('typeid' => 'recent', 'type' => __('Recent')), array('typeid' => 'popular', 'type' => __('Popular'))), 'typeid', 'type', __('Recent shows only the most recent tweets, Popular the most popular and Mixed includes both popular and recent results.'), 't', 'required');
     // Distance
     $formFields['general'][] = FormManager::AddNumber('tweetDistance', __('Distance'), $this->GetOption('tweetDistance'), __('Distance in miles that the tweets should be returned from. Set to 0 for no restrictions.'), 'd');
     // Distance
     $formFields['general'][] = FormManager::AddNumber('tweetCount', __('Count'), $this->GetOption('tweetCount'), __('The number of Tweets to return.'), 'c');
     // Common fields
     $formFields['effect'][] = FormManager::AddCombo('effect', __('Effect'), $this->GetOption('effect'), array(array('effectid' => 'none', 'effect' => __('None')), array('effectid' => 'fade', 'effect' => __('Fade')), array('effectid' => 'fadeout', 'effect' => __('Fade Out')), array('effectid' => 'scrollHorz', 'effect' => __('Scroll Horizontal')), array('effectid' => 'scrollVert', 'effect' => __('Scroll Vertical')), array('effectid' => 'flipHorz', 'effect' => __('Flip Horizontal')), array('effectid' => 'flipVert', 'effect' => __('Flip Vertical')), array('effectid' => 'shuffle', 'effect' => __('Shuffle')), array('effectid' => 'tileSlide', 'effect' => __('Tile Slide')), array('effectid' => 'tileBlind', 'effect' => __('Tile Blinds')), array('effectid' => 'marqueeLeft', 'effect' => __('Marquee Left')), array('effectid' => 'marqueeRight', 'effect' => __('Marquee Right')), array('effectid' => 'marqueeUp', 'effect' => __('Marquee Up')), array('effectid' => 'marqueeDown', 'effect' => __('Marquee Down'))), 'effectid', 'effect', __('Please select the effect that will be used to transition between items. If all items should be output, select None. Marquee effects are CPU intensive and may not be suitable for lower power displays.'), 'e');
     $formFields['effect'][] = FormManager::AddNumber('speed', __('Speed'), $this->GetOption('speed'), __('The transition speed of the selected effect in milliseconds (normal = 1000) or the Marquee Speed in a low to high scale (normal = 1).'), 's', NULL, 'effect-controls');
     // A list of web safe colours
     $formFields['advanced'][] = FormManager::AddText('backgroundColor', __('Background Colour'), $this->GetOption('backgroundColor'), __('The selected effect works best with a background colour. Optionally add one here.'), 'c', NULL, 'background-color-group');
     // Field empty
     $formFields['advanced'][] = FormManager::AddText('noTweetsMessage', __('No tweets'), $this->GetOption('noTweetsMessage'), __('A message to display when there are no tweets returned by the search query'), 'n');
     $formFields['advanced'][] = FormManager::AddText('dateFormat', __('Date Format'), $this->GetOption('dateFormat'), __('The format to apply to all dates returned by the ticker. In PHP date format: http://uk3.php.net/manual/en/function.date.php'), 'f');
     $formFields['advanced'][] = FormManager::AddCheckbox('removeUrls', __('Remove URLs?'), $this->GetOption('removeUrls', 1), __('Should URLs be removed from the Tweet Text. Most URLs do not compliment digital signage.'), 'u');
     $formFields['advanced'][] = FormManager::AddNumber('updateInterval', __('Update Interval (mins)'), $this->GetOption('updateInterval', 60), __('Please enter the update interval in minutes. This should be kept as high as possible. For example, if the data will only change once per hour this could be set to 60.'), 'n', 'required');
     // Encode up the template
     if (Config::GetSetting('SERVER_MODE') == 'Test' && $this->user->usertypeid == 1) {
         $formFields['advanced'][] = FormManager::AddMessage('<pre>' . htmlentities(json_encode(array('id' => 'ID', 'value' => 'TITLE', 'template' => $this->GetRawNode('template'), 'css' => $this->GetRawNode('styleSheet')))) . '</pre>');
     }
     // Template - for standard stuff
     $formFields['template'][] = FormManager::AddCombo('templateId', __('Template'), $this->GetOption('templateId', 'tweet-only'), $this->settings['templates'], 'id', 'value', __('Select the template you would like to apply. This can be overridden using the check box below.'), 't', 'template-selector-control');
     // Add a field for whether to override the template or not.
     // Default to 1 so that it will work correctly with old items (that didn't have a template selected at all)
     $formFields['template'][] = FormManager::AddCheckbox('overrideTemplate', __('Override the template?'), $this->GetOption('overrideTemplate', 0), __('Tick if you would like to override the template.'), 'o');
     // Add a text template
     $formFields['template'][] = FormManager::AddMultiText('ta_text', NULL, $this->GetRawNode('template'), __('Enter the template. Please note that the background colour has automatically coloured to your layout background colour.'), 't', 10, NULL, 'template-override-controls');
     // Field for the style sheet (optional)
     $formFields['template'][] = FormManager::AddMultiText('ta_css', NULL, $this->GetRawNode('styleSheet'), __('Optional Stylesheet'), 's', 10, NULL, 'template-override-controls');
     // Add some field dependencies
     // When the override template check box is ticked, we want to expose the advanced controls and we want to hide the template selector
     $this->response->AddFieldAction('overrideTemplate', 'init', false, array('.template-override-controls' => array('display' => 'none'), '.template-selector-control' => array('display' => 'block')), 'is:checked');
     $this->response->AddFieldAction('overrideTemplate', 'change', false, array('.template-override-controls' => array('display' => 'none'), '.template-selector-control' => array('display' => 'block')), 'is:checked');
     $this->response->AddFieldAction('overrideTemplate', 'init', true, array('.template-override-controls' => array('display' => 'block'), '.template-selector-control' => array('display' => 'none')), 'is:checked');
     $this->response->AddFieldAction('overrideTemplate', 'change', true, array('.template-override-controls' => array('display' => 'block'), '.template-selector-control' => array('display' => 'none')), 'is:checked');
     // Present an error message if the module has not been configured. Don't prevent further configuration.
     if (!extension_loaded('curl') || $this->GetSetting('apiKey') == '' || $this->GetSetting('apiSecret') == '') {
         $formFields['general'][] = FormManager::AddMessage(__('The Twitter Widget has not been configured yet, please ask your CMS Administrator to look at it for you.'), 'alert alert-danger');
     }
     // Modules should be rendered using the theme engine.
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_template', $formFields['template']);
     Theme::Set('form_fields_effect', $formFields['effect']);
     Theme::Set('form_fields_advanced', $formFields['advanced']);
     // Set the field dependencies
     $this->setFieldDepencencies();
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->dialogTitle = __($this->displayType);
     $this->response->callBack = 'text_callback';
     // The response object outputs the required JSON object to the browser
     // which is then processed by the CMS JavaScript library (xibo-cms.js).
     // Append the templates to the response
     $this->response->extra = $this->settings['templates'];
     $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $this->layoutid . '&regionid=' . $this->regionid . '&q=RegionOptions")');
     $this->response->AddButton(__('Apply'), 'XiboDialogApply("#ModuleForm")');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     // The response must be returned.
     return $this->response;
 }
Beispiel #25
0
 /**
  * Resolution Delete Form
  */
 function DeleteForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $resolutionid = Kit::GetParam('resolutionid', _GET, _INT);
     // Set some information about the form
     Theme::Set('form_id', 'DeleteForm');
     Theme::Set('form_action', 'index.php?p=resolution&q=Delete');
     Theme::Set('form_meta', '<input type="hidden" name="resolutionid" value="' . $resolutionid . '" />');
     Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete?'))));
     $response->SetFormRequestResponse(Theme::RenderReturn('form_render'), __('Delete Resolution'), '250px', '150px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Delete') . '")');
     $response->AddButton(__('No'), 'XiboDialogClose()');
     $response->AddButton(__('Yes'), '$("#DeleteForm").submit()');
     $response->Respond();
 }
Beispiel #26
0
 public function ScheduleNowForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $date = time();
     // We might have a layout id, or a display id
     $campaignId = Kit::GetParam('CampaignID', _GET, _INT, 0);
     $displayGroupIds = Kit::GetParam('displayGroupId', _GET, _ARRAY);
     Theme::Set('form_id', 'ScheduleNowForm');
     Theme::Set('form_action', 'index.php?p=schedule&q=ScheduleNow');
     $formFields = array();
     // Generate a list of layouts.
     $layouts = $user->CampaignList(NULL, false, false);
     $optionGroups = array(array('id' => 'campaign', 'label' => __('Campaigns')), array('id' => 'layout', 'label' => __('Layouts')));
     $layoutOptions = array();
     $campaignOptions = array();
     foreach ($layouts as $layout) {
         if ($layout['islayoutspecific'] == 1) {
             $layoutOptions[] = array('id' => $layout['campaignid'], 'value' => $layout['campaign']);
         } else {
             $campaignOptions[] = array('id' => $layout['campaignid'], 'value' => $layout['campaign']);
         }
     }
     $formFields[] = FormManager::AddCombo('CampaignID', __('Layout'), $campaignId, array('campaign' => $campaignOptions, 'layout' => $layoutOptions), 'id', 'value', __('Please select a Layout or Campaign for this Event to show'), 'l', '', true, '', '', '', $optionGroups);
     $formFields[] = FormManager::AddText('hours', __('Hours'), NULL, __('Hours this event should be scheduled for'), 'h', '');
     $formFields[] = FormManager::AddText('minutes', __('Minutes'), NULL, __('Minutes this event should be scheduled for'), 'h', '');
     $formFields[] = FormManager::AddText('seconds', __('Seconds'), NULL, __('Seconds this event should be scheduled for'), 'h', '');
     // List of Display Groups
     $optionGroups = array(array('id' => 'group', 'label' => __('Groups')), array('id' => 'display', 'label' => __('Displays')));
     $groups = array();
     $displays = array();
     $scheduleWithView = Config::GetSetting('SCHEDULE_WITH_VIEW_PERMISSION') == 'Yes';
     foreach ($this->user->DisplayGroupList(-1) as $display) {
         // Can schedule with view, but no view permissions
         if ($scheduleWithView && $display['view'] != 1) {
             continue;
         }
         // Can't schedule with view, but no edit permissions
         if (!$scheduleWithView && $display['edit'] != 1) {
             continue;
         }
         $display['checked_text'] = in_array($display['displaygroupid'], $displayGroupIds) ? ' selected' : '';
         if ($display['isdisplayspecific'] == 1) {
             $displays[] = $display;
         } else {
             $groups[] = $display;
         }
     }
     $formFields[] = FormManager::AddMultiCombo('DisplayGroupIDs[]', __('Display'), $displayGroupIds, array('group' => $groups, 'display' => $displays), 'displaygroupid', 'displaygroup', __('Please select one or more displays / groups for this event to be shown on.'), 'd', '', true, '', '', '', $optionGroups, array(array('name' => 'data-live-search', 'value' => "true"), array('name' => 'data-selected-text-format', 'value' => "count > 4")));
     $formFields[] = FormManager::AddNumber('DisplayOrder', __('Display Order'), 0, __('Should this event have an order?'), 'o', '');
     $formFields[] = FormManager::AddCheckbox('is_priority', __('Priority?'), NULL, __('Sets whether or not this event has priority. If set the event will be show in preference to other events.'), 'p');
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Schedule Now'), '700px', '400px');
     $response->callBack = 'setupScheduleNowForm';
     $response->AddButton(__('Help'), "XiboHelpRender('index.php?p=help&q=Display&Topic=Schedule&Category=ScheduleNow')");
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#ScheduleNowForm").submit()');
     $response->Respond();
 }
Beispiel #27
0
 public function RequestScreenShotForm()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $displayId = Kit::GetParam('displayId', _GET, _INT);
     // Set some information about the form
     Theme::Set('form_id', 'RequestScreenShotForm');
     Theme::Set('form_action', 'index.php?p=display&q=RequestScreenShot');
     Theme::Set('form_meta', '<input type="hidden" name="displayId" value="' . $displayId . '">');
     Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to request a screen shot? The next time the client connects to the CMS the screen shot will be sent.'))));
     $response->SetFormRequestResponse(NULL, __('Request Screen Shot'), '300px', '250px');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Request'), '$("#RequestScreenShotForm").submit()');
     $response->Respond();
 }
Beispiel #28
0
 public function tidyLibraryForm()
 {
     $response = new ResponseManager();
     Theme::Set('form_id', 'TidyLibraryForm');
     Theme::Set('form_action', 'index.php?p=content&q=tidyLibrary');
     $formFields = array();
     $formFields[] = FormManager::AddMessage(__('Tidying your Library will delete any media that is not currently in use.'));
     // Work out how many files there are
     $media = Media::entriesUnusedForUser($this->user->userid);
     $formFields[] = FormManager::AddMessage(sprintf(__('There is %s of data stored in %d files . Are you sure you want to proceed?', Kit::formatBytes(array_sum(array_map(function ($element) {
         return $element['fileSize'];
     }, $media))), count($media))));
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Tidy Library'), '350px', '275px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Content', 'TidyLibrary') . '")');
     $response->AddButton(__('No'), 'XiboDialogClose()');
     $response->AddButton(__('Yes'), '$("#TidyLibraryForm").submit()');
     $response->Respond();
 }
Beispiel #29
0
 /**
  * Displays the Library Assign form
  * @return
  */
 function LayoutAssignForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Input vars
     $campaignId = Kit::GetParam('CampaignID', _GET, _INT);
     $id = uniqid();
     Theme::Set('id', $id);
     Theme::Set('form_meta', '<input type="hidden" name="p" value="campaign"><input type="hidden" name="q" value="LayoutAssignView">');
     Theme::Set('pager', ResponseManager::Pager($id, 'grid_pager'));
     // Get the currently assigned layouts and put them in the "well"
     $layoutsAssigned = Layout::Entries(array('lkcl.DisplayOrder'), array('campaignId' => $campaignId));
     if (!is_array($layoutsAssigned)) {
         trigger_error($db->error());
         trigger_error(__('Error getting Layouts'), E_USER_ERROR);
     }
     Debug::LogEntry('audit', count($layoutsAssigned) . ' layouts assigned already');
     $formFields = array();
     $formFields[] = FormManager::AddText('filter_name', __('Name'), NULL, NULL, 'l');
     $formFields[] = FormManager::AddText('filter_tags', __('Tags'), NULL, NULL, 't');
     Theme::Set('form_fields', $formFields);
     // Set the layouts assigned
     Theme::Set('layouts_assigned', $layoutsAssigned);
     Theme::Set('append', Theme::RenderReturn('campaign_form_layout_assign'));
     // Call to render the template
     Theme::Set('header_text', __('Choose Layouts'));
     $output = Theme::RenderReturn('grid_render');
     // Construct the Response
     $response->html = $output;
     $response->success = true;
     $response->dialogSize = true;
     $response->dialogWidth = '780px';
     $response->dialogHeight = '580px';
     $response->dialogTitle = __('Layouts on Campaign');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Layouts') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), 'LayoutsSubmit("' . $campaignId . '")');
     $response->Respond();
 }
Beispiel #30
0
 /**
  * Shows the form to delete a template
  */
 public function DeleteTemplateForm()
 {
     $response = new ResponseManager();
     $templateId = Kit::GetParam('layoutid', _GET, _INT);
     $auth = $this->user->TemplateAuth($templateId, true);
     if (!$auth->del) {
         trigger_error(__('You do not have permissions to delete this template'), E_USER_ERROR);
     }
     Theme::Set('form_id', 'DeleteForm');
     Theme::Set('form_action', 'index.php?p=template&q=DeleteTemplate');
     Theme::Set('form_meta', '<input type="hidden" name="templateId" value="' . $templateId . '">');
     Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete this template?'))));
     $form = Theme::RenderReturn('form_render');
     $response->SetFormRequestResponse($form, __('Delete Template'), '300px', '200px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Template', 'Delete') . '")');
     $response->AddButton(__('No'), 'XiboDialogClose()');
     $response->AddButton(__('Yes'), '$("#DeleteForm").submit()');
     $response->Respond();
 }