Changeset 8232 for branches/2.5/expressoMail1_2/js/connector.js
- Timestamp:
- 10/08/13 16:20:46 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/expressoMail1_2/js/connector.js
r8103 r8232 171 171 } 172 172 173 cConnector.prototype.unserializeArchiver = function(str) 174 { 175 _thisObject = this; 176 var matchB = function (str, iniPos) 177 { 178 var nOpen, nClose = iniPos; 179 do 180 { 181 nOpen = str.substr(nClose+1).search(/[0-9]\:\{/ ); 182 183 if (nOpen > 0) 184 nOpen = nOpen + nClose+3; 185 186 nClose = str.indexOf('}', nClose+1); 187 188 if (nOpen < 0) 189 { 190 return nClose; 191 } 192 if (nOpen < nClose ) 193 { 194 nClose = matchB(str, nOpen); 195 } 196 } while (nOpen < nClose); 197 198 return nClose; 199 } 200 201 var f = function (str) 202 { 203 switch (str.charAt(0)) 204 { 205 case 'a': 206 207 var data = new Array(); 208 var n = parseInt( str.substring( str.indexOf(':')+1, str.indexOf(':',2) ) ); 209 var arrayContent = str.substring(str.indexOf('{')+1, str.lastIndexOf('}')); 210 211 for (var i = 0; i < n; i++) 212 { 213 var pos = 0; 214 215 /* Process Index */ 216 var indexStr = arrayContent.substr(pos, arrayContent.indexOf(';')+1); 217 var index = f(indexStr); 218 pos = arrayContent.indexOf(';', pos)+1; 219 220 /* Process Content */ 221 var part = null; 222 switch (arrayContent.charAt(pos)) 223 { 224 case 'a': 225 var pos_ = matchB(arrayContent, arrayContent.indexOf('{', pos))+1; 226 part = arrayContent.substring(pos, pos_); 227 pos = pos_; 228 data[index] = f(part); 229 break; 230 231 case 's': 232 var pval = arrayContent.indexOf(':', pos+2); 233 var val = parseInt(arrayContent.substring(pos+2, pval)); 234 pos = pval + val + 4; 235 data[index] = arrayContent.substr(pval+2, val); 236 break; 237 238 default: 239 part = arrayContent.substring(pos, arrayContent.indexOf(';', pos)+1); 240 pos = arrayContent.indexOf(';', pos)+1; 241 data[index] = f(part); 242 break; 243 } 244 arrayContent = arrayContent.substr(pos); 245 } 246 break; 247 248 case 's': 249 var pos = str.indexOf(':', 2); 250 var val = parseInt(str.substring(2,pos)); 251 var data = str.substr(pos+2, val); 252 str = str.substr(pos + 4 + val); 253 break; 254 255 case 'i': 256 case 'd': 257 var pos = str.indexOf(';'); 258 var data = parseInt(str.substring(2,pos)); 259 str = str.substr(pos + 1); 260 break; 261 262 case 'N': 263 var data = null; 264 str = str.substr(str.indexOf(';') + 1); 265 break; 266 267 case 'b': 268 var data = str.charAt(2) == '1' ? true : false; 269 break; 270 } 271 return data; 272 } 273 274 return f(str); 275 } 276 173 cConnector.prototype.unserializeArchiver = function(str) 174 { 175 _thisObject = this; 176 var matchB = function (str, iniPos) 177 { 178 var nOpen, nClose = iniPos; 179 do 180 { 181 nOpen = str.substr(nClose+1).search(/[0-9]\:\{/ ); 182 183 if (nOpen > 0) 184 nOpen = nOpen + nClose+3; 185 186 nClose = str.indexOf('}', nClose+1); 187 188 if (nOpen < 0) 189 { 190 return nClose; 191 } 192 if (nOpen < nClose ) 193 { 194 nClose = matchB(str, nOpen); 195 } 196 } while (nOpen < nClose); 197 198 return nClose; 199 } 200 201 var f = function (str) 202 { 203 switch (str.charAt(0)) 204 { 205 case 'a': 206 207 var data = new Array(); 208 var n = parseInt( str.substring( str.indexOf(':')+1, str.indexOf(':',2) ) ); 209 var arrayContent = str.substring(str.indexOf('{')+1, str.lastIndexOf('}')); 210 211 for (var i = 0; i < n; i++) 212 { 213 var pos = 0; 214 215 /* Process Index */ 216 var indexStr = arrayContent.substr(pos, arrayContent.indexOf(';')+1); 217 var index = f(indexStr); 218 pos = arrayContent.indexOf(';', pos)+1; 219 220 /* Process Content */ 221 var part = null; 222 switch (arrayContent.charAt(pos)) 223 { 224 case 'a': 225 var pos_ = matchB(arrayContent, arrayContent.indexOf('{', pos))+1; 226 part = arrayContent.substring(pos, pos_); 227 pos = pos_; 228 data[index] = f(part); 229 break; 230 231 case 's': 232 var pval = arrayContent.indexOf(':', pos+2); 233 var val = parseInt(arrayContent.substring(pos+2, pval)); 234 pos = pval + val + 4; 235 data[index] = arrayContent.substr(pval+2, val); 236 break; 237 238 default: 239 part = arrayContent.substring(pos, arrayContent.indexOf(';', pos)+1); 240 pos = arrayContent.indexOf(';', pos)+1; 241 data[index] = f(part); 242 break; 243 } 244 arrayContent = arrayContent.substr(pos); 245 } 246 break; 247 248 case 's': 249 var pos = str.indexOf(':', 2); 250 var val = parseInt(str.substring(2,pos)); 251 var data = str.substr(pos+2, val); 252 str = str.substr(pos + 4 + val); 253 break; 254 255 case 'i': 256 case 'd': 257 var pos = str.indexOf(';'); 258 var data = parseInt(str.substring(2,pos)); 259 str = str.substr(pos + 1); 260 break; 261 262 case 'N': 263 var data = null; 264 str = str.substr(str.indexOf(';') + 1); 265 break; 266 267 case 'b': 268 var data = str.charAt(2) == '1' ? true : false; 269 break; 270 } 271 return data; 272 } 273 274 return f(str); 275 } 276 277 277 //Unserialize Data Method 278 278 cConnector.prototype.unserialize = function(str) … … 290 290 291 291 nClose = (str.substr(nClose+1) == '}' || str.substr(nClose+1,1) == '}') ? nClose +1 : str.substr(nClose+1).search(/[0-9\"]\;\}/ ) + nClose + 3; 292 292 293 293 if (nOpen < 0) 294 294 { … … 554 554 { 555 555 var div = document.getElementById('divProgressBar'); 556 557 if(div) 558 { 559 div.style.visibility = 'hidden'; 560 this.isVisibleBar = false; 561 } 556 557 if(div) 558 { 559 div.style.visibility = 'hidden'; 560 this.isVisibleBar = false; 561 } 562 562 } 563 563 564 564 cConnector.prototype.showProgressBar = function(){ 565 565 566 566 var div = document.getElementById('divProgressBar'); 567 if(div) 568 { 569 div.style.visibility = 'visible'; 570 this.isVisibleBar = true; 571 } 567 if(div) 568 { 569 div.style.visibility = 'visible'; 570 this.isVisibleBar = true; 571 } 572 572 } 573 573
Note: See TracChangeset
for help on using the changeset viewer.