Changeset 1011

Show
Ignore:
Timestamp:
06/07/08 09:08:53 (4 months ago)
Author:
ray
Message:

update to new dialog plugins: separation of code into several files to reduce loading time

Location:
branches/new-dialogs-merge
Files:
10 modified
2 copied

Legend:

Unmodified
Added
Removed
  • branches/new-dialogs-merge/XinhaCore.js

    r1010 r1011  
    67996799  scope = (scope) ? scope : window; 
    68006800  var x,y; 
    6801   if (scope.pageYOffset) // all except Explorer 
     6801  if (typeof scope.pageYOffset != 'undefined') // all except Explorer 
    68026802  { 
    68036803    x = scope.pageXOffset; 
    68046804    y = scope.pageYOffset; 
    68056805  } 
    6806   else if (scope.document.documentElement && document.documentElement.scrollTop) 
     6806  else if (scope.document.documentElement && typeof document.documentElement.scrollTop != 'undefined') 
    68076807    // Explorer 6 Strict 
    68086808  { 
  • branches/new-dialogs-merge/modules/CreateLink/link.js

    r1009 r1011  
    5050CreateLink.prototype.onGenerateOnce = function() 
    5151{ 
    52         this.prepareDialog(); 
    53         this.loadScripts(); 
     52  CreateLink.loadAssets(); 
    5453}; 
    5554 
    56 CreateLink.prototype.loadScripts = function() 
     55CreateLink.loadAssets = function() 
    5756{ 
    58   var self = this; 
    59   if(!this.methodsReady) 
    60         { 
    61                 Xinha._getback(_editor_url + 'modules/CreateLink/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
    62                 return; 
    63         } 
    64 }; 
     57        var self = CreateLink; 
     58        if (self.loading) return; 
     59        self.loading = true; 
     60        Xinha._getback(_editor_url + 'modules/CreateLink/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; }); 
     61        Xinha._getback(_editor_url + 'modules/CreateLink/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
     62} 
    6563 
    6664CreateLink.prototype.onUpdateToolbar = function() 
    6765{  
    68   if (!(this.dialogReady && this.methodsReady)) 
     66        if (!(CreateLink.dialogReady && CreateLink.methodsReady)) 
    6967        { 
    70           this.editor._toolbarObjects.createlink.state("enabled", false); 
     68                this.editor._toolbarObjects.createlink.state("enabled", false); 
    7169        } 
     70        else this.onUpdateToolbar = null; 
    7271}; 
    7372 
     
    7776        var editor = this.editor; 
    7877 
    79         if(!this.html) // retrieve the raw dialog contents 
    80         { 
    81                 Xinha._getback(_editor_url + 'modules/CreateLink/dialog.html', function(getback) { self.html = getback; self.prepareDialog(); }); 
    82                 return; 
    83         } 
    84  
    85         // Now we have everything we need, so we can build the dialog. 
    86                  
    87         var dialog = this.dialog = new Xinha.Dialog(editor, this.html, 'Xinha',{width:400}) 
     78        var dialog = this.dialog = new Xinha.Dialog(editor, CreateLink.html, 'Xinha',{width:400}) 
    8879        // Connect the OK and Cancel buttons 
    8980        dialog.getElementById('ok').onclick = function() {self.apply();} 
  • branches/new-dialogs-merge/modules/CreateLink/pluginMethods.js

    r1008 r1011  
    22CreateLink.prototype.show = function(a) 
    33{ 
     4  if (!this.dialog) 
     5  { 
     6    this.prepareDialog(); 
     7  }  
    48        var editor = this.editor; 
    59        this.a = a; 
  • branches/new-dialogs-merge/modules/InsertImage/insert_image.js

    r1008 r1011  
    4646InsertImage.prototype.onGenerateOnce = function() 
    4747{ 
    48         this.prepareDialog(); 
    49         this.loadScripts(); 
     48        InsertImage.loadAssets(); 
    5049}; 
    5150 
    52 InsertImage.prototype.loadScripts = function() 
     51InsertImage.loadAssets = function() 
    5352{ 
    54   var self = this; 
    55   if(!this.methodsReady) 
    56         { 
    57                 Xinha._getback(_editor_url + 'modules/InsertImage/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
    58                 return; 
    59         } 
     53        var self = InsertImage; 
     54        if (self.loading) return; 
     55        self.loading = true; 
     56        Xinha._getback(_editor_url + 'modules/InsertImage/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; }); 
     57        Xinha._getback(_editor_url + 'modules/InsertImage/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
    6058}; 
    61  
    6259InsertImage.prototype.onUpdateToolbar = function() 
    6360{  
    64   if (!(this.dialogReady && this.methodsReady)) 
     61  if (!(InsertImage.dialogReady && InsertImage.methodsReady)) 
    6562        { 
    6663          this.editor._toolbarObjects.insertimage.state("enabled", false); 
    6764        } 
     65  else this.onUpdateToolbar = null; 
    6866}; 
    6967 
     
    7371        var editor = this.editor; 
    7472 
    75         if(!this.html) // retrieve the raw dialog contents 
    76         { 
    77                 Xinha._getback(_editor_url + 'modules/InsertImage/dialog.html', function(getback) { self.html = getback; self.prepareDialog(); }); 
    78                 return; 
    79         } 
    80  
    81         // Now we have everything we need, so we can build the dialog. 
    82                  
    83         var dialog = this.dialog = new Xinha.Dialog(editor, this.html, 'Xinha',{width:410}) 
     73        var dialog = this.dialog = new Xinha.Dialog(editor, InsertImage.html, 'Xinha',{width:410}) 
    8474        // Connect the OK and Cancel buttons 
    8575        dialog.getElementById('ok').onclick = function() {self.apply();} 
  • branches/new-dialogs-merge/modules/InsertImage/pluginMethods.js

    r1008 r1011  
    11InsertImage.prototype.show = function(image) 
    22{ 
    3         var editor = this.editor; 
     3        if (!this.dialog) this.prepareDialog(); 
     4   
     5  var editor = this.editor; 
    46        if ( typeof image == "undefined" ) 
    57  { 
     
    6062InsertImage.prototype.apply = function() 
    6163{ 
    62  
    6364  var param = this.dialog.hide(); 
    6465  if (!param.f_url) 
  • branches/new-dialogs-merge/modules/InsertTable/insert_table.js

    r1008 r1011  
    3737        var self = this; 
    3838 
    39    editor.config.btnList.inserttable[3] = function() { self.show(); } 
     39        editor.config.btnList.inserttable[3] = function() { self.show(); } 
    4040} 
    4141 
     
    4747InsertTable.prototype.onGenerateOnce = function() 
    4848{ 
    49         this.prepareDialog(); 
    50         this.loadScripts(); 
     49        InsertTable.loadAssets(); 
    5150}; 
    52  
    53 InsertTable.prototype.loadScripts = function() 
     51InsertTable.loadAssets = function() 
    5452{ 
    55   var self = this; 
    56   if(!this.methodsReady) 
    57         { 
    58                 Xinha._getback(_editor_url + 'modules/InsertTable/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
    59                 return; 
    60         } 
     53        var self = InsertTable; 
     54        if (self.loading) return; 
     55        self.loading = true; 
     56        Xinha._getback(_editor_url + 'modules/InsertTable/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; }); 
     57        Xinha._getback(_editor_url + 'modules/InsertTable/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
    6158}; 
    6259 
    6360InsertTable.prototype.onUpdateToolbar = function() 
    6461{  
    65   if (!(this.dialogReady && this.methodsReady)) 
     62  if (!(InsertTable.dialogReady && InsertTable.methodsReady)) 
    6663        { 
    6764          this.editor._toolbarObjects.inserttable.state("enabled", false); 
    6865        } 
     66        else this.onUpdateToolbar = null; 
    6967}; 
    7068 
     
    7472        var editor = this.editor; 
    7573 
    76         if(!this.html) // retrieve the raw dialog contents 
    77         { 
    78                 Xinha._getback(_editor_url + 'modules/InsertTable/dialog.html', function(getback) { self.html = getback; self.prepareDialog(); }); 
    79                 return; 
    80         } 
    81  
    82         // Now we have everything we need, so we can build the dialog. 
    83                  
    84         var dialog = this.dialog = new Xinha.Dialog(editor, this.html, 'Xinha',{width:400}) 
     74        var dialog = this.dialog = new Xinha.Dialog(editor, InsertTable.html, 'Xinha',{width:400}) 
    8575        // Connect the OK and Cancel buttons 
    8676        dialog.getElementById('ok').onclick = function() {self.apply();} 
  • branches/new-dialogs-merge/modules/InsertTable/pluginMethods.js

    r1008 r1011  
    11InsertTable.prototype.show = function(image) 
    22{ 
    3         var editor = this.editor; 
     3  if (!this.dialog) this.prepareDialog(); 
     4 
     5  var editor = this.editor; 
    46 
    57  var values =  
  • branches/new-dialogs-merge/plugins/Linker/linker.js

    r1007 r1011  
    5151}; 
    5252 
    53 Linker.prototype._createLink = function(a) 
    54 { 
    55   if(!a && this.editor.selectionEmpty(this.editor.getSelection())) 
    56   {        
    57     alert(this._lc("You must select some text before making a new link.")); 
    58     return false; 
    59   } 
    60  
    61   var inputs = 
    62   { 
    63     type:     'url', 
    64     href:     'http://www.example.com/', 
    65     target:   '', 
    66     p_width:  '', 
    67     p_height: '', 
    68     p_options: ['menubar=no','toolbar=yes','location=no','status=no','scrollbars=yes','resizeable=yes'], 
    69     to:       'alice@example.com', 
    70     subject:  '', 
    71     body:     '', 
    72     anchor:   '' 
    73   }; 
    74  
    75   if(a && a.tagName.toLowerCase() == 'a') 
    76   { 
    77     var href =this.editor.fixRelativeLinks(a.getAttribute('href')); 
    78     var m = href.match(/^mailto:(.*@[^?&]*)(\?(.*))?$/); 
    79     var anchor = href.match(/^#(.*)$/); 
    80  
    81     if(m) 
    82     { 
    83       // Mailto 
    84       inputs.type = 'mailto'; 
    85       inputs.to = m[1]; 
    86       if(m[3]) 
    87       { 
    88         var args  = m[3].split('&'); 
    89         for(var x = 0; x<args.length; x++) 
    90         { 
    91           var j = args[x].match(/(subject|body)=(.*)/); 
    92           if(j) 
    93           { 
    94             inputs[j[1]] = decodeURIComponent(j[2]); 
    95           } 
    96         } 
    97       } 
    98     } 
    99     else if (anchor) 
    100     { 
    101       //Anchor-Link 
    102       inputs.type = 'anchor'; 
    103       inputs.anchor = anchor[1]; 
    104        
    105     } 
    106     else 
    107     { 
    108  
    109  
    110       if(a.getAttribute('onclick')) 
    111       { 
    112         var m = a.getAttribute('onclick').match(/window\.open\(\s*this\.href\s*,\s*'([a-z0-9_]*)'\s*,\s*'([a-z0-9_=,]*)'\s*\)/i); 
    113  
    114         // Popup Window 
    115         inputs.href   = href ? href : ''; 
    116         inputs.target = 'popup'; 
    117         inputs.p_name = m[1]; 
    118         inputs.p_options = [ ]; 
    119  
    120  
    121         var args = m[2].split(','); 
    122         for(var x = 0; x < args.length; x++) 
    123         { 
    124           var i = args[x].match(/(width|height)=([0-9]+)/); 
    125           if(i) 
    126           { 
    127             inputs['p_' + i[1]] = parseInt(i[2]); 
    128           } 
    129           else 
    130           { 
    131             inputs.p_options.push(args[x]); 
    132           } 
    133         } 
    134       } 
    135       else 
    136       { 
    137         // Normal 
    138         inputs.href   = href; 
    139         inputs.target = a.target; 
    140       } 
    141     } 
    142   } 
    143  
    144   var linker = this; 
    145  
    146   // If we are not editing a link, then we need to insert links now using execCommand 
    147   // because for some reason IE is losing the selection between now and when doOK is 
    148   // complete.  I guess because we are defocusing the iframe when we click stuff in the 
    149   // linker dialog. 
    150  
    151   this.a = a; // Why doesn't a get into the closure below, but if I set it as a property then it's fine? 
    152  
    153   var doOK = function() 
    154   { 
    155     //if(linker.a) alert(linker.a.tagName); 
    156     var a = linker.a; 
    157  
    158     var values = linker._dialog.hide(); 
    159     var atr = 
    160     { 
    161       href: '', 
    162       target:'', 
    163       title:'', 
    164       onclick:'' 
    165     }; 
    166  
    167     if(values.type == 'url') 
    168     { 
    169      if(values.href) 
    170      { 
    171        atr.href = values.href; 
    172        atr.target = values.target; 
    173        if(values.target == 'popup') 
    174        { 
    175  
    176          if(values.p_width) 
    177          { 
    178            values.p_options.push('width=' + values.p_width); 
    179          } 
    180          if(values.p_height) 
    181          { 
    182            values.p_options.push('height=' + values.p_height); 
    183          } 
    184          atr.onclick = 'if(window.parent && window.parent.Xinha){return false}window.open(this.href, \'' + (values.p_name.replace(/[^a-z0-9_]/i, '_')) + '\', \'' + values.p_options.join(',') + '\');return false;'; 
    185        } 
    186      } 
    187     } 
    188     else if(values.type == 'anchor') 
    189     { 
    190       if(values.anchor) 
    191       { 
    192         atr.href = values.anchor.value; 
    193       } 
    194     } 
    195     else 
    196     { 
    197       if(values.to) 
    198       { 
    199         atr.href = 'mailto:' + values.to; 
    200         if(values.subject) atr.href += '?subject=' + encodeURIComponent(values.subject); 
    201         if(values.body)    atr.href += (values.subject ? '&' : '?') + 'body=' + encodeURIComponent(values.body); 
    202       } 
    203     } 
    204  
    205     if(a && a.tagName.toLowerCase() == 'a') 
    206     { 
    207       if(!atr.href) 
    208       { 
    209         if(confirm(linker._dialog._lc('Are you sure you wish to remove this link?'))) 
    210         { 
    211           var p = a.parentNode; 
    212           while(a.hasChildNodes()) 
    213           { 
    214             p.insertBefore(a.removeChild(a.childNodes[0]), a); 
    215           } 
    216           p.removeChild(a); 
    217           linker.editor.updateToolbar(); 
    218           return; 
    219         } 
    220       } 
    221       else 
    222       { 
    223         // Update the link 
    224         for(var i in atr) 
    225         { 
    226           a.setAttribute(i, atr[i]); 
    227         } 
    228          
    229         // If we change a mailto link in IE for some hitherto unknown 
    230         // reason it sets the innerHTML of the link to be the  
    231         // href of the link.  Stupid IE. 
    232         if(Xinha.is_ie) 
    233         { 
    234           if(/mailto:([^?<>]*)(\?[^<]*)?$/i.test(a.innerHTML)) 
    235           { 
    236             a.innerHTML = RegExp.$1; 
    237           } 
    238         } 
    239       } 
    240     } 
    241     else 
    242     { 
    243       if(!atr.href) return true; 
    244  
    245       // Insert a link, we let the browser do this, we figure it knows best 
    246       var tmp = Xinha.uniq('http://www.example.com/Link'); 
    247       linker.editor._doc.execCommand('createlink', false, tmp); 
    248  
    249       // Fix them up 
    250       var anchors = linker.editor._doc.getElementsByTagName('a'); 
    251       for(var i = 0; i < anchors.length; i++) 
    252       { 
    253         var anchor = anchors[i]; 
    254         if(anchor.href == tmp) 
    255         { 
    256           // Found one. 
    257           if (!a) a = anchor; 
    258           for(var j in atr) 
    259           { 
    260             anchor.setAttribute(j, atr[j]); 
    261           } 
    262         } 
    263       } 
    264     } 
    265     linker.editor.selectNodeContents(a); 
    266     linker.editor.updateToolbar(); 
    267   }; 
    268  
    269   this._dialog.show(inputs, doOK); 
    270  
    271 }; 
    272  
    273 Linker.prototype._getSelectedAnchor = function() 
    274 { 
    275   var sel  = this.editor.getSelection(); 
    276   var rng  = this.editor.createRange(sel); 
    277   var a    = this.editor.activeElement(sel); 
    278   if(a != null && a.tagName.toLowerCase() == 'a') 
    279   { 
    280     return a; 
    281   } 
    282   else 
    283   { 
    284     a = this.editor._getFirstAncestor(sel, 'a'); 
    285     if(a != null) 
    286     { 
    287       return a; 
    288     } 
    289   } 
    290   return null; 
    291 }; 
    29253 
    29354Linker.prototype.onGenerateOnce = function() 
    29455{ 
    295   this._dialog = new Linker.Dialog(this); 
     56  Linker.loadAssets(); 
     57  this.loadFiles(); 
    29658}; 
    297 // Inline Dialog for Linker 
     59 
     60Linker.prototype.onUpdateToolbar = function() 
     61{  
     62  if (typeof dTree == 'undefined' || !Linker.methodsReady || !Linker.html || !this.files) 
     63  { 
     64    this.editor._toolbarObjects.createlink.state("enabled", false); 
     65  } 
     66  else this.onUpdateToolbar = null; 
     67}; 
    29868 
    29969Linker.Dialog_dTrees = [ ]; 
    30070 
     71Linker.loadAssets = function() 
     72{ 
     73  var self = Linker; 
     74  if (self.loading) return; 
     75  self.loading = true; 
     76  Xinha._getback(Xinha.getPluginDir("Linker") + '/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
     77  Xinha._loadback( Xinha.getPluginDir("Linker") + '/dTree/dtree.js', function() {Linker.dTreeReady = true; } ); 
     78  Xinha._getback( Xinha.getPluginDir("Linker") + '/dialog.html', function(getback) { self.html = getback; } ); 
     79} 
    30180 
    302 Linker.Dialog = function (linker) 
     81Linker.prototype.loadFiles = function() 
    30382{ 
    304   var  lDialog = this; 
    305   this.Dialog_nxtid = 0; 
    306   this.linker = linker; 
    307   this.id = { }; // This will be filled below with a replace, nifty 
    308  
    309   this.ready = false; 
    310   this.files  = false; 
    311   this.html   = false; 
    312   this.dialog = false; 
    313  
    314   // load the dTree script 
    315   this._prepareDialog(); 
    316  
    317 }; 
    318  
    319 Linker.Dialog.prototype._prepareDialog = function() 
    320 { 
    321   var lDialog = this; 
    322   var linker = this.linker; 
    323  
    324   // We load some stuff up int he background, recalling this function 
    325   // when they have loaded.  This is to keep the editor responsive while 
    326   // we prepare the dialog. 
    327   if(typeof dTree == 'undefined') 
    328   { 
    329     this.linker.editor.setLoadingMessage('Loading Tree script'); 
    330     Xinha._loadback(Xinha.getPluginDir("Linker") + '/dTree/dtree.js', 
    331                        function() {lDialog._prepareDialog(); } 
    332                       ); 
    333     return; 
    334   } 
    335  
    336   if(this.files === false) 
    337   { 
     83    var linker = this; 
    33884    if(linker.lConfig.backend) 
    33985    { 
    34086        //get files from backend 
    341         this.linker.editor.setLoadingMessage('Loading files from backend'); 
    34287        Xinha._postback(linker.lConfig.backend, 
    34388                          linker.lConfig.backend_data, 
    34489                          function(txt) { 
    34590                            try { 
    346                                 lDialog.files = eval(txt); 
     91                                linker.files = eval(txt); 
    34792                            } catch(Error) { 
    348                                 lDialog.files = [ {url:'',title:Error.toString()} ]; 
     93                                linker.files = [ {url:'',title:Error.toString()} ]; 
    34994                            } 
    350                             lDialog._prepareDialog(); }); 
     95                            }); 
    35196    } 
    35297    else if(linker.lConfig.files != null) 
    35398    { 
    35499        //get files from plugin-config 
    355         lDialog.files = linker.lConfig.files; 
    356         lDialog._prepareDialog(); 
     100        linker.files = linker.lConfig.files; 
    357101    } 
    358     return; 
    359   } 
    360   var files = this.files; 
    361  
    362   if(this.html == false) 
    363   { 
    364     Xinha._getback(Xinha.getPluginDir("Linker") + '/dialog.html', function(txt) { lDialog.html = txt; lDialog._prepareDialog(); }); 
    365     return; 
    366   } 
    367   var html = this.html; 
    368  
    369   // Now we have everything we need, so we can build the dialog. 
    370   var dialog = this.dialog = new Xinha.Dialog(linker.editor, this.html, 'Linker',{width:600,height:400}); 
    371   var dTreeName = Xinha.uniq('dTree_'); 
    372  
    373   this.dTree = new dTree(dTreeName, Xinha.getPluginDir("Linker") + '/dTree/'); 
    374   eval(dTreeName + ' = this.dTree'); 
    375  
    376   this.dTree.add(this.Dialog_nxtid++, -1, linker.lConfig.treeCaption , null, linker.lConfig.treeCaption); 
    377   this.makeNodes(files, 0); 
    378  
    379   // Put it in 
    380   var ddTree = this.dialog.getElementById('dTree'); 
    381   //ddTree.innerHTML = this.dTree.toString(); 
    382   ddTree.innerHTML = ''; 
    383 //  ddTree.style.position = 'absolute'; 
    384 //  ddTree.style.left = 1 + 'px'; 
    385  // ddTree.style.top =  0 + 'px'; 
    386   ddTree.style.overflow = 'auto'; 
    387   ddTree.style.height = '300px'; 
    388   if ( Xinha.is_ie ) 
    389   { 
    390     ddTree.style.styleFloat = "left"; 
    391   } 
    392   else 
    393   { 
    394     ddTree.style.cssFloat = "left"; 
    395   } 
    396   ddTree.style.backgroundColor = 'white'; 
    397   this.ddTree = ddTree; 
    398    
    399   this.dTree._linker_premade = this.dTree.toString(); 
    400  
    401   var options = this.dialog.getElementById('options'); 
    402   //options.style.position = 'absolute'; 
    403   //options.style.top      = 0   + 'px'; 
    404   //options.style.right    = 0   + 'px'; 
    405   options.style.width    = 320 + 'px'; 
    406   options.style.overflow = 'auto'; 
    407  
    408   // Hookup the resizer 
    409   this.dialog.rootElem.style.paddingBottom ="0"; 
    410   this.dialog.onresize = function() 
    411     { 
    412       var h = parseInt(dialog.height) - dialog.getElementById('h1').offsetHeight; 
    413       var w = parseInt(dialog.width)  - 330 ; 
    414  
    415       // An error is thrown with IE when trying to set a negative width or a negative height 
    416       // But perhaps a width / height of 0 is not the minimum required we need to set 
    417       if (w<0) w = 0; 
    418       if (h<0) h = 0; 
    419       //options.style.height = 
    420       lDialog.ddTree.style.height = h + 'px'; 
    421       lDialog.ddTree.style.width  = w + 'px'; 
    422     } 
    423   this.ready = true; 
    424   ddTree = null; 
    425   Xinha.freeLater(lDialog, 'ddTree'); 
    426   options = null; 
    427 }; 
    428  
    429 Linker.Dialog.prototype.makeNodes = function(files, parent) 
    430 { 
    431   for(var i = 0; i < files.length; i++) 
    432   { 
    433     if(typeof files[i] == 'string') 
    434     { 
    435       this.dTree.add(Linker.nxtid++, parent, 
    436                      files[i].replace(/^.*\//, ''), 
    437                      'javascript:document.getElementsByName(\'' + this.dialog.id.href + '\')[0].value=decodeURIComponent(\'' + encodeURIComponent(files[i]) + '\');document.getElementsByName(\'' + this.dialog.id.type + '\')[0].click();document.getElementsByName(\'' + this.dialog.id.href + '\')[0].focus();void(0);', 
    438                      files[i]); 
    439     } 
    440     else if(typeof files[i]=="object" && files[i] && typeof files[i].length==="number") // there seems to be a strange bug in IE that requires this complicated check, see #1197 
    441     { 
    442       var id = this.Dialog_nxtid++; 
    443       this.dTree.add(id, parent, files[i][0].replace(/^.*\//, ''), null, files[i][0]); 
    444       this.makeNodes(files[i][1], id); 
    445     } 
    446     else if(typeof files[i] == 'object') 
    447     { 
    448       if(files[i].children) { 
    449         var id = this.Dialog_nxtid++; 
    450       } else { 
    451         var id = Linker.nxtid++; 
    452       } 
    453  
    454       if(files[i].title) var title = files[i].title; 
    455       else if(files[i].url) var title = files[i].url.replace(/^.*\//, ''); 
    456       else var title = "no title defined"; 
    457       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);'; 
    458       else var link = ''; 
    459        
    460       this.dTree.add(id, parent, title, link, title); 
    461       if(files[i].children) { 
    462         this.makeNodes(files[i].children, id); 
    463       } 
    464     } 
    465   } 
    466 }; 
    467  
    468 Linker.Dialog.prototype._lc = Linker.prototype._lc; 
    469  
    470 Linker.Dialog.prototype.show = function(inputs, ok, cancel) 
    471 { 
    472   if(!this.ready) 
    473   { 
    474     var lDialog = this; 
    475     window.setTimeout(function() {lDialog.show(inputs,ok,cancel);},100); 
    476     return; 
    477   } 
    478  
    479   if(this.ddTree.innerHTML == '') 
    480   { 
    481     this.ddTree.innerHTML = this.dTree._linker_premade; 
    482   } 
    483  
    484   if(inputs.type=='url') 
    485   { 
    486     this.dialog.getElementById('urltable').sty