Beispiel #1
0
 function displayPage()
 {
     $db =& $this->db;
     // Configure the theme
     $id = uniqid();
     Theme::Set('id', $id);
     Theme::Set('form_meta', '<input type="hidden" name="p" value="sessions"><input type="hidden" name="q" value="Grid">');
     Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter'));
     Theme::Set('pager', ResponseManager::Pager($id));
     // Construct Filter Form
     if (Kit::IsFilterPinned('sessions', 'Filter')) {
         $filter_pinned = 1;
         $filter_type = Session::Get('sessions', 'filter_type');
         $filter_fromdt = Session::Get('sessions', 'filter_fromdt');
     } else {
         $filter_pinned = 0;
         $filter_type = '0';
         $filter_fromdt = NULL;
     }
     $formFields = array();
     $formFields[] = FormManager::AddDatePicker('filter_fromdt', __('From Date'), $filter_fromdt, NULL, 't');
     $formFields[] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, array(array('typeid' => '0', 'type' => 'All'), array('typeid' => 'active', 'type' => 'Active'), array('typeid' => 'guest', 'type' => 'Guest'), array('typeid' => 'expired', 'type' => 'Expired')), 'typeid', 'type', NULL, 'd');
     $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k');
     // Call to render the template
     Theme::Set('header_text', __('Sessions'));
     Theme::Set('form_fields', $formFields);
     Theme::Render('grid_render');
 }
Beispiel #2
0
 /**
  * Return the Add Form as HTML
  * @return
  */
 public function AddForm()
 {
     $this->response = new ResponseManager();
     $db =& $this->db;
     $user =& $this->user;
     // Would like to get the regions width / height
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=AddMedia');
     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 . '" />');
     $formFields = array();
     $formFields[] = FormManager::AddCombo('datasetid', __('DataSet'), NULL, $user->DataSetList(), 'datasetid', 'dataset', __('Please select the DataSet to use as a source of data for this view.'), 'd');
     $formFields[] = FormManager::AddNumber('duration', __('Duration'), NULL, __('The duration in seconds this counter should be displayed'), 'd', 'required');
     Theme::Set('form_fields', $formFields);
     $this->response->SetFormRequestResponse(NULL, __('Add DataSet View'), '350px', '275px');
     // Cancel button
     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;
 }
 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 #4
0
 public function displayPage()
 {
     $db =& $this->db;
     // Configure the theme
     $id = uniqid();
     Theme::Set('id', 'LogGridForRefresh');
     Theme::Set('form_meta', '<input type="hidden" name="p" value="log"><input type="hidden" name="q" value="Grid">');
     Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter'));
     Theme::Set('pager', ResponseManager::Pager('LogGridForRefresh'));
     // Construct Filter Form
     if (Kit::IsFilterPinned('log', 'Filter')) {
         $filter_pinned = 1;
         $filter_type = Session::Get('log', 'filter_type');
         $filter_page = Session::Get('log', 'filter_page');
         $filter_function = Session::Get('log', 'filter_function');
         $filter_display = Session::Get('log', 'filter_display');
         $filter_fromdt = Session::Get('log', 'filter_fromdt');
         $filter_seconds = Session::Get('log', 'filter_seconds');
         $filter_intervalTypeId = Session::Get('log', 'filter_intervalTypeId');
     } else {
         $filter_pinned = 0;
         $filter_type = 0;
         $filter_page = NULL;
         $filter_function = NULL;
         $filter_display = 0;
         $filter_fromdt = NULL;
         $filter_seconds = 120;
         $filter_intervalTypeId = 1;
     }
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('advanced', __('Advanced'));
     $formFields = array();
     $formFields['general'][] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, array(array('typeid' => 0, 'type' => 'All'), array('typeid' => 2, 'type' => 'Audit'), array('typeid' => 1, 'type' => 'Error')), 'typeid', 'type', NULL, 't');
     $formFields['general'][] = FormManager::AddCombo('filter_intervalTypeId', __('Interval'), $filter_intervalTypeId, array(array('intervalTypeid' => 1, 'intervalType' => __('Seconds')), array('intervalTypeid' => 60, 'intervalType' => __('Minutes')), array('intervalTypeid' => 3600, 'intervalType' => __('Hours'))), 'intervalTypeid', 'intervalType', NULL, 'i');
     $formFields['general'][] = FormManager::AddText('filter_seconds', __('Duration back'), $filter_seconds, NULL, 's');
     $formFields['general'][] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k');
     // Advanced Tab
     $formFields['advanced'][] = FormManager::AddDatePicker('filter_fromdt', __('From Date'), $filter_fromdt, NULL, 't');
     $formFields['advanced'][] = FormManager::AddText('filter_page', __('Page'), $filter_page, NULL, 'p');
     $formFields['advanced'][] = FormManager::AddText('filter_function', __('Function'), $filter_function, NULL, 'f');
     // Display
     $displays = $this->user->DisplayList();
     array_unshift($displays, array('displayid' => 0, 'display' => 'All'));
     $formFields['advanced'][] = FormManager::AddCombo('filter_display', __('Display'), $filter_display, $displays, 'displayid', 'display', NULL, 't');
     // Call to render the template
     Theme::Set('header_text', __('Logs'));
     Theme::Set('form_tabs', $tabs);
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_advanced', $formFields['advanced']);
     Theme::Render('grid_render');
 }
