Ejemplo n.º 1
0
 public function displayPage()
 {
     $db =& $this->db;
     // Configure the theme
     $id = uniqid();
     Theme::Set('id', 'LogGridForRefresh');
     Theme::Set('form_meta', '<input type="hidden" name="p" value="log"><input type="hidden" name="q" value="Grid">');
     Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter'));
     Theme::Set('pager', ResponseManager::Pager('LogGridForRefresh'));
     // Construct Filter Form
     if (Kit::IsFilterPinned('log', 'Filter')) {
         $filter_pinned = 1;
         $filter_type = Session::Get('log', 'filter_type');
         $filter_page = Session::Get('log', 'filter_page');
         $filter_function = Session::Get('log', 'filter_function');
         $filter_display = Session::Get('log', 'filter_display');
         $filter_fromdt = Session::Get('log', 'filter_fromdt');
         $filter_seconds = Session::Get('log', 'filter_seconds');
         $filter_intervalTypeId = Session::Get('log', 'filter_intervalTypeId');
     } else {
         $filter_pinned = 0;
         $filter_type = 0;
         $filter_page = NULL;
         $filter_function = NULL;
         $filter_display = 0;
         $filter_fromdt = NULL;
         $filter_seconds = 120;
         $filter_intervalTypeId = 1;
     }
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('advanced', __('Advanced'));
     $formFields = array();
     $formFields['general'][] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, array(array('typeid' => 0, 'type' => 'All'), array('typeid' => 2, 'type' => 'Audit'), array('typeid' => 1, 'type' => 'Error')), 'typeid', 'type', NULL, 't');
     $formFields['general'][] = FormManager::AddCombo('filter_intervalTypeId', __('Interval'), $filter_intervalTypeId, array(array('intervalTypeid' => 1, 'intervalType' => __('Seconds')), array('intervalTypeid' => 60, 'intervalType' => __('Minutes')), array('intervalTypeid' => 3600, 'intervalType' => __('Hours'))), 'intervalTypeid', 'intervalType', NULL, 'i');
     $formFields['general'][] = FormManager::AddText('filter_seconds', __('Duration back'), $filter_seconds, NULL, 's');
     $formFields['general'][] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k');
     // Advanced Tab
     $formFields['advanced'][] = FormManager::AddDatePicker('filter_fromdt', __('From Date'), $filter_fromdt, NULL, 't');
     $formFields['advanced'][] = FormManager::AddText('filter_page', __('Page'), $filter_page, NULL, 'p');
     $formFields['advanced'][] = FormManager::AddText('filter_function', __('Function'), $filter_function, NULL, 'f');
     // Display
     $displays = $this->user->DisplayList();
     array_unshift($displays, array('displayid' => 0, 'display' => 'All'));
     $formFields['advanced'][] = FormManager::AddCombo('filter_display', __('Display'), $filter_display, $displays, 'displayid', 'display', NULL, 't');
     // Call to render the template
     Theme::Set('header_text', __('Logs'));
     Theme::Set('form_tabs', $tabs);
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_advanced', $formFields['advanced']);
     Theme::Render('grid_render');
 }
