lipsiadmin 4.1.8 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +41 -2
- data/lib/access_control/authentication.rb +1 -1
- data/lib/access_control/base.rb +18 -11
- data/lib/controller/ext.rb +5 -3
- data/lib/controller/pdf_builder.rb +22 -6
- data/lib/controller/responds_to_parent.rb +1 -1
- data/lib/data_base/attachment_table.rb +0 -1
- data/lib/lipsiadmin.rb +7 -0
- data/lib/mailer/pdf_builder.rb +23 -9
- data/lib/version.rb +3 -3
- data/lib/view/helpers/backend_helper.rb +137 -97
- data/lib/view/helpers/ext/button.rb +62 -0
- data/lib/view/helpers/ext/column_model.rb +29 -23
- data/lib/view/helpers/ext/component.rb +52 -40
- data/lib/view/helpers/ext/configuration.rb +3 -2
- data/lib/view/helpers/ext/grid.rb +38 -40
- data/lib/view/helpers/ext/store.rb +12 -12
- data/lib/view/helpers/ext/templates/grid_functions.js.erb +14 -9
- data/lib/view/helpers/ext/tool_bar.rb +9 -10
- data/lib/view/helpers/ext_helper.rb +3 -2
- data/lib/view/helpers/pdf_helper.rb +45 -0
- data/lipsiadmin_generators/attachment/REMEMBER +0 -4
- data/lipsiadmin_generators/attachment/templates/migration.rb +1 -1
- data/lipsiadmin_generators/backend/templates/config/config.yml +2 -3
- data/lipsiadmin_generators/backend/templates/config/locales/backend/en.yml +2 -0
- data/lipsiadmin_generators/backend/templates/config/locales/backend/it.yml +2 -0
- data/lipsiadmin_generators/backend/templates/config/locales/models/{en.yml → account/en.yml} +0 -0
- data/lipsiadmin_generators/backend/templates/config/locales/models/{it.yml → account/it.yml} +0 -0
- data/lipsiadmin_generators/backend/templates/controllers/javascripts_controller.rb +1 -1
- data/lipsiadmin_generators/backend/templates/images/backend/association_break.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/backend/association_ok.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/backend/categories.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/charts.swf +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/sizer/se-handle.gif → default/button/arrow.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/btn.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/group-cs.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/grid/grid-blue-split.gif → default/button/group-lr.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/grid/arrow-right-white.gif → default/button/group-tb.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow-b-noline.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow-b.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow-bo.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/grid/grid3-hrow.gif → default/button/s-arrow-noline.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow-o.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/form/checkbox.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/form/radio.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/form/trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/group-collapse.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/group-expand.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/refresh.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/sort-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/panel/tool-sprites.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/panel/tools-sprites-trans.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/qtip/tip-anchor-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/shadow-c.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-thumb.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-v-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-v-thumb.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/grid/arrow-left-white.gif → default/toolbar/more.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/tb-xl-btn-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/panel/left-right.gif → default/toolbar/tb-xl-sep.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-corners.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-right.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-right.psd +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/right-corners.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/top-bottom.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/top-bottom.psd +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/expressinstall.swf +0 -0
- data/lipsiadmin_generators/backend/templates/javascripts/ext.js +97 -76
- data/lipsiadmin_generators/backend/templates/javascripts/prototype.js +14 -12
- data/lipsiadmin_generators/backend/templates/models/notifier.rb +1 -1
- data/lipsiadmin_generators/backend/templates/stylesheets/backend.css +11 -2
- data/lipsiadmin_generators/backend/templates/stylesheets/ext.css +1070 -546
- data/lipsiadmin_generators/backend/templates/stylesheets/login.css +1 -0
- data/lipsiadmin_generators/backend/templates/views/backend/accounts/index.rjs +1 -0
- data/lipsiadmin_generators/backend/templates/views/backend/base/index.html.haml +7 -4
- data/lipsiadmin_generators/backend/templates/views/javascripts/backend.js.erb +203 -143
- data/lipsiadmin_generators/pdf/pdf_generator.rb +1 -4
- data/lipsiadmin_generators/pdf/templates/view.html.haml +11 -6
- data/lipsiadmin_generators/state_session/state_session_generator.rb +2 -0
- data/resources/javascripts/ux.js +16 -17
- data/resources/javascripts/ux.min.js +2 -0
- data/resources/pd4ml/ruby/Pd4Ruby.class +0 -0
- data/resources/pd4ml/ruby/Pd4Ruby.java +277 -31
- data/tasks/lipsiadmin_tasks.rake +18 -1
- metadata +32 -124
- data/lipsiadmin_generators/backend/templates/images/ext/default/box/tb-slate.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/btn-arrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/btn-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/Thumbs.db +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/button/btn-arrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/button/btn-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/editor/tb-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/checkbox.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/clear-trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/date-trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/radio.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/search-trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/trigger-tpl.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/gradient-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/col-move-bottom.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/col-move-top.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/footer-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-blue-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-hrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-split.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-vista-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-hd-btn.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-hrow-over.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-special-col-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-special-col-sel-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/group-expand-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/mso-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-first-disabled.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-first.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-last-disabled.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-last.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-next-disabled.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-next.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-prev-disabled.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-prev.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/refresh.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/row-over.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/row-sel.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/sort_asc.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/sort_desc.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/checked.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/group-checked.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/item-over - Copy.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/item-over.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/menu-parent.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/menu.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/unchecked.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/corners-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/light-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tool-sprite-tpl.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tool-sprites.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tools-sprites-trans.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/top-bottom.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/top-bottom.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-corners-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-left-right.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-top-bottom.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/progress/progress-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/close.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/tip-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/s.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/glass-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/hd-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/left-btn.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/right-btn.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/e-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/e-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/ne-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/ne-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/nw-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/nw-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/s-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/s-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/se-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/square.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/sw-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/sw-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-thumb.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-v-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-v-thumb.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroll-left.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroll-right.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroller-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-inactive-left-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-inactive-right-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-left-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-right-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-close.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-btm-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tabs-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/bg-menu.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-arrow-light.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-arrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-over-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/gray-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/tb-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/tb-btn-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tree/arrows.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-error.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-info.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-question.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-warning.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/left-corners.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/left-right.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/right-corners.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/top-bottom.png +0 -0
- data/lipsiadmin_generators/backend/templates/stylesheets/backend-slate.css +0 -105
- data/lipsiadmin_generators/backend/templates/stylesheets/ext-slate.css +0 -241
@@ -18,5 +18,6 @@ h2 { color:#525151; font-size:18px; margin:0px 0px 15px 0px; padding:0; }
|
|
18
18
|
#content_intro { text-align:center; margin:210px 0px 0px 0px; color: #525151;}
|
19
19
|
#content_intro a { color: #525151;}
|
20
20
|
#copyright { position:absolute; top:100%; left:20px; margin-top:-30px; color:#FFF; }
|
21
|
+
/* Classes */
|
21
22
|
.field { padding-bottom:5px; }
|
22
23
|
.bottom { color:#0BB1E1; margin-top:20px; }
|
@@ -8,6 +8,7 @@ page.grid do |grid|
|
|
8
8
|
grid.store do |store|
|
9
9
|
store.url "/backend/accounts.json"
|
10
10
|
store.fields @column_store.store_fields
|
11
|
+
store.sortInfo :field => "accounts.created_at", :direction => "DESC"
|
11
12
|
end
|
12
13
|
grid.columns do |columns|
|
13
14
|
columns.fields @column_store.column_fields
|
@@ -1,17 +1,20 @@
|
|
1
1
|
%html
|
2
2
|
%head
|
3
3
|
%title="#{AppConfig.project} v.#{Lipsiadmin::VERSION::STRING}"
|
4
|
-
=stylesheet_link_tag :backend
|
4
|
+
=stylesheet_link_tag :backend
|
5
5
|
%body
|
6
6
|
#loading-mask
|
7
7
|
#loading
|
8
8
|
.loading-indicator
|
9
9
|
=image_tag("backend/logo-loader.png") + "Loading..."
|
10
|
-
|
10
|
+
/ include everything after the loading indicator
|
11
11
|
=javascript_include_tag :defaults, :backend
|
12
12
|
-unless params[:small]
|
13
13
|
#header
|
14
14
|
#logo=link_to AppConfig.project, backend_path
|
15
15
|
#logout=link_to "Logout #{current_account.email}", backend_session_path(1), :method => :delete
|
16
|
-
|
17
|
-
%iframe{ :id => "ajax-iframe", :name => "ajax-iframe" }
|
16
|
+
|
17
|
+
%iframe{ :id => "ajax-iframe", :name => "ajax-iframe" }
|
18
|
+
%form{ :id => "history-form", :class => "x-hidden" }
|
19
|
+
=hidden_field_tag "x-history-field"
|
20
|
+
%iframe{ :id => "x-history-frame" }
|
@@ -4,26 +4,65 @@
|
|
4
4
|
//
|
5
5
|
Ext.BLANK_IMAGE_URL = '/images/ext/default/s.gif';
|
6
6
|
Ext.namespace('Backend');
|
7
|
+
Ext.namespace('Backend.util.Format');
|
7
8
|
|
8
|
-
Ext.Updater.defaults.loadScripts =
|
9
|
+
Ext.Updater.defaults.loadScripts = false;
|
9
10
|
Ext.Updater.defaults.showLoadIndicator = false;
|
11
|
+
Ext.Updater.defaults.disableCaching = true;
|
10
12
|
|
13
|
+
// How it works?
|
14
|
+
//
|
15
|
+
// Basically we can load (async) contents in 3 ways:
|
16
|
+
//
|
17
|
+
// * Loading a file .js (javascript)
|
18
|
+
// * Loading a file .html (without extension are considered html)
|
19
|
+
// * Updating directly the html of the page
|
20
|
+
//
|
21
|
+
// If we load a directly a js we put them a <script src="youfile.js" type="text/javascript" /> in the <head>
|
22
|
+
// Consider that the head contains ONLY dynamic javascripts because the system one wose loaded after the loader mask in the <body>.
|
23
|
+
// We turn of Ext.Updater.defaults.loadScripts because we need to clean the cache (when required).
|
24
|
+
//
|
25
|
+
// So when we load a content we need to do two thing:
|
26
|
+
//
|
27
|
+
// * Clean the old html (loaded in the past ajax request)
|
28
|
+
// * Clean the old <script> tags (loaded in the past ajax request)
|
29
|
+
//
|
30
|
+
// For do that we use this functions: clean, cleanScripts.
|
31
|
+
//
|
32
|
+
// If we load direclty an html page we use an handler: this.contentDynamic.getUpdater().on('beforeupdate', function(){ this.cleanScripts(); this.clean(); }, this);
|
33
|
+
// If we update directly the html (ex a render :action => :some): update : function(html){ this.cleanScripts(); this.clean(); ... }
|
34
|
+
// If we load direclty a js file (ex a grid): load : function(url, cache){ ... if (clean) { this.cleanScripts(); this.clean(); } ... }
|
35
|
+
//
|
11
36
|
Backend.app = function(){
|
37
|
+
// Our pretty simple cache
|
38
|
+
var cache = {};
|
39
|
+
var oldUrl = undefined;
|
12
40
|
return {
|
41
|
+
// Init our app
|
13
42
|
init : function(){
|
14
43
|
Ext.state.Manager.setProvider(
|
15
44
|
new Ext.state.CookieProvider({
|
16
|
-
expires: new Date(new Date().getTime()+(1000*60*60*24*365))
|
45
|
+
expires: new Date(new Date().getTime()+(1000*60*60*24*365))
|
17
46
|
})
|
18
47
|
);
|
48
|
+
|
19
49
|
// We want save cookies only for grids
|
20
50
|
Ext.override(Ext.Component, { stateful:false });
|
21
51
|
Ext.override(Ext.grid.GridPanel, { stateful:true });
|
22
52
|
Ext.QuickTips.init();
|
23
|
-
|
24
|
-
Backend.cache.clear();
|
53
|
+
|
25
54
|
// Used for direclty load some specific page
|
26
|
-
|
55
|
+
if (window.location.search){
|
56
|
+
var loadUrl = Ext.urlDecode(window.location.search.substring(1)).load;
|
57
|
+
} else if (window.location.href.split('#')[1]) {
|
58
|
+
var loadUrl = window.location.href.split('#')[1];
|
59
|
+
}
|
60
|
+
|
61
|
+
// Used for history the browsing
|
62
|
+
Ext.History.init();
|
63
|
+
Ext.History.on('change', function(token){ if(token != Backend.app.oldUrl) { Backend.app.load(token) } });
|
64
|
+
|
65
|
+
this.cache = {};
|
27
66
|
|
28
67
|
if (!this.smallView()){
|
29
68
|
var header = new Ext.Panel({
|
@@ -31,7 +70,7 @@ Backend.app = function(){
|
|
31
70
|
region:'north',
|
32
71
|
border: false,
|
33
72
|
height: 65,
|
34
|
-
bbar:
|
73
|
+
bbar: <%= backend_menu %>
|
35
74
|
});
|
36
75
|
}
|
37
76
|
|
@@ -40,7 +79,7 @@ Backend.app = function(){
|
|
40
79
|
region:'center',
|
41
80
|
border:false,
|
42
81
|
bodyStyle: 'background: #FFF url(/images/backend/bg-content.png) repeat-x top;',
|
43
|
-
title:' ',
|
82
|
+
title: this.title() ? ' ' : '',
|
44
83
|
layout:'fit'
|
45
84
|
});
|
46
85
|
|
@@ -49,7 +88,7 @@ Backend.app = function(){
|
|
49
88
|
items: header ? [header, this.contentDynamic] : [this.contentDynamic]
|
50
89
|
});
|
51
90
|
|
52
|
-
this.contentDynamic.getUpdater().on('beforeupdate', function(){ this.clean(); }, this);
|
91
|
+
this.contentDynamic.getUpdater().on('beforeupdate', function(){ this.cleanScripts(); this.clean(); }, this);
|
53
92
|
this.contentDynamic.getUpdater().on('update', this.inspectContent, this);
|
54
93
|
this.load(loadUrl ? loadUrl : '/backend/base/welcome');
|
55
94
|
setTimeout(function(){
|
@@ -60,60 +99,67 @@ Backend.app = function(){
|
|
60
99
|
|
61
100
|
smallView : function(){
|
62
101
|
return window.location.search ? Ext.urlDecode(window.location.search.substring(1)).small : false;
|
63
|
-
}, //
|
102
|
+
}, // smalloallProductsGroupingStore
|
64
103
|
|
65
104
|
toolbar: function(){
|
66
|
-
return window.location.search ? Ext.urlDecode(window.location.search.substring(1)).toolbar :
|
105
|
+
return window.location.search ? Ext.urlDecode(window.location.search.substring(1)).toolbar!="0" : true;
|
67
106
|
}, // hideToolbar
|
68
107
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
108
|
+
title: function(){
|
109
|
+
return window.location.search ? Ext.urlDecode(window.location.search.substring(1)).title!="0" : true;
|
110
|
+
}, // hideTite
|
111
|
+
|
112
|
+
load : function(url){
|
113
|
+
var ext = (/[.]/.exec(url)) ? /[^.]+$/.exec(url) : 'html';
|
74
114
|
|
115
|
+
// Now we need to store the url in the history
|
116
|
+
if (!this.smallView()){
|
117
|
+
Ext.History.add(url, true);
|
118
|
+
this.oldUrl = url;
|
119
|
+
}
|
120
|
+
// Now give a reply based on request
|
75
121
|
if (ext.length == 1 && ext[0].toLowerCase() == 'js') {
|
76
|
-
// Clean the
|
122
|
+
// Clean the html and scripts if requested
|
123
|
+
this.cleanScripts();
|
77
124
|
this.clean();
|
78
|
-
//
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
try { window.eval(response.responseText); } catch(e) { Backend.app.error(e); }
|
86
|
-
}
|
87
|
-
});
|
125
|
+
// We append the js into the head so we can easy inspect errors
|
126
|
+
var hd = document.getElementsByTagName("head")[0];
|
127
|
+
var s = document.createElement("script");
|
128
|
+
s.src = url;
|
129
|
+
s.type = 'text/javascript';
|
130
|
+
// Now we can append the child.
|
131
|
+
hd.appendChild(s);
|
88
132
|
} else if (ext == 'html'){
|
89
|
-
this.contentDynamic.getUpdater().update({ url: url,
|
133
|
+
this.contentDynamic.getUpdater().update({ url: url, headers: { 'Accept': 'text/html, text/javascript, application/xml, text/xml, */*' } });
|
90
134
|
} else {
|
91
135
|
Ext.Msg.alert(Backend.locale.messages.alert.title, Backend.locale.messages.alert.message);
|
92
136
|
}
|
93
|
-
this.contentDynamic.addEvents('inspection');
|
94
137
|
}, // load
|
95
138
|
|
96
139
|
back: function(){
|
97
|
-
if (Backend.app.
|
98
|
-
|
140
|
+
if (Backend.app.smallView()){
|
141
|
+
window.location.reload(true);
|
99
142
|
} else {
|
100
|
-
Ext.
|
143
|
+
Ext.History.back();
|
101
144
|
}
|
102
145
|
},// back
|
103
146
|
|
104
|
-
backTo: undefined, // lastJs
|
105
|
-
|
106
147
|
update : function(html){
|
148
|
+
this.cleanScripts();
|
107
149
|
this.clean();
|
108
150
|
var el = this.contentDynamic.body.update(html, true);
|
109
151
|
this.inspectContent(el);
|
110
152
|
}, // update
|
111
153
|
|
154
|
+
cleanScripts: function(){
|
155
|
+
Ext.select('head > script').each(function(el){ el.remove(); });
|
156
|
+
}, // cleanScripts
|
157
|
+
|
112
158
|
clean : function(){
|
113
159
|
this.mask();
|
114
|
-
this.contentDynamic.body.update('');
|
115
160
|
this.contentDynamic.items.each(function(i){ i.destroy(); });
|
116
161
|
this.contentDynamic.removeAll(true);
|
162
|
+
this.contentDynamic.body.update(''); // Another check ;)
|
117
163
|
this.contentDynamic.doLayout();
|
118
164
|
}, // clean
|
119
165
|
|
@@ -125,13 +171,9 @@ Backend.app = function(){
|
|
125
171
|
submitForm : function(){
|
126
172
|
Backend.app.mask(Backend.locale.messages.wait.message);
|
127
173
|
Backend.app.contentDynamic.findByType('tabpanel').each(function(tabpanel){
|
128
|
-
|
129
|
-
});
|
130
|
-
Ext.select('form').each(function(form){
|
131
|
-
if (form.id != 'ajax-iframe'){
|
132
|
-
form.dom.submit();
|
133
|
-
}
|
174
|
+
cache.activeTab = tabpanel.activeTab.id;
|
134
175
|
});
|
176
|
+
Ext.select('form[target=ajax-iframe]').each(function(form){ form.dom.submit(); });
|
135
177
|
}, // submitForms
|
136
178
|
|
137
179
|
setTitle: function(title){
|
@@ -139,96 +181,106 @@ Backend.app = function(){
|
|
139
181
|
}, // SetTitle
|
140
182
|
|
141
183
|
inspectContent: function(el, oResponseObject){
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
184
|
+
try {
|
185
|
+
|
186
|
+
// Search for forms (except ajax-frame) in the page, usually only one.
|
187
|
+
el.select('form').each(function(form){
|
188
|
+
if (form.id != 'ajax-iframe'){
|
189
|
+
form.dom.target = 'ajax-iframe';
|
190
|
+
}
|
191
|
+
});
|
148
192
|
|
149
|
-
|
150
|
-
|
193
|
+
// Search for tabs in the page
|
194
|
+
var tabs = el.select('div[tabbed=true]');
|
151
195
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
var editable = tab.getAttribute('htmleditor');
|
156
|
-
if (editable) {
|
157
|
-
return { id: tab.id, autoScroll:false, title: tab.title, items: { xtype: 'htmleditor', id: editable, enableFont: false, value: tab.getAttribute('value') } };
|
158
|
-
} else {
|
196
|
+
if (tabs.elements.length > 0){
|
197
|
+
// Build Tabs
|
198
|
+
var items = tabs.elements.collect(function(tab){
|
159
199
|
return { id: tab.id, contentEl: tab.id, title: tab.title };
|
200
|
+
});
|
201
|
+
|
202
|
+
// Get ActiveTab
|
203
|
+
var activeTab = (cache.activeTab || 0);
|
204
|
+
|
205
|
+
var form = el.select('form[target=ajax-iframe]').first();
|
206
|
+
|
207
|
+
this.tabPanel = new Ext.TabPanel({
|
208
|
+
applyTo: form,
|
209
|
+
xtype:'tabpanel',
|
210
|
+
activeTab: activeTab,
|
211
|
+
border:false,
|
212
|
+
items: items,
|
213
|
+
deferredRender: true,
|
214
|
+
layoutOnTabChange: true,
|
215
|
+
enableTabScroll: true,
|
216
|
+
defaults: { autoScroll:true, layout:'fit' }
|
217
|
+
});
|
218
|
+
|
219
|
+
// We need to add an extra container for maximize compatibility with
|
220
|
+
// lastest safari builds.
|
221
|
+
var panelConfig = {
|
222
|
+
border:false,
|
223
|
+
layout:'fit',
|
224
|
+
items: this.tabPanel
|
225
|
+
};
|
226
|
+
|
227
|
+
if (this.toolbar()){
|
228
|
+
Ext.apply(panelConfig, {
|
229
|
+
bbar: [{
|
230
|
+
text: Backend.locale.buttons.back,
|
231
|
+
cls: 'x-btn-text-icon back',
|
232
|
+
handler: Backend.app.back
|
233
|
+
}, '->',{
|
234
|
+
text: Backend.locale.buttons.save,
|
235
|
+
cls: 'x-btn-text-icon save',
|
236
|
+
handler: Backend.app.submitForm
|
237
|
+
}]
|
238
|
+
});
|
160
239
|
}
|
161
|
-
});
|
162
240
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
var tabConfig = {
|
170
|
-
applyTo: container,
|
171
|
-
layoutOnTabChange:true,
|
172
|
-
activeTab: activeTab,
|
173
|
-
border:false,
|
174
|
-
region:'center',
|
175
|
-
items: items,
|
176
|
-
defaults: { autoScroll:true, layout:'fit' }
|
241
|
+
// Build the Container
|
242
|
+
var panel = new Ext.Panel(panelConfig);
|
243
|
+
this.addItem(panel);
|
244
|
+
|
245
|
+
// Need to use this because some times we add tabs from inline scripts
|
246
|
+
this.tabPanel.on('add', function(container, tab){ if (tab.id == activeTab) { Backend.app.tabPanel.setActiveTab(activeTab); } });
|
177
247
|
}
|
178
248
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
text: Backend.locale.buttons.back,
|
183
|
-
cls: 'x-btn-text-icon back',
|
184
|
-
handler: Backend.app.back
|
185
|
-
}, '->',{
|
186
|
-
text: Backend.locale.buttons.save,
|
187
|
-
cls: 'x-btn-text-icon save',
|
188
|
-
handler: Backend.app.submitForm
|
189
|
-
}]
|
190
|
-
});
|
191
|
-
}
|
249
|
+
// Now we can load scripts an eval scripts
|
250
|
+
var html = el.dom.innerHTML;
|
251
|
+
var dom = this.contentDynamic.body.dom;
|
192
252
|
|
193
|
-
|
194
|
-
var
|
195
|
-
|
196
|
-
// Need to use this because some times we add tabs from inline scripts
|
197
|
-
tabPanel.on('add', function(){ tabPanel.setActiveTab(activeTab) });
|
198
|
-
}
|
199
|
-
|
200
|
-
// Now we can load scripts
|
201
|
-
var html = el.dom.innerHTML;
|
202
|
-
var id = Ext.id();
|
203
|
-
var dom = this.contentDynamic.body.dom;
|
204
|
-
|
205
|
-
var hd = document.getElementsByTagName("head")[0];
|
206
|
-
var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
|
207
|
-
var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
|
208
|
-
var typeRe = /\stype=([\'\"])(.*?)\1/i;
|
253
|
+
var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
|
254
|
+
var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
|
255
|
+
var typeRe = /\stype=([\'\"])(.*?)\1/i;
|
209
256
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
s.type =
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
257
|
+
var match;
|
258
|
+
while(match = re.exec(html)){
|
259
|
+
var attrs = match[1];
|
260
|
+
var srcMatch = attrs ? attrs.match(srcRe) : false;
|
261
|
+
if(srcMatch && srcMatch[2]){
|
262
|
+
// We append the js into the head so we can easy inspect errors
|
263
|
+
var hd = document.getElementsByTagName("head")[0];
|
264
|
+
var s = document.createElement("script");
|
265
|
+
s.src = srcMatch[2];
|
266
|
+
s.type = 'text/javascript';
|
267
|
+
// Now we can append the child.
|
268
|
+
hd.appendChild(s);
|
269
|
+
}else if(match[2] && match[2].length > 0){
|
270
|
+
if(window.execScript) {
|
271
|
+
window.execScript(match[2]);
|
272
|
+
} else {
|
273
|
+
window.eval(match[2]);
|
274
|
+
}
|
227
275
|
}
|
228
276
|
}
|
277
|
+
|
278
|
+
this.unmask();
|
279
|
+
// Empty our cache
|
280
|
+
cache = {};
|
281
|
+
} catch(e){
|
282
|
+
throw this.error(e)
|
229
283
|
}
|
230
|
-
|
231
|
-
this.unmask();
|
232
284
|
},//inspectContent
|
233
285
|
|
234
286
|
error: function(e){
|
@@ -244,12 +296,12 @@ Backend.app = function(){
|
|
244
296
|
baseCls: 'x-plain',
|
245
297
|
labelAlign: 'top',
|
246
298
|
items: [{
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
299
|
+
xtype:'textarea',
|
300
|
+
anchor: '100% 100%',
|
301
|
+
allowBlank: false,
|
302
|
+
fieldLabel: Backend.locale.help.description,
|
303
|
+
name: 'message'
|
304
|
+
}]
|
253
305
|
});
|
254
306
|
|
255
307
|
var formDialog = new Ext.Window({
|
@@ -348,7 +400,7 @@ Backend.window = Ext.extend(Ext.Window, {
|
|
348
400
|
handler: this.saveForm.createDelegate(this, [])}
|
349
401
|
);
|
350
402
|
}
|
351
|
-
this.html = '<iframe id="'+this.iframeId+'" src="/backend/base/?small=1&toolbar='+(this.form?1
|
403
|
+
this.html = '<iframe id="'+this.iframeId+'" class="windowed" src="/backend/base/?small=1&toolbar='+(this.form?0:1)+'&load='+this.url+'" frameBorder="0" width="100%" height="100%" />';
|
352
404
|
}, // initComponent
|
353
405
|
|
354
406
|
afterShow : function(afterShow){
|
@@ -375,23 +427,31 @@ Backend.window = Ext.extend(Ext.Window, {
|
|
375
427
|
} // saveForm
|
376
428
|
});
|
377
429
|
|
378
|
-
Backend.
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
430
|
+
Backend.comboBox = Ext.extend(Ext.form.ComboBox, {
|
431
|
+
displayField:'title',
|
432
|
+
typeAhead: false,
|
433
|
+
loadingText: 'Searching...',
|
434
|
+
pageSize: 10,
|
435
|
+
autoWidth:true,
|
436
|
+
hideTrigger:true,
|
437
|
+
itemSelector: 'div.search-item',
|
438
|
+
initComponent : function(){
|
439
|
+
Backend.comboBox.superclass.initComponent.call(this);
|
440
|
+
if (this.autoWidth){
|
441
|
+
Backend.app.contentDynamic.on('resize', this.fitContent, this);
|
442
|
+
this.on('render', this.fitContent, this);
|
443
|
+
}
|
444
|
+
}, // initComponent
|
445
|
+
fitContent : function() {
|
446
|
+
this.el.setStyle({display:'none'});
|
447
|
+
var size = this.el.parent().parent().getSize();
|
448
|
+
this.onResize(size.width, size.height);
|
449
|
+
this.el.setStyle({display:'inline'});
|
450
|
+
}
|
451
|
+
});
|
452
|
+
|
453
|
+
Backend.showAlert = function(){
|
454
|
+
Ext.Msg.alert(Backend.locale.messages.alert.title, Backend.locale.messages.alert.message);
|
455
|
+
}
|
396
456
|
|
397
457
|
Ext.onReady(Backend.app.init, Backend.app, true);
|