Changeset 36031
- Timestamp:
- 11/29/09 12:53:16 (3 years ago)
- Location:
- lang/haxe/Tonyu2
- Files:
-
- 5 modified
-
File.hx (modified) (1 diff)
-
Project.hx (modified) (1 diff)
-
htdocs/Project.class.js (modified) (1 diff)
-
htdocs/TagBuilder.class.js (modified) (2 diffs)
-
ide/Main.hx (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/haxe/Tonyu2/File.hx
r36012 r36031 14 14 return buf; 15 15 } 16 public static function ls(dir:String):Array<String> { 17 var files=neko.FileSystem.readDirectory(dir); 18 return files; 19 } 16 20 } -
lang/haxe/Tonyu2/Project.hx
r36012 r36031 11 11 f.close(); 12 12 return buf;*/ 13 } 14 public function listTonyuSources():Array<String> { 15 var files=neko.FileSystem.readDirectory(getTonyuDir()); 16 var f; 17 var res=[]; 18 var tnf=~/^(\w[\w\d]+)\.tonyu$/; 19 for (f in files) { 20 if(tnf.match(f)) { 21 var cln=tnf.matched(1); 22 res.push(cln); 23 } 24 } 25 return res; 13 26 } 14 27 public function compile1Class(c:grm.Context,className:String) { -
lang/haxe/Tonyu2/htdocs/Project.class.js
r36014 r36031 1 function procAjax(p) { 2 return function (res) { 3 try { 4 p(res.responseText,res); 5 } catch(e) {alert(e);} 6 }; 7 } 1 8 Project =Class.create({ 2 9 initialize: function (name) { 3 10 this.name=name; 11 this.homeURL="project/"+name; 12 this.tonyuSrcURL=this.homeURL+"/tonyuSrc"; 4 13 }, 5 14 open: function () { 6 15 this.editor=tag("textarea",{rows:25 , cols:80}); 7 $tag("body").set([["div", "プロジェクト", this.name], this.editor ]); 16 this.fileList=tag("div"); 17 $tag("body").set([["div", "プロジェクト", this.name], 18 this.fileList, this.editor]); 8 19 attachIndentAdaptor(this.editor.target); 20 this.listTonyuSource(); 9 21 }, 10 loadTonyuSource: function(className) { 11 this.editor.value="Load "+className; 22 listTonyuSource: function() { 23 new Ajax.Request( 24 this.tonyuSrcURL , 25 { 26 method: 'GET', 27 parameters: {}, 28 onComplete: procAjax(showResponse) 29 }); 30 var t=this; 31 function showResponse(res) { 32 t.fileList.set(); 33 res.split(/\n/).each(function (r) { 34 t.fileList.add(["div", 35 ["a",{onclick: function () { 36 t.openTonyuSource(r); 37 }},r]]); 38 }); 39 } 40 }, 41 openTonyuSource: function (name) { 42 new Ajax.Request( 43 this.tonyuSrcURL+"/"+name , 44 { 45 method: 'GET', 46 parameters: {}, 47 onComplete: procAjax(showResponse) 48 }); 49 var t=this; 50 function showResponse(res) { 51 t.editor.setAttr("value",res); 52 } 12 53 } 13 54 }); -
lang/haxe/Tonyu2/htdocs/TagBuilder.class.js
r36011 r36031 83 83 setAttr: function (k,v) { 84 84 if (arguments.length==2) { 85 k={k:v}; 85 var p={};p[k]=v; 86 k=p; 86 87 } 87 88 return this.addObj(k); … … 289 290 } 290 291 } else { 292 //alert("Setting "+i+" -> "+ o[i]); 291 293 target[i]=o[i]; 292 294 } -
lang/haxe/Tonyu2/ide/Main.hx
r36015 r36031 7 7 8 8 static function main() { 9 trace("http://localhost:5000/ にアクセスしてください"); 9 10 httpd.Server.start(5000, loop ); 10 11 } … … 37 38 res.header.set("Content-type","text/plain; charset=utf8"); 38 39 var pName=path.shift(); 40 if (pName==null || pName=="") { 41 listProject(res); 42 return; 43 } 39 44 var p=getProject(pName); 40 45 var resource=path.shift(); … … 42 47 var name=path.shift(); 43 48 if (name==null || name=="") { 44 res.content=p.listTonyuSource ().join("\n");49 res.content=p.listTonyuSources().join("\n"); 45 50 } else { 46 res.content=p.getTonyuSource( path.shift());51 res.content=p.getTonyuSource(name); 47 52 } 48 53 } else { 49 54 res.content="invalid request in: "+p+" "+resource+" path="+path; 50 55 } 56 } 57 static function listProject(res:httpd.Response) { 58 res.content=File.ls(projectPath).join("\n"); 51 59 } 52 60 static var htdocsPath="htdocs";
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)