Ejemplo n.º 2
0
 public function Step2()
 {
     Theme::Set('form_action', 'install.php');
     // Choice of new or existing database
     // Tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('new', __('Create a new database'));
     $tabs[] = FormManager::AddTab('existing', __('Use an existing database'));
     Theme::Set('form_tabs', $tabs);
     $formFields = array();
     // Set some defaults
     $this->db_create = $this->db_create == '' ? 1 : $this->db_create;
     $this->new_db_host = $this->new_db_host == '' ? 'localhost' : $this->new_db_host;
     $this->db_admin_user = $this->db_admin_user == '' ? 'root' : $this->db_admin_user;
     // New DB tab
     $formFields['new'][] = FormManager::AddHidden('step', 3);
     $formFields['new'][] = FormManager::AddMessage(sprintf(__("%s needs to set-up a connection to your MySQL database."), Theme::GetConfig('app_name')));
     $formFields['new'][] = FormManager::AddMessage(__('If you have not yet created an empty database and database user for Xibo to use, and know the user name / password of a MySQL administrator stay on this tab, otherwise click "Use Existing".'));
     $formFields['new'][] = FormManager::AddRadio('db_create', 'db_create1', __('Create a new database'), $this->db_create, 1, __('Select to create a new database'), 'c');
     $formFields['new'][] = FormManager::AddText('host', __('Host'), $this->new_db_host, __('Please enter the hostname for the MySQL server. This is usually localhost.'), 'h');
     $formFields['new'][] = FormManager::AddText('admin_username', __('Admin Username'), $this->db_admin_user, __('Please enter the user name of an account that has administrator privileges on the MySQL server.'), 'h');
     $formFields['new'][] = FormManager::AddPassword('admin_password', __('Admin Password'), $this->db_admin_pass, __('Please enter password for the Admin account.'), 'h');
     $formFields['new'][] = FormManager::AddText('db_name', __('Database Name'), $this->new_db_name, __('Please enter the name of the database that should be created.'), 'h');
     $formFields['new'][] = FormManager::AddText('db_username', __('Database Username'), $this->new_db_user, __('Please enter the name of the database user that should be created.'), 'h');
     $formFields['new'][] = FormManager::AddPassword('db_password', __('Database Password'), $this->new_db_pass, __('Please enter a password for this user.'), 'h');
     // Existing DB tab
     $formFields['existing'][] = FormManager::AddRadio('db_create', 'db_create2', __('Use an existing database'), $this->db_create, 2, __('Select to use an existing database. Please note that when you use an existing database it must be empty of all other contents.'), 'e');
     $formFields['existing'][] = FormManager::AddText('existing_host', __('Host'), $this->existing_db_host, __('Please enter the hostname for the MySQL server. This is usually localhost.'), 'h');
     $formFields['existing'][] = FormManager::AddText('existing_db_name', __('Database Name'), $this->existing_db_name, __('Please enter the name of the database that should be created.'), 'h');
     $formFields['existing'][] = FormManager::AddText('existing_db_username', __('Database Username'), $this->existing_db_user, __('Please enter the name of the database user that should be created.'), 'h');
     $formFields['existing'][] = FormManager::AddPassword('existing_db_password', __('Database Password'), $this->existing_db_pass, __('Please enter a password for this user.'), 'h');
     // Put up an error message if one has been set (and then unset it)
     if ($this->errorMessage != '') {
         Theme::Set('message', $this->errorMessage);
         Theme::Set('prepend', Theme::RenderReturn('message_box'));
         $this->errorMessage == '';
     }
     // Return a rendered form
     Theme::Set('form_fields_new', $formFields['new']);
     Theme::Set('form_fields_existing', $formFields['existing']);
     Theme::Set('form_buttons', array(FormManager::AddButton(__('Next'))));
     return Theme::RenderReturn('form_render');
 }
Ejemplo n.º 3
0
 public function EditForm()
 {
     // Create a form out of the config object.
     $displayProfile = new DisplayProfile();
     $displayProfile->displayProfileId = Kit::GetParam('displayprofileid', _GET, _INT);
     if (!$displayProfile->Load()) {
         trigger_error($displayProfile->GetErrorMessage(), E_USER_ERROR);
     }
     if ($this->user->usertypeid != 1 && $this->user->userid != $displayProfile->userId) {
         trigger_error(__('You do not have permission to edit this profile'), E_USER_ERROR);
     }
     if (empty($displayProfile->type)) {
         trigger_error(__('Unknown Client Type'), E_USER_ERROR);
     }
     // Capture and validate the posted form parameters in accordance with the display config object.
     include 'config/client.config.php';
     if (!isset($CLIENT_CONFIG[$displayProfile->type])) {
         trigger_error(__('CMS Config not supported for ' . $displayProfile->type . ' displays.'), E_USER_ERROR);
     }
     // Set some information about the form
     Theme::Set('form_id', 'DisplayConfigForm');
     Theme::Set('form_action', 'index.php?p=displayprofile&q=Edit');
     Theme::Set('form_meta', '<input type="hidden" name="displayprofileid" value="' . $displayProfile->displayProfileId . '" />');
     $formFields = array();
     $formTabs = array();
     // Tabs?
     foreach ($CLIENT_CONFIG[$displayProfile->type]['tabs'] as $tab) {
         // Create an empty array of form fields for this tab.
         $formFields[$tab['id']] = array();
         // Also add the tab
         $formTabs[] = FormManager::AddTab($tab['id'], $tab['name']);
     }
     // Go through each setting and output a form control to the theme.
     $formFields['general'][] = FormManager::AddText('name', __('Name'), $displayProfile->name, __('The Name of the Profile - (1 - 50 characters)'), 'n', 'maxlength="50" required');
     $formFields['general'][] = FormManager::AddCheckbox('isdefault', __('Default Profile?'), $displayProfile->isDefault, __('Is this the default profile for all Displays of this type? Only 1 profile can be the default.'), 'd');
     foreach ($CLIENT_CONFIG[$displayProfile->type]['settings'] as $setting) {
         // Check to see if we have a value for this setting as yet, if so we use that.
         // TODO: there must be a way to improve this?
         foreach ($displayProfile->config as $set) {
             if ($set['name'] == $setting['name']) {
                 $setting['value'] = $set['value'];
             }
         }
         if ($setting['type'] == 'checkbox' && isset($setting['value'])) {
             $validated = $setting['value'];
         } else {
             if ($setting['fieldType'] == 'timePicker') {
                 // Check if we are 0, if so then set to 00:00
                 if ($setting['value'] == 0) {
                     $validated = '00:00';
                 } else {
                     $validated = DateManager::getLocalDate($setting['value'] / 1000, 'H:i');
                 }
             } else {
                 if (isset($setting['value'])) {
                     $validated = Kit::ValidateParam($setting['value'], $setting['type']);
                 } else {
                     $validated = $setting['default'];
                 }
             }
         }
         //Debug::LogEntry('audit', 'Validated ' . $setting['name'] . '. [' . $setting['value'] . '] as [' . $validated . ']. With type ' . $setting['type']);
         // Each field needs to have a type, a name and a default
         $formFields[$setting['tabId']][] = array('name' => $setting['name'], 'fieldType' => $setting['fieldType'], 'helpText' => $setting['helpText'], 'title' => $setting['title'], 'options' => isset($setting['options']) ? $setting['options'] : array(), 'optionId' => 'id', 'optionValue' => 'value', 'validation' => isset($setting['validation']) ? $setting['validation'] : '', 'value' => $validated, 'enabled' => $setting['enabled'], 'groupClass' => NULL, 'accesskey' => '');
     }
     Theme::Set('form_tabs', $formTabs);
     foreach ($CLIENT_CONFIG[$displayProfile->type]['tabs'] as $tab) {
         Theme::Set('form_fields_' . $tab['id'], $formFields[$tab['id']]);
     }
     $response = new ResponseManager();
     $response->SetFormRequestResponse(NULL, __('Edit Profile'), '650px', '350px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DisplayProfile', 'Edit') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#DisplayConfigForm").submit()');
     $response->Respond();
 }
