lipsiadmin 3.2 → 3.3

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 CHANGED
@@ -1,3 +1,15 @@
1
+ 2009-03-13
2
+ * Improve licensed PD4ML detection, now will look first into vendor/pd4ml
3
+ * Bump to version 3.3
4
+ * Fixed a bug with responds_to_parent
5
+ * Added a new generator for build database state session for extjs (script/generate state_session)
6
+ * Added a new utils for use your licensed (if you have it) pd4ml jar
7
+ * Fix pluralization in creatin migrations (attachment)
8
+ * Removed debug info in lipsiadmin rake
9
+
10
+ 2009-03-10
11
+ * Fixed some typos in attachment table [Vakiliy]
12
+
1
13
  2009-03-10
2
14
  * Bump to version 3.2
3
15
  * Fixed a problem with has_one_attachment
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/gempackagetask'
7
7
  require 'rake/contrib/sshpublisher'
8
8
 
9
9
  PKG_NAME = 'lipsiadmin'
10
- PKG_VERSION = "3.2"
10
+ PKG_VERSION = "3.3"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
 
13
13
  $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
@@ -1,6 +1,10 @@
1
1
  module Lipsiadmin
2
2
  module Controller
3
- # This module convert a string/controller to a pdf through Pd4ml java library (included in this plugin)
3
+ # This module convert a string/controller to a pdf through Pd4ml java library (included in this plugin)-
4
+ #
5
+ # PD4ML is a powerful PDF generating tool that uses HTML and CSS (Cascading Style Sheets) as page layout
6
+ # and content definition format. Written in 100% pure Java, it allows users to easily add PDF generation
7
+ # functionality to end products.
4
8
  #
5
9
  # For generate a pdf you can simply do
6
10
  #
@@ -18,16 +22,31 @@ module Lipsiadmin
18
22
  #
19
23
  # * landescape, default it's false
20
24
  # * send_data, default it's true
21
- #
25
+ #
26
+ # Lipsiadmin include a trial fully functional evaluation version, but if you want buy it,
27
+ # go here: http://pd4ml.com/buy.htm and then put your licensed jar in a directory in your
28
+ # project then simply calling this:
29
+ #
30
+ # Lipsiadmin::Utils::PdfBuilder::JARS_PATH = "here/is/my/licensed/pd4ml"
31
+ #
32
+ # you can use your version without any problem.
33
+ #
34
+ # By default Lipsiadmin will look into your "vendor/pd4ml" and if:
35
+ #
36
+ # * pd4ml.jar
37
+ # * ss_css2.jar
38
+ #
39
+ # are present will use it
40
+ #
22
41
  module PdfBuilder
23
42
  include Lipsiadmin::Utils::HtmlEntities
24
43
 
25
- # Path to the pd4ml jarfile
26
- JARPATH = "../../resources"
27
-
28
- # Convert a stream to pdf, the template must be located in app/view/pdf/yourtemplate.pdf.erb
44
+ # # Convert a stream to pdf, the template must be located in app/view/pdf/yourtemplate.pdf.erb
29
45
  def render_pdf(template, filename=nil, options={})
30
46
 
47
+ # path to the pd4ml jarfile
48
+ jars_path = Lipsiadmin::Utils::PdfBuilder::JARS_PATH
49
+
31
50
  options[:landescape] ||= true
32
51
  options[:send_data] ||= !filename.blank?
33
52
  # encode the template
@@ -41,12 +60,12 @@ module Lipsiadmin
41
60
  input.gsub!('src="/', 'src="' + RAILS_ROOT + '/public/')
42
61
  input.gsub!('url(','url('+RAILS_ROOT+'/public')
43
62
 
44
- cmd = "java -Xmx512m -Djava.awt.headless=true -cp pd4ml.jar:.:#{File.dirname(__FILE__)}/#{JARPATH} Pd4Ruby '#{input}' 950 A4 #{options[:landescape]}"
63
+ cmd = "java -Xmx512m -Djava.awt.headless=true -cp #{jars_path}/pd4ml.jar:.:#{jars_path} Pd4Ruby '#{input}' 950 A4 #{options[:landescape]}"
45
64
 
