Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * Shows a list of displays
  */
 public function DisplayList()
 {
     $user =& $this->user;
     $response = new ResponseManager();
     $displayGroupIDs = Kit::GetParam('DisplayGroupIDs', _SESSION, _ARRAY);
     $filter_name = Kit::GetParam('filter_name', _POST, _STRING);
     // Build 2 lists
     $groups = array();
     $displays = array();
     foreach ($user->DisplayGroupList(0, $filter_name) as $display) {
         $display['checked_text'] = in_array($display['displaygroupid'], $displayGroupIDs) ? 'checked' : '';
         if ($display['isdisplayspecific'] == 1) {
             $displays[] = $display;
         } else {
             $groups[] = $display;
         }
     }
     Theme::Set('id', 'DisplayList');
     Theme::Set('group_list_items', $groups);
     Theme::Set('display_list_items', $displays);
     $output = Theme::RenderReturn('schedule_page_display_list');
     $response->SetGridResponse($output);
     $response->callBack = 'DisplayListRender';
     $response->Respond();
 }
Ejemplo n.º 3
0
 function displayPage()
 {
     Theme::Set('version', VERSION);
     Theme::Set('text', Theme::RenderReturn('about_text'));
     // Render the Theme and output
     Theme::Render('about_page');
 }
Ejemplo n.º 4
0
 function displayPage()
 {
     $db =& $this->db;
     $user =& $this->user;
     $error = Kit::GetParam('ErrorMessage', _SESSION, _HTMLSTRING, __('Unknown Error'));
     Theme::Set('ErrorMessage', $error);
     Theme::Render('error');
 }
Ejemplo n.º 5
0
 function displayPage()
 {
     // Set some information about the form
     Theme::Set('form_id', 'SettingsForm');
     Theme::Set('form_action', 'index.php?p=group&q=Delete');
     Theme::Set('settings_help_button_url', HelpManager::Link('Content', 'Config'));
     Theme::Set('settings_form', $this->display_settings());
     // Render the Theme and output
     Theme::Render('settings_page');
 }
Ejemplo n.º 6
0
 function displayPage()
 {
     $db =& $this->db;
     $user =& $this->user;
     $config = new Config();
     // Configure the theme
     Theme::Set('environment_check', $config->CheckEnvironment());
     Theme::Set('collect_data_url', 'index.php?p=fault&q=CollectData');
     // Render the Theme and output
     Theme::Render('fault_page');
 }
Ejemplo n.º 7
0
 /**
  * Validate the User is Logged In
  * @param $ajax Object[optional] Indicates if this request came from an AJAX call or otherwise
  */
 function attempt_login($ajax = false)
 {
     $db =& $this->db;
     $userid = Kit::GetParam('userid', _SESSION, _INT);
     // Referring Page is anything after the ?
     $requestUri = rawurlencode(Kit::GetCurrentPage());
     if (!$this->checkforUserid()) {
         // Log out the user
         if ($userid != 0) {
             $db->query(sprintf("UPDATE user SET loggedin = 0 WHERE userid = %d ", $userid));
         }
         // AJAX calls that fail the login test cause a page redirect
         if ($ajax) {
             //create the AJAX request object
             $response = new ResponseManager();
             $response->Login();
             $response->Respond();
         } else {
             Theme::Set('form_meta', '<input type="hidden" name="token" value="' . CreateFormToken() . '" />');
             Theme::Set('form_action', 'index.php?q=login&referingPage=' . $requestUri);
             Theme::Set('about_url', 'index.php?p=index&q=About');
             Theme::Set('source_url', 'https://launchpad.net/xibo/1.6');
             // Message (either from the URL or the session)
             $message = Kit::GetParam('message', _GET, _STRING, Kit::GetParam('message', _SESSION, _STRING, ''));
             Theme::Set('login_message', $message);
             Theme::Render('login_page');
             // Clear the session message
             $_SESSION['message'] = '';
             exit;
         }
         return false;
     } else {
         //write out to the db that the logged in user has accessed the page still
         $SQL = sprintf("UPDATE user SET lastaccessed = '" . date("Y-m-d H:i:s") . "', loggedin = 1 WHERE userid = %d ", $userid);
         $results = $db->query($SQL) or trigger_error("Can not write last accessed info.", E_USER_ERROR);
         // Load the information about this user
         $this->LoginServices($userid);
         return true;
     }
 }