Ejemplo n.º 4
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();
 }
Ejemplo n.º 5
0
 /**
  * Displays an Add/Edit form
  */
 function displayForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $layoutId = Kit::GetParam('layoutid', _GET, _INT);
     // Get the layout
     if ($layoutId != 0) {
         $layout = $user->LayoutList(NULL, array('layoutId' => Kit::GetParam('layoutid', _GET, _INT)));
         if (count($layout) <= 0) {
             trigger_error(__('Unable to find Layout'), E_USER_ERROR);
         }
         $layout = $layout[0];
     }
     Theme::Set('form_id', 'LayoutForm');
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('description', __('Description'));
     Theme::Set('form_tabs', $tabs);
     $formFields = array();
     $formFields['general'][] = FormManager::AddText('layout', __('Name'), isset($layout['layout']) ? $layout['layout'] : NULL, __('The Name of the Layout - (1 - 50 characters)'), 'n', 'required');
     $formFields['general'][] = FormManager::AddText('tags', __('Tags'), isset($layout['tags']) ? $layout['tags'] : NULL, __('Tags for this layout - used when searching for it. Comma delimited. (1 - 250 characters)'), 't', 'maxlength="250"');
     $formFields['description'][] = FormManager::AddMultiText('description', __('Description'), isset($layout['description']) ? $layout['description'] : NULL, __('An optional description of the Layout. (1 - 250 characters)'), 'd', 5, 'maxlength="250"');
     if ($layoutId != 0) {
         // We are editing
         Theme::Set('form_action', 'index.php?p=layout&q=modify');
         Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutId . '">');
         $formFields['general'][] = FormManager::AddCombo('retired', __('Retired'), $layout['retired'], array(array('retiredid' => '1', 'retired' => 'Yes'), array('retiredid' => '0', 'retired' => 'No')), 'retiredid', 'retired', __('Retire this layout or not? It will no longer be visible in lists'), 'r');
     } else {
         // We are adding
         Theme::Set('form_action', 'index.php?p=layout&q=add');
         $templates = $user->TemplateList();
         array_unshift($templates, array('layoutid' => '0', 'layout' => 'None'));
         $formFields['general'][] = FormManager::AddCombo('templateid', __('Template'), NULL, $templates, 'layoutid', 'layout', __('Optionally choose a template you have saved before.'), 't');
         $formFields['general'][] = FormManager::AddCombo('resolutionid', __('Resolution'), NULL, $user->ResolutionList(), 'resolutionid', 'resolution', __('Choose the resolution this Layout should be designed for.'), 'r', 'resolution-group');
         $response->AddFieldAction('templateid', 'change', 0, array('.resolution-group' => array('display' => 'block')));
         $response->AddFieldAction('templateid', 'change', 0, array('.resolution-group' => array('display' => 'none')), "not");
     }
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_description', $formFields['description']);
     // Initialise the template and capture the output
     $form = Theme::RenderReturn('form_render');
     $dialogTitle = $this->layoutid == 0 ? __('Add Layout') : __('Edit Layout');
     $response->SetFormRequestResponse($form, $dialogTitle, '350px', '275px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . ($this->layoutid != '' ? HelpManager::Link('Layout', 'Edit') : HelpManager::Link('Layout', 'Add')) . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#LayoutForm").submit()');
     $response->Respond();
 }
