}
}
+function filterDlgCheckType(sender) {
+
+ try {
+
+ var ftype = sender[sender.selectedIndex].value;
+
+ var form = document.forms["filter_add_form"];
+
+ if (!form) {
+ form = document.forms["filter_edit_form"];
+ }
+
+ if (!form) {
+ debug("filterDlgCheckType: can't find form!");
+ return;
+ }
+
+ // if selected filter type is 5 (Date) enable the modifier dropbox
+ if (ftype == 5) {
+ Element.show("filter_dlg_date_mod_box");
+ Element.show("filter_dlg_date_chk_box");
+ } else {
+ Element.hide("filter_dlg_date_mod_box");
+ Element.hide("filter_dlg_date_chk_box");
+
+ }
+
+ } catch (e) {
+ exception_error("filterDlgCheckType", e);
+ }
+
+}
+
function filterDlgCheckAction(sender) {
try {
}
+function filterDlgCheckDate() {
+ try {
+ var form = document.forms["filter_add_form"];
+
+ if (!form) {
+ form = document.forms["filter_edit_form"];
+ }
+
+ if (!form) {
+ debug("filterDlgCheckAction: can't find form!");
+ return;
+ }
+
+ var reg_exp = form.reg_exp.value;
+
+ var query = "backend.php?op=rpc&subop=checkDate&date=" + reg_exp;
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+
+ var form = document.forms["filter_add_form"];
+
+ if (!form) {
+ form = document.forms["filter_edit_form"];
+ }
+
+ if (transport.responseXML) {
+ var result = transport.responseXML.getElementsByTagName("result")[0];
+
+ if (result && result.firstChild) {
+ if (result.firstChild.nodeValue == "1") {
+
+ new Effect.Highlight(form.reg_exp, {startcolor : '#00ff00'});
+
+ return;
+ }
+ }
+ }
+
+ new Effect.Highlight(form.reg_exp, {startcolor : '#ff0000'});
+
+ } });
+
+
+ } catch (e) {
+ exception_error("filterDlgCheckDate", e);
+ }
+}
+
function explainError(code) {
return displayDlg("explainError", code);
}
return;
}
+ if ($subop == "checkDate") {
+
+ $date = db_escape_string($_REQUEST["date"]);
+ $date_parsed = strtotime($date);
+
+ print "<rpc-reply>";
+
+ if ($date_parsed) {
+ print "<result>1</result>";
+ } else {
+ print "<result>0</result>";
+ }
+
+ print "</rpc-reply>";
+
+ return;
+ }
+
print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
}
?>
print "<div class=\"dlgSecCont\">";
+ print "<span id=\"filter_dlg_date_mod_box\" style=\"display : none\">";
+ print "<select name=\"filter_date_modifier\">";
+ print "<option name=\"before\">".__('Before')."</option>";
+ print "<option name=\"after\">".__('After')."</option>";
+ print "</select> </span>";
+
print "<input onkeypress=\"return filterCR(event, createFilter)\"
onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
name=\"reg_exp\" size=\"30\" value=\"$reg_exp\">";
- print " " . __("on field") . " ";
- print_select_hash("filter_type", 1, $filter_types);
+ print "<span id=\"filter_dlg_date_chk_box\" style=\"display : none\">";
+ print " <input class=\"button\"
+ type=\"submit\" onclick=\"return filterDlgCheckDate()\"
+ value=\"".__('Check Date')."\">";
+ print "</span>";
+
+ print "<br/> " . __("on field") . " ";
+ print_select_hash("filter_type", 1, $filter_types,
+ 'onchange="filterDlgCheckType(this)"');
print "<br/>";
require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 17);
- define('SCHEMA_VERSION', 45);
+ define('SCHEMA_VERSION', 46);
if (!file_exists("config.php")) {
print __("<b>Fatal Error</b>: You forgot to copy