Go to the source code of this file.
Functions | |
| function | incident_details_window (incidentid, win, rtn) |
| function | wt_winpopup (url, mini) |
| function | confirm_action (msg) |
| function | help_window (helpid) |
| function | appointment (id) |
| function | get_and_display (page, component, update) |
| function | ajax_save (page, component) |
| function | deleteOption (object, index) |
| function | addOption (object, text, value) |
| function | copySelected (fromObject, toObject) |
| function | copyAll (fromObject, toObject) |
| function | populateHidden (fromObject, toObject) |
| function | checkAll (formid, checkstatus) |
| function | changeTextAreaLength (e) |
| function | resetTextAreaLength (e) |
| function | get_random () |
| function | update_ttna () |
| function | addcontract_sltimed (servicelevel) |
| function | addservice_showbilling (form) |
| function | hidecontexthelp (event) |
| function | findPos (obj) |
| function | contexthelp (elem, context, auth) |
| function | jumpto () |
| function | clearjumpto () |
| function | email_window (incidentid) |
| function | close_window (incidentid) |
| function | gotab (tab) |
| function | close_page_redirect (url) |
| function | doSelect (select, element) |
| function | groupMemberSelect (group, clear) |
| function | togglePlusMinus (div) |
| function | kbSectionCollapse () |
| function | insertBBCode (element, tag, endtag) |
| function | dismissNotice (noticeid, userid) |
| function | toggleMenuPanel () |
| function | resizeTextarea (t) |
| function | enableBillingPeriod () |
Variables | |
| var | popwin |
| dashletrefresh = new Array() | |
| var | isIE = false |
| var | mainframe = '50%' |
| var | MIN_ROWS = 3 |
| var | MAX_ROWS = 10 |
| var | MIN_COLS = 40 |
| var | MAX_COLS = 80 |
| ResizeableTextarea = Class.create() | |
| function addcontract_sltimed | ( | servicelevel | ) |
Check whether a service level is timed when adding a contract
Definition at line 393 of file webtrack.js.
References get_random(), hide, and show.
{
new Ajax.Request(application_webpath + 'ajaxdata.php?action=servicelevel_timed&servicelevel=' + servicelevel + '&rand=' + get_random(),
{
method:'get',
onSuccess: function(transport)
{
var response = transport.responseText || "no response text";
if (transport.responseText)
{
if (response == 'TRUE')
{
$('hiddentimed').show();
$('timed').value = 'yes';
}
else
{
$('hiddentimed').hide();
$('timed').value = 'no';
}
}
},
onFailure: function(){ alert('Something went wrong...') }
});
}
| function addOption | ( | object, | ||
| text, | ||||
| value | ||||
| ) |
Add an option to a HTML select tag
Definition at line 212 of file webtrack.js.
Referenced by copyAll(), and copySelected().
{
var defaultSelected = true;
var selected = true;
var optionName = new Option(text, value, defaultSelected, selected)
object.options[object.length] = optionName;
}
| function addservice_showbilling | ( | form | ) |
Definition at line 423 of file webtrack.js.
{
/*var a = $('billtype');
alert("A: "+a.value);*/
var typeValue = Form.getInputs(form,'radio','billtype').find(function(radio) { return radio.checked; }).value;
// alert("B: "+typeValue);
if (typeValue == 'billperunit' || typeValue == 'billperincident')
{
if ($('billingsection') != null)
{
$('billingsection').show();
}
if (typeValue == 'billperunit') $('unitratesection').show();
else $('unitratesection').hide();
if (typeValue == 'billperincident') $('incidentratesection').show();
else $('incidentratesection').hide();
}
else
{
$('billingsection').hide();
}
}
| function ajax_save | ( | page, | ||
| component | ||||
| ) |
| string | page | |
| string | component |
Definition at line 183 of file webtrack.js.
{
new Ajax.Request(page, {
parameters: $(component).serialize(true)
});
$(component).innerHTML = 'Saved';
}
| function appointment | ( | id | ) |
| function changeTextAreaLength | ( | e | ) |
Change the length of a text area
Definition at line 304 of file webtrack.js.
{
var txtLength = e.value.length;
var numRows = 0 ;
var arrNewLines = e.value.split("\n");
for(var i=0; i<=arrNewLines.length-1; i++)
{
numRows++;
if (arrNewLines[i].length > MAX_COLS-5)
{
numRows += Math.floor(arrNewLines[i].length/MAX_COLS)
}
}
if (txtLength == 0)
{
e.cols = MIN_COLS ;
e.rows = MIN_ROWS ;
} else
{
if (numRows <= 1)
{
e.cols = (txtLength % MAX_COLS) + 1 >= MIN_COLS ? ((txtLength % MAX_COLS) + 1) : MIN_COLS ;
}
else
{
e.cols = MAX_COLS ;
e.rows = numRows > MAX_ROWS ? MAX_ROWS : numRows ;
}
}
}
| function checkAll | ( | formid, | ||
| checkstatus | ||||
| ) |
Check or uncheck all checkboxes on a form
Definition at line 285 of file webtrack.js.
{
var form = $(formid);
checkboxes = form.getInputs('checkbox');
checkboxes.each(function(e) { e.checked = checkstatus});
}
| function clearjumpto | ( | ) |
Clear/reset the 'jump to' search field
Definition at line 554 of file webtrack.js.
{
$('searchfield').value = "";
}
| function close_page_redirect | ( | url | ) |
Definition at line 584 of file webtrack.js.
References url.
{
window.opener.location=url;
window.close();
}
| function close_window | ( | incidentid | ) |
Definition at line 566 of file webtrack.js.
{
URL = application_webpath + "incident_close.php?menu=hide&id=" + incidentid;
window.open(URL, "email_window", "toolbar=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=700,height=600");
}
| function confirm_action | ( | msg | ) |
Yes/No dialog
| msg | string - A message to display |
Definition at line 65 of file webtrack.js.
{
if (msg == '') msg = 'Are you sure?';
return window.confirm(msg);
}
| function contexthelp | ( | elem, | ||
| context, | ||||
| auth | ||||
| ) |
Show context help [?] popups
Definition at line 491 of file webtrack.js.
References findPos(), get_random(), hidecontexthelp(), span, and style.
{
var epos = findPos(elem);
span = elem.getElementsByTagName('span');
span = span[0];
$(span);
$(elem);
span.style.display = 'block';
var vwidth = document.viewport.getWidth();
var vheight = document.viewport.getHeight();
if (epos[0] + 135 > vwidth)
{
span.style.left = '-125px';
}
else if (epos[1] + 150 > vheight)
{
span.style.top = '-20px';
span.style.left = '5px';
span.style.width = '250px';
}
else
{
$(span).style.top = '1em';
$(span).style.left = '1em';
}
if (span.innerHTML == '')
{
new Ajax.Request(application_webpath + 'ajaxdata.php?action=contexthelp&context=' + context + '&rand=' + get_random() + '&auth=' + auth,
//new Ajax.Request('ajaxdata.php?action=contexthelp&context=' + context + '&rand=' + get_random(),
{
method:'get',
onSuccess: function(transport)
{
var response = transport.responseText || "no response text";
if (transport.responseText)
{
span.innerHTML = transport.responseText;
}
},
onFailure: function(){ alert('Context Help Error\nSorry, we could not retrieve the help tip') }
});
}
span.observe('mouseout', hidecontexthelp);
span.observe('click', hidecontexthelp);
elem.observe('mouseout', hidecontexthelp);
elem.observe('click', hidecontexthelp);
}
| function copyAll | ( | fromObject, | ||
| toObject | ||||
| ) |
Copy all options from one HTML select tag to another
Definition at line 251 of file webtrack.js.
References addOption(), and deleteOption().
{
for (var i=0, l=fromObject.options.length;i < l;i++)
{
addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
}
for (var i=fromObject.options.length-1;i > -1;i--)
{
deleteOption(fromObject,i);
}
}
| function copySelected | ( | fromObject, | ||
| toObject | ||||
| ) |
Copy selected options from one HTML select tag to another
Definition at line 228 of file webtrack.js.
References addOption(), and deleteOption().
{
for (var i=0, l=fromObject.options.length;i < l;i++)
{
if (fromObject.options[i].selected)
{
addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
}
}
for (var i=fromObject.options.length-1;i >-1;i-- )
{
if (fromObject.options[i].selected) deleteOption(fromObject,i);
}
}
| function deleteOption | ( | object, | ||
| index | ||||
| ) |
Delete an option from a HTML select tag
Definition at line 199 of file webtrack.js.
References index.
Referenced by copyAll(), copySelected(), and display_update_page().
{
object.options[index] = null;
}
| function dismissNotice | ( | noticeid, | ||
| userid | ||||
| ) |
Dismiss a notice without refreshing the page
| int | noticeid. The ID of the notice to dismiss | |
| int | userid The current user ID |
Definition at line 705 of file webtrack.js.
References get_random(), and hide.
{
if (noticeid == 'all') var div = 'noticearea';
else var div = 'notice' + noticeid;
new Ajax.Request(application_webpath + 'ajaxdata.php?action=dismiss_notice¬iceid=' + noticeid + '&userid=' + userid + '&rand=' + get_random(),
{
method:'get',
onSuccess: function(transport)
{
$(div).hide();
$(div).removeClassName('noticebar');
if ($$('.noticebar').length < 2) $('dismissall').hide();
},
onFailure: function(){ alert('Notice Error\nSorry, we could not dismiss the notice.') }
});
}
| function doSelect | ( | select, | ||
| element | ||||
| ) |
Below used for selecting GroupMembership from a select field
Definition at line 595 of file webtrack.js.
Referenced by groupMemberSelect().
{
var includes = document.getElementById(element);
for(i = 0; i < includes.length; i++)
{
includes[i].selected = select;
}
}
| function email_window | ( | incidentid | ) |
Definition at line 560 of file webtrack.js.
{
URL = application_webpath + "incident_email.php?menu=hide&id=" + incidentid;
window.open(URL, "email_window", "toolbar=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=700,height=600");
}
| function enableBillingPeriod | ( | ) |
Definition at line 759 of file webtrack.js.
{
if ($('timed').checked==true)
{
$('engineerBillingPeriod').show();
$('customerBillingPeriod').show();
$('limit').show();
$('allow_reopen').checked=false;
$('allow_reopen').disable();
}
else
{
$('engineerBillingPeriod').hide();
$('customerBillingPeriod').hide();
$('allow_reopen').enable();
$('limit').hide();
}
}
| function findPos | ( | obj | ) |
find the real position of an element
Definition at line 474 of file webtrack.js.
Referenced by contexthelp().
{
var curleft = curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return [curleft,curtop];
}
| function get_and_display | ( | page, | ||
| component, | ||||
| update | ||||
| ) |
Get some text and display it
| string | page | |
| string | component | |
| string | update |
Definition at line 115 of file webtrack.js.
References dashletrefresh, stop, update(), and url.
{
// Do certain special things for dashlets
if (component.substr(0,3) == 'win')
{
// Get the ID for the refresh icon so we can replace it, store the original first
var refreshicon = component.replace(/win/, "refresh");
var origicon = '';
if (refreshicon != null)
{
if ($(refreshicon)) origicon = $(refreshicon).src;
}
// If the dashlet content is blank, set a loading image
var loaderimg = "<p align='center'><img src='"+ application_webpath +"images/ajax-loader.gif' alt=\"{$strLoading}\" /></p>";
if ($(component).innerHTML.substr(0,7) == '<script') $(component).innerHTML = loaderimg + $(component).innerHTML
}
if (update == true)
{
if (dashletrefresh[component] != null) dashletrefresh[component].stop();
dashletrefresh[component] = new Ajax.PeriodicalUpdater(component, page, {
method: 'get', frequency: 30, decay: 1.25,
onCreate: function(){
if (refreshicon != null)
{
$(refreshicon).src = application_webpath + 'images/dashlet-ajax-loader.gif';
}
},
onComplete: function(){
if (refreshicon != null) $(refreshicon).src = origicon;
},
onLoaded: function(){
if (refreshicon != null) $(refreshicon).src = origicon;
}
});
}
else
{
if (component.substr(0,3) == 'win') dashletrefresh[component].stop();
new Ajax.Updater(component, page, {
method: 'get',
onFailure: function() {
$(component).innerHTML = 'Error: could not load data: ' + url;
},
onCreate: function() {
if (refreshicon != null)
{
$(refreshicon).src = application_webpath + 'images/dashlet-ajax-loader.gif';
}
},
onComplete: function() {
if (refreshicon != null) $(refreshicon).src = origicon;
},
onLoaded: function() {
if (refreshicon != null) $(refreshicon).src = origicon;
}
});
}
}
| function get_random | ( | ) |
Return a random number
| int | Random number |
Definition at line 351 of file webtrack.js.
Referenced by addcontract_sltimed(), contexthelp(), and dismissNotice().
{
var ranNum= Math.floor(Math.random()*1000000000000);
return ranNum;
}
| function gotab | ( | tab | ) |
Definition at line 579 of file webtrack.js.
{
document.actiontabs.action.value=tab;
document.actiontabs.submit();
}
| function groupMemberSelect | ( | group, | ||
| clear | ||||
| ) |
Definition at line 604 of file webtrack.js.
References doSelect(), and group.
{
if (clear.toUpperCase() == "TRUE")
{
doSelect(false, 'include');
}
var includes = document.getElementById('include');
$a = $(group);
for(i = 0; i < includes.length; i++)
{
if(includes[i].text.indexOf("("+group+")") > -1)
{
if ($a.checked == true)
{
includes[i].selected = true;
}
else
{
includes[i].selected = false;
}
}
}
}
| function help_window | ( | helpid | ) |
Open a popup window showing help
| int | helpid. The help ID to display |
Definition at line 572 of file webtrack.js.
{
URL = application_webpath + "help.php?id=" + helpid;
window.open(URL, "help_window", "toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=500");
}
| function hidecontexthelp | ( | event | ) |
Hide context help [?] popups
Definition at line 452 of file webtrack.js.
Referenced by contexthelp().
{
var element = event.element();
if (element.up(1).hasClassName('helplink'))
{
element.style.display = 'none';
}
else
{
element.firstDescendant().style.display = 'none';
}
//element.addClassName('active');
// alert(element);
element.stopObserving('blur', hidecontexthelp);
element.stopObserving('click', hidecontexthelp);
}
| function incident_details_window | ( | incidentid, | ||
| win, | ||||
| rtn | ||||
| ) |
Open a popup window to show incident details
| string | incidentid. The ID of the incident to display | |
| string | win. Window reference | |
| rtn. | Decides whether the window is unique FIXME I can't remember how the 'rtn' param works, you'll have to figure it out yourself, sorry. |
Definition at line 27 of file webtrack.js.
References popwin.
Referenced by jumpto().
{
// URL = "incident.php?popup=yes&id=" + incidentid;
// URL = application_webpath + "incident_details.php?id=" + incidentid + "&win=" + win;
URL = "incident_details.php?id=" + incidentid + "&win=" + win;
if (popwin)
{
popwin.close();
}
popwin = window.open(URL, "sit_popup", "toolbar=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=700,height=600");
if (rtn == true) return popwin;
}
| function insertBBCode | ( | element, | ||
| tag, | ||||
| endtag | ||||
| ) |
Insert BBCode to a textarea or input at the caret point or around current selection
| string | element. ID of the HTML input or textarea | |
| string | The tag to insert | |
| string | the end tag to insert |
Definition at line 680 of file webtrack.js.
{
if (element.length > 0)
{
var start = $(element).selectionStart;
var end = $(element).selectionEnd;
// alert('start:' + start + ' end: ' + end + 'len: ' + $(element).textLength);
if ($(element).readAttribute('readonly') != 'readonly')
{
$(element).value = $(element).value.substring(0, start) + tag + $(element).value.substring(start, end) + endtag + $(element).value.substring(end, $(element).textLength);
}
}
$(element).focus();
var caret = end + tag.length + endtag.length;
$(element).selectionStart = caret;
$(element).selectionEnd = caret;
}
| function jumpto | ( | ) |
Open an incident window for the incident number specified in the 'jump to' search field
Definition at line 545 of file webtrack.js.
References incident_details_window().
{
incident_details_window(document.jumptoincident.incident.value, 'incident'+document.jumptoincident.incident.value);
}
| function kbSectionCollapse | ( | ) |
Collapses or expands kb article sections as needed during edit Requires scriptaculous/effects.js
Definition at line 647 of file webtrack.js.
{
var sections = ['summary', 'symptoms', 'cause', 'question', 'answer', 'solution',
'workaround', 'status', 'additionalinformation', 'references'];
for (var i = 0; i < sections.length; i++)
{
var span = sections[i] + 'span';
var section = sections[i] + 'section';
if ($(sections[i]).value.length > 0)
{
if ($(section).display != 'block') Effect.BlindDown(section, { duration: 0.2 });
$(span).innerHTML = '[-]';
}
else
{
//$(section).hide();
if ($(section).display != 'none') Effect.BlindUp(section, { duration: 0.2 });
$(span).innerHTML = '[+]';
}
}
}
| function populateHidden | ( | fromObject, | ||
| toObject | ||||
| ) |
Definition at line 269 of file webtrack.js.
References escape.
| function resetTextAreaLength | ( | e | ) |
Definition at line 340 of file webtrack.js.
| function resizeTextarea | ( | t | ) |
| function toggleMenuPanel | ( | ) |
Toggle the display of an experimental menu panel
Definition at line 729 of file webtrack.js.
| function togglePlusMinus | ( | div | ) |
Definition at line 629 of file webtrack.js.
{
if ($(div).innerHTML == "[+]")
{
$(div).innerHTML = '[-]';
}
else
{
$(div).innerHTML = '[+]';
}
}
| function update_ttna | ( | ) |
Display/Hide the time to next action fields
Definition at line 363 of file webtrack.js.
{
if ($('ttna_time').checked)
{
$('ttnacountdown').show();
$('timetonextaction_days').focus();
$('timetonextaction_days').select();
$('ttnadate').hide();
}
if ($('ttna_date').checked)
{
$('ttnacountdown').hide();
$('ttnadate').show();
$('timetonextaction_date').focus();
$('timetonextaction_date').select();
}
if ($('ttna_none').checked)
{
$('ttnacountdown').hide();
$('ttnadate').hide();
}
}
| function wt_winpopup | ( | url, | ||
| mini | ||||
| ) |
Open a popup window
| string | url. The URL to open in the popup window | |
| string | mini. set to 'mini' to open a compact window |
Definition at line 47 of file webtrack.js.
References url.
| dashletrefresh = new Array() |
Definition at line 14 of file webtrack.js.
Referenced by get_and_display().
| var isIE = false |
Definition at line 15 of file webtrack.js.
| var mainframe = '50%' |
Definition at line 16 of file webtrack.js.
Referenced by toggleMenuPanel().
| var MAX_COLS = 80 |
Definition at line 297 of file webtrack.js.
| var MAX_ROWS = 10 |
Definition at line 295 of file webtrack.js.
| var MIN_COLS = 40 |
Definition at line 296 of file webtrack.js.
| var MIN_ROWS = 3 |
Definition at line 294 of file webtrack.js.
| var popwin |
Definition at line 13 of file webtrack.js.
Referenced by incident_details_window().
Definition at line 790 of file webtrack.js.
For more help developing with SiT! see http://sitracker.org/wiki/DevelopmentHowTo