Ejemplo n.º 6
0
 function EditForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $layoutId = Kit::GetParam('layoutid', _GET, _INT);
     // Get the layout
     $layout = $user->LayoutList(NULL, array('layoutId' => Kit::GetParam('layoutid', _GET, _INT), 'excludeTemplates' => 0));
     if (count($layout) <= 0) {
         trigger_error(__('Unable to find Template'), E_USER_ERROR);
     }
     $layout = $layout[0];
     Theme::Set('form_id', 'TemplateEditForm');
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('description', __('Description'));
     Theme::Set('form_tabs', $tabs);
     $formFields = array();
     $formFields['general'][] = FormManager::AddText('layout', __('Name'), $layout['layout'], __('The Name of the Layout - (1 - 50 characters)'), 'n', 'required');
     $formFields['description'][] = FormManager::AddMultiText('description', __('Description'), $layout['description'], __('An optional description of the Layout. (1 - 250 characters)'), 'd', 5, 'maxlength="250"');
     // We are editing
     Theme::Set('form_action', 'index.php?p=template&q=Edit');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutId . '">');
     $formFields['general'][] = FormManager::AddCombo('retired', __('Retired'), $layout['retired'], array(array('retiredid' => '1', 'retired' => 'Yes'), array('retiredid' => '0', 'retired' => 'No')), 'retiredid', 'retired', __('Retire this template or not? It will no longer be visible in lists'), 'r');
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_description', $formFields['description']);
     // Initialise the template and capture the output
     $form = Theme::RenderReturn('form_render');
     $response->SetFormRequestResponse($form, __('Edit Template'), '350px', '275px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Template', 'Edit') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#TemplateEditForm").submit()');
     $response->Respond();
 }
