Changeset 57
- Timestamp:
- 04/04/05 12:23:56 (8 years ago)
- Location:
- trunk/plugins/Linker
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/Linker/linker.js
r41 r57 68 68 { 69 69 if(!a && this.editor._selectionEmpty(this.editor._getSelection())) 70 { 70 { 71 71 alert(this._lc("You must select some text before making a new link.")); 72 72 return false; … … 316 316 //get files from backend 317 317 HTMLArea._getback(linker.lConfig.backend, 318 function(txt) { lDialog.files = eval(txt); lDialog._prepareDialog(); }); 318 function(txt) { 319 try { 320 eval('lDialog.files = '+txt); 321 } catch(Error) { 322 lDialog.files = [ {url:'',title:Error.toString()} ]; 323 } 324 lDialog._prepareDialog(); }); 319 325 } 320 326 else if(linker.lConfig.files != null) … … 384 390 files[i]); 385 391 } 386 else 392 else if(files[i].length) 387 393 { 388 394 var id = this.Dialog_nxtid++; 389 395 this.dTree.add(id, parent, files[i][0].replace(/^.*\//, ''), null, files[i][0]); 390 396 this.makeNodes(files[i][1], id); 397 } 398 else if(typeof files[i] == 'object') 399 { 400 if(files[i].children) { 401 var id = this.Dialog_nxtid++; 402 } else { 403 var id = Linker.nxtid++; 404 } 405 406 if(files[i].title) var title = files[i].title; 407 else if(files[i].url) var title = files[i].url.replace(/^.*\//, ''); 408 else var title = "no title defined"; 409 if(files[i].url) var link = 'javascript:document.getElementsByName(\'' + this.dialog.id.href + '\')[0].value=decodeURIComponent(\'' + encodeURIComponent(files[i].url) + '\');document.getElementsByName(\'' + this.dialog.id.type + '\')[0].click();document.getElementsByName(\'' + this.dialog.id.href + '\')[0].focus();void(0);'; 410 else var link = ''; 411 412 this.dTree.add(id, parent, title, link, title); 413 if(files[i].children) { 414 this.makeNodes(files[i].children, id); 415 } 391 416 } 392 417 } -
trunk/plugins/Linker/scan.php
r21 r57 62 62 if($subdir = scan($path, $url)) 63 63 { 64 $files[] = array( $url,$subdir);64 $files[] = array('url'=>$url, 'children'=>$subdir); 65 65 } 66 66 } … … 68 68 { 69 69 if(($include && !preg_match($include, $url)) || ($exclude && preg_match($exclude, $url))) continue; 70 $files[] = $url;70 $files[] = array('url'=>$url); 71 71 } 72 72 … … 104 104 if(is_array($var)) 105 105 { 106 $useObject = false; 107 foreach(array_keys($var) as $k) { 108 if(!is_numeric($k)) $useObject = true; 109 } 106 110 $js = array(); 107 111 foreach($var as $k => $v) 108 112 { 109 $js[] = to_js($v, $tabs + 1); 113 $i = ""; 114 if($useObject) { 115 if(preg_match('#[a-zA-Z]+[a-zA-Z0-9]*#', $k)) { 116 $i .= "$k: "; 117 } else { 118 $i .= "'$k': "; 119 } 120 } 121 $i .= to_js($v, $tabs + 1); 122 $js[] = $i; 110 123 } 111 return "[\n" . tabify(implode(",\n", $js), $tabs) . "\n]"; 124 if($useObject) { 125 $ret = "{\n" . tabify(implode(",\n", $js), $tabs) . "\n}"; 126 } else { 127 $ret = "[\n" . tabify(implode(",\n", $js), $tabs) . "\n]"; 128 } 129 return $ret; 112 130 } 113 131