Beispiel #5
0
 /**
  * Displays the page logic
  */
 function displayPage()
 {
     $db =& $this->db;
     // Default options
     if (Kit::IsFilterPinned('content', 'Filter')) {
         $filter_pinned = 1;
         $filter_name = Session::Get('content', 'filter_name');
         $filterId = Session::Get('content', 'fiterId');
         $filter_type = Session::Get('content', 'filter_type');
         $filter_retired = Session::Get('content', 'filter_retired');
         $filter_owner = Session::Get('content', 'filter_owner');
         $filter_duration_in_seconds = Session::Get('content', 'filter_duration_in_seconds');
         $showTags = Session::Get('content', 'showTags');
         $filter_showThumbnail = Session::Get('content', 'filter_showThumbnail');
     } else {
         $filter_pinned = 0;
         $filter_name = NULL;
         $filterId = NULL;
         $filter_type = NULL;
         $filter_retired = 0;
         $filter_owner = NULL;
         $filter_duration_in_seconds = 0;
         $filter_showThumbnail = 0;
         $showTags = 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="content"><input type="hidden" name="q" value="LibraryGrid">');
     $formFields = array();
     $formFields[] = FormManager::AddText('filter_name', __('Name'), $filter_name, NULL, 'n');
     $formFields[] = FormManager::AddText('filterId', __('ID'), $filterId, NULL, 'i');
     // Users we have permission to see
     $users = $this->user->userList();
     array_unshift($users, array('userid' => '', 'username' => 'All'));
     $formFields[] = FormManager::AddCombo('filter_owner', __('Owner'), $filter_owner, $users, 'userid', 'username', NULL, 'o');
     $types = $db->GetArray("SELECT Module AS moduleid, Name AS module FROM `module` WHERE RegionSpecific = 0 AND Enabled = 1 ORDER BY 2");
     array_unshift($types, array('moduleid' => '', 'module' => 'All'));
     $formFields[] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, $types, 'moduleid', 'module', NULL, 'y');
     $formFields[] = FormManager::AddCombo('filter_retired', __('Retired'), $filter_retired, array(array('retiredid' => 1, 'retired' => 'Yes'), array('retiredid' => 0, 'retired' => 'No')), 'retiredid', 'retired', NULL, 'r');
     $formFields[] = FormManager::AddCheckbox('filter_duration_in_seconds', __('Duration in Seconds'), $filter_duration_in_seconds, NULL, 's');
     $formFields[] = FormManager::AddCheckbox('showTags', __('Show Tags'), $showTags, NULL, 't');
     $formFields[] = FormManager::AddCheckbox('filter_showThumbnail', __('Show Thumbnails'), $filter_showThumbnail, NULL, 't');
     $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k');
     // Call to render the template
     Theme::Set('header_text', __('Library'));
     Theme::Set('form_fields', $formFields);
     Theme::Render('grid_render');
 }
 function AddForm()
 {
     // Show a form for adding a display profile.
     Theme::Set('form_id', 'ProfileForm');
     Theme::Set('form_action', 'index.php?p=displayprofile&q=Add');
     $formFields = array();
     $formFields[] = FormManager::AddText('name', __('Name'), NULL, __('The Name of the Profile - (1 - 50 characters)'), 'n', 'maxlength="50" required');
     $formFields[] = FormManager::AddCombo('type', __('Client Type'), NULL, array(array('typeid' => 'windows', 'type' => 'Windows'), array('typeid' => 'ubuntu', 'type' => 'Ubuntu'), array('typeid' => 'android', 'type' => 'Android')), 'typeid', 'type', __('What type of display client is this profile intended for?'), 't');
     $formFields[] = FormManager::AddCheckbox('isdefault', __('Default Profile?'), NULL, __('Is this the default profile for all Displays of this type? Only 1 profile can be the default.'), 'd');
     Theme::Set('form_fields', $formFields);
     $response = new ResponseManager();
     $response->SetFormRequestResponse(NULL, 'Add Profile', '350px', '275px');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#ProfileForm").submit()');
     $response->Respond();
 }
Beispiel #7
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 #8
0
 /**
  * Display the Resolution Page
  */
 function displayPage()
 {
     // Configure the theme
     $id = uniqid();
     Theme::Set('id', $id);
     Theme::Set('form_meta', '<input type="hidden" name="p" value="resolution"><input type="hidden" name="q" value="ResolutionGrid">');
     Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter'));
     Theme::Set('pager', ResponseManager::Pager($id));
     if (Kit::IsFilterPinned('resolution', 'ResolutionFilter')) {
         $pinned = 1;
         $enabled = Session::Get('resolution', 'filterEnabled');
     } else {
         $enabled = 1;
         $pinned = 0;
     }
     $formFields = array();
     $formFields[] = FormManager::AddCombo('filterEnabled', __('Enabled'), $enabled, array(array('enabledid' => 1, 'enabled' => 'Yes'), array('enabledid' => 0, 'enabled' => 'No')), 'enabledid', 'enabled', NULL, 'e');
     $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $pinned, NULL, 'k');
     // Call to render the template
     Theme::Set('header_text', __('Resolutions'));
     Theme::Set('form_fields', $formFields);
     Theme::Render('grid_render');
 }
Beispiel #9
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 #10
0
 /**
  * Sets the users home page
  * @return
  */
 function SetUserHomepageForm()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $userid = Kit::GetParam('userid', _GET, _INT);
     // Set some information about the form
     Theme::Set('form_id', 'SetUserHomePageForm');
     Theme::Set('form_action', 'index.php?p=user&q=SetUserHomepage');
     Theme::Set('form_meta', '<input type="hidden" name="userid" value="' . $userid . '" />');
     // Render the return and output
     $formFields = array();
     $formFields[] = FormManager::AddCombo('homepage', __('Homepage'), $this->user->GetHomePage($userid), array(array("homepageid" => "dashboard", 'homepage' => 'Icon Dashboard'), array("homepageid" => "mediamanager", 'homepage' => 'Media Dashboard'), array("homepageid" => "statusdashboard", 'homepage' => 'Status Dashboard')), 'homepageid', 'homepage', __('The users Homepage. This should not be changed until you want to reset their homepage.'), 'h');
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Set the homepage for this user'), '350px', '150px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('User', 'SetHomepage') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#SetUserHomePageForm").submit()');
     $response->Respond();
 }
