Ejemplo n.º 1
0
 /**
  * Shows the Time Information
  * @return 
  */
 function ShowTimeInfo()
 {
     $response = new ResponseManager();
     $output = '<ul>';
     $output .= '<li>' . __('Local Time') . ': ' . DateManager::getClock() . '</li>';
     $output .= '<li>' . __('System Time') . ': ' . DateManager::getSystemClock() . '</li>';
     $output .= '<li>' . __('Local Date') . ': ' . DateManager::getLocalDate() . '</li>';
     $output .= '<li>' . __('System Date') . ': ' . DateManager::getSystemDate() . '</li>';
     $output .= '</ul>';
     $response->SetFormRequestResponse($output, __('Date / Time Information'), '480px', '240px');
     $response->Respond();
 }
Ejemplo n.º 2
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::getSystemDate($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.º 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::getSystemDate($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();
 }