46
- output = %x[cd #{File.dirname(__FILE__)}/#{JARPATH} \n #{cmd}]
65
+ output = %x[cd #{Lipsiadmin::Utils::PdfBuilder::PD4RUBY_PATH} \n #{cmd}]
47
66
 
48
67
  # raise error if process returned false (ie: a java error)
49
- raise PdfError, "An unknonwn error occurred while generating pdf: cd #{File.dirname(__FILE__)}/#{JARPATH} #{cmd}" if $?.success? === false
68
+ raise PdfError, "An unknonwn error occurred while generating pdf: cd #{Lipsiadmin::Utils::PdfBuilder::PD4RUBY_PATH} && #{cmd}" if $?.success? === false
50
69
 
51
70
  # return raw pdf binary-stream
52
71
  if options[:send_data]
@@ -44,11 +44,12 @@ module Lipsiadmin
44
44
  # Eval in parent scope and replace document location of this frame
45
45
  # so back button doesn't replay action on targeted forms
46
46
  # loc = document.location to be set after parent is updated for IE
47
+ # with(window.parent) - pull in variables from parent window
47
48
  # setTimeout - scope the execution in the windows parent for safari
48
49
  # window.eval - legal eval for Opera
49
50
  render :text => "<html><body><script type='text/javascript' charset='utf-8'>
50
- window.parent.eval('#{script}');
51
- document.location.replace('about:blank');
51
+ var loc = document.location;
52
+ with(window.parent) { setTimeout(function() { window.eval('#{script}'); loc.replace('about:blank'); }, 1) }
52
53
  </script></body></html>"
53
54
  end
54
55
  end
@@ -161,7 +161,7 @@ module Lipsiadmin
161
161
  # attachment_default_url :avatar, "/images/backend/no-image.png"
162
162
  # User.new.avatar.url(:small) # => "/images/backend/no-image.png"
163
163
  def attachment_default_url_for(name, url)
164
- attachment_definitions[name][:default_url]
164
+ attachment_definitions[name][:default_url] = url
165
165
  end
166
166
 
167
167
  # The path were the attachment are stored.
@@ -82,7 +82,7 @@ module Lipsiadmin
82
82
  module ClassMethods#:nodoc:
83
83
 
84
84
  def attachment_url(url)
85
- attachment_attachment_url_for(self.name, url)
85
+ attachment_url_for(self.name, url)
86
86
  end
87
87
 
88
88
  def attachment_default_url(url)
@@ -1,5 +1,6 @@
1
1
  require 'utils/html_entities'
2
2
  require 'utils/literal'
3
+ require 'utils/pdf_builder'
3
4
  require 'access_control/authentication'
4
5
  require 'access_control/base'
5
6
  require 'mailer/pdf_builder'
@@ -2,6 +2,10 @@ module Lipsiadmin
2
2
  module Mailer
3
3
  # This module convert a string/controller to a pdf through Pd4ml java library (included in this plugin)
4
4
  #
5
+ # PD4ML is a powerful PDF generating tool that uses HTML and CSS (Cascading Style Sheets) as page layout
6
+ # and content definition format. Written in 100% pure Java, it allows users to easily add PDF generation
7
+ # functionality to end products.
8
+ #
5
9
  # For generate a pdf you can simply do
6
10
  #
7
11
  # script/generate pdf invoice
@@ -24,14 +28,30 @@ module Lipsiadmin
24
28
  # end
25
29
  # end
26
30
  #
31
+ # Lipsiadmin include a trial fully functional evaluation version, but if you want buy it,
32
+ # go here: http://pd4ml.com/buy.htm and then put your licensed jar in a directory in your
33
+ # project then simply calling this:
34
+ #
35
+ # Lipsiadmin::Utils::PdfBuilder::JARS_PATH = "here/is/my/licensed/pd4ml"
36
+ #
37
+ # you can use your version without any problem.
38
+ #
39
+ # By default Lipsiadmin will look into your "vendor/pd4ml" and if:
40
+ #
41
+ # * pd4ml.jar
42
+ # * ss_css2.jar
43
+ #
44
+ # are present will use it
45
+ #
27
46
  module PdfBuilder
28
47
  include Lipsiadmin::Utils::HtmlEntities
29
48
 
30
- # Path to the pd4ml jarfile
31
- JARPATH = "../../resources"
32
-
33
49
  # Convert a stream to pdf, the template must be located in app/view/pdf/yourtemplate.pdf.erb
34
50
  def render_pdf(template, body)
51
+
52
+ # path to the pd4ml jarfile
53
+ jars_path = Lipsiadmin::Utils::PdfBuilder::JARS_PATH
54
+
35
55
  # set the landescape
36
56
  landescape = (body[:landescape].delete || false)
37
57
 
@@ -46,12 +66,12 @@ module Lipsiadmin
46
66
  input.gsub!('src="/', 'src="' + RAILS_ROOT + '/public/')
47
67
  input.gsub!('url(','url('+RAILS_ROOT+'/public')
48
68
 
49
- cmd = "java -Xmx512m -Djava.awt.headless=true -cp pd4ml.jar:.:#{File.dirname(__FILE__)}/#{JARPATH} Pd4Ruby '#{input}' 950 A4 #{landescape}"
69
+ cmd = "java -Xmx512m -Djava.awt.headless=true -cp #{jars_path}/pd4ml.jar:.:#{jars_path} Pd4Ruby '#{input}' 950 A4 #{landescape}"
50
70
 
51
- output = %x[cd #{File.dirname(__FILE__)}/#{JARPATH} \n #{cmd}]
71
+ output = %x[cd #{Lipsiadmin::Utils::PdfBuilder::PD4RUBY_PATH} \n #{cmd}]
52
72
 
53
73
  # raise error if process returned false (ie: a java error)
54
- raise PdfError, "An unknonwn error occurred while generating pdf: #{cmd}" if $?.success? === false
74
+ raise PdfError, "An unknonwn error occurred while generating pdf: cd #{Lipsiadmin::Utils::PdfBuilder::PD4RUBY_PATH} && #{cmd}" if $?.success? === false
55
75
 
56
76
  #return raw pdf binary-stream
57
77
  output
@@ -0,0 +1,32 @@
1
+ module Lipsiadmin
2
+ module Utils
3
+ # This module help you, when you buy the default pdf builder.
4
+ #
5
+ # Lipsiadmin include a trial fully functional evaluation version, but if you want buy it,
6
+ # go here: http://pd4ml.com/buy.htm and then put your licensed jar in a directory in your
7
+ # project then simply calling this:
8
+ #
9
+ # Lipsiadmin::Utils::PdfBuilder::JARS_PATH = "here/is/my/licensed/pd4ml"
10
+ #
11
+ # you can use your version without any problem.
12
+ #
13
+ # By default Lipsiadmin will look into your "vendor/pd4ml" and if:
14
+ #
15
+ # * pd4ml.jar
16
+ # * ss_css2.jar
17
+ #
18
+ # are present will use it
19
+ #
20
+ module PdfBuilder
21
+ if File.exist?("#{Rails.root}/vendor/pd4ml/pd4ml.jar") &&
22
+ File.exist?("#{Rails.root}/vendor/pd4ml/ss_css2.jar")
23
+
24
+ JARS_PATH = "#{Rails.root}/vendor/pd4ml"
25
+ else
26
+ JARS_PATH = "#{File.dirname(__FILE__)}/../../resources/pd4ml"
27
+ end
28
+
29
+ PD4RUBY_PATH = "#{File.dirname(__FILE__)}/../../resources/pd4ml/ruby"
30
+ end
31
+ end
32
+ end
@@ -1,7 +1,7 @@
1
1
  module Lipsiadmin
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
- MINOR = 0
4
+ MINOR = 3
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
@@ -4,7 +4,7 @@ class AttachmentGenerator < Rails::Generator::Base
4
4
  def manifest
5
5
  record do |m|
6
6
  unless options[:skip_migration]
7
- m.migration_template("migration.rb", "db/migrate", :migration_file_name => "create_attachment")
7
+ m.migration_template("migration.rb", "db/migrate", :migration_file_name => "create_attachments")
8
8
  end
9
9
  m.template('model.rb', 'app/models/attachment.rb')
10
10
  m.readme "../REMEMBER"
@@ -73,4 +73,4 @@ delete this.textTopEl}else{this.textTopEl=Ext.get(this.progressBar.dom.firstChil
73
73
  }Ext.StatusBar.superclass.initComponent.call(this)},afterRender:function(){Ext.StatusBar.superclass.afterRender.call(this);var _1=this.statusAlign=="right",td=Ext.get(this.nextBlock());if(_1){this.tr.appendChild(td.dom)}else{td.insertBefore(this.tr.firstChild)}this.statusEl=td.createChild({cls:"x-status-text "+(this.iconCls||this.defaultIconCls||""),html:this.text||this.defaultText||""});this.statusEl.unselectable();this.spacerEl=td.insertSibling({tag:"td",style:"width:100%",cn:[{cls:"ytb-spacer"}]},_1?"before":"after")},setStatus:function(o){o=o||{};if(typeof o=="string"){o={text:o}}if(o.text!==undefined){this.setText(o.text)}if(o.iconCls!==undefined){this.setIcon(o.iconCls)}if(o.clear){var c=o.clear,_5=this.autoClear,_6={useDefaults:true,anim:true};if(typeof c=="object"){c=Ext.applyIf(c,_6);if(c.wait){_5=c.wait}}else{if(typeof c=="number"){_5=c;c=_6}else{if(typeof c=="boolean"){c=_6}}}c.threadId=this.activeThreadId;this.clearStatus.defer(_5,this,[c])}return this},clearStatus:function(o){o=o||{};if(o.threadId&&o.threadId!==this.activeThreadId){return this}var _8=o.useDefaults?this.defaultText:"",_9=o.useDefaults?(this.defaultIconCls?this.defaultIconCls:""):"";if(o.anim){this.statusEl.fadeOut({remove:false,useDisplay:true,scope:this,callback:function(){this.setStatus({text:_8,iconCls:_9});this.statusEl.show()}})}else{this.statusEl.hide();this.setStatus({text:_8,iconCls:_9});this.statusEl.show()}return this},setText:function(_a){this.activeThreadId++;this.text=_a||"";if(this.rendered){this.statusEl.update(this.text)}return this},getText:function(){return this.text},setIcon:function(_b){this.activeThreadId++;_b=_b||"";if(this.rendered){if(this.currIconCls){this.statusEl.removeClass(this.currIconCls);this.currIconCls=null}if(_b.length>0){this.statusEl.addClass(_b);this.currIconCls=_b}}else{this.currIconCls=_b}return this},showBusy:function(o){if(typeof o=="string"){o={text:o}}o=Ext.applyIf(o||{},{text:this.busyText,iconCls:this.busyIconCls});return this.setStatus(o)}});Ext.reg("statusbar",Ext.StatusBar);Ext.History=(function(){var _1,_2;var _3=false;var _4;function getHash(){var _5=top.location.href,i=_5.indexOf("#");return i>=0?_5.substr(i+1):null}function doSave(){_2.value=_4}function handleStateChange(_7){_4=_7;Ext.History.fireEvent("change",_7)}function updateIFrame(_8){var _9=['<html><body><div id="state">',_8,"</div></body></html>"].join("");try{var _a=_1.contentWindow.document;_a.open();_a.write(_9);_a.close();return true}catch(e){return false}}function checkIFrame(){if(!_1.contentWindow||!_1.contentWindow.document){setTimeout(checkIFrame,10);return}var _b=_1.contentWindow.document;var _c=_b.getElementById("state");var _d=_c?_c.innerText:null;var _e=getHash();setInterval(function(){_b=_1.contentWindow.document;_c=_b.getElementById("state");var _f=_c?_c.innerText:null;var _10=getHash();if(_f!==_d){_d=_f;handleStateChange(_d);top.location.hash=_d;_e=_d;doSave()}else{if(_10!==_e){_e=_10;updateIFrame(_10)}}},50);_3=true;Ext.History.fireEvent("ready",Ext.History)}function startUp(){_4=_2.value?_2.value:getHash();if(Ext.isIE){checkIFrame()}else{var _11=getHash();setInterval(function(){var _12=getHash();if(_12!==_11){_11=_12;handleStateChange(_11);doSave()}},50);_3=true;Ext.History.fireEvent("ready",Ext.History)}}return{fieldId:"x-history-field",iframeId:"x-history-frame",events:{},init:function(_13,_14){if(_3){Ext.callback(_13,_14,[this]);return}if(!Ext.isReady){Ext.onReady(function(){Ext.History.init(_13,_14)});return}_2=Ext.getDom(Ext.History.fieldId);if(Ext.isIE){_1=Ext.getDom(Ext.History.iframeId)}this.addEvents("ready","change");if(_13){this.on("ready",_13,_14,{single:true})}startUp()},add:function(_15,_16){if(_16!==false){if(this.getToken()==_15){return true}}if(Ext.isIE){return updateIFrame(_15)}else{top.location.hash=_15;return true}},back:function(){history.go(-1)},forward:function(){history.go(1)},getToken:function(){return _3?_4:getHash()}}})();Ext.apply(Ext.History,new Ext.util.Observable());Ext.debug={};(function(){var cp;function createConsole(){var _2=new Ext.debug.ScriptsPanel();var _3=new Ext.debug.LogPanel();var _4=new Ext.debug.DomTree();var _5=new Ext.TabPanel({activeTab:0,border:false,tabPosition:"bottom",items:[{title:"Debug Console",layout:"border",items:[_3,_2]},{title:"DOM Inspector",layout:"border",items:[_4]}]});cp=new Ext.Panel({id:"x-debug-browser",title:"Console",collapsible:true,animCollapse:false,style:"position:absolute;left:0;bottom:0;",height:200,logView:_3,layout:"fit",tools:[{id:"close",handler:function(){cp.destroy();cp=null;Ext.EventManager.removeResizeListener(handleResize)}}],items:_5});cp.render(document.body);cp.resizer=new Ext.Resizable(cp.el,{minHeight:50,handles:"n",pinned:true,transparent:true,resizeElement:function(){var _6=this.proxy.getBox();this.proxy.hide();cp.setHeight(_6.height);return _6}});function handleResize(){cp.setWidth(Ext.getBody().getViewSize().width)}Ext.EventManager.onWindowResize(handleResize);handleResize()}Ext.apply(Ext,{log:function(){if(!cp){createConsole()}cp.logView.log.apply(cp.logView,arguments)},logf:function(_7,_8,_9,_a){Ext.log(String.format.apply(String,arguments))},dump:function(o){if(typeof o=="string"||typeof o=="number"||typeof o=="undefined"||Ext.isDate(o)){Ext.log(o)}else{if(!o){Ext.log("null")}else{if(typeof o!="object"){Ext.log("Unknown return type")}else{if(Ext.isArray(o)){Ext.log("["+o.join(",")+"]")}else{var b=["{\n"];for(var _d in o){var to=typeof o[_d];if(to!="function"&&to!="object"){b.push(String.format(" {0}: {1},\n",_d,o[_d]))}}var s=b.join("");if(s.length>3){s=s.substr(0,s.length-2)}Ext.log(s+"\n}")}}}}},_timers:{},time:function(_10){_10=_10||"def";Ext._timers[_10]=new Date().getTime()},timeEnd:function(_11,_12){var t=new Date().getTime();_11=_11||"def";var v=String.format("{0} ms",t-Ext._timers[_11]);Ext._timers[_11]=new Date().getTime();if(_12!==false){Ext.log("Timer "+(_11=="def"?v:_11+": "+v))}return v}})})();Ext.debug.ScriptsPanel=Ext.extend(Ext.Panel,{id:"x-debug-scripts",region:"east",minWidth:200,split:true,width:350,border:false,layout:"anchor",style:"border-width:0 0 0 1px;",initComponent:function(){this.scriptField=new Ext.form.TextArea({anchor:"100% -26",style:"border-width:0;"});this.trapBox=new Ext.form.Checkbox({id:"console-trap",boxLabel:"Trap Errors",checked:true});this.toolbar=new Ext.Toolbar([{text:"Run",scope:this,handler:this.evalScript},{text:"Clear",scope:this,handler:this.clear},"->",this.trapBox," "," "]);this.items=[this.toolbar,this.scriptField];Ext.debug.ScriptsPanel.superclass.initComponent.call(this)},evalScript:function(){var s=this.scriptField.getValue();if(this.trapBox.getValue()){try{var rt=eval(s);Ext.dump(rt===undefined?"(no return)":rt)}catch(e){Ext.log(e.message||e.descript)}}else{var rt=eval(s);Ext.dump(rt===undefined?"(no return)":rt)}},clear:function(){this.scriptField.setValue("");this.scriptField.focus()}});Ext.debug.LogPanel=Ext.extend(Ext.Panel,{autoScroll:true,region:"center",border:false,style:"border-width:0 1px 0 0",log:function(){var _17=['<div style="padding:5px !important;border-bottom:1px solid #ccc;">',Ext.util.Format.htmlEncode(Array.prototype.join.call(arguments,", ")).replace(/\n/g,"<br />").replace(/\s/g,"&#160;"),"</div>"].join("");this.body.insertHtml("beforeend",_17);this.body.scrollTo("top",100000)},clear:function(){this.body.update("");this.body.dom.scrollTop=0}});Ext.debug.DomTree=Ext.extend(Ext.tree.TreePanel,{enableDD:false,lines:false,rootVisible:false,animate:false,hlColor:"ffff9c",autoScroll:true,region:"center",border:false,initComponent:function(){Ext.debug.DomTree.superclass.initComponent.call(this);var _18=false,_19;var _1a=/^\s*$/;var _1b=Ext.util.Format.htmlEncode;var _1c=Ext.util.Format.ellipsis;var _1d=/\s?([a-z\-]*)\:([^;]*)(?:[;\s\n\r]*)/gi;function findNode(n){if(!n||n.nodeType!=1||n==document.body||n==document){return false}var pn=[n],p=n;while((p=p.parentNode)&&p.nodeType==1&&p.tagName.toUpperCase()!="HTML"){pn.unshift(p)}var cn=_19;for(var i=0,len=pn.length;i<len;i++){cn.expand();
74
74
  cn=cn.findChild("htmlNode",pn[i]);if(!cn){return false}}cn.select();var a=cn.ui.anchor;treeEl.dom.scrollTop=Math.max(0,a.offsetTop-10);cn.highlight();return true}function nodeTitle(n){var s=n.tagName;if(n.id){s+="#"+n.id}else{if(n.className){s+="."+n.className}}return s}function onNodeSelect(t,n,_29){return;if(_29&&_29.unframe){_29.unframe()}var _2a={};if(n&&n.htmlNode){if(frameEl.pressed){n.frame()}if(inspecting){return}addStyle.enable();reload.setDisabled(n.leaf);var dom=n.htmlNode;stylePanel.setTitle(nodeTitle(dom));if(_18&&!showAll.pressed){var s=dom.style?dom.style.cssText:"";if(s){var m;while((m=_1d.exec(s))!=null){_2a[m[1].toLowerCase()]=m[2]}}}else{if(_18){var cl=Ext.debug.cssList;var s=dom.style,fly=Ext.fly(dom);if(s){for(var i=0,len=cl.length;i<len;i++){var st=cl[i];var v=s[st]||fly.getStyle(st);if(v!=undefined&&v!==null&&v!==""){_2a[st]=v}}}}else{for(var a in dom){var v=dom[a];if((isNaN(a+10))&&v!=undefined&&v!==null&&v!==""&&!(Ext.isGecko&&a[0]==a[0].toUpperCase())){_2a[a]=v}}}}}else{if(inspecting){return}addStyle.disable();reload.disabled()}stylesGrid.setSource(_2a);stylesGrid.treeNode=n;stylesGrid.view.fitColumns()}this.loader=new Ext.tree.TreeLoader();this.loader.load=function(n,cb){var _37=n.htmlNode==document.body;var cn=n.htmlNode.childNodes;for(var i=0,c;c=cn[i];i++){if(_37&&c.id=="x-debug-browser"){continue}if(c.nodeType==1){n.appendChild(new Ext.debug.HtmlNode(c))}else{if(c.nodeType==3&&!_1a.test(c.nodeValue)){n.appendChild(new Ext.tree.TreeNode({text:"<em>"+_1c(_1b(String(c.nodeValue)),35)+"</em>",cls:"x-tree-noicon"}))}}}cb()};this.root=this.setRootNode(new Ext.tree.TreeNode("Ext"));_19=this.root.appendChild(new Ext.debug.HtmlNode(document.getElementsByTagName("html")[0]))}});Ext.debug.HtmlNode=function(){var _3b=Ext.util.Format.htmlEncode;var _3c=Ext.util.Format.ellipsis;var _3d=/^\s*$/;var _3e=[{n:"id",v:"id"},{n:"className",v:"class"},{n:"name",v:"name"},{n:"type",v:"type"},{n:"src",v:"src"},{n:"href",v:"href"}];function hasChild(n){for(var i=0,c;c=n.childNodes[i];i++){if(c.nodeType==1){return true}}return false}function renderNode(n,_43){var tag=n.tagName.toLowerCase();var s="&lt;"+tag;for(var i=0,len=_3e.length;i<len;i++){var a=_3e[i];var v=n[a.n];if(v&&!_3d.test(v)){s+=" "+a.v+"=&quot;<i>"+_3b(v)+"</i>&quot;"}}var _4a=n.style?n.style.cssText:"";if(_4a){s+=" style=&quot;<i>"+_3b(_4a.toLowerCase())+"</i>&quot;"}if(_43&&n.childNodes.length>0){s+="&gt;<em>"+_3c(_3b(String(n.innerHTML)),35)+"</em>&lt;/"+tag+"&gt;"}else{if(_43){s+=" /&gt;"}else{s+="&gt;"}}return s}var _4b=function(n){var _4d=!hasChild(n);this.htmlNode=n;this.tagName=n.tagName.toLowerCase();var _4e={text:renderNode(n,_4d),leaf:_4d,cls:"x-tree-noicon"};_4b.superclass.constructor.call(this,_4e);this.attributes.htmlNode=n;if(!_4d){this.on("expand",this.onExpand,this);this.on("collapse",this.onCollapse,this)}};Ext.extend(_4b,Ext.tree.AsyncTreeNode,{cls:"x-tree-noicon",preventHScroll:true,refresh:function(_4f){var _50=!hasChild(this.htmlNode);this.setText(renderNode(this.htmlNode,_50));if(_4f){Ext.fly(this.ui.textNode).highlight()}},onExpand:function(){if(!this.closeNode&&this.parentNode){this.closeNode=this.parentNode.insertBefore(new Ext.tree.TreeNode({text:"&lt;/"+this.tagName+"&gt;",cls:"x-tree-noicon"}),this.nextSibling)}else{if(this.closeNode){this.closeNode.ui.show()}}},onCollapse:function(){if(this.closeNode){this.closeNode.ui.hide()}},render:function(_51){_4b.superclass.render.call(this,_51)},highlightNode:function(){},highlight:function(){},frame:function(){this.htmlNode.style.border="1px solid #0000ff"},unframe:function(){this.htmlNode.style.border=""}});return _4b}();
75
75
  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.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.lib.Event.getTarget=function(e){var ee=e.browserEvent||e;return ee.target?Event.element(ee):null};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:false,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.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{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():new Date(1970,0,1,0,0,0)},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.setValue(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)}val=val?val:new Date(1970,0,1,0,0,0);var da,time;if(val instanceof Date){this.setDate(val);this.setTime(val);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]}var hh=da[1].split(":");this.setTime(hh[0]+":"+hh[1])}}},setVisible:function(visible){if(visible){this.df.show();
76
- 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;if("string"===typeof this.toolbarContainer){this.toolbarContainer=Ext.getCmp(this.toolbarContainer)}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.reconfigure();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()}})}},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()}},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()}},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)}}});
76
+ 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;if("string"===typeof this.toolbarContainer){this.toolbarContainer=Ext.getCmp(this.toolbarContainer)}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.reconfigure();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()}})}},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()}},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()}},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);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.component&&f.component.substring(0,3)=="ys-"){cookies[f.component.substr(3)]=this.decodeValue(f.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"})}});
@@ -0,0 +1,38 @@
1
+
2
+ ================================================================
3
+
4
+ Please remember to:
5
+
6
+ Update your Javascripts
7
+
8
+ $ rake lipsiadmin:update:javascripts
9
+
10
+ Edit app/model/account.rb and add:
11
+
12
+ has_many :state_sessions, :dependent => :destroy
13
+
14
+ Edit app/model/account_access.rb and add:
15
+
16
+ role.allow_all_actions "/backend/state_sessions"
17
+
18
+ Edit app/views/javascripts/backend.js and change this:
19
+
20
+ Ext.state.Manager.setProvider(
21
+ new Ext.state.CookieProvider({
22
+ expires: new Date(new Date().getTime()+(1000*60*60*24*365))
23
+ })
24
+ );
25
+
26
+ into this:
27
+
28
+ Ext.state.Manager.setProvider(new Ext.state.DataBaseProvider());
29
+
30
+ finally:
31
+
32
+ $ rake db:migrate
33
+
34
+ verify that in your config/routes.rb there is this:
35
+
36
+ backend.resources :state_sessions
37
+
38
+ ================================================================
@@ -0,0 +1,34 @@
1
+ class StateSessionGenerator < Rails::Generator::Base
2
+ default_options :skip_migration => false
3
+
4
+ def manifest
5
+ record do |m|
6
+ # Controller class, functional test, helper, and views.
7
+ m.template 'controller.rb', 'app/controllers/backend/state_sessions_controller.rb'
8
+ m.template 'functional_test.rb', 'test/functional/backend/state_sessions_controller_test.rb'
9
+
10
+ unless options[:skip_migration]
11
+ m.migration_template("migration.rb", "db/migrate", :migration_file_name => "create_state_sessions")
12
+ end
13
+
14
+ m.template('model.rb', 'app/models/state_session.rb')
15
+ # Adding a new route
16
+ m.append("config/routes.rb", " backend.resources :state_sessions", "map.namespace(:backend) do |backend|")
17
+ m.readme "../REMEMBER"
18
+ end
19
+ end
20
+
21
+
22
+ protected
23
+ def banner
24
+ "Usage: #{$0} state_session_migration [--skip-migration]"
25
+ end
26
+
27
+ def add_options!(opt)
28
+ opt.separator ''
29
+ opt.separator 'Options:'
30
+ opt.on("--skip-migration",
31
+ "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
32
+ end
33
+
34
+ end
@@ -0,0 +1,21 @@
1
+ class Backend::StateSessionsController < BackendController
2
+
3
+ def index
4
+ return_data = current_account.state_sessions.inject({}) do |mem, ss|
5
+ mem[ss.component.to_sym] = ss.data
6
+ mem
7
+ end
8
+ render :json => current_account.state_sessions
9
+ end
10
+
11
+ def create
12
+ current_account.state_sessions.find_or_create_by_component(params[:id]).update_attribute(:data, params[:data])
13
+ render :nothing => true
14
+ end
15
+
16
+ def destroy
17
+ state_session = current_account.state_sessions.find_by_component(params[:id])
18
+ state_session.destroy if state_session
19
+ render :nothing => true
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class Backend::StateSessionsControllerTest < ActionController::TestCase
4
+ # Replace this with your real tests.
5
+ def test_truth
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ class CreateStateSessions < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :state_sessions, :force => true do |t|
4
+ t.references :account
5
+ t.string :component, :null => false
6
+ t.text :data
7
+ end
8
+
9
+ add_index :state_sessions, :component
10
+ end
11
+
12
+ def self.down
13
+ remove_index :state_sessions, :component
14
+ drop_table :state_sessions
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ class StateSession < ActiveRecord::Base
2
+ belongs_to :account
3
+ validates_presence_of :account_id, :component
4
+ end
@@ -1099,4 +1099,68 @@ Ext.extend(Ext.grid.Search, Ext.util.Observable, {
1099
1099
 
1100
1100
  }); // eo extend
1101
1101
 
1102
- // eof
1102
+ // eof
1103
+
1104
+ /**
1105
+ * This class store state session of extjs in the database for the current account
1106
+ */
1107
+ Ext.state.DataBaseProvider = function(config){
1108
+ Ext.state.DataBaseProvider.superclass.constructor.call(this);
1109
+ this.path = "/backend/state_sessions";
1110
+ Ext.apply(this, config);
1111
+ this.state = this.readCookies();
1112
+ };
1113
+
1114
+ Ext.extend(Ext.state.DataBaseProvider, Ext.state.Provider, {
1115
+ // private
1116
+ set : function(name, value){
1117
+ if(typeof value == "undefined" || value === null){
1118
+ this.clear(name);
1119
+ return;
1120
+ }
1121
+ this.setCookie(name, value);
1122
+ Ext.state.DataBaseProvider.superclass.set.call(this, name, value);
1123
+ },
1124
+
1125
+ // private
1126
+ clear : function(name){
1127
+ this.clearCookie(name);
1128
+ Ext.state.DataBaseProvider.superclass.clear.call(this, name);
1129
+ },
1130
+
1131
+ // private
1132
+ readCookies : function(){
1133
+ var cookies = {};
1134
+ var values = [];
1135
+ new Ajax.Request(this.path, {
1136
+ method: 'GET',
1137
+ asynchronous: false,
1138
+ onSuccess: function(response, request){
1139
+ values = Ext.decode(response.responseText);
1140
+ }
1141
+ });
1142
+ values.each(function(f){
1143
+ if(f.component && f.component.substring(0,3) == "ys-"){
1144
+ cookies[f.component.substr(3)] = this.decodeValue(f.data);
1145
+ }
1146
+ }, this);
1147
+ return cookies;
1148
+ },
1149
+
1150
+ // private
1151
+ setCookie : function(name, value){
1152
+ Ext.Ajax.request({
1153
+ url: this.path,
1154
+ method: 'POST',
1155
+ params: { id: 'ys-'+name, data: this.encodeValue(value) }
1156
+ })
1157
+ },
1158
+
1159
+ // private
1160
+ clearCookie : function(name){
1161
+ Ext.Ajax.request({
1162
+ url: this.path+'/ys-'+name,
1163
+ method: 'DELETE'
1164
+ })
1165
+ }
1166
+ });
File without changes
@@ -3,7 +3,6 @@ namespace :lipsiadmin do
3
3
  namespace :update do
4
4
  desc "Update your javascripts from your current lipsiadmin install"
5
5
  task :javascripts do
6
- puts File.join(File.dirname(__FILE__), '..', '/lipsiadmin_generators/backend/templates/javascripts/*.js')
7
6
  project_dir = RAILS_ROOT + '/public/javascripts/'
8
7
  Dir[File.join(File.dirname(__FILE__), '..', '/lipsiadmin_generators/backend/templates/javascripts/*.js')].each do |js|
9
8
  puts "Coping #{File.basename(js)} ... DONE"
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: "3.2"
4
+ version: "3.3"
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-03-10 00:00:00 +01:00
12
+ date: 2009-03-13 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -533,6 +533,14 @@ files:
533
533
  - lipsiadmin_generators/pdf/templates/stylesheets
534
534
  - lipsiadmin_generators/pdf/templates/stylesheets/print.css
535
535
  - lipsiadmin_generators/pdf/templates/view.html.haml
536
+ - lipsiadmin_generators/state_session
537
+ - lipsiadmin_generators/state_session/REMEMBER
538
+ - lipsiadmin_generators/state_session/state_session_generator.rb
539
+ - lipsiadmin_generators/state_session/templates
540
+ - lipsiadmin_generators/state_session/templates/controller.rb
541
+ - lipsiadmin_generators/state_session/templates/functional_test.rb
542
+ - lipsiadmin_generators/state_session/templates/migration.rb
543
+ - lipsiadmin_generators/state_session/templates/model.rb
536
544
  - lib/access_control
537
545
  - lib/access_control/authentication.rb
538
546
  - lib/access_control/base.rb
@@ -570,6 +578,7 @@ files:
570
578
  - lib/utils
571
579
  - lib/utils/html_entities.rb
572
580
  - lib/utils/literal.rb
581
+ - lib/utils/pdf_builder.rb
573
582
  - lib/version.rb
574
583
  - lib/view
575
584
  - lib/view/helpers
@@ -589,12 +598,14 @@ files:
589
598
  - lib/view/helpers/view_helper.rb
590
599
  - resources/javascripts
591
600
  - resources/javascripts/ux.js
592
- - resources/pd4ml.jar
593
- - resources/Pd4Ruby.class
594
- - resources/Pd4Ruby.java
601
+ - resources/pd4ml
602
+ - resources/pd4ml/pd4ml.jar
603
+ - resources/pd4ml/ruby
604
+ - resources/pd4ml/ruby/Pd4Ruby.class
605
+ - resources/pd4ml/ruby/Pd4Ruby.java
606
+ - resources/pd4ml/ss_css2.jar
595
607
  - resources/rdoc
596
608
  - resources/rdoc/horo.rb
597
- - resources/ss_css2.jar
598
609
  - tasks/lipsiadmin_tasks.rake
599
610
  has_rdoc: true
600
611
  homepage: http://groups.google.com/group/lipsiadmin