2 "build_module" : "builder",
6 "@ void complete" : "(string result)",
7 "gboolean deletable" : true,
8 "gboolean modal" : true,
9 "gint default_height" : 500,
10 "gint default_width" : 750,
11 "id" : "DialogPluginWebkit",
15 "* pack" : "get_content_area().append",
16 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
17 "bool homogeneous" : false,
22 " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
27 "bool hexpand" : true,
28 "bool vexpand" : true,
34 " // this may not work!?",
35 " var settings = this.el.get_settings();",
36 " settings.enable_write_console_messages_to_stdout = true;",
38 " var fs= new FakeServer(this.el);",
40 " // this was an attempt to change the url perms.. did not work..",
41 " // settings.enable_file_access_from_file_uris = true;",
42 " // settings.enable_offline_web_application_cache - true;",
43 " // settings.enable_universal_access_from_file_uris = true;",
50 " // FIXME - base url of script..",
51 " // we need it so some of the database features work.",
52 " this.el.load_html( \"Render not ready\" , ",
53 " //fixme - should be a config option!",
54 " // or should we catch stuff and fix it up..",
55 " \"xhttp://localhost/roobuilder/\"",
64 "* pack" : "set_child",
69 " if (this.el == null) {",
73 " var msg = dialog.get_message();",
74 " if (msg.length < 4) {",
77 " if (msg.substring(0,4) != \"IPC:\") {",
80 " var ar = msg.split(\":\", 3);",
81 " if (ar.length < 3) {",
84 " print(\"CMD: %s\\n\",ar[1]);",
85 " print(\"ARGS: %s\\n\",ar[2]);",
88 " case \"SAVEHTML\":",
89 " // print(\"%sw\",ar[2]);",
90 " // _this.file.saveHTML(ar[2]);",
94 " _this.result_json = ar[2];",
107 "xtype" : "ScrolledWindow"
114 "* pack" : "add_action_widget,3",
120 "* pack" : "add_action_widget,0",
126 "* pack" : "add_action_widget,1",
133 "(response_id) => {",
136 "\t\t if (response_id == 1) { // OK...",
137 "\t\t var loop = new MainLoop();",
138 "\t\t // run toBJS to get the data... (calls back into alert handler)",
139 "\t\t _this.result_json = \"\";",
140 "\t\t this.webview.el.run_javascript.begin(\"Editor.\" + this.cls + \".panel.toBJS();\", null, (obj, res) => {",
142 "\t\t this.webview.el.run_javascript.end(res);",
143 "\t\t } catch(Error e) {",
149 "\t\t _this.complete(_this.result_json);",
152 "\t\t// print(\"LOOP END?\");",
153 "\t\t // try and get the resopse...",
156 "\t\t if (response_id < 1) {",
157 "\t\t this.el.hide();",
158 "\t\t _this.complete(\"\");",
160 "\t\t // keep showing...?",
166 "string result_json" : "",
168 "utf8 title" : "Add / Edit Component",
170 "| bool has_plugin" : [
173 " return GLib.FileUtils.test(",
174 " BuilderApplication.configDirectory() + \"/resources/Editors/Editor.\" + cls + \".js\",",
175 " GLib.FileTest.IS_REGULAR",
184 " // for result hook into complete",
186 " (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {",
188 " \tthis.cls = cls;",
190 " if (parent != null) {",
191 " this.el.set_transient_for(parent);",
192 " this.el.modal = true;",
194 " this.result_json = \"\";",
195 " var db = project.roo_database;",
201 " var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;",
202 " string builderhtml;",
205 " GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);",
206 " } catch (Error e) {",
207 " builderhtml = \"\";",
211 " runhtml += builderhtml + \"\\n\";",
214 " runhtml += \"\\n\" +",
215 " \"Builder.saveHTML = function() {};\\n\" + ",
216 "\t \"Roo.onReady(function() {\\n\" +",
218 "\t \"Roo.XComponent.build();\\n\" +",
224 " var ar = db.readForeignKeys(tbl);",
225 " var generator = new Json.Generator ();",
226 " var root = new Json.Node(Json.NodeType.OBJECT);",
227 " root.init_object(ar);",
228 " generator.set_root (root);",
230 " generator.pretty = true;",
231 " generator.indent = 4;",
233 " runhtml += \"\\n\" +",
234 " \" Roo.XComponent.on('buildcomplete', function() {\\n\" +",
235 " \" Editor.\" + cls + \".panel.loadData(\" + generator.to_data (null) + \"); \" +",
242 " runhtml += \"</script>\\n\" ;",
245 " // fix to make sure they are the same..",
247 " // need to modify paths",
251 " GLib.FileUtils.get_contents(",
252 " BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"",
255 " } catch (Error e) {",
258 " // fetch the json from the database...",
260 " //print(runhtml);",
262 " var html = inhtml.replace(\"</head>\", runhtml + // + this.runhtml + ",
263 " \"<script type=\\\"text/javascript\\\" src=\\\"resources://localhost/Editors/Editor.\" + cls + \".js\\\"></script>\" + ",
267 " //print(\"LOAD HTML \" + html);",
269 " //var rootURL = _this.file.project.rootURL;",
273 " this.webview.el.load_html( html , ",
274 " //fixme - should be a config option!",
275 " \"xhttp://localhost/roobuilder/\"",
288 "name" : "DialogPluginWebkit",
290 "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogPluginWebkit.bjs",