var ERROR_GENERIC = 666; var ERROR_SESSION_EXPIRED = 667; var ERROR_NAVIGATION = 668; var ERROR_ACCESS_DENIED = 669; var ERROR_OPTIMISTIC_LOCK = 670; function CloseDialog(){ window.close(); } function CheckError (ret) { try { switch (ret[0]) { case ERROR_GENERIC: window.location.replace ('/voodoo/Error/ErrorPage.aspx?guid=' + ret[1]); return false; case ERROR_SESSION_EXPIRED: window.location.replace ('/voodoo/Error/SessionExpired.aspx'); return false; case ERROR_NAVIGATION: window.location.replace ('/voodoo/Error/NavigationError.aspx'); return false; case ERROR_ACCESS_DENIED: window.location.replace ('/voodoo/Error/AccessDenied.aspx'); return false; case ERROR_OPTIMISTIC_LOCK: window.location.replace ('/voodoo/Error/OptimisticLock.aspx'); return false; } } catch (e) { return ret; } return ret; } function ShowInExUrlDialog(params){ return CheckError (window.showModalDialog('/voodoo/Common/Dialog/UrlDialogWrapper.htm', params, 'scroll=no;status:off;dialogHeight:199px;dialogWidth:450px;')) } function ShowInUrlDialog(params){ return ShowCustomModalDialogWithReturnValue('/voodoo/Common/Dialog/ExtranetUrlDialog.aspx', 'Select URL', params, 407, 350); } function ShowCustomModalDialog(url, title, params, height, width){ height = parseInt(height) + 7; var customReturnValue = window.showModalDialog('/voodoo/Common/GenericWrapper.aspx?title=' + title, url + '?' + params, 'scroll=no;status:off;dialogHeight:'+height+'px;dialogWidth:'+width+'px;'); if (false == CheckError (customReturnValue)) return false; return true; } function ShowCustomFormModalDialog(url, title, params, height, width){ height = parseInt(height) + 7; var customReturnValue = window.showModalDialog('/voodoo/Common/GenericWrapper.aspx?title=' + title, url + '?' + params, 'scroll=no;status:off;dialogHeight:'+height+'px;dialogWidth:'+width+'px;'); if(customReturnValue != null && customReturnValue.length > 0){ return CheckError(customReturnValue); } return false; } function ShowCustomModalDialogWithReturnValue(url, title, params, height, width){ height = parseInt(height) + 7; return CheckError (window.showModalDialog('/voodoo/Common/GenericWrapper.aspx?title=' + title, url + '?' + params, 'scroll=no;status:off;dialogHeight:'+height+'px;dialogWidth:'+width+'px;')); } //FORM MANAGEMENT function ShowStaticTextDialog(params){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/StaticTextDialog.aspx', "Add \"Static Text\" Control", params, 145, 350); } function ShowHyperLinkDialog(params){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/HyperlinkDialog.aspx', "Add \"Hyperlink\" Control", params, 177, 350); } function ShowGroupTitleDialog(params){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/GroupTitleDialog.aspx', "Add \"Group Title\" Control", params, 162, 350); } function ShowTextBoxDialog(params){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/TextBoxDialog.aspx', "Add \"Text Box\" Control", params, 410, 415); } function ShowDropdownDialog(params){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/DropdownDialog.aspx', "Add \"Drop-down box\" Control", params, 297, 350); } function ShowDropdownItemsDialog(){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/DropdownItemsDialog.aspx', "Manage Items", '', 452, 845); } function ShowRadioButtonGroupItemsDialog(){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/DropdownItemsDialog.aspx', "Manage Items", '', 452, 570); } function ShowTextAreaDialog(params){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/TextAreaDialog.aspx', "Add \"Text Area\" Control", params, 428, 405); } function ShowCheckBoxDialog(params){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/CheckboxDialog.aspx', "Add \"Check box\" Control", params, 234, 350); } function ShowRadioButtonsDialog(params){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/RadioButtonGroupDialog.aspx', "Add \"Radio-button Group\" Control", params, 228, 350); } function ShowFormProcessingOptionsDialog(){ return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/FormProcessingOptionsDialog.aspx', "Define Form Processing Options", '', 400, 350); } function ShowCalendarDialog(params) { return ShowCustomFormModalDialog('/voodoo/Common/Dialog/Form/CalendarDialog.aspx', "Add \"Calendar\" Control", params, 280, 415); } function ShowHyperLinkUrlDialog(params) { return CheckError(window.showModalDialog('/voodoo/Common/Dialog/Form/HypreLinkUrlDialogWrapper.htm', params, 'scroll=no;status:off;dialogHeight:175px;dialogWidth:450px;')) } function y2k(number) { return (number < 1000) ? number + 1900 : number; } function isDate (day,month,year) { var today = new Date(); year = ((!year) ? y2k(today.getYear()):year); month = ((!month) ? today.getMonth():month-1); if (!day) return false var test = new Date(year,month,day); if ( (y2k(test.getYear()) == year) && (month == test.getMonth()) && (day == test.getDate()) ) return true; else return false } function GetDate (day,month,year) { var today = new Date(); year = ((!year) ? y2k(today.getYear()):year); month = ((!month) ? today.getMonth():month - 1); if (!day) return false var test = new Date(year,month,day); if ( (y2k(test.getYear()) == year) && (month == test.getMonth()) && (day == test.getDate()) ) return new Date(year, month, day); else return new Date() } function formatDate(strFullDate, strFormatString) { var strMonths = new Array(); var strDay = new Array(); strMonths[0] = "January"; strMonths[1] = "February"; strMonths[2] = "March"; strMonths[3] = "April"; strMonths[4] = "May"; strMonths[5] = "June"; strMonths[6] = "July"; strMonths[7] = "August"; strMonths[8] = "September"; strMonths[9] = "October"; strMonths[10] = "November"; strMonths[11] = "December"; strDay[0] = "Sunday"; strDay[1] = "Monday"; strDay[2] = "Tuesday"; strDay[3] = "Wednesday"; strDay[4] = "Thursday"; strDay[5] = "Friday"; strDay[6] = "Saturday"; var strValue_d = strFullDate.getDate(); var strValue_dd = (strValue_d < 10) ? '0' + strValue_d : strValue_d; var strValue_m = strFullDate.getMonth() + 1; var strValue_mm = (strValue_m < 10) ? '0' + strValue_m : strValue_m; var strValue_mmmm = strMonths[strFullDate.getMonth()]; var strValue_mmm = strValue_mmmm.substr(0,3); var strValue_yy = strFullDate.getFullYear() + ""; var strValue_y = strValue_yy.substr(2,2); var strValue_ww = strDay[strFullDate.getDay()]; var strValue_w = strValue_ww.substr(0,3); if (strFormatString.indexOf("dd") > -1) { strFormatString = strFormatString.replace("dd", "strValue_dd"); } else { if (strFormatString.indexOf("d") > -1) { strFormatString = strFormatString.replace("d", "strValue_d"); } } if (strFormatString.indexOf("mmmm") > -1) { strFormatString = strFormatString.replace("mmmm", "strValue_mmmm"); } else { if (strFormatString.indexOf("mmm") > -1) { strFormatString = strFormatString.replace("mmm", "strValue_mmm"); } else { if (strFormatString.indexOf("mm") > -1) { strFormatString = strFormatString.replace("mm", "strValue_mm"); } else { if (strFormatString.indexOf("m") > -1) { strFormatString = strFormatString.replace("m", "strValue_m"); } } } } if (strFormatString.indexOf("yy") > -1) { strFormatString = strFormatString.replace("yy", "strValue_yy"); } else { if (strFormatString.indexOf("y") > -1) { strFormatString = strFormatString.replace("y", "strValue_y"); } } if (strFormatString.indexOf("ww") > -1) { strFormatString = strFormatString.replace("ww", "strValue_ww"); } else { if (strFormatString.indexOf("w") > -1) { strFormatString = strFormatString.replace("w", "strValue_w"); } } strFormatString = strFormatString.replace("strValue_dd", strValue_dd); strFormatString = strFormatString.replace("strValue_d", strValue_d); strFormatString = strFormatString.replace("strValue_mmmm", strValue_mmmm); strFormatString = strFormatString.replace("strValue_mmm", strValue_mmm); strFormatString = strFormatString.replace("strValue_mm", strValue_mm); strFormatString = strFormatString.replace("strValue_m", strValue_m); strFormatString = strFormatString.replace("strValue_yy", strValue_yy); strFormatString = strFormatString.replace("strValue_y", strValue_y); strFormatString = strFormatString.replace("strValue_ww", strValue_ww); strFormatString = strFormatString.replace("strValue_w", strValue_w); return strFormatString; }