/** * Gets the Time * @return */ function GetClock() { $db =& $this->db; $response = new ResponseManager(); $output = DateManager::GetClock(); $response->SetFormRequestResponse($output, __('Date / Time Information'), '480px', '240px'); $response->clockUpdate = true; $response->success = false; $response->Respond(); }
/** * Shows the Members of a Group */ public function MembersForm() { $db =& $this->db; $response = new ResponseManager(); $groupID = Kit::GetParam('groupid', _REQUEST, _INT); // There needs to be two lists here. // Set some information about the form Theme::Set('users_assigned_id', 'usersIn'); Theme::Set('users_available_id', 'usersOut'); Theme::Set('users_assigned_url', 'index.php?p=group&q=SetMembers&GroupID=' . $groupID); // Users in group $SQL = ""; $SQL .= "SELECT user.UserID, "; $SQL .= " user.UserName, "; $SQL .= " CONCAT('UserID_', user.userID) AS list_id "; $SQL .= "FROM `user` "; $SQL .= " INNER JOIN lkusergroup "; $SQL .= " ON lkusergroup.UserID = user.UserID "; $SQL .= sprintf("WHERE lkusergroup.GroupID = %d", $groupID); $usersAssigned = $db->GetArray($SQL); if (!is_array($usersAssigned)) { trigger_error($db->error()); trigger_error(__('Error getting users'), E_USER_ERROR); } Theme::Set('users_assigned', $usersAssigned); // Users not in group $SQL = ""; $SQL .= "SELECT user.UserID, "; $SQL .= " user.UserName, "; $SQL .= " CONCAT('UserID_', user.userID) AS list_id "; $SQL .= "FROM `user` "; $SQL .= " WHERE user.UserID NOT IN ( "; $SQL .= " SELECT user.UserID "; $SQL .= " FROM `user` "; $SQL .= " INNER JOIN lkusergroup "; $SQL .= " ON lkusergroup.UserID = user.UserID "; $SQL .= sprintf("WHERE lkusergroup.GroupID = %d", $groupID); $SQL .= " )"; $usersAvailable = $db->GetArray($SQL); if (!is_array($usersAvailable)) { trigger_error($db->error()); trigger_error(__('Error getting users'), E_USER_ERROR); } Theme::Set('users_available', $usersAvailable); $form = Theme::RenderReturn('usergroup_form_user_assign'); $response->SetFormRequestResponse($form, __('Manage Membership'), '400', '375', 'ManageMembersCallBack'); $response->AddButton(__('Help'), "XiboHelpRender('" . HelpManager::Link('UserGroup', 'Members') . "')"); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), 'MembersSubmit()'); $response->Respond(); }
/** * Shows the Delete Group Form */ function DeleteForm() { $displayProfile = new DisplayProfile(); $displayProfile->displayProfileId = Kit::GetParam('displayprofileid', _GET, _INT); if (!$displayProfile->Load()) { trigger_error($displayProfile->GetErrorMessage(), E_USER_ERROR); } if ($this->user->usertypeid != 1 && $this->user->userid != $displayProfile->userId) { trigger_error(__('You do not have permission to edit this profile'), E_USER_ERROR); } // Set some information about the form Theme::Set('form_id', 'DisplayProfileDeleteForm'); Theme::Set('form_action', 'index.php?p=displayprofile&q=Delete'); Theme::Set('form_meta', '<input type="hidden" name="displayprofileid" value="' . $displayProfile->displayProfileId . '" />'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete?')))); $response = new ResponseManager(); $response->SetFormRequestResponse(NULL, __('Delete Display Profile'), '350px', '175px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DisplayProfile', 'Delete') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#DisplayProfileDeleteForm").submit()'); $response->Respond(); }
/** * Permissions form */ public function PermissionsForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); if (!$this->auth->modifyPermissions) { trigger_error(__('You do not have permissions to edit this media'), E_USER_ERROR); } // List of all Groups with a view / edit / delete check box $permissions = new UserGroup(); if ($this->assignedMedia) { if (!($result = $permissions->GetPermissionsForObject('lklayoutmediagroup', NULL, NULL, sprintf(" AND lklayoutmediagroup.MediaID = '%s' AND lklayoutmediagroup.RegionID = '%s' AND lklayoutmediagroup.LayoutID = %d ", $this->mediaid, $this->regionid, $this->layoutid)))) { trigger_error($permissions->GetErrorMessage(), E_USER_ERROR); } } else { if (!($result = $permissions->GetPermissionsForObject('lkmediagroup', 'MediaID', $this->mediaid))) { trigger_error($permissions->GetErrorMessage(), E_USER_ERROR); } } if (count($result) <= 0) { trigger_error(__('Unable to get permissions'), E_USER_ERROR); } $checkboxes = array(); foreach ($result as $row) { $groupId = $row['groupid']; $rowClass = $row['isuserspecific'] == 0 ? 'strong_text' : ''; $checkbox = array('id' => $groupId, 'name' => Kit::ValidateParam($row['group'], _STRING), 'class' => $rowClass, 'value_view' => $groupId . '_view', 'value_view_checked' => $row['view'] == 1 ? 'checked' : '', 'value_edit' => $groupId . '_edit', 'value_edit_checked' => $row['edit'] == 1 ? 'checked' : '', 'value_del' => $groupId . '_del', 'value_del_checked' => $row['del'] == 1 ? 'checked' : ''); $checkboxes[] = $checkbox; } $formFields = array(); $formFields[] = FormManager::AddPermissions('groupids[]', $checkboxes); Theme::Set('form_fields', $formFields); // Set some information about the form Theme::Set('form_id', 'LayoutPermissionsForm'); Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=Permissions'); Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $this->layoutid . '" /><input type="hidden" name="regionid" value="' . $this->regionid . '" /><input type="hidden" name="mediaid" value="' . $this->mediaid . '" />'); $response->SetFormRequestResponse(NULL, __('Permissions'), '350px', '500px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . ($this->layoutid != 0 ? $helpManager->Link('LayoutMedia', 'Permissions') : $helpManager->Link('Media', 'Permissions')) . '")'); if ($this->assignedMedia) { $response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $this->layoutid . '®ionid=' . $this->regionid . '&q=RegionOptions")'); } else { $response->AddButton(__('Cancel'), 'XiboDialogClose()'); } $response->AddButton(__('Save'), '$("#LayoutPermissionsForm").submit()'); return $response; }
/** * Edit Form */ public function EditForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); // Can we edit? if (Config::GetSetting('MODULE_CONFIG_LOCKED_CHECKB') == 'Checked') { trigger_error(__('Module Config Locked'), E_USER_ERROR); } $moduleId = Kit::GetParam('ModuleID', _GET, _INT); // Pull the currently known info from the DB $SQL = ''; $SQL .= 'SELECT ModuleID, '; $SQL .= ' Name, '; $SQL .= ' Enabled, '; $SQL .= ' Description, '; $SQL .= ' RegionSpecific, '; $SQL .= ' ValidExtensions, '; $SQL .= ' ImageUri, '; $SQL .= ' PreviewEnabled '; $SQL .= ' FROM `module` '; $SQL .= ' WHERE ModuleID = %d '; $SQL = sprintf($SQL, $moduleId); if (!($row = $db->GetSingleRow($SQL))) { trigger_error($db->error()); trigger_error(__('Error getting Module')); } Theme::Set('validextensions', Kit::ValidateParam($row['ValidExtensions'], _STRING)); Theme::Set('imageuri', Kit::ValidateParam($row['ImageUri'], _STRING)); Theme::Set('isregionspecific', Kit::ValidateParam($row['RegionSpecific'], _INT)); Theme::Set('enabled_checked', Kit::ValidateParam($row['Enabled'], _INT) ? 'checked' : ''); Theme::Set('preview_enabled_checked', Kit::ValidateParam($row['PreviewEnabled'], _INT) ? 'checked' : ''); // Set some information about the form Theme::Set('form_id', 'ModuleEditForm'); Theme::Set('form_action', 'index.php?p=module&q=Edit'); Theme::Set('form_meta', '<input type="hidden" name="ModuleID" value="' . $moduleId . '" />'); $form = Theme::RenderReturn('module_form_edit'); $response->SetFormRequestResponse($form, __('Edit Module'), '350px', '325px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Module', 'Edit') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#ModuleEditForm").submit()'); $response->Respond(); }
public function ImportForm() { global $session; $db =& $this->db; $response = new ResponseManager(); // Set the Session / Security information $sessionId = session_id(); $securityToken = CreateFormToken(); $session->setSecurityToken($securityToken); // Find the max file size $maxFileSizeBytes = convertBytes(ini_get('upload_max_filesize')); // Set some information about the form Theme::Set('form_id', 'LayoutImportForm'); Theme::Set('form_action', 'index.php?p=layout&q=Import'); Theme::Set('form_meta', '<input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /><input type="hidden" name="hidFileID" id="hidFileID" value="" /><input type="hidden" name="template" value="' . Kit::GetParam('template', _GET, _STRING, 'false') . '" />'); Theme::Set('form_upload_id', 'file_upload'); Theme::Set('form_upload_action', 'index.php?p=content&q=FileUpload'); Theme::Set('form_upload_meta', '<input type="hidden" id="PHPSESSID" value="' . $sessionId . '" /><input type="hidden" id="SecurityToken" value="' . $securityToken . '" /><input type="hidden" name="MAX_FILE_SIZE" value="' . $maxFileSizeBytes . '" />'); Theme::Set('prepend', Theme::RenderReturn('form_file_upload_single')); $formFields = array(); $formFields[] = FormManager::AddText('layout', __('Name'), NULL, __('The Name of the Layout - (1 - 50 characters). Leave blank to use the name from the import.'), 'n'); $formFields[] = FormManager::AddCheckbox('replaceExisting', __('Replace Existing Media?'), NULL, __('If the import finds existing media with the same name, should it be replaced in the Layout or should the Layout use that media.'), 'r'); if (Kit::GetParam('template', _GET, _STRING, 'false') != 'true') { $formFields[] = FormManager::AddCheckbox('importTags', __('Import Tags?'), NULL, __('Would you like to import any tags contained on the layout.'), 't'); } Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Import Layout'), '350px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DataSet', 'ImportCsv') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Import'), '$("#LayoutImportForm").submit()'); $response->Respond(); }
/** * Edit Form */ public function VerifyForm() { $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager(NULL, $user); // Set some information about the form Theme::Set('form_id', 'VerifyForm'); Theme::Set('form_action', 'index.php?p=module&q=Verify'); $formFields = array(); $formFields[] = FormManager::AddMessage(__('Verify all modules have been installed correctly by reinstalling any module related files')); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Verify'), '350px', '325px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Module', 'Edit') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Verify'), '$("#VerifyForm").submit()'); $response->Respond(); }
public function RegionPermissionsForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); $layoutid = Kit::GetParam('layoutid', _GET, _INT); $regionid = Kit::GetParam('regionid', _GET, _STRING); Kit::ClassLoader('region'); $region = new region($db); $ownerId = $region->GetOwnerId($layoutid, $regionid); $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutid, $regionid, true); if (!$regionAuth->modifyPermissions) { trigger_error(__("You do not have permissions to edit this regions permissions"), E_USER_ERROR); } // Form content $form = '<form id="RegionPermissionsForm" class="XiboForm" method="post" action="index.php?p=timeline&q=RegionPermissions">'; $form .= '<input type="hidden" name="layoutid" value="' . $layoutid . '" />'; $form .= '<input type="hidden" name="regionid" value="' . $regionid . '" />'; $form .= '<div class="dialog_table">'; $form .= ' <table style="width:100%">'; $form .= ' <tr>'; $form .= ' <th>' . __('Group') . '</th>'; $form .= ' <th>' . __('View') . '</th>'; $form .= ' <th>' . __('Edit') . '</th>'; $form .= ' <th>' . __('Delete') . '</th>'; $form .= ' </tr>'; // List of all Groups with a view/edit/delete checkbox $SQL = ''; $SQL .= 'SELECT `group`.GroupID, `group`.`Group`, View, Edit, Del, `group`.IsUserSpecific '; $SQL .= ' FROM `group` '; $SQL .= ' LEFT OUTER JOIN lklayoutregiongroup '; $SQL .= ' ON lklayoutregiongroup.GroupID = group.GroupID '; $SQL .= ' AND lklayoutregiongroup.LayoutID = %d '; $SQL .= " AND lklayoutregiongroup.RegionID = '%s' "; $SQL .= ' WHERE `group`.GroupID <> %d '; $SQL .= 'ORDER BY `group`.IsEveryone DESC, `group`.IsUserSpecific, `group`.`Group` '; $SQL = sprintf($SQL, $layoutid, $regionid, $user->getGroupFromId($user->userid, true)); if (!($results = $db->query($SQL))) { trigger_error($db->error()); trigger_error(__('Unable to get permissions for this layout region'), E_USER_ERROR); } while ($row = $db->get_assoc_row($results)) { $groupId = $row['GroupID']; $group = $row['IsUserSpecific'] == 0 ? '<strong>' . $row['Group'] . '</strong>' : $row['Group']; $form .= '<tr>'; $form .= ' <td>' . $group . '</td>'; $form .= ' <td><input type="checkbox" name="groupids[]" value="' . $groupId . '_view" ' . ($row['View'] == 1 ? 'checked' : '') . '></td>'; $form .= ' <td><input type="checkbox" name="groupids[]" value="' . $groupId . '_edit" ' . ($row['Edit'] == 1 ? 'checked' : '') . '></td>'; $form .= ' <td><input type="checkbox" name="groupids[]" value="' . $groupId . '_del" ' . ($row['Del'] == 1 ? 'checked' : '') . '></td>'; $form .= '</tr>'; } $form .= '</table>'; $form .= '</div>'; $form .= '</form>'; $response->SetFormRequestResponse($form, __('Permissions'), '350px', '500px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Region', 'Permissions') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#RegionPermissionsForm").submit()'); $response->Respond(); }
public function VersionInstructionsForm() { $response = new ResponseManager(); $displayGroupId = Kit::GetParam('displaygroupid', _GET, _INT); $displayId = Kit::GetParam('displayid', _GET, _INT); Theme::Set('installer_file_id', 0); // List of effected displays $rows = array(); if ($displayId != 0) { // Get some version information about this display. if (!($displays = $this->user->DisplayList(array('display'), array('displayid' => $displayId)))) { trigger_error(__('Unknown Display'), E_USER_ERROR); } } else { // Get a list of displays with their version information? if (!($displays = $this->user->DisplayList(array('display'), array('displaygroupid' => $displayGroupId)))) { trigger_error(__('No displays in this group'), E_USER_ERROR); } } foreach ($displays as $display) { $rows[] = array('display' => Theme::Prepare($display['display']), 'client_type' => Theme::Prepare($display['client_type']), 'client_version' => Theme::Prepare($display['client_version']), 'client_code' => Theme::Prepare($display['client_code'])); } // Store this for use in the theme Theme::Set('displays', $displays); // Present a list of possible files to choose from (generic file module) $mediaList = $this->user->MediaList('genericfile'); array_unshift($mediaList, array('mediaid' => 0, 'media' => '')); Theme::Set('media_field_list', $mediaList); // Set some information about the form Theme::Set('form_id', 'VersionInstructions'); Theme::Set('form_action', 'index.php?p=displaygroup&q=VersionInstructions'); Theme::Set('form_meta', '<input type="hidden" name="displaygroupid" value="' . $displayGroupId . '">'); $form = Theme::RenderReturn('display_form_version_instructions'); $response->SetFormRequestResponse($form, __('Set Instructions for Upgrading this client'), '300px', '250px'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#VersionInstructions").submit()'); $response->Respond(); }
/** * Delete Help Link Form */ public function DeleteForm() { $db =& $this->db; $response = new ResponseManager(); $helpId = Kit::GetParam('HelpID', _REQUEST, _INT); // Set some information about the form Theme::Set('form_id', 'HelpDeleteForm'); Theme::Set('form_action', 'index.php?p=help&q=Delete'); Theme::Set('form_meta', '<input type="hidden" name="HelpID" value="' . $helpId . '" />'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete?')))); $response->SetFormRequestResponse(NULL, __('Delete Help Link'), '350px', '175px'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#HelpDeleteForm").submit()'); $response->Respond(); }
/** * Form for wake on Lan */ public function WakeOnLanForm() { $db =& $this->db; $response = new ResponseManager(); $displayId = Kit::GetParam('DisplayId', _GET, _INT); // Get the MAC Address $macAddress = $db->GetSingleValue(sprintf("SELECT MacAddress FROM `display` WHERE DisplayID = %d", $displayId), 'MacAddress', _STRING); if (!$macAddress || $macAddress == '') { trigger_error(__('This display has no mac address recorded against it yet. Make sure the display is running.'), E_USER_ERROR); } // Set some information about the form Theme::Set('form_id', 'WakeOnLanForm'); Theme::Set('form_action', 'index.php?p=display&q=WakeOnLan'); Theme::Set('form_meta', '<input type="hidden" name="DisplayId" value="' . $displayId . '"><input type="hidden" name="MacAddress" value="' . $macAddress . '">'); $form = Theme::RenderReturn('display_form_wakeonlan'); $response->SetFormRequestResponse($form, __('Wake On Lan'), '300px', '250px'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Send'), '$("#WakeOnLanForm").submit()'); $response->Respond(); }
public function OutputCsvForm() { $response = new ResponseManager(); Theme::Set('form_id', 'OutputCsvForm'); Theme::Set('form_action', 'index.php?p=stats&q=OutputCSV'); $formFields = array(); $formFields[] = FormManager::AddText('fromdt', __('From Date'), DateManager::getLocalDate(time() - 86400 * 35, 'Y-m-d'), NULL, 'f'); $formFields[] = FormManager::AddText('todt', __('To Date'), DateManager::getLocalDate(null, 'Y-m-d'), NULL, 't'); // List of Displays this user has permission for $displays = $this->user->DisplayGroupList(1); array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All')); $formFields[] = FormManager::AddCombo('displayid', __('Display'), NULL, $displays, 'displayid', 'displaygroup', NULL, 'd'); Theme::Set('header_text', __('Bandwidth')); Theme::Set('form_fields', $formFields); Theme::Set('form_class', 'XiboManualSubmit'); $response->SetFormRequestResponse(NULL, __('Export Statistics'), '550px', '275px'); $response->AddButton(__('Export'), '$("#OutputCsvForm").submit()'); $response->AddButton(__('Close'), 'XiboDialogClose()'); $response->Respond(); }
public function TruncateForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); if ($this->user->usertypeid != 1) { trigger_error(__('Only Administrator Users can truncate the log'), E_USER_ERROR); } // Set some information about the form Theme::Set('form_id', 'TruncateForm'); Theme::Set('form_action', 'index.php?p=log&q=Truncate'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to truncate?')))); $response->SetFormRequestResponse(NULL, __('Truncate Log'), '430px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Log', 'Truncate') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#TruncateForm").submit()'); $response->Respond(); }
/** * Show an upload form to restore a database dump file */ public function RestoreForm() { $response = new ResponseManager(); if (Config::GetSetting('SETTING_IMPORT_ENABLED') != 'On') { trigger_error(__('Sorry this function is disabled.'), E_USER_ERROR); } // Check we have permission to do this if ($this->user->usertypeid != 1) { trigger_error(__('Only an adminitrator can import a database')); } $msgDumpFile = __('Backup File'); $msgWarn = __('Warning: Importing a file here will overwrite your existing database. This action cannot be reversed.'); $msgMore = __('Select a file to import and then click the import button below. You will be taken to another page where the file will be imported.'); $msgInfo = __('Please note: The folder location for mysqldump must be available in your path environment variable for this to work and the php "exec" command must be enabled.'); $form = <<<FORM <p>{$msgWarn}</p> <p>{$msgInfo}</p> <form id="file_upload" method="post" action="index.php?p=admin&q=RestoreDatabase" enctype="multipart/form-data"> <table> <tr> <td><label for="file">{$msgDumpFile}<span class="required">*</span></label></td> <td> <input type="file" name="dumpFile" /> </td> </tr> </table> </form> <p>{$msgMore}</p> FORM; $response->SetFormRequestResponse($form, __('Import Database Backup'), '550px', '375px'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Import'), '$("#file_upload").submit()'); $response->Respond(); }
/** * Resolution Delete Form */ function DeleteForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $resolutionid = Kit::GetParam('resolutionid', _GET, _INT); // Set some information about the form Theme::Set('form_id', 'DeleteForm'); Theme::Set('form_action', 'index.php?p=resolution&q=Delete'); Theme::Set('form_meta', '<input type="hidden" name="resolutionid" value="' . $resolutionid . '" />'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete?')))); $response->SetFormRequestResponse(Theme::RenderReturn('form_render'), __('Delete Resolution'), '250px', '150px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Delete') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#DeleteForm").submit()'); $response->Respond(); }
public function ImportCsvForm() { global $session; $db =& $this->db; $response = new ResponseManager(); $dataSetId = Kit::GetParam('datasetid', _GET, _INT); $dataSet = Kit::GetParam('dataset', _GET, _STRING); $auth = $this->user->DataSetAuth($dataSetId, true); if (!$auth->edit) { trigger_error(__('Access Denied'), E_USER_ERROR); } // Set the Session / Security information $sessionId = session_id(); $securityToken = CreateFormToken(); $session->setSecurityToken($securityToken); // Find the max file size $maxFileSizeBytes = convertBytes(ini_get('upload_max_filesize')); // Set some information about the form Theme::Set('form_id', 'DataSetImportCsvForm'); Theme::Set('form_action', 'index.php?p=dataset&q=ImportCsv'); Theme::Set('form_meta', '<input type="hidden" name="dataset" value="' . $dataSet . '" /><input type="hidden" name="datasetid" value="' . $dataSetId . '" /><input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /><input type="hidden" name="hidFileID" id="hidFileID" value="" />'); Theme::Set('form_upload_id', 'file_upload'); Theme::Set('form_upload_action', 'index.php?p=content&q=FileUpload'); Theme::Set('form_upload_meta', '<input type="hidden" id="PHPSESSID" value="' . $sessionId . '" /><input type="hidden" id="SecurityToken" value="' . $securityToken . '" /><input type="hidden" name="MAX_FILE_SIZE" value="' . $maxFileSizeBytes . '" />'); // Enumerate over the columns in the DataSet and offer a column mapping for each one (from the file) $SQL = ""; $SQL .= "SELECT DataSetColumnID, Heading "; $SQL .= " FROM datasetcolumn "; $SQL .= sprintf(" WHERE DataSetID = %d ", $dataSetId); $SQL .= " AND DataSetColumnTypeID = 1 "; $SQL .= "ORDER BY ColumnOrder "; // Load results into an array $dataSetColumns = $db->GetArray($SQL); if (!is_array($dataSetColumns)) { trigger_error($db->error()); trigger_error(__('Error getting list of dataSetColumns'), E_USER_ERROR); } $rows = array(); $i = 0; foreach ($dataSetColumns as $row) { $i++; $row['heading'] = Kit::ValidateParam($row['Heading'], _STRING); $row['formfieldid'] = 'csvImport_' . Kit::ValidateParam($row['DataSetColumnID'], _INT); $row['auto_column_number'] = $i; $rows[] = $row; } Theme::Set('fields', $rows); $form = Theme::RenderReturn('dataset_form_csv_import'); $response->SetFormRequestResponse($form, __('CSV Import'), '350px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DataSet', 'ImportCsv') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Import'), '$("#DataSetImportCsvForm").submit()'); $response->Respond(); }
public function tidyLibraryForm() { $response = new ResponseManager(); Theme::Set('form_id', 'TidyLibraryForm'); Theme::Set('form_action', 'index.php?p=content&q=tidyLibrary'); $formFields = array(); $formFields[] = FormManager::AddMessage(__('Tidying your Library will delete any media that is not currently in use.')); // Work out how many files there are $media = Media::entriesUnusedForUser($this->user->userid); $formFields[] = FormManager::AddMessage(sprintf(__('There is %s of data stored in %d files . Are you sure you want to proceed?', Kit::formatBytes(array_sum(array_map(function ($element) { return $element['fileSize']; }, $media))), count($media)))); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Tidy Library'), '350px', '275px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Content', 'TidyLibrary') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#TidyLibraryForm").submit()'); $response->Respond(); }
public function TidyLibraryForm() { $response = new ResponseManager(); Theme::Set('form_id', 'TidyLibraryForm'); Theme::Set('form_action', 'index.php?p=admin&q=TidyLibrary'); $formFields = array(); $formFields[] = FormManager::AddMessage(__('Tidying the Library will delete any temporary files. Are you sure you want to proceed?')); // Check box to also delete un-used media that has been revised. $formFields[] = FormManager::AddCheckbox('tidyOldRevisions', __('Remove old revisions'), 0, __('Cleaning up old revisions of media will result in any unused media revisions being permanently deleted.'), ''); // Check box to tidy up un-used files $formFields[] = FormManager::AddCheckbox('cleanUnusedFiles', __('Remove all media not currently in use?'), 0, __('Selecting this option will remove any media that is not currently being used in Layouts or linked to Displays. This process cannot be reversed.'), ''); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Tidy Library'), '350px', '275px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Settings', 'TidyLibrary') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#TidyLibraryForm").submit()'); $response->Respond(); }
/** * Shows the form to delete a template */ public function DeleteTemplateForm() { $response = new ResponseManager(); $templateId = Kit::GetParam('layoutid', _GET, _INT); $auth = $this->user->TemplateAuth($templateId, true); if (!$auth->del) { trigger_error(__('You do not have permissions to delete this template'), E_USER_ERROR); } Theme::Set('form_id', 'DeleteForm'); Theme::Set('form_action', 'index.php?p=template&q=DeleteTemplate'); Theme::Set('form_meta', '<input type="hidden" name="templateId" value="' . $templateId . '">'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete this template?')))); $form = Theme::RenderReturn('form_render'); $response->SetFormRequestResponse($form, __('Delete Template'), '300px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Template', 'Delete') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#DeleteForm").submit()'); $response->Respond(); }
/** * Copy layout form */ public function CopyForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $layoutid = Kit::GetParam('layoutid', _REQUEST, _INT); $oldLayout = Kit::GetParam('oldlayout', _REQUEST, _STRING); $copyMediaChecked = Config::GetSetting('LAYOUT_COPY_MEDIA_CHECKB') == 'Checked' ? 'checked' : ''; Theme::Set('form_id', 'LayoutCopyForm'); Theme::Set('form_action', 'index.php?p=layout&q=Copy'); Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '">'); Theme::Set('copy_media_checked', $copyMediaChecked); Theme::Set('new_layout_default', $oldLayout . ' 2'); $form = Theme::RenderReturn('layout_form_copy'); $response->SetFormRequestResponse($form, __('Copy a Layout.'), '350px', '275px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Layout', 'Copy') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Copy'), '$("#LayoutCopyForm").submit()'); $response->Respond(); }
/** * Permissions form */ public function PermissionsForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); $templateId = Kit::GetParam('templateid', _GET, _INT); if ($templateId == 0) { trigger_error(__('No template selected'), E_USER_ERROR); } // Is this user allowed to delete this template? $auth = $this->user->TemplateAuth($templateId, true); // Set some information about the form Theme::Set('form_id', 'TemplatePermissionsForm'); Theme::Set('form_action', 'index.php?p=template&q=Permissions'); Theme::Set('form_meta', '<input type="hidden" name="templateid" value="' . $templateId . '" />'); // List of all Groups with a view/edit/delete checkbox $SQL = ''; $SQL .= 'SELECT `group`.GroupID, `group`.`Group`, View, Edit, Del, `group`.IsUserSpecific '; $SQL .= ' FROM `group` '; $SQL .= ' LEFT OUTER JOIN lktemplategroup '; $SQL .= ' ON lktemplategroup.GroupID = group.GroupID '; $SQL .= ' AND lktemplategroup.TemplateID = %d '; $SQL .= ' WHERE `group`.GroupID <> %d '; $SQL .= 'ORDER BY `group`.IsEveryone DESC, `group`.IsUserSpecific, `group`.`Group` '; $SQL = sprintf($SQL, $templateId, $user->getGroupFromId($user->userid, true)); if (!($results = $db->query($SQL))) { trigger_error($db->error()); trigger_error(__('Unable to get permissions for this template'), E_USER_ERROR); } $checkboxes = array(); while ($row = $db->get_assoc_row($results)) { $groupId = $row['GroupID']; $rowClass = $row['IsUserSpecific'] == 0 ? 'strong_text' : ''; $checkbox = array('id' => $groupId, 'name' => Kit::ValidateParam($row['Group'], _STRING), 'class' => $rowClass, 'value_view' => $groupId . '_view', 'value_view_checked' => $row['View'] == 1 ? 'checked' : '', 'value_edit' => $groupId . '_edit', 'value_edit_checked' => $row['Edit'] == 1 ? 'checked' : '', 'value_del' => $groupId . '_del', 'value_del_checked' => $row['Del'] == 1 ? 'checked' : ''); $checkboxes[] = $checkbox; } Theme::Set('form_rows', $checkboxes); $form = Theme::RenderReturn('campaign_form_permissions'); $response->SetFormRequestResponse($form, __('Permissions'), '350px', '500px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Template', 'Permissions') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#TemplatePermissionsForm").submit()'); $response->Respond(); }
/** * Shows the DeleteEvent form * @return */ function DeleteDayForm() { $response = new ResponseManager(); $date = Kit::GetParam('date', _GET, _INT, 0); $dateString = date('Y-m-d', $date); if ($date == 0) { trigger_error(__('Day not selected'), E_USER_ERROR); } $strQuestion = __('Are you sure you want to delete all events that intersect this day from <b>all</b> displays?'); $strAdvice = __('This action cannot be undone.'); $token = Kit::Token(); $form = <<<END <form id="DeleteDayForm" class="XiboForm" action="index.php?p=schedule&q=DeleteDay"> {$token} <input type="hidden" name="date" value="{$date}"> <table> <tr> <td>{$strQuestion}</td> </tr> <tr> <td>{$strAdvice}</td> </tr> </table> </form> END; $response->SetFormRequestResponse($form, sprintf(__('Delete %s'), $dateString), '480px', '240px'); $response->AddButton(__('Help'), "XiboHelpRender('index.php?p=help&q=Display&Topic=Schedule&Category=Delete')"); $response->AddButton(__('No'), 'XiboFormRender("index.php?p=schedule&q=DayViewFilter&date=' . $date . '")'); $response->AddButton(__('Yes'), '$("#DeleteDayForm").submit()'); $response->Respond(); }
/** * Shows information about Xibo * @return */ function About() { $response = new ResponseManager(); Theme::Set('version', VERSION); // Render the Theme and output $output = Theme::RenderReturn('about_text'); $response->SetFormRequestResponse($output, __('About'), '500', '500'); $response->AddButton(__('Close'), 'XiboDialogClose()'); $response->Respond(); }
public function ScheduleNowForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $date = time(); // We might have a layout id, or a display id $campaignId = Kit::GetParam('CampaignID', _GET, _INT, 0); $displayGroupIds = Kit::GetParam('displayGroupId', _GET, _ARRAY); Theme::Set('form_id', 'ScheduleNowForm'); Theme::Set('form_action', 'index.php?p=schedule&q=ScheduleNow'); $formFields = array(); // Generate a list of layouts. $layouts = $user->CampaignList(NULL, false, false); $optionGroups = array(array('id' => 'campaign', 'label' => __('Campaigns')), array('id' => 'layout', 'label' => __('Layouts'))); $layoutOptions = array(); $campaignOptions = array(); foreach ($layouts as $layout) { if ($layout['islayoutspecific'] == 1) { $layoutOptions[] = array('id' => $layout['campaignid'], 'value' => $layout['campaign']); } else { $campaignOptions[] = array('id' => $layout['campaignid'], 'value' => $layout['campaign']); } } $formFields[] = FormManager::AddCombo('CampaignID', __('Layout'), $campaignId, array('campaign' => $campaignOptions, 'layout' => $layoutOptions), 'id', 'value', __('Please select a Layout or Campaign for this Event to show'), 'l', '', true, '', '', '', $optionGroups); $formFields[] = FormManager::AddText('hours', __('Hours'), NULL, __('Hours this event should be scheduled for'), 'h', ''); $formFields[] = FormManager::AddText('minutes', __('Minutes'), NULL, __('Minutes this event should be scheduled for'), 'h', ''); $formFields[] = FormManager::AddText('seconds', __('Seconds'), NULL, __('Seconds this event should be scheduled for'), 'h', ''); // List of Display Groups $optionGroups = array(array('id' => 'group', 'label' => __('Groups')), array('id' => 'display', 'label' => __('Displays'))); $groups = array(); $displays = array(); $scheduleWithView = Config::GetSetting('SCHEDULE_WITH_VIEW_PERMISSION') == 'Yes'; foreach ($this->user->DisplayGroupList(-1) as $display) { // Can schedule with view, but no view permissions if ($scheduleWithView && $display['view'] != 1) { continue; } // Can't schedule with view, but no edit permissions if (!$scheduleWithView && $display['edit'] != 1) { continue; } $display['checked_text'] = in_array($display['displaygroupid'], $displayGroupIds) ? ' selected' : ''; if ($display['isdisplayspecific'] == 1) { $displays[] = $display; } else { $groups[] = $display; } } $formFields[] = FormManager::AddMultiCombo('DisplayGroupIDs[]', __('Display'), $displayGroupIds, array('group' => $groups, 'display' => $displays), 'displaygroupid', 'displaygroup', __('Please select one or more displays / groups for this event to be shown on.'), 'd', '', true, '', '', '', $optionGroups, array(array('name' => 'data-live-search', 'value' => "true"), array('name' => 'data-selected-text-format', 'value' => "count > 4"))); $formFields[] = FormManager::AddNumber('DisplayOrder', __('Display Order'), 0, __('Should this event have an order?'), 'o', ''); $formFields[] = FormManager::AddCheckbox('is_priority', __('Priority?'), NULL, __('Sets whether or not this event has priority. If set the event will be show in preference to other events.'), 'p'); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Schedule Now'), '700px', '400px'); $response->callBack = 'setupScheduleNowForm'; $response->AddButton(__('Help'), "XiboHelpRender('index.php?p=help&q=Display&Topic=Schedule&Category=ScheduleNow')"); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#ScheduleNowForm").submit()'); $response->Respond(); }
function ConfirmLogout() { $db =& $this->db; $response = new ResponseManager(); $userid = Kit::GetParam('userid', _GET, _INT); // Set some information about the form Theme::Set('form_id', 'SessionsLogoutForm'); Theme::Set('form_action', 'index.php?p=sessions&q=LogoutUser'); Theme::Set('form_meta', '<input type="hidden" name="userid" value="' . $userid . '" />'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to logout this user?')))); $response->SetFormRequestResponse(NULL, __('Logout User'), '430px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Sessions', 'Logout') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#SessionsLogoutForm").submit()'); $response->Respond(); }
/** * Shows the Authorised applications this user has */ public function UserTokens() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $store = OAuthStore::instance(); try { $list = $store->listConsumerTokens(Kit::GetParam('userID', _GET, _INT)); } catch (OAuthException $e) { trigger_error($e->getMessage()); trigger_error(__('Error listing Log.'), E_USER_ERROR); } $rows = array(); foreach ($list as $app) { $app['application_title'] = Kit::ValidateParam($app['application_title'], _STRING); $app['enabled'] = Kit::ValidateParam($app['enabled'], _STRING); $app['status'] = Kit::ValidateParam($app['status'], _STRING); $rows[] = $app; } Theme::Set('table_rows', $rows); $output = Theme::RenderReturn('application_form_user_applications'); $response->SetFormRequestResponse($output, __('Authorized applications for user'), '650', '450'); $response->AddButton(__('Help'), "XiboHelpRender('" . HelpManager::Link('User', 'Applications') . "')"); $response->AddButton(__('Close'), 'XiboDialogClose()'); $response->Respond(); }
public function RequestScreenShotForm() { $db =& $this->db; $response = new ResponseManager(); $displayId = Kit::GetParam('displayId', _GET, _INT); // Set some information about the form Theme::Set('form_id', 'RequestScreenShotForm'); Theme::Set('form_action', 'index.php?p=display&q=RequestScreenShot'); Theme::Set('form_meta', '<input type="hidden" name="displayId" value="' . $displayId . '">'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to request a screen shot? The next time the client connects to the CMS the screen shot will be sent.')))); $response->SetFormRequestResponse(NULL, __('Request Screen Shot'), '300px', '250px'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Request'), '$("#RequestScreenShotForm").submit()'); $response->Respond(); }
/** * Delete Help Link Form */ public function DeleteForm() { $db =& $this->db; $response = new ResponseManager(); $helpId = Kit::GetParam('HelpID', _REQUEST, _INT); // Set some information about the form Theme::Set('form_id', 'HelpDeleteForm'); Theme::Set('form_action', 'index.php?p=help&q=Delete'); Theme::Set('form_meta', '<input type="hidden" name="HelpID" value="' . $helpId . '" />'); $form = Theme::RenderReturn('help_form_delete'); $response->SetFormRequestResponse($form, __('Delete Help Link'), '350px', '175px'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#HelpDeleteForm").submit()'); $response->Respond(); }
/** * Show the Permissions for this Campaign */ public function PermissionsForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $campaignId = Kit::GetParam('CampaignID', _GET, _INT); $auth = $this->user->CampaignAuth($campaignId, true); if (!$auth->modifyPermissions) { trigger_error(__('You do not have permissions to edit this campaign'), E_USER_ERROR); } // Set some information about the form Theme::Set('form_id', 'CampaignPermissionsForm'); Theme::Set('form_action', 'index.php?p=campaign&q=Permissions'); Theme::Set('form_meta', '<input type="hidden" name="campaignId" value="' . $campaignId . '" />'); // List of all Groups with a view / edit / delete check box $permissions = new CampaignSecurity(); if (!($result = $permissions->GetPermissions($campaignId))) { trigger_error($permissions->GetErrorMessage(), E_USER_ERROR); } if (count($result) <= 0) { trigger_error(__('Unable to get permissions for this Campaign'), E_USER_ERROR); } $checkboxes = array(); foreach ($result as $row) { $groupId = $row['groupid']; $rowClass = $row['isuserspecific'] == 0 ? 'strong_text' : ''; $checkbox = array('id' => $groupId, 'name' => Kit::ValidateParam($row['group'], _STRING), 'class' => $rowClass, 'value_view' => $groupId . '_view', 'value_view_checked' => $row['view'] == 1 ? 'checked' : '', 'value_edit' => $groupId . '_edit', 'value_edit_checked' => $row['edit'] == 1 ? 'checked' : '', 'value_del' => $groupId . '_del', 'value_del_checked' => $row['del'] == 1 ? 'checked' : ''); $checkboxes[] = $checkbox; } $formFields = array(); $formFields[] = FormManager::AddPermissions('groupids[]', $checkboxes); $formFields[] = FormManager::AddCheckbox('replaceInLayouts', __('Update these permissions on all layouts, regions and media.'), 0, __('Note: It will only be replaced in layouts you have permission to edit.'), 'r'); $users = $user->userList(array('userName')); $users[] = array('userid' => -1, 'username' => ''); $formFields[] = FormManager::AddCombo('ownerId', __('Owner'), -1, $users, 'userid', 'username', __('Change the Owner of this item. Leave empty to keep the current owner.'), 'o'); Theme::Set('form_fields', $formFields); $form = Theme::RenderReturn('form_render'); $response->SetFormRequestResponse($form, __('Permissions'), '350px', '500px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Permissions') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#CampaignPermissionsForm").submit()'); $response->Respond(); }
public function EditForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); // Can we edit? if (Config::GetSetting('TRANSITION_CONFIG_LOCKED_CHECKB') == 'Checked') { trigger_error(__('Transition Config Locked'), E_USER_ERROR); } $transitionId = Kit::GetParam('TransitionID', _GET, _INT); // Pull the currently known info from the DB $SQL = ''; $SQL .= 'SELECT Transition, '; $SQL .= ' AvailableAsIn, '; $SQL .= ' AvailableAsOut '; $SQL .= ' FROM `transition` '; $SQL .= ' WHERE TransitionID = %d '; $SQL = sprintf($SQL, $transitionId); if (!($row = $db->GetSingleRow($SQL))) { trigger_error($db->error()); trigger_error(__('Error getting Transition')); } $name = Kit::ValidateParam($row['Transition'], _STRING); Theme::Set('enabledforin_checked', Kit::ValidateParam($row['AvailableAsIn'], _INT) == 1 ? 'Checked' : ''); Theme::Set('enabledforout_checked', Kit::ValidateParam($row['AvailableAsOut'], _INT) == 1 ? 'Checked' : ''); // Set some information about the form Theme::Set('form_id', 'TransitionEditForm'); Theme::Set('form_action', 'index.php?p=transition&q=Edit'); Theme::Set('form_meta', '<input type="hidden" name="TransitionID" value="' . $transitionId . '" />'); $form = Theme::RenderReturn('transition_form_edit'); $response->SetFormRequestResponse($form, sprintf(__('Edit %s'), $name), '350px', '325px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Transition', 'Edit') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#TransitionEditForm").submit()'); $response->Respond(); }