lipsiadmin 5.1.2 → 5.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 2010-09-3
2
+ * Fixed haml supports
3
+ * Fixed Rails 3 compatiblity
4
+
1
5
  2009-12-18
2
6
  * Bump to 5.1.1
3
7
  * Updated ExtJS to 3.1+ Version
@@ -26,7 +30,7 @@
26
30
  * Changed the rake lipsiadmin:update:javascripts now update also backend.js.erb and locale.js.erb
27
31
  * Added a new frontend helper method for resize images on the fly
28
32
  * Added new locales for rails 2.3.4
29
-
33
+
30
34
  2009-09-7
31
35
  * Bump to 5.0.7
32
36
  * Fix some compatibility issues on IE6+
@@ -131,7 +135,7 @@
131
135
  * Added ImageMagick requirements to gem
132
136
  * Improved doc
133
137
  * Allow models to have multiple attachments definitions
134
-
138
+
135
139
  2009-05-18
136
140
  * Small fix in generation of account access
137
141
  * Fix an issue in backend_page generator
@@ -157,7 +161,7 @@
157
161
  * Removed unusued routes
158
162
  * Fix few typos
159
163
  * Require at least Rails 2.2.x
160
-
164
+
161
165
  2009-04-30
162
166
  * Fix a small typo in extgrid
163
167
  * Fix a dependency problem in lipsiadmin rake tasks
@@ -190,7 +194,7 @@
190
194
  2009-03-17
191
195
  * Bump to version 3.3.3
192
196
  * Fix a typo in attachment migration
193
-
197
+
194
198
  2009-03-16
195
199
  * Bump to version 3.3.2
196
200
  * Updated locales for work with rails 2.3.2 (do rake lipsiadmin:update:locales)
@@ -199,7 +203,7 @@
199
203
  * Bump to version 3.3.1
200
204
  * Removed debug code from state_session_controller
201
205
  * Fix mistake in ux.js [Joseph]
202
-
206
+
203
207
  2009-03-13
204
208
  * Improve licensed PD4ML detection, now will look first into vendor/pd4ml
205
209
  * Bump to version 3.3
@@ -208,7 +212,7 @@
208
212
  * Added a new utils for use your licensed (if you have it) pd4ml jar
209
213
  * Fix pluralization when lipsiadmin generate migrations (attachment)
210
214
  * Removed debug info in lipsiadmin rake
211
-
215
+
212
216
  2009-03-10
213
217
  * Fixed some typos in attachment table [Vakiliy]
214
218
 
@@ -232,7 +236,7 @@
232
236
 
233
237
  2009-02-28
234
238
  * Fixed a small js error on dblclick on grids
235
- * Added for Ext::Component a new method for remove listener, remove_listener
239
+ * Added for Ext::Component a new method for remove listener, remove_listener
236
240
  * Added for Ext::Component a new alias for grid.on, called add_listener
237
241
  * Fixed problem with generation of template for boolean cols
238
242
  * Improvement in Backend.js, now mask() when clean()
@@ -256,7 +260,7 @@
256
260
  * Added scope to the component events
257
261
  * Added a new task for update javascripts (add require 'lipsiadmin_tasks' if you don't have yet in your RakeFile)
258
262
  * Fixed padding in DateTime Field for firefox
259
- * Removed not necessary frontend images
263
+ * Removed not necessary frontend images
260
264
  * Extended Ext Component to be more flexible
261
265
  * Small refactoring of ext components
262
266
 
@@ -293,7 +297,7 @@
293
297
  * Refactored text_field, text_area, password_field helpers
294
298
  * Refactored country_select helper
295
299
  * Refactored ext_date_select, ext_datetime_select helpers
296
-
300
+
297
301
  2008-02-24
298
302
  * Rename Js app from Lipsiadmin.app to Backend.app
299
303
  * Added the possibility to reuse pages/froms/grids in windows.
@@ -317,7 +321,7 @@
317
321
  * Added utility scopes for paginate, include, search
318
322
  * Added a new literal method for prevent json to "strignify" javascripts funtctions (eg. "function() { alert('me')}".to_l)
319
323
  * Added a new module for escape utf8 chars for servers that don't have java with utf8 fonts (it's used by pdf builder)
320
-
324
+
321
325
  2008-05-21
322
326
  * Added a new PDF generator, we don't need the expensive PRINCEXML, we can use pd4ml
323
327
 
@@ -326,7 +330,7 @@
326
330
 
327
331
  2008-05-09.
328
332
  * Added ext-all-debug.js (Was autodetect if env == development)
329
- * Removed menuitems table and added new module project
333
+ * Removed menuitems table and added new module project
330
334
  * Improve Auth System with project modules
331
335
  * Initial rdoc documentation
332
336
  * Removed from admin view list to index so we can use cruds
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
27
27
  rdoc.rdoc_files.include('lib/**/*.rb')
28
28
  end
29
29
 
30
- spec = Gem::Specification.new do |s|
30
+ spec = Gem::Specification.new do |s|
31
31
  s.name = PKG_NAME
32
32
  s.version = PKG_VERSION
33
33
  s.author = "Davide D'Agostino"
@@ -39,7 +39,7 @@ spec = Gem::Specification.new do |s|
39
39
  s.files = FileList["CHANGELOG", "README.rdoc", "MIT-LICENSE", "Rakefile", "init.rb", "{lipsiadmin_generators,lib,resources,tasks}/**/*"].to_a
40
40
  s.has_rdoc = true
41
41
  s.requirements << "ImageMagick"
42
- s.add_dependency('haml')
42
+ s.add_dependency('haml', '<= 3.0.18')
43
43
  s.add_dependency('rails', '>= 2.2.1')
44
44
  end
45
45
 
@@ -65,7 +65,7 @@ desc "Unistall the gem from local"
65
65
  task :uninstall => [:clean] do