Ejemplo n.º 8
0
 /**
  * Shows the stats grid
  */
 public function StatsGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $fromDt = Kit::GetParam('fromdt', _POST, _STRING);
     $toDt = Kit::GetParam('todt', _POST, _STRING);
     $displayId = Kit::GetParam('displayid', _POST, _INT);
     $mediaId = Kit::GetParam('mediaid', _POST, _INT);
     // What if the fromdt and todt are exactly the same?
     // in this case assume an entire day from midnight on the fromdt to midnight on the todt (i.e. add a day to the todt)
     if ($fromDt == $toDt) {
         $toDt = date("Y-m-d", strtotime($toDt) + 86399);
     }
     Theme::Set('form_action', '');
     Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"/><input type="hidden" name="q" value="OutputCSV"/><input type="hidden" name="displayid" value="' . $displayId . '" /><input type="hidden" name="fromdt" value="' . $fromDt . '" /><input type="hidden" name="todt" value="' . $toDt . '" />');
     // Get an array of display id this user has access to.
     $displays = $this->user->DisplayList();
     $display_ids = array();
     foreach ($displays as $display) {
         $display_ids[] = $display['displayid'];
     }
     if (count($display_ids) <= 0) {
         trigger_error(__('No displays with View permissions'), E_USER_ERROR);
     }
     // 3 grids showing different stats.
     // Layouts Ran
     $SQL = 'SELECT display.Display, layout.Layout, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd ';
     $SQL .= '  FROM stat ';
     $SQL .= '  INNER JOIN layout ON layout.LayoutID = stat.LayoutID ';
     $SQL .= '  INNER JOIN display ON stat.DisplayID = display.DisplayID ';
     $SQL .= " WHERE stat.type = 'layout' ";
     $SQL .= sprintf("  AND stat.end > '%s' ", $fromDt);
     $SQL .= sprintf("  AND stat.start <= '%s' ", $toDt);
     $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') ';
     if ($displayId != 0) {
         $SQL .= sprintf("  AND stat.displayID = %d ", $displayId);
     }
     $SQL .= 'GROUP BY display.Display, layout.Layout ';
     $SQL .= 'ORDER BY display.Display, layout.Layout';
     if (!($results = $this->db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get Layouts Shown'), E_USER_ERROR);
     }
     $rows = array();
     while ($row = $db->get_assoc_row($results)) {
         $row['Display'] = Kit::ValidateParam($row['Display'], _STRING);
         $row['Layout'] = Kit::ValidateParam($row['Layout'], _STRING);
         $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT);
         $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT);
         $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT));
         $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING);
         $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING);
         $rows[] = $row;
     }
     Theme::Set('table_layouts_shown', $rows);
     // Media Ran
     $SQL = 'SELECT display.Display, media.Name, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd ';
     $SQL .= '  FROM stat ';
     $SQL .= '  INNER JOIN display ON stat.DisplayID = display.DisplayID ';
     $SQL .= '  INNER JOIN  media ON media.MediaID = stat.MediaID ';
     $SQL .= " WHERE stat.type = 'media' ";
     $SQL .= sprintf("  AND stat.end > '%s' ", $fromDt);
     $SQL .= sprintf("  AND stat.start <= '%s' ", $toDt);
     $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') ';
     if ($mediaId != 0) {
         $SQL .= sprintf("  AND media.MediaID = %d ", $mediaId);
     }
     if ($displayId != 0) {
         $SQL .= sprintf("  AND stat.displayID = %d ", $displayId);
     }
     $SQL .= 'GROUP BY display.Display, media.Name ';
     $SQL .= 'ORDER BY display.Display, media.Name';
     if (!($results = $this->db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get Library Media Ran'), E_USER_ERROR);
     }
     $rows = array();
     while ($row = $db->get_assoc_row($results)) {
         $row['Display'] = Kit::ValidateParam($row['Display'], _STRING);
         $row['Media'] = Kit::ValidateParam($row['Name'], _STRING);
         $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT);
         $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT);
         $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT));
         $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING);
         $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING);
         $rows[] = $row;
     }
     Theme::Set('table_media_shown', $rows);
     // Media on Layouts Ran
     $SQL = "SELECT display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage') AS Name, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd ";
     $SQL .= '  FROM stat ';
     $SQL .= '  INNER JOIN display ON stat.DisplayID = display.DisplayID ';
     $SQL .= '  INNER JOIN layout ON layout.LayoutID = stat.LayoutID ';
     $SQL .= '  LEFT OUTER JOIN media ON media.MediaID = stat.MediaID ';
     $SQL .= " WHERE stat.type = 'media' ";
     $SQL .= sprintf("  AND stat.end > '%s' ", $fromDt);
     $SQL .= sprintf("  AND stat.start <= '%s' ", $toDt);
     $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') ';
     if ($mediaId != 0) {
         $SQL .= sprintf("  AND media.MediaID = %d ", $mediaId);
     }
     if ($displayId != 0) {
         $SQL .= sprintf("  AND stat.displayID = %d ", $displayId);
     }
     $SQL .= "GROUP BY display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage') ";
     $SQL .= "ORDER BY display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage')";
     if (!($results = $this->db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get Library Media Ran'), E_USER_ERROR);
     }
     $rows = array();
     while ($row = $db->get_assoc_row($results)) {
         $row['Display'] = Kit::ValidateParam($row['Display'], _STRING);
         $row['Layout'] = Kit::ValidateParam($row['Layout'], _STRING);
         $row['Media'] = Kit::ValidateParam($row['Name'], _STRING);
         $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT);
         $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT);
         $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT));
         $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING);
         $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING);
         $rows[] = $row;
     }
     Theme::Set('table_media_on_layouts_shown', $rows);
     $output = Theme::RenderReturn('stats_page_grid');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Ejemplo n.º 9
