1 //<script type="text/javascript">
4 Roo.onReady(function(){
18 this.cookie = new Roo.state.CookieProvider({})
20 MainBody.layout = new Roo.BorderLayout(document.body, {
43 var layout = MainBody.layout;
44 MainBody.layout.beginUpdate();
45 var hd = this.layout.getEl().createChild( {
47 style: 'background-colour:#000; font-weight: bold;' +
49 'font-family:Arial,Verdana,\'Bitstream Vera Sans\',Helvetica,sans-serif;',
50 html: '<img src="../images/roojs_logo.jpg" height="25" align="right"/>' +
51 '<div style="margin-left:10px;margin-top:3px;">Roo Version 1.1.1 - Documentation</div>'
53 layout.add('north', new Roo.ContentPanel(hd, {fitToFrame:true, closable:false }));
55 //innerLayout.add('south', new Roo.ContentPanel('inner1', "More Information"));
56 //innerLayout.add('center', new Roo.ContentPanel('inner2')); // right bottom Tree
63 //var frame = this.layout.getEl().createChild({ tag:'div' , frameborder: "no"});
64 var frame = this.layout.getEl().createChild({ tag:'iframe' , id:'viewFrame', name:'viewFrame',frameborder: "no"});
69 this.preview = new Roo.ContentPanel(frame, {title:
70 ' <a target="viewFrame" href="/roojs1/buildSDK/indexPage.html">Contents / Examples</a>' +
76 //// ---- HANLE CLICKS ON OUR CHILD PAGE???
78 this.preview.getEl().on('click', function(e, target)
80 //console.log("click pressed?");
82 if(target = e.getTarget('a:not(.exi)', 3)) {
83 var cls = Roo.fly(target).getAttributeNS('roo', 'cls');
86 var member = Roo.fly(target).getAttributeNS('roo', 'member');
87 //this.loadClass(target.href, cls, member);
89 if (/^src\//.test(cls)) {
90 cls = cls.replace(/.js$/, ''); // get rid of .js for source links..
94 MainBody.loadPage("symbols/"+ cls +".html");
97 if(target.className == 'inner-link'){ // go to #
98 this.getActiveTab().scrollToSection(target.href.split('#')[1]);
101 window.open(target.href);
103 return; // no more...
105 if(target = e.getTarget('.micon', 2)){
108 var tr = Roo.fly(target.parentNode);
109 if(tr.hasClass('expandable')){
110 tr.toggleClass('expanded');
117 window.setInterval(function() {
119 //console.log("check");
120 if (CommentDialog.showCommentId.length) {
121 var id = '' + CommentDialog.showCommentId;
123 Roo.get(document.getElementsByTagName('iframe')[0]).setVisible(false);
126 CommentDialog.showCommentId= '';
130 CommentDialog.show(id);
132 }, 500); // check every half second..
137 var cp = this.layout.add('center', this.preview);
138 MainBody.loadPage("/roojs1/buildSDK/indexPage.html");
141 MainBody.layout.endUpdate();
143 CommentDialog.build();
145 Roo.get(document.getElementsByTagName('iframe')[0]).setVisibilityMode(Roo.Element.DISPLAY);
150 loadPage: function(src) {
151 this.preview.el.dom.src = src;
153 //this.preview.load(src);
169 var ct = MainBody.layout.getEl().createChild({tag:'div'});
170 var viewEl = ct.createChild({tag:'div'});
171 var folders = MainBody.layout.add('west',
172 new Roo.ContentPanel(ct, {
180 this.tree = new Roo.tree.TreePanel(viewEl, {
183 containerScroll: true,
184 ddGroup: 'organizerDD',
188 click : function(node, e) {
191 //console.log(node.attributes.openUrl);
192 if (!node.attributes.openUrl) {
195 MainBody.loadPage("symbols/"+ node.attributes.openUrl +".html");
197 //MainBody.layout.getRegion('center').getPanel(0).setTitle(ClassTree.getTitleHtml(file)); // methods
203 new Roo.tree.TreeSorter(this.tree, {folderSort:true});
204 var root = new Roo.tree.TreeNode({
209 this.tree.setRootNode(root);
211 function addNodes(parent, ar, pref)
214 if (nm.substring(0,1) == "_") { // skip desc..
217 //console.log("nm : " + nm + " = isNS:"+ar[nm]._isNS + " ? PN:" + nd.getDepth());
218 var hasChildNodes = ar[nm]._hasChildren && (ar[nm]._isNS || (parent.getDepth() < 1));
221 var nd = new Roo.tree.TreeNode( {
225 leaf : !hasChildNodes,
226 openUrl: ar[nm].hasOwnProperty('_full') ? ar[nm]._full : false,
230 // add a duplacate reference - if it's got children and
232 if (ar[nm]._hasChildren && (!ar[nm]._isNS) {
233 //console.log("Adding node.." + nm);
234 var xn = new Roo.tree.TreeNode( {
239 openUrl: ar[nm].hasOwnProperty('_full') ? ar[nm]._full : false
243 parent.appendChild(xn);
246 parent.appendChild(nd);
248 //if (typeof(ar[nm]) == "object") {
250 if (ar[nm]._hasChildren) {
251 //console.log("nm : " + nm + " = isNS:"+ar[nm]._isNS + " ? PN:" + nd.getDepth());
254 // namespace -- make a tre..
255 addNodes(nd, ar[nm],'');
260 addNodes(parent, ar[nm], pref + nm + '.');
274 // class tree comes from outside!!!
275 addNodes(root, ClassTree.nodes,'');
280 root.eachChild(function(n) { n.expand(); });
281 //new Roo.tree.TreeSorter(this.tree);
282 ///this.tree.expand();
289 ClassTree.nodes = { _hasChildren: true, _isNameSpace: true };
291 Roo.get('classlist').select('li').each( function(n) {
292 var dvs = n.select('div');
295 name : dvs.item(0).dom.innerHTML,
296 desc : '', //dvs.item(1).dom.innerHTML
297 isNS : dvs.item(0).getAttributeNS('roo','isns') == "yes"
299 //console.log("ADD: " + cn.name);
300 var nbits = cn.name.split(".");
302 // top is where we stick everything in...
304 var top= ClassTree.nodes;
306 for (var i = 0; i < nbits.length; i++) {
310 if (i == (nbits.length-1)) {
311 if (top.hasOwnProperty(nm)) {
312 top[nm]._full = cn.name;
313 top[nm]._desc = cn.desc;
316 top._hasChildren =true;
318 /// _parent : "Object", // not sure abou this bit!!!
321 _hasChildren : false ,
327 if (top.hasOwnProperty(nm)) {
331 top[nm] = { _hasChildren : false };
340 //console.log(ClassTree.nodes);
344 // load page into right hand panel....
347 getTitleHtml : function (file)
349 var bits = file.split(".");
350 // what about 'Gtk/G etc.'
351 if (bits.length < 2) {
354 // should not really happen..
355 if (!(bits[0] in classtree)) {
358 if (!(bits[1] in classtree[bits[0]])) {
361 var parent = classtree[bits[0]][bits[1]]._parent;
362 if (bits.length == 3) {
363 if (!(bits[2] in classtree[bits[0]][bits[1]])) {
366 parent = classtree[bits[0]][bits[1]][bits[2]]._parent;
370 var ret = "<u onclick=\"ClassTree.load('"+file+"')\">" + file + "</u> > ";
371 return ret + ClassTree.getTitleHtml(parent);
390 showCommentId: '', /// id of comment to show as scoping on konq/safari is borked
391 show: function (cls) {
395 this.form.setValues( {
396 "comment[title]" : "General Comment",
397 "comment[wikifile]" : cls
399 this.form.setValues( MainBody.cookie.state );
402 if (this.form.getValues()["comment[author]"].length) {
403 CommentDialog.form.items.items[4].focus();
405 CommentDialog.form.items.items[0].focus();
416 this.dialog = new Roo.LayoutDialog(Roo.id(), {
419 title: "Add Comment",
436 this.dialog.addKeyListener(27, this.hide, this);
437 this.dialog.addButton('Cancel', this.hide, this);
438 this.dialog.addButton('Submit', this.submit, this);
440 var layout = this.dialog.getLayout();
442 // create the dialog....
443 this.form = new Roo.form.Form({
447 actionfailed : function(f, act) {
448 cd.dialog.el.unmask();
449 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
450 // we dont do loads....
454 actioncomplete: function(f, act) {
456 cd.dialog.el.unmask();
459 //hopefully this hsould work!
461 while (p.parent != p) {
464 console.log("trying : " + "comments-" + cd.ids);
465 p.frames[0].document.getElementById("comments-" + cd.ids).contentDocument.location.reload();
474 // simple array store
475 var ctypes = new Roo.data.SimpleStore({
478 [ "General Comment" ],
488 new Roo.form.TextField({
489 fieldLabel: 'Your Name',
490 name: 'comment[author]',
493 autoCreate: {tag: "input", type: "text", size: "20", autocomplete: "on"}
495 new Roo.form.TextField({
496 fieldLabel: 'Your Email address',
497 name: 'comment[email]',
501 autoCreate: {tag: "input", type: "text", size: "20", autocomplete: "on"}
504 new Roo.form.TextField({
505 fieldLabel: 'Your Web site (optional)',
506 name: 'comment[url]',
511 new Roo.form.ComboBox({
512 fieldLabel: 'Type of Comment',
513 name: 'comment[title]',
515 forceSelection: true,
517 displayField:'value',
520 triggerAction: 'all',
521 defaultValue: "General Comment",
526 new Roo.form.TextArea({
527 fieldLabel: 'Comment',
528 name: 'comment[body]',
534 new Roo.form.Hidden({
535 name: 'comment[wikifile]',
538 new Roo.form.Hidden({
547 var ef = layout.getEl().createChild({tag: 'div', style: 'margin: 5px'});
548 ef.dom.style.margin = 10;
549 ef.dom.style.position = "fixed";
551 //console.log("form container");
556 var vp = layout.add('center', new Roo.ContentPanel(ef, {
561 this.form.render(ef.dom);
571 var cd = typeof(CommentDialog) == "undefined" ? parent.CommentDialog : CommentDialog;
572 if (!cd.form.isValid()) {
573 Roo.MessageBox.alert("Error", "Please Fill in all the details");
576 var p = cd.form.getValues();
578 var mb = typeof(MainBody) == "undefined" ? parent.MainBody : MainBody;
580 mb.cookie.set("comment[author]", p["comment[author]"]);
581 mb.cookie.set("comment[email]", p["comment[email]"]);
582 mb.cookie.set("comment[url]", p["comment[url]"]);
583 cd.dialog.el.mask("Saving Data");
586 cd.form.doAction('submit', {
587 url: '/blog.php/GtkDjsComments/' + cd.ids + '.html',
599 Roo.get(document.getElementsByTagName('iframe')[0]).setVisible(true);