66
66
  sh %{sudo gem uninstall #{PKG_NAME}} rescue nil
67
67
  end
68
-
68
+
69
69
  desc "Generate a gemspec file for GitHub"
70
70
  task :gemspec do
71
71
  File.open("#{spec.name}.gemspec", 'w') do |f|
@@ -74,19 +74,12 @@ task :gemspec do
74
74
  end
75
75
 
76
76
  desc "Publish the API documentation"
77
- task :pdoc => [:rdoc] do
77
+ task :pdoc => [:rdoc] do
78
78
  Rake::SshDirPublisher.new("root@lipsiasoft.net", "/mnt/www/apps/lipsiasoft/doc", "doc").upload
79
79
  end
80
80
 
81
81
  desc "Publish the release files to RubyForge."
82
- task :release => [ :package ] do
83
- require 'rubyforge'
84
- require 'rake/contrib/rubyforgepublisher'
85
-
86
- packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
87
-
88
- rubyforge = RubyForge.new
89
- rubyforge.configure
90
- rubyforge.login
91
- rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
82
+ desc "Release the gem"
83
+ task :release => :package do
84
+ sh "gem push pkg/#{spec.name}-#{spec.version}.gem"
92
85
  end
data/lib/lipsiadmin.rb CHANGED
@@ -22,6 +22,7 @@ require 'data_base/translate_attributes'
22
22
  require 'data_base/attachment'
23
23
  require 'data_base/attachment_table'
24
24
  require 'data_base/utility_scopes'
25
+ gem 'haml', '3.0.18'
25
26
  require 'haml'
26
27
  require 'version'
27
28
  require 'generator'
@@ -61,7 +62,7 @@ end
61
62
 
62
63
  ActionMailer::Base.class_eval do
63
64
  include Lipsiadmin::Mailer::PdfBuilder
64
- include Lipsiadmin::View::Helpers::PdfHelper
65
+ include Lipsiadmin::View::Helpers::PdfHelper
65
66
  end
66
67
 
67
68
  # For Attachments
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@ module Lipsiadmin
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 5
4
4
  MINOR = 1
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,3 @@
1
+ Ext.util.Format.eurMoney=function(v){v=(Math.round((v-0)*100))/100;v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v);return v+" €"};Ext.util.Format.percentage=function(v,p,record){return(v+" %")};Ext.util.Format.boolRenderer=function(v,p,record){p.css+=" x-grid3-check-col-td";return'<div class="x-grid3-check-col'+(v?"-on":"")+" x-grid3-cc-"+this.id+'">&#160;</div>'};var treeDropConfig={getDropPoint:function(e,n,dd){var tn=n.node;if(tn.isRoot){return tn.allowChildren!==false?"append":false}var dragEl=n.ddel;var t=Ext.lib.Dom.getY(dragEl),b=t+dragEl.offsetHeight;var y=Ext.lib.Event.getPageY(e);var noAppend=tn.allowChildren===false;if(this.appendOnly||tn.parentNode.allowChildren===false){return noAppend?false:"append"}var noBelow=false;if(!this.allowParentInsert){noBelow=tn.hasChildNodes()&&tn.isExpanded()}var q=(b-t)/(noAppend?2:3);if(y>=t&&y<(t+q)){return"above"}else{if(!noBelow&&(noAppend||y>=b-q&&y<=b)){return"below"}else{return"append"}}},completeDrop:function(de){var ns=de.dropNode,p=de.point,t=de.target;if(!Ext.isArray(ns)){ns=[ns]}var n;for(var i=0,len=ns.length;i<len;i++){n=ns[i];if(p=="above"){t.parentNode.insertBefore(n,t)}else{if(p=="below"){t.parentNode.insertBefore(n,t.nextSibling)}else{t.leaf=false;t.appendChild(n)}}}n.ui.focus();if(this.tree.hlDrop){n.ui.highlight()}t.ui.endDrop();this.tree.fireEvent("nodedrop",de)}};Ext.grid.CheckColumn=function(config){Ext.apply(this,config);if(!this.id){this.id=Ext.id()}this.renderer=this.renderer.createDelegate(this)};Ext.grid.CheckColumn.prototype={init:function(grid){this.grid=grid;this.grid.on("render",function(){var view=this.grid.getView();view.mainBody.on("mousedown",this.onMouseDown,this)},this)},onMouseDown:function(e,t){if(t.className&&t.className.indexOf("x-grid3-cc-"+this.id)!=-1){e.stopEvent();var index=this.grid.getView().findRowIndex(t);var record=this.grid.store.getAt(index);var editEvent={grid:this.grid,record:this.grid.store.getAt(index),field:this.dataIndex,value:!record.data[this.dataIndex],originalValue:record.data[this.dataIndex],row:index,column:this.grid.getColumnModel().findColumnIndex(this.dataIndex)};record.set(this.dataIndex,editEvent.value);this.grid.getSelectionModel().selectRow(index);this.grid.fireEvent("afteredit",editEvent)}},renderer:function(v,p,record){p.css+=" x-grid3-check-col-td";return'<div class="x-grid3-check-col'+(v?"-on":"")+" x-grid3-cc-"+this.id+'">&#160;</div>'}};Ext.form.DateTimeField=Ext.extend(Ext.form.Field,{defaultAutoCreate:{tag:"input",type:"hidden"},timeWidth:100,dateWidth:100,dtSeparator:" ",hiddenFormat:"Y-m-d H:i:s",otherToNow:true,dateFormat:"d/m/y",timeFormat:"H:i",allowBlank:true,hideTime:false,initComponent:function(){Ext.form.DateTimeField.superclass.initComponent.call(this);var dateConfig=Ext.apply({},{id:this.id+"-date",format:this.dateFormat||Ext.form.DateField.prototype.format,width:this.dateWidth,allowBlank:this.allowBlank,selectOnFocus:this.selectOnFocus,listeners:{blur:{scope:this,fn:this.onBlur},focus:{scope:this,fn:this.onFocus}}},this.dateConfig);this.df=new Ext.form.DateField(dateConfig);this.df.ownerCt=this;delete (this.dateFormat);var timeConfig=Ext.apply({},{id:this.id+"-time",format:this.timeFormat||Ext.form.TimeField.prototype.format,allowBlank:(this.hideTime||this.allowBlank),width:this.timeWidth,selectOnFocus:this.selectOnFocus,listeners:{blur:{scope:this,fn:this.onBlur},focus:{scope:this,fn:this.onFocus}}},this.timeConfig);this.tf=new Ext.form.TimeField(timeConfig);this.tf.ownerCt=this;delete (this.timeFormat);this.relayEvents(this.df,["focus","specialkey","invalid","valid"]);this.relayEvents(this.tf,["focus","specialkey","invalid","valid"])},onRender:function(ct,position){if(this.isRendered){return}Ext.form.DateTimeField.superclass.onRender.call(this,ct,position);var t;var timeStyle=this.hideTime?"display:none":"";t=Ext.DomHelper.append(ct,{tag:"table",style:"border-collapse:collapse",children:[{tag:"tr",children:[{tag:"td",style:"padding-right:17px",cls:"datetime-date"},{tag:"td",cls:"datetime-time",style:timeStyle}]}]},true);this.tableEl=t;this.wrap=t.wrap();this.wrap.on("mousedown",this.onMouseDown,this,{delay:10});this.df.render(t.child("td.datetime-date"));this.tf.render(t.child("td.datetime-time"));this.df.wrap.setStyle({width:this.dateWidth});this.tf.wrap.setStyle({width:this.timeWidth});if(Ext.isIE&&Ext.isStrict){t.select("input").applyStyles({top:0})}this.on("specialkey",this.onSpecialKey,this);this.df.el.swallowEvent(["keydown","keypress"]);this.tf.el.swallowEvent(["keydown","keypress"]);if("side"===this.msgTarget){var elp=this.el.findParent(".x-form-element",10,true);this.errorIcon=elp.createChild({cls:"x-form-invalid-icon"});this.df.errorIcon=this.errorIcon;this.tf.errorIcon=this.errorIcon}if(!this.el.dom.name){this.el.dom.name=this.hiddenName||this.name||this.id}this.df.el.dom.removeAttribute("name");this.tf.el.dom.removeAttribute("name");this.isRendered=true;if(this.el.dom.value){this.setValue(this.el.dom.value)}else{if(true===this.emptyToNow){this.setValue(new Date());this.updateHidden()}}},adjustSize:Ext.BoxComponent.prototype.adjustSize,alignErrorIcon:function(){this.errorIcon.alignTo(this.tableEl,"tl-tr",[2,0])},initDateValue:function(){this.dateValue=this.otherToNow?new Date():""},clearInvalid:function(){this.df.clearInvalid();this.tf.clearInvalid()},beforeDestroy:function(){if(this.isRendered){this.wrap.removeAllListeners();this.wrap.remove();this.tableEl.remove();this.df.destroy();this.tf.destroy()}},disable:function(){if(this.isRendered){this.df.disabled=this.disabled;this.df.onDisable();this.tf.onDisable()}this.disabled=true;this.df.disabled=true;this.tf.disabled=true;this.fireEvent("disable",this);return this},enable:function(){if(this.rendered){this.df.onEnable();this.tf.onEnable()}this.disabled=false;this.df.disabled=false;this.tf.disabled=false;this.fireEvent("enable",this);return this},focus:function(){this.df.focus()},getPositionEl:function(){return this.wrap},getResizeEl:function(){return this.wrap},getValue:function(){return this.dateValue?new Date(this.dateValue):""},isValid:function(){return this.df.isValid()&&this.tf.isValid()},isVisible:function(){return this.df.rendered&&this.df.getActionEl().isVisible()},onBlur:function(f){if(this.wrapClick){f.focus();this.wrapClick=false}this.updateDate();this.updateTime();this.updateHidden();(function(){if(!this.df.hasFocus&&!this.tf.hasFocus){var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent("change",this,v,this.startValue)}this.hasFocus=false;this.fireEvent("blur",this)}}).defer(100,this)},onFocus:function(){if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this)}},onMouseDown:function(e){if(!this.disabled){this.wrapClick="td"===e.target.nodeName.toLowerCase()}},onSpecialKey:function(t,e){var key=e.getKey();if(key===e.TAB){if(t===this.df&&!e.shiftKey){e.stopEvent();this.tf.focus()}if(t===this.tf&&e.shiftKey){e.stopEvent();this.df.focus()}}if(key===e.ENTER){this.updateValue()}},setDate:function(date){this.df.setValue(date)},setTime:function(date){this.tf.setRawValue(date)},setSize:function(w,h){if(!w){return}if("below"===this.timePosition){this.df.setSize(w,h);this.tf.setSize(w,h);if(Ext.isIE){this.df.el.up("td").setWidth(w);this.tf.el.up("td").setWidth(w)}}else{this.df.setSize(w-this.timeWidth-4,h);this.tf.setSize(this.timeWidth,h);if(Ext.isIE){this.df.el.up("td").setWidth(w-this.timeWidth-4);this.tf.el.up("td").setWidth(this.timeWidth)}}},setValue:function(val){if(!val&&true===this.emptyToNow){this.setValue(new Date());return}else{if(!val){this.setDate("");this.setTime("");this.updateValue();return}}if("number"===typeof val){val=new Date(val)}else{if("string"===typeof val&&this.hiddenFormat){val=Date.parseDate(val,this.hiddenFormat)}}val=val?val:new Date(1970,0,1,0,0,0);var da,time;if(val instanceof Date){this.setDate(val);this.setTime(val.format(this.timeFormat));this.dateValue=new Date(val)}else{da=val.split(this.dtSeparator);this.setDate(da[0]);if(da[1]){if(da[2]){da[1]+=da[2]
2
+ }var hh=da[1].split(":");this.setTime(hh[0]+":"+hh[1])}}},setVisible:function(visible){if(visible){this.df.show();this.tf.show()}else{this.df.hide();this.tf.hide()}return this},show:function(){return this.setVisible(true)},hide:function(){return this.setVisible(false)},updateDate:function(){var d=this.df.getValue();if(d){if(!(this.dateValue instanceof Date)){this.initDateValue();if(!this.tf.getValue()){this.setTime(this.dateValue)}}this.dateValue.setMonth(0);this.dateValue.setFullYear(d.getFullYear());this.dateValue.setMonth(d.getMonth());this.dateValue.setDate(d.getDate())}else{this.dateValue="";this.setTime("")}},updateTime:function(){var t=this.tf.getValue();if(t&&!(t instanceof Date)){t=Date.parseDate(t,this.tf.format)}if(t&&!this.df.getValue()){this.initDateValue();this.setDate(this.dateValue)}if(this.dateValue instanceof Date){if(t){this.dateValue.setHours(t.getHours());this.dateValue.setMinutes(t.getMinutes());this.dateValue.setSeconds(t.getSeconds())}else{this.dateValue.setHours(0);this.dateValue.setMinutes(0);this.dateValue.setSeconds(0)}}},updateHidden:function(){if(this.isRendered){var value=this.dateValue instanceof Date?this.dateValue.format(this.hiddenFormat):"";this.el.dom.value=value}},updateValue:function(){this.updateDate();this.updateTime();this.updateHidden();return},validate:function(){return this.df.validate()&&this.tf.validate()},renderer:function(field){var format=field.editor.dateFormat||Ext.form.DateTime.prototype.dateFormat;format+=" "+(field.editor.timeFormat||Ext.form.DateTime.prototype.timeFormat);var renderer=function(val){var retval=Ext.util.Format.date(val,format);return retval};return renderer}});Ext.reg("datetimefield",Ext.form.DateTimeField);Ext.grid.Search=function(config){Ext.apply(this,config);Ext.grid.Search.superclass.constructor.call(this)};Ext.extend(Ext.grid.Search,Ext.util.Observable,{autoFocus:true,searchText:"Search",searchTipText:"Insert a word or press Search",selectAllText:"Select All",position:"top",iconCls:"check",checkIndexes:"all",disableIndexes:[],dateFormat:undefined,showSelectAll:true,menuStyle:"checkbox",minCharsTipText:"Insert at least {0} characters",mode:"remote",width:200,xtype:"gridsearch",paramNames:{fields:"fields",query:"query"},shortcutKey:"r",shortcutModifier:"alt",align:"right",minLength:3,init:function(grid){this.grid=grid;this.id=this.grid.id+"-search";if("string"===typeof this.toolbarContainer){this.toolbarContainer=Ext.getCmp(this.toolbarContainer)}grid.store.load=grid.store.load.createInterceptor(this.load,this);grid.onRender=grid.onRender.createSequence(this.onRender,this);grid.reconfigure=grid.reconfigure.createSequence(this.reconfigure,this)},onRender:function(){var panel=this.toolbarContainer||this.grid;var tb="bottom"===this.position?panel.bottomToolbar:panel.topToolbar;this.menu=new Ext.menu.Menu();if("right"===this.align){tb.addFill()}else{if(0<tb.items.getCount()){tb.addSeparator()}}tb.add({text:this.searchText,menu:this.menu});this.field=new Ext.form.TwinTriggerField({width:this.width,selectOnFocus:undefined===this.selectOnFocus?true:this.selectOnFocus,trigger1Class:"x-form-clear-trigger",trigger2Class:this.minChars?"x-hidden":"x-form-search-trigger",onTrigger1Click:this.minChars?Ext.emptyFn:this.onTriggerClear.createDelegate(this),onTrigger2Click:this.onTriggerSearch.createDelegate(this),minLength:this.minLength});this.field.on("render",function(){this.field.el.dom.qtip=this.minChars?String.format(this.minCharsTipText,this.minChars):this.searchTipText;if(this.minChars){this.field.el.on({scope:this,buffer:300,keyup:this.onKeyUp})}var map=new Ext.KeyMap(this.field.el,[{key:Ext.EventObject.ENTER,scope:this,fn:this.onTriggerSearch},{key:Ext.EventObject.ESC,scope:this,fn:this.onTriggerClear}]);map.stopEvent=true},this,{single:true});tb.add(this.field);this.initState();if(this.shortcutKey&&this.shortcutModifier){var shortcutEl=this.grid.getEl();var shortcutCfg=[{key:this.shortcutKey,scope:this,stopEvent:true,fn:function(){this.field.focus()}}];shortcutCfg[0][this.shortcutModifier]=true;this.keymap=new Ext.KeyMap(shortcutEl,shortcutCfg)}if(true===this.autoFocus){this.grid.store.on({scope:this,load:function(){this.field.focus()}})}},initState:function(){if(Ext.state.Manager){var state=Ext.state.Manager.get(this.id);this.applyState(state)}},applyState:function(state){if(state){if(state.checked&&state.checked instanceof Array){this.checkIndexes=state.checked}if(state.value){this.field.setValue(state.value)}}this.reconfigure();this.onTriggerSearch()},saveState:function(){if(Ext.state.Manager){var state=this.getState();Ext.state.Manager.set(this.id,state)}},getState:function(){var checked=[];this.menu.items.each(function(item){if(item.dataIndex&&item.checked){checked.push(item.dataIndex)}});this.inited=true;return{value:this.field.getValue(),checked:checked}},load:function(){return(this.field!=undefined&&this.inited==true)},onKeyUp:function(){var length=this.field.getValue().toString().length;if(0===length||this.minChars<=length){this.onTriggerSearch()}},onTriggerClear:function(){if(this.field.getValue()){this.field.setValue("");this.field.focus();this.onTriggerSearch()}this.saveState()},onTriggerSearch:function(){if(!this.field.isValid()){return}var val=this.field.getValue();var store=this.grid.store;if("local"===this.mode){store.clearFilter();if(val){store.filterBy(function(r){var retval=false;this.menu.items.each(function(item){if(!item.checked||retval){return}var rv=r.get(item.dataIndex);rv=rv instanceof Date?rv.format(this.dateFormat||r.fields.get(item.dataIndex).dateFormat):rv;var re=new RegExp(val,"gi");retval=re.test(rv)},this);if(retval){return true}return retval},this)}else{}}else{if(store.lastOptions&&store.lastOptions.params){store.lastOptions.params[store.paramNames.start]=0}var fields=[];this.menu.items.each(function(item){if(item.checked&&item.dataIndex){fields.push(item.dataIndex)}});delete (store.baseParams[this.paramNames.fields]);delete (store.baseParams[this.paramNames.query]);if(store.lastOptions&&store.lastOptions.params){delete (store.lastOptions.params[this.paramNames.fields]);delete (store.lastOptions.params[this.paramNames.query])}if(fields.length){store.baseParams[this.paramNames.fields]=fields.compact().join();store.baseParams[this.paramNames.query]=val}store.reload()}this.saveState()},setDisabled:function(){this.field.setDisabled.apply(this.field,arguments)},enable:function(){this.setDisabled(false)},disable:function(){this.setDisabled(true)},reconfigure:function(){var menu=this.menu;menu.removeAll();if(this.showSelectAll&&"radio"!==this.menuStyle){menu.add(new Ext.menu.CheckItem({text:this.selectAllText,checked:!(this.checkIndexes instanceof Array),hideOnClick:false,handler:function(item){var checked=!item.checked;item.parentMenu.items.each(function(i){if(item!==i&&i.setChecked&&!i.disabled){i.setChecked(checked)}})}}),"-")}var cm=this.grid.colModel;var group=undefined;if("radio"===this.menuStyle){group="g"+(new Date).getTime()}Ext.each(cm.config,function(config){var disable=false;if(config.header&&config.dataIndex&&config.sortable){Ext.each(this.disableIndexes,function(item){disable=disable?disable:item===config.dataIndex});if(!disable){menu.add(new Ext.menu.CheckItem({text:config.header,hideOnClick:false,group:group,checked:"all"===this.checkIndexes,dataIndex:config.dataIndex}))}}},this);if(this.checkIndexes instanceof Array){Ext.each(this.checkIndexes,function(di){var item=menu.items.find(function(itm){return itm.dataIndex===di});if(item){item.setChecked(true,true)}},this)}if(this.readonlyIndexes instanceof Array){Ext.each(this.readonlyIndexes,function(di){var item=menu.items.find(function(itm){return itm.dataIndex===di});if(item){item.disable()}},this)}}});Ext.state.DataBaseProvider=function(config){Ext.state.DataBaseProvider.superclass.constructor.call(this);this.path="/backend/state_sessions";Ext.apply(this,config);this.state=this.readCookies()};Ext.extend(Ext.state.DataBaseProvider,Ext.state.Provider,{set:function(name,value){if(typeof value=="undefined"||value===null){this.clear(name);
3
+ return}this.setCookie(name,value);Ext.state.DataBaseProvider.superclass.set.call(this,name,value)},clear:function(name){this.clearCookie(name);Ext.state.DataBaseProvider.superclass.clear.call(this,name)},readCookies:function(){var cookies={};var values=[];new Ajax.Request(this.path,{method:"GET",asynchronous:false,onSuccess:function(response,request){values=Ext.decode(response.responseText)}});values.each(function(f){if(f.state_session&&f.state_session.component&&f.state_session.component.substring(0,3)=="ys-"){cookies[f.state_session.component.substr(3)]=this.decodeValue(f.state_session.data)}},this);return cookies},setCookie:function(name,value){Ext.Ajax.request({url:this.path,method:"POST",params:{id:"ys-"+name,data:this.encodeValue(value)}})},clearCookie:function(name){Ext.Ajax.request({url:this.path+"/ys-"+name,method:"DELETE"})}});
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lipsiadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.2
4
+ hash: 53
5
+ prerelease: false
6
+ segments:
7
+ - 5
8
+ - 1
9
+ - 3
10
+ version: 5.1.3
5
11
  platform: ruby