Beispiel #11
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 #12
0
 public function EditDataSetColumnForm()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $helpManager = new HelpManager($db, $this->user);
     $dataSetId = Kit::GetParam('datasetid', _GET, _INT);
     $dataSetColumnId = Kit::GetParam('datasetcolumnid', _GET, _INT);
     $dataSet = Kit::GetParam('dataset', _GET, _STRING);
     $auth = $this->user->DataSetAuth($dataSetId, true);
     if (!$auth->edit) {
         trigger_error(__('Access Denied'));
     }
     // Set some information about the form
     Theme::Set('form_id', 'DataSetColumnEditForm');
     Theme::Set('form_action', 'index.php?p=dataset&q=EditDataSetColumn');
     Theme::Set('form_meta', '<input type="hidden" name="dataset" value="' . $dataSet . '" /><input type="hidden" name="datasetid" value="' . $dataSetId . '" /><input type="hidden" name="datasetcolumnid" value="' . $dataSetColumnId . '" />');
     // Get some information about this data set column
     $SQL = sprintf("SELECT Heading, ListContent, ColumnOrder, DataTypeID, DataSetColumnTypeID, Formula FROM datasetcolumn WHERE DataSetColumnID = %d", $dataSetColumnId);
     if (!($row = $db->GetSingleRow($SQL))) {
         trigger_error(__('Unabled to get Data Column information'), E_USER_ERROR);
     }
     // Dropdown list for DataType and DataColumnType
     Theme::Set('datatype_field_list', $db->GetArray('SELECT datatypeid, datatype FROM datatype'));
     Theme::Set('datasetcolumntype_field_list', $db->GetArray('SELECT datasetcolumntypeid, datasetcolumntype FROM datasetcolumntype'));
     $formFields = array();
     $formFields[] = FormManager::AddText('heading', __('Heading'), Kit::ValidateParam($row['Heading'], _STRING), __('The heading for this Column'), 'h', 'required');
     $formFields[] = FormManager::AddCombo('datasetcolumntypeid', __('Column Type'), Kit::ValidateParam($row['DataSetColumnTypeID'], _INT), $db->GetArray('SELECT datasetcolumntypeid, datasetcolumntype FROM datasetcolumntype'), 'datasetcolumntypeid', 'datasetcolumntype', __('Whether this column is a value or a formula'), 't');
     $formFields[] = FormManager::AddCombo('datatypeid', __('Data Type'), Kit::ValidateParam($row['DataTypeID'], _INT), $db->GetArray('SELECT datatypeid, datatype FROM datatype'), 'datatypeid', 'datatype', __('The DataType of the Intended Data'), 'd');
     $formFields[] = FormManager::AddText('listcontent', __('List Content'), Kit::ValidateParam($row['ListContent'], _STRING), __('A comma separated list of items to present in a combo box'), 'l', '');
     $formFields[] = FormManager::AddNumber('columnorder', __('Column Order'), Kit::ValidateParam($row['ColumnOrder'], _INT), __('The order this column should be displayed in when entering data'), 'o', '');
     $formFields[] = FormManager::AddText('formula', __('Formula'), Kit::ValidateParam($row['Formula'], _STRING), __('A formula to use as a calculation for formula column types'), 'f', '');
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Edit Column'), '350px', '200px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('DataSet', 'EditColumn') . '")');
     $response->AddButton(__('Cancel'), 'XiboFormRender("index.php?p=dataset&q=DataSetColumnsForm&datasetid=' . $dataSetId . '&dataset=' . $dataSet . '")');
     $response->AddButton(__('Save'), '$("#DataSetColumnEditForm").submit()');
     $response->Respond();
 }
Beispiel #13
0
 public function OutputCsvForm()
 {
     $response = new ResponseManager();
     Theme::Set('form_id', 'OutputCsvForm');
     Theme::Set('form_action', 'index.php?p=stats&q=OutputCSV');
     $formFields = array();
     $formFields[] = FormManager::AddText('fromdt', __('From Date'), DateManager::getLocalDate(time() - 86400 * 35, 'Y-m-d'), NULL, 'f');
     $formFields[] = FormManager::AddText('todt', __('To Date'), DateManager::getLocalDate(null, 'Y-m-d'), NULL, 't');
     // List of Displays this user has permission for
     $displays = $this->user->DisplayGroupList(1);
     array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
     $formFields[] = FormManager::AddCombo('displayid', __('Display'), NULL, $displays, 'displayid', 'displaygroup', NULL, 'd');
     Theme::Set('header_text', __('Bandwidth'));
     Theme::Set('form_fields', $formFields);
     Theme::Set('form_class', 'XiboManualSubmit');
     $response->SetFormRequestResponse(NULL, __('Export Statistics'), '550px', '275px');
     $response->AddButton(__('Export'), '$("#OutputCsvForm").submit()');
     $response->AddButton(__('Close'), 'XiboDialogClose()');
     $response->Respond();
 }
Beispiel #14
0
 function ManualRegionPositionForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $regionid = Kit::GetParam('regionid', _GET, _STRING);
     $layoutid = Kit::GetParam('layoutid', _GET, _INT);
     $scale = Kit::GetParam('scale', _GET, _DOUBLE);
     $zoom = Kit::GetParam('zoom', _GET, _DOUBLE);
     // Load the region and get the dimensions, applying the scale factor if necessary (only v1 layouts will have a scale factor != 1)
     $region = new region($db);
     $regionNode = $region->getRegion($layoutid, $regionid);
     $top = round($regionNode->getAttribute('top') * $scale, 0);
     $left = round($regionNode->getAttribute('left') * $scale, 0);
     $width = round($regionNode->getAttribute('width') * $scale, 0);
     $height = round($regionNode->getAttribute('height') * $scale, 0);
     $zindex = $regionNode->getAttribute('zindex');
     $ownerId = $region->GetOwnerId($layoutid, $regionid);
     $regionName = $regionNode->getAttribute('name');
     $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutid, $regionid, true);
     if (!$regionAuth->edit) {
         trigger_error(__('You do not have permissions to edit this region'), E_USER_ERROR);
     }
     // Set some information about the form
     Theme::Set('form_id', 'RegionProperties');
     Theme::Set('form_action', 'index.php?p=timeline&q=ManualRegionPosition');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" name="regionid" value="' . $regionid . '"><input type="hidden" name="scale" value="' . $scale . '"><input type="hidden" name="zoom" value="' . $zoom . '">');
     $formFields = array();
     $formFields[] = FormManager::AddText('name', __('Name'), $regionName, __('Name of the Region'), 'n', 'maxlength="50"');
     $formFields[] = FormManager::AddNumber('top', __('Top'), $top, __('Offset from the Top Corner'), 't');
     $formFields[] = FormManager::AddNumber('left', __('Left'), $left, __('Offset from the Left Corner'), 'l');
     $formFields[] = FormManager::AddNumber('width', __('Width'), $width, __('Width of the Region'), 'w');
     $formFields[] = FormManager::AddNumber('height', __('Height'), $height, __('Height of the Region'), 'h');
     // Transitions
     if (count($this->user->TransitionAuth('out')) > 0) {
         // Add none to the list
         $transitions = $this->user->TransitionAuth('out');
         $transitions[] = array('code' => '', 'transition' => 'None', 'class' => '');
         $formFields[] = FormManager::AddCombo('transitionType', __('Exit Transition'), $region->GetOption($layoutid, $regionid, 'transOut', ''), $transitions, 'code', 'transition', __('What transition should be applied when this region is finished?'), 't');
         $formFields[] = FormManager::AddNumber('transitionDuration', __('Duration'), $region->GetOption($layoutid, $regionid, 'transOutDuration', 0), __('The duration for this transition, in milliseconds.'), 'l', '', 'transition-group');
         // 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')));
         $formFields[] = FormManager::AddCombo('transitionDirection', __('Direction'), $region->GetOption($layoutid, $regionid, 'transOutDirection', ''), $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
         $response->AddFieldAction('transitionType', 'init', '', array('.transition-group' => array('display' => 'none')));
         $response->AddFieldAction('transitionType', 'init', '', array('.transition-group' => array('display' => 'block')), 'not');
         $response->AddFieldAction('transitionType', 'change', '', array('.transition-group' => array('display' => 'none')));
         $response->AddFieldAction('transitionType', 'change', '', array('.transition-group' => array('display' => 'block')), 'not');
     }
     $formFields[] = FormManager::AddCheckbox('loop', __('Loop?'), $region->GetOption($layoutid, $regionid, 'loop', 0), __('If there is only one item in this region should it loop? Not currently available for Windows Players.'), 'l');
     $formFields[] = FormManager::AddNumber('zindex', __('Layer'), $zindex == 0 ? NULL : $zindex, __('The layering order of this region (z-index). Advanced use only. '), 'z');
     Theme::Set('form_fields', $formFields);
     // Add some information about the whole layout to this request.
     $layout = new Layout();
     $layoutInformation = $layout->LayoutInformation($layoutid);
     $response->extra['layoutInformation'] = array('width' => $layoutInformation['width'], 'height' => $layoutInformation['height']);
     $response->SetFormRequestResponse(NULL, __('Region Options'), '350px', '275px');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#RegionProperties").submit()');
     $response->AddButton(__('Set Full Screen'), 'setFullScreenLayout()');
     $response->Respond();
 }
