diff --git a/gulliver/js/common/core/common.js b/gulliver/js/common/core/common.js index 925bdcb4a..2041b1a0f 100755 --- a/gulliver/js/common/core/common.js +++ b/gulliver/js/common/core/common.js @@ -925,11 +925,11 @@ function get_xmlhttp() { xmlhttp = false; if ( window.ActiveXObject ) xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } + } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } + } catch (E) { xmlhttp = false; } @@ -1231,47 +1231,47 @@ var radios = document.getElementById('form[' + field + ']'); /* @author Alvaro Campos Sanchez */ -function validDate(TheField, Required) { +function validDate(TheField, Required) { var date = TheField.split("-"); var date1 = date[0]; var date2 = date[1]; var date3 = date[2]; var TheDay,TheMonth,TheYear; - + if ((date1.length==4)&&(!TheYear)) TheYear = date1; if (date1.length==2) - if ((date1>0)&&(date1<=12)&&(!TheMonth)) + if ((date1>0)&&(date1<=12)&&(!TheMonth)) TheMonth = date1; - else - if ((date1>0)&&(date1<=31)&&(!TheDay)) + else + if ((date1>0)&&(date1<=31)&&(!TheDay)) TheDay = date1; else TheYear = date1; - + if ((date2.length==4)&&(!TheYear)) TheYear = date2; if (date2.length==2) - if ((date2>0)&&(date2<=12)&&(!TheMonth)) + if ((date2>0)&&(date2<=12)&&(!TheMonth)) TheMonth = date2; - else - if ((date2>0)&&(date2<=31)&&(!TheDay)) + else + if ((date2>0)&&(date2<=31)&&(!TheDay)) TheDay = date2; else - TheYear = date2; - + TheYear = date2; + if((date3.length==4)&&(!TheYear)) TheYear = date3; if (date3.length==2) - if ((date3>0)&&(date3<=12)&&(!TheMonth)) + if ((date3>0)&&(date3<=12)&&(!TheMonth)) TheMonth = date3; - else - if ((date3>0)&&(date3<=31)&&(!TheDay)) + else + if ((date3>0)&&(date3<=31)&&(!TheDay)) TheDay = date3; else - TheYear = date3; - + TheYear = date3; + if (!TheYear || !TheMonth || !TheDay) return false; if ((Required)||(Required=='true')) @@ -1283,9 +1283,9 @@ function validDate(TheField, Required) { if ((TheMonth != 02)&&(TheMonth < 13)&&(TheMonth > 0)) if (TheDay > 30) return false; - + return true; - + } /* @author David S. Callizaya S. @@ -1363,34 +1363,34 @@ function dynaformSetFocus(){ * @Author alvaro * @return false */ -function idSet(name){ +function idSet(name){ var inputs = document.getElementsByTagName('input'); if(inputs.length > 0){ for(i in inputs){ - id = inputs[i].id; + id = inputs[i].id; if(id == "form["+name+"_label]"){ - + if(inputs[i].value.trim()) - var valueLabel = inputs[i].value; + var valueLabel = inputs[i].value; else - var valueLabel = "Empty"; - } - + var valueLabel = "Empty"; + } + if(id == "form["+name+"]"){ - try { + try { if(valueLabel !="Empty"){ if (! inputs[i].value) - inputs[i].value = valueLabel; - }else - inputs[i].value = ""; - + inputs[i].value = valueLabel; + }else + inputs[i].value = ""; + } catch (e) { //nothing } - } + } } - } - return false; + } + return false; } /** @@ -1406,8 +1406,8 @@ function idSet(name){ * @Return (string) the parsed string with htmlentities at the string passed such as parameter */ function htmlentities (string, quote_style, charset, double_encode) { - // Convert all applicable characters to HTML entities - // + // Convert all applicable characters to HTML entities + // // version: 1109.2015 // discuss at: http://phpjs.org/functions/htmlentities // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) @@ -1421,31 +1421,31 @@ function htmlentities (string, quote_style, charset, double_encode) { // * example 1: htmlentities('Kevin & van Zonneveld'); // * returns 1: 'Kevin & van Zonneveld' // * example 2: htmlentities("foo'bar","ENT_QUOTES"); - // * returns 2: 'foo'bar' - var hash_map = get_html_translation_table('HTML_ENTITIES', quote_style), symbol = ''; + // * returns 2: 'foo'bar' + var hash_map = get_html_translation_table('HTML_ENTITIES', quote_style), symbol = ''; string = string == null ? '' : string + ''; - - if (!hash_map) { + + if (!hash_map) { return false; } - + if (quote_style && quote_style === 'ENT_QUOTES') { hash_map["'"] = '''; } - + if (!!double_encode || double_encode == null) { for (symbol in hash_map) { - if (hash_map.hasOwnProperty(symbol)) { + if (hash_map.hasOwnProperty(symbol)) { string = string.split(symbol).join(hash_map[symbol]); } } } else { - string = string.replace(/([\s\S]*?)(&(?:#\d+|#x[\da-f]+|[a-zA-Z][\da-z]*);|$)/g, function (ignore, text, entity) { + string = string.replace(/([\s\S]*?)(&(?:#\d+|#x[\da-f]+|[a-zA-Z][\da-z]*);|$)/g, function (ignore, text, entity) { for (symbol in hash_map) { if (hash_map.hasOwnProperty(symbol)) { text = text.split(symbol).join(hash_map[symbol]); } - } + } return text + entity; }); } @@ -1470,7 +1470,7 @@ function utf8_encode (argString) { } else { enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128); - } + } if (enc !== null) { if (end > start) { utftext += string.slice(start, end); @@ -1478,34 +1478,34 @@ function utf8_encode (argString) { utftext += enc; start = end = n + 1; } - } + } if (end > start) { utftext += string.slice(start, stringl); } return utftext; -} +} function base64_encode (data) { var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc = "", - tmp_arr = []; + tmp_arr = []; if (!data) { return data; - } - data = utf8_encode(data + ''); - do { + } + data = utf8_encode(data + ''); + do { o1 = data.charCodeAt(i++); o2 = data.charCodeAt(i++); - o3 = data.charCodeAt(i++); - bits = o1 << 16 | o2 << 8 | o3; + o3 = data.charCodeAt(i++); + bits = o1 << 16 | o2 << 8 | o3; h1 = bits >> 18 & 0x3f; h2 = bits >> 12 & 0x3f; h3 = bits >> 6 & 0x3f; - h4 = bits & 0x3f; + h4 = bits & 0x3f; tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); - } while (i < data.length); - enc = tmp_arr.join(''); + } while (i < data.length); + enc = tmp_arr.join(''); switch (data.length % 3) { case 1: enc = enc.slice(0, -2) + '=='; @@ -1513,13 +1513,13 @@ function base64_encode (data) { case 2: enc = enc.slice(0, -1) + '='; break; - } + } return enc; } function get_html_translation_table (table, quote_style) { - // Returns the internal translation table used by htmlspecialchars and htmlentities - // + // Returns the internal translation table used by htmlspecialchars and htmlentities + // // version: 1109.2015 // discuss at: http://phpjs.org/functions/get_html_translation_table // + original by: Philip Peterson // + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) @@ -1541,19 +1541,19 @@ function get_html_translation_table (table, quote_style) { var constMappingTable = {}, constMappingQuoteStyle = {}; var useTable = {}, - useQuoteStyle = {}; + useQuoteStyle = {}; // Translate arguments constMappingTable[0] = 'HTML_SPECIALCHARS'; constMappingTable[1] = 'HTML_ENTITIES'; constMappingQuoteStyle[0] = 'ENT_NOQUOTES'; constMappingQuoteStyle[2] = 'ENT_COMPAT'; constMappingQuoteStyle[3] = 'ENT_QUOTES'; - + useTable = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS'; - useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT'; + useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT'; if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') { throw new Error("Table: " + useTable + ' not supported'); // return false; - } + } entities['38'] = '&'; if (useTable === 'HTML_ENTITIES') { entities['160'] = ' '; @@ -1633,7 +1633,7 @@ function get_html_translation_table (table, quote_style) { entities['253'] = 'ý'; entities['254'] = 'þ'; entities['255'] = 'ÿ'; - } + } if (useQuoteStyle !== 'ENT_NOQUOTES') { entities['34'] = '"'; } @@ -1641,13 +1641,13 @@ function get_html_translation_table (table, quote_style) { } entities['60'] = '<'; entities['62'] = '>'; - + // ascii decimals to real symbols for (decimal in entities) { if (entities.hasOwnProperty(decimal)) { hash_map[String.fromCharCode(decimal)] = entities[decimal]; } } - + return hash_map; } @@ -1785,8 +1785,8 @@ function highlightRow(o, color){ * @Param * @Return */ -String.prototype.trim = function() { - return this.replace(/^\s+|\s+get/g,""); +String.prototype.trim = function () { + return this.replace(/^\s+|\s+$/g, ""); } function clearCalendar(id){ @@ -1892,22 +1892,22 @@ function PMOS_TemporalMessage(timeToHide){ /** * fast messagesbox - * + * * @Param msg (string) : your message * @Param type (string): {alert|info|confirm} - * @Param type (string): xcallback, callback function name to execute after at user click on Accept + * @Param type (string): xcallback, callback function name to execute after at user click on Accept * @Author */ function msgBox(msg, type, callbackAccept, callbackCancel){ - + //setting default type type = typeof(type) != 'undefined'? type: 'info'; - + //setting up the callback action acceptEv = typeof(callbackAccept) != 'undefined'? callbackAccept: false; cancelEv = typeof(callbackCancel) != 'undefined'? callbackCancel: false; - + switch(type){ case 'alert': new leimnud.module.app.alert().make({ @@ -1954,9 +1954,9 @@ function msgBox(msg, type, callbackAccept, callbackCancel){ }.extend(this) }); } - break; + break; } - + } @@ -1966,8 +1966,8 @@ function executeEvent(id, ev){ document.getElementById(id).checked = true; if(document.getElementById(id).onclick){ try{ - document.getElementById(id).onclick(); - }catch(e){} + document.getElementById(id).onclick(); + }catch(e){} } break; } @@ -2002,7 +2002,7 @@ function getClientWindowSize() { function popUp(URL, width, height, left, top, resizable) { window.open(URL, '', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable='+resizable+',width='+width+',height='+height+',left = '+left+',top = '+top+''); -} +} /** * Alias for tedious large definition for ajax object - By Erik A.O. @@ -2016,12 +2016,12 @@ function removeValue(id){ document.getElementById('form['+id+']').value = ''; else if( document.getElementById(id) ) document.getElementById(id).value = ''; - + fireEvent(document.getElementById(id), 'change'); } function datePicker4(obj, id, mask, startDate, endDate, showTIme, idIsoDate) -{ +{ if (showTIme=='false') { showTIme = false; } @@ -2063,7 +2063,7 @@ function fireEvent(element, event) } } -function elementAttributesNS(e, ns) +function elementAttributesNS(e, ns) { if (!this.__namespaceRegexps) this.__namespaceRegexps = {}; @@ -2083,7 +2083,7 @@ function elementAttributesNS(e, ns) return result; } -/** +/** * Translator function for internationalization */ function _() @@ -2093,23 +2093,42 @@ function _() if( typeof TRANSLATIONS != 'undefined' && TRANSLATIONS) { if( typeof TRANSLATIONS[argv[0]] != 'undefined' ) { - if (argc > 1) { + if (argc > 1) { trn = TRANSLATIONS[argv[0]]; for (i = 1; i < argv.length; i++) { trn = trn.replace('{'+(i-1)+'}', argv[i]); } } else { - trn = TRANSLATIONS[argv[0]]; + trn = TRANSLATIONS[argv[0]]; } - } + } else { trn = '**' + argv[0] + '**'; } - } + } else { PMExt.error('Processmaker JS Core Error', 'The TRANSLATIONS global object is not loaded!'); trn = ''; } return trn; } + +/** + * String Replace function, if StrSearch has special characters "(", "[", must be escape "\\(", "\\[". + */ +function stringReplace(strSearch, stringReplace, str) +{ + var expression = eval("/" + strSearch + "/g"); + + return str.replace(expression, stringReplace); +} + +var mb_strlen = function(str) { + var len = 0; + for (var i = 0; i < str.length; i++) { + len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? 2 : 1; + } + return len; +}; + diff --git a/gulliver/js/ext/pmos-common.js b/gulliver/js/ext/pmos-common.js index bd38119ec..2b582eaa5 100755 --- a/gulliver/js/ext/pmos-common.js +++ b/gulliver/js/ext/pmos-common.js @@ -473,9 +473,8 @@ Ext.util.Format.capitalize = (function(){ /** * left and right delete the blank characteres (String prototype) */ -String.prototype.trim = function() { - return this.replace(/^\s+|\s+get/g,""); - //return Ext.util.Format.trim(this); +String.prototype.trim = function () { + return this.replace(/^\s+|\s+$/g, ""); } String.prototype.nl2br = function () { diff --git a/gulliver/js/form/core/form.js b/gulliver/js/form/core/form.js index fc8085959..4b26f6852 100755 --- a/gulliver/js/form/core/form.js +++ b/gulliver/js/form/core/form.js @@ -1060,7 +1060,7 @@ function G_Text(form, element, name) tamMask = aux[0].length; sw = true; } - if (tamData >= tamMask){ + if (tamData >= tamMask){ var minusExi; for (var numI = 0; newValue.length > numI; numI++) { var campVal = newValue[numI]; @@ -1073,7 +1073,7 @@ function G_Text(form, element, name) } } } - + if (!(keyCode == 45 || (minusExi && tamMask >= tamData))) { if (sw && !swPeriod && testData.indexOf(me.comma_separator) == -1){ action = 'none'; @@ -1081,7 +1081,7 @@ function G_Text(form, element, name) if (!sw) action = 'none'; } } - } + } switch(action){ case 'mask': case 'move': dataNewMask = me.replaceMasks(newValue, newCursor); @@ -3547,11 +3547,5 @@ function dateSetMask(mask) { return mask; } -function stringReplace(strSearch, stringReplace, str) -{ - var expression = eval("/" + strSearch + "/g"); - - return str.replace(expression, stringReplace); -} - /* end file */ + diff --git a/gulliver/js/widgets/suggest/bsn.AutoSuggest_2.1.3.js b/gulliver/js/widgets/suggest/bsn.AutoSuggest_2.1.3.js index 439282a35..73428a0b7 100755 --- a/gulliver/js/widgets/suggest/bsn.AutoSuggest_2.1.3.js +++ b/gulliver/js/widgets/suggest/bsn.AutoSuggest_2.1.3.js @@ -11,6 +11,7 @@ //static variable for suggest responses. @By Erik var Static_AutosuggestResponseData; +var swStoreEntry = 1; if (typeof(bsn) == "undefined") @@ -28,7 +29,7 @@ _b.AutoSuggest = function (id, param) // if (!document.getElementById) return 0; - + // get field via DOM // this.fld = _b.DOM.gE(id); @@ -42,12 +43,12 @@ _b.AutoSuggest = function (id, param) this.nInpC = 0; this.aSug = []; this.iHigh = 0; - + // parameters object // this.oP = param ? param : {}; - - // defaults + + // defaults // var k, def = {minchars:1, meth:"get", varname:"input", className:"autosuggest", timeout:5000, delay:50, offsety:-5, shownoresults: true, noresults: "No results!", maxheight: 250, cache: true, maxentries: 25}; //timeout::2500 //delay was modified of 5000 or 500 by 5, I don't sure.. ;) can't remember... <-erik notes->' @@ -56,107 +57,124 @@ _b.AutoSuggest = function (id, param) if (typeof(this.oP[k]) != typeof(def[k])) this.oP[k] = def[k]; } - + // set keyup handler for field // and prevent autocomplete from client // var p = this; - + // NOTE: not using addEventListener because UpArrow fired twice in Safari //_b.DOM.addEvent( this.fld, 'keyup', function(ev){ return pointer.onKeyPress(ev); } ); - + this.fld.onkeypress = function(ev){ return p.onKeyPress(ev); }; this.fld.onkeyup = function(ev){ return p.onKeyUp(ev); }; - + this.fld.setAttribute("autocomplete","off"); }; -_b.AutoSuggest.prototype.onKeyPress = function(ev) +_b.AutoSuggest.prototype.onKeyPress = function (ev) { - - var key = (window.event) ? window.event.keyCode : ev.keyCode; + var key = (window.event)? window.event.keyCode : ev.keyCode; - var RETURN = 13; - var TAB = 9; - var ESC = 27; - - var bubble = 1; + var RETURN = 13; + var TAB = 9; + var ESC = 27; - switch(key) - { - case RETURN: - this.setHighlightedValue(); - bubble = 0; - //added by erik, this is for enter press, no new line into text area - return false; - break; + var bubble = 1; - case ESC: - this.clearSuggestions(); - break; - } + switch (key) { + case RETURN: + if (typeof this.oP.storeEntryData != "undefined" && this.oP.storeEntryData[0] == 1) { + var elem = document.getElementById(this.oP.storeEntryData[1]); - return bubble; + if (elem.value != "" && swStoreEntry == 1 && + typeof Static_AutosuggestResponseData != "undefined" && Static_AutosuggestResponseData.results.length > 0 + ) { + for (var i = 0 ; i <= Static_AutosuggestResponseData.results.length - 1; i++) { + if (Static_AutosuggestResponseData.results[i].value == elem.value) { + swStoreEntry = 0; + } + } + } + + if (elem.value == "") { + swStoreEntry = 0; + } + + if (swStoreEntry == 1) { + storeEntryProcessAjax( + elem, + this.oP.storeEntryData[2], + this.oP.storeEntryData[3], + this.oP.storeEntryData[4], + this.oP.storeEntryData[5], + this.oP.storeEntryData[6] + ); + } + } + + this.setHighlightedValue(); + bubble = 0; + //added by erik, this is for enter press, no new line into text area + return false; + break; + case ESC: + this.clearSuggestions(); + break; + default: + swStoreEntry = 1; + break; + } + + return bubble; }; - - -_b.AutoSuggest.prototype.onKeyUp = function(ev) +_b.AutoSuggest.prototype.onKeyUp = function (ev) { - var key = (window.event) ? window.event.keyCode : ev.keyCode; + var key = (window.event)? window.event.keyCode : ev.keyCode; - var ARRUP = 38; - var ARRDN = 40; - - var bubble = 1; + var ARRUP = 38; + var ARRDN = 40; - switch(key) - { - case ARRUP: - this.changeHighlight(key); - this.setHighlightedValue2(); - bubble = 0; - break; + var bubble = 1; + switch (key) { + case ARRUP: + this.changeHighlight(key); + this.setHighlightedValue2(); + bubble = 0; + swStoreEntry = 0; + break; + case ARRDN: + this.changeHighlight(key); + this.setHighlightedValue2(); + bubble = 0; + swStoreEntry = 0; + break; + default: + this.getSuggestions(this.fld.value); + break; + } - case ARRDN: - this.changeHighlight(key); - this.setHighlightedValue2(); - bubble = 0; - break; - - - default: - this.getSuggestions(this.fld.value); - } - - return bubble; - + return bubble; }; - - - - - - - _b.AutoSuggest.prototype.getSuggestions = function (val) { - + // if input stays the same, do nothing // if (val == this.sInp) return 0; - + // kill list // _b.DOM.remE(this.idAs); - - + + this.sInp = val; - + // input length is less than the min required to trigger a request // do nothing // @@ -166,7 +184,7 @@ _b.AutoSuggest.prototype.getSuggestions = function (val) this.nInpC = val.length; return 0; } - + var ol = this.nInpC; // old length this.nInpC = val.length ? val.length : 0; @@ -185,7 +203,7 @@ _b.AutoSuggest.prototype.getSuggestions = function (val) arr.push( this.aSug[i] ); } this.aSug = arr; - + this.createList(this.aSug); return false; } @@ -221,13 +239,13 @@ _b.AutoSuggest.prototype.doAjaxRequest = function (input) var url = this.oP.script(encodeURIComponent(this.sInp)); else var url = this.oP.script+this.oP.varname+"="+encodeURIComponent(this.sInp); - + if (!url) return false; - + var meth = this.oP.meth; var input = this.sInp; - + var onSuccessFunc = function (req) { pointer.setSuggestions(req, input) }; var onErrorFunc = function (status) { alert("AJAX error: "+status); }; @@ -244,15 +262,15 @@ _b.AutoSuggest.prototype.setSuggestions = function (req, input) return false; this.aSug = []; - - + + if (this.oP.json) { - + var jsondata = eval('(' + req.responseText + ')'); if( jsondata.status == 0 ){ - + Static_AutosuggestResponseData = jsondata; for (var i=0;i" + val.substring(st, st+this.sInp.length) + "" + val.substring(st+this.sInp.length); - - + + var span = _b.DOM.cE("span", {}, output, true); if (arr[i].info != "") { @@ -337,46 +355,46 @@ _b.AutoSuggest.prototype.createList = function(arr) var small = _b.DOM.cE("small", {}, arr[i].info); span.appendChild(small); } - + var a = _b.DOM.cE("a", { href:"#" }); - + var tl = _b.DOM.cE("span", {className:"tl"}, " "); var tr = _b.DOM.cE("span", {className:"tr"}, " "); a.appendChild(tl); a.appendChild(tr); - + a.appendChild(span); - + a.name = i+1; a.onclick = function () { pointer.setHighlightedValue(); return false; }; - a.onmouseover = function () { - pointer.setHighlight(this.name); + a.onmouseover = function () { + pointer.setHighlight(this.name); // Commented by Bug 6672 // pointer.setHighlightedValue2(); - + }; - + var li = _b.DOM.cE( "li", {}, a ); - + ul.appendChild( li ); } - - + + // no results // if (arr.length == 0 && this.oP.shownoresults) { var li = _b.DOM.cE( "li", {className:"as_warning"}, this.oP.noresults ); ul.appendChild( li ); - + //By Erik AO Static_AutosuggestResponseData.results.length = 0; } - - + + div.appendChild( ul ); - - + + var fcorner = _b.DOM.cE("div", {className:"as_corner"}); var fbar = _b.DOM.cE("div", {className:"as_bar"}); var footer = _b.DOM.cE("div", {className:"as_footer"}); @@ -389,7 +407,7 @@ _b.AutoSuggest.prototype.createList = function(arr) // set width of holding div to width of field // var pos = _b.DOM.getPos(this.fld); - + div.style.left = pos.x + "px"; div.style.top = ( pos.y + this.fld.offsetHeight + this.oP.offsety ) + "px"; div.style.width = this.fld.offsetWidth + "px"; @@ -408,7 +426,7 @@ _b.AutoSuggest.prototype.createList = function(arr) // currently no item is highlighted // this.iHigh = 0; - + // remove list after an interval // var pointer = this; @@ -416,25 +434,25 @@ _b.AutoSuggest.prototype.createList = function(arr) }; _b.AutoSuggest.prototype.changeHighlight = function(key) -{ +{ var list = _b.DOM.gE("as_ul"); if (!list) return false; - + var n; if (key == 40) n = this.iHigh + 1; else if (key == 38) n = this.iHigh - 1; - - + + if (n > list.childNodes.length) n = list.childNodes.length; if (n < 1) n = 1; - - + + this.setHighlight(n); }; @@ -443,12 +461,12 @@ _b.AutoSuggest.prototype.setHighlight = function(n) var list = _b.DOM.gE("as_ul"); if (!list) return false; - + if (this.iHigh > 0) this.clearHighlight(); - + this.iHigh = Number(n); - + list.childNodes[this.iHigh-1].className = "as_highlight"; @@ -460,7 +478,7 @@ _b.AutoSuggest.prototype.clearHighlight = function() var list = _b.DOM.gE("as_ul"); if (!list) return false; - + if (this.iHigh > 0) { list.childNodes[this.iHigh-1].className = ""; @@ -475,21 +493,21 @@ _b.AutoSuggest.prototype.setHighlightedValue = function () { /** * @autor Erik Amaru Ortiz - * This fix when a item on suggestion list have html wntities sent by json like & + * This fix when a item on suggestion list have html wntities sent by json like & */ if(this.aSug[ this.iHigh-1 ]) this.sInp = this.fld.value = html_entity_decode(this.aSug[ this.iHigh-1 ].value);; // - + // move cursor to end of input (safari) // this.fld.focus(); if (this.fld.selectionStart) this.fld.setSelectionRange(this.sInp.length, this.sInp.length); - + this.clearSuggestions(); - + // pass selected object to callback function, if exists // if (typeof(this.oP.callback) == "function") @@ -503,16 +521,16 @@ _b.AutoSuggest.prototype.setHighlightedValue2 = function () { if(this.aSug[ this.iHigh-1 ]) this.sInp = this.fld.value = html_entity_decode(this.aSug[ this.iHigh-1 ].value); - + // move cursor to end of input (safari) // /*this.fld.focus(); if (this.fld.selectionStart) this.fld.setSelectionRange(this.sInp.length, this.sInp.length); - + */ //this.clearSuggestions(); - + // pass selected object to callback function, if exists // /*if (typeof(this.oP.callback) == "function") @@ -534,9 +552,9 @@ _b.AutoSuggest.prototype.resetTimeout = function() _b.AutoSuggest.prototype.clearSuggestions = function () { - + this.killTimeout(); - + var ele = _b.DOM.gE(this.idAs); var pointer = this; if (ele) @@ -559,15 +577,15 @@ _b.Ajax = function () _b.Ajax.prototype.makeRequest = function (url, meth, onComp, onErr) { - + if (meth != "POST") meth = "GET"; - + this.onComplete = onComp; this.onError = onErr; - + var pointer = this; - + // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { @@ -591,7 +609,7 @@ _b.Ajax.prototype.makeRequest = function (url, meth, onComp, onErr) _b.Ajax.prototype.processReqChange = function() { - + // only if req shows "loaded" if (this.req.readyState == 4) { // only if "OK" @@ -615,12 +633,12 @@ _b.DOM.cE = function ( type, attr, cont, html ) var ne = document.createElement( type ); if (!ne) return 0; - + for (var a in attr) ne[a] = attr[a]; - + var t = typeof(cont); - + if (t == "string" && !html) ne.appendChild( document.createTextNode(cont) ); else if (t == "string" && html) @@ -657,7 +675,7 @@ _b.DOM.gE = function ( e ) _b.DOM.remE = function ( ele ) { var e = this.gE(ele); - + if (!e) return 0; else if (e.parentNode.removeChild(e)) @@ -684,9 +702,9 @@ _b.DOM.getPos = function ( e ) } else if (obj.x) curleft += obj.x; - + var obj = e; - + var curtop = 0; if (obj.offsetParent) { @@ -708,22 +726,22 @@ if (typeof(_b.Fader) == "undefined") _b.Fader = {}; _b.Fader = function (ele, from, to, fadetime, callback) -{ +{ if (!ele) return 0; - + this.e = ele; - + this.from = from; this.to = to; - + this.cb = callback; - + this.nDur = fadetime; - + this.nInt = 50; this.nTime = 0; - + var p = this; this.nID = setInterval(function() { p._fade() }, this.nInt); }; @@ -731,16 +749,16 @@ _b.Fader = function (ele, from, to, fadetime, callback) _b.Fader.prototype._fade = function() { this.nTime += this.nInt; - + var ieop = Math.round( this._tween(this.nTime, this.from, this.to, this.nDur) * 100 ); var op = ieop / 100; - + if (this.e.filters) // internet explorer { try { this.e.filters.item("DXImageTransform.Microsoft.Alpha").opacity = ieop; - } catch (e) { + } catch (e) { // If it is not set initially, the browser will throw an error. This will set it if it is not set yet. this.e.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity='+ieop+')'; } @@ -749,8 +767,8 @@ _b.Fader.prototype._fade = function() { this.e.style.opacity = op; } - - + + if (this.nTime == this.nDur) { clearInterval( this.nID ); @@ -764,41 +782,97 @@ _b.Fader.prototype._tween = function(t,b,c,d) return b + ( (c-b) * (t/d) ); }; - - -function storeEntry(o, cnn, table, pk, pkt, fld){ - if( typeof('Static_AutosuggestResponseData') != 'undefined' && Static_AutosuggestResponseData.results.length == 0 ){ - //alert('store it '+ ' -> '+o.id+' val '+ o.value); - var myAjax = new _b.Ajax(); - myAjax.makeRequest('../gulliver/genericAjax?request=storeInTmp'+'&cnn='+cnn+'&table='+table+'&pk='+pk+'&pkt='+pkt+'&fld='+fld+'&value='+o.value, 'POST', - function(req){ - var response = eval('('+req.responseText+')'); - if( response.status != 0 ){ - alert(response.message); - } - }, - function(req){ - //alert(req) - } ); - } +function storeEntryMessageHide(id) +{ + if (document.getElementById(id)) { + document.getElementById(id).parentNode.removeChild(document.getElementById(id)); + } } -function html_entity_decode( string, quote_style ) { - var histogram = {}, symbol = '', tmp_str = '', entity = ''; - tmp_str = string.toString(); - - if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) { - return false; - } - - // & must be the last character when decoding! - delete(histogram['&']); - histogram['&'] = '&'; - - for (symbol in histogram) { - entity = histogram[symbol]; - tmp_str = tmp_str.split(entity).join(symbol); - } - +function storeEntryProcessAjax(o, cnn, table, pk, pkt, fld) +{ + var myAjax = new _b.Ajax(); + + myAjax.makeRequest( + "../gulliver/genericAjax?request=storeInTmp" + "&cnn=" + cnn + "&table=" + table + "&pk=" + pk + "&pkt=" + pkt + "&fld=" + fld + "&value=" + o.value, + "POST", + function (req) + { + var response = eval("(" + req.responseText + ")"); + + switch (response.status) { + case 1: + var w1 = document.documentElement.clientWidth; + var sbX1 = document.documentElement.scrollLeft; + var sbY1 = document.documentElement.scrollTop; + + var w2 = document.body.clientWidth; + var sbX2 = document.body.scrollLeft; + var sbY2 = document.body.scrollTop; + + var bodyW = (w1 > 0)? w1 : w2; + var scrollbarX = (sbX1 > 0)? sbX1 : sbX2; + var scrollbarY = (sbY1 > 0)? sbY1 : sbY2; + + storeEntryMessageHide("myIframe"); + + var myIframe = document.createElement("iframe"); + myIframe.setAttribute("id", "myIframe"); + myIframe.style.position = "absolute"; + myIframe.style.left = (parseInt(bodyW / 2) - 200 + scrollbarX) + "px"; + myIframe.style.top = (scrollbarY + 5) + "px"; + myIframe.src = "about:blank"; + myIframe.frameBorder = 0; + myIframe.scrolling = "no"; + myIframe.style.width = "400px"; + myIframe.style.height = "45px"; + + leimnud.event.add( + myIframe, + "load", + function (evt) + { + document.getElementById("myIframe").contentWindow.document.body.style.margin = 0; + document.getElementById("myIframe").contentWindow.document.body.style.padding = 0; + document.getElementById("myIframe").contentWindow.document.body.innerHTML = "
\"\"" + _("ID_FIELD_DYNAFORM_SUGGEST_MESSAGE_TEMPORAL") + "
"; + } + ); + + document.body.appendChild(myIframe); + + setTimeout("storeEntryMessageHide(\"myIframe\")", 1750); + + swStoreEntry = 0; + break; + default: + alert(response.message); + break; + } + }, + function (req) + { + //alert(req); + } + ); +} + +function html_entity_decode( string, quote_style ) { + var histogram = {}, symbol = '', tmp_str = '', entity = ''; + tmp_str = string.toString(); + + if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) { + return false; + } + + // & must be the last character when decoding! + delete(histogram['&']); + histogram['&'] = '&'; + + for (symbol in histogram) { + entity = histogram[symbol]; + tmp_str = tmp_str.split(entity).join(symbol); + } + return tmp_str; -} \ No newline at end of file +} + diff --git a/gulliver/methods/genericAjax.php b/gulliver/methods/genericAjax.php index 0bd10729a..bc7c8cdfc 100755 --- a/gulliver/methods/genericAjax.php +++ b/gulliver/methods/genericAjax.php @@ -1,4 +1,4 @@ - $value) { - if ($key != $_POST['rowpos']) { + if ($key != $_POST['rowpos']) { $oFields[$initialKey] = $value; - $initialKey++; + $initialKey++; } } unset($_SESSION[$_POST['formID']][$_POST['gridname']]); - $_SESSION[$_POST['formID']][$_POST['gridname']] = $oFields; - + $_SESSION[$_POST['formID']][$_POST['gridname']] = $oFields; + /* if( isset($_SESSION['APPLICATION']) ){ G::LoadClass('case'); $oApp= new Cases(); @@ -31,9 +31,9 @@ if( isset($request) ){ $oFields[$initialKey] = $value; $initialKey++; $aFields['APP_DATA'][$_POST['gridname']] = $oFields; - } + } $oApp->updateCase($_SESSION['APPLICATION'], $aFields); - } + } */ break; /** widgets **/ @@ -41,8 +41,8 @@ if( isset($request) ){ try { if(isset($_GET["inputEnconde64"])) { - $_GET['input'] = base64_decode($_GET['input']); - } + $_GET['input'] = base64_decode($_GET['input']); + } $sData = base64_decode(str_rot13($_GET['hash'])); list($SQL, $DB_UID) = explode('@|', $sData); // Remplace values for dependent fields @@ -57,7 +57,7 @@ if( isset($request) ){ $parser = new PHPSQLParser($SQL); // Verif parsed array - // print_r($parser->parsed); + // print_r($parser->parsed); $SQL = queryModified($parser->parsed, $_GET['input']); $aRows = Array(); @@ -130,7 +130,7 @@ if( isset($request) ){ $arr = array(); $aReplace = array("(\r\n)", "(\n\r)", "(\n)", "(\r)"); for ($i=0;$iexecuteQuery("INSERT INTO {$_GET['table']} ({$_GET['pk']}, {$_GET['fld']}) VALUES ('$gKey', '{$_GET['value']}');"); - echo '{status:0, message:"success"}'; - }catch( Exception $e){ + + echo "{status: 1, message: \"success\"}"; + } catch (Exception $e) { $err = $e->getMessage(); //$err = eregi_replace("[\n|\r|\n\r]", ' ', $err); - $err = preg_replace("[\n|\r|\n\r]", ' ', $err); // Made compatible to PHP 5.3 - echo '{result:1, message:"'.$err.'"}'; + $err = preg_replace("[\n|\r|\n\r]", " ", $err); //Made compatible to PHP 5.3 + + echo "{status: 0, message: \"" . $err . "\"}"; } break; } @@ -213,31 +215,31 @@ function sortByChar($aRows, $charSel) * Converts a SQL array parsing to a SQL string. * @param string $sqlParsed * @param string $inputSel default value empty string - * @return string + * @return string */ -function queryModified($sqlParsed, $inputSel = "") +function queryModified($sqlParsed, $inputSel = "") { if(!empty($sqlParsed['SELECT'])) { - + $sqlSelect = "SELECT "; $aSelect = $sqlParsed['SELECT']; $sFieldSel = (count($aSelect)>1 ) ? $aSelect[1]['base_expr'] : $aSelect[0]['base_expr']; foreach($aSelect as $key => $value ) { - if($key != 0) + if($key != 0) $sqlSelect .= ", "; $sAlias = str_replace("`","", $aSelect[$key]['alias']); $sBaseExpr = $aSelect[$key]['base_expr']; switch($aSelect[$key]['expr_type']){ case 'colref' : if($sAlias === $sBaseExpr) $sqlSelect .= $sAlias; - else + else $sqlSelect .= $sBaseExpr . ' AS ' . $sAlias; break; - case 'expression' : if($sAlias === $sBaseExpr) + case 'expression' : if($sAlias === $sBaseExpr) $sqlSelect .= $sBaseExpr; - else + else $sqlSelect .= $sBaseExpr . ' AS ' . $sAlias; break; case 'subquery' : if(strpos($sAlias, $sBaseExpr,0) != 0) @@ -245,9 +247,9 @@ function queryModified($sqlParsed, $inputSel = "") else $sqlSelect .= $sBaseExpr . " AS " . $sAlias; break; - case 'operator' : $sqlSelect .= $sBaseExpr; + case 'operator' : $sqlSelect .= $sBaseExpr; break; - default : $sqlSelect .= $sBaseExpr; + default : $sqlSelect .= $sBaseExpr; break; } } @@ -260,7 +262,7 @@ function queryModified($sqlParsed, $inputSel = "") if($key == 0) { $sqlFrom .= $aFrom[$key]['table'] . (($aFrom[$key]['table'] == $aFrom[$key]['alias'])?"" : " " . $aFrom[$key]['alias']); } else { - $sqlFrom .= " " . (($aFrom[$key]['join_type']=='JOIN')?"INNER": $aFrom[$key]['join_type']) . " JOIN " . $aFrom[$key]['table'] + $sqlFrom .= " " . (($aFrom[$key]['join_type']=='JOIN')?"INNER": $aFrom[$key]['join_type']) . " JOIN " . $aFrom[$key]['table'] . (($aFrom[$key]['table'] == $aFrom[$key]['alias'])?"" : " " . $aFrom[$key]['alias']) . " " . $aFrom[$key]['ref_type'] . " " . $aFrom[$key]['ref_clause'] ; } @@ -271,48 +273,48 @@ function queryModified($sqlParsed, $inputSel = "") if(!empty($sqlParsed['WHERE'])){ $sqlWhere = " WHERE "; $aWhere = $sqlParsed['WHERE']; - foreach($aWhere as $key => $value ){ + foreach($aWhere as $key => $value ){ $sqlWhere .= $value['base_expr'] . " "; } $sqlWhere .= " AND " . $sFieldSel . " LIKE '%". $inputSel . "%'"; - } + } else { $sqlWhere = " WHERE " . $sFieldSel . " LIKE '%". $inputSel ."%' "; } $sqlGroupBy = ""; - if(!empty($sqlParsed['GROUP'])){ + if(!empty($sqlParsed['GROUP'])){ $sqlGroupBy = "GROUP BY "; $aGroup = $sqlParsed['GROUP']; - foreach($aGroup as $key => $value ){ - if($key != 0) + foreach($aGroup as $key => $value ){ + if($key != 0) $sqlGroupBy .= ", "; if($value['direction'] == 'ASC' ) $sqlGroupBy .= $value['base_expr']; - else + else $sqlGroupBy .= $value['base_expr'] . " " . $value['direction']; } } $sqlHaving = ""; - if(!empty($sqlParsed['HAVING'])){ + if(!empty($sqlParsed['HAVING'])){ $sqlHaving = "HAVING "; $aHaving = $sqlParsed['HAVING']; - foreach($aHaving as $key => $value ){ + foreach($aHaving as $key => $value ){ $sqlHaving .= $value['base_expr'] . " "; } } $sqlOrderBy = ""; - if(!empty($sqlParsed['ORDER'])){ + if(!empty($sqlParsed['ORDER'])){ $sqlOrderBy = "ORDER BY "; $aOrder = $sqlParsed['ORDER']; - foreach($aOrder as $key => $value ){ - if($key != 0) + foreach($aOrder as $key => $value ){ + if($key != 0) $sqlOrderBy .= ", "; if($value['direction'] == 'ASC' ) $sqlOrderBy .= $value['base_expr']; - else + else $sqlOrderBy .= $value['base_expr'] . " " . $value['direction']; } } else { @@ -320,7 +322,7 @@ function queryModified($sqlParsed, $inputSel = "") } $sqlLimit = ""; - if(!empty($sqlParsed['LIMIT'])){ + if(!empty($sqlParsed['LIMIT'])){ $sqlLimit = "LIMIT ". $sqlParsed['LIMIT']['start'] . ", " . $sqlParsed['LIMIT']['end']; } @@ -329,15 +331,15 @@ function queryModified($sqlParsed, $inputSel = "") if(!empty($sqlParsed['CALL'])){ $sCall = "CALL "; $aCall = $sqlParsed['CALL']; - foreach($aCall as $key => $value ){ + foreach($aCall as $key => $value ){ $sCall .= $value . " "; - } + } return $sCall; } if(!empty($sqlParsed['EXECUTE'])){ $sCall = "EXECUTE "; $aCall = $sqlParsed['EXECUTE']; - foreach($aCall as $key => $value ){ + foreach($aCall as $key => $value ){ $sCall .= $value . " "; } return $sCall; @@ -345,7 +347,7 @@ function queryModified($sqlParsed, $inputSel = "") if(!empty($sqlParsed[''])){ $sCall = ""; $aCall = $sqlParsed['']; - foreach($aCall as $key => $value ){ + foreach($aCall as $key => $value ){ $sCall .= $value . " "; } return $sCall; diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index d714065cb..e30e58362 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -1167,9 +1167,12 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek 'size' => '"'.$this->size.'"', ); - $storeEntry = ''; - if($this->store_new_entry){ - $storeEntry = 'onchange="storeEntry(this, \''.$this->sqlConnection.'\', \''.$this->table.'\', \''.$this->primary_key.'\', \''.$this->primary_key_type.'\', \''.$this->field.'\')"'; + $storeEntry = null; + $storeEntryData = ", storeEntryData: [0]"; + + if ($this->store_new_entry) { + $storeEntry = ' title="' . G::LoadTranslation("ID_FIELD_DYNAFORM_SUGGEST_INPUT_TITLE") . '"'; + $storeEntryData = ", storeEntryData: [1, \"form[". $this->name . "_label]\", \"" . $this->sqlConnection . "\", \"" . $this->table . "\", \"" . $this->primary_key . "\", \"" . $this->primary_key_type . "\", \"" . $this->field . "\"]"; } $formVariableValue = ''; @@ -1269,10 +1272,11 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek $setValue = ($this->savelabel == '1') ? 'obj.value' : 'obj.id'; - $sOptions .= 'callback: function(obj){'; - + $sOptions .= 'callback: function (obj) { '; + $sOptions .= 'if (typeof obj != "undefined") { '; $sOptions .= ' var jField = { };'; $sOptions .= ' var sField = "[]"; '; + if ($count > 0) { for ($cnt = 0; $cnt < $count; $cnt++ ) { $sOptions .= 'if ( "' . $this->name . '" == "' . $aDepFields[$cnt] . '" ) {'; @@ -1286,7 +1290,6 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek $sOptions .= ' var sField = "["+ encodeURIComponent(jField.toJSONString()) + "]"; '; $sOptions .= $sCallBack . '; getField("' . $this->name . '").value = obj.id;'; - $sOptions .= 'var response = ajax_function("../gulliver/defaultAjaxDynaform", "reloadField", '; $sOptions .= ' "form=' . $owner->id . '&fields=" + sField, "POST"); '; @@ -1316,11 +1319,12 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek $sOptions .= '} else { '; $sOptions .= ' alert(\'Invalid response: \' + response); ' ; $sOptions .= '} '; - - $sOptions .= 'return false; }'; + $sOptions .= '} '; + $sOptions .= 'return false; '; + $sOptions .= '}'; $str .= ''; return $str; diff --git a/workflow/engine/classes/class.applications.php b/workflow/engine/classes/class.applications.php index 47c1f2da2..26c20dcd6 100644 --- a/workflow/engine/classes/class.applications.php +++ b/workflow/engine/classes/class.applications.php @@ -19,7 +19,7 @@ class Applications $type = isset($type) ? $type: 'extjs'; $dateFrom = isset($dateFrom)? $dateFrom : ''; $dateTo = isset($dateTo) ? $dateTo : ''; - + G::LoadClass("BasePeer" ); G::LoadClass ( 'configuration' ); require_once ( "classes/model/AppCacheView.php" ); @@ -31,7 +31,7 @@ class Applications //$userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? $_SESSION['USER_LOGGED'] : null; <-- passed by param $oAppCache = new AppCacheView(); - + //get data configuration $conf = new Configurations(); $confCasesList = $conf->getConfiguration('casesList',($action=='search'||$action=='simple_search')?'sent':$action ); @@ -98,10 +98,20 @@ class Applications break; } - // $Criteria->addJoin(AppCacheViewPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); - $Criteria->addJoin(AppCacheViewPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); - $Criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME ); - $Criteria->addSelectColumn(UsersPeer::USR_LASTNAME ); + $Criteria->addAlias('CU', 'USERS'); + $Criteria->addJoin(AppCacheViewPeer::USR_UID, 'CU.USR_UID', Criteria::LEFT_JOIN); + $Criteria->addAsColumn('USR_FIRSTNAME', 'CU.USR_FIRSTNAME'); + $Criteria->addAsColumn('USR_LASTNAME', 'CU.USR_LASTNAME'); + $Criteria->addAsColumn('USR_USERNAME', 'CU.USR_USERNAME'); + + // Fix for previous user + if ($action == 'todo' || $action == 'selfservice' || $action =='unassigned' || $action == 'paused' || $action == 'to_revise') { + $Criteria->addAlias('PU', 'USERS'); + $Criteria->addJoin(AppCacheViewPeer::PREVIOUS_USR_UID, 'PU.USR_UID', Criteria::LEFT_JOIN); + $Criteria->addAsColumn('PREVIOUS_USR_FIRSTNAME', 'PU.USR_FIRSTNAME'); + $Criteria->addAsColumn('PREVIOUS_USR_LASTNAME', 'PU.USR_LASTNAME'); + $Criteria->addAsColumn('PREVIOUS_USR_USERNAME', 'PU.USR_USERNAME'); + } if ( !is_array($confCasesList) ) { $rows = $this->getDefaultFields( $action ); @@ -155,14 +165,14 @@ class Applications $CriteriaCount->add (AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ); } - //add the filter + //add the filter if ( $filter != '' ) { switch ( $filter ) { case 'read' : $Criteria->add (AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL); $CriteriaCount->add (AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL); break; - case 'unread' : + case 'unread' : $Criteria->add (AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNULL); $CriteriaCount->add (AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNULL); break; @@ -175,7 +185,7 @@ class Applications $CriteriaCount->add (AppCacheViewPeer::APP_STATUS, 'COMPLETED', Criteria::EQUAL); break; } - } + } //add the search filter if ( $search != '' ) { @@ -245,7 +255,7 @@ class Applications //here we count how many records exists for this criteria. //BUT there are some special cases, and if we dont optimize them the server will crash. $doCountAlreadyExecuted = false; - //case 1. when the SEARCH action is selected and none filter, search criteria is defined, + //case 1. when the SEARCH action is selected and none filter, search criteria is defined, //we need to count using the table APPLICATION, because APP_CACHE_VIEW takes 3 seconds if ( $action == 'search' && $filter == '' && $search == '' && $process == '' && $status == '' && $dateFrom == '' && $dateTo == '') { @@ -282,7 +292,7 @@ class Applications } - //add sortable options + //add sortable options if ( $sort != '' ) { if ( $dir == 'DESC' ) $Criteria->addDescendingOrderByColumn( $sort ); @@ -290,7 +300,7 @@ class Applications $Criteria->addAscendingOrderByColumn( $sort ); } - //limit the results according the interface + //limit the results according the interface $Criteria->setLimit( $limit ); $Criteria->setOffset( $start ); @@ -327,7 +337,7 @@ class Applications $index = $start; while($aRow = $oDataset->getRow()){ //$aRow = $oAppCache->replaceRowUserData($aRow); - + /* For participated cases, we want the last step in the case, not only * the last step this user participated. To do that we get every case * information again for the last step. (This could be solved by a subquery, @@ -349,14 +359,14 @@ class Applications if (array_key_exists($col, $newData)) $aRow[$col] = $newData[$col]; } - + $maxDataset->close(); } - + if (!isset($aRow['APP_CURRENT_USER'])) $aRow['APP_CURRENT_USER'] = "[Unassigned]"; - - // replacing the status data with their respective translation + + // replacing the status data with their respective translation if( isset($aRow['APP_STATUS']) ){ $aRow['APP_STATUS'] = G::LoadTranslation("ID_{$aRow['APP_STATUS']}"); } @@ -365,17 +375,17 @@ class Applications if( isset($aRow['DEL_PRIORITY']) ){ $aRow['DEL_PRIORITY'] = G::LoadTranslation("ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}"); } - + $rows[] = $aRow; $oDataset->next(); } $result['data'] = $rows; - + return $result; } - + //TODO: Encapsulates these and another default generation functions inside a class /** * generate all the default fields @@ -631,7 +641,7 @@ class Applications G::LoadClass('pmScript'); G::LoadClass('case'); - + $steps = Array(); $case = new Cases; $step = new Step; @@ -661,7 +671,7 @@ class Applications if (trim($caseStep->getStepCondition()) != '') { // if it has a condition $pmScript->setScript($caseStep->getStepCondition()); - + if (!$pmScript->evaluate()) { //evaluate //evaluated false, jump & continue with the others steps continue; @@ -689,18 +699,18 @@ class Applications $outputDoc = $appDocument->getObject($appUid, $index, $caseStep->getStepUidObj(), 'OUTPUT'); $stepItem['title'] = $oDocument->getOutDocTitle(); - + if ($outputDoc['APP_DOC_UID']) { - $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=VIEW&DOC={$outputDoc['APP_DOC_UID']}"; + $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=VIEW&DOC={$outputDoc['APP_DOC_UID']}"; } else { - $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=GENERATE"; + $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=GENERATE"; } break; case 'INPUT_DOCUMENT': $oDocument = InputDocumentPeer::retrieveByPK($stepUid); - + $stepItem['title'] = $oDocument->getInpDocTitle(); $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=ATTACH"; break; @@ -708,11 +718,11 @@ class Applications case 'EXTERNAL': $stepTitle = 'unknown ' . $caseStep->getStepUidObj(); $oPluginRegistry = PMPluginRegistry::getSingleton(); - + $externalStep = $externalSteps[$caseStep->getStepUidObj()]; $stepItem['id'] = $externalStep->sStepId; $stepItem['title'] = $externalStep->sStepTitle; - $stepItem['url'] = "cases/cases_Step?UID={$externalStep->sStepId}&TYPE=EXTERNAL&POSITION=$stepPosition&ACTION=EDIT"; + $stepItem['url'] = "cases/cases_Step?UID={$externalStep->sStepId}&TYPE=EXTERNAL&POSITION=$stepPosition&ACTION=EDIT"; break; } @@ -725,8 +735,8 @@ class Applications $stepItem['type'] = ''; $stepItem['title'] = G::LoadTranslation('ID_ASSIGN_TASK'); $stepItem['url'] = "cases/cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN"; - - $steps[] = $stepItem; + + $steps[] = $stepItem; return $steps; } diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index a5d3cbd1c..1ee82ce05 100755 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -125,7 +125,7 @@ class Derivation $aDerivation['NEXT_TASK']['TAS_DEF_PROC_CODE'] = ''; $aDerivation['NEXT_TASK']['TAS_PARENT'] = ''; $aDerivation['NEXT_TASK']['TAS_TRANSFER_FLY'] = ''; - + switch ($aDerivation['ROU_NEXT_TASK']) { case -1: $aDerivation['NEXT_TASK']['TAS_TITLE'] = G::LoadTranslation('ID_END_OF_PROCESS'); break; @@ -274,12 +274,10 @@ class Derivation $oUser = UsersPeer::retrieveByPK( $row['USR_UID'] ); if( $oUser->getUsrStatus() == 'ACTIVE' ){ $users[$row['USR_UID']] = $row['USR_UID']; - } else if($oUser->getUsrStatus() == 'VACATION'){ - //this a litle hook for this issue,... - //TODO if the user in getUsrReplacedBy() is not assignet to the same task,. will have problems,.... - $UsrReplace = $oUser->getUsrReplacedBy(); - if( trim($UsrReplace) != ''){ - //$users[$UsrReplace] = $UsrReplace; + } else { + $userUID = $this->checkReplacedByUser($oUser); + if ($userUID != '') { + $users[$userUID] = $userUID; } } } @@ -321,7 +319,7 @@ class Derivation else { $oCriteria = new Criteria(); $oCriteria->add(UsersPeer::USR_UID, $aUsers); - + if (UsersPeer::doCount($oCriteria) < 1) { return null; } @@ -394,7 +392,7 @@ class Derivation $variable = str_replace ( '@@', '', $nextAssignedTask['TAS_ASSIGN_VARIABLE'] ); if ( isset ( $AppFields['APP_DATA'][$variable] ) ) { if ($AppFields['APP_DATA'][$variable] != '') { - $value = $AppFields['APP_DATA'][$variable]; + $value = $this->checkReplacedByUser($AppFields['APP_DATA'][$variable]); $userFields = $this->getUsersFullNameFromArray ($value); if (is_null($userFields)) { throw ( new Exception("Task doesn't have a valid user in variable $variable.") ) ; @@ -419,12 +417,12 @@ class Derivation $userFields['USR_EMAIL'] = ''; //get the report_to user & its full info - $useruid = $this->getDenpendentUser($tasInfo['USER_UID']); - + $useruid = $this->getDenpendentUser($this->checkReplacedByUser($tasInfo['USER_UID'])); + if (isset($useruid) && $useruid != '') { $userFields = $this->getUsersFullNameFromArray($useruid); } - + // if there is no report_to user info, throw an exception indicating this if (!isset($userFields) || $userFields['USR_UID'] == '') { throw ( new Exception(G::LoadTranslation('ID_MSJ_REPORSTO')));// "The current user does not have a valid Reports To user. Please contact administrator.") ) ; @@ -555,7 +553,7 @@ class Derivation $iAppThreadIndex = $appFields['DEL_THREAD']; $this->case->closeAppThread ( $currentDelegation['APP_UID'], $iAppThreadIndex); break; - + default: // get all siblingThreads //if($currentDelegation['TAS_ASSIGN_TYPE'] == 'STATIC_MI') @@ -574,22 +572,22 @@ class Derivation $sMIcompleteVar = $aData['APP_DATA'][str_replace('@@', '', $currentDelegation['TAS_MI_COMPLETE_VARIABLE'])]; else $sMIcompleteVar = $aData['APP_DATA']['TAS_MI_COMPLETE_VARIABLE']; - + $discriminateThread = $sMIinstanceVar - $sMIcompleteVar; - + // -1 because One App Delegation is closed by above Code if($discriminateThread == count($siblingThreads)) $canDerivate =true; else $canDerivate =false; break; - + default: if ( $currentDelegation['ROU_TYPE'] == 'SEC-JOIN') { $siblingThreads = $this->case->getOpenSiblingThreads( - $nextDel['TAS_UID'], - $currentDelegation['APP_UID'], - $currentDelegation['DEL_INDEX'], + $nextDel['TAS_UID'], + $currentDelegation['APP_UID'], + $currentDelegation['DEL_INDEX'], $currentDelegation['TAS_UID'], $currentDelegation['ROU_TYPE'] ); @@ -641,26 +639,26 @@ class Derivation $appFields['APP_STATUS'] = $currentDelegation['APP_STATUS']; /* Start Block : Count the open threads of $currentDelegation['APP_UID'] */ $openThreads = $this->case->GetOpenThreads( $currentDelegation['APP_UID'] ); - + /////// $sw = 0; - + if ($openThreads == 0) { //Close case $appFields["APP_STATUS"] = "COMPLETED"; $appFields["APP_FINISH_DATE"] = "now"; $this->verifyIsCaseChild($currentDelegation["APP_UID"]); - + $sw = 1; } - + if (isset($iNewDelIndex)) { $appFields["DEL_INDEX"] = $iNewDelIndex; $appFields["TAS_UID"] = $nextDel["TAS_UID"]; - + $sw = 1; } - + if ($sw == 1) { //Start Block : UPDATES APPLICATION $this->case->updateCase($currentDelegation["APP_UID"], $appFields); @@ -673,7 +671,7 @@ class Derivation { $iAppThreadIndex = $appFields['DEL_THREAD']; $delType = 'NORMAL'; - + if (is_numeric($nextDel['DEL_PRIORITY'])) { $nextDel['DEL_PRIORITY'] = (isset($nextDel['DEL_PRIORITY']) ? ($nextDel['DEL_PRIORITY'] >= 1 && $nextDel['DEL_PRIORITY'] <= 5 ? $nextDel['DEL_PRIORITY'] : '3') : '3'); } @@ -686,12 +684,12 @@ class Derivation // Create new delegation depending on the no of users in the group $iNewAppThreadIndex = $appFields['DEL_THREAD']; $this->case->closeAppThread ( $currentDelegation['APP_UID'], $iAppThreadIndex); - + foreach($nextDel['NEXT_TASK']['USER_ASSIGNED'] as $key=>$aValue){ //Incrementing the Del_thread First so that new delegation has new del_thread $iNewAppThreadIndex += 1; //Creating new delegation according to users in group - $iMIDelIndex = $this->case->newAppDelegation( + $iMIDelIndex = $this->case->newAppDelegation( $appFields['PRO_UID'], $currentDelegation['APP_UID'], $nextDel['TAS_UID'], @@ -732,7 +730,7 @@ class Derivation } $iAppThreadIndex = $appFields['DEL_THREAD']; - + switch ( $currentDelegation['ROU_TYPE'] ) { case 'PARALLEL' : case 'PARALLEL-BY-EVALUATION' : @@ -741,12 +739,12 @@ class Derivation $this->case->updateAppDelegation ( $currentDelegation['APP_UID'], $iNewDelIndex, $iNewThreadIndex ); //print " this->case->updateAppDelegation ( " . $currentDelegation['APP_UID'] .", " . $iNewDelIndex ." , " . $iNewThreadIndex . " )
"; break; - + case 'DISCRIMINATOR': if($currentDelegation['ROU_OPTIONAL'] == 'TRUE') { $this->case->discriminateCases($currentDelegation); } //No Break, executing Default Condition - + default : switch ($currentDelegation['TAS_ASSIGN_TYPE']) { case 'CANCEL_MI': @@ -776,7 +774,7 @@ class Derivation $aOldFields['APP_DATA'] = array_merge($aOldFields['APP_DATA'], $aNewFields); $aOldFields['APP_STATUS'] = 'TO_DO'; - + $this->case->updateCase($aNewCase['APPLICATION'], $aOldFields); //Create a registry in SUB_APPLICATION table $aSubApplication = array('APP_UID' => $aNewCase['APPLICATION'], @@ -796,11 +794,11 @@ class Derivation $oSubApplication->create($aSubApplication); //Update the AppDelegation to execute the update trigger $AppDelegation = AppDelegationPeer::retrieveByPK($aNewCase['APPLICATION'], $aNewCase['INDEX']); - - // note added by krlos pacha carlos[at]colosa[dot]com - // the following line of code was commented because it is related to the 6878 bug + + // note added by krlos pacha carlos[at]colosa[dot]com + // the following line of code was commented because it is related to the 6878 bug //$AppDelegation->setDelInitDate("+1 second"); - + $AppDelegation->save(); //If not is SYNCHRONOUS derivate one more time @@ -1031,8 +1029,28 @@ class Derivation $aData[$aKey] = $userid; } return $aGrp; - //var_dump($aDerivation); - //die; } -} + function checkReplacedByUser($user) + { + if (get_class($user) != 'Users') { + $userInstance = UsersPeer::retrieveByPK($user); + } else { + $userInstance = $user; + } + if (!is_object($userInstance)) { + throw new Exception("The user with the UID '$user' doesn't exist."); + } + if ($userInstance->getUsrStatus() == 'ACTIVE') { + return $userInstance->getUsrUid(); + } else { + $userReplace = trim($userInstance->getUsrReplacedBy()); + if ($userReplace != '') { + return $this->checkReplacedByUser(UsersPeer::retrieveByPK($userReplace)); + } else { + return ''; + } + } + } + +} \ No newline at end of file diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index 0de0f65cc..30bc1b172 100755 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -2,7 +2,7 @@ /** * Dynaform.php * @package workflow.engine.classes.model - * + * * ProcessMaker Open Source Edition * Copyright (C) 2004 - 2011 Colosa Inc. * @@ -81,7 +81,7 @@ class Dynaform extends BaseDynaform { if ($this->dyn_title !== $v || $v === '') { $this->dyn_title = $v; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - + $res = Content::addContent( 'DYN_TITLE', '', $this->getDynUid(), $lang, $this->dyn_title ); } @@ -127,7 +127,7 @@ class Dynaform extends BaseDynaform { if ($this->dyn_description !== $v || $v === '') { $this->dyn_description = $v; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - + $res = Content::addContent( 'DYN_DESCRIPTION', '', $this->getDynUid(), $lang, $this->dyn_description ); } @@ -175,7 +175,7 @@ class Dynaform extends BaseDynaform { $con->commit(); $sXml = ''."\n"; - $sXml .= ''."\n"; + $sXml .= ''."\n"; $sXml .= ''; G::verifyPath(PATH_DYNAFORM . $this->getProUid(), true); $oFile = fopen(PATH_DYNAFORM . $this->getProUid() . '/' . $this->getDynUid() . '.xml', 'w'); @@ -200,7 +200,7 @@ class Dynaform extends BaseDynaform { /** * * Creates a Dynaform based on a PMTable - * + * * @name createFromPMTable * @author gustavo cruz gustavo[at]colosa[dot]com * @param array $aData Fields with : @@ -252,7 +252,7 @@ class Dynaform extends BaseDynaform { } else { $sql = 'DESC '.$addTabName; } - + $dbh = Propel::getConnection(AdditionalTablesPeer::DATABASE_NAME); $sth = $dbh->createStatement(); $res = $sth->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); @@ -277,7 +277,7 @@ class Dynaform extends BaseDynaform { if ($res->get('Key') != '') { $countKeys++; } - if ($res->get('Extra') == 'auto_increment') { + if ($res->get('Extra') == 'auto_increment') { $keyRequered .= $res->get('Field'); } } @@ -474,7 +474,7 @@ class Dynaform extends BaseDynaform { throw($oError); } } - + function getDynaformContent( $dynaformUid) { $content = ''; $fields = $this->Load ( $dynaformUid); @@ -482,9 +482,9 @@ class Dynaform extends BaseDynaform { if (file_exists( $filename )) { $content = file_get_contents ( $filename ); } - + return $content; - } + } function getDynaformFields( $dynaformUid) { $content = ''; @@ -493,10 +493,10 @@ class Dynaform extends BaseDynaform { if (file_exists( $filename )) { $content = file_get_contents ( $filename ); } - + $G_FORM = new xmlform ( $fields['DYN_FILENAME'] , PATH_DYNAFORM ); $G_FORM->parseFile( $filename , SYS_LANG, true ); - + return $G_FORM->fields; } diff --git a/workflow/engine/js/dbConnections/main.js b/workflow/engine/js/dbConnections/main.js index dce01b2ec..9c3c193c4 100755 --- a/workflow/engine/js/dbConnections/main.js +++ b/workflow/engine/js/dbConnections/main.js @@ -1,14 +1,13 @@ /* - * Data base connection javascript routines - * @Author Erik Amatu Ortiz + * Data base connection javascript routines + * @Author Erik Amatu Ortiz * @Update date May 20th, 2009 */ var PROCESS_REQUEST_FILE = '../dbConnections/dbConnectionsAjax'; -String.prototype.trim = function() -{ - return this.replace(/^\s+|\s+get/g,""); +String.prototype.trim = function () { + return this.replace(/^\s+|\s+$/g, ""); } var oPanel; @@ -86,7 +85,7 @@ function saveEditDBConnection() if( getField('DBS_PORT').value.trim() == '' || getField('DBS_PORT').value.trim() == '0' ) { onChangeType(); } - + var dbs_uid = currentEditDBS_UID; var type = $('form[DBS_TYPE]').value; var server = $('form[DBS_SERVER]').value; @@ -375,16 +374,16 @@ function validateFields() if( getField('DBS_PORT').value.trim() == '' || getField('DBS_PORT').value.trim() == '0' ) { onChangeType(); } - + var res = true; var o = new input(getField('DBS_SERVER')); if($('form[DBS_SERVER]').value == '') { //new leimnud.module.app.alert().make({label: G_STRINGS.DBCONNECTIONS_MSG4}); o.failed(); res = false; - } else + } else o.passed(); - + var o = new input(getField('DBS_DATABASE_NAME')); if($('form[DBS_DATABASE_NAME]').value == '') { //new leimnud.module.app.alert().make({label: G_STRINGS.DBCONNECTIONS_MSG5}); @@ -392,7 +391,7 @@ function validateFields() res = false; } else o.passed(); - + var o = new input(getField('DBS_USERNAME')); if($('form[DBS_USERNAME]').value == '') { //new leimnud.module.app.alert().make({label: G_STRINGS.DBCONNECTIONS_MSG6}); @@ -400,22 +399,22 @@ function validateFields() res = false; } else o.passed(); - + /*var o = new input(getField('DBS_PORT')); if($('form[DBS_PORT]').value == '') { o.failed(); res = false; } else o.passed();*/ - + var o = new input(getField('DBS_TYPE')); if($('form[DBS_TYPE]').value == '0') { o.failed(); res = false; } else o.passed(); - - oType = getField('DBS_TYPE'); + + oType = getField('DBS_TYPE'); if( oType.value != 'mssql' && oType.value != 'oracle' ){ var o = new input(getField('DBS_ENCODE')); if($('form[DBS_ENCODE]').value == '0') { @@ -425,7 +424,7 @@ function validateFields() o.passed(); } - + if(!res){ new leimnud.module.app.alert().make({label: G_STRINGS.DBCONNECTIONS_ALERT}); } @@ -434,7 +433,7 @@ function validateFields() var onChangeType = function() { var oAux = getField('DBS_PORT'); - + switch(getField('DBS_TYPE').value) { case 'mysql': oAux.value = '3306'; @@ -451,11 +450,11 @@ var onChangeType = function() { default: oAux.value = ''; } - + }; function showEncodes(pre){ - oType = getField('DBS_TYPE'); + oType = getField('DBS_TYPE'); //if( oType.value != 'mssql' && oType.value != 'oracle' ){ if( oType.value != 'oracle' ){ showRowById('DBS_ENCODE'); @@ -465,29 +464,29 @@ function showEncodes(pre){ res = false; } else o.passed(); - + var o = getField('DBS_TYPE'); - + var oRPC = new leimnud.module.rpc.xmlhttp({ url : PROCESS_REQUEST_FILE, args: 'action=showEncodes&engine='+o.value }); - + oRPC.callback = function(rpc){ var oEnc = getField('DBS_ENCODE'); response = eval('{'+oRPC.xmlhttp.responseText+'}'); - + oEnc.options.length = 0; //set news for(i=0; i '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sorteable'=>false); + $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sorteable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_DUE_DATE'), 'dataIndex' => 'DEL_TASK_DUE_DATE', 'width' => 110); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'),'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PRIORITY'), 'dataIndex' => 'DEL_PRIORITY', 'width' => 50 ); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); + $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_DUE_DATE'), 'dataIndex' => 'DEL_TASK_DUE_DATE', 'width' => 110); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PRIORITY'), 'dataIndex' => 'DEL_PRIORITY', 'width' => 50 ); $caseReaderFields = array(); $caseReaderFields[] = array( 'name' => 'APP_UID' ); $caseReaderFields[] = array( 'name' => 'USR_UID' ); $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); @@ -491,7 +493,6 @@ $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID','width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); @@ -506,6 +507,9 @@ $caseReaderFields[] = array( 'name' => 'APP_UID' ); $caseReaderFields[] = array( 'name' => 'USR_UID' ); $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); @@ -532,12 +536,9 @@ $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 80 ); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_THREAD_INDEX'),'dataIndex' => 'APP_THREAD_INDEX', 'width' => 80 ); @@ -547,6 +548,9 @@ $caseReaderFields[] = array( 'name' => 'APP_UID' ); $caseReaderFields[] = array( 'name' => 'USR_UID' ); $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); @@ -578,7 +582,7 @@ $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'ID_SENT_BY','width' => 90 ); + $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 ); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CURRENT_USER'),'dataIndex' => 'APP_CURRENT_USER','width' => 90 ); // $caseColumns[] = array( 'header' =>'Sent By', 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); ///-- $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); @@ -589,6 +593,9 @@ $caseReaderFields[] = array( 'name' => 'APP_UID' ); $caseReaderFields[] = array( 'name' => 'USR_UID' ); $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); + $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); @@ -601,7 +608,7 @@ $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); - $caseReaderFields[] = array( 'name' => 'ID_SENT_BY' ); + $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); @@ -612,8 +619,6 @@ $caseColumns = array (); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sorteable'=>false); - $caseColumns[] = array( 'header' => 'TaskUid', 'dataIndex' => 'TAS_UID' , 'width' => 150 ,'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'DelIndex', 'dataIndex' => 'DEL_INDEX' , 'width' => 150 ,'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID','width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); diff --git a/workflow/engine/methods/users/usersAjax.php b/workflow/engine/methods/users/usersAjax.php index 5c6b0f71b..acc454a48 100644 --- a/workflow/engine/methods/users/usersAjax.php +++ b/workflow/engine/methods/users/usersAjax.php @@ -56,6 +56,9 @@ switch($_POST['action']) $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); $oCriteria->add(UsersPeer::USR_STATUS,'ACTIVE'); + if (isset($_POST['USR_UID'])) { + $oCriteria->add(UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL); + } $oDataset = UsersPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); diff --git a/workflow/engine/skinEngine/base/css/style.css b/workflow/engine/skinEngine/base/css/style.css index 4bd07655f..cea1dc097 100755 --- a/workflow/engine/skinEngine/base/css/style.css +++ b/workflow/engine/skinEngine/base/css/style.css @@ -11,7 +11,7 @@ a, img { margin: 0; } -img { +img { border: 0 none; } @@ -830,6 +830,7 @@ form.formSearch .Record { color:#2078A8; text-decoration:none; + white-space:nowrap; } .pagedTableDefault, .pagedTableDefault .headerContent .tableOption a:hover { @@ -882,6 +883,7 @@ font-weight:bold; text-decoration: none; padding-left: 5px; font: bold 11px Tahoma,sans-serif, MiscFixed; + white-space:nowrap; } .pagedTableDefault .pagedTable a:hover { @@ -960,6 +962,7 @@ font-weight:bold; } .pagedTableDefault .pagedTable .RowLink a{ display:block; + white-space:nowrap; } A.firstPage { @@ -1555,14 +1558,14 @@ div.autosuggest div.as_footer position: relative; height: 0px; padding: 0 6px; - + background-position: top right; background-repeat: no-repeat; overflow: hidden; } div.autosuggest div.as_footer { - + } div.autosuggest div.as_header div.as_corner, @@ -1573,13 +1576,13 @@ div.autosuggest div.as_footer div.as_corner left: 0; height: 6px; width: 6px; - + background-position: top left; background-repeat: no-repeat; } div.autosuggest div.as_footer div.as_corner { - + } div.autosuggest div.as_header div.as_bar, div.autosuggest div.as_footer div.as_bar @@ -1651,14 +1654,14 @@ div.autosuggest ul li.as_highlight a { color: #000; background-color: #D1DEDF; /* erik -- hover*/ - + background-position: bottom right; background-repeat: no-repeat; } div.autosuggest ul li.as_highlight a span { - + background-position: bottom left; background-repeat: no-repeat; } @@ -1689,7 +1692,7 @@ div.autosuggest ul li.as_highlight a .tl div.autosuggest ul li.as_highlight a .tr { right: 0; - + background-position: bottom right; } @@ -3122,7 +3125,7 @@ ul#pm_submenu a{ } ul#pm_submenu a img{ float:left; - max-height: 18px; + max-height: 18px; } ul#pm_submenu li.SelectedSubMenu,ul#pm_submenu li:hover{ background-color: #CCC; @@ -3170,7 +3173,7 @@ button.x-btn-text:focus,.x-combo-selected{ -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; - + background: -moz-linear-gradient(white, #E1E1E1) repeat scroll 0 0 transparent; background: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#E1E1E1)); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#E1E1E1'); /* IE6,IE7 */ @@ -3213,7 +3216,7 @@ button.x-btn-text:focus,.x-combo-selected{ -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; - + background: -moz-linear-gradient(white, #E1E1E1) repeat scroll 0 0 transparent; background: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#E1E1E1)); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#E1E1E1'); /* IE6,IE7 */ @@ -3261,7 +3264,7 @@ button.x-btn-text:focus,.x-combo-selected{ background: -webkit-gradient(linear, 0 0, 0 100%, from(#829AA8), to(#405A6A)); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#829AA8', endColorstr='#405A6A'); /* IE6,IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#829AA8', endColorstr='#405A6A')"; /* IE8 */ - + border-color: #677C89 #677C89 #6B808D; border-radius: 3px 3px 0 0; border-style: solid; diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index cdf13cb3a..89065ee9d 100644 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -123,7 +123,7 @@ function jumpToCase(appNumber){ } }, params: {action:'previusJump', appNumber: appNumber} - }); + }); } function deleteCase() { @@ -226,7 +226,7 @@ function pauseCase(date){ var noteReasonTxt = ''; } var notifyReasonVal = Ext.getCmp('notifyReason').getValue() == true ? 1 : 0; - + Ext.MessageBox.show({ msg: _('ID_PROCESSING'), wait:true,waitConfig: {interval:200} }); Ext.Ajax.request({ url: 'cases_Ajax', @@ -260,7 +260,7 @@ function pauseCase(date){ ] }); msgPause.show(this); - + } else { Ext.Msg.show({ title:'', @@ -459,9 +459,14 @@ Ext.onReady ( function() { } function dueDate(value, p, r){ - var myDate = convertDate( value ); - var myColor = (myDate < new Date()) ? " color:red;" : 'color:green;'; - return String.format("{0}", myDate.dateFormat(FORMATS.casesListDateFormat), myColor ); + if (value) { + var myDate = convertDate( value ); + var myColor = (myDate < new Date()) ? " color:red;" : 'color:green;'; + return String.format("{0}", myDate.dateFormat(FORMATS.casesListDateFormat), myColor ); + } + else { + return ''; + } } var renderSummary = function (val, p, r) { @@ -477,8 +482,22 @@ Ext.onReady ( function() { } //Render Full Name - full_name = function(v,x,s){ - return _FNF(v, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME); + full_name = function(v, x, s) { + if (s.data.USR_UID) { + return _FNF(s.data.USR_USERNAME, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME); + } + else { + return ''; + } + }; + + previous_full_name = function(v, x, s) { + if (s.data.PREVIOUS_USR_UID) { + return _FNF(s.data.PREVIOUS_USR_USERNAME, s.data.PREVIOUS_USR_FIRSTNAME, s.data.PREVIOUS_USR_LASTNAME); + } + else { + return ''; + } }; for(var i = 0, len = columns.length; i < len; i++){ @@ -491,7 +510,7 @@ Ext.onReady ( function() { if( c.id == 'unpauseLink') c.renderer = unpauseLink; if( c.dataIndex == 'CASE_SUMMARY') c.renderer = renderSummary; if( c.dataIndex == 'CASE_NOTES_COUNT') c.renderer = renderNote; - if( c.dataIndex == 'APP_DEL_PREVIOUS_USER') c.renderer = full_name; + if( c.dataIndex == 'APP_DEL_PREVIOUS_USER') c.renderer = previous_full_name; if( c.dataIndex == 'APP_CURRENT_USER') c.renderer = full_name; } @@ -502,6 +521,7 @@ Ext.onReady ( function() { readerFields.push ( {name: "USR_FIRSTNAME"}); readerFields.push ( {name: "USR_LASTNAME"}); + readerFields.push ( {name: "USR_USERNAME"}); for (i=0; i + " + response,"alert"); return false; - } }.extend(this); - isTrue = oRPC.make(); + isTrue = oRPC.make(); return isTrue; }; diff --git a/workflow/engine/xmlform/dynaforms/fields/suggest.xml b/workflow/engine/xmlform/dynaforms/fields/suggest.xml index 47b895bfa..67b61ae28 100755 --- a/workflow/engine/xmlform/dynaforms/fields/suggest.xml +++ b/workflow/engine/xmlform/dynaforms/fields/suggest.xml @@ -53,7 +53,7 @@ SELECT XMLNODE_NAME, TYPE FROM dynaForm WHERE XMLNODE_NAME = @@PME_XMLNODE_NAME select XMLNODE_NAME, XMLNODE_NAME AS NAME FROM dynaForm WHERE XMLNODE_NAME <> @@PME_XMLNODE_NAME AND XMLNODE_NAME <> "" AND ( TYPE="text" or TYPE="textarea" or TYPE="dropdown" or TYPE="listbox" or TYPE="hidden" or TYPE="suggest") ]]>Dependent Fields - + Hint @@ -140,39 +140,44 @@ select XMLNODE_NAME, XMLNODE_NAME AS NAME FROM dynaForm WHERE XMLNODE_NAME <> @@ Save - + @@ getField('PME_PRIMARY_KEY_TYPE_DATA').value = this.value.trim(); }); - function getTablesNames(){ - var s0 = getField('PME_XMLNODE_VALUE').value; - var s = getField('PME_XMLNODE_VALUE').value.toUpperCase(); + function getTablesNames() { + var strSql = getField("PME_XMLNODE_VALUE").value; + + strSql = stringReplace("\\x0A", " ", strSql); //\n 10 + strSql = stringReplace("\\x0D", " ", strSql); //\r 13 + strSql = stringReplace("\\x09", " ", strSql); //\t 9 + + var s0 = strSql; + var s = strSql.toUpperCase(); p1 = s.indexOf(" FROM "); if(p1 > 0){ @@ -218,7 +229,7 @@ select XMLNODE_NAME, XMLNODE_NAME AS NAME FROM dynaForm WHERE XMLNODE_NAME <> @@ ss = s0.substring(p1, p2); ss = ss.replace("FROM", "").trim(); ss = ss.replace("from", "").trim(); - + aTables = ss.split(','); otable = getField('PME_TABLE'); @@ -230,16 +241,26 @@ select XMLNODE_NAME, XMLNODE_NAME AS NAME FROM dynaForm WHERE XMLNODE_NAME <> @@ var newOption = new Option("", "0"); otable.options[0] = newOption; - for(i=0; i= 0){ @@ -258,9 +279,13 @@ select XMLNODE_NAME, XMLNODE_NAME AS NAME FROM dynaForm WHERE XMLNODE_NAME <> @@ var newOption = new Option("", "0"); otable.options[0] = newOption; - for(i=0; i - + diff --git a/workflow/engine/xmlform/roles/roles_Options.xml b/workflow/engine/xmlform/roles/roles_Options.xml index 2271a8739..eeb7dbc30 100755 --- a/workflow/engine/xmlform/roles/roles_Options.xml +++ b/workflow/engine/xmlform/roles/roles_Options.xml @@ -33,27 +33,27 @@ function saveNewRole() new leimnud.module.app.alert().make({label: G_STRINGS.ID_ROLES_MSG3}); return false; } - + var uri = 'request=verifyNewRole&code='+code; var ajax = AJAX(); ajax.open("POST", PROCESS_REQUEST_FILE, true); - ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"); - ajax.onreadystatechange = function() { + ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"); + ajax.onreadystatechange = function() { if(ajax.readyState == 4) { - + if(eval(ajax.responseText.trim())){ try{ parent = $('form[ROL_PARENT]').value; }catch(e){} code = $('form[ROL_CODE]').value; status = $('form[ROL_STATUS]').value; - var uri = 'request=saveNewRole&code='+code+'&parent='+parent+'&status='+status+'&name='+name; - + var uri = 'request=saveNewRole&code='+code+'&parent='+parent+'&status='+status+'&name='+name; + var oRPC = new leimnud.module.rpc.xmlhttp({ url : PROCESS_REQUEST_FILE, args: uri }); - + oRPC.callback = function(rpc){ var oRPC = new leimnud.module.rpc.xmlhttp({ url : PROCESS_REQUEST_FILE, @@ -62,38 +62,38 @@ function saveNewRole() args : 'request=show&r='+Math.random() }); oRPC.make(); - $('publisherContent[0]').innerHTML = oRPC.xmlhttp.responseText; + $('publisherContent[0]').innerHTML = oRPC.xmlhttp.responseText; window.location = 'roles_List'; }.extend(this); oRPC.make(); currentPopupWindow.remove(); } - + if(!eval(ajax.responseText.trim())){ new leimnud.module.app.alert().make({label: G_STRINGS.ID_ROLES_MSG2}); return false; } - } + } } ajax.send(uri); } function editRole(ROL_UID) -{ +{ if(ROL_UID!='00000000000000000000000000000002') - { - var uri = 'request=editRole&ROL_UID='+ROL_UID; + { + var uri = 'request=editRole&ROL_UID='+ROL_UID; popupWindow('', '../roles/roles_Ajax?'+uri, 350, 265); } else - { - new leimnud.module.app.alert().make({label: G_STRINGS.ID_ROLES_MSG}); - } + { + new leimnud.module.app.alert().make({label: G_STRINGS.ID_ROLES_MSG}); + } } function updateRole(ROL_UID) { - + code = $('form[ROL_CODE]').value; name = $('form[ROL_NAME]').value; if(code == '') { @@ -111,16 +111,16 @@ function updateRole(ROL_UID) { try{ parent = $('form[ROL_PARENT]').value; }catch(e){} - + status = $('form[ROL_STATUS]').value; - - var uri = 'request=updateRole&code='+code+'&parent='+parent+'&status='+status+'&rol_uid='+ROL_UID+'&name='+name; - + + var uri = 'request=updateRole&code='+code+'&parent='+parent+'&status='+status+'&rol_uid='+ROL_UID+'&name='+name; + var oRPC = new leimnud.module.rpc.xmlhttp({ url : PROCESS_REQUEST_FILE, args: uri }); - + oRPC.callback = function(rpc){ var oRPC = new leimnud.module.rpc.xmlhttp({ url : PROCESS_REQUEST_FILE, @@ -140,21 +140,21 @@ function deleteRole(ROL_UID) { var uri = 'request=canDeleteRole&ROL_UID='+ROL_UID; var ajax = AJAX(); ajax.open("POST", PROCESS_REQUEST_FILE, true); - ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"); - ajax.onreadystatechange = function() { + ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"); + ajax.onreadystatechange = function() { if(ajax.readyState == 4) { - - if(eval(ajax.responseText.trim())){ + + if(eval(ajax.responseText.trim())){ new leimnud.module.app.confirm().make({ label:G_STRINGS.ID_REMOVE_ROLE, action:function() { - var uri = 'request=deleteRole&ROL_UID='+ROL_UID; - + var uri = 'request=deleteRole&ROL_UID='+ROL_UID; + var oRPC = new leimnud.module.rpc.xmlhttp({ url : PROCESS_REQUEST_FILE, args: uri }); - + oRPC.callback = function(rpc){ var oRPC = new leimnud.module.rpc.xmlhttp({ url : PROCESS_REQUEST_FILE, @@ -167,16 +167,16 @@ function deleteRole(ROL_UID) { window.location = 'roles_List'; }.extend(this); oRPC.make(); - + }.extend(this) }); - } + } else { new leimnud.module.app.alert().make({label: G_STRINGS.ID_ROLES_CAN_NOT_DELETE}); return false; } - } + } } ajax.send(uri); }; @@ -189,7 +189,7 @@ function usersIntoRole(ROL_UID) } function deleteUserRole(ROL_UID, USR_UID){ - + new leimnud.module.app.confirm().make({ label:G_STRINGS.ID_MSG_CONFIRM, action:function(){ @@ -219,7 +219,7 @@ oPanel = new leimnud.module.panel(); fx :{modal:true,opacity:true,blinkToFront:false,fadeIn:false,drag:true} }; oPanel.events = { - remove: function() { + remove: function() { delete(oPanel); resetChecks(); }.extend(this) @@ -237,7 +237,7 @@ oPanel = new leimnud.module.panel(); }); oRPC.make(); currentPopupWindow.clearContent(); - currentPopupWindow.addContent(oRPC.xmlhttp.responseText); + currentPopupWindow.addContent(oRPC.xmlhttp.responseText); } var checks_selected_Rolid = new Array(); function showUsersLoad( ROL_UID ){ @@ -253,7 +253,7 @@ function showUsersLoad( ROL_UID ){ fx :{modal:true,opacity:true,blinkToFront:false,fadeIn:false,drag:true} }; oPanel.events = { - remove: function() { + remove: function() { delete(oPanel); resetChecks(); }.extend(this) @@ -267,7 +267,7 @@ function showUsersLoad( ROL_UID ){ }); //currentPopupWindow.clearContent(); - //currentPopupWindow.addContent(oRPC.xmlhttp.responseText); + //currentPopupWindow.addContent(oRPC.xmlhttp.responseText); checks_selected_Rolid.push(ROL_UID); oRPC.callback = function(rpc) { oPanel.loader.hide(); @@ -287,11 +287,11 @@ function showUsersLoad( ROL_UID ){ }; }catch(e){alert(e)} } - } + } }.extend(this); oRPC.make(); - + } function assignUserToRole(ROL_UID, USR_UID) { @@ -303,13 +303,13 @@ function assignUserToRole(ROL_UID, USR_UID) }); oRPC.make(); currentPopupWindow.clearContent(); - currentPopupWindow.addContent(oRPC.xmlhttp.responseText); + currentPopupWindow.addContent(oRPC.xmlhttp.responseText); } function viewPermitions(ROL_UID) { var uri = 'request=viewPermitions&ROL_UID='+ROL_UID; - popupWindow('', '../roles/roles_Ajax?'+uri, 500, 450); + popupWindow('', '../roles/roles_Ajax?'+uri, 500, 450); } function showPermissions(ROL_UID) @@ -327,7 +327,7 @@ function showPermissions(ROL_UID) function assignPermissionToRole(ROL_UID, PER_UID) { - + var oRPC = new leimnud.module.rpc.xmlhttp({ url : PROCESS_REQUEST_FILE, async : false, @@ -336,11 +336,11 @@ function assignPermissionToRole(ROL_UID, PER_UID) }); oRPC.make(); currentPopupWindow.clearContent(); - currentPopupWindow.addContent(oRPC.xmlhttp.responseText); + currentPopupWindow.addContent(oRPC.xmlhttp.responseText); } function deletePermissionRole(ROL_UID, PER_UID){ - + new leimnud.module.app.confirm().make({ label:G_STRINGS.ID_MSG_CONFIRM, action:function(){ @@ -382,14 +382,14 @@ function backUsers(ROL_UID) currentPopupWindow.clearContent(); currentPopupWindow.addContent(oRPC.xmlhttp.responseText); } - - - -function AJAX() + + + +function AJAX() { try { xmlhttp = new XMLHttpRequest(); - } + } catch(generic_error) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); @@ -403,10 +403,9 @@ function AJAX() } return xmlhttp; } - -String.prototype.trim = function() -{ - return this.replace(/^\s+|\s+get/g,""); + +String.prototype.trim = function () { + return this.replace(/^\s+|\s+$/g, ""); } function $(id){ @@ -433,7 +432,7 @@ function saveUsers(){ resetChecks(); oRPC.make(); currentPopupWindow.remove(); - + usersIntoRole(rolUid); } diff --git a/workflow/engine/xmlform/steps/conditions_Edit.xml b/workflow/engine/xmlform/steps/conditions_Edit.xml index c0f3325b6..3f81ca5bb 100755 --- a/workflow/engine/xmlform/steps/conditions_Edit.xml +++ b/workflow/engine/xmlform/steps/conditions_Edit.xml @@ -1,5 +1,5 @@ - + @@ -7,7 +7,7 @@ - + Condition @@ -71,4 +71,4 @@ var insertFormVar = function(sFieldName, sValue) { ]]> - \ No newline at end of file + \ No newline at end of file diff --git a/workflow/engine/xmlform/steps/conditions_Options.xml b/workflow/engine/xmlform/steps/conditions_Options.xml index 2575789a8..c48331361 100755 --- a/workflow/engine/xmlform/steps/conditions_Options.xml +++ b/workflow/engine/xmlform/steps/conditions_Options.xml @@ -9,15 +9,15 @@ function editCondition(uid, sStepTitle) { - popupWindow('@G::LoadTranslation(ID_EDIT_CONDITIONS_OF_STEP)' + ': ' + sStepTitle, '@G::encryptLink(@#URL_CONDITIONS_EDIT)?UID='+ uid , 500, 216); + popupWindow("@G::LoadTranslation(ID_EDIT_CONDITIONS_OF_STEP)" + ": " + sStepTitle, "@G::encryptLink(@#URL_CONDITIONS_EDIT)?UID=" + uid , 535, 240); } function saveCondition(oForm) { - ajax_post(oForm.action, oForm, 'POST'); - currentPopupWindow.remove(); - @#PAGED_TABLE_ID.refresh(); + ajax_post(oForm.action, oForm, "POST"); + currentPopupWindow.remove(); + @#PAGED_TABLE_ID.refresh(); } - \ No newline at end of file + \ No newline at end of file