static function renderImportFromDirectory() { $html = '<div id="entryform">'; $html .= '<h1>' . translate('Import all .ics files of a directory') . '</h1>'; $html .= '<p>' . translate('This process will import each file in a directory named "username.ics" and create a user and calendar for each file to import.') . '</p>'; $data = (object) array('directory_path' => '/path/to/your/ics/files', 'calendar_path' => 'calendar'); $ef = new EntryForm($_SERVER['REQUEST_URI'], $data, true, true); $html .= "<table width=\"100%\" class=\"data\">\n"; $html .= $ef->StartForm(array("autocomplete" => "off")); $html .= $ef->DataEntryLine(translate("path to store your ics"), "%s", "text", "calendar_path", array("size" => 20, "title" => translate("Set the path to store your ics e.g. 'calendar' will be referenced as /caldav.php/username/calendar/"), "help" => translate("<b>WARNING: all events in this path will be deleted before inserting allof the ics file</b>")), ''); $html .= $ef->DataEntryLine(translate("Directory on the server"), "%s", "text", "directory_path", array("size" => 20, "title" => translate("The path on the server where your .ics files are."))); $html .= "</table>\n"; $html .= $ef->SubmitButton("import_from_directory", translate('Submit')); $html .= $ef->EndForm(); $html .= "</div>"; return $html; }
function RenderSearchForm($target_url) { global $session, $theme, $search_record; $html = ""; $search_record = (object) array(); $org_code = intval($GLOBALS['org_code']); if ($org_code > 0) { $search_record->org_code = $org_code; } // $session->Log( 'DBG: isset($_POST[submit])=%s isset($_GET[saved_query])=%s', isset($_POST[submit]), isset($_GET['saved_query'] ) ); if (!isset($_POST['submit']) && isset($_GET['saved_query'])) { $qry = new PgQuery("SELECT query_params FROM saved_queries WHERE (user_no = ? OR public ) AND lower(query_name) = lower(?);", $session->user_no, $_GET['saved_query']); if ($qry->Exec('RenderSearchForm') && $qry->rows == 1 && ($row = $qry->Fetch())) { $_POST = unserialize($row->query_params); } } $ef = new EntryForm($REQUEST_URI, $search_record, true); // We do the formatting fairly carefully here... $ef->SimpleForm('<span style="white-space: nowrap"><span class="srchp">%s:</span><span class="srchf">%s</span></span> '); $html .= $ef->StartForm(array("autocomplete" => "off", "onsubmit" => "return CheckSearchForm();")); $html .= "<table border=0 cellspacing=2 cellpadding=0 align=center class=row0 width=100% style=\"border: 1px dashed #aaaaaa;\">\n"; $html .= "<tr><td width=100%><table border=0 cellspacing=0 cellpadding=0 width=100%><tr valign=middle><td width=100%>\n"; if (isset($_GET['search_for']) && !isset($_POST['search_for'])) { $_POST['search_for'] = $_GET['search_for']; } $html .= $ef->DataEntryLine("Find", "%s", "text", "search_for", array("size" => 10, "class" => "srchf", "title" => "Search for free text in the request or notes. Regular expressions are OK too.")); // Organisation drop-down if ($session->AllowedTo("Admin") || $session->AllowedTo("Support") || $session->AllowedTo("Contractor")) { $html .= $ef->DataEntryLine("Organisation", "", "lookup", "org_code", array("_sql" => SqlSelectOrganisations($org_code), "_null" => "-- All Organisations --", "onchange" => "OrganisationChanged();", "title" => "The organisation that this work will be done for.", "class" => "srchf", "style" => "width: 18em")); } // System (within Organisation) drop-down $html .= $ef->DataEntryLine("System", "", "lookup", "system_id", array("_sql" => SqlSelectSystems($org_code), "_null" => "-- All Systems --", "onchange" => "SystemChanged();", "title" => "The business system that this request applies to.", "class" => "srchf", "style" => "width: 18em")); $html .= $ef->DataEntryLine("Requester", "", "lookup", "requested_by", array("_sql" => SqlSelectRequesters($org_code), "_null" => "-- Any Requester --", "onchange" => "PersonChanged();", "title" => "The client who is requesting this, or who is in charge of ensuring it happens.", "class" => "srchf", "style" => "width: 12em")); $html .= $ef->DataEntryLine("Watching", "", "lookup", "interested_in", array("_sql" => SqlSelectSubscribers($org_code), "_null" => "-- Any Interested User --", "title" => "The client who is requesting this, or who is in charge of ensuring it happens.", "class" => "srchf", "style" => "width: 12em")); // Person Assigned to W/R $html .= $ef->DataEntryLine("ToDo", "", "lookup", "allocated_to", array("_sql" => SqlSelectSubscribers($org_code), "_null" => "-- Any Assigned User --", "_nobody" => "-- Not Yet Allocated --", "class" => "srchf", "title" => "A person who has been assigned to work on requests.", "style" => "width: 12em")); // Date range $html .= $ef->DataEntryLine("Last Action", "%s", "date", "from_date", array("size" => 10, "class" => "srchf", "title" => "Only show requests with action after this date.")); $html .= "<a href=\"javascript:show_calendar('forms.form.from_date');\" onmouseover=\"window.status='Date Picker';return true;\" onmouseout=\"window.status='';return true;\">" . $theme->Image("date-picker.gif") . "</a> \n"; $html .= $ef->DataEntryLine("To", "%s", "date", "to_date", array("size" => 10, "class" => "srchf", "title" => "Only show requests with action before this date.")); $html .= "<a href=\"javascript:show_calendar('forms.form.to_date');\" onmouseover=\"window.status='Date Picker';return true;\" onmouseout=\"window.status='';return true;\">" . $theme->Image("date-picker.gif") . "</a> \n"; // Type of Request $html .= $ef->DataEntryLine("Type", "%s", "lookup", "type_code", array("_type" => "request|request_type", "_null" => "-- All Types --", "class" => "srchf", "style" => "width: 8em", "title" => "Only show this type of request")); if ($session->AllowedTo("Admin")) { // $html .= "<div id=\"whereclause\">"; $html .= $ef->DataEntryLine("Where", "%s", "text", "where_clause", array("size" => 60, "class" => "srchf", "title" => "Add an SQL 'WHERE' clause to further refine the search - you will need to know what you are doing...")); // $html .= "</div>"; } $html .= "<table border='0' cellspacing='0' cellpadding='0' width='100%'><tr>"; $html .= "<td style=\"vertical-align: top; padding-top: 0.3em; white-space:wrap;\"><span class=\"srchp\">Status:</span></td><td valign='top'>\n"; $sql = "SELECT * FROM lookup_code WHERE source_table='request' "; $sql .= " AND source_field='status_code' "; $sql .= " ORDER BY source_table, source_field, lookup_seq, lookup_code "; $qry = new PgQuery($sql); if ($qry->Exec("RenderSearchForm") && $qry->rows > 0) { $i = 0; while ($status = $qry->Fetch()) { $ef->record->incstat[$status->lookup_code] = strpos($GLOBALS['default_search_statuses'], $status->lookup_code) != false ? 1 : ''; if ($i++ > 0) { $html .= " "; } $html .= $ef->DataEntryField("%s", "checkbox", "incstat[{$status->lookup_code}]", array("_label" => $status->lookup_desc, "class" => "srchf", "value" => 1)); // if ( $i++ == round($qry->rows / 2) ) $html .= "<br />"; } $html .= $ef->DataEntryField("%s", "checkbox", "inactive", array("_label" => "inactive", "class" => "srchf", "value" => 1)); $html .= "</td>\n"; } $html .= "</tr></table>\n"; $html .= RenderTagsPanel($ef); $html .= RenderColumnSelections($ef); // style="display: block; float:right; clear: left;" $html .= '<div id="savesearch">'; $html .= $ef->DataEntryLine("Save as", "%s", "text", "savelist", array("size" => 20, "class" => "srchf", "title" => "A name to use to refer to this query in the future.")); $html .= $ef->DataEntryField("%s", "checkbox", "save_query_order", array("_label" => "With Order?", "class" => "srchf", "value" => 1)); $html .= $ef->DataEntryField("%s", "checkbox", "save_public", array("_label" => "Public?", "class" => "srchf", "value" => 1)); $search_record->save_hotlist = 't'; $html .= $ef->DataEntryField("%s", "checkbox", "save_hotlist", array("_label" => "In my menu?", "class" => "srchf", "value" => 1)); $html .= $ef->SubmitButton("submit", "Save Query", array("title" => "Save this query so you can run it again.")); $html .= "</div>"; $html .= $ef->DataEntryLine("Max results", "%s", "text", "maxresults", array("size" => 6, "class" => "srchf", "title" => "The maximum number of rows to show in the listing")); $html .= $ef->SubmitButton("submit", "Run Query", array("title" => "Run a query with these settings")); $html .= "</td></tr></table>\n"; $html .= "</td></tr></table>\n"; $html .= $ef->EndForm(); return $html; }
re = new RegExp("^" + matching + "_" ) for ( var i=0; i < document.forms.form.elements.length ; i++ ) { if ( document.forms.form.elements[i].name.match( /^role/ ) ) { if ( document.forms.form.elements[i].value == '' ) { if ( document.forms.form.elements[i].id.match( re ) ) { document.forms.form.elements[i].value = document.forms.form.default_role.value; } } } } return true; } </script> SCRIPT; $ef->TempLineFormat('<span class="srchf" style="white-space: nowrap">%s%s</span>'); $btn_clients = $ef->DataEntryLine("", "", "button", "apply_clients", array("value" => "Client", "onclick" => "ApplyToRoles('client');", "title" => "Click to apply the default to unassigned users for this system.", "class" => "fsubmit")); $btn_contractors = $ef->DataEntryLine("", "", "button", "apply_contractors", array("value" => "Contractor", "onclick" => "ApplyToRoles('ext');", "title" => "Click to apply the default to unassigned users for this system.", "class" => "fsubmit")); $btn_internal = $ef->DataEntryLine("", "", "button", "apply_internal", array("value" => "Internal", "onclick" => "ApplyToRoles('int');", "title" => "Click to apply the default to unassigned users for this system.", "class" => "fsubmit")); $ef->RevertLineFormat(); $html .= "Choose a default and apply to unassigned {$btn_clients} / {$btn_contractors} / {$btn_internal} users</th>"; $html .= '<td class="entry" align="center">'; $options = array_merge($roles, array("title" => "Select the default role people have in relation to this system")); $html .= $ef->DataEntryField("", "select", "default_role", $options); $html .= "</td></tr>"; echo $html; } $options = array_merge($roles, array("title" => "Select the role this person has in relation to this system")); $fld_format = '<span style="background-color: %s;"> %s </span>'; $i = 0; while ($row = $q->Fetch()) { $search_record->role[$row->user_no] = $row->role;