6
12
  authors:
7
13
  - Davide D'Agostino
@@ -9,29 +15,41 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-03 00:00:00 +01:00
18
+ date: 2010-10-03 00:00:00 +02:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: haml
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
- - - ">="
27
+ - - <=
22
28
  - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
29
+ hash: 35
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 18
34
+ version: 3.0.18
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  - !ruby/object:Gem::Dependency
26
38
  name: rails
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
45
+ hash: 5
46
+ segments:
47
+ - 2
48
+ - 2
49
+ - 1
33
50
  version: 2.2.1
34
- version:
51
+ type: :runtime
52
+ version_requirements: *id002
35
53
  description:
36
54
  email: d.dagostino@lipsiasoft.com
37
55
  executables: []
@@ -441,8 +459,8 @@ files:
441
459
  - lib/view/helpers/frontend_helper.rb
442
460
  - lib/view/helpers/pdf_helper.rb
443
461
  - lib/view/helpers/view_helper.rb
444
- - resources/javascripts/swfuploadpanel.js
445
462
  - resources/javascripts/ux.js
463
+ - resources/javascripts/ux.min.js
446
464
  - resources/pd4ml/pd4ml.jar
447
465
  - resources/pd4ml/ruby/Pd4Ruby.class
448
466
  - resources/pd4ml/ruby/Pd4Ruby.java
