Exemple #1
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();
 }
Exemple #2
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;
 }
Exemple #3
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     $db =& $this->db;
     $user =& $this->user;
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $mediaid = $this->mediaid;
     // Permissions
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this assignment.');
         $this->response->keepOpen = true;
         return $this->response;
     }
     // Other properties
     $popupNotification = $this->GetOption('popupNotification');
     // Get the text out of RAW
     $rawXml = new DOMDocument();
     $rawXml->loadXML($this->GetRaw());
     Debug::LogEntry('audit', 'Raw XML returned: ' . $this->GetRaw());
     // Get the Text Node out of this
     $textNodes = $rawXml->getElementsByTagName('template');
     $textNode = $textNodes->item(0);
     $text = $textNode->nodeValue;
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=EditMedia');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" id="iRegionId" name="regionid" value="' . $regionid . '"><input type="hidden" name="mediaid" value="' . $mediaid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" />');
     $formFields = array();
     $formFields[] = FormManager::AddMessage(__('Ubuntu Client Only'));
     $formFields[] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this counter should be displayed'), 'd', 'required', '', $this->auth->modifyPermissions);
     $formFields[] = FormManager::AddCheckbox('popupNotification', __('Pop-up Notification?'), $popupNotification, __('Popup a notification when the counter changes?'), 'n');
     $formFields[] = FormManager::AddMultiText('ta_text', NULL, $text, __('Enter a format that should be applied to the counter when it is show.'), 't', 10);
     Theme::Set('form_fields', $formFields);
     if ($this->showRegionOptions) {
         $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
     } else {
         $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
     }
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->callBack = 'text_callback';
     $this->response->dialogTitle = __('Edit Counter');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     return $this->response;
 }
Exemple #4
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();
 }
Exemple #5
0
 /**
  * Resolution Edit Form
  */
 function EditForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $resolutionID = Kit::GetParam('resolutionid', _GET, _INT);
     $SQL = sprintf("SELECT resolution, width, height, intended_width, intended_height, enabled FROM resolution WHERE resolutionID = %d", $resolutionID);
     if (!($result = $db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to edit this resolution'), E_USER_ERROR);
     }
     if ($db->num_rows($result) == 0) {
         trigger_error(__('Incorrect resolution id'), E_USER_ERROR);
     }
     $row = $db->get_assoc_row($result);
     $formFields = array();
     $formFields[] = FormManager::AddText('resolution', __('Resolution'), Kit::ValidateParam($row['resolution'], _STRING), __('A name for this Resolution'), 'r', 'required');
     $formFields[] = FormManager::AddNumber('width', __('Width'), Kit::ValidateParam($row['intended_width'], _INT), __('The Width for this Resolution'), 'w', 'required');
     $formFields[] = FormManager::AddNumber('height', __('Height'), Kit::ValidateParam($row['intended_height'], _INT), __('The Height for this Resolution'), 'h', 'required');
     $formFields[] = FormManager::AddCheckbox('enabled', __('Enable?'), Kit::ValidateParam($row['enabled'], _INT), __('Is the Resolution enabled for use?'), 'e');
     Theme::Set('form_fields', $formFields);
     Theme::Set('form_id', 'ResolutionForm');
     Theme::Set('form_action', 'index.php?p=resolution&q=Edit');
     Theme::Set('form_meta', '<input type="hidden" name="resolutionid" value="' . $resolutionID . '" >');
     $response->SetFormRequestResponse(NULL, __('Edit Resolution'), '350px', '250px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Template', 'Add') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#ResolutionForm").submit()');
     $response->Respond();
 }