Ejemplo n.º 7
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     // This is the logged in user and can be used to assess permissions
     $user =& $this->user;
     // The CMS provides the region width and height in case they are needed
     $rWidth = Kit::GetParam('rWidth', _REQUEST, _STRING);
     $rHeight = Kit::GetParam('rHeight', _REQUEST, _STRING);
     // Augment settings with templates
     $this->loadTemplates();
     // All forms should set some meta data about the form.
     // Usually, you would want this meta data to remain the same.
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=EditMedia');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $this->layoutid . '"><input type="hidden" id="iRegionId" name="regionid" value="' . $this->regionid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" /><input type="hidden" id="mediaid" name="mediaid" value="' . $this->mediaid . '">');
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('template', __('Appearance'), array(array('name' => 'enlarge', 'value' => true)));
     $tabs[] = FormManager::AddTab('effect', __('Effect'));
     $tabs[] = FormManager::AddTab('advanced', __('Advanced'));
     Theme::Set('form_tabs', $tabs);
     $formFields['general'][] = FormManager::AddText('name', __('Name'), $this->GetOption('name'), __('An optional name for this media'), 'n');
     // Duration
     $formFields['general'][] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed.'), 'd', 'required');
     // Search Term
     $formFields['general'][] = FormManager::AddText('searchTerm', __('Search Term'), $this->GetOption('searchTerm'), __('Search term. You can test your search term in the twitter.com search box first.'), 's', 'required');
     // Type
     $formFields['general'][] = FormManager::AddCombo('resultType', __('Type'), $this->GetOption('resultType'), array(array('typeid' => 'mixed', 'type' => __('Mixed')), array('typeid' => 'recent', 'type' => __('Recent')), array('typeid' => 'popular', 'type' => __('Popular'))), 'typeid', 'type', __('Recent shows only the most recent tweets, Popular the most popular and Mixed includes both popular and recent results.'), 't', 'required');
     // Distance
     $formFields['general'][] = FormManager::AddNumber('tweetDistance', __('Distance'), $this->GetOption('tweetDistance'), __('Distance in miles that the tweets should be returned from. Set to 0 for no restrictions.'), 'd');
     // Distance
     $formFields['general'][] = FormManager::AddNumber('tweetCount', __('Count'), $this->GetOption('tweetCount'), __('The number of Tweets to return.'), 'c');
     // Common fields
     $formFields['effect'][] = FormManager::AddCombo('effect', __('Effect'), $this->GetOption('effect'), array(array('effectid' => 'none', 'effect' => __('None')), array('effectid' => 'fade', 'effect' => __('Fade')), array('effectid' => 'fadeout', 'effect' => __('Fade Out')), array('effectid' => 'scrollHorz', 'effect' => __('Scroll Horizontal')), array('effectid' => 'scrollVert', 'effect' => __('Scroll Vertical')), array('effectid' => 'flipHorz', 'effect' => __('Flip Horizontal')), array('effectid' => 'flipVert', 'effect' => __('Flip Vertical')), array('effectid' => 'shuffle', 'effect' => __('Shuffle')), array('effectid' => 'tileSlide', 'effect' => __('Tile Slide')), array('effectid' => 'tileBlind', 'effect' => __('Tile Blinds')), array('effectid' => 'marqueeLeft', 'effect' => __('Marquee Left')), array('effectid' => 'marqueeRight', 'effect' => __('Marquee Right')), array('effectid' => 'marqueeUp', 'effect' => __('Marquee Up')), array('effectid' => 'marqueeDown', 'effect' => __('Marquee Down'))), 'effectid', 'effect', __('Please select the effect that will be used to transition between items. If all items should be output, select None. Marquee effects are CPU intensive and may not be suitable for lower power displays.'), 'e');
     $formFields['effect'][] = FormManager::AddNumber('speed', __('Speed'), $this->GetOption('speed'), __('The transition speed of the selected effect in milliseconds (normal = 1000) or the Marquee Speed in a low to high scale (normal = 1).'), 's', NULL, 'effect-controls');
     // A list of web safe colours
     $formFields['advanced'][] = FormManager::AddText('backgroundColor', __('Background Colour'), $this->GetOption('backgroundColor'), __('The selected effect works best with a background colour. Optionally add one here.'), 'c', NULL, 'background-color-group');
     // Field empty
     $formFields['advanced'][] = FormManager::AddText('noTweetsMessage', __('No tweets'), $this->GetOption('noTweetsMessage'), __('A message to display when there are no tweets returned by the search query'), 'n');
     $formFields['advanced'][] = FormManager::AddText('dateFormat', __('Date Format'), $this->GetOption('dateFormat'), __('The format to apply to all dates returned by the ticker. In PHP date format: http://uk3.php.net/manual/en/function.date.php'), 'f');
     $formFields['advanced'][] = FormManager::AddCheckbox('removeUrls', __('Remove URLs?'), $this->GetOption('removeUrls', 1), __('Should URLs be removed from the Tweet Text. Most URLs do not compliment digital signage.'), 'u');
     $formFields['advanced'][] = FormManager::AddNumber('updateInterval', __('Update Interval (mins)'), $this->GetOption('updateInterval', 60), __('Please enter the update interval in minutes. This should be kept as high as possible. For example, if the data will only change once per hour this could be set to 60.'), 'n', 'required');
     // Encode up the template
     if (Config::GetSetting('SERVER_MODE') == 'Test' && $this->user->usertypeid == 1) {
         $formFields['advanced'][] = FormManager::AddMessage('<pre>' . htmlentities(json_encode(array('id' => 'ID', 'value' => 'TITLE', 'template' => $this->GetRawNode('template'), 'css' => $this->GetRawNode('styleSheet')))) . '</pre>');
     }
     // Template - for standard stuff
     $formFields['template'][] = FormManager::AddCombo('templateId', __('Template'), $this->GetOption('templateId', 'tweet-only'), $this->settings['templates'], 'id', 'value', __('Select the template you would like to apply. This can be overridden using the check box below.'), 't', 'template-selector-control');
     // Add a field for whether to override the template or not.
     // Default to 1 so that it will work correctly with old items (that didn't have a template selected at all)
     $formFields['template'][] = FormManager::AddCheckbox('overrideTemplate', __('Override the template?'), $this->GetOption('overrideTemplate', 0), __('Tick if you would like to override the template.'), 'o');
     // Add a text template
     $formFields['template'][] = FormManager::AddMultiText('ta_text', NULL, $this->GetRawNode('template'), __('Enter the template. Please note that the background colour has automatically coloured to your layout background colour.'), 't', 10, NULL, 'template-override-controls');
     // Field for the style sheet (optional)
     $formFields['template'][] = FormManager::AddMultiText('ta_css', NULL, $this->GetRawNode('styleSheet'), __('Optional Stylesheet'), 's', 10, NULL, 'template-override-controls');
     // Add some field dependencies
     // When the override template check box is ticked, we want to expose the advanced controls and we want to hide the template selector
     $this->response->AddFieldAction('overrideTemplate', 'init', false, array('.template-override-controls' => array('display' => 'none'), '.template-selector-control' => array('display' => 'block')), 'is:checked');
     $this->response->AddFieldAction('overrideTemplate', 'change', false, array('.template-override-controls' => array('display' => 'none'), '.template-selector-control' => array('display' => 'block')), 'is:checked');
     $this->response->AddFieldAction('overrideTemplate', 'init', true, array('.template-override-controls' => array('display' => 'block'), '.template-selector-control' => array('display' => 'none')), 'is:checked');
     $this->response->AddFieldAction('overrideTemplate', 'change', true, array('.template-override-controls' => array('display' => 'block'), '.template-selector-control' => array('display' => 'none')), 'is:checked');
     // Present an error message if the module has not been configured. Don't prevent further configuration.
     if (!extension_loaded('curl') || $this->GetSetting('apiKey') == '' || $this->GetSetting('apiSecret') == '') {
         $formFields['general'][] = FormManager::AddMessage(__('The Twitter Widget has not been configured yet, please ask your CMS Administrator to look at it for you.'), 'alert alert-danger');
     }
     // Modules should be rendered using the theme engine.
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_template', $formFields['template']);
     Theme::Set('form_fields_effect', $formFields['effect']);
     Theme::Set('form_fields_advanced', $formFields['advanced']);
     // Set the field dependencies
     $this->setFieldDepencencies();
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->dialogTitle = __($this->displayType);
     $this->response->callBack = 'text_callback';
     // The response object outputs the required JSON object to the browser
     // which is then processed by the CMS JavaScript library (xibo-cms.js).
     // Append the templates to the response
     $this->response->extra = $this->settings['templates'];
     $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $this->layoutid . '&regionid=' . $this->regionid . '&q=RegionOptions")');
     $this->response->AddButton(__('Apply'), 'XiboDialogApply("#ModuleForm")');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     // The response must be returned.
     return $this->response;
 }
