echo "<option value='Recent180'>" . sprintf($strPreviousXMonths, 6) . "</option>"; echo "<option value='Recent90'>" . sprintf($strPreviousXMonths, 3) . "</option>"; echo "<option value='Recent30'>" . sprintf($strPreviousXMonths, 30) . "</option>"; echo "<option value='Recent14'>" . sprintf($strPreviousXMonths, 14) . "</option>"; echo "<option value='Recent7'>" . sprintf($strPreviousXDays, 7) . "</option>"; echo "<option value='Recent1'>{$strToday}</option>"; echo "<option value='RecentHour'>< " . sprintf($strXMinutes, 60) . "</option>"; echo "<option value='OldHour'>> " . sprintf($strXMinutes, 60) . "</option>"; echo "<option value='Old7'>> " . sprintf($strXDays, 7) . "</option>"; echo "<option value='Old30'>> " . sprintf($strXDays, 30) . "</option>"; echo "<option value='Old90'>> " . sprintf($strXMonths, 3) . "</option>"; echo "<option value='Old180'>> " . sprintf($strXMonths, 6) . "</option>"; echo "</select>"; echo "</td></tr>\n"; echo "<tr><th>{$strOwner}:</th><td width='300'>"; user_drop_down('search_user', 0); echo "</td></tr>"; echo "<tr><th>{$strSortResults}:</th><td width='300'>"; echo "<select size='1' name='sort_results'>\n <option selected='selected' value='DateDESC'>{$strByDate} ({$strNewestAtTop})</option>\n <option value='DateASC'>{$strByDate} ({$strNewestAtBottom})</option>\n <option value='IDASC'>{$strID}</option>\n <option value='TitleASC'>{$strTitle}</option>\n <option value='ContactASC'>{$strContact}</option>\n <option value='SiteASC'>{$strSite}</option>\n </select>"; echo "</td></tr>\n"; echo "<tr><td></td><td><input type='hidden' name='action' value='search' />"; echo "<input name='reset' type='reset' value=\"{$strReset}\" /> "; echo "<input name='submit' type='submit' value=\"{$strSearch}\" />"; echo "</td></tr>\n"; echo "</table>\n"; echo "</form>\n"; } else { // perform search // search for criteria if ($errors == 0) { // build SQL
echo "<td><input type='text' name='enddate' id='enddate' size='10' /> "; echo date_picker('addtask.enddate'); echo " ".time_dropdown("endtime"); echo "</td></tr>";*/ echo "<tr><th>{$strValue}</th>"; echo "<td><input type='text' name='value' size='6' maxlength='12'"; if ($_SESSION['formdata']['add_task']['value'] != '') { echo "value='{$_SESSION['formdata']['add_task']['value']}'"; } echo "/></td></tr>"; echo "<tr><th>{$strUser}</th>"; echo "<td>"; if ($_SESSION['formdata']['add_task']['taskuser'] != '') { echo user_drop_down('taskuser', $_SESSION['formdata']['add_task']['taskuser'], FALSE); } else { echo user_drop_down('taskuser', $sit[2], FALSE); } echo help_link('TaskUser') . "</td></tr>"; echo "<tr><th>{$strPrivacy}" . help_link('TaskPrivacy') . "</th>"; echo "<td>"; if ($_SESSION['formdata']['add_task']['distribution'] == 'public') { echo "<label><input type='radio' name='distribution' checked='checked'"; echo " value='public' /> {$strPublic}</label><br />"; echo "<label><input type='radio' name='distribution' value='private' />"; echo " {$strPrivate} "; echo icon('private', 16, $strPrivate, "{$strPublic}/{$strPrivate}"); echo "</label></td></tr>"; } else { echo "<label><input type='radio' name='distribution' value='public' /> {$strPublic}</label><br />"; echo "<label><input type='radio' name='distribution' checked='checked' value='private' /> {$strPrivate} "; echo icon('private', 16, $strPrivate, "{$strPublic}/{$strPrivate}");
echo "<tbody id='hidden' class='hidden' style='display:none'>"; echo "<tr><th>{$strFax}</th><td><input maxlength='255' name='fax' size='30'"; echo "value='{$_SESSION['formdata']['add_site']['fax']}' /></td></tr>\n"; echo "<tr><th>{$strWebsite}</th><td><input maxlength='255' name='websiteurl' size='30'"; echo "value='{$_SESSION['formdata']['add_site']['websiteurl']}' /></td></tr>\n"; echo "<tr><th>{$strSiteType}</th><td>"; if ($_SESSION['formdata']['add_site']['typeid'] != '') { echo sitetype_drop_down('typeid', $_SESSION['formdata']['add_site']['typeid']) . "</td></tr>\n"; } else { echo sitetype_drop_down('typeid', 1) . "</td></tr>\n"; } echo "<tr><th>{$strSalesperson}</th><td>"; if ($_SESSION['formdata']['add_site']['owner'] != '') { user_drop_down('owner', $_SESSION['formdata']['add_site']['owner'], FALSE); } else { user_drop_down('owner', 0, FALSE); } echo "</td></tr>\n"; echo "<tr><th>{$strNotes}</th><td><textarea cols='30' name='notes' rows='5'>"; echo $_SESSION['formdata']['add_site']['notes']; echo "</textarea></td></tr>\n"; echo "</tbody>"; echo "</table>\n"; echo "<p><input name='submit' type='submit' value='{$strAddSite}' /></p>"; echo "<p class='warning'>{$strAvoidDupes}</p>\n"; echo "</form>\n"; include APPLICATION_INCPATH . 'htmlfooter.inc.php'; clear_form_data('add_site'); } elseif ($action == "add") { // External variables $name = cleanvar($_POST['name']);
function dashboard_watch_incidents_edit($dashletid) { global $CONFIG, $sit; $editaction = $_REQUEST['editaction']; switch ($editaction) { case 'add': $type = $_REQUEST['type']; echo "<h2>{$GLOBALS['strWatchAddSet']}</h2>"; echo "<form id='dwiaddform' action='{$_SERVER['PHP_SELF']}?action=do_add&type={$type}' method='post' onsubmit='return false'>"; echo "<table class='vertical'>"; echo "<tr><td>"; switch ($type) { case '0': //site echo "{$GLOBALS['strSite']}: "; echo site_drop_down('id', ''); break; case '1': //contact echo "{$GLOBALS['strContact']}: "; echo contact_drop_down('id', ''); break; case '2': //engineer echo "{$GLOBALS['strEngineer']}: "; echo user_drop_down('id', '', FALSE); break; case '3': //Incident echo "{$GLOBALS['strIncident']}:"; echo "<input class='textbox' name='id' size='30' />"; break; } echo "</td><tr>"; echo "</table>"; echo "<p align='center'>"; echo dashlet_link('watch_incidents', $dashletid, $GLOBALS['strAdd'], 'save', array('editaction' => 'do_add', 'type' => $type), false, 'dwiaddform'); echo "</p>"; break; case 'do_add': $id = $_REQUEST['id']; $type = $_REQUEST['type']; $sql = "INSERT INTO `{$CONFIG['db_tableprefix']}dashboard_watch_incidents` VALUES ({$sit[2]},'{$type}','{$id}')"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_ERROR); } if (!$result) { echo "<p class='error'>{$GLOBALS['strWatchAddFailed']}</p>"; } else { echo "<p>{$GLOBALS['strAddedSuccessfully']}</p>"; echo dashlet_link('watch_incidents', $dashletid, $GLOBALS['strBackToList'], '', '', TRUE); } break; case 'delete': $id = $_REQUEST['id']; $type = $_REQUEST['type']; $sql = "DELETE FROM `{$CONFIG['db_tableprefix']}dashboard_watch_incidents` WHERE id = '{$id}' AND userid = {$sit[2]} AND type = '{$type}'"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_ERROR); } if (!$result) { echo "<p class='error'>{$GLOBALS['strWatchDeleteFailed']}</p>"; } else { echo "<p>{$GLOBALS['strSuccess']}</p>"; echo dashlet_link('watch_incidents', $dashletid, $GLOBALS['strBackToList'], '', '', TRUE); } break; default: echo "<h3>{$GLOBALS['strEditWatchedIncidents']}</h3>"; echo "<table align='center'>"; for ($i = 0; $i < 4; $i++) { $sql = "SELECT * FROM `{$CONFIG['db_tableprefix']}dashboard_watch_incidents` WHERE userid = {$sit[2]} AND type = {$i}"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } echo "<tr><td align='left'><strong>"; switch ($i) { case 0: echo $GLOBALS['strSites']; break; case 1: echo $GLOBALS['strContacts']; break; case 2: echo $GLOBALS['strEngineers']; break; case 3: echo $GLOBALS['strIncidents']; break; } echo "</strong></td><td align='right'>"; switch ($i) { case 0: $linktext = $GLOBALS['strAddSite']; break; case 1: $linktext = $GLOBALS['strAddContact']; break; case 2: $linktext = $GLOBALS['strAddUser']; break; case 3: $linktext = $GLOBALS['strAddIncident']; break; } echo dashlet_link('watch_incidents', $dashletid, $linktext, 'edit', array('editaction' => 'add', 'type' => $i)); echo "</td></tr>"; if (mysql_num_rows($result) > 0) { $shade = 'shade1'; while ($obj = mysql_fetch_object($result)) { $name = ''; switch ($obj->type) { case 0: //site $sql = "SELECT name FROM `{$GLOBALS['dbSites']}` WHERE id = {$obj->id}"; $iresult = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $iobj = mysql_fetch_object($iresult); $name = $iobj->name; break; case 1: //contact $sql = "SELECT forenames, surname FROM `{$GLOBALS['dbContacts']}` WHERE id = {$obj->id}"; $iresult = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $iobj = mysql_fetch_object($iresult); $name = $iobj->forenames . ' ' . $iobj->surname; break; case 2: //Engineer $sql = "SELECT realname FROM `{$GLOBALS['dbUsers']}` WHERE id = {$obj->id}"; $iresult = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $iobj = mysql_fetch_object($iresult); $name = $iobj->realname; break; case 3: //Incident $sql = "SELECT title FROM `{$GLOBALS['dbIncidents']}` WHERE id = {$obj->id}"; $iresult = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $iobj = mysql_fetch_object($iresult); $name = "<a href=\"javascript:incident_details_window('{$obj->id}','incident{$obj->id}')\" class='info'>[{$obj->id}] {$iobj->title}</a>"; break; } echo "<tr class='{$shade}'><td>{$name}</td><td>"; echo dashlet_link('watch_incidents', $dashletid, $GLOBALS['strRemove'], 'edit', array('editaction' => 'delete', 'id' => $obj->id, 'type' => $i)); if ($shade == 'shade1') { $shade = 'shade2'; } else { $shade = 'shade1'; } } } else { echo "<tr><td colspan='2'>{$GLOBALS['strNoIncidentsBeingWatchOfType']}</td></tr>"; } } echo "</table>"; break; } return $html; }
$activity_files['$strSupport'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_support.inc.php'; $activity_files['$strTravelling'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_travelling.inc.php'; $activity_files['$strResearch'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_research.inc.php'; $activity_files['$strDevelopment'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_development.inc.php'; $activity_files['$PreSales'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_presales.inc.php'; $activity_files['$strTraining'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_training.inc.php'; $activity_files['$strManagement'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_managerial.inc.php'; plugin_do('activity_types'); foreach ($activity_files as $activity_name => $activity_file) { include $activity_file; } ksort($activity_types); global $approver; if ($approver) { echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?display=timesheet'>"; echo user_drop_down('user', $user, FALSE); echo "<input type='submit' value='{$strSwitchUser}' />"; echo "</form>"; echo "<br/>"; } // Controls Table echo "<div id='rightdiv' style='float: right; border: 1px dashed gray; width: 25%;'>"; echo "<table class='timesheet'>"; echo "<tr>"; echo "<th>{$strKey}</th>"; echo "<th>{$strOperation}</th>"; echo "</tr>"; echo "<tr>"; echo "<td style='width:200px;'><center>"; foreach (array('Unconfirmed' => 'ddf', 'Confirmed' => 'fff', 'Waiting Approval' => 'ffb', 'Approved' => 'fdf', 'Unavailable' => 'dfd') as $at => $col) { echo "<div style='background-color: #{$col}; width: 110px; margin: 5px; border: 1px solid grey;'>{$at}</div>";
$title = $strDefineSubstituteEngineer; if (empty($save)) { // External variables if (empty($_REQUEST['user']) or $_REQUEST['user'] == 'current') { $user = mysql_real_escape_string($sit[2]); } else { $user = mysql_real_escape_string($_REQUEST['user']); } $default = cleanvar($_REQUEST['default']); $softlist = $_REQUEST['softlist']; include APPLICATION_INCPATH . 'htmlheader.inc.php'; echo "<h2>" . sprintf($strDefineSubstituteEngineersFor, user_realname($user, TRUE)) . "</h2>\n"; echo "<form name='def' action='{$_SERVER['PHP_SELF']}' method='post'>"; echo "<input type='hidden' name='user' value='{$user}' />"; echo "<p align='center'>{$strDefaultSubstitute}: "; user_drop_down('default', $default, FALSE, $user, "onchange='javascript:this.form.submit();'"); echo "</p>"; echo "</form>"; $sql = "SELECT * FROM `{$dbUserSoftware}` AS us, `{$dbSoftware}` AS s "; $sql .= "WHERE us.softwareid = s.id AND userid='{$user}' ORDER BY name"; $result = mysql_query($sql); $countsw = mysql_num_rows($result); if ($countsw >= 1) { echo "<form action='{$_SERVER['PHP_SELF']}' method='post'>\n"; echo "<table align='center'>\n"; echo "<tr><th>{$strSkill}</th><th>{$strSubstitute}</th></tr>"; $class = 'shade1'; while ($software = mysql_fetch_object($result)) { echo "<tr class='{$class}'>"; echo "<td><strong>{$software->id}</strong>: {$software->name}</td>"; if ($software->backupid == 0) {
echo "<tr><th>{$strCompletion}</th>"; echo "<td><input type='text' name='completion' size='3' maxlength='3' value='{$task->completion}' />%</td></tr>"; echo "<tr><th>{$strEndDate}</th>"; echo "<td><input type='text' name='enddate' id='enddate' size='10' value='"; if ($enddate > 0) { echo date('Y-m-d', $enddate); } echo "' /> "; echo date_picker('edittask.enddate'); echo " " . time_dropdown("endtime", date('H:i', $enddate)); echo "</td></tr>"; echo "<tr><th>{$strValue}</th>"; echo "<td><input type='text' name='value' size='6' maxlength='12' value='{$task->value}' /></td></tr>"; echo "<tr><th>{$strUser}</th>"; echo "<td>"; echo user_drop_down('owner', $task->owner, FALSE); echo help_link('TaskUser') . "</td></tr>"; echo "<tr><th>{$strPrivacy}</th>"; echo "<td>"; echo "<input type='radio' name='distribution' "; if ($task->distribution == 'public') { echo "checked='checked' "; } echo "value='public' /> {$strPublic}<br />"; echo "<input type='radio' name='distribution' "; if ($task->distribution == 'private') { echo "checked='checked' "; } echo "value='private' /> {$strPrivate} " . icon('private', 16, $strPrivate) . "</td></tr>"; echo "</table>"; echo "<p><input name='submit' type='submit' value='{$strSave}' /></p>";
/** * HTML for a config variable input box * @author Ivan Lucas * @param string $setupvar The setup variable key name * @param bool $showvarnames Whether to display the config variable name * @returns string HTML */ function cfgVarInput($setupvar, $showvarnames = FALSE) { global $CONFIG, $CFGVAR; if ($CFGVAR[$setupvar]['type'] == 'languageselect' or $CFGVAR[$setupvar]['type'] == 'languagemultiselect') { $available_languages = available_languages(); } $html .= "<div class='configvar'>"; if ($CFGVAR[$setupvar]['title'] != '') { $title = $CFGVAR[$setupvar]['title']; } else { $title = $setupvar; } $html .= "<h4>{$title}</h4>"; if ($CFGVAR[$setupvar]['help'] != '') { $html .= "<p class='helptip'>{$CFGVAR[$setupvar]['help']}</p>\n"; } $value = ''; if (!$cfg_file_exists or $cfg_file_exists and $cfg_file_writable) { $value = $CONFIG[$setupvar]; if (is_bool($value)) { if ($value == TRUE) { $value = 'TRUE'; } else { $value = 'FALSE'; } } elseif (is_array($value)) { if (is_assoc($value)) { $value = "array(" . implode_assoc('=>', ',', $value) . ")"; } else { $value = "array(" . implode(',', $value) . ")"; } } if ($setupvar == 'db_password' and $_REQUEST['action'] != 'reconfigure') { $value = ''; } } $value = stripslashes($value); switch ($CFGVAR[$setupvar]['type']) { case 'select': $html .= "<select name='{$setupvar}' id='{$setupvar}'>"; if (empty($CFGVAR[$setupvar]['options'])) { $CFGVAR[$setupvar]['options'] = "TRUE|FALSE"; } $options = explode('|', $CFGVAR[$setupvar]['options']); foreach ($options as $option) { $html .= "<option value=\"{$option}\""; if ($option == $value) { $html .= " selected='selected'"; } $html .= ">{$option}</option>\n"; } $html .= "</select>"; break; case 'percent': $html .= "<select name='{$setupvar}' id='{$setupvar}'>"; for ($i = 0; $i <= 100; $i++) { $html .= "<option value=\"{$i}\""; if ($i == $value) { $html .= " selected='selected'"; } $html .= ">{$i}</option>\n"; } $html .= "</select>%"; break; case 'interfacestyleselect': $html .= interfacestyle_drop_down($setupvar, $value); break; case 'languageselect': if (empty($value)) { $value = $_SESSION['lang']; } $html .= array_drop_down($available_languages, $setupvar, $value, '', TRUE); break; case 'languagemultiselect': if (empty($value)) { foreach ($available_languages as $code => $lang) { $value[] = $code; } $checked = TRUE; } else { $checked = FALSE; $replace = array('array(', ')', "'"); $value = str_replace($replace, '', $value); $value = explode(',', $value); } $html .= array_drop_down($available_languages, $setupvar, $value, '', TRUE, TRUE); $attributes = "onchange=\"toggle_multiselect('{$setupvar}[]')\""; $html .= "<label>" . html_checkbox($setupvar . 'checkbox', $checked, ""); $html .= $GLOBALS['strAll'] . "</label>"; break; case 'slaselect': $html .= serviceleveltag_drop_down($setupvar, $value, TRUE); break; case 'userselect': $html .= user_drop_down($setupvar, $value, FALSE, FALSE, '', TRUE); break; case 'siteselect': $html .= site_drop_down($setupvar, $value, FALSE); break; case 'userstatusselect': $html .= userstatus_drop_down($setupvar, $value); break; case 'roleselect': $html .= role_drop_down($setupvar, $value); break; case 'number': $html .= "<input type='text' name='{$setupvar}' id='{$setupvar}' size='7' value=\"{$value}\" />"; break; case '1darray': $replace = array('array(', ')', "'"); $value = str_replace($replace, '', $value); $html .= "<input type='text' name='{$setupvar}' id='{$setupvar}' size='60' value=\"{$value}\" />"; break; case '2darray': $replace = array('array(', ')', "'", '\\r', '\\n'); $value = str_replace($replace, '', $value); $value = str_replace(',', "\n", $value); $html .= "<textarea name='{$setupvar}' id='{$setupvar}' cols='60' rows='10'>{$value}</textarea>"; break; case 'password': $html .= "<input type='password' id='cfg{$setupvar}' name='{$setupvar}' size='16' value=\"{$value}\" /> " . password_reveal_link("cfg{$setupvar}"); break; case 'ldappassword': $html .= "<input type='password' id='cfg{$setupvar}' name='{$setupvar}' size='16' value=\"{$value}\" /> " . password_reveal_link("cfg{$setupvar}"); $html .= " <a href='javascript:void(0);' onclick=\"checkLDAPDetails('status{$setupvar}');\">{$GLOBALS['strCheckLDAPDetails']}</a>"; break; case 'text': default: if (strlen($CONFIG[$setupvar]) < 65) { $html .= "<input type='text' name='{$setupvar}' id='{$setupvar}' size='60' value=\"{$value}\" />"; } else { $html .= "<textarea name='{$setupvar}' id='{$setupvar}' cols='60' rows='10'>{$value}</textarea>"; } } if (!empty($CFGVAR[$setupvar]['unit'])) { $html .= " {$CFGVAR[$setupvar]['unit']}"; } if (!empty($CFGVAR[$setupvar]['helplink'])) { $html .= ' ' . help_link($CFGVAR[$setupvar]['helplink']); } if ($setupvar == 'db_password' and $_REQUEST['action'] != 'reconfigure' and $value != '') { $html .= "<p class='info'>The current password setting is not shown</p>"; } if ($showvarnames) { $html .= "<br />(<var>\$CONFIG['{$setupvar}']</var>)"; } if ($CFGVAR[$setupvar]['statusfield'] == 'TRUE') { $html .= "<div id='status{$setupvar}'></div>"; } $html .= "</div>"; $html .= "<br />\n"; if ($c == 1) { $c == 2; } else { $c = 1; } return $html; }