Beispiel #15
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('uri', __('Link'), urldecode($this->GetOption('uri')), __('The Location (URL) of the webpage'), 'l', 'required');
     $formFields[] = FormManager::AddText('name', __('Name'), $this->GetOption('name'), __('An optional name for this media'), 'n');
     $formFields[] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed'), 'd', 'required', '', $this->auth->modifyPermissions);
     $formFields[] = FormManager::AddCombo('modeid', __('Options'), $this->GetOption('modeid'), array(array('modeid' => '1', 'mode' => __('Open Natively')), array('modeid' => '2', 'mode' => __('Manual Position')), array('modeid' => '3', 'mode' => __('Best Fit'))), 'modeid', 'mode', __('How should this web page be embedded?'), 'm');
     $formFields[] = FormManager::AddNumber('pageWidth', __('Page Width'), $this->GetOption('pageWidth'), __('The width of the page. Leave empty to use the region width.'), 'w', NULL, 'webpage-widths');
     $formFields[] = FormManager::AddNumber('pageHeight', __('Page Height'), $this->GetOption('pageHeight'), __('The height of the page. Leave empty to use the region height'), 'h', NULL, 'webpage-widths');
     $formFields[] = FormManager::AddNumber('offsetTop', __('Offset Top'), $this->GetOption('offsetTop'), __('The starting point from the top in pixels'), 't', NULL, 'webpage-offsets');
     $formFields[] = FormManager::AddNumber('offsetLeft', __('Offset Left'), $this->GetOption('offsetLeft'), __('The starting point from the left in pixels'), 'l', NULL, 'webpage-offsets');
     $formFields[] = FormManager::AddNumber('scaling', __('Scale Percentage'), $this->GetOption('scaling'), __('The Percentage to Scale this Webpage (0 - 100)'), 's', NULL, 'webpage-offsets');
     $formFields[] = FormManager::AddCheckbox('transparency', __('Background transparent?'), $this->GetOption('transparency'), __('Should the HTML be shown with a transparent background. Not currently available on the Windows Display Client.'), 't');
     // Field dependencies
     $modeFieldDepencies_1 = array('.webpage-widths' => array('display' => 'none'), '.webpage-offsets' => array('display' => 'none'));
     $modeFieldDepencies_2 = array('.webpage-widths' => array('display' => 'block'), '.webpage-offsets' => array('display' => 'block'));
     $modeFieldDepencies_3 = array('.webpage-widths' => array('display' => 'block'), '.webpage-offsets' => array('display' => 'none'));
     $this->response->AddFieldAction('modeid', 'init', 1, $modeFieldDepencies_1);
     $this->response->AddFieldAction('modeid', 'change', 1, $modeFieldDepencies_1);
     $this->response->AddFieldAction('modeid', 'init', 2, $modeFieldDepencies_2);
     $this->response->AddFieldAction('modeid', 'change', 2, $modeFieldDepencies_2);
     $this->response->AddFieldAction('modeid', 'init', 3, $modeFieldDepencies_3);
     $this->response->AddFieldAction('modeid', 'change', 3, $modeFieldDepencies_3);
     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(__('Apply'), 'XiboDialogApply("#ModuleForm")');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     $this->response->dialogTitle = __('Edit Webpage');
     $this->response->dialogSize = true;
     $this->response->dialogWidth = '450px';
     $this->response->dialogHeight = '250px';
     return $this->response;
 }
Beispiel #16
0
 function EditForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $layoutId = Kit::GetParam('layoutid', _GET, _INT);
     // Get the layout
     $layout = $user->LayoutList(NULL, array('layoutId' => Kit::GetParam('layoutid', _GET, _INT), 'excludeTemplates' => 0));
     if (count($layout) <= 0) {
         trigger_error(__('Unable to find Template'), E_USER_ERROR);
     }
     $layout = $layout[0];
     Theme::Set('form_id', 'TemplateEditForm');
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('description', __('Description'));
     Theme::Set('form_tabs', $tabs);
     $formFields = array();
     $formFields['general'][] = FormManager::AddText('layout', __('Name'), $layout['layout'], __('The Name of the Layout - (1 - 50 characters)'), 'n', 'required');
     $formFields['description'][] = FormManager::AddMultiText('description', __('Description'), $layout['description'], __('An optional description of the Layout. (1 - 250 characters)'), 'd', 5, 'maxlength="250"');
     // We are editing
     Theme::Set('form_action', 'index.php?p=template&q=Edit');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutId . '">');
     $formFields['general'][] = FormManager::AddCombo('retired', __('Retired'), $layout['retired'], array(array('retiredid' => '1', 'retired' => 'Yes'), array('retiredid' => '0', 'retired' => 'No')), 'retiredid', 'retired', __('Retire this template or not? It will no longer be visible in lists'), 'r');
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_description', $formFields['description']);
     // Initialise the template and capture the output
     $form = Theme::RenderReturn('form_render');
     $response->SetFormRequestResponse($form, __('Edit Template'), '350px', '275px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Template', 'Edit') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#TemplateEditForm").submit()');
     $response->Respond();
 }