Ejemplo n.º 8
0
 /**
  * Shows a form to add an event
  *  will default to the current date if non is provided
  * @return 
  */
 function EditEventForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $eventID = Kit::GetParam('EventID', _GET, _INT, 0);
     if ($eventID == 0) {
         trigger_error(__('No event selected.'), E_USER_ERROR);
     }
     // Get the relevant details for this event
     $SQL = "";
     $SQL .= "SELECT schedule.FromDT, ";
     $SQL .= "       schedule.ToDT,";
     $SQL .= "       schedule.CampaignID, ";
     $SQL .= "       schedule.userid, ";
     $SQL .= "       schedule.is_priority, ";
     $SQL .= "       schedule.DisplayGroupIDs, ";
     $SQL .= "       schedule.recurrence_type, ";
     $SQL .= "       schedule.recurrence_detail, ";
     $SQL .= "       schedule.recurrence_range, ";
     $SQL .= "       schedule.EventID, ";
     $SQL .= "       schedule.DisplayOrder ";
     $SQL .= "  FROM schedule ";
     $SQL .= " WHERE 1=1 ";
     $SQL .= sprintf("   AND schedule.EventID = %d", $eventID);
     Debug::LogEntry('audit', $SQL);
     if (!($result = $db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Error getting details for this event.'), E_USER_ERROR);
     }
     $row = $db->get_assoc_row($result);
     $fromDT = Kit::ValidateParam($row['FromDT'], _INT);
     $toDT = Kit::ValidateParam($row['ToDT'], _INT);
     $displayGroupIds = explode(',', Kit::ValidateParam($row['DisplayGroupIDs'], _STRING));
     $recType = Kit::ValidateParam($row['recurrence_type'], _STRING);
     $recDetail = Kit::ValidateParam($row['recurrence_detail'], _STRING);
     $recToDT = Kit::ValidateParam($row['recurrence_range'], _INT);
     $campaignId = Kit::ValidateParam($row['CampaignID'], _STRING);
     $isPriority = Kit::ValidateParam($row['is_priority'], _INT);
     $displayOrder = Kit::ValidateParam($row['DisplayOrder'], _INT);
     // Check that we have permission to edit this event.
     if (!$this->IsEventEditable($displayGroupIds)) {
         trigger_error(__('You do not have permission to edit this event.'), E_USER_ERROR);
     }
     $token_id = uniqid();
     $token_field = '<input type="hidden" name="token_id" value="' . $token_id . '" />';
     $token = Kit::Token($token_id);
     Theme::Set('form_id', 'EditEventForm');
     Theme::Set('form_action', 'index.php?p=schedule&q=EditEvent');
     Theme::Set('form_meta', $token_field . $token . '<input type="hidden" id="EventID" name="EventID" value="' . $eventID . '" />');
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('repeats', __('Repeats'));
     Theme::Set('form_tabs', $tabs);
     $formFields = array();
     // 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['general'][] = 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")));
     // Time controls
     $formFields['general'][] = FormManager::AddText('starttimeControl', __('Start Time'), DateManager::getLocalDate($fromDT), __('Select the start time for this event'), 's', 'required');
     $formFields['general'][] = FormManager::AddText('endtimeControl', __('End Time'), DateManager::getLocalDate($toDT), __('Select the end time for this event'), 'e', 'required');
     // Add two hidden fields to always carry the ISO date
     $formFields['general'][] = FormManager::AddHidden('starttime', DateManager::getLocalDate($fromDT, "Y-m-d H:i", false));
     $formFields['general'][] = FormManager::AddHidden('endtime', DateManager::getLocalDate($toDT, "Y-m-d H:i", false));
     // 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['general'][] = FormManager::AddCombo('CampaignID', __('Layout / Campaign'), $campaignId, array('campaign' => $campaignOptions, 'layout' => $layoutOptions), 'id', 'value', __('Please select a Layout or Campaign for this Event to show'), 'l', '', true, '', '', '', $optionGroups);
     $formFields['general'][] = FormManager::AddNumber('DisplayOrder', __('Display Order'), $displayOrder, __('Please select the order this event should appear in relation to others when there is more than one event scheduled'), 'o');
     $formFields['general'][] = FormManager::AddCheckbox('is_priority', __('Priority'), $isPriority, __('Sets whether or not this event has priority. If set the event will be show in preference to other events.'), 'p');
     $formFields['repeats'][] = FormManager::AddCombo('rec_type', __('Repeats'), $recType, array(array('id' => '', 'name' => __('None')), array('id' => 'Minute', 'name' => __('Per Minute')), array('id' => 'Hour', 'name' => __('Hourly')), array('id' => 'Day', 'name' => __('Daily')), array('id' => 'Week', 'name' => __('Weekly')), array('id' => 'Month', 'name' => __('Monthly')), array('id' => 'Year', 'name' => __('Yearly'))), 'id', 'name', __('What type of repeat is required?'), 'r');
     $formFields['repeats'][] = FormManager::AddNumber('rec_detail', __('Repeat every'), $recDetail, __('How often does this event repeat?'), 'o', '', 'repeat-control-group');
     $formFields['repeats'][] = FormManager::AddText('rec_rangeControl', __('Until'), $recToDT == 0 ? '' : DateManager::getLocalDate($recToDT), __('When should this event stop repeating?'), 'u', '', 'repeat-control-group');
     $formFields['repeats'][] = FormManager::AddHidden('rec_range', DateManager::getLocalDate($recToDT, "Y-m-d H:i"));
     // Set some field dependencies
     $response->AddFieldAction('rec_type', 'init', '', array('.repeat-control-group' => array('display' => 'none')));
     $response->AddFieldAction('rec_type', 'init', '', array('.repeat-control-group' => array('display' => 'block')), "not");
     $response->AddFieldAction('rec_type', 'change', '', array('.repeat-control-group' => array('display' => 'none')));
     $response->AddFieldAction('rec_type', 'change', '', array('.repeat-control-group' => array('display' => 'block')), "not");
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_repeats', $formFields['repeats']);
     $response->SetFormRequestResponse(NULL, __('Edit Event'), '800px', '600px');
     $response->AddButton(__('Help'), "XiboHelpRender('index.php?p=help&q=Display&Topic=Schedule&Category=Edit')");
     $response->AddButton(__('Delete'), 'XiboFormRender("index.php?p=schedule&q=DeleteForm&EventID=' . $eventID . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#EditEventForm").attr("action", $("#EditEventForm").attr("action") + "&next=0").submit()');
     $response->callBack = 'setupScheduleForm';
     $response->Respond();
 }
Ejemplo n.º 9
0
 /**
  * Return the Edit Form as HTML
  * @return
  */
 public function EditForm()
 {
     $this->response = new ResponseManager();
     // Edit calls are the same as add calls, except you will to check the user has permissions to do the edit
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this assignment.');
         $this->response->keepOpen = false;
         return $this->response;
     }
     // All forms should set some meta data about the form.
     // Usually, you would want this meta data to remain the same.
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=EditMedia');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $this->layoutid . '"><input type="hidden" id="iRegionId" name="regionid" value="' . $this->regionid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" /><input type="hidden" id="mediaid" name="mediaid" value="' . $this->mediaid . '">');
     // Augment settings with templates
     $this->loadTemplates();
     // Two tabs
     $tabs = array();
     $tabs[] = FormManager::AddTab('general', __('General'));
     $tabs[] = FormManager::AddTab('advanced', __('Appearance'));
     $tabs[] = FormManager::AddTab('forecast', __('Forecast'));
     Theme::Set('form_tabs', $tabs);
     $formFields['general'][] = FormManager::AddText('name', __('Name'), $this->GetOption('name'), __('An optional name for this media'), 'n');
     $formFields['general'][] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed.'), 'd', 'required');
     $formFields['general'][] = FormManager::AddCheckbox('useDisplayLocation', __('Use the Display Location'), $this->GetOption('useDisplayLocation'), __('Use the location configured on the display'), 'd');
     // Any values for the form fields should be added to the theme here.
     $formFields['general'][] = FormManager::AddNumber('latitude', __('Latitude'), $this->GetOption('latitude'), __('The Latitude for this weather module'), 'l', '', 'locationControls');
     $formFields['general'][] = FormManager::AddNumber('longitude', __('Longitude'), $this->GetOption('longitude'), __('The Longitude for this weather module'), 'g', '', 'locationControls');
     $formFields['advanced'][] = FormManager::AddCombo('templateId', __('Weather Template'), $this->GetOption('templateId'), $this->settings['templates'], 'id', 'value', __('Select the template you would like to apply. This can be overridden using the check box below.'), 't', 'template-selector-control');
     $formFields['advanced'][] = FormManager::AddCombo('icons', __('Icons'), $this->GetOption('icons'), $this->iconsAvailable(), 'id', 'value', __('Select the icon set you would like to use.'), 't', 'icon-controls');
     $formFields['advanced'][] = FormManager::AddNumber('size', __('Size'), $this->GetOption('size', 1), __('Set the size. Start at 1 and work up until the widget fits your region appropriately.'), 's', 'number', 'template-selector-control');
     $formFields['advanced'][] = FormManager::AddCombo('units', __('Units'), $this->GetOption('units'), $this->unitsAvailable(), 'id', 'value', __('Select the units you would like to use.'), 'u');
     $formFields['advanced'][] = FormManager::AddCombo('lang', __('Language'), $this->GetOption('lang', TranslationEngine::GetLocale(2)), $this->supportedLanguages(), 'id', 'value', __('Select the language you would like to use.'), 'l');
     $formFields['advanced'][] = FormManager::AddNumber('updateInterval', __('Update Interval (mins)'), $this->GetOption('updateInterval', 60), __('Please enter the update interval in minutes. This should be kept as high as possible. For example, if the data will only change once per hour this could be set to 60.'), 'n', 'required');
     $formFields['advanced'][] = FormManager::AddCheckbox('dayConditionsOnly', __('Only show Daytime weather conditions'), $this->GetOption('dayConditionsOnly', 1), __('Tick if you would like to only show the Daytime weather conditions.'), 'd');
     $formFields['general'][] = FormManager::AddText('color', __('Colour'), $this->GetOption('color', '000'), __('Please select a colour for the foreground text.'), 'c', 'required');
     $formFields['advanced'][] = FormManager::AddCheckbox('overrideTemplate', __('Override the template?'), $this->GetOption('overrideTemplate'), __('Tick if you would like to override the template.'), 'o');
     $formFields['advanced'][] = FormManager::AddMultiText('currentTemplate', __('Template for Current Forecast'), $this->GetRawNode('currentTemplate'), __('Enter the template for the current forecast. For a list of substitutions click "Request Forecast" below.'), 't', 10, 'required', 'template-override-controls');
     $formFields['advanced'][] = FormManager::AddMultiText('dailyTemplate', __('Template for Daily Forecast'), $this->GetRawNode('dailyTemplate'), __('Enter the template for the current forecast. Replaces [dailyForecast] in main template.'), 't', 10, NULL, 'template-override-controls');
     $formFields['advanced'][] = FormManager::AddMultiText('styleSheet', __('CSS Style Sheet'), $this->GetRawNode('styleSheet'), __('Enter a CSS style sheet to style the weather widget'), 'c', 10, 'required', 'template-override-controls');
     $formFields['forecast'][] = FormManager::AddMessage(__('Please press Request Forecast to show the current forecast and all available substitutions.'));
     // Encode up the template
     if (Config::GetSetting('SERVER_MODE') == 'Test' && $this->user->usertypeid == 1) {
         $formFields['forecast'][] = FormManager::AddMessage('<pre>' . htmlentities(json_encode(array('id' => 'ID', 'value' => 'TITLE', 'main' => $this->GetRawNode('currentTemplate'), 'daily' => $this->GetRawNode('dailyTemplate'), 'css' => $this->GetRawNode('styleSheet')))) . '</pre>');
     }
     // Configure the field dependencies
     $this->SetFieldDepencencies();
     // Append the Templates to the response
     $this->response->extra = $this->settings['templates'];
     // Modules should be rendered using the theme engine.
     Theme::Set('form_fields_general', $formFields['general']);
     Theme::Set('form_fields_advanced', $formFields['advanced']);
     Theme::Set('form_fields_forecast', $formFields['forecast']);
     $this->response->html = Theme::RenderReturn('form_render');
     $this->response->dialogTitle = __('Forecast IO');
     $this->response->callBack = 'forecastIoFormSetup';
     // The response object outputs the required JSON object to the browser
     // which is then processed by the CMS JavaScript library (xibo-cms.js).
     $this->response->AddButton(__('Request Forecast'), 'requestTab("forecast", "index.php?p=module&q=exec&mod=' . $this->type . '&method=requestTab&layoutid=' . $this->layoutid . '&regionid=' . $this->regionid . '&mediaid=' . $this->mediaid . '")');
     $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $this->layoutid . '&regionid=' . $this->regionid . '&q=RegionOptions")');
     $this->response->AddButton(__('Apply'), 'XiboDialogApply("#ModuleForm")');
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     // The response must be returned.
     return $this->response;
 }
Ejemplo n.º 10
0
 * any later version. 
 *
 * Xibo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 */
defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
// Are we tabs?
$form_tabs = Theme::Get('form_tabs');
$tabs = is_array($form_tabs) && count($form_tabs > 0);
if (!$tabs) {
    $form_tabs = array(FormManager::AddTab('general', 'General'));
}
if (Theme::Get('header_text') != '') {
}
?>
<div class="widget">
    <div class="widget-title"><?php 
echo Theme::Get('header_text');
?>
</div>
    <div class="widget-body">
        <?php 
echo Theme::Get('prepend');
?>
        <div class="XiboGrid" id="<?php 
echo Theme::Get('id');
Ejemplo n.º 11
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;
 }
Ejemplo n.º 12
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;
 }
Ejemplo n.º 13
0
 /**
  * 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;
 }