@@ -459,21 +477,27 @@ rdoc_options: []
459
477
  require_paths:
460
478
  - lib
461
479
  required_ruby_version: !ruby/object:Gem::Requirement
480
+ none: false
462
481
  requirements:
463
482
  - - ">="
464
483
  - !ruby/object:Gem::Version
484
+ hash: 3
485
+ segments:
486
+ - 0
465
487
  version: "0"
466
- version:
467
488
  required_rubygems_version: !ruby/object:Gem::Requirement
489
+ none: false
468
490
  requirements:
469
491
  - - ">="
470
492
  - !ruby/object:Gem::Version
493
+ hash: 3
494
+ segments:
495
+ - 0
471
496
  version: "0"
472
- version:
473
497
  requirements:
474
498
  - ImageMagick
475
499
  rubyforge_project: lipsiadmin
476
- rubygems_version: 1.3.5
500
+ rubygems_version: 1.3.7
477
501
  signing_key:
478
502
  specification_version: 3
479
503
  summary: Lipsiadmin is a new revolutionary admin for your projects.Lipsiadmin is based on Ext Js 2.0. framework (with prototype adapter) and is ready for Rails 2.0. This admin is for newbie developper but also for experts, is not entirely written in javascript because the aim of developper wose build in a agile way web/site apps so we use extjs in a new intelligent way a mixin of 'old' html and new ajax functions, for example ext manage the layout of page, grids, tree and errors, but form are in html code.
