diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/calendar.css b/agc_2-X/branches/agc_2.2.0/www/agc/calendar.css
new file mode 100644
index 00000000..a3ddcae5
--- /dev/null
+++ b/agc_2-X/branches/agc_2.2.0/www/agc/calendar.css
@@ -0,0 +1,95 @@
+/* calendar icon */
+img.tcalIcon {
+ cursor: pointer;
+ margin-left: 1px;
+ vertical-align: middle;
+}
+/* calendar container element */
+div#tcal {
+ position: absolute;
+ visibility: hidden;
+ z-index: 100;
+ width: 158px;
+ padding: 2px 0 0 0;
+}
+/* all tables in calendar */
+div#tcal table {
+ width: 100%;
+ border: 1px solid silver;
+ border-collapse: collapse;
+ background-color: white;
+}
+/* navigation table */
+div#tcal table.ctrl {
+ border-bottom: 0;
+}
+/* navigation buttons */
+div#tcal table.ctrl td {
+ width: 15px;
+ height: 20px;
+}
+/* month year header */
+div#tcal table.ctrl th {
+ background-color: white;
+ color: black;
+ border: 0;
+}
+/* week days header */
+div#tcal th {
+ border: 1px solid silver;
+ border-collapse: collapse;
+ text-align: center;
+ padding: 3px 0;
+ font-family: tahoma, verdana, arial;
+ font-size: 10px;
+ background-color: gray;
+ color: white;
+}
+/* date cells */
+div#tcal td {
+ border: 0;
+ border-collapse: collapse;
+ text-align: center;
+ padding: 2px 0;
+ font-family: tahoma, verdana, arial;
+ font-size: 11px;
+ width: 22px;
+ cursor: pointer;
+}
+/* date highlight
+ in case of conflicting settings order here determines the priority from least to most important */
+div#tcal td.othermonth {
+ color: silver;
+}
+div#tcal td.weekend {
+ background-color: #ACD6F5;
+}
+div#tcal td.today {
+ border: 1px solid red;
+}
+div#tcal td.selected {
+ background-color: #FFB3BE;
+}
+/* iframe element used to suppress windowed controls in IE5/6 */
+iframe#tcalIF {
+ position: absolute;
+ visibility: hidden;
+ z-index: 98;
+ border: 0;
+}
+/* transparent shadow */
+div#tcalShade {
+ position: absolute;
+ visibility: hidden;
+ z-index: 99;
+}
+div#tcalShade table {
+ border: 0;
+ border-collapse: collapse;
+ width: 100%;
+}
+div#tcalShade table td {
+ border: 0;
+ border-collapse: collapse;
+ padding: 0;
+}
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/calendar_db.js b/agc_2-X/branches/agc_2.2.0/www/agc/calendar_db.js
new file mode 100644
index 00000000..ee6c8dd3
--- /dev/null
+++ b/agc_2-X/branches/agc_2.2.0/www/agc/calendar_db.js
@@ -0,0 +1,335 @@
+// Tigra Calendar v4.0.2 (2009-01-12) Database (yyyy-mm-dd)
+// http://www.softcomplex.com/products/tigra_calendar/
+// Public Domain Software... You're welcome.
+
+// default settins
+var A_TCALDEF = {
+ 'months' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ 'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ 'yearscroll': true, // show year scroller
+ 'weekstart': 0, // first day of week: 0-Su or 1-Mo
+ 'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx.
+ 'imgpath' : 'images/' // directory with calendar images
+}
+// date parsing function
+function f_tcalParseDate (s_date) {
+
+ var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*$/;
+ if (!re_date.exec(s_date))
+ return alert ("Invalid date: '" + s_date + "'.\nAccepted format is yyyy-mm-dd.")
+ var n_day = Number(RegExp.$3),
+ n_month = Number(RegExp.$2),
+ n_year = Number(RegExp.$1);
+
+ if (n_year < 100)
+ n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900);
+ if (n_month < 1 || n_month > 12)
+ return alert ("Invalid month value: '" + n_month + "'.\nAllowed range is 01-12.");
+ var d_numdays = new Date(n_year, n_month, 0);
+ if (n_day > d_numdays.getDate())
+ return alert("Invalid day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + ".");
+
+ return new Date (n_year, n_month - 1, n_day);
+}
+// date generating function
+function f_tcalGenerDate (d_date) {
+ return (
+ d_date.getFullYear() + "-"
+ + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
+ + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate()
+ );
+}
+
+// implementation
+function tcal (a_cfg, a_tpl) {
+
+ // apply default template if not specified
+ if (!a_tpl)
+ a_tpl = A_TCALDEF;
+
+ // register in global collections
+ if (!window.A_TCALS)
+ window.A_TCALS = [];
+ if (!window.A_TCALSIDX)
+ window.A_TCALSIDX = [];
+
+ this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length;
+ window.A_TCALS[this.s_id] = this;
+ window.A_TCALSIDX[window.A_TCALSIDX.length] = this;
+
+ // assign methods
+ this.f_show = f_tcalShow;
+ this.f_hide = f_tcalHide;
+ this.f_toggle = f_tcalToggle;
+ this.f_update = f_tcalUpdate;
+ this.f_relDate = f_tcalRelDate;
+ this.f_parseDate = f_tcalParseDate;
+ this.f_generDate = f_tcalGenerDate;
+
+ // create calendar icon
+ this.s_iconId = 'tcalico_' + this.s_id;
+ this.e_icon = f_getElement(this.s_iconId);
+ if (!this.e_icon) {
+ document.write('
');
+ this.e_icon = f_getElement(this.s_iconId);
+ }
+ // save received parameters
+ this.a_cfg = a_cfg;
+ this.a_tpl = a_tpl;
+}
+
+function f_tcalShow (d_date) {
+
+ // find input field
+ if (!this.a_cfg.controlname)
+ throw("TC: control name is not specified");
+ if (this.a_cfg.formname) {
+ var e_form = document.forms[this.a_cfg.formname];
+ if (!e_form)
+ throw("TC: form '" + this.a_cfg.formname + "' can not be found");
+ this.e_input = e_form.elements[this.a_cfg.controlname];
+ }
+ else
+ this.e_input = f_getElement(this.a_cfg.controlname);
+
+ if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT')
+ throw("TC: element '" + this.a_cfg.controlname + "' does not exist in "
+ + (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document'));
+
+ // dynamically create HTML elements if needed
+ this.e_div = f_getElement('tcal');
+ if (!this.e_div) {
+ this.e_div = document.createElement("DIV");
+ this.e_div.id = 'tcal';
+ document.body.appendChild(this.e_div);
+ }
+ this.e_shade = f_getElement('tcalShade');
+ if (!this.e_shade) {
+ this.e_shade = document.createElement("DIV");
+ this.e_shade.id = 'tcalShade';
+ document.body.appendChild(this.e_shade);
+ }
+ this.e_iframe = f_getElement('tcalIF')
+ if (b_ieFix && !this.e_iframe) {
+ this.e_iframe = document.createElement("IFRAME");
+ this.e_iframe.style.filter = 'alpha(opacity=0)';
+ this.e_iframe.id = 'tcalIF';
+ this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif';
+ document.body.appendChild(this.e_iframe);
+ }
+
+ // hide all calendars
+ f_tcalHideAll();
+
+ // generate HTML and show calendar
+ this.e_icon = f_getElement(this.s_iconId);
+ if (!this.f_update())
+ return;
+
+ this.e_div.style.visibility = 'visible';
+ this.e_shade.style.visibility = 'visible';
+ if (this.e_iframe)
+ this.e_iframe.style.visibility = 'visible';
+
+ // change icon and status
+ this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif';
+ this.e_icon.title = 'Close Calendar';
+ this.b_visible = true;
+}
+
+function f_tcalHide (n_date) {
+ if (n_date)
+ this.e_input.value = this.f_generDate(new Date(n_date));
+
+ // no action if not visible
+ if (!this.b_visible)
+ return;
+
+ // hide elements
+ if (this.e_iframe)
+ this.e_iframe.style.visibility = 'hidden';
+ if (this.e_shade)
+ this.e_shade.style.visibility = 'hidden';
+ this.e_div.style.visibility = 'hidden';
+
+ // change icon and status
+ this.e_icon = f_getElement(this.s_iconId);
+ this.e_icon.src = this.a_tpl.imgpath + 'cal.gif';
+ this.e_icon.title = 'Open Calendar';
+ this.b_visible = false;
+}
+
+function f_tcalToggle () {
+ return this.b_visible ? this.f_hide() : this.f_show();
+}
+
+function f_tcalUpdate (d_date) {
+
+ var d_today = this.a_cfg.today ? this.f_parseDate(this.a_cfg.today) : f_tcalResetTime(new Date());
+ var d_selected = this.e_input.value == ''
+ ? (this.a_cfg.selected ? this.f_parseDate(this.a_cfg.selected) : d_today)
+ : this.f_parseDate(this.e_input.value);
+
+ // figure out date to display
+ if (!d_date)
+ // selected by default
+ d_date = d_selected;
+ else if (typeof(d_date) == 'number')
+ // get from number
+ d_date = f_tcalResetTime(new Date(d_date));
+ else if (typeof(d_date) == 'string')
+ // parse from string
+ this.f_parseDate(d_date);
+
+ if (!d_date) return false;
+
+ // first date to display
+ var d_firstday = new Date(d_date);
+ d_firstday.setDate(1);
+ d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7);
+
+ var a_class, s_html = '
'
+ + (this.a_tpl.yearscroll ? ' | ' : '')
+ + ' | '
+ + this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear()
+ + ' |  | '
+ + (this.a_tpl.yearscroll ? ' | ' : '')
+ + '
';
+
+ // print weekdays titles
+ for (var i = 0; i < 7; i++)
+ s_html += '| ' + this.a_tpl.weekdays[(this.a_tpl.weekstart + i) % 7] + ' | ';
+ s_html += '
' ;
+
+ // print calendar table
+ var n_date, n_month, d_current = new Date(d_firstday);
+ while (d_current.getMonth() == d_date.getMonth() ||
+ d_current.getMonth() == d_firstday.getMonth()) {
+
+ // print row heder
+ s_html +='';
+ for (var n_wday = 0; n_wday < 7; n_wday++) {
+
+ a_class = [];
+ n_date = d_current.getDate();
+ n_month = d_current.getMonth();
+
+ // other month
+ if (d_current.getMonth() != d_date.getMonth())
+ a_class[a_class.length] = 'othermonth';
+ // weekend
+ if (d_current.getDay() == 0 || d_current.getDay() == 6)
+ a_class[a_class.length] = 'weekend';
+ // today
+ if (d_current.valueOf() == d_today.valueOf())
+ a_class[a_class.length] = 'today';
+ // selected
+ if (d_current.valueOf() == d_selected.valueOf())
+ a_class[a_class.length] = 'selected';
+
+ s_html += '| ' : '>') + n_date + ' | '
+
+ d_current.setDate(++n_date);
+ while (d_current.getDate() != n_date && d_current.getMonth() == n_month) {
+ d_current.setHours(d_current.getHours + 1);
+ d_current = f_tcalResetTime(d_current);
+ }
+ }
+ // print row footer
+ s_html +='
';
+ }
+ s_html +='
';
+
+ // update HTML, positions and sizes
+ this.e_div.innerHTML = s_html;
+
+ var n_width = this.e_div.offsetWidth;
+ var n_height = this.e_div.offsetHeight;
+ var n_top = f_getPosition (this.e_icon, 'Top') + this.e_icon.offsetHeight;
+ var n_left = f_getPosition (this.e_icon, 'Left') - n_width + this.e_icon.offsetWidth;
+ if (n_left < 0) n_left = 0;
+
+ this.e_div.style.left = n_left + 'px';
+ this.e_div.style.top = n_top + 'px';
+
+ this.e_shade.style.width = (n_width + 8) + 'px';
+ this.e_shade.style.left = (n_left - 1) + 'px';
+ this.e_shade.style.top = (n_top - 1) + 'px';
+ this.e_shade.innerHTML = b_ieFix
+ ? ''
+ : '';
+
+ if (this.e_iframe) {
+ this.e_iframe.style.left = n_left + 'px';
+ this.e_iframe.style.top = n_top + 'px';
+ this.e_iframe.style.width = (n_width + 6) + 'px';
+ this.e_iframe.style.height = (n_height + 6) +'px';
+ }
+ return true;
+}
+
+function f_getPosition (e_elemRef, s_coord) {
+ var n_pos = 0, n_offset,
+ e_elem = e_elemRef;
+
+ while (e_elem) {
+ n_offset = e_elem["offset" + s_coord];
+ n_pos += n_offset;
+ e_elem = e_elem.offsetParent;
+ }
+ // margin correction in some browsers
+ if (b_ieMac)
+ n_pos += parseInt(document.body[s_coord.toLowerCase() + 'Margin']);
+ else if (b_safari)
+ n_pos -= n_offset;
+
+ e_elem = e_elemRef;
+ while (e_elem != document.body) {
+ n_offset = e_elem["scroll" + s_coord];
+ if (n_offset && e_elem.style.overflow == 'scroll')
+ n_pos -= n_offset;
+ e_elem = e_elem.parentNode;
+ }
+ return n_pos;
+}
+
+function f_tcalRelDate (d_date, d_diff, s_units) {
+ var s_units = (s_units == 'y' ? 'FullYear' : 'Month');
+ var d_result = new Date(d_date);
+ d_result['set' + s_units](d_date['get' + s_units]() + d_diff);
+ if (d_result.getDate() != d_date.getDate())
+ d_result.setDate(0);
+ return ' onclick="A_TCALS[\'' + this.s_id + '\'].f_update(' + d_result.valueOf() + ')"';
+}
+
+function f_tcalHideAll () {
+ for (var i = 0; i < window.A_TCALSIDX.length; i++)
+ window.A_TCALSIDX[i].f_hide();
+}
+
+function f_tcalResetTime (d_date) {
+ d_date.setHours(0);
+ d_date.setMinutes(0);
+ d_date.setSeconds(0);
+ d_date.setMilliseconds(0);
+ return d_date;
+}
+
+f_getElement = document.all ?
+ function (s_id) { return document.all[s_id] } :
+ function (s_id) { return document.getElementById(s_id) };
+
+if (document.addEventListener)
+ window.addEventListener('scroll', f_tcalHideAll, false);
+if (window.attachEvent)
+ window.attachEvent('onscroll', f_tcalHideAll);
+
+// global variables
+var s_userAgent = navigator.userAgent.toLowerCase(),
+ re_webkit = /WebKit\/(\d+)/i;
+var b_mac = s_userAgent.indexOf('mac') != -1,
+ b_ie5 = s_userAgent.indexOf('msie 5') != -1,
+ b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1;
+var b_ieFix = b_ie5 || b_ie6,
+ b_ieMac = b_mac && b_ie5,
+ b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500;
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/cal.gif b/agc_2-X/branches/agc_2.2.0/www/agc/images/cal.gif
new file mode 100644
index 00000000..8526cf5d
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/cal.gif differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/next_mon.gif b/agc_2-X/branches/agc_2.2.0/www/agc/images/next_mon.gif
new file mode 100644
index 00000000..14c622f9
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/next_mon.gif differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/next_year.gif b/agc_2-X/branches/agc_2.2.0/www/agc/images/next_year.gif
new file mode 100644
index 00000000..b66f2888
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/next_year.gif differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/no_cal.gif b/agc_2-X/branches/agc_2.2.0/www/agc/images/no_cal.gif
new file mode 100644
index 00000000..adc58e2a
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/no_cal.gif differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/pixel.gif b/agc_2-X/branches/agc_2.2.0/www/agc/images/pixel.gif
new file mode 100644
index 00000000..46a2cf08
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/pixel.gif differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/prev_mon.gif b/agc_2-X/branches/agc_2.2.0/www/agc/images/prev_mon.gif
new file mode 100644
index 00000000..12ce7ff5
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/prev_mon.gif differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/prev_year.gif b/agc_2-X/branches/agc_2.2.0/www/agc/images/prev_year.gif
new file mode 100644
index 00000000..c726b0e4
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/prev_year.gif differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_bl.png b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_bl.png
new file mode 100644
index 00000000..29bd5543
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_bl.png differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_bm.png b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_bm.png
new file mode 100644
index 00000000..5c4e0af9
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_bm.png differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_br.png b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_br.png
new file mode 100644
index 00000000..ce8a2fad
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_br.png differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_mr.png b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_mr.png
new file mode 100644
index 00000000..4594bc4e
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_mr.png differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_tr.png b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_tr.png
new file mode 100644
index 00000000..2e598c95
Binary files /dev/null and b/agc_2-X/branches/agc_2.2.0/www/agc/images/shade_tr.png differ
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/vdc_script_display.php b/agc_2-X/branches/agc_2.2.0/www/agc/vdc_script_display.php
index 7814428e..8c9bb87d 100644
--- a/agc_2-X/branches/agc_2.2.0/www/agc/vdc_script_display.php
+++ b/agc_2-X/branches/agc_2.2.0/www/agc/vdc_script_display.php
@@ -178,6 +178,8 @@ $ENTRYdate = date("YmdHis");
$MT[0]='';
$agents='@agents';
+$script_height = ($script_height - 20);
+
$IFRAME=0;
#############################################
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/vdc_script_notes.php b/agc_2-X/branches/agc_2.2.0/www/agc/vdc_script_notes.php
new file mode 100644
index 00000000..751af166
--- /dev/null
+++ b/agc_2-X/branches/agc_2.2.0/www/agc/vdc_script_notes.php
@@ -0,0 +1,599 @@
+ LICENSE: AGPLv2
+#
+# This script is designed open in the SCRIPT tab in the agent interface through
+# an IFRAME. It will create a new record for every SUBMIT
+#
+# CHANGELOG:
+# 100215-0744 - First build of script
+#
+
+$version = '2.4-1';
+$build = '100215-0744';
+
+require("dbconnect.php");
+
+
+if (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
+ elseif (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
+if (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
+ elseif (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
+ $vendor_lead_code = $vendor_id;
+if (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
+ elseif (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
+if (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
+ elseif (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
+if (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
+ elseif (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
+if (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
+ elseif (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
+if (isset($_POST["title"])) {$title=$_POST["title"];}
+ elseif (isset($_GET["title"])) {$title=$_GET["title"];}
+if (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
+ elseif (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
+if (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
+ elseif (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
+if (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
+ elseif (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
+if (isset($_POST["address1"])) {$address1=$_POST["address1"];}
+ elseif (isset($_GET["address1"])) {$address1=$_GET["address1"];}
+if (isset($_POST["address2"])) {$address2=$_POST["address2"];}
+ elseif (isset($_GET["address2"])) {$address2=$_GET["address2"];}
+if (isset($_POST["address3"])) {$address3=$_POST["address3"];}
+ elseif (isset($_GET["address3"])) {$address3=$_GET["address3"];}
+if (isset($_POST["city"])) {$city=$_POST["city"];}
+ elseif (isset($_GET["city"])) {$city=$_GET["city"];}
+if (isset($_POST["state"])) {$state=$_POST["state"];}
+ elseif (isset($_GET["state"])) {$state=$_GET["state"];}
+if (isset($_POST["province"])) {$province=$_POST["province"];}
+ elseif (isset($_GET["province"])) {$province=$_GET["province"];}
+if (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
+ elseif (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
+if (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
+ elseif (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
+if (isset($_POST["gender"])) {$gender=$_POST["gender"];}
+ elseif (isset($_GET["gender"])) {$gender=$_GET["gender"];}
+if (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
+ elseif (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
+if (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
+ elseif (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
+if (isset($_POST["email"])) {$email=$_POST["email"];}
+ elseif (isset($_GET["email"])) {$email=$_GET["email"];}
+if (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
+ elseif (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
+if (isset($_POST["comments"])) {$comments=$_POST["comments"];}
+ elseif (isset($_GET["comments"])) {$comments=$_GET["comments"];}
+if (isset($_POST["user"])) {$user=$_POST["user"];}
+ elseif (isset($_GET["user"])) {$user=$_GET["user"];}
+if (isset($_POST["pass"])) {$pass=$_POST["pass"];}
+ elseif (isset($_GET["pass"])) {$pass=$_GET["pass"];}
+if (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
+ elseif (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
+if (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
+ elseif (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
+if (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
+ elseif (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
+if (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
+ elseif (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
+if (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
+ elseif (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
+if (isset($_POST["closer"])) {$closer=$_POST["closer"];}
+ elseif (isset($_GET["closer"])) {$closer=$_GET["closer"];}
+if (isset($_POST["group"])) {$group=$_POST["group"];}
+ elseif (isset($_GET["group"])) {$group=$_GET["group"];}
+if (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
+ elseif (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
+if (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
+ elseif (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
+if (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
+ elseif (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
+if (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
+ elseif (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
+if (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
+ elseif (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
+if (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
+ elseif (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
+if (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
+ elseif (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
+if (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
+ elseif (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
+if (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
+ elseif (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
+if (isset($_POST["phone"])) {$phone=$_POST["phone"];}
+ elseif (isset($_GET["phone"])) {$phone=$_GET["phone"];}
+if (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
+ elseif (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
+if (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
+ elseif (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
+if (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
+ elseif (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
+if (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
+ elseif (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
+if (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
+ elseif (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
+if (isset($_POST["rank"])) {$rank=$_POST["rank"];}
+ elseif (isset($_GET["rank"])) {$rank=$_GET["rank"];}
+if (isset($_POST["owner"])) {$owner=$_POST["owner"];}
+ elseif (isset($_GET["owner"])) {$owner=$_GET["owner"];}
+if (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
+ elseif (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
+if (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
+ elseif (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
+if (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
+ elseif (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
+if (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
+ elseif (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
+if (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
+ elseif (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
+if (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
+ elseif (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
+if (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
+ elseif (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
+if (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
+ elseif (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
+if (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
+ elseif (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
+if (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
+ elseif (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
+if (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
+ elseif (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
+if (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
+ elseif (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
+if (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];}
+ elseif (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];}
+if (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];}
+ elseif (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];}
+if (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];}
+ elseif (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];}
+if (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];}
+ elseif (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];}
+if (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];}
+ elseif (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];}
+if (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];}
+ elseif (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];}
+if (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
+ elseif (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
+if (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
+ elseif (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
+if (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
+ elseif (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
+if (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
+ elseif (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
+
+if (isset($_POST["DB"])) {$DB=$_POST["DB"];}
+ elseif (isset($_GET["DB"])) {$DB=$_GET["DB"];}
+if (isset($_POST["process"])) {$process=$_POST["process"];}
+ elseif (isset($_GET["process"])) {$process=$_GET["process"];}
+if (isset($_POST["vicidial_id"])) {$vicidial_id=$_POST["vicidial_id"];}
+ elseif (isset($_GET["vicidial_id"])) {$vicidial_id=$_GET["vicidial_id"];}
+if (isset($_POST["call_date"])) {$call_date=$_POST["call_date"];}
+ elseif (isset($_GET["call_date"])) {$call_date=$_GET["call_date"];}
+if (isset($_POST["order_id"])) {$order_id=$_POST["order_id"];}
+ elseif (isset($_GET["order_id"])) {$order_id=$_GET["order_id"];}
+if (isset($_POST["appointment_date"])) {$appointment_date=$_POST["appointment_date"];}
+ elseif (isset($_GET["appointment_date"])) {$appointment_date=$_GET["appointment_date"];}
+if (isset($_POST["appointment_time"])) {$appointment_time=$_POST["appointment_time"];}
+ elseif (isset($_GET["appointment_time"])) {$appointment_time=$_GET["appointment_time"];}
+if (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];}
+ elseif (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];}
+if (isset($_POST["notesid"])) {$notesid=$_POST["notesid"];}
+ elseif (isset($_GET["notesid"])) {$notesid=$_GET["notesid"];}
+if ($notesid < 100)
+ {$notesid=0;}
+if (strlen($vicidial_id) < 1)
+ {$vicidial_id = $uniqueid;}
+if (strlen($appointment_time) < 1)
+ {$appointment_time = '12:00:00';}
+
+$appointment_timeARRAY = explode(":",$appointment_time);
+$appointment_hour = $appointment_timeARRAY[0];
+$appointment_min = $appointment_timeARRAY[1];
+
+header ("Content-type: text/html; charset=utf-8");
+header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
+header ("Pragma: no-cache"); // HTTP/1.0
+
+$txt = '.txt';
+$StarTtime = date("U");
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$CIDdate = date("mdHis");
+$ENTRYdate = date("YmdHis");
+$MT[0]='';
+$agents='@agents';
+
+if (strlen($call_date) < 1)
+ {$call_date = $NOW_TIME;}
+
+#############################################
+##### START SYSTEM_SETTINGS LOOKUP #####
+$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$qm_conf_ct = mysql_num_rows($rslt);
+if ($qm_conf_ct > 0)
+ {
+ $row=mysql_fetch_row($rslt);
+ $non_latin = $row[0];
+ $timeclock_end_of_day = $row[1];
+ $agentonly_callback_campaign_lock = $row[2];
+ }
+##### END SETTINGS LOOKUP #####
+###########################################
+
+if ($non_latin < 1)
+ {
+ $user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
+ $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
+ $length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
+ $phone_code = ereg_replace("[^0-9]","",$phone_code);
+ $phone_number = ereg_replace("[^0-9]","",$phone_number);
+ }
+else
+ {
+ $user = ereg_replace("'|\"|\\\\|;","",$user);
+ $pass = ereg_replace("'|\"|\\\\|;","",$pass);
+ }
+
+if ($DB > 0)
+ {
+ echo "
$lead_id|$entry_date|$modify_date|$status|$user|$vendor_lead_code|$source_id|$list_id|$gmt_offset_now|$called_since_last_reset|$phone_code|$phone_number|$title|$first_name|$middle_initial|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country_code|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$last_local_call_time|$rank|$owner|\n
";
+ }
+
+# default optional vars if not set
+if (!isset($format)) {$format="text";}
+ if ($format == 'debug') {$DB=1;}
+if (!isset($ACTION)) {$ACTION="refresh";}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
+if ($DB) {echo "|$stmt|\n";}
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$auth=$row[0];
+
+if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
+ {
+ echo "Invalid Username/Password: |$user|$pass|\n";
+ exit;
+ }
+else
+ {
+ # do nothing for now
+ }
+
+echo "\n";
+echo "\n";
+echo "\n";
+echo "ViciDial Notes";
+echo "\n";
+echo "\n";
+echo "\n";
+?>
+
+\n";
+echo "\n";
+
+if ($process > 0)
+ {
+ #Update vicidial_list record
+ $stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_query($stmt, $link);
+ $affected_rows = mysql_affected_rows($link);
+
+ #Update the agent screen with new data
+ $stmt="UPDATE vicidial_live_agents set external_update_fields='1',external_update_fields_data='vendor_lead_code,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,phone_code,phone_number,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner' where user='$user';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_query($stmt, $link);
+ $affected_rows = mysql_affected_rows($link);
+
+ if ($notesid < 100)
+ {
+ # Insert into vicidial_call_notes
+ $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_query($stmt, $link);
+ $affected_rows = mysql_affected_rows($link);
+ $notesid = mysql_insert_id($link);
+ }
+ else
+ {
+ # update vicidial_call_notes record
+ $stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_query($stmt, $link);
+ $affected_rows = mysql_affected_rows($link);
+ }
+
+ echo "
Data Changes Accepted
";
+ }
+
+$URLarray = explode("?", $PHP_SELF);
+$URLsubmit = $URLarray[0];
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/agc_2-X/branches/agc_2.2.0/www/agc/vicidial.php b/agc_2-X/branches/agc_2.2.0/www/agc/vicidial.php
index 71708d5e..7e68dce3 100644
--- a/agc_2-X/branches/agc_2.2.0/www/agc/vicidial.php
+++ b/agc_2-X/branches/agc_2.2.0/www/agc/vicidial.php
@@ -4925,7 +4925,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5020,7 +5020,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars_two =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5341,7 +5341,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5436,7 +5436,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars_two =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5553,7 +5553,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if ( (view_scripts == 1) && (campaign_script.length > 0) )
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5939,7 +5939,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if ( (view_scripts == 1) && (campaign_script.length > 0) )
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -6672,7 +6672,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -6767,7 +6767,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars_two =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -6867,7 +6867,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if ( (view_scripts == 1) && (CalL_ScripT_id.length > 0) )
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -7048,7 +7048,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if ( (webvars_refresh > 0) || (force_webvars_refresh > 0) )
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -7173,7 +7173,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars_two =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
diff --git a/agc_2-X/branches/agc_2.2.0/www/vicidial/calendar.css b/agc_2-X/branches/agc_2.2.0/www/vicidial/calendar.css
new file mode 100644
index 00000000..a3ddcae5
--- /dev/null
+++ b/agc_2-X/branches/agc_2.2.0/www/vicidial/calendar.css
@@ -0,0 +1,95 @@
+/* calendar icon */
+img.tcalIcon {
+ cursor: pointer;
+ margin-left: 1px;
+ vertical-align: middle;
+}
+/* calendar container element */
+div#tcal {
+ position: absolute;
+ visibility: hidden;
+ z-index: 100;
+ width: 158px;
+ padding: 2px 0 0 0;
+}
+/* all tables in calendar */
+div#tcal table {
+ width: 100%;
+ border: 1px solid silver;
+ border-collapse: collapse;
+ background-color: white;
+}
+/* navigation table */
+div#tcal table.ctrl {
+ border-bottom: 0;
+}
+/* navigation buttons */
+div#tcal table.ctrl td {
+ width: 15px;
+ height: 20px;
+}
+/* month year header */
+div#tcal table.ctrl th {
+ background-color: white;
+ color: black;
+ border: 0;
+}
+/* week days header */
+div#tcal th {
+ border: 1px solid silver;
+ border-collapse: collapse;
+ text-align: center;
+ padding: 3px 0;
+ font-family: tahoma, verdana, arial;
+ font-size: 10px;
+ background-color: gray;
+ color: white;
+}
+/* date cells */
+div#tcal td {
+ border: 0;
+ border-collapse: collapse;
+ text-align: center;
+ padding: 2px 0;
+ font-family: tahoma, verdana, arial;
+ font-size: 11px;
+ width: 22px;
+ cursor: pointer;
+}
+/* date highlight
+ in case of conflicting settings order here determines the priority from least to most important */
+div#tcal td.othermonth {
+ color: silver;
+}
+div#tcal td.weekend {
+ background-color: #ACD6F5;
+}
+div#tcal td.today {
+ border: 1px solid red;
+}
+div#tcal td.selected {
+ background-color: #FFB3BE;
+}
+/* iframe element used to suppress windowed controls in IE5/6 */
+iframe#tcalIF {
+ position: absolute;
+ visibility: hidden;
+ z-index: 98;
+ border: 0;
+}
+/* transparent shadow */
+div#tcalShade {
+ position: absolute;
+ visibility: hidden;
+ z-index: 99;
+}
+div#tcalShade table {
+ border: 0;
+ border-collapse: collapse;
+ width: 100%;
+}
+div#tcalShade table td {
+ border: 0;
+ border-collapse: collapse;
+ padding: 0;
+}
diff --git a/agc_2-X/branches/agc_2.2.0/www/vicidial/calendar_db.js b/agc_2-X/branches/agc_2.2.0/www/vicidial/calendar_db.js
new file mode 100644
index 00000000..ee6c8dd3
--- /dev/null
+++ b/agc_2-X/branches/agc_2.2.0/www/vicidial/calendar_db.js
@@ -0,0 +1,335 @@
+// Tigra Calendar v4.0.2 (2009-01-12) Database (yyyy-mm-dd)
+// http://www.softcomplex.com/products/tigra_calendar/
+// Public Domain Software... You're welcome.
+
+// default settins
+var A_TCALDEF = {
+ 'months' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ 'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ 'yearscroll': true, // show year scroller
+ 'weekstart': 0, // first day of week: 0-Su or 1-Mo
+ 'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx.
+ 'imgpath' : 'images/' // directory with calendar images
+}
+// date parsing function
+function f_tcalParseDate (s_date) {
+
+ var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*$/;
+ if (!re_date.exec(s_date))
+ return alert ("Invalid date: '" + s_date + "'.\nAccepted format is yyyy-mm-dd.")
+ var n_day = Number(RegExp.$3),
+ n_month = Number(RegExp.$2),
+ n_year = Number(RegExp.$1);
+
+ if (n_year < 100)
+ n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900);
+ if (n_month < 1 || n_month > 12)
+ return alert ("Invalid month value: '" + n_month + "'.\nAllowed range is 01-12.");
+ var d_numdays = new Date(n_year, n_month, 0);
+ if (n_day > d_numdays.getDate())
+ return alert("Invalid day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + ".");
+
+ return new Date (n_year, n_month - 1, n_day);
+}
+// date generating function
+function f_tcalGenerDate (d_date) {
+ return (
+ d_date.getFullYear() + "-"
+ + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
+ + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate()
+ );
+}
+
+// implementation
+function tcal (a_cfg, a_tpl) {
+
+ // apply default template if not specified
+ if (!a_tpl)
+ a_tpl = A_TCALDEF;
+
+ // register in global collections
+ if (!window.A_TCALS)
+ window.A_TCALS = [];
+ if (!window.A_TCALSIDX)
+ window.A_TCALSIDX = [];
+
+ this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length;
+ window.A_TCALS[this.s_id] = this;
+ window.A_TCALSIDX[window.A_TCALSIDX.length] = this;
+
+ // assign methods
+ this.f_show = f_tcalShow;
+ this.f_hide = f_tcalHide;
+ this.f_toggle = f_tcalToggle;
+ this.f_update = f_tcalUpdate;
+ this.f_relDate = f_tcalRelDate;
+ this.f_parseDate = f_tcalParseDate;
+ this.f_generDate = f_tcalGenerDate;
+
+ // create calendar icon
+ this.s_iconId = 'tcalico_' + this.s_id;
+ this.e_icon = f_getElement(this.s_iconId);
+ if (!this.e_icon) {
+ document.write('
');
+ this.e_icon = f_getElement(this.s_iconId);
+ }
+ // save received parameters
+ this.a_cfg = a_cfg;
+ this.a_tpl = a_tpl;
+}
+
+function f_tcalShow (d_date) {
+
+ // find input field
+ if (!this.a_cfg.controlname)
+ throw("TC: control name is not specified");
+ if (this.a_cfg.formname) {
+ var e_form = document.forms[this.a_cfg.formname];
+ if (!e_form)
+ throw("TC: form '" + this.a_cfg.formname + "' can not be found");
+ this.e_input = e_form.elements[this.a_cfg.controlname];
+ }
+ else
+ this.e_input = f_getElement(this.a_cfg.controlname);
+
+ if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT')
+ throw("TC: element '" + this.a_cfg.controlname + "' does not exist in "
+ + (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document'));
+
+ // dynamically create HTML elements if needed
+ this.e_div = f_getElement('tcal');
+ if (!this.e_div) {
+ this.e_div = document.createElement("DIV");
+ this.e_div.id = 'tcal';
+ document.body.appendChild(this.e_div);
+ }
+ this.e_shade = f_getElement('tcalShade');
+ if (!this.e_shade) {
+ this.e_shade = document.createElement("DIV");
+ this.e_shade.id = 'tcalShade';
+ document.body.appendChild(this.e_shade);
+ }
+ this.e_iframe = f_getElement('tcalIF')
+ if (b_ieFix && !this.e_iframe) {
+ this.e_iframe = document.createElement("IFRAME");
+ this.e_iframe.style.filter = 'alpha(opacity=0)';
+ this.e_iframe.id = 'tcalIF';
+ this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif';
+ document.body.appendChild(this.e_iframe);
+ }
+
+ // hide all calendars
+ f_tcalHideAll();
+
+ // generate HTML and show calendar
+ this.e_icon = f_getElement(this.s_iconId);
+ if (!this.f_update())
+ return;
+
+ this.e_div.style.visibility = 'visible';
+ this.e_shade.style.visibility = 'visible';
+ if (this.e_iframe)
+ this.e_iframe.style.visibility = 'visible';
+
+ // change icon and status
+ this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif';
+ this.e_icon.title = 'Close Calendar';
+ this.b_visible = true;
+}
+
+function f_tcalHide (n_date) {
+ if (n_date)
+ this.e_input.value = this.f_generDate(new Date(n_date));
+
+ // no action if not visible
+ if (!this.b_visible)
+ return;
+
+ // hide elements
+ if (this.e_iframe)
+ this.e_iframe.style.visibility = 'hidden';
+ if (this.e_shade)
+ this.e_shade.style.visibility = 'hidden';
+ this.e_div.style.visibility = 'hidden';
+
+ // change icon and status
+ this.e_icon = f_getElement(this.s_iconId);
+ this.e_icon.src = this.a_tpl.imgpath + 'cal.gif';
+ this.e_icon.title = 'Open Calendar';
+ this.b_visible = false;
+}
+
+function f_tcalToggle () {
+ return this.b_visible ? this.f_hide() : this.f_show();
+}
+
+function f_tcalUpdate (d_date) {
+
+ var d_today = this.a_cfg.today ? this.f_parseDate(this.a_cfg.today) : f_tcalResetTime(new Date());
+ var d_selected = this.e_input.value == ''
+ ? (this.a_cfg.selected ? this.f_parseDate(this.a_cfg.selected) : d_today)
+ : this.f_parseDate(this.e_input.value);
+
+ // figure out date to display
+ if (!d_date)
+ // selected by default
+ d_date = d_selected;
+ else if (typeof(d_date) == 'number')
+ // get from number
+ d_date = f_tcalResetTime(new Date(d_date));
+ else if (typeof(d_date) == 'string')
+ // parse from string
+ this.f_parseDate(d_date);
+
+ if (!d_date) return false;
+
+ // first date to display
+ var d_firstday = new Date(d_date);
+ d_firstday.setDate(1);
+ d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7);
+
+ var a_class, s_html = ''
+ + (this.a_tpl.yearscroll ? ' | ' : '')
+ + ' | '
+ + this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear()
+ + ' |  | '
+ + (this.a_tpl.yearscroll ? ' | ' : '')
+ + '
';
+
+ // print weekdays titles
+ for (var i = 0; i < 7; i++)
+ s_html += '| ' + this.a_tpl.weekdays[(this.a_tpl.weekstart + i) % 7] + ' | ';
+ s_html += '
' ;
+
+ // print calendar table
+ var n_date, n_month, d_current = new Date(d_firstday);
+ while (d_current.getMonth() == d_date.getMonth() ||
+ d_current.getMonth() == d_firstday.getMonth()) {
+
+ // print row heder
+ s_html +='';
+ for (var n_wday = 0; n_wday < 7; n_wday++) {
+
+ a_class = [];
+ n_date = d_current.getDate();
+ n_month = d_current.getMonth();
+
+ // other month
+ if (d_current.getMonth() != d_date.getMonth())
+ a_class[a_class.length] = 'othermonth';
+ // weekend
+ if (d_current.getDay() == 0 || d_current.getDay() == 6)
+ a_class[a_class.length] = 'weekend';
+ // today
+ if (d_current.valueOf() == d_today.valueOf())
+ a_class[a_class.length] = 'today';
+ // selected
+ if (d_current.valueOf() == d_selected.valueOf())
+ a_class[a_class.length] = 'selected';
+
+ s_html += '| ' : '>') + n_date + ' | '
+
+ d_current.setDate(++n_date);
+ while (d_current.getDate() != n_date && d_current.getMonth() == n_month) {
+ d_current.setHours(d_current.getHours + 1);
+ d_current = f_tcalResetTime(d_current);
+ }
+ }
+ // print row footer
+ s_html +='
';
+ }
+ s_html +='
';
+
+ // update HTML, positions and sizes
+ this.e_div.innerHTML = s_html;
+
+ var n_width = this.e_div.offsetWidth;
+ var n_height = this.e_div.offsetHeight;
+ var n_top = f_getPosition (this.e_icon, 'Top') + this.e_icon.offsetHeight;
+ var n_left = f_getPosition (this.e_icon, 'Left') - n_width + this.e_icon.offsetWidth;
+ if (n_left < 0) n_left = 0;
+
+ this.e_div.style.left = n_left + 'px';
+ this.e_div.style.top = n_top + 'px';
+
+ this.e_shade.style.width = (n_width + 8) + 'px';
+ this.e_shade.style.left = (n_left - 1) + 'px';
+ this.e_shade.style.top = (n_top - 1) + 'px';
+ this.e_shade.innerHTML = b_ieFix
+ ? ''
+ : '';
+
+ if (this.e_iframe) {
+ this.e_iframe.style.left = n_left + 'px';
+ this.e_iframe.style.top = n_top + 'px';
+ this.e_iframe.style.width = (n_width + 6) + 'px';
+ this.e_iframe.style.height = (n_height + 6) +'px';
+ }
+ return true;
+}
+
+function f_getPosition (e_elemRef, s_coord) {
+ var n_pos = 0, n_offset,
+ e_elem = e_elemRef;
+
+ while (e_elem) {
+ n_offset = e_elem["offset" + s_coord];
+ n_pos += n_offset;
+ e_elem = e_elem.offsetParent;
+ }
+ // margin correction in some browsers
+ if (b_ieMac)
+ n_pos += parseInt(document.body[s_coord.toLowerCase() + 'Margin']);
+ else if (b_safari)
+ n_pos -= n_offset;
+
+ e_elem = e_elemRef;
+ while (e_elem != document.body) {
+ n_offset = e_elem["scroll" + s_coord];
+ if (n_offset && e_elem.style.overflow == 'scroll')
+ n_pos -= n_offset;
+ e_elem = e_elem.parentNode;
+ }
+ return n_pos;
+}
+
+function f_tcalRelDate (d_date, d_diff, s_units) {
+ var s_units = (s_units == 'y' ? 'FullYear' : 'Month');
+ var d_result = new Date(d_date);
+ d_result['set' + s_units](d_date['get' + s_units]() + d_diff);
+ if (d_result.getDate() != d_date.getDate())
+ d_result.setDate(0);
+ return ' onclick="A_TCALS[\'' + this.s_id + '\'].f_update(' + d_result.valueOf() + ')"';
+}
+
+function f_tcalHideAll () {
+ for (var i = 0; i < window.A_TCALSIDX.length; i++)
+ window.A_TCALSIDX[i].f_hide();
+}
+
+function f_tcalResetTime (d_date) {
+ d_date.setHours(0);
+ d_date.setMinutes(0);
+ d_date.setSeconds(0);
+ d_date.setMilliseconds(0);
+ return d_date;
+}
+
+f_getElement = document.all ?
+ function (s_id) { return document.all[s_id] } :
+ function (s_id) { return document.getElementById(s_id) };
+
+if (document.addEventListener)
+ window.addEventListener('scroll', f_tcalHideAll, false);
+if (window.attachEvent)
+ window.attachEvent('onscroll', f_tcalHideAll);
+
+// global variables
+var s_userAgent = navigator.userAgent.toLowerCase(),
+ re_webkit = /WebKit\/(\d+)/i;
+var b_mac = s_userAgent.indexOf('mac') != -1,
+ b_ie5 = s_userAgent.indexOf('msie 5') != -1,
+ b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1;
+var b_ieFix = b_ie5 || b_ie6,
+ b_ieMac = b_mac && b_ie5,
+ b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500;
diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE
index 4de28ce7..95f48512 100644
--- a/agc_2-X/trunk/UPGRADE
+++ b/agc_2-X/trunk/UPGRADE
@@ -37,6 +37,9 @@ OTHER CHANGES:
4. Added ability to use a webphone added in an IFRAME in the agent screen.
Tested with Zoiper webphone and sample code included
+5. Added vdc_script_notes.php for call notes and appointment taking, read
+ comments for more information.
+
diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
index 40154aff..43661bc3 100644
--- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
+++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
@@ -1903,6 +1903,19 @@ user_level TINYINT(2),
vtiger_role VARCHAR(5)
);
+CREATE TABLE vicidial_call_notes (
+notesid INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+lead_id INT(9) UNSIGNED NOT NULL,
+vicidial_id VARCHAR(20),
+call_date DATETIME,
+order_id VARCHAR(20),
+appointment_date DATE,
+appointment_time TIME,
+call_notes TEXT
+);
+
+ALTER TABLE vicidial_call_notes AUTO_INCREMENT = 100;
+
ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP;
@@ -2040,7 +2053,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N
CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log;
-UPDATE system_settings SET db_schema_version='1198',db_schema_update_date=NOW();
+UPDATE system_settings SET db_schema_version='1199',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
diff --git a/agc_2-X/trunk/extras/upgrade_2.4.sql b/agc_2-X/trunk/extras/upgrade_2.4.sql
index ff2b32e4..ce892c3e 100644
--- a/agc_2-X/trunk/extras/upgrade_2.4.sql
+++ b/agc_2-X/trunk/extras/upgrade_2.4.sql
@@ -34,3 +34,18 @@ ALTER TABLE system_settings ADD default_external_server_ip ENUM('1','0') default
ALTER TABLE system_settings ADD webphone_url VARCHAR(255) default '';
UPDATE system_settings SET db_schema_version='1198',db_schema_update_date=NOW();
+
+CREATE TABLE vicidial_call_notes (
+notesid INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+lead_id INT(9) UNSIGNED NOT NULL,
+vicidial_id VARCHAR(20),
+call_date DATETIME,
+order_id VARCHAR(20),
+appointment_date DATE,
+appointment_time TIME,
+call_notes TEXT
+);
+
+ALTER TABLE vicidial_call_notes AUTO_INCREMENT = 100;
+
+UPDATE system_settings SET db_schema_version='1199',db_schema_update_date=NOW();
diff --git a/agc_2-X/trunk/www/agc/calendar.css b/agc_2-X/trunk/www/agc/calendar.css
new file mode 100644
index 00000000..a3ddcae5
--- /dev/null
+++ b/agc_2-X/trunk/www/agc/calendar.css
@@ -0,0 +1,95 @@
+/* calendar icon */
+img.tcalIcon {
+ cursor: pointer;
+ margin-left: 1px;
+ vertical-align: middle;
+}
+/* calendar container element */
+div#tcal {
+ position: absolute;
+ visibility: hidden;
+ z-index: 100;
+ width: 158px;
+ padding: 2px 0 0 0;
+}
+/* all tables in calendar */
+div#tcal table {
+ width: 100%;
+ border: 1px solid silver;
+ border-collapse: collapse;
+ background-color: white;
+}
+/* navigation table */
+div#tcal table.ctrl {
+ border-bottom: 0;
+}
+/* navigation buttons */
+div#tcal table.ctrl td {
+ width: 15px;
+ height: 20px;
+}
+/* month year header */
+div#tcal table.ctrl th {
+ background-color: white;
+ color: black;
+ border: 0;
+}
+/* week days header */
+div#tcal th {
+ border: 1px solid silver;
+ border-collapse: collapse;
+ text-align: center;
+ padding: 3px 0;
+ font-family: tahoma, verdana, arial;
+ font-size: 10px;
+ background-color: gray;
+ color: white;
+}
+/* date cells */
+div#tcal td {
+ border: 0;
+ border-collapse: collapse;
+ text-align: center;
+ padding: 2px 0;
+ font-family: tahoma, verdana, arial;
+ font-size: 11px;
+ width: 22px;
+ cursor: pointer;
+}
+/* date highlight
+ in case of conflicting settings order here determines the priority from least to most important */
+div#tcal td.othermonth {
+ color: silver;
+}
+div#tcal td.weekend {
+ background-color: #ACD6F5;
+}
+div#tcal td.today {
+ border: 1px solid red;
+}
+div#tcal td.selected {
+ background-color: #FFB3BE;
+}
+/* iframe element used to suppress windowed controls in IE5/6 */
+iframe#tcalIF {
+ position: absolute;
+ visibility: hidden;
+ z-index: 98;
+ border: 0;
+}
+/* transparent shadow */
+div#tcalShade {
+ position: absolute;
+ visibility: hidden;
+ z-index: 99;
+}
+div#tcalShade table {
+ border: 0;
+ border-collapse: collapse;
+ width: 100%;
+}
+div#tcalShade table td {
+ border: 0;
+ border-collapse: collapse;
+ padding: 0;
+}
diff --git a/agc_2-X/trunk/www/agc/calendar_db.js b/agc_2-X/trunk/www/agc/calendar_db.js
new file mode 100644
index 00000000..ee6c8dd3
--- /dev/null
+++ b/agc_2-X/trunk/www/agc/calendar_db.js
@@ -0,0 +1,335 @@
+// Tigra Calendar v4.0.2 (2009-01-12) Database (yyyy-mm-dd)
+// http://www.softcomplex.com/products/tigra_calendar/
+// Public Domain Software... You're welcome.
+
+// default settins
+var A_TCALDEF = {
+ 'months' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ 'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ 'yearscroll': true, // show year scroller
+ 'weekstart': 0, // first day of week: 0-Su or 1-Mo
+ 'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx.
+ 'imgpath' : 'images/' // directory with calendar images
+}
+// date parsing function
+function f_tcalParseDate (s_date) {
+
+ var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*$/;
+ if (!re_date.exec(s_date))
+ return alert ("Invalid date: '" + s_date + "'.\nAccepted format is yyyy-mm-dd.")
+ var n_day = Number(RegExp.$3),
+ n_month = Number(RegExp.$2),
+ n_year = Number(RegExp.$1);
+
+ if (n_year < 100)
+ n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900);
+ if (n_month < 1 || n_month > 12)
+ return alert ("Invalid month value: '" + n_month + "'.\nAllowed range is 01-12.");
+ var d_numdays = new Date(n_year, n_month, 0);
+ if (n_day > d_numdays.getDate())
+ return alert("Invalid day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + ".");
+
+ return new Date (n_year, n_month - 1, n_day);
+}
+// date generating function
+function f_tcalGenerDate (d_date) {
+ return (
+ d_date.getFullYear() + "-"
+ + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
+ + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate()
+ );
+}
+
+// implementation
+function tcal (a_cfg, a_tpl) {
+
+ // apply default template if not specified
+ if (!a_tpl)
+ a_tpl = A_TCALDEF;
+
+ // register in global collections
+ if (!window.A_TCALS)
+ window.A_TCALS = [];
+ if (!window.A_TCALSIDX)
+ window.A_TCALSIDX = [];
+
+ this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length;
+ window.A_TCALS[this.s_id] = this;
+ window.A_TCALSIDX[window.A_TCALSIDX.length] = this;
+
+ // assign methods
+ this.f_show = f_tcalShow;
+ this.f_hide = f_tcalHide;
+ this.f_toggle = f_tcalToggle;
+ this.f_update = f_tcalUpdate;
+ this.f_relDate = f_tcalRelDate;
+ this.f_parseDate = f_tcalParseDate;
+ this.f_generDate = f_tcalGenerDate;
+
+ // create calendar icon
+ this.s_iconId = 'tcalico_' + this.s_id;
+ this.e_icon = f_getElement(this.s_iconId);
+ if (!this.e_icon) {
+ document.write('
');
+ this.e_icon = f_getElement(this.s_iconId);
+ }
+ // save received parameters
+ this.a_cfg = a_cfg;
+ this.a_tpl = a_tpl;
+}
+
+function f_tcalShow (d_date) {
+
+ // find input field
+ if (!this.a_cfg.controlname)
+ throw("TC: control name is not specified");
+ if (this.a_cfg.formname) {
+ var e_form = document.forms[this.a_cfg.formname];
+ if (!e_form)
+ throw("TC: form '" + this.a_cfg.formname + "' can not be found");
+ this.e_input = e_form.elements[this.a_cfg.controlname];
+ }
+ else
+ this.e_input = f_getElement(this.a_cfg.controlname);
+
+ if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT')
+ throw("TC: element '" + this.a_cfg.controlname + "' does not exist in "
+ + (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document'));
+
+ // dynamically create HTML elements if needed
+ this.e_div = f_getElement('tcal');
+ if (!this.e_div) {
+ this.e_div = document.createElement("DIV");
+ this.e_div.id = 'tcal';
+ document.body.appendChild(this.e_div);
+ }
+ this.e_shade = f_getElement('tcalShade');
+ if (!this.e_shade) {
+ this.e_shade = document.createElement("DIV");
+ this.e_shade.id = 'tcalShade';
+ document.body.appendChild(this.e_shade);
+ }
+ this.e_iframe = f_getElement('tcalIF')
+ if (b_ieFix && !this.e_iframe) {
+ this.e_iframe = document.createElement("IFRAME");
+ this.e_iframe.style.filter = 'alpha(opacity=0)';
+ this.e_iframe.id = 'tcalIF';
+ this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif';
+ document.body.appendChild(this.e_iframe);
+ }
+
+ // hide all calendars
+ f_tcalHideAll();
+
+ // generate HTML and show calendar
+ this.e_icon = f_getElement(this.s_iconId);
+ if (!this.f_update())
+ return;
+
+ this.e_div.style.visibility = 'visible';
+ this.e_shade.style.visibility = 'visible';
+ if (this.e_iframe)
+ this.e_iframe.style.visibility = 'visible';
+
+ // change icon and status
+ this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif';
+ this.e_icon.title = 'Close Calendar';
+ this.b_visible = true;
+}
+
+function f_tcalHide (n_date) {
+ if (n_date)
+ this.e_input.value = this.f_generDate(new Date(n_date));
+
+ // no action if not visible
+ if (!this.b_visible)
+ return;
+
+ // hide elements
+ if (this.e_iframe)
+ this.e_iframe.style.visibility = 'hidden';
+ if (this.e_shade)
+ this.e_shade.style.visibility = 'hidden';
+ this.e_div.style.visibility = 'hidden';
+
+ // change icon and status
+ this.e_icon = f_getElement(this.s_iconId);
+ this.e_icon.src = this.a_tpl.imgpath + 'cal.gif';
+ this.e_icon.title = 'Open Calendar';
+ this.b_visible = false;
+}
+
+function f_tcalToggle () {
+ return this.b_visible ? this.f_hide() : this.f_show();
+}
+
+function f_tcalUpdate (d_date) {
+
+ var d_today = this.a_cfg.today ? this.f_parseDate(this.a_cfg.today) : f_tcalResetTime(new Date());
+ var d_selected = this.e_input.value == ''
+ ? (this.a_cfg.selected ? this.f_parseDate(this.a_cfg.selected) : d_today)
+ : this.f_parseDate(this.e_input.value);
+
+ // figure out date to display
+ if (!d_date)
+ // selected by default
+ d_date = d_selected;
+ else if (typeof(d_date) == 'number')
+ // get from number
+ d_date = f_tcalResetTime(new Date(d_date));
+ else if (typeof(d_date) == 'string')
+ // parse from string
+ this.f_parseDate(d_date);
+
+ if (!d_date) return false;
+
+ // first date to display
+ var d_firstday = new Date(d_date);
+ d_firstday.setDate(1);
+ d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7);
+
+ var a_class, s_html = ''
+ + (this.a_tpl.yearscroll ? ' | ' : '')
+ + ' | '
+ + this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear()
+ + ' |  | '
+ + (this.a_tpl.yearscroll ? ' | ' : '')
+ + '
';
+
+ // print weekdays titles
+ for (var i = 0; i < 7; i++)
+ s_html += '| ' + this.a_tpl.weekdays[(this.a_tpl.weekstart + i) % 7] + ' | ';
+ s_html += '
' ;
+
+ // print calendar table
+ var n_date, n_month, d_current = new Date(d_firstday);
+ while (d_current.getMonth() == d_date.getMonth() ||
+ d_current.getMonth() == d_firstday.getMonth()) {
+
+ // print row heder
+ s_html +='';
+ for (var n_wday = 0; n_wday < 7; n_wday++) {
+
+ a_class = [];
+ n_date = d_current.getDate();
+ n_month = d_current.getMonth();
+
+ // other month
+ if (d_current.getMonth() != d_date.getMonth())
+ a_class[a_class.length] = 'othermonth';
+ // weekend
+ if (d_current.getDay() == 0 || d_current.getDay() == 6)
+ a_class[a_class.length] = 'weekend';
+ // today
+ if (d_current.valueOf() == d_today.valueOf())
+ a_class[a_class.length] = 'today';
+ // selected
+ if (d_current.valueOf() == d_selected.valueOf())
+ a_class[a_class.length] = 'selected';
+
+ s_html += '| ' : '>') + n_date + ' | '
+
+ d_current.setDate(++n_date);
+ while (d_current.getDate() != n_date && d_current.getMonth() == n_month) {
+ d_current.setHours(d_current.getHours + 1);
+ d_current = f_tcalResetTime(d_current);
+ }
+ }
+ // print row footer
+ s_html +='
';
+ }
+ s_html +='
';
+
+ // update HTML, positions and sizes
+ this.e_div.innerHTML = s_html;
+
+ var n_width = this.e_div.offsetWidth;
+ var n_height = this.e_div.offsetHeight;
+ var n_top = f_getPosition (this.e_icon, 'Top') + this.e_icon.offsetHeight;
+ var n_left = f_getPosition (this.e_icon, 'Left') - n_width + this.e_icon.offsetWidth;
+ if (n_left < 0) n_left = 0;
+
+ this.e_div.style.left = n_left + 'px';
+ this.e_div.style.top = n_top + 'px';
+
+ this.e_shade.style.width = (n_width + 8) + 'px';
+ this.e_shade.style.left = (n_left - 1) + 'px';
+ this.e_shade.style.top = (n_top - 1) + 'px';
+ this.e_shade.innerHTML = b_ieFix
+ ? ''
+ : '';
+
+ if (this.e_iframe) {
+ this.e_iframe.style.left = n_left + 'px';
+ this.e_iframe.style.top = n_top + 'px';
+ this.e_iframe.style.width = (n_width + 6) + 'px';
+ this.e_iframe.style.height = (n_height + 6) +'px';
+ }
+ return true;
+}
+
+function f_getPosition (e_elemRef, s_coord) {
+ var n_pos = 0, n_offset,
+ e_elem = e_elemRef;
+
+ while (e_elem) {
+ n_offset = e_elem["offset" + s_coord];
+ n_pos += n_offset;
+ e_elem = e_elem.offsetParent;
+ }
+ // margin correction in some browsers
+ if (b_ieMac)
+ n_pos += parseInt(document.body[s_coord.toLowerCase() + 'Margin']);
+ else if (b_safari)
+ n_pos -= n_offset;
+
+ e_elem = e_elemRef;
+ while (e_elem != document.body) {
+ n_offset = e_elem["scroll" + s_coord];
+ if (n_offset && e_elem.style.overflow == 'scroll')
+ n_pos -= n_offset;
+ e_elem = e_elem.parentNode;
+ }
+ return n_pos;
+}
+
+function f_tcalRelDate (d_date, d_diff, s_units) {
+ var s_units = (s_units == 'y' ? 'FullYear' : 'Month');
+ var d_result = new Date(d_date);
+ d_result['set' + s_units](d_date['get' + s_units]() + d_diff);
+ if (d_result.getDate() != d_date.getDate())
+ d_result.setDate(0);
+ return ' onclick="A_TCALS[\'' + this.s_id + '\'].f_update(' + d_result.valueOf() + ')"';
+}
+
+function f_tcalHideAll () {
+ for (var i = 0; i < window.A_TCALSIDX.length; i++)
+ window.A_TCALSIDX[i].f_hide();
+}
+
+function f_tcalResetTime (d_date) {
+ d_date.setHours(0);
+ d_date.setMinutes(0);
+ d_date.setSeconds(0);
+ d_date.setMilliseconds(0);
+ return d_date;
+}
+
+f_getElement = document.all ?
+ function (s_id) { return document.all[s_id] } :
+ function (s_id) { return document.getElementById(s_id) };
+
+if (document.addEventListener)
+ window.addEventListener('scroll', f_tcalHideAll, false);
+if (window.attachEvent)
+ window.attachEvent('onscroll', f_tcalHideAll);
+
+// global variables
+var s_userAgent = navigator.userAgent.toLowerCase(),
+ re_webkit = /WebKit\/(\d+)/i;
+var b_mac = s_userAgent.indexOf('mac') != -1,
+ b_ie5 = s_userAgent.indexOf('msie 5') != -1,
+ b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1;
+var b_ieFix = b_ie5 || b_ie6,
+ b_ieMac = b_mac && b_ie5,
+ b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500;
diff --git a/agc_2-X/trunk/www/agc/images/cal.gif b/agc_2-X/trunk/www/agc/images/cal.gif
new file mode 100644
index 00000000..8526cf5d
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/cal.gif differ
diff --git a/agc_2-X/trunk/www/agc/images/next_mon.gif b/agc_2-X/trunk/www/agc/images/next_mon.gif
new file mode 100644
index 00000000..14c622f9
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/next_mon.gif differ
diff --git a/agc_2-X/trunk/www/agc/images/next_year.gif b/agc_2-X/trunk/www/agc/images/next_year.gif
new file mode 100644
index 00000000..b66f2888
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/next_year.gif differ
diff --git a/agc_2-X/trunk/www/agc/images/no_cal.gif b/agc_2-X/trunk/www/agc/images/no_cal.gif
new file mode 100644
index 00000000..adc58e2a
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/no_cal.gif differ
diff --git a/agc_2-X/trunk/www/agc/images/pixel.gif b/agc_2-X/trunk/www/agc/images/pixel.gif
new file mode 100644
index 00000000..46a2cf08
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/pixel.gif differ
diff --git a/agc_2-X/trunk/www/agc/images/prev_mon.gif b/agc_2-X/trunk/www/agc/images/prev_mon.gif
new file mode 100644
index 00000000..12ce7ff5
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/prev_mon.gif differ
diff --git a/agc_2-X/trunk/www/agc/images/prev_year.gif b/agc_2-X/trunk/www/agc/images/prev_year.gif
new file mode 100644
index 00000000..c726b0e4
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/prev_year.gif differ
diff --git a/agc_2-X/trunk/www/agc/images/shade_bl.png b/agc_2-X/trunk/www/agc/images/shade_bl.png
new file mode 100644
index 00000000..29bd5543
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/shade_bl.png differ
diff --git a/agc_2-X/trunk/www/agc/images/shade_bm.png b/agc_2-X/trunk/www/agc/images/shade_bm.png
new file mode 100644
index 00000000..5c4e0af9
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/shade_bm.png differ
diff --git a/agc_2-X/trunk/www/agc/images/shade_br.png b/agc_2-X/trunk/www/agc/images/shade_br.png
new file mode 100644
index 00000000..ce8a2fad
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/shade_br.png differ
diff --git a/agc_2-X/trunk/www/agc/images/shade_mr.png b/agc_2-X/trunk/www/agc/images/shade_mr.png
new file mode 100644
index 00000000..4594bc4e
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/shade_mr.png differ
diff --git a/agc_2-X/trunk/www/agc/images/shade_tr.png b/agc_2-X/trunk/www/agc/images/shade_tr.png
new file mode 100644
index 00000000..2e598c95
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/shade_tr.png differ
diff --git a/agc_2-X/trunk/www/agc/vdc_script_display.php b/agc_2-X/trunk/www/agc/vdc_script_display.php
index 3dc812ab..81115084 100644
--- a/agc_2-X/trunk/www/agc/vdc_script_display.php
+++ b/agc_2-X/trunk/www/agc/vdc_script_display.php
@@ -178,6 +178,7 @@ $CIDdate = date("mdHis");
$ENTRYdate = date("YmdHis");
$MT[0]='';
$agents='@agents';
+$script_height = ($script_height - 20);
$IFRAME=0;
diff --git a/agc_2-X/trunk/www/agc/vdc_script_notes.php b/agc_2-X/trunk/www/agc/vdc_script_notes.php
new file mode 100644
index 00000000..9395c47e
--- /dev/null
+++ b/agc_2-X/trunk/www/agc/vdc_script_notes.php
@@ -0,0 +1,602 @@
+ LICENSE: AGPLv2
+#
+# This script is designed open in the SCRIPT tab in the agent interface through
+# an IFRAME. It will create a new record for every SUBMIT
+#
+# Example of a ViciDial agent SCRIPT using this script:
+#
+#
+# CHANGELOG:
+# 100215-0744 - First build of script
+#
+
+$version = '2.4-1';
+$build = '100215-0744';
+
+require("dbconnect.php");
+
+
+if (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
+ elseif (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
+if (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
+ elseif (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
+ $vendor_lead_code = $vendor_id;
+if (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
+ elseif (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
+if (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
+ elseif (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
+if (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
+ elseif (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
+if (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
+ elseif (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
+if (isset($_POST["title"])) {$title=$_POST["title"];}
+ elseif (isset($_GET["title"])) {$title=$_GET["title"];}
+if (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
+ elseif (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
+if (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
+ elseif (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
+if (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
+ elseif (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
+if (isset($_POST["address1"])) {$address1=$_POST["address1"];}
+ elseif (isset($_GET["address1"])) {$address1=$_GET["address1"];}
+if (isset($_POST["address2"])) {$address2=$_POST["address2"];}
+ elseif (isset($_GET["address2"])) {$address2=$_GET["address2"];}
+if (isset($_POST["address3"])) {$address3=$_POST["address3"];}
+ elseif (isset($_GET["address3"])) {$address3=$_GET["address3"];}
+if (isset($_POST["city"])) {$city=$_POST["city"];}
+ elseif (isset($_GET["city"])) {$city=$_GET["city"];}
+if (isset($_POST["state"])) {$state=$_POST["state"];}
+ elseif (isset($_GET["state"])) {$state=$_GET["state"];}
+if (isset($_POST["province"])) {$province=$_POST["province"];}
+ elseif (isset($_GET["province"])) {$province=$_GET["province"];}
+if (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
+ elseif (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
+if (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
+ elseif (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
+if (isset($_POST["gender"])) {$gender=$_POST["gender"];}
+ elseif (isset($_GET["gender"])) {$gender=$_GET["gender"];}
+if (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
+ elseif (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
+if (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
+ elseif (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
+if (isset($_POST["email"])) {$email=$_POST["email"];}
+ elseif (isset($_GET["email"])) {$email=$_GET["email"];}
+if (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
+ elseif (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
+if (isset($_POST["comments"])) {$comments=$_POST["comments"];}
+ elseif (isset($_GET["comments"])) {$comments=$_GET["comments"];}
+if (isset($_POST["user"])) {$user=$_POST["user"];}
+ elseif (isset($_GET["user"])) {$user=$_GET["user"];}
+if (isset($_POST["pass"])) {$pass=$_POST["pass"];}
+ elseif (isset($_GET["pass"])) {$pass=$_GET["pass"];}
+if (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
+ elseif (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
+if (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
+ elseif (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
+if (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
+ elseif (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
+if (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
+ elseif (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
+if (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
+ elseif (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
+if (isset($_POST["closer"])) {$closer=$_POST["closer"];}
+ elseif (isset($_GET["closer"])) {$closer=$_GET["closer"];}
+if (isset($_POST["group"])) {$group=$_POST["group"];}
+ elseif (isset($_GET["group"])) {$group=$_GET["group"];}
+if (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
+ elseif (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
+if (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
+ elseif (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
+if (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
+ elseif (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
+if (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
+ elseif (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
+if (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
+ elseif (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
+if (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
+ elseif (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
+if (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
+ elseif (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
+if (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
+ elseif (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
+if (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
+ elseif (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
+if (isset($_POST["phone"])) {$phone=$_POST["phone"];}
+ elseif (isset($_GET["phone"])) {$phone=$_GET["phone"];}
+if (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
+ elseif (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
+if (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
+ elseif (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
+if (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
+ elseif (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
+if (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
+ elseif (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
+if (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
+ elseif (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
+if (isset($_POST["rank"])) {$rank=$_POST["rank"];}
+ elseif (isset($_GET["rank"])) {$rank=$_GET["rank"];}
+if (isset($_POST["owner"])) {$owner=$_POST["owner"];}
+ elseif (isset($_GET["owner"])) {$owner=$_GET["owner"];}
+if (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
+ elseif (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
+if (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
+ elseif (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
+if (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
+ elseif (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
+if (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
+ elseif (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
+if (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
+ elseif (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
+if (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
+ elseif (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
+if (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
+ elseif (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
+if (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
+ elseif (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
+if (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
+ elseif (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
+if (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
+ elseif (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
+if (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
+ elseif (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
+if (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
+ elseif (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
+if (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];}
+ elseif (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];}
+if (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];}
+ elseif (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];}
+if (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];}
+ elseif (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];}
+if (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];}
+ elseif (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];}
+if (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];}
+ elseif (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];}
+if (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];}
+ elseif (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];}
+if (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
+ elseif (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
+if (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
+ elseif (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
+if (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
+ elseif (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
+if (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
+ elseif (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
+
+if (isset($_POST["DB"])) {$DB=$_POST["DB"];}
+ elseif (isset($_GET["DB"])) {$DB=$_GET["DB"];}
+if (isset($_POST["process"])) {$process=$_POST["process"];}
+ elseif (isset($_GET["process"])) {$process=$_GET["process"];}
+if (isset($_POST["vicidial_id"])) {$vicidial_id=$_POST["vicidial_id"];}
+ elseif (isset($_GET["vicidial_id"])) {$vicidial_id=$_GET["vicidial_id"];}
+if (isset($_POST["call_date"])) {$call_date=$_POST["call_date"];}
+ elseif (isset($_GET["call_date"])) {$call_date=$_GET["call_date"];}
+if (isset($_POST["order_id"])) {$order_id=$_POST["order_id"];}
+ elseif (isset($_GET["order_id"])) {$order_id=$_GET["order_id"];}
+if (isset($_POST["appointment_date"])) {$appointment_date=$_POST["appointment_date"];}
+ elseif (isset($_GET["appointment_date"])) {$appointment_date=$_GET["appointment_date"];}
+if (isset($_POST["appointment_time"])) {$appointment_time=$_POST["appointment_time"];}
+ elseif (isset($_GET["appointment_time"])) {$appointment_time=$_GET["appointment_time"];}
+if (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];}
+ elseif (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];}
+if (isset($_POST["notesid"])) {$notesid=$_POST["notesid"];}
+ elseif (isset($_GET["notesid"])) {$notesid=$_GET["notesid"];}
+if ($notesid < 100)
+ {$notesid=0;}
+if (strlen($vicidial_id) < 1)
+ {$vicidial_id = $uniqueid;}
+if (strlen($appointment_time) < 1)
+ {$appointment_time = '12:00:00';}
+
+$appointment_timeARRAY = explode(":",$appointment_time);
+$appointment_hour = $appointment_timeARRAY[0];
+$appointment_min = $appointment_timeARRAY[1];
+
+header ("Content-type: text/html; charset=utf-8");
+header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
+header ("Pragma: no-cache"); // HTTP/1.0
+
+$txt = '.txt';
+$StarTtime = date("U");
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$CIDdate = date("mdHis");
+$ENTRYdate = date("YmdHis");
+$MT[0]='';
+$agents='@agents';
+
+if (strlen($call_date) < 1)
+ {$call_date = $NOW_TIME;}
+
+#############################################
+##### START SYSTEM_SETTINGS LOOKUP #####
+$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$qm_conf_ct = mysql_num_rows($rslt);
+if ($qm_conf_ct > 0)
+ {
+ $row=mysql_fetch_row($rslt);
+ $non_latin = $row[0];
+ $timeclock_end_of_day = $row[1];
+ $agentonly_callback_campaign_lock = $row[2];
+ }
+##### END SETTINGS LOOKUP #####
+###########################################
+
+if ($non_latin < 1)
+ {
+ $user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
+ $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
+ $length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
+ $phone_code = ereg_replace("[^0-9]","",$phone_code);
+ $phone_number = ereg_replace("[^0-9]","",$phone_number);
+ }
+else
+ {
+ $user = ereg_replace("'|\"|\\\\|;","",$user);
+ $pass = ereg_replace("'|\"|\\\\|;","",$pass);
+ }
+
+if ($DB > 0)
+ {
+ echo "
$lead_id|$entry_date|$modify_date|$status|$user|$vendor_lead_code|$source_id|$list_id|$gmt_offset_now|$called_since_last_reset|$phone_code|$phone_number|$title|$first_name|$middle_initial|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country_code|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$last_local_call_time|$rank|$owner|\n
";
+ }
+
+# default optional vars if not set
+if (!isset($format)) {$format="text";}
+ if ($format == 'debug') {$DB=1;}
+if (!isset($ACTION)) {$ACTION="refresh";}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
+if ($DB) {echo "|$stmt|\n";}
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$auth=$row[0];
+
+if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
+ {
+ echo "Invalid Username/Password: |$user|$pass|\n";
+ exit;
+ }
+else
+ {
+ # do nothing for now
+ }
+
+echo "\n";
+echo "\n";
+echo "\n";
+echo "ViciDial Notes";
+echo "\n";
+echo "\n";
+echo "\n";
+?>
+
+\n";
+echo "\n";
+
+if ($process > 0)
+ {
+ #Update vicidial_list record
+ $stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_query($stmt, $link);
+ $affected_rows = mysql_affected_rows($link);
+
+ #Update the agent screen with new data
+ $stmt="UPDATE vicidial_live_agents set external_update_fields='1',external_update_fields_data='vendor_lead_code,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,phone_code,phone_number,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner' where user='$user';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_query($stmt, $link);
+ $affected_rows = mysql_affected_rows($link);
+
+ if ($notesid < 100)
+ {
+ # Insert into vicidial_call_notes
+ $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_query($stmt, $link);
+ $affected_rows = mysql_affected_rows($link);
+ $notesid = mysql_insert_id($link);
+ }
+ else
+ {
+ # update vicidial_call_notes record
+ $stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_query($stmt, $link);
+ $affected_rows = mysql_affected_rows($link);
+ }
+
+ echo "
Data Changes Accepted
";
+ }
+
+$URLarray = explode("?", $PHP_SELF);
+$URLsubmit = $URLarray[0];
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php
index 94b64214..da0f2515 100644
--- a/agc_2-X/trunk/www/agc/vicidial.php
+++ b/agc_2-X/trunk/www/agc/vicidial.php
@@ -4975,7 +4975,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5070,7 +5070,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars_two =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5391,7 +5391,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5486,7 +5486,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars_two =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5603,7 +5603,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if ( (view_scripts == 1) && (campaign_script.length > 0) )
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -5989,7 +5989,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if ( (view_scripts == 1) && (campaign_script.length > 0) )
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -6364,7 +6364,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
{
all_record = 'NO';
all_record_count=0;
- document.vicidial_form.lead_id.value = '';
+ // document.vicidial_form.lead_id.value = '';
var xmlhttprequestcheckauto=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
@@ -6722,7 +6722,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -6817,7 +6817,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars_two =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -6917,7 +6917,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if ( (view_scripts == 1) && (CalL_ScripT_id.length > 0) )
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -7098,7 +7098,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if ( (webvars_refresh > 0) || (force_webvars_refresh > 0) )
{
web_form_vars =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
@@ -7223,7 +7223,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
else
{
web_form_vars_two =
- "lead_id=" + document.vicidial_form.lead_id.value +
+ "&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
diff --git a/agc_2-X/trunk/www/vicidial/calendar.css b/agc_2-X/trunk/www/vicidial/calendar.css
new file mode 100644
index 00000000..a3ddcae5
--- /dev/null
+++ b/agc_2-X/trunk/www/vicidial/calendar.css
@@ -0,0 +1,95 @@
+/* calendar icon */
+img.tcalIcon {
+ cursor: pointer;
+ margin-left: 1px;
+ vertical-align: middle;
+}
+/* calendar container element */
+div#tcal {
+ position: absolute;
+ visibility: hidden;
+ z-index: 100;
+ width: 158px;
+ padding: 2px 0 0 0;
+}
+/* all tables in calendar */
+div#tcal table {
+ width: 100%;
+ border: 1px solid silver;
+ border-collapse: collapse;
+ background-color: white;
+}
+/* navigation table */
+div#tcal table.ctrl {
+ border-bottom: 0;
+}
+/* navigation buttons */
+div#tcal table.ctrl td {
+ width: 15px;
+ height: 20px;
+}
+/* month year header */
+div#tcal table.ctrl th {
+ background-color: white;
+ color: black;
+ border: 0;
+}
+/* week days header */
+div#tcal th {
+ border: 1px solid silver;
+ border-collapse: collapse;
+ text-align: center;
+ padding: 3px 0;
+ font-family: tahoma, verdana, arial;
+ font-size: 10px;
+ background-color: gray;
+ color: white;
+}
+/* date cells */
+div#tcal td {
+ border: 0;
+ border-collapse: collapse;
+ text-align: center;
+ padding: 2px 0;
+ font-family: tahoma, verdana, arial;
+ font-size: 11px;
+ width: 22px;
+ cursor: pointer;
+}
+/* date highlight
+ in case of conflicting settings order here determines the priority from least to most important */
+div#tcal td.othermonth {
+ color: silver;
+}
+div#tcal td.weekend {
+ background-color: #ACD6F5;
+}
+div#tcal td.today {
+ border: 1px solid red;
+}
+div#tcal td.selected {
+ background-color: #FFB3BE;
+}
+/* iframe element used to suppress windowed controls in IE5/6 */
+iframe#tcalIF {
+ position: absolute;
+ visibility: hidden;
+ z-index: 98;
+ border: 0;
+}
+/* transparent shadow */
+div#tcalShade {
+ position: absolute;
+ visibility: hidden;
+ z-index: 99;
+}
+div#tcalShade table {
+ border: 0;
+ border-collapse: collapse;
+ width: 100%;
+}
+div#tcalShade table td {
+ border: 0;
+ border-collapse: collapse;
+ padding: 0;
+}
diff --git a/agc_2-X/trunk/www/vicidial/calendar_db.js b/agc_2-X/trunk/www/vicidial/calendar_db.js
new file mode 100644
index 00000000..ee6c8dd3
--- /dev/null
+++ b/agc_2-X/trunk/www/vicidial/calendar_db.js
@@ -0,0 +1,335 @@
+// Tigra Calendar v4.0.2 (2009-01-12) Database (yyyy-mm-dd)
+// http://www.softcomplex.com/products/tigra_calendar/
+// Public Domain Software... You're welcome.
+
+// default settins
+var A_TCALDEF = {
+ 'months' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ 'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ 'yearscroll': true, // show year scroller
+ 'weekstart': 0, // first day of week: 0-Su or 1-Mo
+ 'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx.
+ 'imgpath' : 'images/' // directory with calendar images
+}
+// date parsing function
+function f_tcalParseDate (s_date) {
+
+ var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*$/;
+ if (!re_date.exec(s_date))
+ return alert ("Invalid date: '" + s_date + "'.\nAccepted format is yyyy-mm-dd.")
+ var n_day = Number(RegExp.$3),
+ n_month = Number(RegExp.$2),
+ n_year = Number(RegExp.$1);
+
+ if (n_year < 100)
+ n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900);
+ if (n_month < 1 || n_month > 12)
+ return alert ("Invalid month value: '" + n_month + "'.\nAllowed range is 01-12.");
+ var d_numdays = new Date(n_year, n_month, 0);
+ if (n_day > d_numdays.getDate())
+ return alert("Invalid day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + ".");
+
+ return new Date (n_year, n_month - 1, n_day);
+}
+// date generating function
+function f_tcalGenerDate (d_date) {
+ return (
+ d_date.getFullYear() + "-"
+ + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
+ + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate()
+ );
+}
+
+// implementation
+function tcal (a_cfg, a_tpl) {
+
+ // apply default template if not specified
+ if (!a_tpl)
+ a_tpl = A_TCALDEF;
+
+ // register in global collections
+ if (!window.A_TCALS)
+ window.A_TCALS = [];
+ if (!window.A_TCALSIDX)
+ window.A_TCALSIDX = [];
+
+ this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length;
+ window.A_TCALS[this.s_id] = this;
+ window.A_TCALSIDX[window.A_TCALSIDX.length] = this;
+
+ // assign methods
+ this.f_show = f_tcalShow;
+ this.f_hide = f_tcalHide;
+ this.f_toggle = f_tcalToggle;
+ this.f_update = f_tcalUpdate;
+ this.f_relDate = f_tcalRelDate;
+ this.f_parseDate = f_tcalParseDate;
+ this.f_generDate = f_tcalGenerDate;
+
+ // create calendar icon
+ this.s_iconId = 'tcalico_' + this.s_id;
+ this.e_icon = f_getElement(this.s_iconId);
+ if (!this.e_icon) {
+ document.write('
');
+ this.e_icon = f_getElement(this.s_iconId);
+ }
+ // save received parameters
+ this.a_cfg = a_cfg;
+ this.a_tpl = a_tpl;
+}
+
+function f_tcalShow (d_date) {
+
+ // find input field
+ if (!this.a_cfg.controlname)
+ throw("TC: control name is not specified");
+ if (this.a_cfg.formname) {
+ var e_form = document.forms[this.a_cfg.formname];
+ if (!e_form)
+ throw("TC: form '" + this.a_cfg.formname + "' can not be found");
+ this.e_input = e_form.elements[this.a_cfg.controlname];
+ }
+ else
+ this.e_input = f_getElement(this.a_cfg.controlname);
+
+ if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT')
+ throw("TC: element '" + this.a_cfg.controlname + "' does not exist in "
+ + (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document'));
+
+ // dynamically create HTML elements if needed
+ this.e_div = f_getElement('tcal');
+ if (!this.e_div) {
+ this.e_div = document.createElement("DIV");
+ this.e_div.id = 'tcal';
+ document.body.appendChild(this.e_div);
+ }
+ this.e_shade = f_getElement('tcalShade');
+ if (!this.e_shade) {
+ this.e_shade = document.createElement("DIV");
+ this.e_shade.id = 'tcalShade';
+ document.body.appendChild(this.e_shade);
+ }
+ this.e_iframe = f_getElement('tcalIF')
+ if (b_ieFix && !this.e_iframe) {
+ this.e_iframe = document.createElement("IFRAME");
+ this.e_iframe.style.filter = 'alpha(opacity=0)';
+ this.e_iframe.id = 'tcalIF';
+ this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif';
+ document.body.appendChild(this.e_iframe);
+ }
+
+ // hide all calendars
+ f_tcalHideAll();
+
+ // generate HTML and show calendar
+ this.e_icon = f_getElement(this.s_iconId);
+ if (!this.f_update())
+ return;
+
+ this.e_div.style.visibility = 'visible';
+ this.e_shade.style.visibility = 'visible';
+ if (this.e_iframe)
+ this.e_iframe.style.visibility = 'visible';
+
+ // change icon and status
+ this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif';
+ this.e_icon.title = 'Close Calendar';
+ this.b_visible = true;
+}
+
+function f_tcalHide (n_date) {
+ if (n_date)
+ this.e_input.value = this.f_generDate(new Date(n_date));
+
+ // no action if not visible
+ if (!this.b_visible)
+ return;
+
+ // hide elements
+ if (this.e_iframe)
+ this.e_iframe.style.visibility = 'hidden';
+ if (this.e_shade)
+ this.e_shade.style.visibility = 'hidden';
+ this.e_div.style.visibility = 'hidden';
+
+ // change icon and status
+ this.e_icon = f_getElement(this.s_iconId);
+ this.e_icon.src = this.a_tpl.imgpath + 'cal.gif';
+ this.e_icon.title = 'Open Calendar';
+ this.b_visible = false;
+}
+
+function f_tcalToggle () {
+ return this.b_visible ? this.f_hide() : this.f_show();
+}
+
+function f_tcalUpdate (d_date) {
+
+ var d_today = this.a_cfg.today ? this.f_parseDate(this.a_cfg.today) : f_tcalResetTime(new Date());
+ var d_selected = this.e_input.value == ''
+ ? (this.a_cfg.selected ? this.f_parseDate(this.a_cfg.selected) : d_today)
+ : this.f_parseDate(this.e_input.value);
+
+ // figure out date to display
+ if (!d_date)
+ // selected by default
+ d_date = d_selected;
+ else if (typeof(d_date) == 'number')
+ // get from number
+ d_date = f_tcalResetTime(new Date(d_date));
+ else if (typeof(d_date) == 'string')
+ // parse from string
+ this.f_parseDate(d_date);
+
+ if (!d_date) return false;
+
+ // first date to display
+ var d_firstday = new Date(d_date);
+ d_firstday.setDate(1);
+ d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7);
+
+ var a_class, s_html = ''
+ + (this.a_tpl.yearscroll ? ' | ' : '')
+ + ' | '
+ + this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear()
+ + ' |  | '
+ + (this.a_tpl.yearscroll ? ' | ' : '')
+ + '
';
+
+ // print weekdays titles
+ for (var i = 0; i < 7; i++)
+ s_html += '| ' + this.a_tpl.weekdays[(this.a_tpl.weekstart + i) % 7] + ' | ';
+ s_html += '
' ;
+
+ // print calendar table
+ var n_date, n_month, d_current = new Date(d_firstday);
+ while (d_current.getMonth() == d_date.getMonth() ||
+ d_current.getMonth() == d_firstday.getMonth()) {
+
+ // print row heder
+ s_html +='';
+ for (var n_wday = 0; n_wday < 7; n_wday++) {
+
+ a_class = [];
+ n_date = d_current.getDate();
+ n_month = d_current.getMonth();
+
+ // other month
+ if (d_current.getMonth() != d_date.getMonth())
+ a_class[a_class.length] = 'othermonth';
+ // weekend
+ if (d_current.getDay() == 0 || d_current.getDay() == 6)
+ a_class[a_class.length] = 'weekend';
+ // today
+ if (d_current.valueOf() == d_today.valueOf())
+ a_class[a_class.length] = 'today';
+ // selected
+ if (d_current.valueOf() == d_selected.valueOf())
+ a_class[a_class.length] = 'selected';
+
+ s_html += '| ' : '>') + n_date + ' | '
+
+ d_current.setDate(++n_date);
+ while (d_current.getDate() != n_date && d_current.getMonth() == n_month) {
+ d_current.setHours(d_current.getHours + 1);
+ d_current = f_tcalResetTime(d_current);
+ }
+ }
+ // print row footer
+ s_html +='
';
+ }
+ s_html +='
';
+
+ // update HTML, positions and sizes
+ this.e_div.innerHTML = s_html;
+
+ var n_width = this.e_div.offsetWidth;
+ var n_height = this.e_div.offsetHeight;
+ var n_top = f_getPosition (this.e_icon, 'Top') + this.e_icon.offsetHeight;
+ var n_left = f_getPosition (this.e_icon, 'Left') - n_width + this.e_icon.offsetWidth;
+ if (n_left < 0) n_left = 0;
+
+ this.e_div.style.left = n_left + 'px';
+ this.e_div.style.top = n_top + 'px';
+
+ this.e_shade.style.width = (n_width + 8) + 'px';
+ this.e_shade.style.left = (n_left - 1) + 'px';
+ this.e_shade.style.top = (n_top - 1) + 'px';
+ this.e_shade.innerHTML = b_ieFix
+ ? ''
+ : '';
+
+ if (this.e_iframe) {
+ this.e_iframe.style.left = n_left + 'px';
+ this.e_iframe.style.top = n_top + 'px';
+ this.e_iframe.style.width = (n_width + 6) + 'px';
+ this.e_iframe.style.height = (n_height + 6) +'px';
+ }
+ return true;
+}
+
+function f_getPosition (e_elemRef, s_coord) {
+ var n_pos = 0, n_offset,
+ e_elem = e_elemRef;
+
+ while (e_elem) {
+ n_offset = e_elem["offset" + s_coord];
+ n_pos += n_offset;
+ e_elem = e_elem.offsetParent;
+ }
+ // margin correction in some browsers
+ if (b_ieMac)
+ n_pos += parseInt(document.body[s_coord.toLowerCase() + 'Margin']);
+ else if (b_safari)
+ n_pos -= n_offset;
+
+ e_elem = e_elemRef;
+ while (e_elem != document.body) {
+ n_offset = e_elem["scroll" + s_coord];
+ if (n_offset && e_elem.style.overflow == 'scroll')
+ n_pos -= n_offset;
+ e_elem = e_elem.parentNode;
+ }
+ return n_pos;
+}
+
+function f_tcalRelDate (d_date, d_diff, s_units) {
+ var s_units = (s_units == 'y' ? 'FullYear' : 'Month');
+ var d_result = new Date(d_date);
+ d_result['set' + s_units](d_date['get' + s_units]() + d_diff);
+ if (d_result.getDate() != d_date.getDate())
+ d_result.setDate(0);
+ return ' onclick="A_TCALS[\'' + this.s_id + '\'].f_update(' + d_result.valueOf() + ')"';
+}
+
+function f_tcalHideAll () {
+ for (var i = 0; i < window.A_TCALSIDX.length; i++)
+ window.A_TCALSIDX[i].f_hide();
+}
+
+function f_tcalResetTime (d_date) {
+ d_date.setHours(0);
+ d_date.setMinutes(0);
+ d_date.setSeconds(0);
+ d_date.setMilliseconds(0);
+ return d_date;
+}
+
+f_getElement = document.all ?
+ function (s_id) { return document.all[s_id] } :
+ function (s_id) { return document.getElementById(s_id) };
+
+if (document.addEventListener)
+ window.addEventListener('scroll', f_tcalHideAll, false);
+if (window.attachEvent)
+ window.attachEvent('onscroll', f_tcalHideAll);
+
+// global variables
+var s_userAgent = navigator.userAgent.toLowerCase(),
+ re_webkit = /WebKit\/(\d+)/i;
+var b_mac = s_userAgent.indexOf('mac') != -1,
+ b_ie5 = s_userAgent.indexOf('msie 5') != -1,
+ b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1;
+var b_ieFix = b_ie5 || b_ie6,
+ b_ieMac = b_mac && b_ie5,
+ b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500;