lipsiadmin 3.4.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +6 -0
- data/lib/controller/ext.rb +3 -0
- data/lib/data_base/attachment/attach.rb +4 -4
- data/lib/version.rb +3 -3
- data/lib/view/helpers/backend_helper.rb +91 -14
- data/lib/view/helpers/ext/column_model.rb +49 -2
- data/lib/view/helpers/ext/grid.rb +14 -2
- data/lib/view/helpers/ext/templates/grid_functions.js.erb +50 -0
- data/lib/view/helpers/ext_helper.rb +2 -2
- data/lipsiadmin_generators/backend/templates/views/javascripts/backend.js.erb +126 -76
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
2009-05-11
|
2
|
+
* Bumped version to 4.0.0
|
3
|
+
* Refactored backend.js so javascript in tabs are evalued after render so you can interact with tabs
|
4
|
+
* Refactored Backend.window so now you can do much more with your grids/forms. See rdoc for examples.
|
5
|
+
* Small refactor to attachment processor, now original attachments are saved without "_original_" in the filename.
|
6
|
+
|
1
7
|
2009-05-07
|
2
8
|
* Fixed a problem with WithoutTable
|
3
9
|
* Removed unusued routes
|
data/lib/controller/ext.rb
CHANGED
@@ -78,6 +78,9 @@ module Lipsiadmin
|
|
78
78
|
end.join(",")
|
79
79
|
end
|
80
80
|
|
81
|
+
# Adding a name for our column
|
82
|
+
options[:name] ||= "#{@model.table_name.singularize}[#{options[:method]}]"
|
83
|
+
|
81
84
|
# Reformat query
|
82
85
|
if options[:method].is_a?(Symbol)
|
83
86
|
options[:dataIndex] ||= "#{@model.table_name}.#{options[:method]}"
|
@@ -115,7 +115,7 @@ module Lipsiadmin
|
|
115
115
|
:path => ":rails_root/public/uploads/:id_:style_:basename.:extension",
|
116
116
|
:styles => {},
|
117
117
|
:default_url => "/images/backend/no-image.png",
|
118
|
-
:default_style => :
|
118
|
+
:default_style => :original,
|
119
119
|
:validations => {},
|
120
120
|
:storage => :filesystem
|
121
121
|
}
|
@@ -486,9 +486,9 @@ module Lipsiadmin
|
|
486
486
|
interpolations = self.class.interpolations.sort{|a,b| a.first.to_s <=> b.first.to_s }
|
487
487
|
interpolations.reverse.inject( pattern.dup ) do |result, interpolation|
|
488
488
|
tag, blk = interpolation
|
489
|
-
|
490
|
-
|
491
|
-
|
489
|
+
match = blk.call(self, style)
|
490
|
+
# If we use tag original we dont want to add :original to filename or url
|
491
|
+
tag == :style && match == :original ? result.gsub(/:style_/, "") : result.gsub(/:#{tag}/, match.to_s)
|
492
492
|
end
|
493
493
|
end
|
494
494
|
|
data/lib/version.rb
CHANGED
@@ -47,22 +47,99 @@ module Lipsiadmin
|
|
47
47
|
return config.to_json
|
48
48
|
end
|
49
49
|
|
50
|
+
# Open a new windows that can contain a grid that you can reuse
|
51
|
+
#
|
52
|
+
# The first argument name is used as the link text.
|
53
|
+
#
|
54
|
+
# The second argument is the url where js of grid are stored.
|
55
|
+
#
|
56
|
+
# The third argument is the name of the gird var usually gridPanel or editorGridPanel.
|
57
|
+
#
|
58
|
+
# The four argument are callbacks that may be specified:
|
59
|
+
#
|
60
|
+
# <tt>:before</tt>:: Called before request is initiated.
|
61
|
+
# <tt>:update</tt>:: Called after user press +select+ button.
|
62
|
+
# This call are performed in an handler where
|
63
|
+
# you have access to two variables:
|
64
|
+
# <tt>:win</tt>:: Backend.window
|
65
|
+
# <tt>:selections</tt>:: Records selected in the grid
|
66
|
+
#
|
67
|
+
# # Generates: <a onclick="
|
68
|
+
# # new Backend.window({
|
69
|
+
# # url: '/backend/categories.js',
|
70
|
+
# # grid: 'gridPanel',
|
71
|
+
# # listeners: {
|
72
|
+
# # selected: function(win, selections){
|
73
|
+
# # $('post_category_ids').value = selections.collect(function(s) { return s.id }).join(',');
|
74
|
+
# # $('category_names').innerHTML = selections.collect(function(s) { return s.data['categories.name'] }).join(', ');
|
75
|
+
# # }
|
76
|
+
# # }
|
77
|
+
# # }).show();
|
78
|
+
# # return false;" href="#">Select a Category</a>
|
79
|
+
#
|
80
|
+
# open_grid "Select a Category", "/backend/categories.js", "gridPanel",
|
81
|
+
# :update => "$('post_category_ids').value = selections.collect(function(s) { return s.id }).join(',');" +
|
82
|
+
# "$('category_names').innerHTML = selections.collect(function(s) { return s.data['categories.name'] }).join(', ');"
|
83
|
+
#
|
84
|
+
def open_grid(text, url, grid, options={})
|
85
|
+
options[:before] = options[:before] + ";" if options[:before]
|
86
|
+
javascript = <<-JAVASCRIPT
|
87
|
+
#{options[:before]}
|
88
|
+
new Backend.window({
|
89
|
+
url: '#{url}',
|
90
|
+
grid: '#{grid}',
|
91
|
+
listeners: {
|
92
|
+
selected: function(win, selections){
|
93
|
+
#{options[:update]}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}).show()
|
97
|
+
JAVASCRIPT
|
98
|
+
link_to_function(text, javascript)
|
99
|
+
end
|
100
|
+
|
50
101
|
# Open a new windows that can contain a form that you can reuse
|
51
102
|
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
|
64
|
-
|
65
|
-
|
103
|
+
# The first argument name is used as the link text.
|
104
|
+
#
|
105
|
+
# The second argument is the url where html of form are stored.
|
106
|
+
#
|
107
|
+
# The third argument are callbacks that may be specified:
|
108
|
+
#
|
109
|
+
# <tt>:before</tt>:: Called before request is initiated.
|
110
|
+
# <tt>:update</tt>:: Called after user press +save+ button.
|
111
|
+
# This call are performed in an handler where
|
112
|
+
# you have access to one variables:
|
113
|
+
# <tt>:win</tt>:: Backend.window
|
114
|
+
#
|
115
|
+
# # Generates: <a onclick="
|
116
|
+
# # new Backend.window({
|
117
|
+
# # url: '/backend/posts/'+$('comment_post_id').value+'/edit',
|
118
|
+
# # form: true,
|
119
|
+
# # listeners: {
|
120
|
+
# # saved: function(win){
|
121
|
+
# # someFn();
|
122
|
+
# # }
|
123
|
+
# # }
|
124
|
+
# # }).show();
|
125
|
+
# # return false;" href="#">Edit Post</a>
|
126
|
+
# open_form "Edit Post", "/backend/posts/'+$('comment_post_id').value+'/edit", :update => "someFn();"
|
127
|
+
#
|
128
|
+
def open_form(text, url, options={})
|
129
|
+
options[:before] = options[:before] + ";" if options[:before]
|
130
|
+
javascript = <<-JAVASCRIPT
|
131
|
+
#{options[:before]}
|
132
|
+
new Backend.window({
|
133
|
+
url: '#{url}',
|
134
|
+
form: true,
|
135
|
+
listeners: {
|
136
|
+
saved: function(win){
|
137
|
+
#{options[:update]}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}).show()
|
141
|
+
JAVASCRIPT
|
142
|
+
link_to_function(text, javascript)
|
66
143
|
end
|
67
144
|
|
68
145
|
# This method call a remote_function and in the same time do a
|
@@ -56,9 +56,54 @@ module Lipsiadmin
|
|
56
56
|
# # Generates: Ext.util.Format.boolRenderer
|
57
57
|
# :renderer => :boolean
|
58
58
|
#
|
59
|
+
# You can pass :edit_with_###
|
60
|
+
#
|
61
|
+
# # Generates: { checkbox: true }
|
62
|
+
# :editor => { :xtype => :checkbox, :someConfig => true }
|
63
|
+
# # Generates: new Ext.form.ComboBox({ someConfig => true });
|
64
|
+
# :editor => { :xtype => :combo, :someConfig => true }
|
65
|
+
# # Generates: new Ext.form.DateField({ someConfig => true });
|
66
|
+
# :editor => { :xtype => :datefield, :someConfig => true }
|
67
|
+
# # Generates: new Ext.form.NumberField({ someConfig => true });
|
68
|
+
# :editor => { :xtype => :numberfield, :someConfig => true }
|
69
|
+
# # Generates: new Ext.form.Radio({ someConfig => true });
|
70
|
+
# :editor => { :xtype => :radio, :someConfig => true }
|
71
|
+
# # Generates: new Ext.form.TextArea({ someConfig => true });
|
72
|
+
# :editor => { :xtype => :textarea, :someConfig => true }
|
73
|
+
# # Generates: new Ext.form.TextField({ someConfig => true });
|
74
|
+
# :editor => { :xtype => :textfield, :someConfig => true }
|
75
|
+
# # Generates: new Ext.form.TimeField({ someConfig => true });
|
76
|
+
# :editor => { :xtype => :timefield, :someConfig => true }
|
77
|
+
#
|
78
|
+
# Form components so are:
|
79
|
+
# ---------------------------------------
|
80
|
+
# :checkbox => Ext.form.Checkbox
|
81
|
+
# :combo => Ext.form.ComboBox
|
82
|
+
# :datefield => Ext.form.DateField
|
83
|
+
# :numberfield => Ext.form.NumberField
|
84
|
+
# :radio => Ext.form.Radio
|
85
|
+
# :textarea => Ext.form.TextArea
|
86
|
+
# :textfield => Ext.form.TextField
|
87
|
+
# :timefield => Ext.form.TimeField
|
88
|
+
#
|
59
89
|
def add(name=nil, data=nil, options={})
|
60
90
|
options[:header] = name if name
|
61
|
-
options[:dataIndex] = data if
|
91
|
+
options[:dataIndex] = data if date
|
92
|
+
|
93
|
+
if options[:editor]
|
94
|
+
xtype = options[:editor].delete(:xtype)
|
95
|
+
case xtype
|
96
|
+
when :checkbox then options.delete(:editor); options.merge!(:checkbox => true)
|
97
|
+
when :combo then options.merge!(:editor => l("new Ext.form.ComboBox(#{Configuration.new(options[:editor]).to_s(3)})"))
|
98
|
+
when :datefield then options.merge!(:editor => l("new Ext.form.DateField(#{Configuration.new(options[:editor]).to_s(3)})"))
|
99
|
+
when :numberfield then options.merge!(:editor => l("new Ext.form.NumberField(#{Configuration.new(options[:editor]).to_s(3)})"))
|
100
|
+
when :radio then options.merge!(:editor => l("new Ext.form.Radio(#{Configuration.new(options[:editor]).to_s(3)})"))
|
101
|
+
when :textarea then options.merge!(:editor => l("new Ext.form.TextArea(#{Configuration.new(options[:editor]).to_s(3)})"))
|
102
|
+
when :textfield then options.merge!(:editor => l("new Ext.form.TextField(#{Configuration.new(options[:editor]).to_s(3)})"))
|
103
|
+
when :timefield then options.merge!(:editor => l("new Ext.form.TimeField(#{Configuration.new(options[:editor]).to_s(3)})"))
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
62
107
|
case options[:renderer]
|
63
108
|
when :date then options.merge!(:renderer => l("Ext.util.Format.dateRenderer()"))
|
64
109
|
when :datetime then options.merge!(:renderer => l("Ext.util.Format.dateTimeRenderer()"))
|
@@ -66,7 +111,9 @@ module Lipsiadmin
|
|
66
111
|
when :us_money then options.merge!(:renderer => l("Ext.util.Format.usMoney"))
|
67
112
|
when :boolean then options.merge!(:renderer => l("Ext.util.Format.boolRenderer"))
|
68
113
|
end
|
69
|
-
|
114
|
+
|
115
|
+
raise ComponentError, "You must provide header and dataIndex for generate a column model" if options[:header].blank? ||
|
116
|
+
options[:dataIndex].blank?
|
70
117
|
config[:columns] << Configuration.new(options)
|
71
118
|
end
|
72
119
|
end
|
@@ -38,10 +38,22 @@ module Lipsiadmin
|
|
38
38
|
# grid.bbar :store => grid.get_store, :pageSize => params[:limit]
|
39
39
|
# end
|
40
40
|
#
|
41
|
+
# # Returns:
|
42
|
+
# # var grid = new Ext.grid.EditorGridPanel({
|
43
|
+
# # clicksToEdit: 1,
|
44
|
+
# # ...
|
45
|
+
#
|
46
|
+
# page.grid :editable => true do |grid|
|
47
|
+
# grid.id "grid-posts"
|
48
|
+
# ...
|
49
|
+
#
|
41
50
|
class Grid < Component
|
51
|
+
|
42
52
|
def initialize(options={}, &block)#:nodoc:
|
43
53
|
# Call Super Class for initialize configuration
|
44
|
-
|
54
|
+
@editable = options.delete(:editable)
|
55
|
+
|
56
|
+
super("Ext.grid.#{@editable ? 'EditorGridPanel' : 'GridPanel' }", options)
|
45
57
|
|
46
58
|
# Write default configuration if not specified
|
47
59
|
config[:plugins] ||= []
|
@@ -255,7 +267,7 @@ module Lipsiadmin
|
|
255
267
|
end
|
256
268
|
|
257
269
|
if @default_tbar
|
258
|
-
after << render_javascript(:grid_functions, :var => get_var, :store => config[:store], :sm => config[:sm], :tbar => config[:tbar])
|
270
|
+
after << render_javascript(:grid_functions, :var => get_var, :store => config[:store], :sm => config[:sm], :tbar => config[:tbar], :editable => @editable)
|
259
271
|
end
|
260
272
|
|
261
273
|
if config[:store]
|
@@ -13,6 +13,56 @@
|
|
13
13
|
}
|
14
14
|
});
|
15
15
|
|
16
|
+
<% if @editable %>
|
17
|
+
<%= @var %>.on('cellmousedown', function(grid, rowIndex, colIndex, e){
|
18
|
+
var columnId = grid.getColumnModel().getColumnId(colIndex);
|
19
|
+
var column = grid.getColumnModel().getColumnById(columnId);
|
20
|
+
var t = e.getTarget();
|
21
|
+
|
22
|
+
if(column.checkbox && t.className && t.className.indexOf('x-grid3-cc-'+t.id) != -1){
|
23
|
+
e.stopEvent();
|
24
|
+
var record = grid.store.getAt(rowIndex);
|
25
|
+
var editEvent = {
|
26
|
+
grid: grid,
|
27
|
+
record: grid.store.getAt(rowIndex),
|
28
|
+
field: column.dataIndex,
|
29
|
+
value: !record.data[column.dataIndex],
|
30
|
+
originalValue: record.data[column.dataIndex],
|
31
|
+
row: rowIndex,
|
32
|
+
column: grid.getColumnModel().findColumnIndex(column.dataIndex)
|
33
|
+
};
|
34
|
+
record.set(column.dataIndex, editEvent.value);
|
35
|
+
grid.getSelectionModel().selectRow(rowIndex);
|
36
|
+
grid.fireEvent('afteredit', editEvent);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
|
40
|
+
|
41
|
+
<%= @var %>.on('afteredit', function(e){
|
42
|
+
var columnId = <%= @var %>.getColumnModel().getColumnId(e.column);
|
43
|
+
var column = <%= @var %>.getColumnModel().getColumnById(columnId);
|
44
|
+
|
45
|
+
Ext.Ajax.request({
|
46
|
+
url: '<%= @base_path %>/'+e.record.id,
|
47
|
+
method: 'PUT',
|
48
|
+
params: column.name+'='+e.value,
|
49
|
+
success: function(result, request){
|
50
|
+
var resultValue = Ext.decode(result.responseText);
|
51
|
+
if (resultValue.success == true){
|
52
|
+
e.record.commit();
|
53
|
+
} else {
|
54
|
+
Ext.MessageBox.alert(Lipsiadmin.locale.alert.title, resultValue.msg);
|
55
|
+
e.record.reject();
|
56
|
+
}
|
57
|
+
},
|
58
|
+
failure: function(result, request) {
|
59
|
+
Ext.Msg.alert(Lipsiadmin.locale.alert.title, Lipsiadmin.locale.alert.msg);
|
60
|
+
e.record.reject();
|
61
|
+
}
|
62
|
+
});
|
63
|
+
});
|
64
|
+
<% end %>
|
65
|
+
|
16
66
|
function add(){
|
17
67
|
Backend.app.load('<%= @new_path.blank? ? "#{@base_path}/new" : @new_path %>');
|
18
68
|
}
|
@@ -141,8 +141,8 @@ module Lipsiadmin
|
|
141
141
|
# grid.bbar :store => grid.get_store, :pageSize => params[:limit]
|
142
142
|
# end
|
143
143
|
#
|
144
|
-
def grid(&block)
|
145
|
-
self << Lipsiadmin::Ext::Grid.new(&block)
|
144
|
+
def grid(options={}, &block)
|
145
|
+
self << Lipsiadmin::Ext::Grid.new(options, &block)
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
@@ -30,6 +30,7 @@ Backend.app = function(){
|
|
30
30
|
contentEl:'header',
|
31
31
|
region:'north',
|
32
32
|
border: false,
|
33
|
+
height: 65,
|
33
34
|
bbar: new Ext.Toolbar({ cls:'x-toolbar-menu', items: [<%= backend_menu %>] })
|
34
35
|
});
|
35
36
|
}
|
@@ -61,12 +62,16 @@ Backend.app = function(){
|
|
61
62
|
return window.location.search ? Ext.urlDecode(window.location.search.substring(1)).small : false;
|
62
63
|
}, // small
|
63
64
|
|
65
|
+
toolbar: function(){
|
66
|
+
return window.location.search ? Ext.urlDecode(window.location.search.substring(1)).toolbar : false;
|
67
|
+
}, // hideToolbar
|
68
|
+
|
64
69
|
load : function(url, cache){
|
65
70
|
var ext = (/[.]/.exec(url)) ? /[^.]+$/.exec(url) : 'html';
|
66
71
|
var cache = (cache && cache == true) || false;
|
67
72
|
|
68
73
|
if (!cache){ Backend.cache.clear(); }
|
69
|
-
|
74
|
+
|
70
75
|
if (ext.length == 1 && ext[0].toLowerCase() == 'js') {
|
71
76
|
// Clean the cache
|
72
77
|
this.clean();
|
@@ -81,10 +86,11 @@ Backend.app = function(){
|
|
81
86
|
}
|
82
87
|
});
|
83
88
|
} else if (ext == 'html'){
|
84
|
-
this.contentDynamic.getUpdater().update({ url: url, headers: { 'Accept': 'text/html, text/javascript, application/xml, text/xml, */*' } });
|
89
|
+
this.contentDynamic.getUpdater().update({ url: url, scripts: false, headers: { 'Accept': 'text/html, text/javascript, application/xml, text/xml, */*' } });
|
85
90
|
} else {
|
86
91
|
Ext.Msg.alert(Backend.locale.messages.alert.title, Backend.locale.messages.alert.message);
|
87
92
|
}
|
93
|
+
this.contentDynamic.addEvents('inspection');
|
88
94
|
}, // load
|
89
95
|
|
90
96
|
back: function(){
|
@@ -106,6 +112,7 @@ Backend.app = function(){
|
|
106
112
|
clean : function(){
|
107
113
|
this.mask();
|
108
114
|
this.contentDynamic.body.update('');
|
115
|
+
this.contentDynamic.items.each(function(i){ i.destroy(); });
|
109
116
|
this.contentDynamic.removeAll(true);
|
110
117
|
this.contentDynamic.doLayout();
|
111
118
|
}, // clean
|
@@ -113,9 +120,6 @@ Backend.app = function(){
|
|
113
120
|
addItem : function(item){
|
114
121
|
this.contentDynamic.add(item);
|
115
122
|
this.contentDynamic.doLayout();
|
116
|
-
if (this.smallView()){
|
117
|
-
window.parent.Backend.window.item = item;
|
118
|
-
}
|
119
123
|
}, // addItem
|
120
124
|
|
121
125
|
submitForm : function(){
|
@@ -148,7 +152,12 @@ Backend.app = function(){
|
|
148
152
|
if (tabs.elements.length > 0){
|
149
153
|
// Build Tabs
|
150
154
|
var items = tabs.elements.collect(function(tab){
|
151
|
-
|
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 {
|
159
|
+
return { id: tab.id, contentEl: tab.id, title: tab.title };
|
160
|
+
}
|
152
161
|
});
|
153
162
|
|
154
163
|
// Get ActiveTab
|
@@ -156,29 +165,69 @@ Backend.app = function(){
|
|
156
165
|
|
157
166
|
// Get The container, this code is redundant, but is a trick for ie.
|
158
167
|
var container = Ext.get(tabs.elements[0].id).parent().id;
|
159
|
-
|
160
|
-
|
161
|
-
var tabPanel = new Ext.TabPanel({
|
168
|
+
|
169
|
+
var tabConfig = {
|
162
170
|
applyTo: container,
|
163
171
|
layoutOnTabChange:true,
|
164
172
|
activeTab: activeTab,
|
165
173
|
border:false,
|
166
174
|
region:'center',
|
167
175
|
items: items,
|
168
|
-
bbar: [{
|
169
|
-
text: Backend.locale.buttons.back,
|
170
|
-
cls: 'x-btn-text-icon back',
|
171
|
-
handler: Backend.app.back
|
172
|
-
}, '->',{
|
173
|
-
text: Backend.locale.buttons.save,
|
174
|
-
cls: 'x-btn-text-icon save',
|
175
|
-
handler: Backend.app.submitForm
|
176
|
-
}],
|
177
176
|
defaults: { autoScroll:true, layout:'fit' }
|
178
|
-
}
|
177
|
+
}
|
179
178
|
|
179
|
+
if (this.toolbar()!="1"){
|
180
|
+
Ext.apply(tabConfig, {
|
181
|
+
bbar: [{
|
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
|
+
}
|
192
|
+
|
193
|
+
// Build TabPanel
|
194
|
+
var tabPanel = new Ext.TabPanel(tabConfig);
|
180
195
|
this.addItem(tabPanel);
|
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;
|
209
|
+
|
210
|
+
var match;
|
211
|
+
while(match = re.exec(html)){
|
212
|
+
var attrs = match[1];
|
213
|
+
var srcMatch = attrs ? attrs.match(srcRe) : false;
|
214
|
+
if(srcMatch && srcMatch[2]){
|
215
|
+
var s = document.createElement("script");
|
216
|
+
s.src = srcMatch[2];
|
217
|
+
var typeMatch = attrs.match(typeRe);
|
218
|
+
if(typeMatch && typeMatch[2]){
|
219
|
+
s.type = typeMatch[2];
|
220
|
+
}
|
221
|
+
hd.appendChild(s);
|
222
|
+
}else if(match[2] && match[2].length > 0){
|
223
|
+
if(window.execScript) {
|
224
|
+
window.execScript(match[2]);
|
225
|
+
} else {
|
226
|
+
window.eval(match[2]);
|
227
|
+
}
|
228
|
+
}
|
181
229
|
}
|
230
|
+
|
182
231
|
this.unmask();
|
183
232
|
},//inspectContent
|
184
233
|
|
@@ -267,63 +316,64 @@ Backend.app = function(){
|
|
267
316
|
} // return
|
268
317
|
}();
|
269
318
|
|
270
|
-
Backend.window =
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
}
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
}
|
319
|
+
Backend.window = Ext.extend(Ext.Window, {
|
320
|
+
width: 700,
|
321
|
+
height: 300,
|
322
|
+
layout: 'fit',
|
323
|
+
autoScroll: true,
|
324
|
+
modal: true,
|
325
|
+
maximizable: true,
|
326
|
+
bodyStyle: 'background-color:#FFF',
|
327
|
+
grid: undefined,
|
328
|
+
form: false,
|
329
|
+
url: '',
|
330
|
+
iframeId: Ext.id('','iframe-'),
|
331
|
+
initComponent : function(){
|
332
|
+
Backend.window.superclass.initComponent.call(this);
|
333
|
+
this.addEvents('selected');
|
334
|
+
this.addEvents('saved');
|
335
|
+
this.addButton({
|
336
|
+
text: Backend.locale.buttons.close,
|
337
|
+
handler: this[this.closeAction].createDelegate(this, [])
|
338
|
+
});
|
339
|
+
if (this.grid){
|
340
|
+
this.addButton({
|
341
|
+
text: Backend.locale.buttons.select,
|
342
|
+
handler: this.closeWithSelections.createDelegate(this, [])}
|
343
|
+
);
|
344
|
+
}
|
345
|
+
if (this.form){
|
346
|
+
this.addButton({
|
347
|
+
text: Backend.locale.buttons.save,
|
348
|
+
handler: this.saveForm.createDelegate(this, [])}
|
349
|
+
);
|
350
|
+
}
|
351
|
+
this.html = '<iframe id="'+this.iframeId+'" src="/backend/base/?small=1&toolbar='+(this.form?1:0)+'&load='+this.url+'" frameBorder="0" width="100%" height="100%" />';
|
352
|
+
}, // initComponent
|
353
|
+
|
354
|
+
afterShow : function(afterShow){
|
355
|
+
Backend.window.superclass.afterShow.call(this);
|
356
|
+
this.contentWindow = Ext.fly(this.iframeId).dom.contentWindow;
|
357
|
+
}, // onRender
|
358
|
+
|
359
|
+
getSelections: function(){
|
360
|
+
return this.contentWindow[this.grid].getSelectionModel().getSelections();
|
361
|
+
}, // getSelections
|
362
|
+
|
363
|
+
closeWithSelections: function(){
|
364
|
+
if (this.getSelections().length > 0){
|
365
|
+
this.fireEvent('selected', this, this.getSelections());
|
366
|
+
this[this.closeAction]();
|
367
|
+
} else {
|
368
|
+
Ext.Msg.alert(Backend.locale.messages.alert.title, Backend.locale.messages.alert.notSelected);
|
369
|
+
}
|
370
|
+
}, // closeWithSelections
|
371
|
+
|
372
|
+
saveForm: function(){
|
373
|
+
this.contentWindow.Backend.app.submitForm();
|
374
|
+
this.fireEvent('saved', this);
|
375
|
+
} // saveForm
|
376
|
+
});
|
327
377
|
|
328
378
|
Backend.cache = function(){
|
329
379
|
return {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lipsiadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davide D'Agostino
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-11 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|