0
 /**
  * Shows information about Xibo
  * @return 
  */
 function About()
 {
     $response = new ResponseManager();
     Theme::Set('version', VERSION);
     // Render the Theme and output
     $output = Theme::RenderReturn('about_text');
     $response->SetFormRequestResponse($output, __('About'), '500', '500');
     $response->AddButton(__('Close'), 'XiboDialogClose()');
     $response->Respond();
 }
Ejemplo n.º 10
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();
 }
Ejemplo n.º 11
0
 /**
  * Permissions form
  */
 public function PermissionsForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $helpManager = new HelpManager($db, $user);
     $templateId = Kit::GetParam('templateid', _GET, _INT);
     if ($templateId == 0) {
         trigger_error(__('No template selected'), E_USER_ERROR);
     }
     // Is this user allowed to delete this template?
     $auth = $this->user->TemplateAuth($templateId, true);
     // Set some information about the form
     Theme::Set('form_id', 'TemplatePermissionsForm');
     Theme::Set('form_action', 'index.php?p=template&q=Permissions');
     Theme::Set('form_meta', '<input type="hidden" name="templateid" value="' . $templateId . '" />');
     // List of all Groups with a view/edit/delete checkbox
     $SQL = '';
     $SQL .= 'SELECT `group`.GroupID, `group`.`Group`, View, Edit, Del, `group`.IsUserSpecific ';
     $SQL .= '  FROM `group` ';
     $SQL .= '   LEFT OUTER JOIN lktemplategroup ';
     $SQL .= '   ON lktemplategroup.GroupID = group.GroupID ';
     $SQL .= '       AND lktemplategroup.TemplateID = %d ';
     $SQL .= ' WHERE `group`.GroupID <> %d ';
     $SQL .= 'ORDER BY `group`.IsEveryone DESC, `group`.IsUserSpecific, `group`.`Group` ';
     $SQL = sprintf($SQL, $templateId, $user->getGroupFromId($user->userid, true));
     if (!($results = $db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get permissions for this template'), E_USER_ERROR);
     }
     $checkboxes = array();
     while ($row = $db->get_assoc_row($results)) {
         $groupId = $row['GroupID'];
         $rowClass = $row['IsUserSpecific'] == 0 ? 'strong_text' : '';
         $checkbox = array('id' => $groupId, 'name' => Kit::ValidateParam($row['Group'], _STRING), 'class' => $rowClass, 'value_view' => $groupId . '_view', 'value_view_checked' => $row['View'] == 1 ? 'checked' : '', 'value_edit' => $groupId . '_edit', 'value_edit_checked' => $row['Edit'] == 1 ? 'checked' : '', 'value_del' => $groupId . '_del', 'value_del_checked' => $row['Del'] == 1 ? 'checked' : '');
         $checkboxes[] = $checkbox;
     }
     Theme::Set('form_rows', $checkboxes);
     $form = Theme::RenderReturn('campaign_form_permissions');
     $response->SetFormRequestResponse($form, __('Permissions'), '350px', '500px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Template', 'Permissions') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#TemplatePermissionsForm").submit()');
     $response->Respond();
 }
