/* yasep/test/template.js
This file is distributed under terms of the Affero GPL v3 license or later, see http://yasep.org
created lun. sept. 12 08:52:50 CEST 2011
This is just an example of how to create the windows.
*/
// create an object of the chosen name, beware of namespace clutter !
init_obj.push(template={
win: null, // important : stores the ygwm id of the open window.
// this is set to null to indicate it is closed,
// !=null when open or hidden.
// This function creates, displays and populates/updates the ygwm window
start: function() {
// create a contents space to populate, patch and display
template.cont=dcE("DIV");
// import the htmi, giving the "path" that is automatically completed with the current language
template.cont.innerHTML=import_htmi("test/template");
// modify the tags to change the style and hook the proper handling routines
winman.patchInnerLinks(template.cont);
// get the hidden DIV where language-specific snippets are stored
var t, h=getByClass("hiddenDiv","DIV",template.cont);
template.win = ygwm.new_window(
hiddenText(0,h), null, template.cont,
500, 400, 250, 250, false, true, true, true, false, "WinOK");
// substitute a piece of text :
getById("template_id","SPAN",template.cont).innerHTML=hiddenText(1,h);
// Don't forget to return the window ID ! or else it won't be able to focus() it :-/
return template.win;
},
// this function is called at the "onload" stage, in index.js
// It creates the .menuItem object to remember where to activate/deactivate the menu item
init_obj: function(){
template.menuItem = menu.subMenuItem(menu.list["Dev"], // it's going to appear in the "windows" submenu
i8n.tmpl, // The different names under which it will appear in the menu
"test/template"); // the key to call
}
});
// dont forget to "register" the object so it can be called by other
// objects, with a "#!" tag in the HREF of the
//winman.register_key("test/template",template.start);
// ==> moved to a list in keys.js