1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684 |
- function hts_skipTask(fragmentObj, fragmentName) {
- fragmentObj_retrieve(fragmentObj, "action=skipTask", null, true);
- return true;
- }
- function hts_complete(fragmentObj, fragmentName) {
- fragmentObj_retrieve(fragmentObj, "action=complete", null, true);
- return true;
- }
- function hts_claimTask(fragmentObj, fragmentName) {
- fragmentObj_retrieve(fragmentObj, "action=claim", null, true);
- return true;
- }
- function hts_releaseTask(fragmentObj, fragmentName) {
- fragmentObj_retrieve(fragmentObj, "action=release", null, true);
- return true;
- }
- function hts_createNotificationTask(fragmentObj, fragmentName) {
- var iframe = $(fragmentName+'_notificationMessageValue_iframe');
- var bodytext = iframe.contentDocument? iframe.contentDocument.body.textContent : iframe.contentWindow.document.body.innerText;
- $(fragmentName+'_notificationMessageTextValue').value = bodytext;
- var params = new hts_taskUpdateParams("action=createNotificationTask");
- if (params)
- {
- var messages = hts_getMsgs(fragmentName);
-
- var recipients = document.getElementById(fragmentName + '_potentialOwners_value');
-
- var stakeholders = document.getElementById(fragmentName + '_stakeHolders_value');
- if ((recipients.value == '' || recipients.value.indexOf('{"organizationalEntities":[]}') != -1) &&
- (stakeholders.value == '' || stakeholders.value.indexOf('{"organizationalEntities":[]}') != -1))
- {
- alert(messages['MSG_ERR_NOTIFICATION_RECIPIENT_NOT_SELECTED']);
- return false;
- }
-
- var notificationCheckBox = document.getElementById(fragmentName + 'notification');
- if(notificationCheckBox.checked==true)
- {
-
-
- if(hts_validateNotificationDate(fragmentName + 'taskOptions_dueDate', messages))
- {
-
- params.createParamFromElement('dueDate', 'p_' + fragmentName + 'taskOptions_dueDate');
- }
- else
- {
-
- return false;
- }
- }
-
- params.createParamFromElement('priority',fragmentName + 'taskOptions_priority');
- params.createParamFromElement('stakeholderList',fragmentName + '_stakeHolders_value');
- params.createParamFromElement('recipientList',fragmentName + '_potentialOwners_value');
- params.createParamFromElement('subject', fragmentName + '_subject_value');
- params.createParamFromElement('message_HTML',fragmentName + '_notificationMessageValue');
- params.createParamFromElement('message_text', fragmentName + '_notificationMessageTextValue');
- params.createParamFromElement('reportLinks', fragmentName + '_linksList_value');
- params.createParamFromElement('reportLinksDisplay', fragmentName + '_linksList_display');
- var recordReadReceiptCheckbox = document.getElementById(fragmentName + 'recordReadReceipt');
- if (recordReadReceiptCheckbox)
- {
- params += ("&recordReadReceipt=" + recordReadReceiptCheckbox.checked);
- }
-
- var paramStr = params.toString();
- fragmentObj_retrieve(fragmentObj, paramStr, null, true);
- }
- return params?true:false;
- }
- function hts_validateNotificationDate(notificationDate, msgs)
- {
- var htsDatePickerUtil = new hts_datePickerUtil(notificationDate);
- if(htsDatePickerUtil.isDateEmpty() || !htsDatePickerUtil.isDateValid())
- {
-
- alert(msgs['MSG_ERR_NOTIFICATION_DATE_INVALID']);
- return false;
- }
- if(!htsDatePickerUtil.isDateLaterThanOrEqualToCurrentDate())
- {
- alert(msgs['MSG_ERR_NOTIFICATION_DATE_IN_PAST']);
- return false;
- }
- return true;
- }
- function trim(s)
- {
- return s.replace(/^\s+|\s+$/, '');
- }
- function hts_createGenericTask(fragmentObj, fragmentName, subscriptions) {
- var iframe = $(fragmentName+'_taskMessageValue_iframe');
- var subject_val = $(fragmentName+'_subject_value');
- var bodytext = iframe.contentDocument? iframe.contentDocument.body.textContent : iframe.contentWindow.document.body.innerText;
- $(fragmentName+'_taskMessageTextValue').value = bodytext;
- var subjectText = trim(subject_val.value);
- var params = hts_getParams(fragmentName,"createGenericTask");
- var messages = hts_getMsgs(fragmentName);
-
- if (subjectText.length==0)
- {
- alert(messages['MSG_ERR_TASKVIEWER_WARN_GENERICTASK_NO_SUBJECT']);
- return false;
- }
- if (params)
- {
- var messages = hts_getMsgs(fragmentName);
- var assignedTo = document.getElementById(fragmentName + '_potentialOwners_value');
- var stakeholders = document.getElementById(fragmentName + '_stakeHolders_value');
- var regx = new RegExp("{\"organizationalEntities\":\\[\\]}");
- if (regx.test(assignedTo.value) && regx.test(stakeholders.value))
- {
- alert(messages['MSG_ERR_ASSIGNEDTO_OR_STAKEHOLDER_NOT_SELECTED']);
- return false;
- }
- params.createParamFromElement('subject', fragmentName + '_subject_value');
- params.createParamFromElement('message_text',fragmentName + '_taskMessageTextValue');
- params.createParamFromElement('message_HTML',fragmentName + '_taskMessageValue');
- params.createParamFromElement('reportLinks', fragmentName + '_linksList_value');
- params.createParamFromElement('reportLinksDisplay', fragmentName + '_linksList_display');
-
- params = params + subscriptions;
-
- var paramStr = params.toString();
- fragmentObj_retrieve(fragmentObj, paramStr, null, true);
- }
- return params?true:false;
- }
- function hts_setMessage(fragmentName,message) {
- var node = $(fragmentName+"infoDiv_value");
- node.innerHTML=message;
- }
- function hts_saveTaskOptions(fragmentObj, fragmentName) {
- var params = hts_getParams(fragmentName,"updateTask");
- if (params) {
- fragmentObj.raiseEvent('cognos.hts.showWait');
- params.createParamFromElement('actualOwner',fragmentName + '_assingnedTo_token');
-
- var paramStr = params.toString();
- fragmentObj_retrieve(fragmentObj, paramStr, null, true);
- }
- return params?true:false;
- }
- function hts_getParams(fragmentName, action) {
- var params = new hts_taskUpdateParams("action="+ action);
- var dt = new hts_datetime(fragmentName + 'taskOptions_startBy',fragmentName + 'taskOptions_dueDate',hts_getMsgs(fragmentName));
-
- params.createParamFromElement('hts_status', fragmentName + 'taskOptions_status');
- params.createParamFromElement('priority',fragmentName + 'taskOptions_priority');
- params.createParamFromElement('stakeholderList',fragmentName + '_stakeHolders_value');
- params.createParamFromElement('potentialOwnerList',fragmentName + '_potentialOwners_value');
-
- var fromPickerDirty = !dt.checkDate(true,eval(fragmentName+"dateFrom"));
- var toPickerDirty = !dt.checkDate(false,eval(fragmentName+"dateTo"));
-
-
- var datesValid = hts_validateDeadlines(dt,fromPickerDirty,toPickerDirty);
-
- if (fromPickerDirty) {
- var elementName = 'p_' + fragmentName + 'taskOptions_startBy';
-
- if (dt.checkCurrentDate(dt.getDateFromValue())) {
- var element = document.getElementById(elementName);
- if (element) {
- var newValue = element.value.replace("00:00:00.000","23:59:00.000");
- element.value = newValue;
- }
- }
- params.createParamFromElement('startBy',elementName);
- }
-
- if (toPickerDirty) {
- params.createParamFromElement('dueDate', 'p_' + fragmentName + 'taskOptions_dueDate');
- }
- return datesValid?params:datesValid;
- }
- function hts_validateDeadlines(dt,fromPickerDirty,toPickerDirty) {
- var datesValid = true;
-
- if (fromPickerDirty && toPickerDirty) {
- datesValid = dt.validateDates();
- }
-
- else if (fromPickerDirty) {
- datesValid = dt.validateFromDate();
- }
-
- else if (toPickerDirty) {
- datesValid = dt.validateToDate();
- }
- return datesValid;
- }
- function hts_getCurrentDate() {
- var currentDate = new Date();
- var day = currentDate.getDate();
- var month = currentDate.getMonth()+1;
- var year = currentDate.getFullYear();
- return year + "-" + month +"-" + day;
- }
- function hts_getMsgs(fragmentName) {
- return eval(fragmentName+"msg_array");
- }
- function hts_getDatePicker(fragmentName,pickerName) {
- return window['pickerControl' + fragmentName + pickerName];
- }
- function hts_setDatePickers(fragmentName,dateFromStr,dateToStr) {
- var dt = new hts_datetime(fragmentName + 'taskOptions_startBy',fragmentName + 'taskOptions_dueDate',hts_getMsgs(fragmentName));
- if (dateFromStr!=="") {
- dt.setDateFromValue(dateFromStr);
- }
- if (dateToStr!=="") {
- dt.setDateToValue(dateToStr);
- }
- }
- function hts_clearDatePickers(fragmentName) {
- var dt = new hts_datetime(fragmentName + 'taskOptions_startBy',fragmentName + 'taskOptions_dueDate',hts_getMsgs(fragmentName));
- dt.setDateFromValue("");
- dt.setDateToValue("");
- }
- function hts_datePickerListener() {
-
- dojo.addOnLoad( function() {
-
- dojo.query('body').onclick( function(evt) {
- hts_hideDatePickers();
- });
- dojo.query("[id$='imgPicker']").onmousedown( function(evt) {
- hts_hideDatePickers();
- dojo.query('iframe[id$="_iframe"]').forEach (function(item, idx) {
- if (item.contentDocument) {
- var handle = dojo.connect(item.contentWindow, "onmousedown", function(e){
- hts_hideDatePickers();
- dojo.disconnect(handle);
- });
- } else {
- var handle = dojo.connect(item.contentWindow.document.body, "onmousedown", function(e) {
- hts_hideDatePickers();
- dojo.disconnect(handle);
- });
- }
- });
- });
- });
- }
- function hts_hideDatePickers() {
- for (var i in window) {
-
- if (i.indexOf('pickerControl')!= -1 && i.indexOf('iframe')== -1) {
-
- window[i].gotFocus();
- }
- }
- }
- function hts_clearDatePickersIframe(id) {
- dojo.query("[id*='pickerControl" + id + "iframe']").forEach(dojo.destroy);
- }
- function hts_toggler(imgExpand,imgCollapse) {
- this.imgExpand = imgExpand;
- this.imgCollapse = imgCollapse;
- }
- hts_toggler.prototype = {
- toggleDynamicSection: function (name) {
- if(document.getElementById(name).style.display == 'none') {
- this.showDynamicSection(name);
- }
- else {
- this.hideDynamicSection(name);
- }
- },
- showDynamicSection: function (name) {
- var node = document.getElementById(name);
- if (node) {
- node.style.display='block';
- var imgName = document.getElementById('img' + name);
- if (imgName) {
- imgName.src = this.imgCollapse;
- imgName.setAttribute('alt','Collapse');
- imgName.setAttribute('title','Collapse');
- }
- }
- },
- hideDynamicSection: function (name) {
- var node = document.getElementById(name);
- if (node) {
- node.style.display='none';
- var imgName = document.getElementById('img' + name);
- if (imgName) {
- imgName.src = this.imgExpand;
- imgName.setAttribute('alt','Expand');
- imgName.setAttribute('title','Expand');
- }
- }
- },
- isHidden: function(name) {
- return document.getElementById(name).style.display=='none';
- }
- }
- function hts_taskUpdateParams(prefix) {
- this.params = prefix;
- }
- hts_taskUpdateParams.prototype = {
- createParamFromElement: function (paramName, elementName) {
- var element = document.getElementById(elementName);
- if (dijit.byId(elementName)) {
-
- element.value = dijit.byId(elementName).getValue();
- }
- if (element)
- {
- this.params+="&"+_F_Strings.urlEncode(paramName)+"="+_F_Strings.urlEncode(element.value);
- }
- },
- toString: function() {
- return this.params;
- },
- contains: function(str) {
- return this.params.indexOf(str)>=0;
- }
- }
- function hts_selectCheckbox(id,frag) {
-
- if (id==frag+'notification') {
- var cb = document.getElementById(id);
- hts_walk(document,frag,cb.checked);
- }
-
- else {
- var parentCb = document.getElementById(frag+'notification');
- parentCb.checked= hts_checkStateChanges(document,frag);
- }
- }
- function hts_walk(node,frag,subscribe) {
- for (var i=0; i < node.childNodes.length; i++){
- var childNode = node.childNodes[i];
- if (childNode.nodeName=='INPUT' && childNode.type=='checkbox' && node.id != frag+'notification' && childNode.id.indexOf(frag+'sub_stateChange')==0) {
- if (childNode.checked != subscribe) {
- childNode.checked=subscribe;
- }
- }
- hts_walk(childNode,frag,subscribe);
- }
- }
- function hts_checkStateChanges(node,frag) {
- var found = true;
- var checkboxes = node.getElementsByTagName('INPUT');
- var cbName = frag+"sub_stateChange";
- for (var i=0;i < checkboxes.length;i++) {
- if (checkboxes[i].type =='checkbox' && checkboxes[i].id.indexOf(cbName) != -1 && checkboxes[i].id != frag+'notification') {
- found = checkboxes[i].checked;
-
- if (found) {
- break;
- }
- }
- }
- return found;
- }
- function hts_setCurrentUser(prefix, id, name){
- var oItemDisplay = document.getElementById(prefix + "_display");
- var oItemValue = document.getElementById(prefix + "_value");
- oItemDisplay.value = name;
- oItemValue.value = id;
- }
- function hts_selectUser(paramPrefix) {
- var sHeaderTitle = "taskpool";
- var select_scope = "adminconsole.users";
- var display_prop = "defaultName";
-
- var value_prop = "searchPath";
- var oItemDisplay = document.getElementById(paramPrefix + "_display");
- var oItemSearchPath = document.getElementById(paramPrefix + "_searchpath");
- var oItemValue = document.getElementById(paramPrefix + "_value");
- ccModalCallBack = function(cmd,sResponse) {
- if (cmd == "ok"){
- var xmlDoc = XMLBuilderLoadXMLFromString(xmldecode(sResponse));
- var item = xmlDoc.getElementsByTagName("item");
- var isItemSet = false;
- var itemDisplay = "";
- var itemValue = "";
- var itemSearchPath = "";
- for (var i=0; item.length > i; i++) {
- if (item[i].hasChildNodes()) {
- var children = item[i].childNodes;
- for (var j = 0; children.length > j; j++) {
- if (XMLHelper_GetText(children[j]) == display_prop) {
- itemDisplay = XMLHelper_GetText(children[1]);
- isItemSet = true;
- }
- if (XMLHelper_GetText(children[j]) == value_prop) {
- itemValue = XMLHelper_GetText(children[1]);
- }
- if (XMLHelper_GetText(children[j]) == 'searchPath') {
- itemSearchPath = XMLHelper_GetText(children[1]);
- }
- }
- }
- }
- }
- if (isItemSet == true) {
- hts_setText(oItemDisplay,_F_Strings.htmlEncode(itemDisplay));
- hts_setText(oItemValue,itemValue);
- hts_setText(oItemSearchPath,itemSearchPath);
- }
- ui_modal_dialog.close();
- }
- var defaultObject = '';
- if (oItemSearchPath.value != '')
- {
- defaultObject = '&so.defaultObject='+ oItemSearchPath.value;
- }
- ui_modal_dialog.open('?b_action=xts.run&m=portal/select/select.xts&so.select=' + select_scope + defaultObject + '&md.callBack=data&md.callBackMode=&m_name=' + sHeaderTitle, false, true, true);
- }
- function hts_removeLinks(cListObj, divObjId) {
- cListObj.removeSelected();
- hts_setFocusOnLink(divObjId);
- }
- function hts_removeAllLinks(cListObj) {
- cListObj.removeAllNodes();
- }
- function hts_selectLinks(cListObj,parentId, divObjId, linksTabIndex) {
- ccModalCallBack = function (cmd, entries) {
- if (cmd == "ok") {
- var htsLinks = new HTSLinks(cListObj,$(parentId));
- for (var i = 0; i < entries.length; i++) {
- htsLinks.append(entries[i], linksTabIndex);
- }
-
-
- htsLinks.commit();
- }
- ui_modal_dialog.close();
- hts_setFocusOnLink(divObjId);
- };
-
-
- ui_modal_dialog.open('?b_action=xts.run&m=myinbox/add_entries_links.xts&m_name=' + "", false, true, true);
- }
- function hts_setFocusOnLink(divObjId) {
- if (divObjId != null) {
- dojo.query("div#"+divObjId+ " a").forEach(
- function(node, index, arr) {
- node.focus();
- }
- );
- }
- }
- var counter = 0;
- function hts_selectRecipients(presentationName,msgs,stakeHoldersPrefix,potOwnersPrefix, dialogType, divObjId) {
- var stakeHolders = new HTSHumanRole(stakeHoldersPrefix);
- var potentialOwners = new HTSHumanRole(potOwnersPrefix);
- if (hts_productMode && hts_productMode.getMode() == hts_productMode.PLANNING) {
- var psWrapper = new myinbox.PSWrapper();
-
- psWrapper.getSecurityMode(function(response) {
- stakeHolders.setLogicalPeopleGroup(response);
- potentialOwners.setLogicalPeopleGroup(response);
- var appDialog = myinbox.ListApplicationDialog;
- var df = appDialog.openDialog(psWrapper);
- if (df ) {
- df.addCallback(dojo.hitch(this, function(result){
- if (result) {
- var recipientDialog = email.RecipientDialog;
- var args = {"applicationId":result,"endPointAddress":psWrapper._getServiceUrl()};
- var callBack = recipientDialog.openDialog(args);
- callBack.addCallback(dojo.hitch(this, function(recipients){
- var resultObj = dojo.fromJson(recipients);
- if (resultObj.length > 0) {
- for (var i = 0; i < resultObj.length; i++) {
- var camId = resultObj[i].id?resultObj[i].id:counter++;
- var name = resultObj[i].name;
-
-
- var isGroup = 'true';
-
-
- var to = resultObj[i].to;
- var cc = resultObj[i].cc;
-
- if (to==true) {
- potentialOwners.append(camId,name,isGroup);
- }
-
- if (cc==true) {
- stakeHolders.append(camId,name,isGroup);
- }
- }
-
-
- stakeHolders.commit();
- potentialOwners.commit();
- }
- hts_setFocusOnLink(divObjId);
- potentialOwners.focus();
- }));
- }
- }));
- }
- });
- } else {
- ccModalCallBack = function(cmd, g_vEntries) {
- if (cmd == "ok") {
- potentialOwners.clear();
- potentialOwners.commit();
- stakeHolders.clear();
- stakeHolders.commit();
-
- if (g_vEntries.length > 0) {
- for (var i = 0; i < g_vEntries.length; i++) {
- var camId = g_vEntries[i].searchPath;
- var name = g_vEntries[i].defaultName;
- var type = g_vEntries[i].type.split(',');
- var isGroup = 'false';
-
- if(g_vEntries[i].objectClass == 'role' || g_vEntries[i].objectClass == 'group') {
- isGroup = 'true';
- }
-
- for (var j=0;j<type.length;j++) {
- if (type[j] == 'to') {
- potentialOwners.append(camId,name,isGroup);
- }
-
- if (type[j] == 'cc') {
- stakeHolders.append(camId,name,isGroup);
- }
- }
- }
- stakeHolders.commit();
- potentialOwners.commit();
- }
- }
-
- ui_modal_dialog.close();
- hts_setFocusOnLink(divObjId);
- potentialOwners.focus();
- }
-
- var fileName = "add_entries.xts";
- if (dialogType == "humanTask") {
- fileName = "add_entries_task.xts";
- }
-
-
- ui_modal_dialog.open('?b_action=xts.run&m=myinbox/' + fileName + '&m_name=' + presentationName +
- '&selectedStakeHoldersCamIds='+ stakeHolders.getValues() +
- '&selectedPotentialOwnersCamIds='+potentialOwners.getValues(), false, true, true);
- }
- }
- function HTSProductMode(){
- this.PLANNING="planning";
- this.PLATFORM="platform";
- this.mode=this.PLATFORM;
- }
- HTSProductMode.prototype.getMode = function(){
- return this.mode;
- }
- HTSProductMode.prototype.setMode = function(modeIn){
- this.mode = modeIn;
- }
- function HTSTabDisabler() {
- this.fragId=null;
- }
- HTSTabDisabler.prototype.setParentFragment = function(fragment) {
-
- if (this.fragId == null) {
- this.fragId = fragment + "tabs";
- }
- }
- HTSTabDisabler.prototype.setEnabled = function(enabled) {
-
-
- if (this.fragId==null) {
- return;
- }
- try {
- var tabObj = eval(this.fragId);
- for(var i in tabObj.tabs) {
- var tab = tabObj.tabs[i];
- if (tab != undefined) {
- this.replaceEventHandlers(tab,enabled);
- }
- }
- } catch(exception) {
-
- }
-
- }
- HTSTabDisabler.prototype.replaceEventHandlers = function(tab,enabled) {
- var elem = $(tab.tabID);
- if (elem != null) {
- if (!enabled) {
- xRemoveEventListener(elem,"click",tab.onclick);
- xRemoveEventListener(elem,"keypress",tab.onkeypress);
- xAddEventListener(elem, "click", _F_Document.associate(elem,this, "onclick"));
- xAddEventListener(elem, "keypress", _F_Document.associate(elem,this, "onkeypress"));
- dojo.style(elem, "opacity", 0.4);
- }
- else {
- xRemoveEventListener(elem, "click",this.onclick);
- xRemoveEventListener(elem, "keypress", this.onkeypress);
- xAddEventListener(elem,"click",_F_Document.associate(elem, tab, "onclick"));
- xAddEventListener(elem,"keypress",_F_Document.associate(elem, tab, "onkeypress"));
- dojo.style(elem, "opacity", 1);
- }
- }
- }
- HTSTabDisabler.prototype.onclick = function(e, tag) {
-
- }
- HTSTabDisabler.prototype.onkeypress = function(evt) {
-
- }
- function HTSLocker(contentId) {
- this.locked=false;
- this.utils = new hts_utils();
- this.contentId = contentId;
- this.oCallBack=null;
- }
- HTSLocker.prototype.lock = function () {
-
-
- if(this.locked == undefined || this.locked) {
- return false;
- }
- else {
- this.locked=true;
- var content = $(this.contentId);
- this.utils.setUIState(content,this.locked);
- if (typeof this.oCallBack == 'function') {
- this.oCallBack(this.locked);
- }
- }
- };
- HTSLocker.prototype.unlock = function () {
-
-
- if(this.locked == undefined || this.locked==false) {
- return false;
- }
- else {
- this.locked=false;
- var content = $(this.contentId);
- this.utils.setUIState(content,this.locked);
- if (typeof this.oCallBack =='function') {
- this.oCallBack(this.locked);
- }
- }
- };
- HTSLocker.prototype.isLocked = function () {
- return this.locked;
- };
- HTSLocker.prototype.setCallBack = function (func) {
- this.oCallBack = func;
- };
- function HTSLinks(cListObj,parentDiv) {
- this.cListObj = cListObj;
- this.parent=parentDiv;
-
-
-
-
- if (this.cListObj.getEqualityFunc()===null) {
- var eqFunc = function(clist,itemValue) {
-
- var cid = itemValue.id;
-
-
- var results = dojo.query("[cid='"+cid+"']",clist.getListElement());
- return results.length > 0;
- };
- this.cListObj.setEqualityFunc(eqFunc);
- }
- }
- HTSLinks.prototype.append = function (entry, linkTabIndex) {
- var dispValue = entry.defaultName;
- var itemValue = entry.key;
- var objectClass = entry.objectClass;
- var divElem;
-
- var img = entry.img;
-
-
- if (objectClass && objectClass!="") {
- divElem = dojo.create("div",{ id:itemValue,objectClass:objectClass});
- }
- else {
- divElem = dojo.create("div",{ id:itemValue});
- }
-
- var tabIndex = 0;
- if(linkTabIndex != undefined && linkTabIndex != null && linkTabIndex != '') {
- tabIndex = linkTabIndex;
- }
-
-
- dojo.attr(divElem, "class","reportLink");
-
-
- dojo.html.set(divElem,
- '<span style="padding-left:3px;padding-right:3px;vertical-align:top;">'+img+'</span>'+
- '<a class="cognos-anchor" id="'+itemValue+'" tabindex="'+tabIndex+'" title="'+entry.linkTitle+'">'+_F_Strings.htmlEncode(dispValue)+'</a>'
- );
-
- this.cListObj.add(divElem, itemValue, dispValue);
- };
- HTSLinks.prototype.commit = function (parentId) {
- if (this.cListObj.childCount > 0) {
-
- if (parentId!=undefined) {
- $(parentId).appendChild(this.cListObj.getListElement());
- }
- else {
- this.parent.appendChild(this.cListObj.getListElement());
- }
- this.cListObj.deSelectAll();
- }
- };
- HTSLinks.prototype.getValues = function () {
- var valueObj = new Object();
- var links = new Array();
- if (this.cListObj.size() > 0) {
- var nodesArray = this.cListObj.getAllNodes();
- dojo.forEach(nodesArray, function(item) {
- valueObj.id=dojo.attr(item, "cid");
- valueObj.objectClass=dojo.query("table[objectClass]",item).at(0).attr("objectClass").toString();
- var valueJson = dojo.toJson(valueObj);
- links.push(valueJson);
- });
- }
- return links.join(',');
- };
- HTSLinks.prototype.getDisplayValues = function () {
- var links = new Array();
- if (this.cListObj.size() > 0) {
- var nodesArray = this.cListObj.getAllNodes();
- dojo.forEach(nodesArray, function(item) {
- links.push(dojo.attr(item, "disp"));
- });
- }
- return links.join(',');
- };
- function HTSHumanRole(humanRolePrefix) {
- this.values = document.getElementById(humanRolePrefix + "_value");
- this.display = document.getElementById(humanRolePrefix + "_display");
- this.rawValues = {};
- this.rawValues.organizationalEntities = new Array();
-
- this.rawValues.logicalPeopleGroup = new String("CAM");
- this.rawDisplayValues = new Array();
- }
- HTSHumanRole.prototype.focus =function() {
- this.display.focus();
- }
- HTSHumanRole.prototype.append = function (camId,name,bGroup) {
- this.addRawValue(camId,bGroup);
- this.addRawDisplayValue(name);
- };
- HTSHumanRole.prototype.parse = function (formatted,raw) {
- if (raw != undefined) {
- this.processRaw(raw.users);
- this.processRaw(raw.groups);
- }
- if (formatted != undefined) {
- this.processFormatted(formatted.users);
- this.processFormatted(formatted.groups);
- }
- };
- HTSHumanRole.prototype.processRaw = function (raw) {
- if (raw != undefined && raw.length === undefined) {
- if (raw.group != undefined) {
- this.addRawValue(raw.group,"true");
- } else if (raw.user != undefined) {
- this.addRawValue(raw.user,"false");
- }
- }
- for (var i=0;raw != undefined && i< raw.length;i++) {
- if (raw[i].group != undefined) {
- this.addRawValue(raw[i].group,"true");
- } else if (raw[i].user != undefined) {
- this.addRawValue(raw[i].user,"false");
- }
- }
- };
- HTSHumanRole.prototype.processFormatted = function (formatted) {
- if (formatted != undefined && formatted.length === undefined) {
- if (formatted.group != undefined) {
- this.addRawDisplayValue(formatted.group);
- } else if (formatted.user != undefined) {
- this.addRawDisplayValue(formatted.user);
- }
- }
- for (var i=0;formatted != undefined && i<formatted.length;i++) {
- if (formatted[i].group != undefined) {
- this.addRawDisplayValue(formatted[i].group);
- } else if (formatted[i].user != undefined) {
- this.addRawDisplayValue(formatted[i].user);
- }
- }
- };
- HTSHumanRole.prototype.commit = function () {
- this.setValues(dojo.toJson(this.getRawValues()));
- this.setDisplayValues(this.getRawDisplayValues().join(', '));
- };
- HTSHumanRole.prototype.clear =function() {
- this.rawValues = {};
- this.rawDisplayValues = new Array();
- this.rawValues.organizationalEntities = new Array();
-
- this.setValues('');
- this.setDisplayValues('');
-
- };
- HTSHumanRole.prototype.getValues = function () {
- var values = this.values.value;
-
- if(values && values.indexOf('organizationalEntities') != -1){
- var valuesObj = dojo.fromJson(values);
- var valuesArr = new Array();
- dojo.forEach(valuesObj.organizationalEntities, function(value) {
- valuesArr.push(value.token);
- });
- values = valuesArr.join(',');
- }
- return values;
- };
- HTSHumanRole.prototype.getDisplayValues = function () {
- return this.displays.value;
- };
- HTSHumanRole.prototype.getRawValues = function () {
- return this.rawValues
- };
- HTSHumanRole.prototype.getRawDisplayValues = function () {
- return this.rawDisplayValues
- };
- HTSHumanRole.prototype.setValues = function (sValues) {
- hts_setText(this.values, sValues);
- };
- HTSHumanRole.prototype.setDisplayValues = function (sValues) {
- hts_setText(this.display, sValues);
- };
- HTSHumanRole.prototype.setRawValues = function (sRawValues) {
- this.rawValues = sRawValues;
- };
- HTSHumanRole.prototype.addRawValue = function (sRawValue,bGroup) {
- var obj = {};
- obj.token = sRawValue.toString();
- obj.isGroup = bGroup === "true" || bGroup === "false" ?bGroup:"false";
- this.rawValues.organizationalEntities.push(obj);
- };
- HTSHumanRole.prototype.setRawDisplayValues = function (sRawDisplayValues) {
- this.rawDisplayValues = sRawDisplayValues;
- };
- HTSHumanRole.prototype.addRawDisplayValue = function (sRawDisplayValue) {
- this.rawDisplayValues.push(sRawDisplayValue);
- };
- HTSHumanRole.prototype.setLogicalPeopleGroup = function (sLogicalPeopleGroup) {
- this.rawValues.logicalPeopleGroup = sLogicalPeopleGroup;
- };
- function hts_selectComboItem(comboBox,selectedValue) {
- for (var i=0;i<comboBox.options.length;i++) {
- if (comboBox.options[i].value==selectedValue) {
- comboBox.options[i].selected=true;
- }
- }
- }
- function hts_getButtonsInfo(taskInfo) {
- var infoButtons = null;
- if(taskInfo.capabilities) {
- infoButtons = taskInfo.capabilities;
- }
- return infoButtons;
- }
- function hts_populateStatusComboItem(comboBox,taskInfo, menuStrings){
- var currentStatus = false;
- comboBox.options.length = 0;
- var menus;
- if(taskInfo.menus && taskInfo.menus.length > 0){
- menus = taskInfo.menus;
- }else{
- menus = new Array();
- if(taskInfo.menus.menu){
- menus.push(taskInfo.menus);
- }
- }
- var idx = 0;
- var alreadyAdded = false;
- for (var i=0;i< menus.length;i++) {
- var status = menus[i].menu.targetStatus;
- var isReadyReserved = (status == 'READY' || status == 'RESERVED');
- if (isReadyReserved) {
- if (alreadyAdded) {
- continue;
- }
-
-
- alreadyAdded = true;
- }
- comboBox.options[idx] = new Option(menuStrings[status], menus[i].menu.operation);
-
-
- var isRealStatusReadyReserved = taskInfo.status && (taskInfo.status == 'READY' || taskInfo.status == 'RESERVED');
- var setSelected = (isRealStatusReadyReserved && isReadyReserved) || taskInfo.status == status;
-
-
- if (setSelected) {
-
- currentStatus = true;
- comboBox.options[idx].selected=true;
- }
- idx++;
- }
- if(currentStatus != true ){
- var currentOption = new Option(menuStrings[taskInfo.status], "");
-
- comboBox.options[comboBox.options.length] = currentOption;
- comboBox.options[comboBox.options.length - 1].selected = true;
- }
- }
- function hts_getSelectedComboValue(node,comboName) {
- var combo = node.ownerDocument.getElementById(comboName);
- var comboValue = combo.options[combo.selectedIndex].value;
- return comboValue
- }
- function hts_showWait(elementId) {
-
- var content = typeof elementId == "string"?$(elementId):elementId;
- if (content) {
- var theId = typeof elementId == "string"?elementId:content.id;
- var innerDivId = theId+"_value";
- var innerDivContent = innerDivId + "content";
- var progressMarkup= ui_templates.get(ui_templates.contentTemplate, 'CONTENTID', innerDivContent);
- $(innerDivId).innerHTML=progressMarkup;
- content.style.display="block";
- var cancelAnchor = $(theId + "_cancel");
- cancelAnchor.innerHTML = PFM.JS.IDS_JS_BUTTON_CANCEL;
- var cancelDiv = $(theId + "_cancel_div");
- var func = function() {
- if (dojo.byId(innerDivContent) != null){
- cancelDiv.style.display = "";
- }
- };
- setTimeout(func, 500);
- }
- }
-
- function hts_hideButtons(elementId, disable) {
- var display = "";
- var visibility = "visible";
- if (disable) {
- display = "none";
- visibility = "hidden";
- }
- dojo.style(elementId,{"display":display,"visibility":visibility});
- }
- function hts_hideWait(elementId) {
- }
- function hts_setUsersOrGroups(taskInfo,node) {
- var displayList="";
- var organisationalEntities;
-
- if (taskInfo.users) {
- organisationalEntities = taskInfo.users;
- }
- else if (taskInfo.groups) {
- organisationalEntities = taskInfo.groups;
- }
- if(!organisationalEntities)
- return;
-
- if (organisationalEntities.length==undefined) {
- if (organisationalEntities.group!=undefined) {
- displayList = organisationalEntities.group;
- }
- else {
- displayList = organisationalEntities.user;
- }
- }
-
- for (var i=0;i<organisationalEntities.length;i++) {
- var organisationalEntity = organisationalEntities[i];
- if (organisationalEntity.group) {
- displayList += organisationalEntity.group;
- }
- else if (organisationalEntity.user) {
- displayList += organisationalEntity.user;
- }
- if ((i+1)<organisationalEntities.length) {
- displayList+=",";
- }
- }
- hts_setText(node,displayList);
- }
- function _hts_getKeyCode(e) {
- var evtobj = window.event? event : e;
- var charCode = (evtobj.keyCode) ? evtobj.keyCode : evtobj.which
- return charCode;
- }
- function hts_resizeTextArea(t) {
- text = t.value.split('\n');
- if (text == "") {
- rows_length = 1;
- t.rows = rows_length;
- }
- else {
- b=1;
- for (x=0;x < text.length; x++) {
- if (text[x].length >= t.cols) b+= Math.floor(text[x].length/t.cols);
- }
- b+= text.length;
- if (b > t.rows) t.rows = b;
- }
- }
- function hts_setNotificationDeadline(taskInfo,deadlineLabel) {
- if (taskInfo.formattedDeadlines) {
- if(taskInfo.formattedDeadlines.length){
- deadlines = taskInfo.formattedDeadlines;
- }else {
- deadlines = new Array();
- deadlines.push(taskInfo.formattedDeadlines);
- }
- for (var i=0; i < deadlines.length;i++) {
- var deadlineInstance = deadlines[i].deadlineInstance;
-
- if (deadlineInstance.type=="START") {
- hts_setText(deadlineLabel,deadlineInstance.date);
- }
- }
- }
-
- else {
- hts_setText(deadlineLabel,"");
- }
- }
- function hts_setText(elem,txt) {
-
- if (elem && (elem.tagName=="SPAN" || elem.tagName=="DIV")) {
- if (elem.childNodes.length == 0) {
- var textNode = document.createTextNode(txt);
- elem.appendChild(textNode)
- } else {
- elem.firstChild.nodeValue = txt;
- }
- } else if (elem) {
- elem.value=txt;
- }
- }
- function hts_createButton(labelParam,onClickFunction,placeHolderId) {
- var params = {
- label: labelParam,
- onClick: onClickFunction
- };
- var button = new dijit.form.Button(
- params,dojo.byId(placeHolderId)
- );
- return button
- }
- function hts_utils(fragObj) {
- this.fragObj = fragObj;
- }
- function fragmentObj_retrieve(fragmentObj, sParams, dest, synchronous, excludeDescendantState) {
-
- sParams += "&" + _F_Strings.urlEncode("hts_client_caf") + "=";
- fragmentObj.retrieve(sParams, dest, synchronous, excludeDescendantState);
- }
- hts_utils.prototype = {
- refreshTaskViewer: function() {
-
- var tabs = this.getTabsHolder('subbook');
-
-
- tabObject = tabs.tabs[tabs.activeTabID];
-
-
- tabObject.refreshRequired=true;
-
-
- tabObject.refresh();
- },
-
- deleteTransient: function(sName,sChannel) {
- var sKey = sName + "[" + sChannel + "]";
- for (var k in fragments) {
- if (fragments[k].transientGlobal[sKey]) {
- delete fragments[k].transientGlobal[sKey];
- }
- }
- },
-
- findById: function (fragId) {
- var root = this.fragObj.getRoot();
- return this.find(root,fragId);
- },
- find: function (parent,fragId) {
- var found = false;
- var fragment = null;
- var children = parent.getChildren();
- for (var i=0;(i<children.length && !found);i++) {
- var child = children[i];
- var parentId = child.parent.id;
- var childId = child.id.replace(parentId,"");
- var found = childId == fragId;
- if (found) {
- fragment = child;
- }
- else {
- fragment = this.find(child,fragId);
- }
- }
- return fragment;
- },
-
- refresh: function(fragId) {
- var frag = this.findById(fragId);
- if (frag != null) {
-
- fragmentObj_retrieve(frag, null, null, false, false);
- }
- },
- findFirstChildById: function(fragId) {
- var child = null;
- var frag = this.findById(fragId);
- if (frag !== null) {
- var children = frag.getChildren();
- if (children.length > 0) {
- child = children[0];
- }
- }
- return child;
- },
- getTabsHolder: function(fragId) {
- var tabs = null;
- var firstChild = this.findFirstChildById(fragId);
- if (firstChild !== null) {
- var children = firstChild.getChildren();
-
- try {
- tabs = eval(firstChild.id+"tabs");
- }
- catch(ex){
-
- }
- }
-
- return tabs;
- },
- getCurrentTab: function(fragId) {
-
- var tab = null;
- var tabs = this.getTabsHolder(fragId);
- var firstChild = this.findFirstChildById(fragId);
- if (firstChild !== null) {
- var children = firstChild.getChildren();
- var found=false;
-
- if (tabs !=null && tabs && tabs.activeTabID) {
- var activeTabID = tabs.activeTabID;
-
- for (var i=0;i<children.length && !found;i++) {
- tab = children[i];
-
- if (tab.id.indexOf(activeTabID)!=-1) {
- found = true;
- }
- }
- }
- }
-
- return tab;
- },
- refreshCurrentTab: function(fragId) {
-
- var tab = this.getCurrentTab(fragId);
-
- if (tab!=null) {
- tab.raiseEvent("fragment.refresh");
- }
- },
- getDays: function(nbrOfDays,future) {
- var currentDate = new Date();
- var millisPerDay = 24*60*60*1000;
- var nbrOfHours = millisPerDay * nbrOfDays;
- var dateMillis = future?(currentDate.getTime() + nbrOfHours):(currentDate.getTime() - nbrOfHours);
- var theDate = new Date(dateMillis);
-
- theDate.setHours(0);
- theDate.setMinutes(0);
- theDate.setSeconds(0);
-
- var time = theDate.getTime();
-
- return time;
- },
- getMonths: function(nbrOfMonths,future) {
-
- nbrOfMonths = parseInt(nbrOfMonths,10);
- var theDate = new Date();
- var year = theDate.getFullYear();
- var month = theDate.getMonth();
- var day = theDate.getDate();
- var newYear = year;
- var newMonth = future==true?(month + nbrOfMonths):(month - nbrOfMonths);
-
- var additionalYears = parseInt(newMonth/12,10);
-
- if (newMonth > 0) {
- newYear+=additionalYears;
- }
-
- else {
- newYear= (newYear + additionalYears)-1;
- newMonth = 12 + newMonth;
- }
-
- theDate.setMonth(newMonth);
- theDate.setFullYear(newYear);
-
- theDate.setHours(0);
- theDate.setMinutes(0);
- theDate.setSeconds(0);
-
- return theDate.getTime();
- },
-
- setUIState: function(node,taskStatus,buttonsOnly) {
- var id=null;
- var disabled = false;
- if (buttonsOnly==undefined) {
- buttonsOnly=false;
- }
-
- if (typeof node == "string") {
- id = node;
- }
-
- else if (node !== null && typeof node == "object" && node.id) {
- id = node.id;
- }
-
- if (id !== null && taskStatus!==undefined) {
-
- if (taskStatus=='COMPLETED' || taskStatus=='ERROR' || taskStatus=='EXITED' || taskStatus=='OBSOLETE') {
- disabled=true;
- }
-
- else if (typeof taskStatus == "boolean"){
- disabled = taskStatus;
- }
- else if (taskStatus=='READY') {
- disabled = false;
- }
- }
-
- if (this.fragObj != undefined && buttonsOnly != undefined && buttonsOnly==true) {
- var fragId = this.fragObj.id;
-
-
- var items = dojo.query('[id^= \"'+fragId+'button\"]').forEach(
- function(item, index, array){
- var widget = dijit.byId(item.id);
- if (widget !== undefined) {
- widget.attr("disabled",disabled);
- }
- }
- );
- }
- else {
-
- var widget = dijit.byId(id);
- if (widget !== undefined) {
- widget.attr("disabled",disabled);
- }
-
- else {
- var node = dojo.byId(id);
- if (node!==undefined) {
- node.disabled = disabled;
-
-
- if (disabled) {
- dojo.style(node,"opacity","0.4");
- }
- else {
- dojo.style(node,"opacity","1");
- }
- }
- }
- }
- },
- debug: function(message) {
- var debugDivId = 'debugDiv';
- var debugDiv = $(debugDivId);
- var clearFunc = function clear() {
- var debugDiv = document.getElementById(debugDivId);
- if (debugDiv) {
- debugDiv.innerHTML="";
- }
- };
-
- if (debugDiv == null) {
- debugDiv = xCreateElement("div");
- debugDiv.id = "debugDiv";
- debugDiv.style.width="1200px";
- debugDiv.style.height="300px"
- debugDiv.style.border="1px solid red";
- debugDiv.style.overflow="auto";
- debugDiv.style.display="block";
- document.body.appendChild(debugDiv);
- var btn = xCreateElement("input");
- btn.type="button"
- btn.value="Clear";
- btn.onclick=clearFunc;
- document.body.appendChild(btn);
- }
- if (debugDiv && document.createTextNode) {
- var messageNode=document.createTextNode(new Date()+"->"+message);
- var br = document.createElement('br');
- debugDiv.appendChild(messageNode);
- debugDiv.appendChild(br);
- }
- }
- }
- var dojoEditor = null;
- function DOJOEditor(id,options) {
- this.id = id;
- this.editorHolder = dojo.byId(id);
- this.options = options;
- this.editor;
- this.setup();
- }
- DOJOEditor.prototype.setup = function() {
- var body = document.getElementsByTagName("body")[0];
- var currClass = dojo.attr( body, "class" ) || "";
- if (currClass.indexOf ("tundra") == -1){
- dojo.attr( body, "class", currClass + " tundra" );
- }
- }
- DOJOEditor.prototype.create = function () {
- this.editor = new dijit.Editor(this.options, this.id);
- this.editorHolder = dojo.byId(this.id);
- };
- DOJOEditor.prototype.destroy = function () {
- if(this.editor) {
- this.editor.destroyRecursive(true);
- this.cleanup();
- }
- };
- DOJOEditor.prototype.cleanup = function() {
- this.editorHolder.innerHTML = "";
- this.editorHolder=null;
- this.editor=null;
-
- delete dojo._topics["available"];
-
-
- };
- DOJOEditor.prototype.isEmpty = function () {
- var value = this.editor.getValue();
- return value == "" || /<br.*_moz_editor_bogus_node.*\/>/.test(value);
- };
- DOJOEditor.prototype.getValue = function () {
- var value = this.editor.getValue();
- if (this.isEmpty()) {
- value = "";
- }
- return value;
- };
- DOJOEditor.prototype.setValue = function (value) {
- this.editor.setValue(value);
- };
- var hts_tabDisabler = new HTSTabDisabler();
- hts_productMode = new HTSProductMode();
|