Ejemplo n.º 12
0
 /**
  * Show the library
  * @return 
  */
 function LibraryAssignView()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     //Input vars
     $mediatype = Kit::GetParam('filter_type', _POST, _STRING);
     $name = Kit::GetParam('filter_name', _POST, _STRING);
     // Get a list of media
     $mediaList = $user->MediaList($mediatype, $name);
     $rows = array();
     // Add some extra information
     foreach ($mediaList as $row) {
         $row['duration_text'] = sec2hms($row['duration']);
         $row['list_id'] = 'MediaID_' . $row['mediaid'];
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     // Render the Theme
     $response->SetGridResponse(Theme::RenderReturn('library_form_assign_list'));
     $response->callBack = 'LibraryAssignCallback';
     $response->pageSize = 5;
     $response->Respond();
 }
Ejemplo n.º 13
0
 /**
  * Delete Help Link Form
  */
 public function DeleteForm()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $helpId = Kit::GetParam('HelpID', _REQUEST, _INT);
     // Set some information about the form
     Theme::Set('form_id', 'HelpDeleteForm');
     Theme::Set('form_action', 'index.php?p=help&q=Delete');
     Theme::Set('form_meta', '<input type="hidden" name="HelpID" value="' . $helpId . '" />');
     $form = Theme::RenderReturn('help_form_delete');
     $response->SetFormRequestResponse($form, __('Delete Help Link'), '350px', '175px');
     $response->AddButton(__('No'), 'XiboDialogClose()');
     $response->AddButton(__('Yes'), '$("#HelpDeleteForm").submit()');
     $response->Respond();
 }
Ejemplo n.º 14
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();
 }
Ejemplo n.º 15
0
 /**
  * Return the Edit Form as HTML
  * @return 
  */
 public function EditForm()
 {
     $db =& $this->db;
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $mediaid = $this->mediaid;
     // Can this user edit?
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this media.');
         $this->response->keepOpen = false;
         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 . '">');
     // Get the embedded HTML out of RAW
     $rawXml = new DOMDocument();
     $rawXml->loadXML($this->GetRaw());
     Debug::LogEntry('audit', 'Raw XML returned: ' . $this->GetRaw());
     // Get the HTML Node out of this
     $textNodes = $rawXml->getElementsByTagName('embedHtml');
     $textNode = $textNodes->item(0);
     Theme::Set('embedHtml', $textNode->nodeValue);
     $textNodes = $rawXml->getElementsByTagName('embedScript');
     $textNode = $textNodes->item(0);
     Theme::Set('embedScript', $textNode->nodeValue);
     Theme::Set('duration', $this->duration);
     Theme::Set('durationFieldEnabled', $this->auth->modifyPermissions ? '' : ' readonly');
     // Is the transparency option set?
     if ($this->GetOption('transparency')) {
         Theme::Set('transparency_checked', 'checked');
     }
     //Output the form
     $form = Theme::RenderReturn('media_form_embedded_edit');
     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 = $form;
     $this->response->dialogTitle = 'Edit Embedded HTML';
     $this->response->dialogSize = true;
     $this->response->dialogWidth = '650px';
     $this->response->dialogHeight = '450px';
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     return $this->response;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 17
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;
 }
Ejemplo n.º 18
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();
 }
