1 Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
3 Ext.override(Ext.Panel,{
5 return { collapsed: this.collapsed };
9 var quick_msg = function(msg)
14 buttons: Ext.MessageBox.OK,
15 icon: Ext.MessageBox.INFO
19 var goto_url = function(www_url)
21 window.location = www_url;
24 $(document).ready(function(){
25 //----------------------------------------
26 // Django Library Page CSS Fix
27 /*var fix_library_css = function() {
28 Ext.fly('library-index-div').select('*').addClass('djangocss');
34 //----------------------------------------
35 // Dynamically Generate Panels from HTML!
36 var create_dynamic_panels = function(){
37 var wp_items = Ext.fly('west_panel_items');
38 var ul_items = wp_items.query('ul');
40 var dynamic_panels = new Array();
41 Ext.each(ul_items, function(ul) {
42 var panel_obj = new Ext.Panel({
46 //titleCollapse: true,
49 //stateId: 'freezer_panel_state',
53 //stateEvents: ['collapse', 'expand']
55 dynamic_panels.push(panel_obj);
57 return dynamic_panels;
60 var panel_bcmagic = new Ext.Panel({
63 contentEl: 'bcmagic_div',
67 var menuPanel = new Ext.Panel({
74 //cmargins: '2 2 0 2',
85 // Add dynamically generated panels from html and include barcode magic
86 items: create_dynamic_panels().concat([panel_bcmagic])
89 var get_east_panel_content = function(){
90 // East panel contentEl id is supplied in html div id of east_region_config.
91 var east_id = Ext.fly('east_region_config').dom.textContent;
93 // If no element exists with the supplied content id, report and error.
94 if (Ext.fly(east_id) == null){
95 return 'east_region_config_error';
100 var east_panel_content_id = get_east_panel_content();
101 if (east_panel_content_id.length > 0){
102 var eastPanel = new Ext.Panel({
105 //margins: '0 2 0 2',
109 collapseMode: 'mini',
111 contentEl: east_panel_content_id
114 var eastPanel = new Ext.Panel({
117 //margins: '0 2 0 2',
122 collapseMode: 'mini',
129 //-------------------------------
130 // Main Viewport Setup
131 //-------------------------------
132 var mainBorderPanel = new Ext.Viewport({
152 handler: function() { quick_msg('Messages can be fun!'); }
165 //title: 'Inner Panel',
166 contentEl: 'body_content',
173 //-------------------------------
175 //-------------------------------
176 var main_tb = Ext.getCmp('main_toolbar');
178 var add_buttons_from_html_left = function(main_tb){
179 var left_tbar_data = Ext.fly('left_tbar_data');
180 var div_array = left_tbar_data.query('div');
182 // Loop through each div since it defines a button and link or a spacer and add it to the right side of the toolbar
183 Ext.each(div_array, function(divobj) {
185 if (div_id == 'spacer'){
190 handler: function() { goto_url(divobj.getAttribute('href')); }
194 //return right_tbar_data;
197 var add_buttons_from_html_right = function(main_tb){
198 var right_tbar_data = Ext.fly('right_tbar_data');
199 var div_array = right_tbar_data.query('div');
201 // Loop through each div since it defines a button and link or a spacer and add it to the right side of the toolbar
202 Ext.each(div_array, function(divobj) {
204 if (div_id == 'spacer'){
209 handler: function() { goto_url(divobj.getAttribute('href')); }
213 //return right_tbar_data;
216 add_buttons_from_html_left(main_tb);
218 // Shifts the remaining toolbar options to the right side.
219 main_tb.add({ xtype: 'tbfill' });
220 var user_info = Ext.fly('login_info');
221 var logout_url = user_info.getAttribute('logouturl');
222 var login_url = user_info.getAttribute('loginurl');
224 if (user_info.getAttribute('authenticated') == 'true') {
227 text: 'User: ' + user_info.getAttribute('user')
230 add_buttons_from_html_right(main_tb);
234 handler: function() { goto_url(logout_url); }
240 handler: function() { goto_url(login_url) }