Develop and Download Open Source Software

Browse Subversion Repository

Diff of /SvgEditor.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 68 by isao-hara, Mon Aug 2 22:30:22 2010 UTC revision 70 by isao-hara, Fri Aug 6 04:27:12 2010 UTC
# Line 91  var colors=new Array('none', '#ffffff', Line 91  var colors=new Array('none', '#ffffff',
91    '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'    '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'
92  );  );
93    
94    var  Editor;
95    
96  //// Initialize  //// Initialize
97  function initEditor(name, dispname, size){  function initEditor(name, dispname, size){
98    systemDB = initDB(name, dispname, size);    systemDB = (new TextEditor("Editor")).initDB(name, dispname, size);
99    fileSelector();    fileSelector();
100    preview=document.getElementById('preview');    preview=document.getElementById('preview');
101    if(preview){    if(preview){
# Line 127  Configuration.prototype.saveChanges = fu Line 129  Configuration.prototype.saveChanges = fu
129  }  }
130    
131  // initialize a database  // initialize a database
132  function initDB(name, dispname, size) {  function TextEditor(name){
133      this.db=null;
134      this.name=name;
135      eval(name+"= this;");
136      return this;
137    }
138    
139    TextEditor.prototype.initDB=function(name, dispname, size){
140    try {    try {
141      if (!window.openDatabase) {      if (!window.openDatabase) {
142        remote_only = true;        remote_only = true;
# Line 135  function initDB(name, dispname, size) { Line 144  function initDB(name, dispname, size) {
144        return null;        return null;
145      } else {      } else {
146        var version = '1.0';        var version = '1.0';
147        var myDB = openDatabase(name, version, dispname, size);        this.db = openDatabase(name, version, dispname, size);
148        createTables(myDB);        this.createTables();
149        return myDB;        return this.db;
150      }      }
151    }catch(e){    }catch(e){
152      if (e == INVALID_STATE_ERR){ alert("Invalid database version."); }else{ alert("Unknown error "+e+"."); }      if (e == INVALID_STATE_ERR){ alert("Invalid database version."); }else{ alert("Unknown error "+e+"."); }
# Line 145  function initDB(name, dispname, size) { Line 154  function initDB(name, dispname, size) {
154    }    }
155  }  }
156    
157  function createTables(db) {  TextEditor.prototype.createTables=function(){
158    db.transaction(    this.db.transaction(
159      function (transaction) {      function (transaction) {
160        transaction.executeSql('CREATE TABLE IF NOT EXISTS files(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, filedata_id INTEGER NOT NULL, deleted INTEGER NOT NULL DEFAULT 0);', [], nullDataHandler, killTransaction);        transaction.executeSql('CREATE TABLE IF NOT EXISTS files(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, filedata_id INTEGER NOT NULL, deleted INTEGER NOT NULL DEFAULT 0);', [], this.nullDataHandler, this.killTransaction);
161        transaction.executeSql('CREATE TABLE IF NOT EXISTS filedata(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, datablob BLOB NOT NULL DEFAULT "");', [], nullDataHandler, errorHandler);        transaction.executeSql('CREATE TABLE IF NOT EXISTS filedata(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, datablob BLOB NOT NULL DEFAULT "");', [], this.nullDataHandler, this.errorHandler);
162      }      }
163    );    );
164  }  }
165    
166  function dropTables(db) {  TextEditor.prototype.dropTable=function(){
167    db.transaction(    this.db.transaction(
168      function (transaction) {      function (transaction) {
169        transaction.executeSql('DROP TABLE files;');        transaction.executeSql('DROP TABLE files;');
170        transaction.executeSql('DROP TABLE filedata;');        transaction.executeSql('DROP TABLE filedata;');
171      }      }
172    );    );
173  }  }
   
174  /// Create New File  /// Create New File
175  function reallyCreateNewFileAction(name, db){  TextEditor.prototype.reallyCreateNewFileAction=function(name){
176    var myDB = db;    this.db.transaction(
   if(!db) myDB = systemDB;  
   
   myDB.transaction(  
177      function (transaction) {      function (transaction) {
178        var myfunc = new Function("transaction","results","transaction.executeSql('INSERT INTO files (name, filedata_id) VALUES (?, ?);', [ '"+name+"', results.insertId], nullDataHandler, killTransaction);");        var myfunc = new Function("transaction","results","transaction.executeSql('INSERT INTO files (name, filedata_id) VALUES (?, ?);', [ '"+name+"', results.insertId], "+this.name+".nullDataHandler,"+this.name+".killTransaction);");
179           transaction.executeSql('INSERT INTO filedata (datablob) VALUES ("");', [], myfunc, this.errorHandler);
        transaction.executeSql('INSERT INTO filedata (datablob) VALUES ("");', [], myfunc, errorHandler);  
180      }      }
181    );    );
182    fileSelector();    fileSelector();
183  }  }
184    
185  function createNewFileAction(db){  TextEditor.prototype.createNewFileAction=function(){
   var myDB = db;  
   if(!db) myDB = systemDB;  
   
186    var name = document.getElementById('createFilename').value    var name = document.getElementById('createFilename').value
187    if(name == "") {    if(name == "") {
188      if (confirm('Filename is required, try agein?')) { createNewFile(); }else{ fileSelector(); }      if (confirm('Filename is required, try agein?')) { createNewFile(); }else{ fileSelector(); }
189      return;      return;
190    }    }
191    
192    myDB.transaction(    this.db.transaction(
193      new Function("transaction", "transaction.executeSql('SELECT id,name from files where name=?;',['"+name+"'],"+      new Function("transaction", "transaction.executeSql('SELECT id,name from files where name=?;',['"+name+"'],"+
194          "function (transaction, results) {"+          "function (transaction, results) {"+
195             "if(results.rows.length == 0){"+             "if(results.rows.length == 0){"+
196                 "reallyCreateNewFileAction('"+name+"');"+                 this.name+".reallyCreateNewFileAction('"+name+"');"+
197             "}else{"+             "}else{"+
198               "if (confirm(results.rows.item(0)['name']+' already exist, try agein?')) {"+               "if (confirm(results.rows.item(0)['name']+' already exist, try agein?')) {"+
199                 "createNewFile();"+                 "createNewFile();"+
# Line 200  function createNewFileAction(db){ Line 201  function createNewFileAction(db){
201                 "fileSelector();"+                 "fileSelector();"+
202               "}"+               "}"+
203             "}"+             "}"+
204          "}, errorHandler);")          "}, "+this.name+".errorHandler);")
205    );    );
   
206  }  }
207    
208  //// Delete File  //// Delete File
209  function deleteUpdateResults(transaction, results){  TextEditor.prototype.deleteUpdateResults=function(transaction, results){
210    if (results.rowsAffected) {    if (results.rowsAffected) { fileSelector(); }
     fileSelector();  
   }  
211  }  }
212    
213  function reallyDelete(id, db){  TextEditor.prototype.reallyDelete=function(id){
214    var myDB = db;    this.db.transaction(
   if(!db) myDB = systemDB;  
   
   myDB.transaction(  
215      new Function("transaction",      new Function("transaction",
216        "transaction.executeSql('DELETE FROM  files where id=?;', [ "+id+" ], null, errorHandler);"        "transaction.executeSql('DELETE FROM  files where id=?;', ["+id+"], null, "+this.name+".errorHandler);"
217        +"transaction.executeSql('DELETE FROM filedata where id=?;', [ "+id+" ], deleteUpdateResults, errorHandler);")       +"transaction.executeSql('DELETE FROM filedata where id=?;',["+id+"],"+this.name+".deleteUpdateResults, "+
218          this.name+".errorHandler);")
219    );    );
220  }  }
221    
222  function deleteFile(name, db){  TextEditor.prototype.deleteFile=function(name){
223    var myDB = db;    this.db.transaction(
   if(!db) myDB = systemDB;  
   
   myDB.transaction(  
224      new Function("transaction", "transaction.executeSql('SELECT id,name from files where name=?;',['"+name+"'],"+      new Function("transaction", "transaction.executeSql('SELECT id,name from files where name=?;',['"+name+"'],"+
225          "function (transaction, results) {"+          "function (transaction, results) {"+
226             "if (confirm('Really delete '+results.rows.item(0)['name']+'?')) {"+             "if (confirm('Really delete '+results.rows.item(0)['name']+'?')) {"+
227                 "reallyDelete(results.rows.item(0)['id']);"+                 this.name+".reallyDelete(results.rows.item(0)['id']);"+
228             "}"+             "}"+
229          "}, errorHandler);")          "}, "+this.name+".errorHandler);")
230    );    );
231  }  }
232    
233  function reallyDeleteAll(db){  TextEditor.prototype.reallyDeleteAll=function(){
234    var myDB = db;    this.transaction(
   if(!db) myDB = systemDB;  
   
   myDB.transaction(  
235      new Function("transaction",      new Function("transaction",
236        "transaction.executeSql('DELETE FROM  files;',[],null, errorHandler);"        "transaction.executeSql('DELETE FROM  files;',[],null, "+this.name+".errorHandler);"
237        +"transaction.executeSql('DELETE FROM filedata;',[],deleteUpdateResults, errorHandler);")       +"transaction.executeSql('DELETE FROM filedata;',[],"+this.name+".deleteUpdateResults, "+this.name+".errorHandler);")
238    );    );
239  }  }
240    
241  function deleteAllFile(db){  TextEditor.prototype.deleteAllFile=function(){
242    if (confirm('Really delete all file?')) {    if (confirm('Really delete all file?')) { this.reallyDeleteAll(); }
      reallyDeleteAll(db);  
   }  
243  }  }
244    
245  ///// Rename  ///// Rename
246  function reallyRenameFileAction(id, newname, db){  TextEditor.prototype.reallyRenameFileAction=function(id, newname){
247    var myDB = db;    this.db.transaction(
   if(!db) myDB = systemDB;  
   
   myDB.transaction(  
248      function (transaction) {      function (transaction) {
249        transaction.executeSql('UPDATE files set name=? where id=?;', [newname,id ], null, errorHandler);        transaction.executeSql('UPDATE files set name=? where id=?;', [newname,id ], null, this.errorHandler);
250      }      }
251    );    );
252    fileSelector();    fileSelector();
253  }  }
254    
255  function renameFileAction(db){  TextEditor.prototype.renameFileAction=function(){
256    var myDB = db;    var new_name = document.getElementById('newFilename').value;
257    if(!db) myDB = systemDB;    var id = document.getElementById('fileId').value;
   
   var new_name = document.getElementById('newFilename').value  
   var id = document.getElementById('fileId').value  
   
   if(new_name == "") {  
     alert('Filename is required.');  
     fileSelector();  
     return;  
   }  
258    
259    myDB.transaction(    if(new_name == "") { alert('Filename is required.'); fileSelector(); return; }
260      this.db.transaction(
261      new Function("transaction",      new Function("transaction",
262        "transaction.executeSql('SELECT id,name from files where name=?;',['"+new_name+"'],"+        "transaction.executeSql('SELECT id,name from files where name=?;',['"+new_name+"'],"+
263          "function (transaction, results) {"+          "function (transaction, results) {"+
264             "if(results.rows.length == 0){"+             "if(results.rows.length == 0){"+
265                 "reallyRenameFileAction('"+id+"','"+new_name+"');"+               this.name+".reallyRenameFileAction('"+id+"','"+new_name+"');"+
266             "}else{"+             "}else{"+
267               "alert(results.rows.item(0)['name']+' already exist');"+               "alert(results.rows.item(0)['name']+' already exist');"+
268               "fileSelector();"+               "fileSelector();"+
269             "}"+             "}"+
270          "}, errorHandler);")          "}, "+this.name+".errorHandler);")
271    );    );
   
272  }  }
273    
274  /// Save File  /// Save File
275  function saveFile(db){  TextEditor.prototype.saveFile=function(){
   var myDB = db;  
   if(!db) myDB = systemDB;  
   
276    var editarea = document.getElementById('editarea');    var editarea = document.getElementById('editarea');
277    var contents = "";    var contents = "";
278    contents = editarea.value;    contents = editarea.value;
279    
280    myDB.transaction(    this.saveContent(contents);
     function (transaction) {  
       var datadiv = document.getElementById('tempdata');  
       var filedata_id = datadiv.getAttribute('lfdataid');  
   
       transaction.executeSql("UPDATE filedata set datablob=? where id=?;",  
         [ contents, filedata_id ], nullDataHandler, errorHandler);  
   
       alert('Saved.');  
     }  
   );  
281  }  }
282    
283  function saveData(db){  TextEditor.prototype.saveData=function(){
   var myDB = db;  
   if(!db) myDB = systemDB;  
   
284    var contents = "";    var contents = "";
285    contents = getSVGContent();    contents = getSVGContent();
286      this.saveContent(contents);
   myDB.transaction(  
     function (transaction) {  
       var datadiv = document.getElementById('tempdata');  
       var filedata_id = datadiv.getAttribute('lfdataid');  
   
       transaction.executeSql("UPDATE filedata set datablob=? where id=?;",  
         [ contents, filedata_id ], nullDataHandler, errorHandler);  
   
       alert('Saved.');  
     }  
   );  
287  }  }
288    
289  function saveContent(contents, db){  TextEditor.prototype.saveContent=function(contents){
290    var myDB = db;    if(!contents) { alert("Invalid content"); return; }
   if(!db) myDB = systemDB;  
   
   if(!contents) {  
     alert("Invalid content");  
     return;  
   }  
291    
292    myDB.transaction(    this.db.transaction(
293      function (transaction) {      function (transaction) {
294        var datadiv = document.getElementById('tempdata');        var datadiv = document.getElementById('tempdata');
295        var filedata_id = datadiv.getAttribute('lfdataid');        var filedata_id = datadiv.getAttribute('lfdataid');
296    
297        transaction.executeSql("UPDATE filedata set datablob=? where id=?;",        transaction.executeSql("UPDATE filedata set datablob=? where id=?;",
298          [ contents, filedata_id ], nullDataHandler, errorHandler);          [ contents, filedata_id ], this.nullDataHandler, this.errorHandler);
299    
300        alert('Saved.');        alert('Saved.');
301      }      }
302    );    );
303  }  }
304    
305  function reallySaveNewFileAction(fname, db){  TextEditor.prototype.reallySaveNewFileAction=function(fname){
   var myDB = db;  
   if(!db) myDB = systemDB;  
   
306    var datadiv = document.getElementById('tempdata');    var datadiv = document.getElementById('tempdata');
307    content = datadiv.textContent;    content = datadiv.textContent;
308    
309    myDB.transaction(    this.db.transaction(
310      function (transaction) {      function (transaction) {
311        var myfunc = new Function("transaction", "results", "transaction.executeSql('INSERT INTO files (name, filedata_id) VALUES (?, ?);', [ '"+fname+"', results.insertId], nullDataHandler, killTransaction);");        var myfunc = new Function("transaction", "results", "transaction.executeSql('INSERT INTO files (name, filedata_id) VALUES (?, ?);', [ '"+fname+"', results.insertId], "+this.name+".nullDataHandler, "+this.name+".killTransaction);");
312    
313         transaction.executeSql('INSERT INTO filedata (datablob) VALUES (?);', [content], myfunc, errorHandler);         transaction.executeSql('INSERT INTO filedata (datablob) VALUES (?);', [content], myfunc, this.errorHandler);
314      }      }
315    );    );
316    datadiv.textContent="";    datadiv.textContent="";
317    alert("download to "+fname);    alert("download to "+fname);
318  }  }
319    
320  function saveContentFilename(id, db){  TextEditor.prototype.saveContentFilename=function(id){
321    var datadiv = document.getElementById('tempdata');    var datadiv = document.getElementById('tempdata');
322    datadiv.setAttribute('lfdataid', id);    datadiv.setAttribute('lfdataid', id);
323    saveContent(datadiv.innerHTML, db);    this.saveContent(datadiv.innerHTML);
324    datadiv.textContent="";    datadiv.textContent="";
325  }  }
326    
327  function saveContentWithFilename(fname, contents, db){  TextEditor.prototype.saveContentWithFilename=function(fname, contents){
   var myDB = db;  
   if(!db) myDB = systemDB;  
328    if(!contents) { alert("Invalid content"); return; }    if(!contents) { alert("Invalid content"); return; }
329    
330    var datadiv = document.getElementById('tempdata');    var datadiv = document.getElementById('tempdata');
331    datadiv.setAttribute('lfname', fname);    datadiv.setAttribute('lfname', fname);
332    datadiv.textContent = contents;    datadiv.textContent = contents;
333    
334    myDB.transaction(    this.db.transaction(
335      new Function("transaction", "transaction.executeSql('SELECT id,name from files where name=?;',['"+fname+"'],"+      new Function("transaction", "transaction.executeSql('SELECT id,name from files where name=?;',['"+fname+"'],"+
336          "function (transaction, results) {"+          "function (transaction, results) {"+
337             "if(results.rows.length == 0){"+             "if(results.rows.length == 0){"+
338                 "reallySaveNewFileAction('"+fname+"');"+                this.name+".reallySaveNewFileAction('"+fname+"');"+
339             "}else{"+             "}else{"+
340               "if (confirm(results.rows.item(0)['name']+' already exist, Overwrite?')) {"+               "if (confirm(results.rows.item(0)['name']+' already exist, Overwrite?')) {"+
341                 "saveContentFilename(results.rows.item(0)['id']);"+                 this.name+".saveContentFilename(results.rows.item(0)['id']);"+
342               "}else{"+               "}else{"+
343                 "fileSelector();"+                 "fileSelector();"+
344               "}"+               "}"+
345             "}"+             "}"+
346          "}, errorHandler);")          "}, "+this.name+".errorHandler);")
347    );    );
   
 }  
   
 function showFileData(transaction, results){  
   var data = results.rows.item(0);  
   var filename = data['name'];  
   var filedata = data['datablob'];  
   
   var datadiv = document.getElementById('tempdata');  
   datadiv.setAttribute('lfdataid', parseInt(data['filedata_id']));  
   document.title=filename;  
   
   previewFile(filedata);  
   
   updateShowMenu();  
   setMode('Preview');  
348  }  }
349    
350  function showFile(name){ getFile(name, 'showFileData'); }  TextEditor.prototype.getFile=function(name,func){
   
 function getFile(name, func, db){  
   var myDB = db;  
   if(!db) myDB = systemDB;  
   
351    var datadiv = document.getElementById('tempdata');    var datadiv = document.getElementById('tempdata');
352    if(datadiv) datadiv.setAttribute('lfname', name);    if(datadiv) datadiv.setAttribute('lfname', name);
353    
354    myDB.transaction(    this.db.transaction(
355      function (transaction) {      function (transaction) {
356        transaction.executeSql('SELECT * from files, filedata where files.name=? and files.filedata_id = filedata.id;', [name], eval(func), errorHandler);        transaction.executeSql('SELECT * from files, filedata where files.name=? and files.filedata_id = filedata.id;', [name], eval(func), this.errorHandler);
357      }      }
358    );    );
359  }  }
360    TextEditor.prototype.showFile=function(name){ this.getFile(name, 'showFileData'); }
361    
362    TextEditor.prototype.killTransaction=function(transaction, error){ return true; }
363    
364  //  Error Handlers  TextEditor.prototype.errorHandler=function(transaction, error){
 function killTransaction(transaction, error){ return true; }  
   
 function errorHandler(transaction, error){  
365    alert('Oops.  Error was '+error.message+' (Code '+error.code+')');    alert('Oops.  Error was '+error.message+' (Code '+error.code+')');
366    
367    var we_think_this_error_is_fatal = true;    this.we_think_this_error_is_fatal = true;
368    if (we_think_this_error_is_fatal) return true;    if (this.we_think_this_error_is_fatal) return true;
369    return false;    return false;
370  }  }
371    
372  function nullDataHandler(transaction, results){ }  TextEditor.prototype.nullDataHandler=function(transaction, results){ }
373    
374  /////////  TextEditor.prototype.fileSelector=function(){
375  function fileSelector(db) {    this.db.transaction(
   var myDB = db;  
   if(!db) myDB = systemDB;  
   
   if(!myDB){  
     getRemoteFileList();  
     return;  
   }  
   myDB.transaction(  
376      function (transaction) {      function (transaction) {
377        transaction.executeSql("SELECT * from files where deleted=0;", [ ],        transaction.executeSql("SELECT * from files where deleted=0;", [ ],
378           function (transaction, results) {           function (transaction, results) {
# Line 481  function fileSelector(db) { Line 390  function fileSelector(db) {
390                }                }
391                menuDiv.innerHTML="<H1 class='title'>"+MainTitle+"</H1>"+createMenuBar()+filelist;                menuDiv.innerHTML="<H1 class='title'>"+MainTitle+"</H1>"+createMenuBar()+filelist;
392              }              }
393            }, errorHandler);            }, this.errorHandler);
394      }      }
395    );    );
396    }
397    
398    
399    function showFileData(transaction, results){
400      var data = results.rows.item(0);
401      var filename = data['name'];
402      var filedata = data['datablob'];
403    
404      var datadiv = document.getElementById('tempdata');
405      datadiv.setAttribute('lfdataid', parseInt(data['filedata_id']));
406      document.title=filename;
407    
408      previewFile(filedata);
409    
410      updateShowMenu();
411      setMode('Preview');
412    }
413    
414    
415    
416    /////////
417    function fileSelector() {
418      if(!systemDB){
419        getRemoteFileList();
420      }else{
421        Editor.fileSelector();
422      }
423    setMode('List');    setMode('List');
424  }  }
425    
# Line 527  function fileEntry(row){ Line 463  function fileEntry(row){
463    var files_id = row['id'];    var files_id = row['id'];
464    
465    var res =  "<tr class='filerow'>";    var res =  "<tr class='filerow'>";
466    res += "<td class='filenamecell'  onClick=\"showFile('"+name+"');\">"+name+"</td>";    res += "<td class='filenamecell'  onClick=\"Editor.showFile('"+name+"');\">"+name+"</td>";
467    res += "<td class='filelinkcell'>";    res += "<td class='filelinkcell'>";
468    res += "<button class='blue' onClick=\"editFile('"+name+"');\">&nbsp;Edit&nbsp;</button> &nbsp;";    res += "<button class='blue' onClick=\"editFile('"+name+"');\">&nbsp;Edit&nbsp;</button> &nbsp;";
469    res += "<button class='green' onClick=\"renameFile('"+name+"',"+files_id+");\">&nbsp;Rename&nbsp;</button> &nbsp;";    res += "<button class='green' onClick=\"renameFile('"+name+"',"+files_id+");\">&nbsp;Rename&nbsp;</button> &nbsp;";
470    res += "<button  onClick=\"uploadFile('"+name+"');\">Upload</button>";    res += "<button  onClick=\"uploadFile('"+name+"');\">Upload</button>";
471    res += "<button class='red' onClick=\"deleteFile('"+name+"');\">Delete</button>";    res += "<button class='red' onClick=\"Editor.deleteFile('"+name+"');\">Delete</button>";
472    res += "</td></tr>\n";    res += "</td></tr>\n";
473    
474    return res;    return res;
# Line 579  function createNewFile(){ Line 515  function createNewFile(){
515    string += "<H1 class='title'>Create New File</H1>\n";    string += "<H1 class='title'>Create New File</H1>\n";
516    string += "<div class=\"input_form\">\n";    string += "<div class=\"input_form\">\n";
517    string += "Filename:<input id='createFilename' name='name' value=\"\" />\n";    string += "Filename:<input id='createFilename' name='name' value=\"\" />\n";
518    string += "<button onClick=\"createNewFileAction();hideItemById('popup'); \">Create</button>\n";    string += "<button onClick=\"Editor.createNewFileAction();hideItemById('popup'); \">Create</button>\n";
519    string += "<button onClick=\"hideItemById('popup'); \">Cancel</button>\n";    string += "<button onClick=\"hideItemById('popup'); \">Cancel</button>\n";
520    string += "</div>\n";    string += "</div>\n";
521    
# Line 597  function renameFile(name, id){ Line 533  function renameFile(name, id){
533    string += "Old Filename: "+name+"<br>";    string += "Old Filename: "+name+"<br>";
534    string += "New Filename:<input id='newFilename' name='newname' value=\"\" />\n";    string += "New Filename:<input id='newFilename' name='newname' value=\"\" />\n";
535    string += "<input type='hidden' id='fileId' value=\""+id+"\" /><br>\n";    string += "<input type='hidden' id='fileId' value=\""+id+"\" /><br>\n";
536    string += "<button onClick=\"renameFileAction();hideItemById('popup');\">Rename</button>\n";    string += "<button onClick=\"Editor.renameFileAction();hideItemById('popup');\">Rename</button>\n";
537    string += "<button onClick=\"hideItemById('popup'); \">Cancel</button>\n";    string += "<button onClick=\"hideItemById('popup'); \">Cancel</button>\n";
538    string += "</div>\n";    string += "</div>\n";
539    
# Line 710  function editFile(name){ Line 646  function editFile(name){
646    
647       setMode('Edit');       setMode('Edit');
648     }else{     }else{
649       getFile(name, 'editFileData');       Editor.getFile(name, 'editFileData');
650     }     }
651  }  }
652    
# Line 729  function updateShowMenu(){ Line 665  function updateShowMenu(){
665    var menu_str = "<img src=\"images/menu.png\" usemap=\"#topmenu\" />\n";    var menu_str = "<img src=\"images/menu.png\" usemap=\"#topmenu\" />\n";
666    menu_str+= "<map name=\"topmenu\">";    menu_str+= "<map name=\"topmenu\">";
667    menu_str+= "<area shape=\"rect\" coords=\"0,0,30,25\"  onClick=\"fileSelector();\">";    menu_str+= "<area shape=\"rect\" coords=\"0,0,30,25\"  onClick=\"fileSelector();\">";
668    menu_str+= "<area shape=\"rect\" coords=\"30,0,60,25\" onClick=\"saveData();\">";    menu_str+= "<area shape=\"rect\" coords=\"30,0,60,25\" onClick=\"Editor.saveData();\">";
669    menu_str+= "<area shape=\"rect\" coords=\"60,0,90,25\" onClick=\"showSVGSource();\">";    menu_str+= "<area shape=\"rect\" coords=\"60,0,90,25\" onClick=\"showSVGSource();\">";
670    menu_str+= "</map>";    menu_str+= "</map>";
671    
# Line 1757  function uploadFileData(transaction, res Line 1693  function uploadFileData(transaction, res
1693  }  }
1694    
1695  function uploadFile(name){  function uploadFile(name){
1696     getFile(name, 'uploadFileData');     Editor.getFile(name, 'uploadFileData');
1697  }  }
1698    
1699  function getRemoteFileList(){  function getRemoteFileList(){
# Line 1782  function getRemoteFile(name){ Line 1718  function getRemoteFile(name){
1718  function saveRemoteFile(content){  function saveRemoteFile(content){
1719    var datadiv = document.getElementById('tempdata');    var datadiv = document.getElementById('tempdata');
1720    var fname = datadiv.getAttribute('lfname');    var fname = datadiv.getAttribute('lfname');
1721    saveContentWithFilename(fname, content);    Editor.saveContentWithFilename(fname, content);
1722  }  }
1723    
1724  function downloadFile(name){  function downloadFile(name){
# Line 1900  function addAttributeVal(obj, itm, dv){ Line 1836  function addAttributeVal(obj, itm, dv){
1836  function showSVGSource(){  function showSVGSource(){
1837    var str = getSVGContent();    var str = getSVGContent();
1838    var escstr="<button onClick=\"hideItemById('popup');\">Close</button>";    var escstr="<button onClick=\"hideItemById('popup');\">Close</button>";
1839    escstr+="<button onClick=\"saveContent(document.getElementById('ContentView').value); previewData(document.getElementById('ContentView').value);\">Save</button><hr> ";    escstr+="<button onClick=\"Editor.saveContent(document.getElementById('ContentView').value); previewData(document.getElementById('ContentView').value);\">Save</button><hr> ";
1840    escstr += "<textarea cols=\"100\" rows=\"30\" id=\"ContentView\">"+str+"</textarea>";    escstr += "<textarea cols=\"100\" rows=\"30\" id=\"ContentView\">"+str+"</textarea>";
1841    setInnerHTML('popup', escstr);    setInnerHTML('popup', escstr);
1842    showItemById('popup');    showItemById('popup');

Legend:
Removed from v.68  
changed lines
  Added in v.70

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26