Ejemplo n.º 19
0
 /**
  * Edit Form
  */
 public function EditForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $helpManager = new HelpManager($db, $user);
     // Can we edit?
     if (Config::GetSetting('MODULE_CONFIG_LOCKED_CHECKB') == 'Checked') {
         trigger_error(__('Module Config Locked'), E_USER_ERROR);
     }
     $moduleId = Kit::GetParam('ModuleID', _GET, _INT);
     // Pull the currently known info from the DB
     $SQL = '';
     $SQL .= 'SELECT ModuleID, ';
     $SQL .= '   Name, ';
     $SQL .= '   Enabled, ';
     $SQL .= '   Description, ';
     $SQL .= '   RegionSpecific, ';
     $SQL .= '   ValidExtensions, ';
     $SQL .= '   ImageUri, ';
     $SQL .= '   PreviewEnabled ';
     $SQL .= '  FROM `module` ';
     $SQL .= ' WHERE ModuleID = %d ';
     $SQL = sprintf($SQL, $moduleId);
     if (!($row = $db->GetSingleRow($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Error getting Module'));
     }
     Theme::Set('validextensions', Kit::ValidateParam($row['ValidExtensions'], _STRING));
     Theme::Set('imageuri', Kit::ValidateParam($row['ImageUri'], _STRING));
     Theme::Set('isregionspecific', Kit::ValidateParam($row['RegionSpecific'], _INT));
     Theme::Set('enabled_checked', Kit::ValidateParam($row['Enabled'], _INT) ? 'checked' : '');
     Theme::Set('preview_enabled_checked', Kit::ValidateParam($row['PreviewEnabled'], _INT) ? 'checked' : '');
     // Set some information about the form
     Theme::Set('form_id', 'ModuleEditForm');
     Theme::Set('form_action', 'index.php?p=module&q=Edit');
     Theme::Set('form_meta', '<input type="hidden" name="ModuleID" value="' . $moduleId . '" />');
     $form = Theme::RenderReturn('module_form_edit');
     $response->SetFormRequestResponse($form, __('Edit Module'), '350px', '325px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Module', 'Edit') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#ModuleEditForm").submit()');
     $response->Respond();
 }
Ejemplo n.º 20
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();
 }
Ejemplo n.º 21
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();
 }
Ejemplo n.º 22
0
 /**
  * Return the Edit Form as HTML
  * @return 
  */
 public function EditForm()
 {
     $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 . '">');
     // What is the source for this ticker?
     $sourceId = $this->GetOption('sourceId');
     $dataSetId = $this->GetOption('datasetid');
     Theme::Set('sourceId', $sourceId);
     // Data Set Source
     if ($sourceId == 2) {
         // Extra Fields for the DataSet
         Theme::Set('columns', $db->GetArray(sprintf("SELECT DataSetColumnID, Heading FROM datasetcolumn WHERE DataSetID = %d ", $dataSetId)));
         Theme::Set('upperLimit', $this->GetOption('upperLimit'));
         Theme::Set('lowerLimit', $this->GetOption('lowerLimit'));
         Theme::Set('filter', $this->GetOption('filter'));
         Theme::Set('ordering', $this->GetOption('ordering'));
     } else {
         // Extra Fields for the Ticker
         $subs = array(array('Substitute' => 'Title'), array('Substitute' => 'Description'), array('Substitute' => 'Content'), array('Substitute' => 'Copyright'), array('Substitute' => 'Link'), array('Substitute' => 'PermaLink'), array('Substitute' => 'Tag|Namespace'));
         Theme::Set('substitutions', $subs);
     }
     // Direction Options
     $directionOptions = array(array('directionid' => 'none', 'direction' => __('None')), array('directionid' => 'left', 'direction' => __('Left')), array('directionid' => 'right', 'direction' => __('Right')), array('directionid' => 'up', 'direction' => __('Up')), array('directionid' => 'down', 'direction' => __('Down')), array('directionid' => 'single', 'direction' => __('Single')));
     Theme::Set('direction_field_list', $directionOptions);
     // "Take from" Options
     $takeItemsFrom = array(array('takeitemsfromid' => 'start', 'takeitemsfrom' => __('Start of the Feed')), array('takeitemsfromid' => 'end', 'takeitemsfrom' => __('End of the Feed')));
     Theme::Set('takeitemsfrom_field_list', $takeItemsFrom);
     // Set up the variables we already have
     Theme::Set('direction', $this->GetOption('direction'));
     Theme::Set('copyright', $this->GetOption('copyright'));
     Theme::Set('scrollSpeed', $this->GetOption('scrollSpeed'));
     Theme::Set('updateInterval', $this->GetOption('updateInterval'));
     Theme::Set('uri', urldecode($this->GetOption('uri')));
     Theme::Set('numItems', $this->GetOption('numItems'));
     Theme::Set('takeItemsFrom', $this->GetOption('takeItemsFrom'));
     Theme::Set('itemsPerPage', $this->GetOption('itemsPerPage'));
     Theme::Set('datasetid', $this->GetOption('datasetid'));
     // Checkboxes
     Theme::Set('fitTextChecked', $this->GetOption('fitText', 0) == 0 ? '' : ' checked');
     Theme::Set('itemsSideBySideChecked', $this->GetOption('itemsSideBySide', 0) == 0 ? '' : ' checked');
     Theme::Set('durationIsPerItemChecked', $this->GetOption('durationIsPerItem') == 1 ? ' checked' : '');
     // 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);
     Theme::Set('text', $textNode->nodeValue);
     // Get the CSS node
     $cssNodes = $rawXml->getElementsByTagName('css');
     if ($cssNodes->length > 0) {
         $cssNode = $cssNodes->item(0);
         Theme::Set('css', $cssNode->nodeValue);
     } else {
         Theme::Set('css', '');
     }
     // Duration
     Theme::Set('duration', $this->duration);
     Theme::Set('is_duration_enabled', $this->auth->modifyPermissions ? '' : ' readonly');
     // Output the form
     if ($sourceId == 2) {
         $this->response->html = Theme::RenderReturn('media_form_ticker_dataset_edit');
     } else {
         $this->response->html = Theme::RenderReturn('media_form_ticker_edit');
     }
     // Generate the Response
     $this->response->callBack = 'text_callback';
     $this->response->dialogTitle = __('Edit Ticker');
     $this->response->dialogClass = 'modal-big';
     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->AddButton(__('Save'), '$("#ModuleForm").submit()');
     return $this->response;
 }
