1/****************************************************************************** 2* odfClientRuntime.js 3******************************************************************************* 4Runtime client pour les controles 5******************************************************************************* 6* * 7* Copyright 2000-2002 * 8* * 9******************************************************************************/ 10function formatCurrency(currency, simple) 11{ 12 var langPrefix = lang.substr(0, 2); 13 if(simple != true && langPrefix == "en") simple = true; 14 var sign =""; 15 if(currency < 0) { 16 currency = -currency; 17 sign = "-"; 18 } 19 var integer = Math.floor(currency); 20 // NB : A cause des arrondis, on utilise round au lieu de floor et on ne va pas factoriser l'expression mathematique en ecrivant : 100 * (currency - integer) 21 // De plus, comme on travaille avec 2 decimales, si la partie decimale est egale a 100 (xx.9964), il ne faut pas oublier de rajouter 1 a la partie entiere et d'affecter 0 a la partie decimale 22 // Cas a probleme : 583.05 | 152.89 | 6.9964 23 var dec = Math.round((100 * currency) - (100 * integer)); 24 if (dec == 100) { 25 integer += 1; 26 dec = 0; 27 } 28 var full = "" + integer; 29 var decimal = "" + dec; 30 if(decimal.length == 1) decimal = "0"+decimal; 31 var res = null; 32 var pos = full.length; 33 while(pos > 3) { 34 block = full.substr(pos - 3, 3); 35 if(res == null) { 36 res = block; 37 } else { 38 if(simple) { 39 res = block+","+res; 40 } else { 41 res = block+"\240"+res; 42 } 43 } 44 pos -= 3; 45 } 46 if(pos > 0) { 47 block = full.substr(0, pos); 48 if(res == null) { 49 res = block; 50 } else { 51 if(simple) { 52 res = block+","+res; 53 } else { 54 res = block+"\240"+res; 55 } 56 } 57 } 58 if(simple) { 59 res += "."+decimal; 60 } else { 61 res += ","+decimal; 62 } 63 return sign+res; 64} 65 66function formatTimestamp(timestamp, format) 67{ 68 switch(format) { 69 case "hours": 70 return objDateUtils.getStringDate(timestamp, "G:i:s"); 71 case "time": 72 return objDateUtils.getStringDate(timestamp, "d/m/Y G:i:s"); 73 case "date": 74 default: 75 return objDateUtils.getStringDate(timestamp, "d/m/Y"); 76 } 77} 78 79function showModalWindow(url, name, width, height, arguments) 80{ 81 var leftPos = (screen.availWidth - width) / 2; 82 var topPos = (screen.availHeight - height) / 2; 83 if(false && document.all) { 84 width = parseInt(width, 10); 85 height = parseInt(height, 10); 86 width += 8; 87 height += 29; 88 var options = 'resizable=yes;scroll=no;edge=sunken;status=no;dialogWidth=' + width + 'px;dialogHeight=' + height + 'px;dialogLeft=' + leftPos + 'px;dialogTop=' + topPos + "px;"; 89 //consoleDump("window.showModalDialog(\"" + url + "\", arguments, \"" + options +"\")"); 90 window.showModalDialog(url, arguments, options); 91 } else { 92 var options = 'width=' + width + ',height=' + height + ',left=' + leftPos + ',top=' + topPos; 93 var win = window.open(fixUrl(url), name, options); 94 if (win==null) { 95 alert(objThesaurus.translate("odfCheckPopupBlocker")); 96 } else { 97 win.focus(); 98 } 99 } 100} 101 102function tabClick(a) 103{ 104 var srcLi = a.parentNode; 105 var ul = srcLi.parentNode; 106 for(var i=0;i < ul.childNodes.length;i++) { 107 var li = ul.childNodes.item(i); 108 if(li.nodeName != "LI") continue; 109 var id = li.id; 110 var tabBody = document.getElementById("tab" + id); 111 if(li.tagName != "LI" || tabBody == null) { 112 continue; 113 } 114 if(li == srcLi) { 115 tabBody.className = tabBody.className.replace(/^tabBody$|tabBody\s/,"tabBodySelected ") 116 li.className = li.className.replace(/^tabButton$|tabButton\s/,"tabButtonSelected ") 117 } else { 118 tabBody.className = tabBody.className.replace(/^tabBodySelected$|tabBodySelected\s/,"tabBody ") 119 li.className = li.className.replace(/^tabButtonSelected$|tabButtonSelected\s/,"tabButton ") 120 } 121 } 122 return false; 123} 124 125function showTargetElement(hash) { 126 document.location.hash = hash; 127} 128 129function getTableSelectionOids(event) 130{ 131 if (document.all != null) { 132 var form = window.event.srcElement; 133 } else { 134 if(event == null) return null; 135 var form = event.currentTarget; 136 } 137 while(form && form.nodeType == 1 && form.tagName != "FORM") { 138 form = form.parentNode; 139 } 140 if(form == null || form.nodeType != 1) return null; 141 var allCheckbox = form.topAllOids; 142 if(allCheckbox != null && allCheckbox.checked) { 143 return "all"; 144 } 145 var checkboxes = form.oids; 146 if(checkboxes == null) checkboxes = new Array(); 147 if(checkboxes.length == null) { 148 checkboxes = new Array(checkboxes); 149 } 150 var oids = ""; 151 for(var i=0;i<checkboxes.length;i++) { 152 var checkbox = checkboxes[i];
153 if(!checkbox.checked) continue; 154 if(oids != "") oids += " "; 155 oids += checkbox.value; 156 } 157 return oids; 158} 159 160function odfSelectionTableLimitChange(select, id, anchor) 161{ 162 var cmd = "limit:" + select.value; 163 repostPage(id, cmd, anchor, null); 164} 165 166var allItlEnumerator = { 167} 168 169function ItlEnumerator(id, anchor) 170{ 171 this._id = id; 172 this._anchor = anchor; 173 this._oids = ""; 174 allItlEnumerator[id] = this; 175} 176 177ItlEnumerator.prototype.setOids = function(oids) 178{ 179 this._oids = oids; 180} 181 182 183ItlEnumerator.prototype.getOids = function(oids) 184{ 185 return this._oids; 186} 187 188ItlEnumerator.prototype.incrementRank = function(rank) 189{ 190 var oids = this._oids.split(" "); 191 var oid = oids[rank+1]; 192 oids[rank+1] = oids[rank]; 193 oids[rank] = oid; 194 var str = ""; 195 for(var i=0;i<oids.length;i++) { 196 if(i) str += " "; 197 str += oids[i]; 198 } 199 repostPage(this._id, "modifyRank", this._anchor, str); 200} 201 202 203ItlEnumerator.prototype.decrementRank = function(rank) 204{ 205 var oids = this._oids.split(" "); 206 var oid = oids[rank]; 207 oids[rank] = oids[rank-1]; 208 oids[rank-1] = oid; 209 var str = ""; 210 for(var i=0;i<oids.length;i++) { 211 if(i) str += " "; 212 str += oids[i]; 213 } 214 repostPage(this._id, "modifyRank", this._anchor, str); 215} 216 217ItlEnumerator.prototype.reOrder = function(oids, anchor) 218{ 219 repostPage(this._id, "modifyRank", anchor, oids); 220}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.