Beispiel #17
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;
     }
     // Augment settings with templates
     $this->loadTemplates();
     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();
     // What is the source for this ticker?
     $sourceId = $this->GetOption('sourceId');
     $dataSetId = $this->GetOption('datasetid');
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('template', __('Appearance'), array(array('name' => 'enlarge', 'value' => true)));
     $tabs[] = FormManager::AddTab('format', __('Format'));
     $tabs[] = FormManager::AddTab('advanced', __('Advanced'));
     Theme::Set('form_tabs', $tabs);
     $field_name = FormManager::AddText('name', __('Name'), $this->GetOption('name'), __('An optional name for this media'), 'n');
     $field_duration = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed'), 'd', 'required', '', $this->auth->modifyPermissions);
     // Common fields
     $oldDirection = $this->GetOption('direction');
     if ($oldDirection == 'single') {
         $oldDirection = 'fade';
     } else {
         if ($oldDirection != 'none') {
             $oldDirection = 'marquee' . ucfirst($oldDirection);
         }
     }
     $fieldFx = FormManager::AddCombo('effect', __('Effect'), $this->GetOption('effect', $oldDirection), 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');
     $fieldScrollSpeed = FormManager::AddNumber('speed', __('Speed'), $this->GetOption('speed', $this->GetOption('scrollSpeed')), __('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');
     $fieldBackgroundColor = 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_itemsPerPage = FormManager::AddNumber('itemsPerPage', __('Items per page'), $this->GetOption('itemsPerPage'), __('When in single mode how many items per page should be shown.'), 'p');
     $field_updateInterval = FormManager::AddNumber('updateInterval', __('Update Interval (mins)'), $this->GetOption('updateInterval', 5), __('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');
     $field_durationIsPerItem = FormManager::AddCheckbox('durationIsPerItem', __('Duration is per item'), $this->GetOption('durationIsPerItem'), __('The duration specified is per item otherwise it is per feed.'), 'i');
     $field_itemsSideBySide = FormManager::AddCheckbox('itemsSideBySide', __('Show items side by side?'), $this->GetOption('itemsSideBySide'), __('Should items be shown side by side?'), 's');
     // Data Set Source
     if ($sourceId == 2) {
         $formFields['general'][] = $field_name;
         $formFields['general'][] = $field_duration;
         $formFields['general'][] = $fieldFx;
         $formFields['general'][] = $fieldScrollSpeed;
         $formFields['advanced'][] = $fieldBackgroundColor;
         $formFields['advanced'][] = $field_durationIsPerItem;
         $formFields['advanced'][] = $field_updateInterval;
         // Extra Fields for the DataSet
         $formFields['general'][] = FormManager::AddText('ordering', __('Order'), $this->GetOption('ordering'), __('Please enter a SQL clause for how this dataset should be ordered'), 'o');
         $formFields['general'][] = FormManager::AddText('filter', __('Filter'), $this->GetOption('filter'), __('Please enter a SQL clause to filter this DataSet.'), 'f');
         $formFields['advanced'][] = FormManager::AddNumber('lowerLimit', __('Lower Row Limit'), $this->GetOption('lowerLimit'), __('Please enter the Lower Row Limit for this DataSet (enter 0 for no limit)'), 'l');
         $formFields['advanced'][] = FormManager::AddNumber('upperLimit', __('Upper Row Limit'), $this->GetOption('upperLimit'), __('Please enter the Upper Row Limit for this DataSet (enter 0 for no limit)'), 'u');
         $formFields['format'][] = $field_itemsPerPage;
         $formFields['format'][] = $field_itemsSideBySide;
         Theme::Set('columns', $db->GetArray(sprintf("SELECT DataSetColumnID, Heading FROM datasetcolumn WHERE DataSetID = %d ", $dataSetId)));
         $formFields['template'][] = FormManager::AddRaw(Theme::RenderReturn('media_form_ticker_dataset_edit'));
     } else {
         // Extra Fields for the Ticker
         $formFields['general'][] = FormManager::AddText('uri', __('Feed URL'), urldecode($this->GetOption('uri')), __('The Link for the RSS feed'), 'f');
         $formFields['general'][] = $field_name;
         $formFields['general'][] = $field_duration;
         $formFields['general'][] = $fieldFx;
         $formFields['format'][] = $fieldScrollSpeed;
         // Add a field for RTL tickers
         $formFields['format'][] = FormManager::AddCombo('textDirection', __('Text direction'), $this->GetOption('textDirection'), array(array('textdirectionid' => 'ltr', 'textdirection' => __('Left to Right (LTR)')), array('textdirectionid' => 'rtl', 'textdirection' => __('Right to Left (RTL)'))), 'textdirectionid', 'textdirection', __('Which direction does the text in the feed use? (left to right or right to left)'), 'd');
         $formFields['advanced'][] = $fieldBackgroundColor;
         $formFields['format'][] = FormManager::AddNumber('numItems', __('Number of Items'), $this->GetOption('numItems'), __('The Number of RSS items you want to display'), 'o');
         $formFields['format'][] = $field_itemsPerPage;
         $formFields['advanced'][] = FormManager::AddText('copyright', __('Copyright'), $this->GetOption('copyright'), __('Copyright information to display as the last item in this feed. This can be styled with the #copyright CSS selector.'), 'f');
         $formFields['advanced'][] = $field_updateInterval;
         $formFields['format'][] = FormManager::AddCombo('takeItemsFrom', __('Take items from the '), $this->GetOption('takeItemsFrom'), array(array('takeitemsfromid' => 'start', 'takeitemsfrom' => __('Start of the Feed')), array('takeitemsfromid' => 'end', 'takeitemsfrom' => __('End of the Feed'))), 'takeitemsfromid', 'takeitemsfrom', __('Take the items from the beginning or the end of the list'), 't');
         $formFields['format'][] = $field_durationIsPerItem;
         $formFields['advanced'][] = $field_itemsSideBySide;
         $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');
         $subs = array(array('Substitute' => 'Name'), array('Substitute' => 'Title'), array('Substitute' => 'Description'), array('Substitute' => 'Date'), array('Substitute' => 'Content'), array('Substitute' => 'Copyright'), array('Substitute' => 'Link'), array('Substitute' => 'PermaLink'), array('Substitute' => 'Tag|Namespace'));
         Theme::Set('substitutions', $subs);
         $formFieldSubs = FormManager::AddRaw(Theme::RenderReturn('media_form_ticker_edit'));
         $formFields['advanced'][] = FormManager::AddText('allowedAttributes', __('Allowable Attributes'), $this->GetOption('allowedAttributes'), __('A comma separated list of attributes that should not be stripped from the incoming feed.'), '');
         $formFields['advanced'][] = FormManager::AddText('stripTags', __('Strip Tags'), $this->GetOption('stripTags'), __('A comma separated list of HTML tags that should be stripped from the feed in addition to the default ones.'), '');
         $formFields['advanced'][] = FormManager::AddCheckbox('disableDateSort', __('Disable Date Sort'), $this->GetOption('disableDateSort'), __('Should the date sort applied to the feed be disabled?'), '');
         // Encode up the template
         //$formFields['advanced'][] = FormManager::AddMessage('<pre>' . htmlentities(json_encode(array('id' => 'media-rss-with-title', 'value' => 'Image overlaid with the Title', 'template' => '<div class="image">[Link|image]<div class="cycle-overlay"><p style="font-family: Arial, Verdana, sans-serif; font-size:48px;">[Title]</p></div></div>', 'css' => '.image img { width:100%;}.cycle-overlay {color: white;background: black;opacity: .6;filter: alpha(opacity=60);position: absolute;bottom: 0;width: 100%;padding: 15px;text-align:center;}'))) . '</pre>');
     }
     // Get the CSS node
     $formFields['template'][] = FormManager::AddMultiText('ta_css', NULL, $this->GetRawNode('css'), __('Optional Style sheet'), 's', 10, NULL, 'template-override-controls');
     // Get the Text Node out of this
     $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');
     // RSS
     if ($this->GetOption('sourceId') == 1) {
         // Append the templates to the response
         $this->response->extra = $this->settings['templates'];
         $formFields['template'][] = $formFieldSubs;
         // 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', 1), __('Tick if you would like to override the template.'), 'o');
         // Template - for standard stuff
         $formFields['template'][] = FormManager::AddCombo('templateId', __('Template'), $this->GetOption('templateId', 'title-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 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');
     }
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_template', array_reverse($formFields['template']));
     Theme::Set('form_fields_format', $formFields['format']);
     Theme::Set('form_fields_advanced', $formFields['advanced']);
     // Generate the Response
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->callBack = 'text_callback';
     $this->response->dialogTitle = __('Edit Ticker');
     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(__('Apply'), 'XiboDialogApply("#ModuleForm")');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     return $this->response;
 }
Beispiel #18
0
 /**
  * Generates a form for the background edit
  */
 function BackgroundForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Permission to retire?
     if (!$this->auth->edit) {
         trigger_error(__('You do not have permissions to edit this layout'), E_USER_ERROR);
     }
     // Load the XML into a SimpleXML OBJECT
     $xml = simplexml_load_string($this->xml);
     $backgroundImage = (string) $xml['background'];
     $backgroundColor = (string) $xml['bgcolor'];
     $width = (string) $xml['width'];
     $height = (string) $xml['height'];
     $resolutionid = (int) $xml['resolutionid'];
     $zindex = (int) $xml['zindex'];
     $bgImageId = 0;
     // Do we need to override the background with one passed in?
     $bgOveride = Kit::GetParam('backgroundOveride', _GET, _STRING);
     if ($bgOveride != '') {
         $backgroundImage = $bgOveride;
     }
     // Manipulate the images slightly
     if ($backgroundImage != '') {
         // Get the ID for the background image
         $bgImageInfo = explode('.', $backgroundImage);
         $bgImageId = $bgImageInfo[0];
         $thumbBgImage = "index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid={$bgImageId}&width=200&height=200&dynamic";
     } else {
         $thumbBgImage = "theme/default/img/forms/filenotfound.gif";
     }
     // Configure some template variables.
     Theme::Set('form_id', 'LayoutBackgroundForm');
     Theme::Set('form_action', 'index.php?p=layout&q=EditBackground');
     Theme::Set('form_meta', '<input type="hidden" id="layoutid" name="layoutid" value="' . $this->layoutid . '">');
     // Get the ID of the current resolution
     if ($resolutionid == 0) {
         $SQL = sprintf("SELECT resolutionID FROM resolution WHERE width = %d AND height = %d", $width, $height);
         if (!($resolutionid = $db->GetSingleValue($SQL, 'resolutionID', _INT))) {
             trigger_error($db->error());
             trigger_error(__("Unable to get the Resolution information"), E_USER_ERROR);
         }
     }
     // Begin the form output
     $formFields = array();
     // A list of web safe colours
     $formFields[] = FormManager::AddText('bg_color', __('Background Colour'), $backgroundColor, __('Use the colour picker to select the background colour'), 'c', 'required');
     // A list of available backgrounds
     $backgrounds = $user->MediaList(NULL, array('type' => 'image'));
     array_unshift($backgrounds, array('mediaid' => '0', 'media' => 'None'));
     $formFields[] = FormManager::AddCombo('bg_image', __('Background Image'), $bgImageId, $backgrounds, 'mediaid', 'media', __('Select the background image from the library'), 'b', '', true, 'onchange="background_button_callback()"');
     $formFields[] = FormManager::AddCombo('resolutionid', __('Resolution'), $resolutionid, $user->ResolutionList(NULL, array('withCurrent' => $resolutionid)), 'resolutionid', 'resolution', __('Change the resolution'), 'r');
     $formFields[] = FormManager::AddNumber('zindex', __('Layer'), $zindex == 0 ? '' : $zindex, __('The layering order of this region (z-index). Advanced use only. '), 'z');
     Theme::Set('append', '<img id="bg_image_image" src="' . $thumbBgImage . '" alt="' . __('Background thumbnail') . '" />');
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Change the Background Properties'), '550px', '240px');
     $response->callBack = 'backGroundFormSetup';
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Layout', 'Background') . '")');
     $response->AddButton(__('Add Image'), 'XiboFormRender("index.php?p=module&q=Exec&mod=image&method=AddForm&backgroundImage=true&layoutid=' . $this->layoutid . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#LayoutBackgroundForm").submit()');
     $response->Respond();
 }
Beispiel #19
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;
     }
     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 . '">');
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'), array(array('name' => 'enlarge', 'value' => true)));
     $tabs[] = FormManager::AddTab('options', __('Options'));
     Theme::Set('form_tabs', $tabs);
     $formFields = array();
     // Handle older layouts that have a direction node but no effect node
     $oldDirection = $this->GetOption('direction', 'none');
     if ($oldDirection != 'none') {
         $oldDirection = 'marquee' . ucfirst($oldDirection);
     }
     $formFields['options'][] = FormManager::AddText('name', __('Name'), $this->GetOption('name'), __('An optional name for this media'), 'n');
     $formFields['options'][] = FormManager::AddCombo('effect', __('Effect'), $this->GetOption('effect', $oldDirection), 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['options'][] = 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['options'][] = FormManager::AddText('backgroundColor', __('Background Colour'), $this->GetOption('backgroundColor'), __('The selected effect works best with a background colour. Optionally add one here.'), 'c', NULL, 'effect-controls');
     $formFields['options'][] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this counter should be displayed'), 'd', 'required', '', $this->auth->modifyPermissions);
     // Handle the substitutions as RAW items
     $subs = array(array('Substitute' => 'Clock'), array('Substitute' => 'Clock|HH:mm'), array('Substitute' => 'Date'), array('Substitute' => 'Clock|DD/MM/YYYY'));
     Theme::Set('substitutions', $subs);
     // Get the text out of RAW
     $rawXml = new DOMDocument();
     $rawXml->loadXML($this->GetRaw());
     // Get the Text Node out of this
     $textNodes = $rawXml->getElementsByTagName('text');
     $textNode = $textNodes->item(0);
     $formFields['general'][] = FormManager::AddMultiText('ta_text', NULL, $textNode->nodeValue, __('Enter the text to display. Please note that the background colour has automatically coloured to your layout background colour.'), 't', 10);
     $formFields['general'][] = FormManager::AddRaw(Theme::RenderReturn('media_form_text_edit'));
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_options', $formFields['options']);
     // Add a dependency
     $this->response->AddFieldAction('effect', 'init', 'none', array('.effect-controls' => array('display' => 'none')));
     $this->response->AddFieldAction('effect', 'change', 'none', array('.effect-controls' => array('display' => 'none')));
     $this->response->AddFieldAction('effect', 'init', 'none', array('.effect-controls' => array('display' => 'block')), 'not');
     $this->response->AddFieldAction('effect', 'change', 'none', array('.effect-controls' => array('display' => 'block')), 'not');
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->callBack = 'text_callback';
     $this->response->dialogSize = 'large';
     $this->response->dialogTitle = __('Edit Text');
     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(__('Apply'), 'XiboDialogApply("#ModuleForm")');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     return $this->response;
 }
Beispiel #20
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     // Edit calls are the same as add calls, except you will to check the user has permissions to do the edit
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this assignment.');
         $this->response->keepOpen = false;
         return $this->response;
     }
     // 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 . '">');
     // Extract the format from the raw node in the XLF
     $rawXml = new DOMDocument();
     $rawXml->loadXML($this->GetRaw());
     $formatNodes = $rawXml->getElementsByTagName('format');
     $formatNode = $formatNodes->item(0);
     $formFields = array();
     // Offer a choice of clock type
     $formFields[] = FormManager::AddCombo('clockTypeId', __('Clock Type'), $this->GetOption('clockTypeId'), array(array('clockTypeId' => '1', 'clockType' => 'Analogue'), array('clockTypeId' => '2', 'clockType' => 'Digital'), array('clockTypeId' => '3', 'clockType' => 'Flip Clock')), 'clockTypeId', 'clockType', __('Please select the type of clock to display.'), 'c');
     $formFields[] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed'), 'd', 'required');
     $formFields[] = FormManager::AddNumber('offset', __('Offset'), $this->GetOption('offset'), __('The offset in minutes that should be applied to the current time.'), 'o', NULL, 'offset-control-group');
     // Offer a choice of theme
     $formFields[] = FormManager::AddCombo('themeid', __('Theme'), $this->GetOption('theme'), array(array('themeid' => '1', 'theme' => 'Light'), array('themeid' => '2', 'theme' => 'Dark')), 'themeid', 'theme', __('Please select a theme for the clock.'), 't', 'analogue-control-group');
     $formFields[] = FormManager::AddMessage(sprintf(__('Enter a format for the Digital Clock below. e.g. [HH:mm] or [DD/MM/YYYY]. See the <a href="%s" target="_blank">format guide</a> for more information.'), HelpManager::Link('Widget', 'ClockFormat')), 'digital-control-group');
     $formFields[] = FormManager::AddMultiText('ta_text', NULL, $formatNode != NULL ? $formatNode->nodeValue : '', __('Enter a format for the clock'), 'f', 10, '', 'digital-control-group');
     Theme::Set('form_fields', $formFields);
     // Dependencies (some fields should be shown / hidden)
     $this->SetFieldDependencies();
     // Modules should be rendered using the theme engine.
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->dialogTitle = __('Edit Clock');
     $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).
     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()');
     }
     $this->response->AddButton(__('Apply'), 'XiboDialogApply("#ModuleForm")');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     // The response must be returned.
     return $this->response;
 }
