wn.ui.AppFrame = Class.extend({ init: function(parent, title) { this.buttons = {}; this.$w = $('
').appendTo(parent); this.$titlebar = $(' ').appendTo(this.$w); this.$w.find('.close').click(function() { window.history.back(); }) if(title) this.title(title); }, title: function(txt) { this.$titlebar.find('.appframe-title').html(txt); }, make_toolbar: function() { if(!this.$w.find('.appframe-toolbar').length) this.$w.append(''); }, add_button: function(label, click, icon) { this.make_toolbar(); args = { label: label, icon:'' }; if(icon) { args.icon = ''; } this.buttons[label] = $(repl('', args)) .click(click) .appendTo(this.$w.find('.appframe-toolbar')); return this.buttons[label]; }, add_help_button: function(txt) { this.make_toolbar(); $('') .data('help-text', txt) .click(function() { msgprint($(this).data('help-text'), 'Help'); }) .appendTo(this.$w.find('.appframe-toolbar')); }, clear_buttons: function() { this.$w.find('.appframe-toolbar').empty(); }, add_breadcrumb: function(html) { if(!this.$breadcrumbs) this.$breadcrumbs = $('\ ').appendTo(this.$titlebar); var crumb = $('').html(html); // first breadcrumb is a title if(!this.$breadcrumbs.find('span').length) { crumb.addClass('appframe-title'); } crumb.appendTo(this.$breadcrumbs); }, clear_breadcrumbs: function() { this.$breadcrumbs && this.$breadcrumbs.empty(); } }); // parent, title, single_column // standard page with appframe wn.ui.make_app_page = function(opts) { if(opts.single_column) { $(opts.parent).html('