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 67 by isao-hara, Mon Aug 2 01:36:34 2010 UTC revision 68 by isao-hara, Mon Aug 2 22:30:22 2010 UTC
# Line 18  var editarea_w=80; Line 18  var editarea_w=80;
18  var editarea_h=10;  var editarea_h=10;
19  var MainTitle="Simple SVG Editor";  var MainTitle="Simple SVG Editor";
20    
21    var Config;
22    
23  var preview=null;  var preview=null;
24  var targetItem=null;  var targetItem=null;
25  var selectedItems=new Array();  var selectedItems=new Array();
# Line 27  var ex=0; Line 29  var ex=0;
29  var ey=0;  var ey=0;
30  var modeSVG=null;  var modeSVG=null;
31  var iSlideMgr='iSlideManager.php';  var iSlideMgr='iSlideManager.php';
 var MgrPath="";  
32  var nextId=1;  var nextId=1;
33    
34  var lineEdit=null;  var lineEdit=null;
# Line 103  function initEditor(name, dispname, size Line 104  function initEditor(name, dispname, size
104      preview.addEventListener("gesturechange", onGestureChange, false);      preview.addEventListener("gesturechange", onGestureChange, false);
105      preview.addEventListener("gestureend", onGestureEnd, false);      preview.addEventListener("gestureend", onGestureEnd, false);
106    }    }
107    restoreValues();    Config = new Configuration();
108      Config.restoreValues();
109  }  }
110    
111  //// localStorage  //// localStorage
112  function restoreValues(){  function Configuration(){
113    if(typeof(localStorage) == 'undefined'){ alert('local storage not suported'); }    this.MgrPath = "";
   MgrPath = localStorage.getItem('MgrPath') ? localStorage.getItem('MgrPath')  : "";  
   window.onbeforeuload=function(){ return saveChanges(); }  
114  }  }
115    
116  function clearAll(){  Configuration.prototype.restoreValues = function(){
117      if(typeof(localStorage) == 'undefined'){ alert('local storage not suported'); }
118      this.MgrPath = localStorage.getItem('MgrPath') ? localStorage.getItem('MgrPath')  : "";
119      window.onbeforeuload=function(){ return this.saveChanges(); }
120    }
121    Configuration.prototype.clearAll = function(){
122    localsStorage.clear();    localsStorage.clear();
123    restoreValudes();    this.restoreValudes();
124  }  }
125    Configuration.prototype.saveChanges = function(){
126  function saveChanges(){    localStorage.setItem('MgrPath', this.MgrPath);
   localStorage.setItem('MgrPath', MgrPath);  
127  }  }
128    
129  // initialize a database  // initialize a database
# Line 547  function createMenuBar(){ Line 551  function createMenuBar(){
551  //// Config  //// Config
552  function setConfig(){  function setConfig(){
553    var ele = document.getElementById('ServerURL');    var ele = document.getElementById('ServerURL');
554    MgrPath=ele.value;    Config.MgrPath=ele.value;
555    saveChanges();    Config.saveChanges();
556    alert("Done");    alert("Done");
557  }  }
558    
# Line 558  function configServer(){ Line 562  function configServer(){
562    
563    string += "<H1 class='title'>Server Configration</H1>\n";    string += "<H1 class='title'>Server Configration</H1>\n";
564    string += "<div class=\"input_form\">\n";    string += "<div class=\"input_form\">\n";
565    string += "Filename:<input id='ServerURL' name='url' value=\""+MgrPath+"\" size=\"80\"/><br>\n";    string += "Filename:<input id='ServerURL' name='url' value=\""+Config.MgrPath+"\" size=\"80\"/><br>\n";
566    string += "<button onClick=\"setConfig();hideItemById('popup'); \">Done</button>\n";    string += "<button onClick=\"setConfig();hideItemById('popup'); \">Done</button>\n";
567    string += "<button onClick=\"hideItemById('popup'); \">Cancel</button>\n";    string += "<button onClick=\"hideItemById('popup'); \">Cancel</button>\n";
568    string += "</div>\n";    string += "</div>\n";
# Line 1720  function postRequest(url, data, func){ Line 1724  function postRequest(url, data, func){
1724    var postData=createRequestData(data);    var postData=createRequestData(data);
1725    var obj=newXMLRequest();    var obj=newXMLRequest();
1726    
1727    obj.onreadystatechange = function(){    try{
1728      if (obj.readyState == 4 && obj.status == 200){      obj.onreadystatechange = function(){
1729        func(obj.responseText);        if (obj.readyState == 4){
1730            if (obj.status == 200){
1731              func(obj.responseText);
1732            }else{
1733              alert("Fail to postRequest: status="+obj.status);
1734              return;
1735            }
1736          }
1737      }      }
1738        obj.open("POST", url, true);
1739        obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
1740        obj.send(postData);
1741      }catch(e){
1742    }    }
   obj.open("POST", url, true);  
   obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");  
   obj.send(postData);  
1743  }  }
1744    
1745  function commnadFinishAlert(s){  function commnadFinishAlert(s){
# Line 1741  function uploadFileData(transaction, res Line 1753  function uploadFileData(transaction, res
1753    updata['datalob'] = data['datablob'];    updata['datalob'] = data['datablob'];
1754    updata['cmd'] = 'upload'    updata['cmd'] = 'upload'
1755    
1756    postRequest(MgrPath+iSlideMgr, updata, commnadFinishAlert);    postRequest(Config.MgrPath+iSlideMgr, updata, commnadFinishAlert);
1757  }  }
1758    
1759  function uploadFile(name){  function uploadFile(name){
# Line 1752  function getRemoteFileList(){ Line 1764  function getRemoteFileList(){
1764    var data=new Array();    var data=new Array();
1765    data['name'] = "SVG";    data['name'] = "SVG";
1766    data['cmd'] = "list";    data['cmd'] = "list";
1767    postRequest(MgrPath+iSlideMgr, data, fileSelectorOnServer);    postRequest(Config.MgrPath+iSlideMgr, data, fileSelectorOnServer);
1768  }  }
1769    
1770  function previewRemoteFile(content){  function previewRemoteFile(content){
# Line 1764  function getRemoteFile(name){ Line 1776  function getRemoteFile(name){
1776    var data=new Array();    var data=new Array();
1777    data['name'] = name;    data['name'] = name;
1778    data['cmd'] = "get";    data['cmd'] = "get";
1779    postRequest(MgrPath+iSlideMgr, data, previewRemoteFile);    postRequest(Config.MgrPath+iSlideMgr, data, previewRemoteFile);
1780  }  }
1781    
1782  function saveRemoteFile(content){  function saveRemoteFile(content){
# Line 1779  function downloadFile(name){ Line 1791  function downloadFile(name){
1791    data['cmd'] = "get";    data['cmd'] = "get";
1792    var datadiv = document.getElementById('tempdata');    var datadiv = document.getElementById('tempdata');
1793    datadiv.setAttribute('lfname', name);    datadiv.setAttribute('lfname', name);
1794    postRequest(MgrPath+iSlideMgr, data, saveRemoteFile);    postRequest(Config.MgrPath+iSlideMgr, data, saveRemoteFile);
1795  }  }
1796    
1797  function showRemoteFile(name){  function showRemoteFile(name){

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

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