@@ -1,790 +0,0 @@
1
- /**
2
- * @class Ext.SwfUploadPanel
3
- * @extends Ext.grid.GridPanel
4
-
5
- * Makes a Panel to provide the ability to upload multiple files using the SwfUpload flash script.
6
- *
7
- * @author Stephan Wentz
8
- * @author Michael Giddens (Original author)
9
- * @website http://www.brainbits.net
10
- * @created 2008-02-26
11
- * @version 0.5
12
- *
13
- * known_issues
14
- * - Progress bar used hardcoded width. Not sure how to make 100% in bbar
15
- * - Panel requires width / height to be set. Not sure why it will not fit
16
- * - when panel is nested sometimes the column model is not always shown to fit until a file is added. Render order issue.
17
- *
18
- * @constructor
19
- * @param {Object} config The config object
20
- */
21
- Ext.SwfUploadPanel = Ext.extend(Ext.grid.GridPanel, {
22
-
23
- /**
24
- * @cfg {Object} strings
25
- * All strings used by Ext.SwfUploadPanel
26
- */
27
- strings: {
28
- text_add: 'Add File(s)',
29
- text_upload: 'Upload File(s)',
30
- text_cancel: 'Cancel Upload',
31
- text_clear: 'Clear Queue',
32
- text_progressbar: 'Progress Bar',
33
- text_remove: 'Remove File',
34
- text_remove_sure: 'Are you sure you wish to remove this file from queue?',
35
- text_error: 'Error',
36
- text_uploading: 'Uploading file: {0} ({1} of {2})',
37
- header_filename: 'Filename',
38
- header_size: 'Size',
39
- header_status: 'Status',
40
- status: {
41
- 0: 'Queued',
42
- 1: 'Uploading...',
43
- 2: 'Completed',
44
- 3: 'Error',
45
- 4: 'Cancelled'
46
- },
47
- error_queue_exceeded: 'The selected file(s) exceed(s) the maximum number of {0} queued files.',
48
- error_queue_slots_0: 'There is no slot left',
49
- error_queue_slots_1: 'There is only one slot left',
50
- error_queue_slots_2: 'There are only {0} slots left',
51
- error_size_exceeded: 'The selected files size exceeds the allowed limit of 1 MB.',
52
- error_zero_byte_file: 'Zero byte file selected.',
53
- error_invalid_filetype: 'Invalid filetype selected.',
54
- error_file_not_found: 'File not found 404.',
55
- error_security_error: 'Security Error. Not allowed to post to different url.'
56
- },
57
-
58
- /**
59
- * @cfg {Boolean} single_select
60
- * false to allow multiple file selections, true for single file selection.
61
- * Please note that this doesn't affect the number of allowed files in the queue.
62
- * Use the {@link #file_queue_limit} parameter to change the allowed number of files in the queue.
63
- */
64
- single_select: true,
65
- /**
66
- * @cfg {Boolean} confirm_delete
67
- * Show a confirmation box on deletion of queued files.
68
- */
69
- confirm_delete: true,
70
- /**
71
- * @cfg {String} file_types
72
- * Allowed file types for the File Selection Dialog. Use semi-colon as a seperator for multiple file-types.
73
- */
74
- file_types: "*.*", // Default allow all file types
75
- /**
76
- * @cfg {String} file_types
77
- * A text description that is displayed to the user in the File Browser dialog.
78
- */
79
- file_types_description: "All Files", //
80
- /**
81
- * @cfg {String} file_size_limit
82
- * The file_size_limit setting defines the maximum allowed size of a file to be uploaded.
83
- * This setting accepts a value and unit. Valid units are B, KB, MB and GB. If the unit is omitted default is KB.
84
- * A value of 0 (zero) is interpretted as unlimited.
85
- */
86
- file_size_limit: "1MB", // Default size limit 100MB
87
- /**
88
- * @cfg {String} file_upload_limit
89
- * Defines the number of files allowed to be uploaded by SWFUpload.
90
- * This setting also sets the upper bound of the {@link #file_queue_limit} setting.
91
- * The value of 0 (zero) is interpretted as unlimited.
92
- */
93
- file_upload_limit: "0", // Default no upload limit
94
- /**
95
- * @cfg {String} file_queue_limit
96
- * Defines the number of unprocessed files allowed to be simultaneously queued.
97
- * The value of 0 (zero) is interpretted as unlimited.
98
- */
99
- file_queue_limit: "0", // Default no queue limit
100
- /**
101
- * @cfg {String} file_post_name
102
- * The file_post_name allows you to set the value name used to post the file.
103
- */
104
- file_post_name: "file", // Default name
105
- /**
106
- * @cfg {String} flash_url
107
- * The full, absolute, or relative URL to the Flash Control swf file.
108
- */
109
- flash_url: "swfupload.swf", // Default url, relative to the page url
110
- /**
111
- * @cfg {Boolean} debug
112
- * A boolean value that defines whether the debug event handler should be fired.
113
- */
114
- debug: false,
115
-
116
- // standard grid parameters
117
- autoExpandColumn: 'name',
118
- enableColumnResize: false,
119
- enableColumnMove: false,
120
- border: false,
121
- viewConfig: { forceFit: true },
122
-
123
- // private
124
- upload_cancelled: false,
125
-
126
- // private
127
- initComponent: function() {
128
-
129
- this.addEvents(
130
- /**
131
- * @event swfUploadLoaded
132
- * Fires after the Flash object has been loaded
133
- * @param {Ext.grid.GridPanel} grid This grid
134
- */
135
- 'swfUploadLoaded',
136
- /**
137
- * @event swfUploadLoaded
138
- * Fires after a file has been qeueud
139
- * @param {Ext.grid.GridPanel} grid This grid
140
- * @param {Object} file The file object that produced the error
141
- */
142
- 'fileQueued',
143
- /**
144
- * @event startUpload
145
- * Fires before the upload starts
146
- * @param {Ext.grid.GridPanel} grid This grid
147
- */
148
- 'startUpload',
149
- /**
150
- * @event fileUploadError
151
- * Fires after an upload has been stopped or cancelled
152
- * @param {Ext.grid.GridPanel} grid This grid
153
- * @param {Object} file The file object that produced the error
154
- * @param {String} code The error code
155
- * @param {String} message Supplemental error message
156
- */
157
- 'fileUploadError',
158
- /**
159
- * @event fileUploadSuccess
160
- * Fires after an upload has been successfully uploaded
161
- * @param {Ext.grid.GridPanel} grid This grid
162
- * @param {Object} file The file object that has been uploaded
163
- * @param {Object} data The response data of the upload request
164
- */
165
- 'fileUploadSuccess',
166
- /**
167
- * @event fileUploadComplete
168
- * Fires after the upload cycle for one file finished
169
- * @param {Ext.grid.GridPanel} grid This grid
170
- * @param {Object} file The file object that has been uploaded
171
- */
172
- 'fileUploadComplete',
173
- /**
174
- * @event fileUploadComplete
175
- * Fires after the upload cycle for all files in the queue finished
176
- * @param {Ext.grid.GridPanel} grid This grid
177
- */
178
- 'allUploadsComplete',
179
- /**
180
- * @event fileUploadComplete
181
- * Fires after one or more files have been removed from the queue
182
- * @param {Ext.grid.GridPanel} grid This grid
183
- */
184
- 'removeFiles',
185
- /**
186
- * @event fileUploadComplete
187
- * Fires after all files have been removed from the queue
188
- * @param {Ext.grid.GridPanel} grid This grid
189
- */
190
- 'removeAllFiles'
191
- );
192
-
193
- this.rec = Ext.data.Record.create([
194
- {name: 'name'},
195
- {name: 'size'},
196
- {name: 'id'},
197
- {name: 'type'},
198
- {name: 'creationdate', type: 'date', dateFormat: 'm/d/Y'},
199
- {name: 'status'}
200
- ]);
201
-
202
- this.store = new Ext.data.Store({
203
- reader: new Ext.data.JsonReader({
204
- id: 'id'
205
- }, this.rec)
206
- });
207
-
208
- this.columns = [{
209
- id:'name',
210
- header: this.strings.header_filename,
211
- dataIndex: 'name'
212
- },{
213
- id:'size',
214
- header: this.strings.header_size,
215
- width: 80,
216
- dataIndex: 'size',
217
- renderer: this.formatBytes
218
- },{
219
- id:'status',
220
- header: this.strings.header_status,
221
- width: 100,
222
- dataIndex: 'status',
223
- renderer: this.formatStatus.createDelegate(this)
224
- },{
225
- id:'progress',
226
- header: 'Progess',
227
- width: 150,
228
- renderer: this.formatProgressBar
229
- }
230
-
231
- ];
232
-
233
- this.sm = new Ext.grid.RowSelectionModel({
234
- singleSelect: this.single_select
235
- });
236
-
237
- this.tbar = [{
238
- text: this.strings.text_add,
239
- cls: 'x-btn-text-icon add',
240
- xhandler: function() {
241
- if (this.single_select) {
242
- this.suo.selectFile();
243
- }
244
- else {
245
- this.suo.selectFiles();
246
- }
247
- },
248
- xscope: this,
249
- // added by mh
250
- listeners: {
251
- render: function(){
252
- this.initButton();
253
- },
254
- scope: this
255
- }
256
- // end added
257
- }, '->', {
258
- text: this.strings.text_cancel,
259
- cls: 'x-btn-text-icon remove',
260
- handler: this.stopUpload,
261
- scope: this,
262
- hidden: true
263
- }, {
264
- text: this.strings.text_upload,
265
- cls: 'x-btn-text-icon upload',
266
- handler: this.startUpload,
267
- scope: this,
268
- hidden: true
269
- }, {
270
- text: this.strings.text_clear,
271
- cls: 'x-btn-text-icon remove',
272
- handler: this.removeAllFiles,
273
- scope: this,
274
- hidden: false
275
- }];
276
-
277
- this.addListener({
278
- keypress: {
279
- fn: function(e) {
280
- if (this.confirm_delete) {
281
- if(e.getKey() == e.DELETE) {
282
- Ext.MessageBox.confirm(this.strings.text_remove,this.strings.text_remove_sure, function(e) {
283
- if (e == 'yes') {
284
- this.removeFiles();
285
- }
286
- }, this);
287
- }
288
- } else {
289
- this.removeFiles(this);
290
- }
291
- },
292
- scope: this
293
- },
294
-
295
- // Prevent the default right click to show up in the grid.
296
- contextmenu: function(e) {
297
- e.stopEvent();
298
- },
299
-
300
- // modified by mh
301
- render: function(){
302
- this.addBtn = this.getTopToolbar().items.items[0];
303
- this.cancelBtn = this.getTopToolbar().items.items[2];
304
- this.uploadBtn = this.getTopToolbar().items.items[3];
305
- this.clearBtn = this.getTopToolbar().items.items[4];
306
- }
307
- // end modified
308
- });
309
-
310
- Ext.SwfUploadPanel.superclass.initComponent.call(this);
311
- },
312
-
313
- // modified by mh - refactor to separate method
314
- initButton: function() {
315
- var suoID = Ext.id();
316
- var em = this.addBtn.el.child('em');
317
- em.setStyle({
318
- position: 'relative',
319
- display: 'block'
320
- });
321
- em.createChild({
322
- tag: 'div',
323
- id: suoID
324
- });
325
- this.suo = new SWFUpload({
326
- button_placeholder_id: suoID,
327
- button_width: em.getWidth(),
328
- button_height: em.getHeight(),
329
- button_cursor: SWFUpload.CURSOR.HAND,
330
- button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
331
-
332
- upload_url: this.upload_url,
333
- post_params: this.post_params,
334
- file_post_name: this.file_post_name,
335
- file_size_limit: this.file_size_limit,
336
- file_queue_limit: this.file_queue_limit,
337
- file_types: this.file_types,
338
- file_types_description: this.file_types_description,
339
- file_upload_limit: this.file_upload_limit,
340
- flash_url: this.flash_url,
341
-
342
- // Event Handler Settings
343
- swfupload_loaded_handler: this.swfUploadLoaded.createDelegate(this),
344
-
345
- file_dialog_start_handler: this.fileDialogStart.createDelegate(this),
346
- file_queued_handler: this.fileQueue.createDelegate(this),
347
- file_queue_error_handler: this.fileQueueError.createDelegate(this),
348
- file_dialog_complete_handler: this.fileDialogComplete.createDelegate(this),
349
-
350
- upload_start_handler: this.uploadStart.createDelegate(this),
351
- upload_progress_handler: this.uploadProgress.createDelegate(this),
352
- upload_error_handler: this.uploadError.createDelegate(this),
353
- upload_success_handler: this.uploadSuccess.createDelegate(this),
354
- upload_complete_handler: this.uploadComplete.createDelegate(this),
355
-
356
- debug: this.debug,
357
- debug_handler: this.debug ? this.debugHandler : Ext.emptyFn
358
- });
359
-
360
- Ext.get(this.suo.movieName).setStyle({
361
- position: 'absolute',
362
- top: 0,
363
- left: 0
364
- });
365
- },
366
-
367
- formatProgressBar : function(_v, cellmeta, record){
368
- switch(record.data.fileState){
369
- case SWFUpload.FILE_STATUS.COMPLETE:
370
- if(Ext.isIE){
371
- returnValue =
372
- '<div class="x-progress-wrap" style="height: 18px">' +
373
- '<div class="x-progress-inner">' +
374
- '<div style="width: 100%;" class="x-progress-bar x-progress-text">' + '100 %'
375
- '</div>' +
376
- '</div>' +
377
- '</div>';
378
- }else{
379
- returnValue =
380
- '<div class="x-progress-wrap" style="height: 18px">' +
381
- '<div class="x-progress-inner">' +
382
- '<div id="progressBar_' + record.data.id + '" style="width: 100%;" class="x-progress-bar">' +
383
- '</div>' +
384
- '<div id="progressText_' + record.data.id + '" style="width: 100%;" class="x-progress-text x-progress-text-back" />100 %</div>'
385
- '</div>' +
386
- '</div>';
387
- }
388
- break;
389
- default :
390
- returnValue =
391
- '<div class="x-progress-wrap" style="height: 18px">' +
392
- '<div class="x-progress-inner">' +
393
- '<div id="progressBar_' + record.data.id + '" style="width: 0%;" class="x-progress-bar">' +
394
- '</div>' +
395
- '<div id="progressText_' + record.data.id + '" style="width: 100%;" class="x-progress-text x-progress-text-back" />0 %</div>'
396
- '</div>' +
397
- '</div>';
398
- break;
399
- }
400
- return returnValue;
401
- },
402
-
403
- /**
404
- * SWFUpload debug handler
405
- * @param {Object} line
406
- */
407
- debugHandler: function(line) {
408
- console.log(line);
409
- },
410
-
411
- /**
412
- * Formats file status
413
- * @param {Integer} status
414
- * @return {String}
415
- */
416
- formatStatus: function(status) {
417
- return this.strings.status[status];
418
- },
419
-
420
- /**
421
- * Formats raw bytes into kB/mB/GB/TB
422
- * @param {Integer} bytes
423
- * @return {String}
424
- */
425
- formatBytes: function(size) {
426
- if (!size) {
427
- size = 0;
428
- }
429
- var suffix = ["B", "KB", "MB", "GB"];
430
- var result = size;
431
- size = parseInt(size, 10);
432
- result = size + " " + suffix[0];
433
- var loop = 0;
434
- while (size / 1024 > 1) {
435
- size = size / 1024;
436
- loop++;
437
- }
438
- result = Math.round(size) + " " + suffix[loop];
439
-
440
- return result;
441
-
442
- if(isNaN(bytes)) {
443
- return ('');
444
- }
445
-
446
- var unit, val;
447
-
448
- if(bytes < 999) {
449
- unit = 'B';
450
- val = (!bytes && this.progressRequestCount >= 1) ? '~' : bytes;
451
- } else if(bytes < 999999) {
452
- unit = 'kB';
453
- val = Math.round(bytes/1000);
454
- } else if(bytes < 999999999) {
455
- unit = 'MB';
456
- val = Math.round(bytes/100000) / 10;
457
- } else if(bytes < 999999999999) {
458
- unit = 'GB';
459
- val = Math.round(bytes/100000000) / 10;
460
- } else {
461
- unit = 'TB';
462
- val = Math.round(bytes/100000000000) / 10;
463
- }
464
-
465
- return (val + ' ' + unit);
466
- },
467
-
468
- /**
469
- * SWFUpload swfUploadLoaded event
470
- */
471
- swfUploadLoaded: function() {
472
- if(this.debug) console.info('SWFUPLOAD LOADED');
473
-
474
- this.fireEvent('swfUploadLoaded', this);
475
- },
476
-
477
- /**
478
- * SWFUpload fileDialogStart event
479
- */
480
- fileDialogStart: function() {
481
- if(this.debug) console.info('FILE DIALOG START');
482
-
483
- this.fireEvent('fileDialogStart', this);
484
- },
485
-
486
- /**
487
- * Add file to store / grid
488
- * SWFUpload fileQueue event
489
- * @param {Object} file
490
- */
491
- fileQueue: function(file) {
492
- if(this.debug) console.info('FILE QUEUE');
493
- file.status = 0;
494
- r = new this.rec(file);
495
- r.id = file.id;
496
- this.store.add(r);
497
-
498
- this.fireEvent('fileQueued', this, file);
499
- },
500
-
501
- /**
502
- * Error when file queue error occurs
503
- * SWFUpload fileQueueError event
504
- * @param {Object} file
505
- * @param {Integer} code
506
- * @param {string} message
507
- */
508
- fileQueueError: function(file, code, message) {
509
- if(this.debug) console.info('FILE QUEUE ERROR');
510
-
511
- switch (code) {
512
- case -100:
513
- var slots;
514
- switch(message) {
515
- case '0':
516
- slots = this.strings.error_queue_slots_0;
517
- break;
518
- case '1':
519
- slots = this.strings.error_queue_slots_1;
520
- break;
521
- default:
522
- slots = String.format(this.strings.error_queue_slots_2, message);
523
- }
524
- Ext.MessageBox.alert(this.strings.text_error, String.format(this.strings.error_queue_exceeded + ' ' + slots, this.file_queue_limit));
525
- break;
526
-
527
- case -110:
528
- Ext.MessageBox.alert(this.strings.text_error, String.format(this.strings.error_size_exceeded, this.formatBytes(this.file_size_limit * 1024)));
529
- break;
530
-
531
- case -120:
532
- Ext.MessageBox.alert(this.strings.text_error, this.strings.error_zero_byte_file);
533
- break;
534
-
535
- case -130:
536
- Ext.MessageBox.alert(this.strings.text_error, this.strings.error_invalid_filetype);
537
- break;
538
- }
539
-
540
- this.fireEvent('fileQueueError', this, file, code/*, error*/);
541
- },
542
-
543
- /**
544
- * SWFUpload fileDialogComplete event
545
- * @param {Integer} file_count
546
- */
547
- fileDialogComplete: function(file_count) {
548
- if(this.debug) console.info('FILE DIALOG COMPLETE');
549
-
550
- if (file_count > 0) {
551
- this.uploadBtn.show();
552
- }
553
-
554
- this.addBtn.show();
555
- this.clearBtn.show();
556
-
557
- this.fireEvent('fileDialogComplete', this, file_count);
558
- },
559
-
560
- /**
561
- * SWFUpload uploadStart event
562
- * @param {Object} file
563
- */
564
- uploadStart: function(file) {
565
- if(this.debug) console.info('UPLOAD START');
566
- this.fireEvent('uploadStart', this, file);
567
-
568
- return true;
569
- },
570
-
571
- /**
572
- * SWFUpload uploadProgress event
573
- * @param {Object} file
574
- * @param {Integer} bytes_completed
575
- * @param {Integer} bytes_total
576
- */
577
- progressCount : 0,
578
- uploadProgress: function(file, bytes_completed, bytes_total) {
579
- //if(this.debug)
580
- var percent = Math.ceil((bytes_completed / bytes_total) * 100);
581
- if (percent != this.progressCount)
582
- {
583
- Ext.getDom('progressBar_' + file.id).style.width = percent + "%";
584
- Ext.getDom('progressText_' + file.id).innerHTML = percent + " %";
585
- this.progressCount = percent;
586
- }
587
-
588
- //console.info(percent);
589
-
590
- this.store.getById(file.id).set('status', 1);
591
-
592
- //this.store.getById(file.id).commit();
593
-
594
- this.fireEvent('uploadProgress', this, file, bytes_completed, bytes_total);
595
- },
596
-
597
- /**
598
- * SWFUpload uploadError event
599
- * Show notice when error occurs
600
- * @param {Object} file
601
- * @param {Integer} error
602
- * @param {Integer} code
603
- * @return {}
604
- */
605
- uploadError: function(file, error, code) {
606
- if(this.debug) console.info('UPLOAD ERROR');
607
- if (code==500)
608
- {
609
- Ext.MessageBox.alert(this.strings.text_error, "File too big");
610
- this.fireEvent('fileUploadError', this, file, error, code);
611
- return;
612
- }
613
- switch (error) {
614
- case -200:
615
- Ext.MessageBox.alert(this.strings.text_error, this.strings.error_file_not_found);
616
- break;
617
-
618
- case -230:
619
- Ext.MessageBox.alert(this.strings.text_error, this.strings.error_security_error);
620
- break;
621
-
622
- case -290:
623
- this.store.getById(file.id).set('status', 4);
624
- this.store.getById(file.id).commit();
625
- break;
626
- }
627
-
628
- this.fireEvent('fileUploadError', this, file, error, code);
629
- },
630
-
631
- /**
632
- * SWFUpload uploadSuccess event
633
- * @param {Object} file
634
- * @param {Object} response
635
- */
636
- uploadSuccess: function(file, response) {
637
- if(this.debug) console.info('UPLOAD SUCCESS');
638
-
639
- var data = Ext.decode(response);
640
- if (data.success) {
641
- this.store.getById(file.id).data.fileState = SWFUpload.FILE_STATUS.COMPLETE;
642
- this.store.getById(file.id).set('status', 2);
643
- //this.store.remove(this.store.getById(file.id));
644
- } else {
645
- this.store.getById(file.id).set('status', 3);
646
- this.store.getById(file.id).commit();
647
- if (data.msg) {
648
- Ext.MessageBox.alert(this.strings.text_error, data.msg);
649
- }
650
- }
651
-
652
-
653
- this.fireEvent('fileUploadSuccess', this, file, data);
654
- },
655
-
656
- /**
657
- * SWFUpload uploadComplete event
658
- * @param {Object} file
659
- */
660
- uploadComplete: function(file) {
661
- if(this.debug) console.info('UPLOAD COMPLETE');
662
-
663
- if(this.suo.getStats().files_queued && !this.upload_cancelled) {
664
- this.suo.startUpload();
665
- } else {
666
- this.fireEvent('fileUploadComplete', this, file);
667
-
668
- this.allUploadsComplete();
669
- }
670
-
671
- },
672
-
673
- /**
674
- * SWFUpload allUploadsComplete method
675
- */
676
- allUploadsComplete: function() {
677
- this.cancelBtn.hide();
678
- this.addBtn.show();
679
- this.clearBtn.show();
680
-
681
- this.fireEvent('allUploadsComplete', this);
682
- },
683
-
684
- /**
685
- * SWFUpload setPostParams method
686
- * @param {String} name
687
- * @param {String} value
688
- */
689
- addPostParam: function(name, value) {
690
- if (this.suo) {
691
- this.suo.settings.post_params[name] = value;
692
- this.suo.setPostParams(this.suo.settings.post_params);
693
- } else {
694
- this.post_params[name] = value;
695
- }
696
- },
697
-
698
- /**
699
- * Start file upload
700
- * SWFUpload startUpload method
701
- */
702
- startUpload: function() {
703
- if(this.debug) console.info('START UPLOAD');
704
-
705
- this.cancelBtn.show();
706
- this.uploadBtn.hide();
707
- this.clearBtn.hide();
708
- // this.addBtn.hide();
709
-
710
- this.upload_cancelled = false;
711
-
712
- this.fireEvent('startUpload', this);
713
-
714
- this.suo.startUpload();
715
- },
716
-
717
- /**
718
- * SWFUpload stopUpload method
719
- * @param {Object} file
720
- */
721
- stopUpload: function(file) {
722
- if(this.debug) console.info('STOP UPLOAD');
723
-
724
- this.suo.stopUpload();
725
-
726
- this.upload_cancelled = true;
727
-
728
- this.getStore().each(function() {
729
- if (this.data.status == 1) {
730
- this.set('status', 0);
731
- this.commit();
732
- }
733
- });
734
-
735
- this.cancelBtn.hide();
736
- if (this.suo.getStats().files_queued > 0) {
737
- this.uploadBtn.show();
738
- }
739
- this.addBtn.show();
740
- this.clearBtn.show();
741
- },
742
-
743
- /**
744
- * Delete one or multiple rows
745
- * SWFUpload cancelUpload method
746
- */
747
- removeFiles: function() {
748
- if(this.debug) console.info('REMOVE FILES');
749
-
750
- var selRecords = this.getSelections();
751
- for (var i=0; i < selRecords.length; i++) {
752
- if (selRecords[i].data.status != 1) {
753
- this.suo.cancelUpload(selRecords[i].id);
754
- this.store.remove(selRecords[i]);
755
- }
756
- }
757
-
758
- if (this.suo.getStats().files_queued === 0) {
759
- this.uploadBtn.hide();
760
- // this.clearBtn.hide();
761
- }
762
-
763
- this.fireEvent('removeFiles', this);
764
- },
765
-
766
- /**
767
- * Clear the Queue
768
- * SWFUpload cancelUpload method
769
- */
770
- removeAllFiles: function() {
771
- if(this.debug) console.info('REMOVE ALL');
772
-
773
- // mark all internal files as cancelled
774
- var files_left = this.suo.getStats().files_queued;
775
-
776
- while (files_left > 0) {
777
- this.suo.cancelUpload();
778
- files_left = this.suo.getStats().files_queued;
779
- }
780
-
781
- this.store.removeAll();
782
-
783
- this.cancelBtn.hide();
784
- this.uploadBtn.hide();
785
- // this.clearBtn.hide();
786
-
787
- this.fireEvent('removeAllFiles', this);
788
- }
789
-
790
- });