/* ©COPYRIGHT SOBIS SOLUTIONS SRL 2004-2007 IMPORTANT! Acest produs software este proprietate SOBIS SOLUTIONS SRL inregistrat ca aplicatie utilitara la Oficiul Roman pentru Drepturile de Autor (ORDA) conform certificatului cu seria B2130558, nr. 2639/20.03.2007 cod program 109000007. Nici o parte din el nu poate fi copiata/reprodusa fara acordul scris detinatorului drepturilor de autor si fara citarea in clar a sursei. PRODUSUL SOFTWARE este protejat prin legi ale dreptului de autor si prin tratate internationale privind dreptul de autor, precum si prin alte legi si tratate referitoare la proprietatea intelectuala. PRODUSUL SOFTWARE nu este vandut, ci se afla sub licenta. In cazul acceptarii termenilor si conditiilor prevazute in Conventia de Licenta SOBIS va garanteaza o licenta ne-exclusiva de utilizare a programelor in termenii si conditiile de mai jos. Pentru detalii legate de drepturile oferite de licentierea produsului va rugam sa urmariti pagina http://www.eprim.ro/portal/portal_doc.nsf/AllById/1.1.4 *//*********************************************************************************** // // GLOBAL SCRIPT LIBRARY // // Do not make any changes to this file // Any request should be addressed to Eugen Cretu/RO/SOBIS // // // Released date: 29.09.2005 // Maintaind by: Eugen Cretu/RO/SOBIS // ***********************************************************************************/ function min(a,b){ // No comment return ((a)<(b))?(a):(b); } function swap(a,b){ // No comment var tmp=(a); a=(b); b=(tmp); } function removeString(strSrc, strWhat){ // remove strWhat from strSrc return strSrc.replace(new RegExp(strWhat,'g'),'') } function replaceString(strSrc, strWhat, strWith){ // replace in strSrc strWhat with strWith return strSrc.replace(new RegExp(strWhat,'g'), strWith) } function urlDecode(strSrc){ // perform urldecode on the string return unescape(strSrc); } function getCookieVal (offset) { // used in getCookie function var endstr = document.cookie.indexOf (";", offset); if (endstr == -1){ endstr = document.cookie.length; } return unescape(document.cookie.substring(offset, endstr)); } function getCookie (name) { //retrieve the specified Cookie var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function setCookie (name, value) { // set a volatile Cookie var argv = setCookie.arguments; var argc = setCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + trim(escape (value)) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function setCookiePermanent (name, value) { // set a permanent Cookie var argv = setCookiePermanent.arguments; var argc = setCookiePermanent.arguments.length; var path = '/;'; var expires = new Date("December 31, 2023"); var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + trim(escape (value)) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function deleteCookie (name) { // delete a Cookie by setting expiration time to now var exp = new Date(); exp.setTime (exp.getTime() - 400000); // This cookie is history var cval = getCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } function backToView(){ //Return to the view from which you started to open or create the document // Original written by Florin Cotarlea/RO/SOBIS var url = window.location.toString().toUpperCase(); posQM = url.indexOf('?'); posNSF = url.indexOf('.NSF/'); if (posNSF != -1) { nsfPath = window.location.toString().substring(0, posNSF+ 5) // 64 = the length of view ID + doc ID // if view ID is missing is new doc if (nsfPath.length + 64 > posQM){ goBack = 1; submittedTimes = 0; posSeq = url.indexOf('SEQ'); if (posSeq != -1) submittedTimes = parseInt(url.substring(posSeq + 4, posSeq + 6)); if (url.indexOf('EDITDOCUMENT') != -1 || url.indexOf('OPENFORM' != -1)) goBack = submittedTimes + 1; history.go(-goBack); //location.href = nsfPath + getCurrentView()+'?OpenView' }else { if(getCurrentView()==''){ history.go (-1); }else{ viewID = url.substring(posNSF + 5, posNSF + 37); location.href = nsfPath + viewID + '?OpenView' } } } } function onescape(){ //When esc key is pressed the Close click event is called // Original written by Florin Cotarlea/RO/SOBIS // Changed by Eugen Cretu/RO/SOBIS var thisFunction='onescape'; try{ if(window.event.keyCode!=27){ return window.event.keyCode; } if(isEditMode()){ if(isChanged()){ var flag=window.confirm('Documentul a fost modificat. Pierdeti modificarile?'); if(flag){ backToView(); } } else{ backToView(); } } if(isReadMode()){ backToView(); } }catch(e){ window.status='Error! Function'+thisFunction+'=>'+e.description; } } function goToEditMode(){ // used in dblClick event of the form and switch the doc. in EditMode // Original written by Florin Cotarlea/RO/SOBIS // Changed by Eugen Cretu/RO/SOBIS //check if the document is in Edit mode if(getCGI('PrintMode')!=''){ //is in Print Mode return; } pos = location.toString().indexOf('?') + 1 str = location.toString().substr(pos, 12).toUpperCase() openForm = location.toString().substr(pos, 8).toUpperCase() if(str != 'EDITDOCUMENT' && openForm != "OPENFORM") location.search='?EditDocument' } function isChanged() { //Check if the data from current document/form is changed // Original written by Florin Cotarlea/RO/SOBIS // Changed by Eugen Cretu/RO/SOBIS var j=0; var elem=document.forms[0].elements; var arrInput=new Array('HIDDEN', 'FILE', 'TEXT','SELECT-ONE', 'SELECT-MULTI','TEXTAREA'); for ( var j=0; j '+e.description; } } function trim(str){ // Remove the leading and ending spaces re = /^ *| *$/gi; return str.replace(re, ''); } function getUrl(){ // No comment return window.location.toString(); } function getDb(){ // return the current .nsf database name with the full path EG. ADP/2005/Registratura.nsf var strPathName=window.location.pathname; var nsfIndex=strPathName.toUpperCase().indexOf('.NSF/'); if(nsfIndex>0){ var strDb= strPathName.substring(0, nsfIndex+4); if(strDb.charAt(0)=='/'){ return strDb.substring(1, strDb.length); }else{ return strDb; } } return ''; } function getDbPath(){ // return only the path of the current database without the file name EG ADP/2005 var strPathName=window.location.pathname; var nsfIndex=strPathName.toUpperCase().indexOf('.NSF'); if(nsfIndex>0){ var strDb= strPathName.substring(0, nsfIndex+4); return strDb.substring(1, strDb.lastIndexOf('/')) } return ''; } function getDbFile(){ // return only the file name of the current database without the path name EG Registratura.nsf var strPathName=window.location.pathname; var nsfIndex=strPathName.toUpperCase().indexOf('.NSF'); if(nsfIndex>0){ var strDb= strPathName.substring(0, nsfIndex+4); return strDb.substring(strDb.lastIndexOf('/')+1, strDb.length) } } function getDbPathN(nrComponent){ // return the nrComponent part of the pathname //EG getDbPathN(0) for /ADP/2005/Registratura.nsf will return ADP var arrayComponents=getDbPath().split('/'); if(arrayComponents.length>nrComponent){ return arrayComponents[nrComponent]; } return ''; } function getPath0(){ // return the first component of the path return getDbPathN(0) } function getPath1(){ // return the second component of the path return getDbPathN(1) } function getCurrentView(){ //return the current view name or the source view name var currentView=''; url = getUrl().toUpperCase(); posQM = url.indexOf('?'); posNSF = url.indexOf('.NSF/'); if (posNSF != -1) { //not a simple .nsf urlAction = url.substring(posNSF+ 5, url.length); if(urlAction.indexOf('?EDITDOCUMENT')>0){ urlAction=urlAction.substring(0, urlAction.indexOf('?EDITDOCUMENT')-1); if(urlAction.indexOf('/')>0){ currentView=urlAction.substring(0, urlAction.indexOf('/')); } } if(urlAction.indexOf('?OPENDOCUMENT')>0){ urlAction=urlAction.substring(0, urlAction.indexOf('?OPENDOCUMENT')-1); if(urlAction.indexOf('/')>0){ currentView=urlAction.substring(0, urlAction.indexOf('/')); } } if(urlAction.indexOf('?OPENVIEW')>0){ currentView=urlAction.substring(0, urlAction.indexOf('?OPENVIEW')); } if(urlAction.indexOf('?SEARCHVIEW')>0){ currentView=urlAction.substring(0, urlAction.indexOf('?SEARCHVIEW')); } } if(currentView!=''){ currentView=getUrl().substring(url.indexOf(currentView), url.indexOf(currentView)+currentView.length) }else{ if(urlAction.indexOf('/')>0){ currentView=getUrl().substring(url.indexOf('.NSF/')+5,url.indexOf('.NSF/')+5+urlAction.indexOf('/')) }else{ currentView=getUrl().substring(url.indexOf('.NSF/')+5,url.length) } } return currentView; } function editDocument(strDocUnid, strView){ //open the specified document in edit mode if((typeof(strView)=='undefined') ||(strView=='')){ strView=getCurrentView(); } window.location.href='/'+getDb()+'/'+strView+'/'+strDocUnid+ "?EditDocument" } function openDocument(strDocUnid, strView){ //open the specified document in read mode if((typeof(strView)=='undefined') ||(strView=='')){ strView=getCurrentView(); } window.location.href='/'+getDb()+'/'+strView+'/'+strDocUnid+ "?OpenDocument" } function deleteDocument(strDocUnid, strView){ //delete the specified document if((typeof(strView)=='undefined') ||(strView=='')){ strView=getCurrentView(); } var flag=window.confirm("Doriti sa stergeti documentul?") if(flag){ var strRet=getUrl(); var strView=(strView=='')?'All':strView; window.location.href='/'+getDb()+'/'+strView+'/'+strDocUnid+ '?DeleteDocument&ReturnPage='+strRet; window.status='Documentul a fost sters!'; } } function isEditMode(){ // check if the document is in edit mode return (getUrl().toUpperCase().indexOf('?EDITDOCUMENT')>0)||(getUrl().toUpperCase().indexOf('?OPENFORM')>0); } function isReadMode(){ // check if the document is in read mode return (getUrl().toUpperCase().indexOf('?OPENDOCUMENT')>0); } function isNewDoc(){ return (getUrl().toUpperCase().indexOf('?OPENFORM')>0); } function getDocumentUniqueID(){ //retrieve the DocUnid from the url url = getUrl().toUpperCase(); posQM = url.indexOf('?'); posNSF = url.indexOf('.NSF/'); if (posNSF != -1){ //not a simple .nsf var urlAction = url.substring(posNSF+ 5, getUrl().length); var indexEdit=urlAction.indexOf('?EDITDOCUMENT'); if(indexEdit>0){ return urlAction.substring(indexEdit-32, indexEdit); } var indexOpen=urlAction.indexOf('?OPENDOCUMENT'); if(indexOpen>0){ return urlAction.substring(indexOpen-32, indexOpen); } } return ''; } function getFieldValue(fldPar){ // return the value of the specified field fldPar // fldPar can be an object or a string var strRet=""; var fld; if(typeof(fldPar)=='string'){ fld=eval('document.forms[0].'+fldPar); }else{ fld=fldPar; } if(!fld){ return ''; } if(typeof(fld)=='undefined'){ return ''; } if(typeof(fld.tagName)=='undefined'){ //poate fi array de controale if(typeof(fld.length)=='undefined'){ // nu e array return ''; }else{ // e array de controale for(var i=0;i'+e.description; } } function hideID(id){ // set the display attribute to none for the value // specified in id parameter var j=0; var thisFunction='hideID'; try{ document.getElementById(id).style.display='none' }catch(e){ window.status='Error! Function'+thisFunction+'=>'+e.description; } } function showIDs(){ // set the display attribute to visible block for the values // specified in URL in ShowID parameter // a field ShowID must reside on the form var j=0; var thisFunction='showIDs'; try{ var arrShowID=document.forms[0].ShowID; if(typeof(arrShowID.length)=='undefined'){ //only one value try{ if(arrShowID.value==''){return} document.getElementById(arrShowID.value).style.display='inline-block' }catch(e){window.status='Not Found '+arrShowID.value} }else{ for(var i=0;i'+e.description; } } function hideIDs(){ // set the display attribute to none // specified in URL in HideID parameter // a field HideID must reside on the form var j=0; var thisFunction='hideIDs'; try{ var arrShowID=document.forms[0].HideID; if(typeof(arrShowID.length)=='undefined'){ //only one value try{ document.getElementById(arrShowID.value).style.display='none' }catch(e){} }else{ for(var i=0;i'+e.description; } } function createPrintIcon(){ try{ var actnBar=document.getElementById('ActionBar'); if(actnBar!=null){ var lastTD=actnBar.rows[0].cells[actnBar.rows[0].cells.length-1]; if(lastTD!=null){ lastTD.className='clsPrintPreview'; lastTD.innerHTML=('PreviewPreview'); } } }catch(e){ } } function initSpecialFields () { try{ var fields = document.forms [0].elements; var i; var strTmp; for (i = 0; i < fields.length; i++) { if (fields [i].getAttribute ('specialChars') == 'true') { fields [i].title = 'Click cu dreptul pentru a insera caractere speciale'; fields [i].oncontextmenu = showSpecialChars; } if (fields [i].getAttribute ('isAutocomplete') == 'true') { fields [i].fnAutoComplete = function () { strAjaxSrc = this.getAttribute ('ajaxSrc'); strArraySrc = this.getAttribute ('arraySrc'); strMaxItems = this.getAttribute ('maxItems'); strSensitivity = this.getAttribute ('sensitivity'); loadChoices (this.name, (strAjaxSrc ? eval (strAjaxSrc) : null), (strArraySrc ? eval (strArraySrc ) : null), (strMaxItems ? parseInt (strMaxItems) : null), (strSensitivity ? parseInt (strSensitivity ) : null)); } fields [i].fnAutoComplete (); } else if (fields [i].getAttribute ('isDate') == 'true') { strTmp = '      '; if (!document.getElementById (fields [i].name + '_trigger')) fields [i].insertAdjacentHTML ('afterEnd', strTmp); } } }catch(e){window.defaultStatus = 'Eroare la campuri speciale!';} } function setCSS(){ // set the Exclamation background to the mandatory fields // mandatory fields have the validateCondition attribute defined // attach onblur and onfocus event // set the document title // Append this function to the onload event for each form var j=0; var elem=document.forms[0].elements; var arrInput=new Array('HIDDEN', 'FILE', 'TEXT','SELECT-ONE', 'SELECT-MULTI','TEXTAREA'); if (typeof (initSpecialFields) != 'undefined'){ initSpecialFields (); } for ( var j=0; j = 0){ elem[j].onfocus=fieldOnFocus; } if(elem[j].onblur==null && elem [j].type.indexOf ('text') >= 0){ elem[j].onblur=fieldOnBlur; } elem[j]._defaultValue=getFieldValue(elem[j]); if((typeof(elem[j].validateCondition)!='undefined')&&(elem[j].validateCondition!='')){ if(elem[j].className==''){ elem[j].className='mandatory'; }else{ elem[j].className+=((elem[j].className.indexOf('mandatory')>0)?'':(' mandatory')); } }// end if } } //end for k }//end for j setTitle(); showIDs(); hideIDs(); createPrintIcon(); window.status=''; /*endThread(); try{ if((getUrl().indexOf('&PrintMode')>0)||(getUrl().indexOf('&NoBar')>0)){} else{ setTimeout("var ctl=document.getElementById('DIVBackground');if(ctl!=null){ctl.style.display='none';} ctl=document.getElementById('ActionBar');if(ctl!=null){ctl.style.visibility='visible';}",100); } }catch(e){}*/ ctl=document.getElementById('ActionBar');if(ctl!=null){ctl.style.visibility='visible';} } function beginThread(nowait){ // create (if not exists) and show the div with background try{ var divBkg=document.getElementById('DIVBackground'); if(divBkg==null){ //div not exists, create it divBkg=document.createElement("
"); divBkg.style.display=''; if((getUrl().indexOf('&PrintMode')>0)||(getUrl().indexOf('&NoBar')>0)){ divBkg.style.display='none'; } var ctl=document.getElementById('ActionBar'); if(ctl!=null){ document.body.childNodes[0].insertBefore(divBkg); } } divBkg.style.display=''; if(nowait==1){ divBkg.style.backgroundImage=''; }else{ divBkg.style.backgroundImage='/templateweb/Setari.nsf/loading.jpg'; } }catch(e){ // window.status='Error at beginThread! '+e.description }//end catch } function endThread(){ // hide (if exists) the div with background try{ var divBkg=document.getElementById('DIVBackground'); if(divBkg!=null){ //div exists divBkg.style.display='none'; } }catch(e){ window.status='Error at endThread!' }//end cathch } function fieldOnFocus(){ // event for fields var thisField=event.srcElement; thisField.style.background='feeeee'; } function fieldOnBlur(){ //event for fields var thisField=event.srcElement; thisField.style.background='#ffffff'; if(thisField.validateCondition){ if(!thisField.value){ thisField.style.backgroundImage='url(/icons/vwicn150.gif)'; thisField.style.backgroundPosition='right'; thisField.style.backgroundRepeat='no-repeat' }else{ thisField.style.background='#ffffff'; } } } function setTitle(){ if((typeof(window.frameElement)!='undefined')&&(window.frameElement!=null)){ if(window.frameElement.tagName=='IFRAME'){ return; }else{ if(top!=self){ top.document.title = document.title; //for framed documents } } }else{ if(top!=self){ top.document.title = document.title; //for framed documents } } } function getCGI(strName){ // return the value of the specified CGI variable in url if(trim(strName)==''){ return ''; } var strPath=window.location.href; if(strPath.indexOf('&')>0){ strPath=strPath.substring(strPath.indexOf('&'), strPath.length) var arrParam=strPath.split('&'); for(var k=0;k0){ choicesDiv.style.visibility='visible' choicesDiv.style.display='' choicesField.options.selectedIndex=0; if(choicesField.options.length<5){ choicesField.size=choicesField.options.length }else{ choicesField.size=5 } }else{ choicesDiv.style.visibility='hidden' choicesDiv.style.display='none' } }//end if ready state 4 } catch(e){ window.status='Error at function callback_updateChoices on field '+fieldName+': '+e.description+ ' at line '+e.lineno; }//end try catch if (uniqueItems) eliminateDuplicateValues (fieldName + 'Choices'); }//end callback function // Open a connection to the server xmlHttp.open("GET", urlName, true); // Setup a function for the server to run when it's done xmlHttp.onreadystatechange =callback_updateChoices ; // Send the request xmlHttp.send(null); } function LogWebService(urlService, user, password) { if(oXmlHttp==null){ var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); } var srt=urlService; srt=srt.substring(0, srt.indexOf('?')); srt+=('?login&UserName='+user+'&Password='+password+'&RedirectTo='+urlService); oXmlHttp.open("GET",srt,false,user,password); } function ReplaceSpecialChars(strSrc) { var arrChars = new Array (), strRet, i; arrChars [0] = String.fromCharCode (259) + 'a'; arrChars [1] = String.fromCharCode (258) + 'A'; arrChars [2] = String.fromCharCode (226) + 'a'; arrChars [3] = String.fromCharCode (194) + 'A'; arrChars [4] = String.fromCharCode (238) + 'i'; arrChars [5] = String.fromCharCode (206) + 'I'; arrChars [6] = String.fromCharCode (351) + 's'; arrChars [7] = String.fromCharCode (350) + 'S'; arrChars [8] = String.fromCharCode (355) + 't'; arrChars [9] = String.fromCharCode (354) + 'T'; strRet = strSrc.replace (new RegExp ('<','g'), '<').replace (new RegExp ('>','g'), '>'); for (i = 0; i < 10; i++) { strRet = strRet.replace (new RegExp (arrChars [i].charAt (0), 'g'), arrChars [i].charAt (1)) } return strRet; } function RunWebService (urlService, soapAction, user, password, portName, paramList, outputType) { /* urlService like "GetSubject?OpenWebService" portName like "GETNTHSUBJECT" paramList is an array of parameters, each parameter has name, type and value, ex paramList=new Array(1); paramList[0].name='ALA', paramList[0].type='xsd:string', paramList[0].value='John' outputType default=xml */ if (typeof outputType=="undefined") outputType=''; var paramSOAP=''; for(i=0;i'+ReplaceSpecialChars(paramList[i].value)+''); if(oXmlHttp==null) var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); if(user!='') oXmlHttp.open("POST",urlService,false,user,password); else oXmlHttp.open("POST",urlService,false); oXmlHttp.setRequestHeader("Content-Type", "text/xml"); //oXmlHttp.setRequestHeader("SOAPAction", "http://tempuri.org/"+portName); oXmlHttp.setRequestHeader("SOAPAction",soapAction); var mystr = '<'+portName+' xmlns="'+soapAction.substring(0,soapAction.lastIndexOf('/'))+'">'+paramSOAP.replace (/\sxsi\:type\=\"xsd:string\"/g, '')+''; var v=prompt('ceva', mystr); return; try {oXmlHttp.send(mystr);} catch (e) {alert ('Error...\n' + e.description)}; if(outputType=='xml') try{ //strO= (oXmlHttp.responseXML.getElementsByTagName(portName+"Return")[0].xml); strO=oXmlHttp.responseXML.text; return strO; } catch(e) {return '';} //end try try{ strO= oXmlHttp.responseXML.getElementsByTagName(portName+"Return")[0].text; return strO; }catch(e){return '';}//end try no } function RunWebServiceOld(urlService, user, password, portName, paramList, outputType) // urlService like "GetSubject?OpenWebService" //portName like "GETNTHSUBJECT" //paramList is an array of parameters, each parameter has name, type and value, ex // paramList=new Array(1); paramList[0].name='ALA', paramList[0].type='xsd:string', paramList[0].value='John' // outputType default=xml { if (typeof outputType=="undefined"){ outputType=''; } var paramSOAP=''; for(i=0;i'+paramList[i].value+''); } //eden/edentests2 if(oXmlHttp==null){ var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); } if(user!=''){ oXmlHttp.open("POST",urlService,false,user,password); }else{ oXmlHttp.open("POST",urlService,false); } oXmlHttp.setRequestHeader("Content-Type", "text/xml"); oXmlHttp.setRequestHeader("SOAPAction", portName); var mystr = ''+paramSOAP+''; alert(mystr); oXmlHttp.send(mystr); if(outputType=='xml'){ try{ strO= (oXmlHttp.responseXML.getElementsByTagName(portName+"Return")[0].xml); return strO; }catch(e){ return ''; } //end try }//end if output type try{ strO= oXmlHttp.responseXML.getElementsByTagName(portName+"Return")[0].text; return strO; }catch(e){ return ''; }//end try no } var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); // document.body.onload=setFieldCSS; displayMsg(); document.onkeyup=onescape;// capture the ESC event initAJAX(); function getSearchableQuery(targetDiv){ //ia toate elementele din targetDiv si construieste query cu ele var thisFunction="getSearchableQuery"; var strQuery=""; try{ targetElem=document.getElementById(targetDiv); targetElem=document.all.tags('INPUT'); if(targetElem!=null){ var i=0; for(i = 0; i '+generateFieldCondition(el)); strQuery+=(generateFieldCondition(el)); } } } } targetElem=document.all.tags('SELECT'); if(targetElem!=null){ var i=0; for(i = 0; i '+e.description; // alert('Error! Function'+thisFunction+'=>'+e.description); } } function generateFieldCondition(el){ //genereaza codul HTML corespunzator conditiei de cautare tipului de element el //el se presupune a fi de tip isSearchable='true'; var thisFunction="generateFieldCondition"; var strQuery=''; try{ var thisVal=getFieldValue(el.name); if((el.validateCondition=="isInteger")||(el.name.indexOf('NO')>0)||(el.isInteger=='true')){ if(el.name.indexOf('MAX')==(el.name.length-3)){ //e cu max/min strQuery=strQuery+'AND (['+el.name.substring(0, el.name.length-3)+']<='+thisVal+')'; }else{ if(el.name.indexOf('MIN')==(el.name.length-3)){ //e cu max/min strQuery=strQuery+'AND (['+el.name.substring(0, el.name.length-3)+']>='+thisVal+')'; }else{ strQuery='AND (['+el.name+']='+thisVal+')'; } } return strQuery; }//end is integer if((el.validateCondition=="isDate")||(el.name.indexOf('DT')==el.name.length-3)||(el.isDate=='true')){ if(el.name.indexOf('MAX')==(el.name.length-3)){ //e cu max/min strQuery=strQuery+'AND (['+el.name.substring(0, el.name.length-3)+']<='+thisVal+')'; }else{ if(el.name.indexOf('MIN')==(el.name.length-3)){ //e cu max/min strQuery=strQuery+'AND (['+el.name.substring(0, el.name.length-3)+']>='+thisVal+')'; }else{ strQuery='AND (['+el.name+']='+thisVal+')'; } } return strQuery; }//end is date //else is string strQuery='AND (['+el.name+']='+thisVal+'*)'; return strQuery; }catch(e){ window.status='Error! Function'+thisFunction+'=>'+e.description; // alert(window.status); } } function generateFieldForm (el){ //genereaza codul HTML corespunzator tipului de element el //el se presupune a fi de tip isSearchable='true'; var thisFunction="generateFieldForm1"; var strField=''; var strInnerHTML=''; var retTDs = new Array (2); retTDs [0] = document.createElement (''); retTDs [0].innerHTML = '
'+label+' :
'; retTDs [1] = document.createElement (''); try{ var parentNode=el.parentElement; label=el.label; if(el.readOnly) el.readOnly=false; if (el.tagName == 'TEXTAREA') { retTDs [1].innerHTML = el.outerHTML.substring (0, el.outerHTML.length - 11).replace (/textarea/gi, 'input type="text"').replace (/\>.*/, '>'); return retTDs; } if(el.validateCondition=="isNotNull"){ el.validateCondition=''; retTDs [1].innerHTML = el.outerHTML;//parentNode.innerHTML; return retTDs; } if((el.validateCondition=="isInteger")||(el.name.indexOf('NO')>0)||(el.isInteger=='true')){ el.validateCondition=''; el.isInteger="true"; if(el.searchInterval=="true"){ retTDs [1].innerHTML = 'de la '+parentNode.innerHTML.replace(new RegExp(el.name,'g'), (el.name+'MIN')) +' pana la ' + parentNode.innerHTML.replace (new RegExp(el.name,'g'), (el.name+'MAX')); }else{ retTDs [1].innerHTML = el.outerHTML;//parentNode.innerHTML; } return retTDs; }//end isInteger if((el.validateCondition=="isDate")||(el.name.indexOf('DT')>0)||(el.isDate=='true')){ //is date el.validateCondition=''; el.isDate="true"; if(el.searchInterval!="true"){ //data fara interval; generez controlul datepicker strDatePicker=''; retTDs [1].innerHTML = el.outerHTML /*parentNode.innerHTML*/;// + strDatePicker; } else { //interval cu date strDatePickerMIN=''; strDatePickerMAX=''; retTDs [1].innerHTML = 'de la ' + el.outerHTML/*parentNode.innerHTML*/.replace(new RegExp(el.name,'g'), (el.name+'MIN'))/*+strDatePickerMIN*/+' pana la '+el.outerHTML/*parentNode.innerHTML*/.replace(new RegExp(el.name,'g'), (el.name+'MAX'));//+strDatePickerMAX; }//end searchInterval="true" return retTDs; }//end isDate el.validateCondition=''; retTDs [1].innerHTML = el.outerHTML.replace (/readonly|disabled/gi, ''); return retTDs; } catch(e) { window.status='Error! Function'+thisFunction+'=>'+e.description; } } function createSearchableForm (title, srcUrl, targetDiv){ //create and insert in the DIV innerHTML the searchable form fields //ia numai campurile care au isSearchable ="true" si genereaza // ptr campurile text ([fieldname]="value") //ptr campurile cu validateCondition="isInteger" ([fieldname]=value) //pentru campurile data ([fieldname]=value) + date picker in dreapta //pentru campurile cu searchInterval="true" genereaza 2 campuri data de tip start si end var thisFunction="createSearchableForm"; try{ targetElem=document.getElementById(targetDiv); if(targetElem==null){ window.status='Error! No target div found:'+targetDiv; return false; } var dummyIframe=document.getElementById("DUMMY_IFRAME"); if(dummyIframe!=null){ dummyIframe.onreadystatechange=function(){ if(this.readyState=='complete'){ var targetElem=document.getElementById(targetDiv); strInnerHTML=''; var form = this.contentWindow.document.forms[0]; var i=0; oTrToInsertBefore = targetElem.parentNode.parentNode; oTBody = oTrToInsertBefore.parentNode; for(i = 0; i < form.elements.length; i++) { if (form.elements[i].isSearchable=="true") { var el=form.elements[i]; var parentNode=el.parentElement; if((el.tagName=='INPUT')&&(el.type=='text')) el.value=''; if(el.tagName=='SELECT'){ if(el.options[0]!=''){ // insert new option el.options[el.options.length]=new Option('',''); el.value=''; } } label=el.label; // eliminarea evenimentelor de pe campuri eventList = ['onclick', 'onchange', 'ondblclick', 'onkeypress', 'onkeyup', 'onkeydown', 'onfocus', 'onblur']; for (j = 0; j < eventList.length; j++) eval ('el.' + eventList [j] + ' = null;'); // inserare rand tabel nou cu label si camp arrTDs = generateFieldForm (el); oNewTr = document.createElement ('tr'); oTdDummy = document.createElement (''); oNewTr.appendChild (oTdDummy); oNewTr.appendChild (arrTDs [0]); oNewTr.appendChild (arrTDs [1]); oTBody.insertBefore (oNewTr, oTrToInsertBefore); } } oTrToInsertBefore.parentNode.removeChild (oTrToInsertBefore); } } dummyIframe.src=srcUrl; } } catch(e) { window.status='Error! Function'+thisFunction+'=>'+e.description; } }//end function function formChangeYear (strNewYear) { boolConfirm = confirm ('Sunteti sigur ca vreti sa inregistrati pe anul ' + strNewYear + ' ?'); if (!boolConfirm) return; var strUrl = location.href; strMatch = strUrl.match (/(19\d\d)|(20\d\d)/gi) [0]; location.href = location.href.replace (new RegExp ('/' + strMatch + '/', ''), '/' + strNewYear + '/'); }