Beispiel #21
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     // Edit calls are the same as add calls, except you will to check the user has permissions to do the edit
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this assignment.');
         $this->response->keepOpen = false;
         return $this->response;
     }
     // 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 . '">');
     // Augment settings with templates
     $this->loadTemplates();
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('advanced', __('Appearance'));
     $tabs[] = FormManager::AddTab('forecast', __('Forecast'));
     Theme::Set('form_tabs', $tabs);
     $formFields['general'][] = FormManager::AddText('name', __('Name'), $this->GetOption('name'), __('An optional name for this media'), 'n');
     $formFields['general'][] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed.'), 'd', 'required');
     $formFields['general'][] = FormManager::AddCheckbox('useDisplayLocation', __('Use the Display Location'), $this->GetOption('useDisplayLocation'), __('Use the location configured on the display'), 'd');
     // Any values for the form fields should be added to the theme here.
     $formFields['general'][] = FormManager::AddNumber('latitude', __('Latitude'), $this->GetOption('latitude'), __('The Latitude for this weather module'), 'l', '', 'locationControls');
     $formFields['general'][] = FormManager::AddNumber('longitude', __('Longitude'), $this->GetOption('longitude'), __('The Longitude for this weather module'), 'g', '', 'locationControls');
     $formFields['advanced'][] = FormManager::AddCombo('templateId', __('Weather Template'), $this->GetOption('templateId'), $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');
     $formFields['advanced'][] = FormManager::AddCombo('icons', __('Icons'), $this->GetOption('icons'), $this->iconsAvailable(), 'id', 'value', __('Select the icon set you would like to use.'), 't', 'icon-controls');
     $formFields['advanced'][] = FormManager::AddNumber('size', __('Size'), $this->GetOption('size', 1), __('Set the size. Start at 1 and work up until the widget fits your region appropriately.'), 's', 'number', 'template-selector-control');
     $formFields['advanced'][] = FormManager::AddCombo('units', __('Units'), $this->GetOption('units'), $this->unitsAvailable(), 'id', 'value', __('Select the units you would like to use.'), 'u');
     $formFields['advanced'][] = FormManager::AddCombo('lang', __('Language'), $this->GetOption('lang', TranslationEngine::GetLocale(2)), $this->supportedLanguages(), 'id', 'value', __('Select the language you would like to use.'), 'l');
     $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');
     $formFields['advanced'][] = FormManager::AddCheckbox('dayConditionsOnly', __('Only show Daytime weather conditions'), $this->GetOption('dayConditionsOnly', 1), __('Tick if you would like to only show the Daytime weather conditions.'), 'd');
     $formFields['general'][] = FormManager::AddText('color', __('Colour'), $this->GetOption('color', '000'), __('Please select a colour for the foreground text.'), 'c', 'required');
     $formFields['advanced'][] = FormManager::AddCheckbox('overrideTemplate', __('Override the template?'), $this->GetOption('overrideTemplate'), __('Tick if you would like to override the template.'), 'o');
     $formFields['advanced'][] = FormManager::AddMultiText('currentTemplate', __('Template for Current Forecast'), $this->GetRawNode('currentTemplate'), __('Enter the template for the current forecast. For a list of substitutions click "Request Forecast" below.'), 't', 10, 'required', 'template-override-controls');
     $formFields['advanced'][] = FormManager::AddMultiText('dailyTemplate', __('Template for Daily Forecast'), $this->GetRawNode('dailyTemplate'), __('Enter the template for the current forecast. Replaces [dailyForecast] in main template.'), 't', 10, NULL, 'template-override-controls');
     $formFields['advanced'][] = FormManager::AddMultiText('styleSheet', __('CSS Style Sheet'), $this->GetRawNode('styleSheet'), __('Enter a CSS style sheet to style the weather widget'), 'c', 10, 'required', 'template-override-controls');
     $formFields['forecast'][] = FormManager::AddMessage(__('Please press Request Forecast to show the current forecast and all available substitutions.'));
     // Encode up the template
     if (Config::GetSetting('SERVER_MODE') == 'Test' && $this->user->usertypeid == 1) {
         $formFields['forecast'][] = FormManager::AddMessage('<pre>' . htmlentities(json_encode(array('id' => 'ID', 'value' => 'TITLE', 'main' => $this->GetRawNode('currentTemplate'), 'daily' => $this->GetRawNode('dailyTemplate'), 'css' => $this->GetRawNode('styleSheet')))) . '</pre>');
     }
     // Configure the field dependencies
     $this->SetFieldDepencencies();
     // Append the Templates to the response
     $this->response->extra = $this->settings['templates'];
     // Modules should be rendered using the theme engine.
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_advanced', $formFields['advanced']);
     Theme::Set('form_fields_forecast', $formFields['forecast']);
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->dialogTitle = __('Forecast IO');
     $this->response->callBack = 'forecastIoFormSetup';
     // The response object outputs the required JSON object to the browser
     // which is then processed by the CMS JavaScript library (xibo-cms.js).
     $this->response->AddButton(__('Request Forecast'), 'requestTab("forecast", "index.php?p=module&q=exec&mod=' . $this->type . '&method=requestTab&layoutid=' . $this->layoutid . '&regionid=' . $this->regionid . '&mediaid=' . $this->mediaid . '")');
     $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 #22
0
 /**
  * Form for editing the default layout of a display
  */
 public function DefaultLayoutForm()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $displayId = Kit::GetParam('DisplayId', _GET, _INT);
     $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayId), true);
     if (!$auth->edit) {
         trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR);
     }
     if (!($defaultLayoutId = $this->db->GetSingleValue(sprintf("SELECT defaultlayoutid FROM display WHERE displayid = %d", $displayId), 'defaultlayoutid', _INT))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get the default layout'), E_USER_ERROR);
     }
     Theme::Set('form_id', 'DefaultLayoutForm');
     Theme::Set('form_action', 'index.php?p=display&q=DefaultLayout');
     Theme::Set('form_meta', '<input type="hidden" name="DisplayId" value="' . $displayId . '">');
     $formFields = array();
     $formFields[] = FormManager::AddCombo('defaultlayoutid', __('Default Layout'), $defaultLayoutId, $this->user->LayoutList(), 'layoutid', 'layout', __('The Default Layout will be shown there are no other scheduled Layouts. It is usually a full screen logo or holding image.'), 'd');
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Edit Default Layout'), '300px', '150px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Display', 'DefaultLayout') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#DefaultLayoutForm").submit()');
     $response->Respond();
 }