Ejemplo n.º 23
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();
 }
Ejemplo n.º 24
0
 /**
  * Shows the Authorised applications this user has
  */
 public function UserTokens()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $store = OAuthStore::instance();
     try {
         $list = $store->listConsumerTokens(Kit::GetParam('userID', _GET, _INT));
     } catch (OAuthException $e) {
         trigger_error($e->getMessage());
         trigger_error(__('Error listing Log.'), E_USER_ERROR);
     }
     $rows = array();
     foreach ($list as $app) {
         $app['application_title'] = Kit::ValidateParam($app['application_title'], _STRING);
         $app['enabled'] = Kit::ValidateParam($app['enabled'], _STRING);
         $app['status'] = Kit::ValidateParam($app['status'], _STRING);
         $rows[] = $app;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('application_form_user_applications');
     $response->SetFormRequestResponse($output, __('Authorized applications for user'), '650', '450');
     $response->AddButton(__('Help'), "XiboHelpRender('" . HelpManager::Link('User', 'Applications') . "')");
     $response->AddButton(__('Close'), 'XiboDialogClose()');
     $response->Respond();
 }
Ejemplo n.º 25
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;
 }
Ejemplo n.º 26
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();
 }
Ejemplo n.º 27
0
 /**
  * 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();
 }
Ejemplo n.º 28
0
 public function MediaManagerGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $filterLayout = Kit::GetParam('filter_layout_name', _POST, _STRING);
     $filterRegion = Kit::GetParam('filter_region_name', _POST, _STRING);
     $filterMediaName = Kit::GetParam('filter_media_name', _POST, _STRING);
     $filterMediaType = Kit::GetParam('filter_type', _POST, _INT);
     setSession('mediamanager', 'filter_layout_name', $filterLayout);
     setSession('mediamanager', 'filter_region_name', $filterRegion);
     setSession('mediamanager', 'filter_media_name', $filterMediaName);
     setSession('mediamanager', 'filter_type', $filterMediaType);
     setSession('mediamanager', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     // Lookup the module name
     if ($filterMediaType != 0) {
         $module = $this->user->ModuleList(NULL, array('id' => $filterMediaType));
         if (count($module) > 0) {
             $filterMediaType = $module[0]['Name'];
             Debug::LogEntry('audit', 'Matched module type ' . $filterMediaType, get_class(), __FUNCTION__);
         }
     }
     $cols = array(array('name' => 'layout', 'title' => __('Layout'), 'colClass' => 'group-word'), array('name' => 'region', 'title' => __('Region')), array('name' => 'media', 'title' => __('Media')), array('name' => 'mediatype', 'title' => __('Type')), array('name' => 'seq', 'title' => __('Sequence')));
     Theme::Set('table_cols', $cols);
     // We would like a list of all layouts, media and media assignments that this user
     // has access to.
     $layouts = $user->LayoutList(NULL, array('layout' => $filterLayout));
     $rows = array();
     foreach ($layouts as $layout) {
         // We have edit permissions?
         if (!$layout['edit']) {
             continue;
         }
         // Every layout this user has access to.. get the regions
         $layoutXml = new DOMDocument();
         $layoutXml->loadXML($layout['xml']);
         // Get ever region
         $regionNodeList = $layoutXml->getElementsByTagName('region');
         $regionNodeSequence = 0;
         //get the regions
         foreach ($regionNodeList as $region) {
             $regionId = $region->getAttribute('id');
             $ownerId = $region->getAttribute('userId') == '' ? $layout['ownerid'] : $region->getAttribute('userId');
             $regionAuth = $user->RegionAssignmentAuth($ownerId, $layout['layoutid'], $regionId, true);
             // Do we have permission to edit?
             if (!$regionAuth->edit) {
                 continue;
             }
             $regionNodeSequence++;
             $regionName = $region->getAttribute('name') == '' ? 'Region ' . $regionNodeSequence : $region->getAttribute('name');
             if ($filterRegion != '' && !stristr($regionName, $filterRegion)) {
                 continue;
             }
             // Media
             $xpath = new DOMXPath($layoutXml);
             $mediaNodes = $xpath->query("//region[@id='{$regionId}']/media");
             $mediaNodeSequence = 0;
             foreach ($mediaNodes as $mediaNode) {
                 $mediaId = $mediaNode->getAttribute('id');
                 $lkId = $mediaNode->getAttribute('lkid');
                 $mediaOwnerId = $mediaNode->getAttribute('userId') == '' ? $layout['ownerid'] : $mediaNode->getAttribute('userId');
                 $mediaType = $mediaNode->getAttribute('type');
                 // Permissions
                 $auth = $user->MediaAssignmentAuth($mediaOwnerId, $layout['layoutid'], $regionId, $mediaId, true);
                 if (!$auth->edit) {
                     continue;
                 }
                 // Create the media object without any region and layout information
                 require_once 'modules/' . $mediaType . '.module.php';
                 $tmpModule = new $mediaType($db, $user, $mediaId, $layout['layoutid'], $regionId, $lkId);
                 $mediaName = $tmpModule->GetName();
                 if ($filterMediaName != '' && !stristr($mediaName, $filterMediaName)) {
                     continue;
                 }
                 if ($filterMediaType != '' && $mediaType != strtolower($filterMediaType)) {
                     continue;
                 }
                 $mediaNodeSequence++;
                 $layout['region'] = $regionName;
                 $layout['media'] = $mediaName;
                 $layout['mediatype'] = $mediaType;
                 $layout['seq'] = $mediaNodeSequence;
                 $layout['buttons'] = array();
                 // Edit
                 $layout['buttons'][] = array('id' => 'homepage_mediamanager_edit_button', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=EditForm&showRegionOptions=0&layoutid=' . $layout['layoutid'] . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId, 'text' => __('Edit'));
                 $rows[] = $layout;
             }
         }
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Ejemplo n.º 29
0
 /**
  * Show the library
  * @return 
  */
 function LayoutAssignView()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     //Input vars
     $name = Kit::GetParam('filter_name', _POST, _STRING);
     $tags = Kit::GetParam('filter_tags', _POST, _STRING);
     // Get a list of media
     $layoutList = $user->LayoutList(NULL, array('layout' => $name, 'tags' => $tags));
     $cols = array(array('name' => 'layout', 'title' => __('Name')));
     Theme::Set('table_cols', $cols);
     $rows = array();
     // Add some extra information
     foreach ($layoutList as $row) {
         $row['list_id'] = 'LayoutID_' . $row['layoutid'];
         $row['assign_icons'][] = array('assign_icons_class' => 'layout_assign_list_select');
         $row['dataAttributes'] = array(array('name' => 'rowid', 'value' => $row['list_id']), array('name' => 'litext', 'value' => $row['layout']));
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     // Render the Theme
     $response->SetGridResponse(Theme::RenderReturn('table_render'));
     $response->callBack = 'LayoutAssignCallback';
     $response->pageSize = 5;
     $response->Respond();
 }
Ejemplo n.º 30
0
 public function Step8()
 {
     PDOConnect::init();
     // Define the VERSION
     Config::Version();
     Theme::Set('form_action', 'index.php?q=login');
     Theme::Set('about_url', 'index.php?p=index&q=About');
     Theme::Set('source_url', Theme::SourceLink());
     // Message (either from the URL or the session)
     Theme::Set('login_message', sprintf(__("%s was successfully installed. Please log-in with the user details you chose earlier."), Theme::GetConfig('app_name')));
     Theme::Render('login_page');
     // Install files
     Media::installAllModuleFiles();
     // Delete install
     if (!unlink('install.php')) {
         throw new Exception(__("Unable to delete install.php. Please ensure the webserver has permission to unlink this file and retry"));
     }
     exit;
 }