Exemple #6
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;
 }
 /**
  * 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;
 }
Exemple #8
0
 /**
  * Return the Edit Form as HTML
  * @return ResponseManager
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $mediaid = $this->mediaid;
     // Can this user edit?
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this media.');
         $this->response->keepOpen = false;
         return $this->response;
     }
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=EditMedia');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" id="iRegionId" name="regionid" value="' . $regionid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" /><input type="hidden" id="mediaid" name="mediaid" value="' . $mediaid . '">');
     // Get the embedded HTML out of RAW
     $rawXml = new DOMDocument();
     $rawXml->loadXML($this->GetRaw());
     //Debug::LogEntry('audit', 'Raw XML returned: ' . $this->GetRaw());
     $formFields = array();
     $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::AddCheckbox('transparency', __('Background transparent?'), $this->GetOption('transparency'), __('Should the HTML be shown with a transparent background. Not current available on the Windows Display Client.'), 't');
     $formFields[] = FormManager::AddCheckbox('scaleContent', __('Scale Content?'), $this->GetOption('scaleContent'), __('Should the embedded content be scaled along with the layout?'), 's');
     $formFields[] = FormManager::AddMultiText('embedHtml', NULL, $this->GetRawNode('embedHtml'), __('HTML to Embed'), 'h', 10);
     $formFields[] = FormManager::AddMultiText('embedStyle', NULL, $this->GetRawNode('embedStyle'), __('Custom Style Sheets'), 'h', 10);
     $formFields[] = FormManager::AddMultiText('embedScript', NULL, $this->GetRawNode('embedScript'), __('HEAD content to Embed (including script tags)'), 'h', 10);
     Theme::Set('form_fields', $formFields);
     if ($this->showRegionOptions) {
         $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
     } else {
         $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
     }
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->dialogTitle = __('Edit Embedded HTML');
     $this->response->dialogSize = true;
     $this->response->dialogWidth = '650px';
     $this->response->dialogHeight = '450px';
     $this->response->AddButton(__('Apply'), 'XiboDialogApply("#ModuleForm")');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     return $this->response;
 }
Exemple #9
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;
 }
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     $db =& $this->db;
     $user =& $this->user;
     // Would like to get the regions width / height
     $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;
     }
     $dataSetId = $this->GetOption('datasetid');
     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" name="datasetid" value="' . $dataSetId . '"><input type="hidden" id="mediaid" name="mediaid" value="' . $mediaid . '">');
     // We want 2 tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('advanced', __('Advanced'));
     Theme::Set('form_tabs', $tabs);
     $formFields = array();
     $formFields[] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed'), 'd', 'required', '', $this->auth->modifyPermissions);
     $formFields[] = FormManager::AddText('ordering', __('Order'), $this->GetOption('ordering'), __('Please enter a SQL clause for how this dataset should be ordered'), 'o');
     $formFields[] = FormManager::AddText('filter', __('Filter'), $this->GetOption('filter'), __('Please enter a SQL clause to filter this DataSet.'), 'f');
     $formFields[] = FormManager::AddCheckbox('showHeadings', __('Show the table headings?'), $this->GetOption('showHeadings'), __('Should the Table headings be shown?'), 'h');
     // Handle the columns
     $columns = $this->GetOption('columns');
     if ($columns != '') {
         // Query for more info about the selected and available columns
         $notColumns = $db->GetArray(sprintf("SELECT DataSetColumnID, Heading FROM datasetcolumn WHERE DataSetID = %d AND DataSetColumnID NOT IN (%s)", $dataSetId, $columns));
         // These columns need to be in order
         $columnIds = explode(',', $columns);
         $headings = array();
         foreach ($columnIds as $col) {
             $heading = $db->GetSingleRow(sprintf('SELECT DataSetColumnID, Heading FROM datasetcolumn WHERE DataSetColumnID = %d', $col), 'Heading', _STRING);
             $headings[] = $heading;
         }
         $columns = $headings;
     } else {
         $columns = array();
         $notColumns = $db->GetArray(sprintf("SELECT DataSetColumnID, Heading FROM datasetcolumn WHERE DataSetID = %d ", $dataSetId));
     }
     // Build the two lists
     $columnsSelected = '<ul id="columnsIn" class="connectedSortable">';
     $columnsNotSelected = '<ul id="columnsOut" class="connectedSortable">';
     foreach ($columns as $col) {
         $columnsSelected .= '<li id="DataSetColumnId_' . $col['DataSetColumnID'] . '" class="li-sortable">' . $col['Heading'] . '</li>';
     }
     $columnsSelected .= '</ul>';
     foreach ($notColumns as $notCol) {
         $columnsNotSelected .= '<li id="DataSetColumnId_' . $notCol['DataSetColumnID'] . '" class="li-sortable">' . $notCol['Heading'] . '</li>';
     }
     $columnsNotSelected .= '</ul>';
     Theme::Set('columns_selected_list', $columnsSelected);
     Theme::Set('columns_available_list', $columnsNotSelected);
     // Add the columns in as a RAW message
     $formFields[] = FormManager::AddRaw(Theme::RenderReturn('media_form_datasetview_edit'));
     Theme::Set('form_fields_general', $formFields);
     // Advanced Tab
     $formFields = array();
     $formFields[] = 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[] = 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[] = 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 day this could be set to 60.'), 'n', 'required');
     $formFields[] = FormManager::AddNumber('rowsPerPage', __('Rows per page'), $this->GetOption('rowsPerPage'), __('Please enter the number of rows per page. 0 for no pages.'), 'u');
     // Get the embedded HTML out of RAW
     $rawXml = new DOMDocument();
     $rawXml->loadXML($this->GetRaw());
     $rawNodes = $rawXml->getElementsByTagName('styleSheet');
     if ($rawNodes->length != 0) {
         $rawNode = $rawNodes->item(0);
     }
     $formFields[] = FormManager::AddMultiText('styleSheet', NULL, $rawNodes->length == 0 ? $this->DefaultStyleSheet() : $rawNode->nodeValue, __('Enter a style sheet for the table'), 's', 10);
     Theme::Set('form_fields_advanced', $formFields);
     $this->response->SetFormRequestResponse(NULL, 'Edit DataSet View for DataSet', '650px', '575px');
     // 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'), 'DataSetViewSubmit()');
     $this->response->callBack = 'datasetview_callback';
     return $this->response;
 }
Exemple #11
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;
 }
Exemple #12
0
 public function ImportCsvForm()
 {
     global $session;
     $db =& $this->db;
     $response = new ResponseManager();
     $dataSetId = Kit::GetParam('datasetid', _GET, _INT);
     $dataSet = Kit::GetParam('dataset', _GET, _STRING);
     $auth = $this->user->DataSetAuth($dataSetId, true);
     if (!$auth->edit) {
         trigger_error(__('Access Denied'), E_USER_ERROR);
     }
     // Set the Session / Security information
     $sessionId = session_id();
     $securityToken = CreateFormToken();
     $session->setSecurityToken($securityToken);
     // Find the max file size
     $maxFileSizeBytes = convertBytes(ini_get('upload_max_filesize'));
     // Set some information about the form
     Theme::Set('form_id', 'DataSetImportCsvForm');
     Theme::Set('form_action', 'index.php?p=dataset&q=ImportCsv');
     Theme::Set('form_meta', '<input type="hidden" name="dataset" value="' . $dataSet . '" /><input type="hidden" name="datasetid" value="' . $dataSetId . '" /><input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /><input type="hidden" name="hidFileID" id="hidFileID" value="" />');
     Theme::Set('form_upload_id', 'file_upload');
     Theme::Set('form_upload_action', 'index.php?p=content&q=FileUpload');
     Theme::Set('form_upload_meta', '<input type="hidden" id="PHPSESSID" value="' . $sessionId . '" /><input type="hidden" id="SecurityToken" value="' . $securityToken . '" /><input type="hidden" name="MAX_FILE_SIZE" value="' . $maxFileSizeBytes . '" />');
     Theme::Set('prepend', Theme::RenderReturn('form_file_upload_single'));
     $formFields = array();
     $formFields[] = FormManager::AddCheckbox('overwrite', __('Overwrite existing data?'), NULL, __('Erase all content in this DataSet and overwrite it with the new content in this import.'), 'o');
     $formFields[] = FormManager::AddCheckbox('ignorefirstrow', __('Ignore first row?'), NULL, __('Ignore the first row? Useful if the CSV has headings.'), 'i');
     // Enumerate over the columns in the DataSet and offer a column mapping for each one (from the file)
     $SQL = "";
     $SQL .= "SELECT DataSetColumnID, Heading ";
     $SQL .= "  FROM datasetcolumn ";
     $SQL .= sprintf(" WHERE DataSetID = %d ", $dataSetId);
     $SQL .= "   AND DataSetColumnTypeID = 1 ";
     $SQL .= "ORDER BY ColumnOrder ";
     // Load results into an array
     $dataSetColumns = $db->GetArray($SQL);
     if (!is_array($dataSetColumns)) {
         trigger_error($db->error());
         trigger_error(__('Error getting list of dataSetColumns'), E_USER_ERROR);
     }
     $i = 0;
     foreach ($dataSetColumns as $row) {
         $i++;
         $formFields[] = FormManager::AddNumber('csvImport_' . Kit::ValidateParam($row['DataSetColumnID'], _INT), Kit::ValidateParam($row['Heading'], _STRING), $i, NULL, 'c');
     }
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('CSV Import'), '350px', '200px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DataSet', 'ImportCsv') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Import'), '$("#DataSetImportCsvForm").submit()');
     $response->Respond();
 }
Exemple #13
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();
 }
Exemple #14
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', __('Video Path'), urldecode($this->GetOption('uri')), __('A local file path or URL to the video. This can be a RTSP stream.'), 'p', 'required');
     $formFields[] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this counter should be displayed'), 'd', 'required', '', $this->auth->modifyPermissions);
     Theme::Set('form_fields', $formFields);
     if ($this->showRegionOptions) {
         $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
     } else {
         $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
     }
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     $this->response->dialogTitle = __('Edit Local Video');
     $this->response->dialogSize = true;
     $this->response->dialogWidth = '350px';
     $this->response->dialogHeight = '250px';
     return $this->response;
 }
Exemple #15
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;
 }
Exemple #16
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;
 }
Exemple #17
0
 /**
  * Modify Display form
  */
 function displayForm()
 {
     $response = new ResponseManager();
     // Get the display Id
     $displayObject = new Display();
     $displayObject->displayId = Kit::GetParam('displayid', _GET, _INT);
     $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayObject->displayId), true);
     if (!$auth->edit) {
         trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR);
     }
     // Load this display
     if (!$displayObject->Load()) {
         trigger_error($displayObject->GetErrorMessage(), E_USER_ERROR);
     }
     // Set some information about the form
     Theme::Set('form_id', 'DisplayEditForm');
     Theme::Set('form_action', 'index.php?p=display&q=modify');
     Theme::Set('form_meta', '<input type="hidden" name="displayid" value="' . $displayObject->displayId . '" />');
     // Column 1
     $formFields = array();
     $formFields[] = FormManager::AddText('display', __('Display'), $displayObject->display, __('The Name of the Display - (1 - 50 characters).'), 'd', 'required');
     $formFields[] = FormManager::AddText('hardwareKey', __('Display\'s Hardware Key'), $displayObject->license, __('A unique identifier for this display.'), 'h', 'required', NULL, false);
     $formFields[] = FormManager::AddText('description', __('Description'), $displayObject->description, __('A description - (1 - 254 characters).'), 'p', 'maxlength="50"');
     $formFields[] = FormManager::AddCombo('licensed', __('Licence Display?'), $displayObject->licensed, array(array('licensedid' => '1', 'licensed' => 'Yes'), array('licensedid' => '0', 'licensed' => 'No')), 'licensedid', 'licensed', __('Use one of the available licenses for this display?'), 'l');
     $formFields[] = FormManager::AddCombo('defaultlayoutid', __('Default Layout'), $displayObject->defaultLayoutId, $this->user->LayoutList(), 'layoutid', 'layout', __('The Default Layout to Display where there is no other content.'), 't');
     Theme::Set('form_fields_general', $formFields);
     // Maintenance
     $formFields = array();
     $formFields[] = FormManager::AddCombo('email_alert', __('Email Alerts'), $displayObject->emailAlert, array(array('id' => '1', 'value' => 'Yes'), array('id' => '0', 'value' => 'No')), 'id', 'value', __('Do you want to be notified by email if there is a problem with this display?'), 'a');
     $formFields[] = FormManager::AddCheckbox('alert_timeout', __('Use the Global Timeout?'), $displayObject->alertTimeout, __('Should this display be tested against the global time out or the client collection interval?'), 'o');
     Theme::Set('form_fields_maintenance', $formFields);
     // Location
     $formFields = array();
     $formFields[] = FormManager::AddNumber('latitude', __('Latitude'), $displayObject->latitude, __('The Latitude of this display'), 'g');
     $formFields[] = FormManager::AddNumber('longitude', __('Longitude'), $displayObject->longitude, __('The Longitude of this Display'), 'g');
     Theme::Set('form_fields_location', $formFields);
     // Wake on LAN
     $formFields = array();
     $formFields[] = FormManager::AddCheckbox('wakeOnLanEnabled', __('Enable Wake on LAN'), $displayObject->wakeOnLanEnabled, __('Wake on Lan requires the correct network configuration to route the magic packet to the display PC'), 'w');
     $formFields[] = FormManager::AddText('broadCastAddress', __('BroadCast Address'), $displayObject->broadCastAddress == '' ? $displayObject->clientAddress : $displayObject->broadCastAddress, __('The IP address of the remote host\'s broadcast address (or gateway)'), 'b');
     $formFields[] = FormManager::AddText('secureOn', __('Wake on LAN SecureOn'), $displayObject->secureOn, __('Enter a hexadecimal password of a SecureOn enabled Network Interface Card (NIC) of the remote host. Enter a value in this pattern: \'xx-xx-xx-xx-xx-xx\'. Leave the following field empty, if SecureOn is not used (for example, because the NIC of the remote host does not support SecureOn).'), 's');
     $formFields[] = FormManager::AddText('wakeOnLanTime', __('Wake on LAN Time'), $displayObject->wakeOnLanTime, __('The time this display should receive the WOL command, using the 24hr clock - e.g. 19:00. Maintenance must be enabled.'), 't');
     $formFields[] = FormManager::AddText('cidr', __('Wake on LAN CIDR'), $displayObject->cidr, __('Enter a number within the range of 0 to 32 in the following field. Leave the following field empty, if no subnet mask should be used (CIDR = 0). If the remote host\'s broadcast address is unknown: Enter the host name or IP address of the remote host in Broad Cast Address and enter the CIDR subnet mask of the remote host in this field.'), 'c');
     Theme::Set('form_fields_wol', $formFields);
     // Advanced
     $formFields = array();
     $displayProfileList = $this->user->DisplayProfileList(NULL, array('type' => $displayObject->clientType));
     array_unshift($displayProfileList, array('displayprofileid' => 0, 'name' => ''));
     $formFields[] = FormManager::AddCombo('displayprofileid', __('Settings Profile?'), $displayObject->displayProfileId, $displayProfileList, 'displayprofileid', 'name', __('What display profile should this display use?'), 'p');
     $formFields[] = FormManager::AddCombo('inc_schedule', __('Interleave Default'), $displayObject->incSchedule, array(array('id' => '1', 'value' => 'Yes'), array('id' => '0', 'value' => 'No')), 'id', 'value', __('Whether to always put the default layout into the cycle.'), 'i');
     $formFields[] = FormManager::AddCombo('auditing', __('Auditing'), $displayObject->isAuditing, array(array('id' => '1', 'value' => 'Yes'), array('id' => '0', 'value' => 'No')), 'id', 'value', __('Collect auditing from this client. Should only be used if there is a problem with the display.'), 'a');
     // Show the resolved settings for this display.
     $formFields[] = FormManager::AddMessage(__('The settings for this display are shown below. They are taken from the active Display Profile for this Display, which can be changed in Display Settings. If you have altered the Settings Profile above, you will need to save and re-show the form.'));
     // Build a table for the settings to be shown in
     $cols = array(array('name' => 'title', 'title' => __('Setting')), array('name' => 'valueString', 'title' => __('Value')));
     // Get the settings from the profile
     $profile = $displayObject->getSettingsProfile();
     // Go through each one, and see if it is a drop down
     for ($i = 0; $i < count($profile); $i++) {
         // Always update the value string with the source value
         $profile[$i]['valueString'] = $profile[$i]['value'];
         // Overwrite the value string when we are dealing with dropdowns
         if ($profile[$i]['fieldType'] == 'dropdown') {
             // Update our value
             foreach ($profile[$i]['options'] as $option) {
                 if ($option['id'] == $profile[$i]['value']) {
                     $profile[$i]['valueString'] = $option['value'];
                 }
             }
         } else {
             if ($profile[$i]['fieldType'] == 'timePicker') {
                 $profile[$i]['valueString'] = DateManager::getLocalDate($profile[$i]['value'] / 1000, 'H:i');
             }
         }
     }
     Theme::Set('table_cols', $cols);
     Theme::Set('table_rows', $profile);
     $formFields[] = FormManager::AddRaw(Theme::RenderReturn('table_render'));
     Theme::Set('form_fields_advanced', $formFields);
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('location', __('Location'));
     $tabs[] = FormManager::AddTab('maintenance', __('Maintenance'));
     $tabs[] = FormManager::AddTab('wol', __('Wake on LAN'));
     $tabs[] = FormManager::AddTab('advanced', __('Advanced'));
     Theme::Set('form_tabs', $tabs);
     $response->SetFormRequestResponse(NULL, __('Edit a Display'), '650px', '350px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Display', 'Edit') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#DisplayEditForm").submit()');
     $response->Respond();
 }
Exemple #18
0
 public function quotaForm()
 {
     $response = new ResponseManager();
     $groupId = Kit::GetParam('groupId', _GET, _INT);
     // Look up the existing quota
     $libraryQuota = UserGroup::getLibraryQuota($groupId);
     $formFields = array();
     $formFields[] = FormManager::AddNumber('libraryQuota', __('Library Quota'), $libraryQuota, __('The quota in Kb that should be applied. Enter 0 for no quota.'), 'q', 'required');
     Theme::Set('form_fields', $formFields);
     // Set some information about the form
     Theme::Set('form_id', 'GroupQuotaForm');
     Theme::Set('form_action', 'index.php?p=group&q=quota');
     Theme::Set('form_meta', '<input type="hidden" name="groupId" value="' . $groupId . '" />');
     $response->SetFormRequestResponse(Theme::RenderReturn('form_render'), __('Edit Library Quota'), '350px', '150px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Group', 'Edit') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#GroupQuotaForm").submit()');
     $response->Respond();
 }