Beispiel #23
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 #24
0
 /**
  * Show the Permissions for this Campaign
  */
 public function PermissionsForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $campaignId = Kit::GetParam('CampaignID', _GET, _INT);
     $auth = $this->user->CampaignAuth($campaignId, true);
     if (!$auth->modifyPermissions) {
         trigger_error(__('You do not have permissions to edit this campaign'), E_USER_ERROR);
     }
     // Set some information about the form
     Theme::Set('form_id', 'CampaignPermissionsForm');
     Theme::Set('form_action', 'index.php?p=campaign&q=Permissions');
     Theme::Set('form_meta', '<input type="hidden" name="campaignId" value="' . $campaignId . '" />');
     // List of all Groups with a view / edit / delete check box
     $permissions = new CampaignSecurity();
     if (!($result = $permissions->GetPermissions($campaignId))) {
         trigger_error($permissions->GetErrorMessage(), E_USER_ERROR);
     }
     if (count($result) <= 0) {
         trigger_error(__('Unable to get permissions for this Campaign'), E_USER_ERROR);
     }
     $checkboxes = array();
     foreach ($result as $row) {
         $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;
     }
     $formFields = array();
     $formFields[] = FormManager::AddPermissions('groupids[]', $checkboxes);
     $formFields[] = FormManager::AddCheckbox('replaceInLayouts', __('Update these permissions on all layouts, regions and media.'), 0, __('Note: It will only be replaced in layouts you have permission to edit.'), 'r');
     $users = $user->userList(array('userName'));
     $users[] = array('userid' => -1, 'username' => '');
     $formFields[] = FormManager::AddCombo('ownerId', __('Owner'), -1, $users, 'userid', 'username', __('Change the Owner of this item. Leave empty to keep the current owner.'), 'o');
     Theme::Set('form_fields', $formFields);
     $form = Theme::RenderReturn('form_render');
     $response->SetFormRequestResponse($form, __('Permissions'), '350px', '500px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Permissions') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#CampaignPermissionsForm").submit()');
     $response->Respond();
 }
Beispiel #25
0
 /**
  * Security for Menu Items
  * @return 
  */
 function MenuItemSecurityForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $id = uniqid();
     Theme::Set('id', $id);
     Theme::Set('header_text', __('Select your Menu Assignments'));
     Theme::Set('pager', ResponseManager::Pager($id));
     Theme::Set('form_meta', '<input type="hidden" name="p" value="group"><input type="hidden" name="q" value="MenuItemSecurityGrid"><input type="hidden" name="groupid" value="' . $this->groupid . '">');
     $formFields = array();
     $formFields[] = FormManager::AddCombo('filter_menu', __('Menu'), null, $db->GetArray("SELECT MenuID, Menu FROM menu"), 'MenuID', 'Menu', NULL, 'r');
     Theme::Set('form_fields', $formFields);
     // Call to render the template
     $xiboGrid = Theme::RenderReturn('grid_render');
     // Construct the Response
     $response = new ResponseManager();
     $response->SetFormRequestResponse($xiboGrid, __('Menu Item Security'), '500', '380');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('User', 'MenuSecurity') . '")');
     $response->AddButton(__('Close'), 'XiboDialogClose()');
     $response->AddButton(__('Assign / Unassign'), '$("#UserGroupMenuForm").submit()');
     $response->Respond();
     return true;
 }