Class: Application

Inherits:
Object
  • Object
show all
Defined in:
lib/application.rb

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



64
65
# File 'lib/application.rb', line 64

def initialize()
end

Instance Method Details

#callController(controller, message, link) ⇒ Object

Llamada a un controlador desde otro controlador



3883
3884
3885
3886
# File 'lib/application.rb', line 3883

def callController(controller)
 objetoMyCgi = MyCGI.new
 objetoMyCgi.redirect($kamila_site+"/"+controller.to_s)
end

#close_bodyObject



393
394
395
# File 'lib/application.rb', line 393

def close_body()
 return '</body>'
end

#close_centerObject



370
371
372
# File 'lib/application.rb', line 370

def close_center()
 return '</center>'
end

#close_divObject



608
609
610
# File 'lib/application.rb', line 608

def close_div()
 return '</div>'
end

#close_fontObject



614
615
616
# File 'lib/application.rb', line 614

def close_font()
 return '</font>'
end

#close_formObject



752
753
754
# File 'lib/application.rb', line 752

def close_form()
 return '</form>'
end

#close_headObject



361
362
363
# File 'lib/application.rb', line 361

def close_head()
 return '</head>'
end

#close_heading(h) ⇒ Object



499
500
501
# File 'lib/application.rb', line 499

def close_heading(h)
 return '</' + h.to_s + '>'
end

#close_hrefObject



629
630
631
# File 'lib/application.rb', line 629

def close_href()
 return '</a>'
end

#close_htmlObject



355
356
357
# File 'lib/application.rb', line 355

def close_html()
 return '</html>'
end

#close_javascriptObject



415
416
417
# File 'lib/application.rb', line 415

def close_javascript()
 return '</script>'
end

#close_liObject



585
586
587
# File 'lib/application.rb', line 585

def close_li()
 return '</li>'
end

#close_olObject



570
571
572
# File 'lib/application.rb', line 570

def close_ol()
 return '</ol>'
end

#close_paragraphsObject



518
519
520
# File 'lib/application.rb', line 518

def close_paragraphs()
 return '</p>'
end

#close_spanObject



544
545
546
# File 'lib/application.rb', line 544

def close_span()
 return '</span>'
end

#close_tableObject



644
645
646
# File 'lib/application.rb', line 644

def close_table()
 return '</table>'
end

#close_tdObject



677
678
679
# File 'lib/application.rb', line 677

def close_td()
 return '</td>'
end

#close_trObject



650
651
652
# File 'lib/application.rb', line 650

def close_tr()
 return '</tr>'
end

#close_ulObject



555
556
557
# File 'lib/application.rb', line 555

def close_ul()
 return '</ul>'
end

#create_AjaxCancel_extjs(nameFunction, action, ids, pageserver) ⇒ Object



2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
# File 'lib/application.rb', line 2908

def create_AjaxCancel_extjs(nameFunction,action,ids,pageserver)
 theAction = Array.new
 theAction = action.split(",")
 theFields = Array.new
 theIds = ''
 theFields = ids.split(",")
 j=1
 for i in 0..theFields.length-1
  theIds = theIds +theFields[i].to_s+'.setValue("");'
  theIds = theIds +theFields[i].to_s+'.clearInvalid();'
  j=j+1
 end
 return '<script>
         function '+nameFunction+'()
         {
          Ext.Ajax.request({
        url : "'+$kamila_site+'/'+pageserver+'",
           params : { '+theAction[0].to_s+': "'+theAction[1].to_s+'" },
           method: "POST",
   	    success: function ( resultado, request ) { 
                      '+theIds+'
        },
        failure: function ( result, request) { 
	              Ext.MessageBox.alert("Error", result.responseText); 
        } 
          });
         }
         </script>'
end

#create_AjaxDelete_extjs(nameFunction, action, params, ids, pageserver) ⇒ Object



2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
# File 'lib/application.rb', line 2937

def create_AjaxDelete_extjs(nameFunction,action,params,ids,pageserver)
 theAction = Array.new
 theAction = action.split(",")
 campos = Array.new
 theParams = ''
 campos = params.split(',')
 for i in 0..campos.length-1
  if i==campos.length-1
   theParams = theParams.to_s + campos[i].to_s+' : '+campos[i].to_s+'.getValue() '
  else
   theParams = theParams.to_s + campos[i].to_s+' : '+campos[i].to_s+'.getValue(), '
  end
 end
 theFields = Array.new
 theIds = ''
 theFields = ids.split(",")
 j=1
 for i in 0..theFields.length-1
  theIds = theIds +theFields[i].to_s+'.setValue("");'
  theIds = theIds +theFields[i].to_s+'.clearInvalid();'
  j=j+1
 end
 return '<script>
         function '+nameFunction+'()
         {
          Ext.Ajax.request({
        url : "'+$kamila_site+'/'+pageserver+'",
           params : { '+theAction[0].to_s+': "'+theAction[1].to_s+'", '+theParams+' },
           method: "POST",
   	    success: function ( resultado, request ) { 
                     mensaje = resultado.responseText;
                     Ext.MessageBox.alert("Informaci&oacute;n", mensaje);
                     '+theIds+'
        },
        failure: function ( result, request) { 
	              Ext.MessageBox.alert("Error", result.responseText); 
        } 
          });
         }
         </script>'
end

#create_AjaxFind_extjs(nameFunction, action, params, ids, pageserver) ⇒ Object



2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
# File 'lib/application.rb', line 2774

def create_AjaxFind_extjs(nameFunction,action,params,ids,pageserver)
 theAction = Array.new
 theAction = action.split(",")
 campos = Array.new
 theParams = ''
 campos = params.split(',')
 for i in 0..campos.length-1
  if i==campos.length-1
   theParams = theParams.to_s + campos[i].to_s+' : '+campos[i].to_s+'.getValue() '
  else
   theParams = theParams.to_s + campos[i].to_s+' : '+campos[i].to_s+'.getValue(), '
  end
 end
 theFields = Array.new
 theIds = ''
 theFields = ids.split(",")
 j=1
 for i in 0..theFields.length-1
  theIds = theIds + 'if (typeof('+theFields[i].to_s+')!="undefined") { '
  theIds = theIds + 'if ('+theFields[i].to_s+'.getXType()=="textfield") { '
  theIds = theIds + theFields[i].to_s+'.setValue(Campos['+j.to_s+']); '
  theIds = theIds + ' } } '
  theIds = theIds + 'if (typeof('+theFields[i].to_s+'0)!="undefined") { '
  theIds = theIds + 'if ('+theFields[i].to_s+'0.getXType()=="radio") { '
  #theIds = theIds + ' Campos1 = Registros[1].split("$!"); Campos2 = Campos1[1].split(";"); alert('+theFields[i].to_s+'0.inputValue); alert(Campos2[0]); if ('+theFields[i].to_s+'0.inputValue==Campos2[0]) { '+theFields[i].to_s+'0.checked = true; '+theFields[i].to_s+'1.checked = false; } else { '+theFields[i].to_s+'1.checked = true; '+theFields[i].to_s+'0.checked = false; } '
  #theIds = theIds + ' Campos1 = Registros[1].split("$!"); Campos2 = Campos1[1].split(";"); if ('+theFields[i].to_s+'0.inputValue==Campos2[0]) { '+theFields[i].to_s+'0.setValue(true); '+theFields[i].to_s+'1.setValue(false); } else { '+theFields[i].to_s+'1.setValue(true); '+theFields[i].to_s+'0.setValue(false); } '
  theIds = theIds + theFields[i].to_s+'0.setValue(Campos['+j.to_s+']); '
  theIds = theIds + ' } }'
  theIds = theIds + 'if (typeof('+theFields[i].to_s+')!="undefined") { '
  theIds = theIds + 'if ('+theFields[i].to_s+'.getXType()=="checkbox") { '
  theIds = theIds + theFields[i].to_s+'.setValue(Campos['+j.to_s+']); '
  theIds = theIds + ' } } '
  theIds = theIds + 'if (typeof('+theFields[i].to_s+')!="undefined") { '
  theIds = theIds + 'if ('+theFields[i].to_s+'.getXType()!="textfield") { '
  theIds = theIds + theFields[i].to_s+'.setValue(Campos['+j.to_s+']); '
  theIds = theIds + ' } } '
  j=j+1
 end
 return '<script>
         function '+nameFunction+'()
         {
          Ext.Ajax.request({
        url : "'+$kamila_site+'/'+pageserver+'",
           params : { '+theAction[0].to_s+': "'+theAction[1].to_s+'", '+theParams+' },
           method: "POST",
   	    success: function ( resultado, request ) { 
                     datos = resultado.responseText;
                     var Registros = datos.split("|");
                     if (Registros.length-1==0)
                     {
                      Ext.MessageBox.alert("Error", "Inesperado, posible error en la vista o modelo");
                      return;
                     }
                     var Campos = Registros[1].split(",");
                     var otroCampos = null;
                     var j = 0;
                     var exitSalida = false;
                     while (j<Campos.length && exitSalida==false)
                     {
                      if (Campos[j].indexOf("$")!=-1)
                      {
                       otrosCampos = Campos[j].split("$");
                       otrosCampos = otrosCampos[1].split(";")
                       k=0;
                       m=j;
                       while (k<otrosCampos.length)
                       {
                        Campos[m] = otrosCampos[k];
                        k++;
                        m++;
                       }
                       exitSalida = true;
                      }
                      j++;
                     }
                     if (Campos[0] == 1)
                     {
                      '+theIds+'
                     }
                     else
                     {
                      Ext.MessageBox.alert("Error", Campos[1]);
                     }
        },
        failure: function ( result, request) { 
	              Ext.MessageBox.alert("Error", result.responseText); 
        } 
          });
         }
         </script>'
end

#create_AjaxPrint_extjs(nameFunction, action, pageserver) ⇒ Object



2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
# File 'lib/application.rb', line 2978

def create_AjaxPrint_extjs(nameFunction,action,pageserver)
 theAction = Array.new
 theAction = action.split(",")
 return '<script>
         function '+nameFunction+'()
         {
          Ext.Ajax.request({
        url : "'+$kamila_site+'/'+pageserver+'",
        params : { '+theAction[0].to_s+': "'+theAction[1].to_s+'" },
           method: "POST",
   	    success: function ( resultado, request ) { 
   	               datos = resultado.responseText;
                      var Registros = datos.split("|");
                      if (Registros.length-1==0)
                      {
                       Ext.MessageBox.alert("Error", "Inesperado, posible error en la vista o modelo");
                       return;
                      }
                      var Campos = Registros[1].split(",");
                      if (Campos[0] == 1)
                      {
                       var opciones="left=200,top=100,width=550,height=450";
                       mi_ventana = window.open(Campos[1],"",opciones); 
                      }
                      else
                      {
                       Ext.MessageBox.alert("Error", Campos[1]);
                      }
        },
        failure: function ( result, request) { 
	              Ext.MessageBox.alert("Error", result.responseText); 
        } 
          });
         }
         </script>'
end

#create_AjaxSave_extjs(nameFunction, action, params, pageserver) ⇒ Object



2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
# File 'lib/application.rb', line 2865

def create_AjaxSave_extjs(nameFunction,action,params,pageserver)
 theAction = Array.new
 theAction = action.split(",")
 campos = Array.new
 theParams = ''
 campos = params.split(',')
 for i in 0..campos.length-1
  if i==campos.length-1
   if campos[i].to_s.index("&")!=nil
    bb = campos[i].to_s.split("&")
    campos[i] = bb[1]
    theParams = theParams.to_s + campos[i].to_s+' : '+campos[i].to_s+'0.getGroupValue() '
   else
    theParams = theParams.to_s + campos[i].to_s+' : '+campos[i].to_s+'.getValue() '
   end
  else
   if campos[i].to_s.index("&")!=nil
    bb = campos[i].to_s.split("&")
    campos[i] = bb[1]
    theParams = theParams.to_s + campos[i].to_s+' : '+campos[i].to_s+'0.getGroupValue(), '
   else
    theParams = theParams.to_s + campos[i].to_s+' : '+campos[i].to_s+'.getValue(), '
   end
  end
 end
 return '<script>
         function '+nameFunction+'()
         {
            Ext.Ajax.request({
         url : "'+$kamila_site+'/'+pageserver+'",
            params : { '+theAction[0].to_s+': "'+theAction[1].to_s+'", '+theParams+' }, 
            method: "POST",
   	     success: function ( resultado, request ) {
                      mensaje = resultado.responseText;
                      Ext.MessageBox.alert("Informaci&oacute;n", mensaje);
         },
         failure: function ( result, request) { 
	               Ext.MessageBox.alert("Error", result.responseText); 
         } 
           });
         }
         </script>'
end

#create_body(marginheight, marginwidth, topmargin, leftmargin, bgcolor) ⇒ Object



381
382
383
# File 'lib/application.rb', line 381

def create_body()
 return '<body>'
end

#create_centerObject



367
368
369
# File 'lib/application.rb', line 367

def create_center()
 return '<center>'
end

#create_ContentSlider_image(id, content, link, label1, label2, isTable) ⇒ Object



3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
# File 'lib/application.rb', line 3813

def create_ContentSlider_image(id,content,link,label1,label2,isTable)
 contentdiv = ''
 for i in 0..content.length-1
  image = Array.new
  image = content[i]
  if isTable.upcase=='TRUE'
   contentdiv = contentdiv + '<div class="contentdiv"><table border="0"><tr><td><a href="'+link[i]+'"><img id="'+image[0].to_s+'" border="'+image[1].to_s+'" src="'+image[2].to_s+'" alt="'+image[3].to_s+'" height="' + image[4].to_s + '" width="' + image[5].to_s + '" /></a><td align="top"><a href="'+link[i]+'">'+image[6].to_s+'</a></td></tr></table></div>'
  else
   contentdiv = contentdiv + '<div class="contentdiv"><a href="'+link[i]+'"><img id="'+image[0].to_s+'" border="'+image[1].to_s+'" src="'+image[2].to_s+'" alt="'+image[3].to_s+'" height="' + image[4].to_s + '" width="' + image[5].to_s + '" /><p>'+image[6].to_s+'</p></a></div>'
  end
 end
 return '<div id="'+id+'" class="sliderwrapper">
          '+contentdiv+'
         </div>
         <div id="paginate-slider1" class="pagination">
         </div>
         <script type="text/javascript">
          featuredcontentslider.init({
         	id: "'+id+'",  
        	contentsource: ["inline", ""],  
        	toc: "#increment",  
       	nextprev: ["'+label1+'", "'+label2+'"],  
         	revealtype: "click", 
        	enablefade: [true, 0.2],  
       	autorotate: [true, 3000],  
        	onChange: function(previndex, curindex){  //event handler fired whenever script changes slide
    		 //previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)
   		 //curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)
           }
          })
         </script>'
end

#create_ContentSlider_text(id, content, link, label1, label2) ⇒ Object



3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
# File 'lib/application.rb', line 3787

def create_ContentSlider_text(id,content,link,label1,label2)
 contentdiv = ''
 for i in 0..content.length-1
  contentdiv = contentdiv + '<div class="contentdiv"><a href="'+link[i]+'">'+content[i]+'</a></div>'
 end
 return '<div id="'+id+'" class="sliderwrapper">
          '+contentdiv+'
         </div>
         <div id="paginate-slider1" class="pagination">
         </div>
         <script type="text/javascript">
          featuredcontentslider.init({
         	id: "'+id+'",  
        	contentsource: ["inline", ""],  
        	toc: "#increment",  
       	nextprev: ["'+label1+'", "'+label2+'"],  
         	revealtype: "click", 
        	enablefade: [true, 0.2],  
       	autorotate: [true, 3000],  
        	onChange: function(previndex, curindex){  //event handler fired whenever script changes slide
    		 //previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)
   		 //curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)
           }
          })
         </script>'
end

#create_css(css) ⇒ Object



396
397
398
# File 'lib/application.rb', line 396

def create_css(css)
 return '<link rel="stylesheet" type="text/css" href="'+ $kamila_site + '/public/css/' + css.to_s+'">'
end

#create_css_contentslider(borderline, bordercolor, width, height, ctp, btp, sctp, sbtp) ⇒ Object

Content Slider 2.4 fuente: www.dynamicdrive.com



3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
# File 'lib/application.rb', line 3745

def create_css_contentslider(borderline,bordercolor,width,height,ctp,btp,sctp,sbtp)
 widthSW = width.to_i - 10
 return '<style>
          .sliderwrapper{
           position: relative; 
           overflow: hidden; 
           border: '+borderline+'px solid '+bordercolor+'; 
           border-bottom-width: 6px;
           width: '+width+'px; 
           height: '+height+'px; 
          }
          .sliderwrapper .contentdiv{
           visibility: hidden; 
           position: absolute; 
           left: 0;  
           top: 0;  
           padding: 5px;
           background: white;
           width: '+widthSW.to_s+'px; 
           height: 100%;
           filter:progid:DXImageTransform.Microsoft.alpha(opacity=100);
           -moz-opacity: 1;
           opacity: 1;
          }
          .pagination{
           width: '+width+'px; 
           text-align: right;
           background-color: '+bordercolor+'; 
           padding: 5px 10px;
          }
          .pagination a{
           padding: 0 5px;
           text-decoration: none; 
           color: '+ctp+'; 
           background: '+btp+'; 
          }
          .pagination a:hover, .pagination a.selected{
           color: '+sctp+'; 
           background-color: '+sbtp+'; 
          }
         </style>'
end

#create_div(id, css, align, text) ⇒ Object



588
589
590
# File 'lib/application.rb', line 588

def create_div()
 return '<div>'
end

#create_font(face, size, color, css) ⇒ Object



611
612
613
# File 'lib/application.rb', line 611

def create_font(face,size,color,css)
 return '<font face="'+face.to_s+'" size="'+size.to_s+'" color="' +color.to_s + '" class="' + css.to_s + '" >'
end

#create_form(id, name, method, action, multipart) ⇒ Object



740
741
742
# File 'lib/application.rb', line 740

def create_form(id,name,method,action)
 return '<form id="'+id.to_s+'" name="'+name.to_s+'" method="'+method.to_s+'" action="' + $kamila_site + '/' + action.to_s + '">'
end

#create_graph_gruff(type, theme, font, fontsize, title, x_axis_label, y_axis_label, titlearray, dataarray, xlabels, xvalue, file) ⇒ Object

Funciones basadas en Gruff



3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
# File 'lib/application.rb', line 3681

def create_graph_gruff(type,theme,font,fontsize,title,x_axis_label,y_axis_label,titlearray,dataarray,xlabels,xvalue,file)
 require 'rubygems'
 require 'gruff'
 case type.upcase
  when 'LINE'
   g = Gruff::Line.new
  when 'PIE'
   g = Gruff::Pie.new 
  when 'BAR'
   g = Gruff::Bar.new 
  when 'AREA'
   g = Gruff::Area.new  
  when 'SIDEBAR'
   g = Gruff::SideBar.new   
  when 'STACKEDBAR'
   g = Gruff::StackedBar.new    
  when 'SIDESTACKEDBAR'
   g = Gruff::SideStackedBar.new
  else
   g = Gruff::Line.new
 end
 case theme[0].upcase
  when 'BLACK'
   g.theme_keynote
  when 'BLUELIGHT'
   g.theme_37signals
  when 'PINK'
   g.theme_odeo
  when 'BLUE'
   g.theme_rails_keynote
  else
   g.theme = theme[1]
 end
 g.title = title
 # Tipo de Letra
 if font!=""
  g.font = font
 end
 if fontsize[0]!=''
  g.title_font_size = fontsize[0]
 else
  g.title_font_size = 14
 end
 if fontsize[1]!=''
  g.legend_font_size = fontsize[1]
 else
  g.legend_font_size = 12
 end
 if fontsize[2]!=''
  g.marker_font_size = fontsize[2]
 else
  g.marker_font_size = 12
 end
 g.x_axis_label = x_axis_label
 g.y_axis_label = y_axis_label
 for i in 0..titlearray.length-1
  g.data(titlearray[i], dataarray[i])
 end
 for i in 0..xlabels.length-1
  g.labels[xlabels[i]] = xvalue[i]
 end
 g.write(file)
end

#create_gridAjaxView_extjs(nameFunction, width, height, title, idCatalogo, ds, cm, widthcm, pageserver, params) ⇒ Object

Grid Dinamico con Altura, Amplitud y Pase de parametros



2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
# File 'lib/application.rb', line 2594

def create_gridAjaxView_extjs(nameFunction,title,,ids,ds,cm,widthcm,pageserver)
 itemsDs = Array.new
 itemsDs = ds.split(',')
 itemsds = ''
 for i in 0..itemsDs.length-1 
  if i==itemsDs.length-1 
   itemsds = itemsds + '{name: "' + itemsDs[i].to_s + '"}'
  else
   itemsds = itemsds + '{name: "' + itemsDs[i].to_s + '"},'
  end
 end
 itemsCm = Array.new
 itemsWidthcm = Array.new
 itemsCm = cm.split(',')
 itemswidthcm = widthcm.split(',')
 itemscm = ''
 for i in 0..itemsCm.length-1 
  if i==itemsCm.length-1 
   itemscm = itemscm + '{header: "'+itemsCm[i].to_s + '", width: '+itemswidthcm[i].to_s+', sortable: true, dataIndex: "'+itemsDs[i].to_s+'"}'
  else
   itemscm = itemscm + '{header: "'+itemsCm[i].to_s + '", width: '+itemswidthcm[i].to_s+', sortable: true, dataIndex: "'+itemsDs[i].to_s+'"},'
  end
 end
 if ids!=''
  itemsIds = Array.new
  itemsIds = ids.split(',')
  itemsids = ''
  for i in 0..itemsIds.length-1 
   itemsids = itemsids + 'Ext.get("'+itemsIds[i].to_s+'").dom.value = '++'grid.getSelectionModel().getSelected().get("'+itemsDs[i].to_s+'");'
  end
  itemsids = itemsids + 'document.getElementById("'+itemsIds[0].to_s+'").select();document.getElementById("'+itemsIds[0].to_s+'").focus();'
  botonAceptar = '{
                    text:"Aceptar",  
                    handler: function()
                    {
                     '+itemsids+'
                     '++'onoff_clave = true;
                     '++'win.hide();
                    }
                   },'
 else
  botonAceptar = ''
 end
 return '<div id="'++'"></div><div id="'++'Grid"></div>
         <script>
          var '++'gridOnOff = false;
          var '++'winOnOff = false;
          var '++'grid = null;
          var '++'win = null;
          function '+nameFunction.to_s+'()
          {
           Ext.Ajax.request({
                          url : "'+$kamila_site+'/'+pageserver+'",
                          method: "POST",
                          waitMsg: "Cargando...",
                          success: function ( resultado, request ) { 
                 var datos = resultado.responseText;
                 var Registros = datos.split("|");
                 if (Registros.length-1==0)
                 {
                  Ext.MessageBox.alert("Error", "Inesperado, posible error en la vista o modelo");
                  return;
                 }
                 var Datos2 = new Array();
                 var j=0;
                 var k=0;
                 while (j<Registros.length)
                 {
                  var Campos = Registros[j].split(",");
                  var Datos1 = new Array();
                  for (i=0;i<Campos.length; i++)
                  {
                   Datos1[i] = Campos[i];
                  }
                  if (j>0)
                  {
                   Datos2[k] = Datos1;
                   k++
                  }
                  j++;
                 }
                 Ext.grid.Datos = Datos2;
                 if (!'++'gridOnOff)
                 {
                  '++'grid = new Ext.grid.GridPanel({
                       border:false,
                       ds: new Ext.data.Store({
                           reader: new Ext.data.ArrayReader({}, [ '+itemsds+' ]),
                           data: Ext.grid.Datos
                       }),
                       cm: new Ext.grid.ColumnModel([
                           new Ext.grid.RowNumberer(), '+itemscm+' ]),

                       viewConfig: {
                           forceFit:true
                       }
                  });
                  '++'gridOnOff = true;
                 }
                 else
                 {
                  var storeDatos = new Ext.data.Store({
                           reader: new Ext.data.ArrayReader({}, [ '+itemsds+' ]),
                           data: Ext.grid.Datos
                       });
                  '++'grid.reconfigure(storeDatos,'++'grid.getColumnModel());
                 }
                 if(!'++'winOnOff)
                 {
                  '++'win = new Ext.Window(
                  {
                   el:"'++'",
                   layout:"fit",
                   title: "'+title.to_s+'",
                   width:500,
                   height:300,
                   modal: true,
                   closeAction:"hide",
                   plain: true,
                   items: '++'grid,
                   buttons: ['+botonAceptar+'
                   {
                    text: "Salir",
                    handler: function()
                    {
                     '++'win.hide();
                    }
                   }]
                  });
                  '++'winOnOff = true;
                 }
                 '++'win.show(this);
                 '++'grid.render("'+.to_s+'Grid");
                 '++'grid.getSelectionModel().selectFirstRow();
                },
                failure: function ( resultado, request) { 
                  Ext.MessageBox.alert("Error", resultado.responseText); 
                }
            });  
          }
         </script>'
end

#create_gridAjaxView_rialto(top, left, width, height, nameFunction, title, nameCatalogo, nameFields, cn, widthc, typec, pageserver, namesparams) ⇒ Object



3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
# File 'lib/application.rb', line 3509

def create_gridAjaxView_rialto(top,left,width,height,nameFunction,title,,nameFields,cn,widthc,typec,pageserver)
 # Estaba despues de cargar el grid: '+nameCatalogo+'oGrid.deleteOneLine(0);
 itemsc = Array.new()
 itemsw = Array.new()
 itemst = Array.new()
 itemsf = Array.new()
 itemsc = cn.split(",")
 itemsw = widthc.split(",")
 itemst = typec.split(",")
 itemsf = nameFields.split(",")
 itemsHeader = " "
 ciclo = " "
 for i in 0..itemsc.length-1
  if i==itemsc.length-1
   itemsHeader = itemsHeader + '{title:"'+itemsc[i]+'",width:'+itemsw[i]+',type:"'+itemst[i]+'"} '
  else
   itemsHeader = itemsHeader + '{title:"'+itemsc[i]+'",width:'+itemsw[i]+',type:"'+itemst[i]+'"},'    
  end
  ciclo = ciclo+itemsf[i].to_s+'.setValue('++'oGrid.getCellData('++'oGrid.getIndLineClic(),'+i.to_s+'));'
 end
 return '<script>
          var '++'sPopup = null;
          var '++'oGrid = null;
          function '++'Repuesta(response)
          { 
           var Datos2 = new Array();
           var j=0;
           var k=0;
           datos = response.responseText;
           Registros = datos.split("|");
           while (j<Registros.length)
           {
            var Campos = Registros[j].split(",");
            var Datos1 = new Array();
            for (i=0;i<Campos.length; i++)
            {
             Datos1[i] =  Campos[i];
            }
            if (j>0)
            {
             Datos2[k] = Datos1;
             k++
            }
            j++;
           }
           '++'oGrid.fillGrid(Datos2);
           '++'oGrid.clickLine(0,0);
           var aceptar = new rialto.widget.Button(parseInt(screen.height * 0.40),parseInt(screen.width * 0.15),
                             "Aceptar","Seleccionar un registro",'++'sPopup,{adaptToText:true,widthMin:70});
           aceptar.onclick= function() { '+ciclo++'sPopup.closeWindow(); }
           var salir = new rialto.widget.Button(parseInt(screen.height * 0.40),parseInt(screen.width * 0.25),
                             "Salir","Salir",'++'sPopup,{adaptToText:true,widthMin:70});
           salir.onclick= function() { '++'sPopup.closeWindow(); }
          }
          function '+nameFunction+'()
          {
           '++'sPopup = new rialto.widget.PopUp("'++'",'+top+','+left+',"'+width+'","'+height+'","'+title+'","","gray");
           '++'oGrid = new rialto.widget.Grid({top:30,left:5,height:220,witdh:200,
            arrHeader:[ '+itemsHeader+' ],
            name:"'++'oTable",parent:'++'sPopup,row:10,
            cellActive:false,sortable:true,multiSelect:false,
            lineHeight:26,boolPrint:true,switchable:true,
            clickable:true,autoResizableW:true,autoResizableH:false,
            writable:false});
            //Ajax para los datos
            var '++'ajaxReq=new rialto.io.AjaxRequest({
              url:"'+$kamila_site+'/'+pageserver+'",
              method: "post",
              withWaitWindow:true,  
              callBackObjectOnSuccess:this,
              onSuccess: '++'Repuesta,
              onFailure: function(){ alert("Error Ajax conexion"); }
            });
            '++'ajaxReq.load("");
          }
         </script>'
end

#create_gridView_extjs(nameFunction, title, idCatalogo, ids, ds, cm, widthcm, data) ⇒ Object



2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
# File 'lib/application.rb', line 2149

def create_gridView_extjs(nameFunction,title,,ids,ds,cm,widthcm,data)
 itemsDs = Array.new
 itemsDs = ds.split(',')
 itemsds = ''
 for i in 0..itemsDs.length-1 
  if i==itemsDs.length-1 
   itemsds = itemsds + '{name: "' + itemsDs[i].to_s + '"}'
  else
   itemsds = itemsds + '{name: "' + itemsDs[i].to_s + '"},'
  end
 end
 itemsCm = Array.new
 itemsWidthcm = Array.new
 itemsCm = cm.split(',')
 itemswidthcm = widthcm.split(',')
 itemscm = ''
 for i in 0..itemsCm.length-1 
  if i==itemsCm.length-1 
   itemscm = itemscm + '{header: "'+itemsCm[i].to_s + '", width: '+itemswidthcm[i].to_s+', sortable: true, dataIndex: "'+itemsDs[i].to_s+'"}'
  else
   itemscm = itemscm + '{header: "'+itemsCm[i].to_s + '", width: '+itemswidthcm[i].to_s+', sortable: true, dataIndex: "'+itemsDs[i].to_s+'"},'
  end
 end
 if ids!=''
  itemsIds = Array.new
  itemsIds = ids.split(',')
  itemsids = ''
  for i in 0..itemsIds.length-1 
   itemsids = itemsids + 'Ext.get("'+itemsIds[i].to_s+'").dom.value = '++'grid.getSelectionModel().getSelected().get("'+itemsDs[i].to_s+'");'
  end
  itemsids = itemsids + 'document.getElementById("'+itemsIds[0].to_s+'").select();document.getElementById("'+itemsIds[0].to_s+'").focus();'
  botonAceptar = '{
                    text:"Aceptar",  
                    handler: function()
                    {
                     '+itemsids+'
                     '++'onoff_clave = true;
                     '++'win.hide();
                    }
                   },'
 else
  botonAceptar = ''
 end
 return '<div id="'++'"></div><div id="'++'Grid"></div>
         <script>
          var '++'gridOnOff = false;
          var '++'winOnOff = false;
          var '++'grid = null;
          var '++'win = null;
          function '+nameFunction.to_s+'()
          {
                 var datos = "'+data.to_s+'";
                 var Registros = datos.split("|");
                 if (Registros.length-1==0)
                 {
                  Ext.MessageBox.alert("Error", "Inesperado, posible error en la vista o modelo");
                  return;
                 }
                 var Datos2 = new Array();
                 var j=0;
                 var k=0;
                 while (j<Registros.length)
                 {
                  var Campos = Registros[j].split(",");
                  var Datos1 = new Array();
                  for (i=0;i<Campos.length; i++)
                  {
                   Datos1[i] = Campos[i];
                  }
                  if (j>0)
                  {
                   Datos2[k] = Datos1;
                   k++
                  }
                  j++;
                 }
                 Ext.grid.Datos = Datos2;
                 if (!'++'gridOnOff)
                 {
                  '++'grid = new Ext.grid.GridPanel({
                       border:false,
                       ds: new Ext.data.Store({
                           reader: new Ext.data.ArrayReader({}, [ '+itemsds+' ]),
                           data: Ext.grid.Datos
                       }),
                       cm: new Ext.grid.ColumnModel([
                           new Ext.grid.RowNumberer(), '+itemscm+' ]),

                       viewConfig: {
                           forceFit:true
                       }
                  });
                  '++'gridOnOff = true;
                 }
                 else
                 {
                  var storeDatos = new Ext.data.Store({
                           reader: new Ext.data.ArrayReader({}, [ '+itemsds+' ]),
                           data: Ext.grid.Datos
                       });
                  '++'grid.reconfigure(storeDatos,'++'grid.getColumnModel());
                 }
                 if(!'++'winOnOff)
                 {
                  '++'win = new Ext.Window(
                  {
                   el:"'++'",
                   layout:"fit",
                   title: "'+title.to_s+'",
                   width:500,
                   height:300,
                   modal: true,
                   closeAction:"hide",
                   plain: true,
                   items: '++'grid,
                   buttons: ['+botonAceptar+'
                   {
                    text: "Salir",
                    handler: function()
                    {
                     '++'win.hide();
                    }
                   }]
                  });
                  '++'winOnOff = true;
                 }
                 '++'win.show(this);
                 '++'grid.render("'+.to_s+'Grid");
                 '++'grid.getSelectionModel().selectFirstRow();
          }
         </script>'
end

#create_gridView_rialto(top, left, width, height, nameFunction, title, nameCatalogo, nameFields, cn, widthc, typec, data) ⇒ Object



3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
# File 'lib/application.rb', line 3441

def create_gridView_rialto(top,left,width,height,nameFunction,title,,nameFields,cn,widthc,typec,data)
 # Estaba despues de cargar el grid: '+nameCatalogo+'oGrid.deleteOneLine(0);
 itemsc = Array.new()
 itemsw = Array.new()
 itemst = Array.new()
 itemsf = Array.new()
 itemsc = cn.split(",")
 itemsw = widthc.split(",")
 itemst = typec.split(",")
 itemsf = nameFields.split(",")
 itemsHeader = " "
 ciclo = " "
 for i in 0..itemsc.length-1
  if i==itemsc.length-1
   itemsHeader = itemsHeader + '{title:"'+itemsc[i]+'",width:'+itemsw[i]+',type:"'+itemst[i]+'"} '
  else
   itemsHeader = itemsHeader + '{title:"'+itemsc[i]+'",width:'+itemsw[i]+',type:"'+itemst[i]+'"},'    
  end
  ciclo = ciclo+itemsf[i].to_s+'.setValue('++'oGrid.getCellData('++'oGrid.getIndLineClic(),'+i.to_s+'));'
 end
 return '<script>
          var '++'sPopup = null;
          var '++'oGrid = null;
          function '++'LoadData()
          { 
           var Datos2 = new Array();
           var j=0;
           var k=0;
           datos = "'+data.to_s+'";
           Registros = datos.split("|");
           while (j<Registros.length)
           {
            var Campos = Registros[j].split(",");
            var Datos1 = new Array();
            for (i=0;i<Campos.length; i++)
            {
             Datos1[i] =  Campos[i];
            }
            if (j>0)
            {
             Datos2[k] = Datos1;
             k++
            }
            j++;
           }
           '++'oGrid.fillGrid(Datos2);
           '++'oGrid.clickLine(0,0);
           var aceptar = new rialto.widget.Button(parseInt(screen.height * 0.40),parseInt(screen.width * 0.15),
                             "Aceptar","Seleccionar un registro",'++'sPopup,{adaptToText:true,widthMin:70});
           aceptar.onclick= function() { '+ciclo++'sPopup.closeWindow(); }
           var salir = new rialto.widget.Button(parseInt(screen.height * 0.40),parseInt(screen.width * 0.25),
                             "Salir","Salir",'++'sPopup,{adaptToText:true,widthMin:70});
           salir.onclick= function() { '++'sPopup.closeWindow(); }
          }
          function '+nameFunction+'()
          {
           '++'sPopup = new rialto.widget.PopUp("'++'",'+top+','+left+',"'+width+'","'+height+'","'+title+'","","gray");
           '++'oGrid = new rialto.widget.Grid({top:30,left:5,height:220,witdh:200,
            arrHeader:[ '+itemsHeader+' ],
            name:"'++'oTable",parent:'++'sPopup,row:10,
            cellActive:false,sortable:true,multiSelect:false,
            lineHeight:26,boolPrint:true,switchable:true,
            clickable:true,autoResizableW:true,autoResizableH:false,
            writable:false});
            '++'LoadData();
          }
         </script>'
end

#create_headObject



358
359
360
# File 'lib/application.rb', line 358

def create_head()
 return '<head>'
end

#create_heading(h, id, texto) ⇒ Object



487
488
489
# File 'lib/application.rb', line 487

def create_heading(h)
 return '<' + h.to_s + '>'
end

#create_href(url, texto, target) ⇒ Object



617
618
619
# File 'lib/application.rb', line 617

def create_href(url)
 return '<a href="' + url.to_s + '">'
end

#create_htmlObject

Funciones de HTML



352
353
354
# File 'lib/application.rb', line 352

def create_html()
 return '<html>'
end

#create_img(id, src, alt, border, height, width) ⇒ Object



680
681
682
# File 'lib/application.rb', line 680

def create_img(src)
 return '<img src="'+$kamila_site+'/public/'+src.to_s+'" />'
end

#create_img_lightbox2(url, text, altura, amplitud) ⇒ Object



720
721
722
# File 'lib/application.rb', line 720

def create_img_lightbox2(src,title,alt,height,width)
 return '<a href="'+$kamila_site+'/public/'+src.to_s+'" rel="lightbox" title="'+title.to_s+'"><img border="0" src="'+$kamila_site+'/public/'+src.to_s+'" alt="'+alt.to_s+'" height="' + height.to_s + '" width="' + width.to_s + '" /><br/>'+alt.to_s+'</a>'
end

#create_javascript(js, flag) ⇒ Object



399
400
401
# File 'lib/application.rb', line 399

def create_javascript()
 return '<script language="javascript">'
end

#create_javascript_extjsObject



434
435
436
# File 'lib/application.rb', line 434

def create_javascript_extjs()
 return '<link rel="stylesheet" type="text/css" href="'+$kamila_site+'/public/css/resources/css/ext-all.css"><link rel="stylesheet" type="text/css" href="'+$kamila_site+'/public/css/resources/css/file-upload.css"><script type="text/javascript" src="'+$kamila_site+'/public/js/extjs/adapter/ext/ext-base.js"></script><script type="text/javascript" src="'+$kamila_site+'/public/js/extjs/ext-all.js"></script><script type="text/javascript" src="'+$kamila_site+'/public/js/extjs/build/widgets/form/FileUploadField.js"></script><script>Ext.QuickTips.init();Ext.BLANK_IMAGE_URL = "'+$kamila_site+'/public/css/resources/images/default/s.gif";</script>'
end

#create_javascript_language_extjs(language, charset) ⇒ Object



445
446
447
448
449
450
451
452
453
# File 'lib/application.rb', line 445

def create_javascript_language_extjs(language,charset)
 return '<script type="text/javascript">
          var s = document.createElement("script");
          s.type = "text/javascript";
          s.src = "' + $kamila_site.to_s + '/public/js/extjs/locale/ext-lang-' + language.to_s + '.js";
          s.charset = "' + charset.to_s + '";
          document.getElementsByTagName("head")[0].appendChild(s);
         </script>'
end

#create_javascript_lightbox2Object



484
485
486
# File 'lib/application.rb', line 484

def create_javascript_lightbox2()
 return '<link rel="stylesheet" type="text/css" href="'+$kamila_site+'/public/css/lightbox2/lightbox.css" media="screen"><script type="text/javascript" src="'+$kamila_site+'/public/js/lightbox2/prototype.js"></script><script type="text/javascript" src="'+$kamila_site+'/public/js/lightbox2/scriptaculous.js?load=effects,builder"></script><script type="text/javascript" src="'+$kamila_site+'/public/js/lightbox2/lightbox.js"></script>'
end

#create_javascript_livevalidation(idiom) ⇒ Object



427
428
429
430
431
432
433
# File 'lib/application.rb', line 427

def create_javascript_livevalidation(idiom)
 if idiom=="es"
  return '<link rel="stylesheet" type="text/css" href="'+$kamila_site+'/public/css/validacion.css"><script type="text/javascript" src="'+$kamila_site+'/public/js/livevalidation_es.js"></script>'
 else
  return '<link rel="stylesheet" type="text/css" href="'+$kamila_site+'/public/css/validacion.css"><script type="text/javascript" src="'+$kamila_site+'/public/js/livevalidation_en.js"></script>'
 end
end

#create_javascript_md5Object



424
425
426
# File 'lib/application.rb', line 424

def create_javascript_md5()
 return '<script type="text/javascript" src="'+$kamila_site+'/public/js/md5.js"></script>'
end

#create_javascript_rialto(theme) ⇒ Object



437
438
439
440
441
442
443
444
# File 'lib/application.rb', line 437

def create_javascript_rialto(theme)
 return '<link rel="stylesheet" type="text/css" href="'+ $kamila_site + '/public/css/rialto/style/rialto.css"/>' +
        '<link rel="stylesheet" type="text/css" href="'+ $kamila_site + '/public/css/rialto/style/formatGrid.css"/>' +
        '<link rel="stylesheet" type="text/css" href="'+ $kamila_site + '/public/css/rialto/style/behavior.css"/>' +
        '<link rel="stylesheet" href="'+ $kamila_site + '/public/css/rialto/style/' + theme.to_s+'" type="text/css">' +
        '<SCRIPT SRC="'+ $kamila_site + '/public/js/rialto/config.js" language="JavaScript1.2"></SCRIPT>' +
        '<SCRIPT SRC="'+ $kamila_site + '/public/js/rialto/rialto.js" language="JavaScript1.2"></SCRIPT>'
end

#create_javascript_validate_rangedate_extjs(funcion) ⇒ Object



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/application.rb', line 454

def create_javascript_validate_rangedate_extjs(funcion)
 return '<script type="text/javascript">
          Ext.apply(Ext.form.VTypes, {
            ' + funcion.to_s + ': function(val, field) {
            var date = field.parseDate(val);
            var dispUpd = function(picker) {
             var ad = picker.activeDate;
             picker.activeDate = null;
             picker.update(ad);
            };
            if (field.startDateField) {
             var sd = Ext.getCmp(field.startDateField);
             sd.maxValue = date;
             if (sd.menu && sd.menu.picker) {
              sd.menu.picker.maxDate = date;
              dispUpd(sd.menu.picker);
             }
            } else if (field.endDateField) {
             var ed = Ext.getCmp(field.endDateField);
             ed.minValue = date;
             if (ed.menu && ed.menu.picker) {
              ed.menu.picker.minDate = date;
              dispUpd(ed.menu.picker);
             }
            }
            return true;
           }
          });
         </script>'
end

#create_javascript_view_file(left, top, width, height, file) ⇒ Object



418
419
420
421
422
423
# File 'lib/application.rb', line 418

def create_javascript_view_file(left,top,width,height,file)
 return '<script language="javascript">
          var opciones="left='+left.to_s+',top='+top.to_s+',width='+width.to_s+',height='+height.to_s+'";
          mi_ventana = window.open("'+file.to_s+'","",opciones); 
         </script>'
end

#create_label_extjs(id, width, text, disabled, cls, x, y) ⇒ Object



1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
# File 'lib/application.rb', line 1450

def create_label_extjs(id,width,text,disabled,cls)
 return '<div id="k'+id.to_s+'"></div>
           <script>
           var k'+id.to_s+' = new Ext.form.Label({
                                   id: "'+id.to_s+'",
                                   width: '+width.to_s+',
                                   text: "'+text.to_s+'",
                                   disabled: '+disabled.to_s+',
                                   cls: "'+cls.to_s+'"
                                  });
           k'+id.to_s+'.render("k'+id.to_s+'");
          </script>'
end

#create_label_rialto(name, top, left, parent, text, className) ⇒ Object



3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
# File 'lib/application.rb', line 3153

def create_label_rialto(name,top,left,parent,text,className)
 if parent.upcase=='DOCUMENT.BODY' or parent==''
  parent='document.body'
  return '<script>
            var '+name.to_s+' = new rialto.widget.Label("'+name.to_s+'",'+top.to_s+','+left.to_s+','+parent.to_s+',"'+text.to_s+'","'+className.to_s+'");
           </script>'
 else
  return '<div id="'+parent.to_s+'"></div>
            <script>
            var '+parent.to_s+'=document.getElementById("'+parent.to_s+'");
            var '+name.to_s+' = new rialto.widget.Label("'+name.to_s+'",'+top.to_s+','+left.to_s+','+parent.to_s+',"'+text.to_s+'","'+className.to_s+'");
           </script>'
 end
end

#create_li(id, css) ⇒ Object



573
574
575
# File 'lib/application.rb', line 573

def create_li()
 return '<li>'
end

#create_massValidate_extjs(name, ids, mensaje) ⇒ Object



1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
# File 'lib/application.rb', line 1415

def create_massValidate_extjs(name,ids,mensaje)
 itemsids = Array.new()
 itemsids = ids.split(",")
 condicion1 = ''
 condicion2 = ''
 for i in 0..itemsids.length-1
  if i == itemsids.length-1
   condicion1 = condicion1.to_s  + itemsids[i].to_s + '.isValid() '
  else
   condicion1 = condicion1.to_s  + itemsids[i].to_s + '.isValid() && '
  end
  condicion2 = condicion2.to_s + itemsids[i].to_s + '.clearInvalid(); '
 end
 return '<script>
        function '+name.to_s+'
        {
         if ('+condicion1.to_s+')
         {
          return true;
         }
         else
         {
          Ext.MessageBox.show({
              title: "Error",
                     msg: "' + mensaje.to_s + '",
           	      width:400,
              buttons: Ext.MessageBox.OK,
                     icon: Ext.MessageBox.ERROR
           });
           '+condicion2.to_s+'
          return false;
         }
        }
        </script>'
end

#create_massValidate_lv(ids, messageError) ⇒ Object



1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
# File 'lib/application.rb', line 1264

def create_massValidate_lv(ids,messageError)
 return '<script type="text/javascript">
   form.onsubmit = function(e){
      var exito = LiveValidation.massValidate(['+ids.to_s+']);
      if (exito==true)
      {
       form.submit();
       return true;
      }
      else
      {
       Ext.onReady(function(){
        Ext.MessageBox.show({
                             title: "Error",
                             msg: "' + messageError.to_s + '" ,
                             width:400,
                             buttons: Ext.MessageBox.OK,
                             icon: Ext.MessageBox.ERROR
                            });

       });
      }
      return false;
   }
 </script>'
end

#create_massValidate_rialto(form, name, ids, mensaje) ⇒ Object



3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
# File 'lib/application.rb', line 3332

def create_massValidate_rialto(form,name,ids,mensaje)
 itemsValidate = ''
 itemsValidateisRequired = 'var '+form.to_s+'_formatter = new rialto.utils.Formatter({type:"string"}); var '+form.to_s+'_Validate=true; '
 itemsExecution = ' '
 itemsids = Array.new()
 itemsids = ids.split(",")
 nrodeItems = itemsids.length-1
 for i in 0..nrodeItems
  if i == 0
   itemsValidateisRequired = itemsValidateisRequired + 'for (i=0; i<'+nrodeItems.to_s+'; i++) { '
  end
  if i !=0 and i!=nrodeItems
   itemsValidateisRequired = itemsValidateisRequired + ' if ('+itemsids[i].to_s+'.isRequired==true && '+itemsids[i].to_s+'.getValue()=="") {'+form.to_s+'_Validate=false; }'
  end
  if i ==  nrodeItems
   itemsValidateisRequired = itemsValidateisRequired + ' if ('+itemsids[i].to_s+'.isRequired==true && '+itemsids[i].to_s+'.getValue()=="") {'+form.to_s+'_Validate=false; } }'
  end
  itemsValidate = itemsValidate + 'if (' + form.to_s + '_formatter.validate('+itemsids[i].to_s+'.getValue(),false)!=true && '+form.to_s+'_Validate==true ) { '+form.to_s+'_Validate=false; } '
 end
 itemsExecution = itemsExecution + 'if ('+form.to_s+'_Validate==true) { '+form.to_s+'.submit(); return true; } else { var sPopup = new rialto.widget.PopUp("popupRialto",150,420,"260","80","'+mensaje.to_s+'","Informacion","gray"); var btn2pop = new rialto.widget.Button(30,65,"Aceptar","Aceptar",sPopup);  btn2pop.onclick=function () { sPopup.closeWindow(); }; return false;}'
 return '<script>
         function '+name.to_s+'
         {
         '+itemsValidateisRequired+' '+itemsValidate+' '+itemsExecution+'
         }
         </script>'
end

#create_meta(httpequiv, content, charset) ⇒ Object



373
374
375
# File 'lib/application.rb', line 373

def create_meta()
 return '<meta name="GENERATOR" content="kamila version 1.0.2">'
end

#create_ol(id, css) ⇒ Object



558
559
560
# File 'lib/application.rb', line 558

def create_ol()
 return '<ol>'
end

#create_paragraphs(id, text, css) ⇒ Object



502
503
504
# File 'lib/application.rb', line 502

def create_paragraphs()
 return '<p>'
end

#create_showVideo_flash(id, width, height, url) ⇒ Object



3863
3864
3865
3866
3867
3868
3869
# File 'lib/application.rb', line 3863

def create_showVideo_flash(id,width,height,url)
 return '<object ID="'+id+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="+height+">
          <param name="movie" value="'+url+'">
          <param name="quality" value="high">
          <embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="+height+"></embed>
         </object>'
end

#create_showVideo_jwplayer(id, width, height, url) ⇒ Object



3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
# File 'lib/application.rb', line 3870

def create_showVideo_jwplayer(id,width,height,url)
 # Basado del Proyecto: http://www.jeroenwijering.com/?item=JW_FLV_Media_Player
 return '<div id="'+id+'"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
          <script type="text/javascript" src="'+$kamila_site+'/public/js/kamila/swfobject.js'+'"></script>
 	       <script type="text/javascript">
	    var s1 = new SWFObject("'+$kamila_site+'/public/js/kamila/player.swf'+'","ply","'+width+'","'+height+'","9","#FFFFFF");
	    s1.addParam("allowfullscreen","true");
	    s1.addParam("allowscriptaccess","always");
	    s1.addParam("flashvars","file='+url+'&image='+$kamila_site+'/public/img/kamila/preview.jpg'+'");
	    s1.write("'+id+'");
       </script>'
end

#create_showVideo_wmv(id, width, height, url) ⇒ Object



3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
# File 'lib/application.rb', line 3845

def create_showVideo_wmv(id,width,height,url)
 return '<OBJECT ID="'+id+'" width="'+width+'" height="+height+" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
           codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,70" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
           <PARAM name="URL" value="'+url+'">
           <PARAM name="DisplaySize" value=0>
           <PARAM name="AllowChangeDisplaySize" value="True">
           <PARAM NAME=ShowControls VALUE=1>
           <PARAM NAME="WindowlessVideo" Value="0">
           <PARAM NAME=ShowDisplay VALUE=1>
           <PARAM NAME=ShowStatusBar VALUE=1>
           <PARAM NAME=AutoStart VALUE=TRUE>
           <PARAM NAME=InvokeURLS Value=False>
           <embed name="'+id+'" width="'+width+'" height="'+height+'" type="application/x-mplayer2"
            pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"
            src="'+url+'" Name="Video File" AllowChangeDisplaySize="True" ShowControls="1" AutoStart=True ShowDisplay="0" ShowStatusBar="1">
           </embed>
         </OBJECT>'
end

#create_span(text, id, css) ⇒ Object



532
533
534
# File 'lib/application.rb', line 532

def create_span(text)
 return '<span>'+text.to_s
end

#create_table(cellpadding, cellspacing, border, align, width, height, background) ⇒ Object



632
633
634
# File 'lib/application.rb', line 632

def create_table(border)
 return '<table border="' + border.to_s + '">'
end

#create_tabpanel_extjs(id, active, collapsible, floating, width, height, plain, titles, icons, tabtips, urls, closeable, col, row) ⇒ Object



2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
# File 'lib/application.rb', line 2085

def create_tabpanel_extjs(id,active,collapsible,floating,width,height,plain,titles,icons,tabtips,urls,closeable,col,row)
 itemsTitles = Array.new()
 itemsIcons = Array.new()
 itemsTabtips = Array.new()
 itemsUrls = Array.new()
 itemsCloseable = Array.new()
 itemsTitles = titles.split(',')
 itemsIcons = icons.split(',')
 itemsTabtips = tabtips.split(',')
 itemsUrls = urls.split(',')
 itemsCloseable = closeable.split(',')
 tamanoitemsRange = itemsTitles.length - 1
 itemsTab = '['
 for i in 0..tamanoitemsRange
  if i==tamanoitemsRange
   itemsTab = itemsTab + '{
                   title: "' +itemsTitles[i].to_s+'",
                   iconCls: "'+itemsIcons[i].to_s+'",
                   tabTip: "'+itemsTabtips[i].to_s+'",
                   autoLoad: "'+itemsUrls[i].to_s+'",
                   closable: '+itemsCloseable[i].to_s+'
                  }]'
  else
   itemsTab = itemsTab + '{
                   title: "' +itemsTitles[i].to_s+'",
                   iconCls: "'+itemsIcons[i].to_s+'",
                   tabTip: "'+itemsTabtips[i].to_s+'",
                   autoLoad: "'+itemsUrls[i].to_s+'",
                   closable: '+itemsCloseable[i].to_s+'
                   },'
  end
 end
 return '<script>
          var '+id.to_s+'tabs = new Ext.TabPanel({
           renderTo: document.body,
           id: "k'+id.to_s+'",
           activeTab: '+active.to_s+',
           collapsible: '+collapsible.to_s+',
           floating: '+floating.to_s+',
           width:'+width.to_s+',
           height:'+height.to_s+',
           plain:'+plain.to_s+',
           defaults:{autoScroll: true},
           draggable: {
            insertProxy: false,
            onDrag : function(e){
             var pel = this.proxy.getEl();
             this.x = pel.getLeft(true);
             this.y = pel.getTop(true);
             var s = this.panel.getEl().shadow;
             if (s) {
               s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
             }
            },
            endDrag : function(e){
             this.panel.setPosition(this.x, this.y);
            }
           },
           items: '+itemsTab.to_s+'
          });
          '+id.to_s+'tabs.setPagePosition('+col.to_s+','+row.to_s+');
          '+id.to_s+'tabs.render("k'+id.to_s+'");
         </script>'
end

#create_td(width, height, align, border, css) ⇒ Object



653
654
655
# File 'lib/application.rb', line 653

def create_td()
 return '<td>'
end

#create_text_lightbox2(src, title, description) ⇒ Object



704
705
706
707
708
709
710
711
712
713
714
# File 'lib/application.rb', line 704

def create_text_lightbox2(url,text)
 src = Array.new
 description = Array.new
 src = url.split("|")
 description = text.split("|")
 itemsImages = ''
 for i in 0..src.length-1
  itemsImages = itemsImages+'<a href="'+$kamila_site+'/public/'+src[i].to_s+'" rel="lightbox[roadtrip]" >'+description[i].to_s+'</a><br/>'
 end
 return itemsImages
end

#create_title(title) ⇒ Object



364
365
366
# File 'lib/application.rb', line 364

def create_title(title)
 return '<title>'+title.to_s+'</title>'
end

#create_trObject



647
648
649
# File 'lib/application.rb', line 647

def create_tr()
 return '<tr>'
end

#create_ul(id) ⇒ Object



547
548
549
# File 'lib/application.rb', line 547

def create_ul()
 return '<ul>'
end

#deleteSessionObject



3932
3933
3934
3935
3936
3937
3938
3939
# File 'lib/application.rb', line 3932

def deleteSession()
 prefix = String.new()
 prefix = Digest::MD5.hexdigest($kamila_remoteaddr.to_s)
 #prefix = $kamila_remoteaddr.to_s
 if File.exist?("/tmp/kamila_session."+prefix.to_s)
  File.unlink("/tmp/kamila_session."+prefix.to_s) 
 end
end

#format_number(number, separator) ⇒ Object

Formato a un numero



3677
3678
3679
# File 'lib/application.rb', line 3677

def format_number(number, separator)
 return number.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1"+separator)
end

#getValueSession(variable) ⇒ Object



3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
# File 'lib/application.rb', line 3951

def getValueSession(variable)
 prefix = String.new()
 prefix = Digest::MD5.hexdigest($kamila_remoteaddr.to_s)
 #prefix = $kamila_remoteaddr.to_s
 value = String.new
 inicio = 0
 minutos = 0
 if File.exist?("/tmp/kamila_session."+prefix.to_s)
  db = PStore.new("/tmp/kamila_session."+prefix.to_s)
  db.transaction do
   inicio = db[prefix]
   minutos = db['kamilasession_framework']
  end
  ahora = Time.now
  tiempo = ahora - inicio
  transcurrido = tiempo.to_i/60
  if transcurrido.to_i < minutos
   db.transaction do
    value = db[variable.to_s]
   end
  else
   deleteSession()
   value = "" 
  end
 else
  value = "" 
 end
 return value.to_s 
end

#initSession(minutes) ⇒ Object

Manejo de Sesiones por Kamila



3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
# File 'lib/application.rb', line 3894

def initSession()
 minutos = 30
 begin
  valor = true
  prefix = String.new()
  prefix = Digest::MD5.hexdigest($kamila_remoteaddr.to_s)
  #prefix = $kamila_remoteaddr.to_s
  db = PStore.new("/tmp/kamila_session."+prefix.to_s) 
  db.transaction do
   db[prefix] = Time.now
   db['kamilasession_framework'] = minutos
   db.commit
  end
 rescue
  valor = false
 end
 return valor 
end

#input_button(id, name, value, css, js) ⇒ Object



761
762
763
# File 'lib/application.rb', line 761

def input_button(id,name,value,css,js)
 return '<input type="button" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" class="' + css.to_s + '" ' + js.to_s + '>'
end

#input_button_extjs(id, name, value, css, form, fieldNames, messageError, js) ⇒ Object

Funciones usando Extjs



1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
# File 'lib/application.rb', line 1299

def input_button_extjs(id,name,value,css,form,fieldNames,messageError,js)
 theitems = 'var exito = true; '
 if fieldNames==''
  condicion1 = 'exito==true'
  condicion2 = ''
 else
  itemsids = Array.new()
  itemsids = fieldNames.split(",")
  condicion1 = ''
  condicion2 = ''
  for i in 0..itemsids.length-1
   if i == itemsids.length-1
    condicion1 = condicion1.to_s  + itemsids[i].to_s + '.isValid() '
   else
    condicion1 = condicion1.to_s  + itemsids[i].to_s + '.isValid() && '
   end
   condicion2 = condicion2.to_s + itemsids[i].to_s + '.clearInvalid(); '
  end
 end
 return '<script>
         function '+id.to_s+name.to_s+'()
         {
          '+theitems+'
          if ('+condicion1.to_s+')
          {
           '+js+';
           return true;
          }
          else
          {
           Ext.MessageBox.show({
               title: "Error",
                      msg: "' + messageError.to_s + '",
           	       width:400,
               buttons: Ext.MessageBox.OK,
                     icon: Ext.MessageBox.ERROR
            });
            '+condicion2.to_s+'
           return false;
          }
         }
         </script>
         <input type="button" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" class="' + css.to_s + '" onclick="return '+id.to_s+name.to_s+'()">'
end

#input_button_rialto(name, top, left, text, alt, parent, options, form, js) ⇒ Object



3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
# File 'lib/application.rb', line 3217

def input_button_rialto(name,top,left,text,alt,parent,options,form,js)
 property = Array.new
 property = options.split(",")
 if parent=='document.body' or parent==''
  parent='document.body'
  return '<script>
            var '+name.to_s+' = new rialto.widget.Button('+top.to_s+','+left.to_s+',"'+text.to_s+'","'+alt.to_s+'",'+parent.to_s+',{adaptToText:'+property[0].to_s+',widthMin:'+property[1].to_s+'});
            '+name.to_s+'.onclick= function () { '+js.to_s+'(); }
           </script>'
 else
  return '<div id="'+parent.to_s+'"></div>
            <script>
            var '+parent.to_s+'=document.getElementById("'+parent.to_s+'");
            var '+name.to_s+' = new rialto.widget.Button('+top.to_s+','+left.to_s+',"'+text.to_s+'","'+alt.to_s+'",'+parent.to_s+',{adaptToText:'+property[0].to_s+',widthMin:'+property[1].to_s+'});
            '+name.to_s+'.onclick= function () { '+js.to_s+'(); }
           </script>'
 end
end

#input_checkbox_lv(id, name, value, readonly, disabled, alt, tabindex) ⇒ Object



1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
# File 'lib/application.rb', line 1070

def input_checkbox_lv(id,name,value,readonly,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 return '<input type="checkbox" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Acceptance);
          </script>'
end

#input_checkbox_rialto(name, top, left, parent, text, isChecked, className) ⇒ Object



3359
3360
3361
3362
3363
3364
# File 'lib/application.rb', line 3359

def input_checkbox_rialto(name,top,left,parent,text,isChecked,className)
return '<div id="'+parent+'"></div>
        <script>
         var '+name+' = new rialto.widget.Checkbox("'+name+'",'+top+','+left+','+parent+',"'+text+'",'+isChecked+',"'+className+'");
        </script>'
end

#input_checkboxGroup_extjs(id, name, columns, items, disabled, cls) ⇒ Object

# NO FUNCIONA, acceder las propiedades al arreglo items, para cambiarlas

# /*if (cg.getXType()=="checkboxgroup")
# {
#  alert("Es Checkbox Group");
#  var item0 = rg.items[0];
#  alert(cg.items[0].checked); // ESTO NO FUNCIONA hasta la version Extjs 2.2
# }*/
def input_checkboxGroup_extjs(id,name,columns,items,disabled,cls)
 theitems = ''
 registros = items.split('|')
 for i in 0..registros.length-1
  campos = registros[i].split(',')
  if i==registros.length-1
   theitems = theitems + '{boxLabel: "'+campos[0].to_s+'", inputValue: "'+campos[1].to_s+'", name: "'+campos[2].to_s+'", checked: '+campos[3].to_s+'}'
  else
   theitems = theitems + '{boxLabel: "'+campos[0].to_s+'", inputValue: "'+campos[1].to_s+'", name: "'+campos[2].to_s+'", checked: '+campos[3].to_s+'}, '
  end
 end
 return '<div id="k'+id.to_s+'"></div>
          <script>
          var '+name.to_s+' = new Ext.form.CheckboxGroup({
                                  id: "'+id.to_s+'",
                                  name: "'+name.to_s+'",
                                  columns: ['+columns.to_s+'],
                                  items: [ '+theitems.to_s+' ],
                                  disabled: '+disabled.to_s+',
                                  cls: "'+cls.to_s+'"
                                 });
          '+name.to_s+'.render("k'+id.to_s+'");
         </script>'
end


1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
# File 'lib/application.rb', line 1967

def input_checkboxGroup_extjs(id,name,columns,items,disabled,cls)
 theCheckbox = ''
 xy = Array.new
 xy = columns.split(",")
 registros = Array.new
 registros = items.split('|')
 for i in 0..registros.length-1
  campos = registros[i].split(',')
  theitems = 'boxLabel: "'+campos[0].to_s+'", inputValue: "'+campos[1].to_s+'", name: "'+campos[2].to_s+'", checked: '+campos[3].to_s+','
  theCheckbox = theCheckbox+name.to_s+i.to_s+' = new Ext.form.Checkbox({
                                                      id: "'+id.to_s+i.to_s+'",
                                                      '+theitems+'
                                                      disabled: '+disabled.to_s+',
                                                      cls: "'+cls.to_s+'"
                                                  }); '
  theCheckbox = theCheckbox+name.to_s+i.to_s+'.setSize('+xy[0].to_s+','+xy[1].to_s+'); '
  theCheckbox = theCheckbox+name.to_s+i.to_s+'.render("k'+id.to_s+'"); '
 end
 return '<div id="k'+id.to_s+'"></div>
          <script>
          '+theCheckbox+'
          </script>'
end

#input_combo_rialto(name, top, left, width, items, selWithText, parent, enable, heightItem) ⇒ Object



3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
# File 'lib/application.rb', line 3365

def input_combo_rialto(name,top,left,width,items,selWithText,parent,enable,heightItem)
 itemsvalue = Array.new
 itemsvalue = items.split(",")
 theitems = ''
 for i in 0..itemsvalue.length-1
  theitems = theitems + name + '.addItem("'+itemsvalue[i].to_s+'","'+itemsvalue[i].to_s+'"); '
 end
 if selWithText == ''
  theitems = theitems + name + '.selFirst();'
 else
  theitems = theitems + name + '.selWithText("'+selWithText+'"); '
 end
 theitems = theitems + name + '.onclick = function() { '+ name + '.getSelText(); }'
 return '<div id="'+parent+'"></div>
        <script>
         var '+name+' = new rialto.widget.Combo("","'+name+'",'+top+','+left+','+width+','+parent+',{suggest:true,enable:'+enable+',heightItem:'+heightItem+'});
         '+theitems+'
        </script>'
end

#input_comboBox_extjs(id, name, width, store, emptyText, disabled, cls) ⇒ Object



1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
# File 'lib/application.rb', line 1794

def input_comboBox_extjs(id,name,width,store,emptyText,disabled,cls)
 thestore = ''
 campos = store.split(',')
 for i in 0..campos.length-1
  if i==campos.length-1
   thestore = thestore + '["'+campos[i].to_s+'"]'
  else
   thestore = thestore + '["'+campos[i].to_s+'"],'
  end
 end
 if store.index(emptyText) != nil
  thevalue = 'value: "'+emptyText.to_s+'"'
 else
  thevalue = 'emptyText: "'+emptyText.to_s+'"'
 end
 return '<div id="k'+id.to_s+'"></div>
          <script>
          var '+id.to_s+'store = new Ext.data.SimpleStore({
                                                           fields: [ "'+name.to_s+'" ],
                                                           data : [ '+thestore.to_s+' ]
                                                         });
          var '+name.to_s+' = new Ext.form.ComboBox({
                                  id: "'+id.to_s+'",
                                  name: "'+name.to_s+'",
                                  store: '+id.to_s+'store,
                                  width: '+width.to_s+',
                                  displayField: "'+name.to_s+'",
                                  typeAhead: true,
                                  mode: "local",
                                  triggerAction: "all",
                                  '+thevalue.to_s+',
                                  disabled: '+disabled.to_s+',
                                  cls: "'+cls.to_s+'"
                                 });
          '+name.to_s+'.render("k'+id.to_s+'");
         </script>'
end

#input_combobox_lv(id, name, range, readonly, disabled, alt, tabindex) ⇒ Object



1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
# File 'lib/application.rb', line 1134

def input_combobox_lv(id,name,range,readonly,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 texto = '<select id="'+id.to_s+'" name="'+name.to_s+'" ' + readonly.to_s + ' ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">'
 itemsRange = Array.new()
 itemsRange = range.split(',')
 tamanoitemsRange = itemsRange.length - 1
 for i in 0..tamanoitemsRange
   if i==0
    texto = texto + '<option selected value="' + itemsRange[i].to_s + '">' + itemsRange[i].to_s + '</option>'
   else 
    texto = texto + '<option value="' + itemsRange[i].to_s + '">' + itemsRange[i].to_s + '</option>'
   end
 end
 texto = texto + '</select>'
 return texto
end

#input_comboBoxFilter_extjs(id, name, width, storename, storedata, emptyText, disabled, cls, servername, displayField) ⇒ Object



1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
# File 'lib/application.rb', line 1831

def input_comboBoxFilter_extjs(id,name,width,storename,storedata,emptyText,disabled,cls,servername,displayField)
 campos = storename.split(',')
 thestorefields = '["'+campos[0].to_s+'","'+campos[1].to_s+'"]'
 theserver = ''
 if servername.to_s=='' and displayField.to_s==''
  thevalueField = campos[0].to_s
  thedisplayField = campos[1].to_s  
 else
  thevalueField = campos[1].to_s
  thedisplayField = campos[1].to_s
  theserver = 'Ext.get("k'+id.to_s+'").on("click", function(){
                              '+name.to_s+'.store.clearFilter();
                              '+name.to_s+'.store.filter("'+displayField.to_s+'",'+servername.to_s+'.getValue(),true);
                              '+name.to_s+'.setValue('+name.to_s+'.store.getAt(0).data.'+id.to_s+'store);
                              '+name.to_s+'.render("k'+id.to_s+'");
                            } );'
 end
 thestoredata = ''
 registros = storedata.split('|')
 for j in 0..registros.length-1
  campos = registros[j].to_s.split(',')
  if j==registros.length-1
   thestoredata = thestoredata + '["'+campos[0].to_s+'","'+campos[1].to_s+'"]'
  else
   thestoredata = thestoredata + '["'+campos[0].to_s+'","'+campos[1].to_s+'"], '
  end
 end
 return '<div id="k'+id.to_s+'"></div>
          <script>
          var '+id.to_s+'store = new Ext.data.SimpleStore({
                                                           fields: '+thestorefields.to_s+',
                                                           data : [ '+thestoredata.to_s+' ]
                                                         });
          var '+name.to_s+' = new Ext.form.ComboBox({
                                  id: "'+id.to_s+'",
                                  name: "'+name.to_s+'",
                                  store: '+id.to_s+'store,
                                  width: '+width.to_s+',
                                  valueField: "'+thevalueField.to_s+'",
                                  displayField: "'+thedisplayField.to_s+'",
                                  typeAhead: true,
                                  mode: "local",
                                  triggerAction: "all",
                                  disabled: '+disabled.to_s+',
                                  cls: "'+cls.to_s+'",
                                  selectOnFocus:true
                                 });
          '+theserver.to_s+'
          '+name.to_s+'.render("k'+id.to_s+'");
          '+name.to_s+'.setValue("'+emptyText.to_s+'");
         </script>'
end

#input_comboBoxFilterAjax_extjs(id, name, width, pageserver, emptyText, disabled, cls, servername) ⇒ Object



1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
# File 'lib/application.rb', line 1883

def input_comboBoxFilterAjax_extjs(id,name,width,pageserver,emptyText,disabled,cls,servername)
 if emptyText.to_s != ''
  thevalue = 'value: "'+emptyText.to_s+'"'
 else
  thevalue = 'emptyText: "'+emptyText.to_s+'"'
 end
 return '<div id="k'+id.to_s+'"></div>
          <script>
          
          Ext.Ajax.request({
                          url : "'+$kamila_site+'/'+pageserver+'",
                          method: "POST",
                          waitMsg: "Cargando...",
                          success: function ( resultado, request ) { 
                              var datos = resultado.responseText;
                              var Registros = datos.split(",");
                              if (Registros.length-1==0)
                              {
                               Ext.MessageBox.alert("Error", "Inesperado, posible error en la vista o modelo");
                               return;
                              }
                              var j=0;
                              while (j<Registros.length)
                              {
                              }
                             }
                          });

          
          
          var '+id.to_s+'Connection = new Ext.data.Connection();
          var '+id.to_s+'store = new Ext.data.SimpleStore({
                                                           fields: [ "'+name.to_s+'" ],
                                                           data : [ '+thestore.to_s+' ]
                                                         });
          var '+name.to_s+' = new Ext.form.ComboBox({
                                  id: "'+id.to_s+'",
                                  name: "'+name.to_s+'",
                                  store: '+id.to_s+'store,
                                  width: '+width.to_s+',
                                  displayField: "'+name.to_s+'",
                                  typeAhead: true,
                                  mode: "local",
                                  triggerAction: "all",
                                  '+thevalue.to_s+',
                                  disabled: '+disabled.to_s+',
                                  cls: "'+cls.to_s+'"
                                 });
          '+name.to_s+'.render("k'+id.to_s+'");
         </script>'
end

#input_comboFilterAjax_rialto(name, top, left, width, items, selWithText, parent, enable, heightItem, pageserver, namesparams, nameCombo) ⇒ Object



3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
# File 'lib/application.rb', line 3384

def input_comboFilterAjax_rialto(name,top,left,width,items,selWithText,parent,enable,heightItem,pageserver,namesparams,nameCombo)
 parametros = namesparams.split(',')
 theparameters = '"'
 for i in 0..parametros.length-1
  if i==parametros.length-1
   theparameters = theparameters + parametros[i].to_s + '="+'+parametros[i].to_s+'.getValue()'
  else
   theparameters = theparameters + parametros[i].to_s + '="+'+parametros[i].to_s+'.getValue()+"&'
  end
 end
 itemsvalue = Array.new
 itemsvalue = items.split(",")
 theitems = ''
 for i in 0..itemsvalue.length-1
  theitems = theitems + name + '.addItem("'+itemsvalue[i].to_s+'","'+itemsvalue[i].to_s+'"); '
 end
 if selWithText == ''
  theitems = theitems + name + '.selFirst();'
 else
  theitems = theitems + name + '.selWithText("'+selWithText+'"); '
 end
 theitems = theitems + name + '.onclick = function()
            { '+ name + '.getSelText();
             //Ajax para los datos
             '+name+'Requerimiento();
            }'
 return '<div id="'+parent+'"></div>
        <script>
         function '+name+'Repuesta(response)
         { 
          var j=0;
          datos = response.responseText;
          Registros = datos.split(",");
          '+nameCombo+'.clearData();
          while (j<Registros.length)
          {
           '+nameCombo+'.addItem(Registros[j],Registros[j]);
           j++;
          }
          '+nameCombo+'.selFirst();
         }
         function '+name+'Requerimiento()
         {
          var '+name+'ajaxReq = new rialto.io.AjaxRequest({
              url:"'+$kamila_site+'/'+pageserver+'",
              method: "post",
              withWaitWindow:true,  
              callBackObjectOnSuccess:this,
              onSuccess: '+name+'Repuesta,
              onFailure: function(){ alert("Error Ajax conexion"); }
             });
           '+name+'ajaxReq.load('+theparameters.to_s+');
         }
         var '+name+' = new rialto.widget.Combo("","'+name+'",'+top+','+left+','+width+','+parent+',{suggest:true,enable:'+enable+',heightItem:'+heightItem+'});
         '+theitems+'
        </script>'
end

#input_datefield_extjs(id, name, value, readonly, blankText, invalidText, type, vtype, disabled, dateField) ⇒ Object



1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
# File 'lib/application.rb', line 1510

def input_datefield_extjs(id,name,value,readonly,blankText,disabled,invalidText)
 return '<span id="k' + id.to_s + '"></span>
       <script>
        var '+name.to_s+' = new Ext.form.DateField({
         name: "' + name.to_s + '",
         id: "' + id.to_s + '",
         value: "' + value.to_s + '",
         readOnly: ' + readonly.to_s + ',
         blankText: "' + blankText.to_s + '",
         disabled: '+disabled.to_s+',
         invalidText: "' + invalidText.to_s + '"
        });
        '+name.to_s+'.render("k'+id.to_s+'");
       </script>'
end

#input_datefield_MinMax_extjs(id, name, value, readonly, blankText, disabled, invalidText, minValue, maxValue) ⇒ Object

Operacion y Metodo realizado por Jose Valecillos: [email protected]



1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
# File 'lib/application.rb', line 1493

def input_datefield_MinMax_extjs(id,name,value,readonly,blankText,disabled,invalidText,minValue, maxValue)
  return '<span id="k' + id.to_s + '"></span>
       <script>
        var '+name.to_s+' = new Ext.form.DateField({
         name: "' + name.to_s + '",
         id: "' + id.to_s + '",
         value: "' + value.to_s + '",
         readOnly: ' + readonly.to_s + ',
         blankText: "' + blankText.to_s + '",
         disabled: '+disabled.to_s+',
         invalidText: "' + invalidText.to_s + '",
         minValue: "' + minValue.to_s + '",
         maxValue: "' + maxValue.to_s + '"
        });
        '+name.to_s+'.render("k'+id.to_s+'");
       </script>'
end

#input_emailField_extjs(id, name, width, allowBlank, value, disabled, cls) ⇒ Object



1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
# File 'lib/application.rb', line 1990

def input_emailField_extjs(id,name,width,allowBlank,value,disabled,cls)
 return '<div id="k'+id.to_s+'"></div>
          <script>
          var '+name.to_s+' = new Ext.form.TextField({
                                  id: "'+id.to_s+'",
                                  name: "'+name.to_s+'",
                                  vtype: "email",
                                  width: '+width.to_s+',
                                  allowBlank: '+allowBlank.to_s+',
                                  value: "'+value.to_s+'",
                                  disabled: '+disabled.to_s+',
                                  cls: "'+cls.to_s+'"
                                 });
          '+name.to_s+'.render("k'+id.to_s+'");
         </script>'
end

#input_exclusion_lv(range, partial, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object



1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
# File 'lib/application.rb', line 1215

def input_exclusion_lv(range,partial,type,id,name,value,readonly,size,maxlength,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 itemsRange = Array.new()
 itemsRange = range.split(',')
 jsRange = '["'
 if range=='A..9'
  jsRange = jsRange.to_s + 'A","B","C","D","E","F","G","H","I","J","K","L","M","N","Ñ","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9' + '"]'
 else
  if range=='A..Z'
   jsRange = jsRange.to_s + 'A","B","C","D","E","F","G","H","I","J","K","L","M","N","Ñ","O","P","Q","R","S","T","U","V","W","X","Y","Z' + '"]'
  else
   if range=='a..9'
    jsRange = jsRange.to_s + 'a","b","c","d","e","f","g","h","i","j","k","l","m","n","ñ","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9' + '"]'
   else
    if range=='a..z'
     jsRange = jsRange.to_s + 'a","b","c","d","e","f","g","h","i","j","k","l","m","n","ñ","o","p","q","r","s","t","u","v","w","x","y","z' + '"]'
    else
     if range=='0..9'
      jsRange = jsRange.to_s + '0","1","2","3","4","5","6","7","8","9' + '"]'
     else
      tamanoitemsRange = itemsRange.length - 1
      for i in 0..tamanoitemsRange
       if i<tamanoitemsRange
        jsRange = jsRange.to_s + itemsRange[i].to_s + '","'
       else
        jsRange = jsRange.to_s + itemsRange[i].to_s + '"]'
       end
      end
     end
    end
   end
  end
 end
 return '<input type="' + type.to_s + '" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           '+id.to_s+'.add(Validate.Exclusion, { within: ' + jsRange.to_s + ', partialMatch: ' + partial.to_s + ' });
          </script>'
end

#input_file_extjs(id, name, width, allowBlank, value, disabled, cls) ⇒ Object



1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
# File 'lib/application.rb', line 1596

def input_file_extjs(id,name,width,allowBlank,value,disabled,cls)
 return '<div id="k'+id.to_s+'"></div>
           <script>
           var '+name.to_s+' = new Ext.form.FileUploadField({
                                   id: "'+id.to_s+'",
                                   name: "'+name.to_s+'",
                                   renderTo: "k'+id.to_s+'",
                                   width: '+width.to_s+',
                                   allowBlank: '+allowBlank.to_s+',
                                   value: "'+value.to_s+'",
                                   disabled: '+disabled.to_s+',
                                   cls: "'+cls.to_s+'"
                                  });
          </script>'
end

#input_file_presence_lv(id, name, value, readonly, disabled, alt, tabindex, css) ⇒ Object



1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
# File 'lib/application.rb', line 1000

def input_file_presence_lv(id,name,value,readonly,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 return '<input id="'+id.to_s+'" type="file" name="'+name.to_s+'" value="'+value.to_s + '" ' +  readonly.to_s + '  ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '" >
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
          </script>'
end

#input_hidden(id, name, value) ⇒ Object



770
771
772
# File 'lib/application.rb', line 770

def input_hidden(id,name,value)
 return '<input type="hidden" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'">'
end

#input_hidden_extjs(id, name, value) ⇒ Object



1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
# File 'lib/application.rb', line 1481

def input_hidden_extjs(id,name,value)
 return '<span id="k' + id.to_s + '"></span>
       <script>
        var '+name.to_s+' = new Ext.form.Hidden({
         name: "' + name.to_s + '",
         id: "' + id.to_s + '",
         value: "' + value.to_s + '"
        });
        '+name.to_s+'.render("k'+id.to_s+'");
       </script>'
end

#input_htmlEditor_extjs(id, name, value, width, height, allowBlank, disabled, cls) ⇒ Object



2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
# File 'lib/application.rb', line 2006

def input_htmlEditor_extjs(id,name,value,width,height,allowBlank,disabled,cls)
 return '<div id="k'+id.to_s+'"></div>
          <script>
          var '+name.to_s+' = new Ext.form.HtmlEditor({
                                  id: "'+id.to_s+'",
                                  name: "'+name.to_s+'",
                                  value: "'+value.to_s+'",
                                  width: '+width.to_s+',
                                  height: '+height.to_s+',
                                  allowBlank: '+allowBlank.to_s+',
                                  disabled: '+disabled.to_s+',
                                  cls: "'+cls.to_s+'",
                                  layout: "fit"
                                 });
          '+name.to_s+'.render("k'+id.to_s+'");
         </script>'
end

#input_inclusion_lv(range, partial, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object



1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
# File 'lib/application.rb', line 1186

def input_inclusion_lv(range,partial,type,id,name,value,readonly,size,maxlength,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 itemsRange = Array.new()
 itemsRange = range.split(',')
 tamanoitemsRange = itemsRange.length - 1
 jsRange = '["'
 for i in 0..tamanoitemsRange
  if i<tamanoitemsRange
   jsRange = jsRange.to_s + itemsRange[i].to_s + '","'
  else
   jsRange = jsRange.to_s + itemsRange[i].to_s + '"]'
  end
 end
 return '<input type="' + type.to_s + '" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           '+id.to_s+'.add(Validate.Inclusion, { within: ' + jsRange.to_s + ', partialMatch: ' + partial.to_s + ' });
          </script>'
end

#input_length_lv(typelength, typesize, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object



1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
# File 'lib/application.rb', line 1052

def input_length_lv(typelength,typesize,type,id,name,value,readonly,size,maxlength,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 return '<input type="' + type.to_s + '" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           '+id.to_s+'.add(Validate.Length, { ' + typelength.to_s + ': ' + typesize.to_s + ' });
          </script>'
end

#input_numberField_extjs(id, name, inputType, width, allowBlank, value, disabled, cls) ⇒ Object



1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
# File 'lib/application.rb', line 1645

def input_numberField_extjs(id,name,inputType,width,allowBlank,value,disabled,cls)
 if inputType.upcase=='INTEGER'
  return '<div id="k'+id.to_s+'"></div>
          <script>
           var '+name.to_s+' = new Ext.form.NumberField({
                                   id: "'+id.to_s+'",
                                   name: "'+name.to_s+'",
                                   width: '+width.to_s+',
                                   allowDecimals: false,
                                   allowBlank: '+allowBlank.to_s+',
                                   value: "'+value.to_s+'",
                                   disabled: '+disabled.to_s+',
                                   cls: "'+cls.to_s+'"
                                  });
           '+name.to_s+'.render("k'+id.to_s+'");   
          </script>'
 else
  return '<div id="k'+id.to_s+'"></div>
           <script>
           var '+name.to_s+' = new Ext.form.NumberField({
                                   id: "'+id.to_s+'",
                                   name: "'+name.to_s+'",
                                   width: '+width.to_s+',
                                   allowDecimals: true,
                                   allowBlank: '+allowBlank.to_s+',
                                   value: "'+value.to_s+'",
                                   disabled: '+disabled.to_s+',
                                   cls: "'+cls.to_s+'"
                                  });
           '+name.to_s+'.render("k'+id.to_s+'");
          </script>'
 end
end

#input_numericality_lv(typeinteger, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object



1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
# File 'lib/application.rb', line 1034

def input_numericality_lv(typeinteger,type,id,name,value,readonly,size,maxlength,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 return '<input type="' + type.to_s + '" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           '+id.to_s+'.add(Validate.Numericality, { onlyInteger: ' + typeinteger.to_s + ' });
          </script>'
end

#input_radio_button_lv(id, name, value, readonly, disabled, alt, tabindex) ⇒ Object



1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
# File 'lib/application.rb', line 1106

def input_radio_button_lv(id,name,value,readonly,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 return '<input type="radio" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">'+value.to_s
end

#input_radioGroup_extjs(id, name, columns, items, disabled, cls) ⇒ Object

#NO FUNCIONA, acceder las propiedades al arreglo items, para cambiarlas

#/*if (rg.getXType()=="radiogroup")
#{
# alert("Es Radio Group");
# var item0 = rg.items[0];
# alert(rg.items[0].checked); // ESTO NO FUNCIONA hasta la version Extjs 2.2
#}*/
def input_radioGroup_extjs(id,name,columns,items,disabled,cls)
 theitems = ''
 registros = items.split('|')
 for i in 0..registros.length-1
  campos = registros[i].split(',')
  if i==registros.length-1
   theitems = theitems + '{boxLabel: "'+campos[0].to_s+'", name:  "'+name.to_s+'", inputValue: "'+campos[1].to_s+'", checked: '+campos[2].to_s+'}'
  else
   theitems = theitems + '{boxLabel: "'+campos[0].to_s+'", name:  "'+name.to_s+'", inputValue: "'+campos[1].to_s+'", checked: '+campos[2].to_s+'}, '
  end
 end
 return '<div id="k'+id.to_s+'"></div>
          <script>
          var '+name.to_s+' = new Ext.form.RadioGroup({
                                  id: "'+id.to_s+'",
                                  name: "'+name.to_s+'",
                                  columns: ['+columns.to_s+'],
                                  items: [ '+theitems.to_s+' ],
                                  disabled: '+disabled.to_s+',
                                  cls: "'+cls.to_s+'"
                                 });
          '+name.to_s+'.render("k'+id.to_s+'");
         </script>'
end


1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
# File 'lib/application.rb', line 1754

def input_radioGroup_extjs(id,name,columns,items,disabled,cls)
 theRadio = ''
 theRadio0 = ''
 xy = Array.new
 xy = columns.split(",")
 registros = Array.new
 registros = items.split('|')
 theRadio0 = theRadio0+name.to_s+' = new Ext.form.Hidden(); '
 for i in 0..registros.length-1
  campos = registros[i].split(',')
  theitems = 'boxLabel: "'+campos[0].to_s+'", name:  "'+name.to_s+'", inputValue: "'+campos[1].to_s+'", checked: '+campos[2].to_s+','
  if campos[2].to_s=='true'
   theRadio0 = theRadio0+name.to_s+'.setValue("'+campos[1].to_s+'"); '
   theRadio0 = theRadio0+name.to_s+'.render("k'+id.to_s+'"); ' 
  end 
  theRadio = theRadio+name.to_s+i.to_s+' = new Ext.form.Radio({
                                            id: "'+id.to_s+i.to_s+'",
                                            name: "'+name.to_s+'",
                                            '+theitems+'
                                            disabled: '+disabled.to_s+',
                                            cls: "'+cls.to_s+'"
                                           }); '
  theRadio = theRadio+name.to_s+i.to_s+'.setSize('+xy[0].to_s+','+xy[1].to_s+'); '
  #theRadio = theRadio+name.to_s+i.to_s+'.on("click", function(){ '
  #for j in 0..registros.length-1
  # if j==i
  #  theRadio = theRadio+name.to_s+j.to_s+'.checked=true; '+name.to_s+'.setValue('+name.to_s+j.to_s+'.getValue()); alert('+name.to_s+'.getValue()); '
  # else
  #  theRadio = theRadio+name.to_s+j.to_s+'.checked=false; ' 
  # end
  #end
  #theRadio = theRadio+' }); '
  theRadio = theRadio+name.to_s+i.to_s+'.render("k'+id.to_s+'"); '
 end
 return '<div id="k'+id.to_s+'"></div>
          <script>
          '+theRadio0+'
          '+theRadio+'
         </script>'
end

#input_reset(id, name, value, css) ⇒ Object



767
768
769
# File 'lib/application.rb', line 767

def input_reset(id,name,value,css)
 return '<input type="reset" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" class="' + css.to_s + '" >'
end

#input_reset_extjs(id, name, value, css) ⇒ Object



1412
1413
1414
# File 'lib/application.rb', line 1412

def input_reset_extjs(id,name,value,css)
 return '<input type="reset" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" class="' + css.to_s + '" >'
end

#input_reset_lv(id, name, value, css) ⇒ Object

Funciones usando Live Validation



774
775
776
# File 'lib/application.rb', line 774

def input_reset_lv(id,name,value,css)
 return '<input type="reset" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" class="' + css.to_s + '" >'
end

#input_reset_rialto(name, top, left, text, alt, parent, options, form) ⇒ Object



3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
# File 'lib/application.rb', line 3235

def input_reset_rialto(name,top,left,text,alt,parent,options,form)
 property = Array.new
 property = options.split(",")
 if parent=='document.body' or parent==''
  parent='document.body'
  return '<script>
            var '+name.to_s+' = new rialto.widget.Button('+top.to_s+','+left.to_s+',"'+text.to_s+'","'+alt.to_s+'",'+parent.to_s+',{adaptToText:'+property[0].to_s+',widthMin:'+property[1].to_s+'});
            '+name.to_s+'.onclick= function () { '+form.to_s+'.reset(); return false; }
           </script>'
 else
  return '<div id="'+parent.to_s+'"></div>
            <script>
            var '+parent.to_s+'=document.getElementById("'+parent.to_s+'");
            var '+name.to_s+' = new rialto.widget.Button('+top.to_s+','+left.to_s+',"'+text.to_s+'","'+alt.to_s+'",'+parent.to_s+',{adaptToText:'+property[0].to_s+',widthMin:'+property[1].to_s+'});
            '+name.to_s+'.onclick= function () { '+form.to_s+'.reset(); return false; }
           </script>'
 end
end

#input_submit(id, name, value, css) ⇒ Object



764
765
766
# File 'lib/application.rb', line 764

def input_submit(id,name,value,css)
 return '<input type="submit" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" class="' + css.to_s + '" >'
end

#input_submit_extjs(id, name, value, css, form, fieldsHidden, fieldNames, messageError) ⇒ Object



1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
# File 'lib/application.rb', line 1343

def input_submit_extjs(id,name,value,css,form,fieldsHidden,js)
 registros = Array.new
 campos = Array.new
 theitems = ''
 registros = fieldsHidden.split('|')
 for i in 0..registros.length-1
  campos = registros[i].split(',')
  theitems = theitems.to_s + form.to_s + '.' + campos[0].to_s+'.value="'+campos[1].to_s+'";'
 end
 return '<script>
         function '+id.to_s+js.to_s+'
         {
         '+theitems+' if ('+js.to_s+') { return true; } else { return false; }; 
         }
         </script>
         <input type="submit" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" class="' + css.to_s + '" onclick="return '+id.to_s+js.to_s+'">'
end

#input_submit_lv(id, name, value, css, form, fieldsHidden, ids, messageError) ⇒ Object



777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
# File 'lib/application.rb', line 777

def input_submit_lv(id,name,value,css,form,fieldsHidden)
 registros = Array.new
 campos = Array.new
 theitems = ''
 registros = fieldsHidden.split('|')
 for i in 0..registros.length-1
  campos = registros[i].split(',')
  theitems = theitems.to_s + form.to_s + '.' + campos[0].to_s+'.value="'+campos[1].to_s+'";'
 end
 return '<script>
          function '+id.to_s+'Click()
          {
          '+theitems+'
          }
         </script>
         <input type="submit" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" class="' + css.to_s + '" onclick="javascript: { '+id.to_s+'Click() }">'
end

#input_submit_rialto(name, top, left, text, alt, parent, options, form, fieldsHidden, fieldsName, messageError) ⇒ Object



3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
# File 'lib/application.rb', line 3253

def input_submit_rialto(name,top,left,text,alt,parent,options,form,fieldsHidden,rialtoMassValidate)
 registros = Array.new
 campos = Array.new
 theitems = ''
 registros = fieldsHidden.split('|')
 for i in 0..registros.length-1
  campos = registros[i].split(',')
  theitems = theitems.to_s + form.to_s + '.' + campos[0].to_s+'.value="'+campos[1].to_s+'";'
 end
 property = Array.new
 property = options.split(",")
 if parent=='document.body' or parent==''
  parent='document.body'
  return '<script>
            var '+name.to_s+' = new rialto.widget.Button('+top.to_s+','+left.to_s+',"'+text.to_s+'","'+alt.to_s+'",'+parent.to_s+',{adaptToText:'+property[0].to_s+',widthMin:'+property[1].to_s+'});
            '+name.to_s+'.onclick= function () { '+theitems + ' '+rialtoMassValidate.to_s+'; }
           </script>'
 else
  return '<div id="'+parent.to_s+'"></div>
            <script>
            var '+parent.to_s+'=document.getElementById("'+parent.to_s+'");
            var '+name.to_s+' = new rialto.widget.Button('+top.to_s+','+left.to_s+',"'+text.to_s+'","'+alt.to_s+'",'+parent.to_s+',{adaptToText:'+property[0].to_s+',widthMin:'+property[1].to_s+'});
            '+name.to_s+'.onclick= function () { '+theitems +' '+rialtoMassValidate.to_s+'; }
           </script>'
 end
end

#input_text_key_validate_lv(nameform, range, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object



856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File 'lib/application.rb', line 856

def input_text_key_validate_lv(nameform,range,type,id,name,value,readonly,size,maxlength,disabled,alt,tabindex,css)
 istype = 0
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 if range=='a..z' or range=='A..Z' or range=='a..Z' or range=='A..z'
  jsRange = 'a-z A-Z'
  istype = 0
 end
 if range=='0..9'
  jsRange = '0-90-9'
  istype = 1
 end
 if range=='0.0..0.9'
  jsRange = '0-90-9'
  istype = 2
 end
 if range=='0..Z' or range=='A..9' or range=='a..9' or range=='0..z'
  jsRange = 'a-z A-Z 0-90-9'
  istype = 3
 end
 if type.upcase=='MD5'
  type = 'password'
  inputText = '<script>function '+id.to_s+'encriptar_md5(idElement) { if ('+id.to_s+'old_clave_md5!=idElement.value)  {  idElement.value = hex_md5(idElement.value );   '+id.to_s+'old_clave_md5 = idElement.value;  } }</script><input type="' + type.to_s + '" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '" onKeyDown="return '+id.to_s+'keyLock(event)" onChange="'+id.to_s+'encriptar_md5(document.'+nameform.to_s+'.'+name.to_s+');"><script>var '+id.to_s+'old_clave_md5 = document.'+nameform.to_s+'.'+name.to_s+'.value ; </script> '
 else
  inputText = '<input type="' + type.to_s + '" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '" onKeyDown="return '+id.to_s+'keyLock(event)">'
 end
 if istype==0
  return inputText + '
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           function '+id.to_s+'keyLock(e)
           {
            kc=e.keyCode?e.keyCode:e.which;
            if(kc<32 || kc==190 || kc==59) return true;
            kc=String.fromCharCode(kc);
            if(/[^' + jsRange.to_s + ']/.test(kc)) return false;
           }
          </script>'
 end
 if istype==1
  return inputText + '
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           function '+id.to_s+'keyLock(e)
           {
            kc=e.keyCode?e.keyCode:e.which;
            if (kc<32) return true;
            kc=String.fromCharCode(kc);
            if(/[^' + jsRange.to_s + ']/.test(kc)) return false;
           }
          </script>'
 end
 if istype==2
  return inputText + '
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           function '+id.to_s+'keyLock(e)
           {
            kc=e.keyCode?e.keyCode:e.which;
            if(kc<32 || (kc==190 && Ext.get("'+id.to_s+'").dom.value.indexOf(".")==-1)) return true;
            kc=String.fromCharCode(kc);
            if(/[^' + jsRange.to_s + ']/.test(kc)) return false;
           }
          </script>'
 end
 if istype==3
  return inputText + '
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           function '+id.to_s+'keyLock(e)
           {
            kc=e.keyCode?e.keyCode:e.which;
            if(kc<32 || kc==190 || kc==59) return true;
            kc=String.fromCharCode(kc);
            if(/[^' + jsRange.to_s + ']/.test(kc)) return false;
           }
          </script>'
 end 
end

#input_text_presence_lv(type, nameform, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object



947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
# File 'lib/application.rb', line 947

def input_text_presence_lv(type,nameform,id,name,value,readonly,size,maxlength,disabled,alt,tabindex,css)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 if type.to_s == 'md5'
  type = 'password'
  inputText = '<script>function '+id.to_s+'encriptar_md5(idElement) { if ('+id.to_s+'old_clave_md5!=idElement.value)  {  idElement.value = hex_md5(idElement.value );   '+id.to_s+'old_clave_md5 = idElement.value;  } }</script><input type="' + type.to_s + '" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '" onChange="'+id.to_s+'encriptar_md5(document.'+nameform.to_s+'.'+name.to_s+');"> <script>var '+id.to_s+'old_clave_md5 = document.'+nameform.to_s+'.'+name.to_s+'.value ; </script>'
 else
  inputText = '<input type="' + type.to_s + '" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">'
 end
 return inputText + '
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
          </script>'
end

#input_text_rialto(name, top, left, width, type, parent, value, options) ⇒ Object



3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
# File 'lib/application.rb', line 3167

def input_text_rialto(name,top,left,width,type,parent,value,options)
 property = Array.new
 property = options.split(",")
 if type.upcase == 'MD5'
  type='P'
  if parent=='document.body' or parent==''
   parent='document.body'
   return '<script>
            function '+name.to_s+'encriptarMd5() 
             { 
               var valorMD5 = hex_md5('+name.to_s+'.getValue());  
               '+name.to_s+'.setValue(valorMD5);
               '+name.to_s+'old_clave_md5 = '+name.to_s+'.getValue();    
             } 
             var '+parent.to_s+'=document.getElementById("'+parent.to_s+'");
             var '+name.to_s+' = new rialto.widget.Text("'+name.to_s+'",'+top.to_s+','+left.to_s+','+width.to_s+',"'+type.to_s+'",'+parent.to_s+',{initValue:"'+value.to_s+'",autoUp:'+property[0].to_s+',isRequired:'+property[1].to_s+',disable:'+property[2].to_s+',alt:"'+property[3].to_s+'",accessKey:"'+property[4].to_s+'",rows:'+property[5].to_s+',tabIndex:'+property[6].to_s+'});
             var '+name.to_s+'old_clave_md5 = '+name.to_s+'.getValue();       
             '+name.to_s+'.onblur = function () {  if ( '+name.to_s+'old_clave_md5 !='+name.to_s+'.getValue() ) { '+name.to_s+'encriptarMd5(); } }  
           </script>'
  else
   return '<div id="'+parent.to_s+'"></div>
             <script>
             function '+name.to_s+'encriptarMd5() 
             { 
               var valorMD5 = hex_md5('+name.to_s+'.getValue());  
               '+name.to_s+'.setValue(valorMD5);
               '+name.to_s+'old_clave_md5 = '+name.to_s+'.getValue();  
               '+name.to_s+'onoff_clave_md5 = false;  
             } 
             var '+parent.to_s+'=document.getElementById("'+parent.to_s+'");
             var '+name.to_s+' = new rialto.widget.Text("'+name.to_s+'",'+top.to_s+','+left.to_s+','+width.to_s+',"'+type.to_s+'",'+parent.to_s+',{initValue:"'+value.to_s+'",autoUp:'+property[0].to_s+',isRequired:'+property[1].to_s+',disable:'+property[2].to_s+',alt:"'+property[3].to_s+'",accessKey:"'+property[4].to_s+'",rows:'+property[5].to_s+',tabIndex:'+property[6].to_s+'});
             var '+name.to_s+'old_clave_md5 = '+name.to_s+'.getValue();       
             '+name.to_s+'.onblur = function () {  if ( '+name.to_s+'old_clave_md5 !='+name.to_s+'.getValue() ) { '+name.to_s+'encriptarMd5(); } }
            </script>'
  end
 else
  if parent=='document.body' or parent==''
   parent='document.body'
   return '<script>
             var '+name.to_s+' = new rialto.widget.Text("'+name.to_s+'",'+top.to_s+','+left.to_s+','+width.to_s+',"'+type.to_s+'",'+parent.to_s+',{initValue:"'+value.to_s+'",autoUp:'+property[0].to_s+',isRequired:'+property[1].to_s+',disable:'+property[2].to_s+',alt:"'+property[3].to_s+'",accessKey:"'+property[4].to_s+'",rows:'+property[5].to_s+',tabIndex:'+property[6].to_s+'});
           </script>'
  else
   return '<div id="'+parent.to_s+'"></div>
            <script>
             var '+parent.to_s+'=document.getElementById("'+parent.to_s+'");
             var '+name.to_s+' = new rialto.widget.Text("'+name.to_s+'",'+top.to_s+','+left.to_s+','+width.to_s+',"'+type.to_s+'",'+parent.to_s+',{initValue:"'+value.to_s+'",autoUp:'+property[0].to_s+',isRequired:'+property[1].to_s+',disable:'+property[2].to_s+',alt:"'+property[3].to_s+'",accessKey:"'+property[4].to_s+'",rows:'+property[5].to_s+',tabIndex:'+property[6].to_s+'});
           </script>'
  end
 end
end

#input_textArea_extjs(id, name, width, height, allowBlank, value, disabled, cls) ⇒ Object



1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
# File 'lib/application.rb', line 1611

def input_textArea_extjs(id,name,width,height,allowBlank,value,disabled,cls)
 return '<div id="k'+id.to_s+'"></div>
           <script>
           var '+name.to_s+' = new Ext.form.TextArea({
                                   id: "'+id.to_s+'",
                                   name: "'+name.to_s+'",
                                   height: '+height.to_s+',
                                   width: '+width.to_s+',
                                   allowBlank: '+allowBlank.to_s+',
                                   value: "'+value.to_s+'",
                                   disabled: '+disabled.to_s+',
                                   cls: "'+cls.to_s+'"
                                  });
           '+name.to_s+'.render("k'+id.to_s+'");
          </script>'
end

#input_textarea_key_validate_lv(range, id, name, value, readonly, disabled, alt, tabindex, css, rows, cols) ⇒ Object



970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
# File 'lib/application.rb', line 970

def input_textarea_key_validate_lv(range,id,name,value,readonly,disabled,alt,tabindex,css,rows,cols)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 if range=='a..z' or range=='A..Z' or range=='a..Z' or range=='A..z'
  jsRange = 'a-z A-Z'
 end
 if range=='0..9'
  jsRange = '0-90-9'
 end
 return '<textarea id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s + '" ' +  readonly.to_s + '  ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '" rows="' + rows.to_s + '" cols="' + cols.to_s + '" onKeyDown="return '+id.to_s+'keyLock(event)"></textarea>
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           function '+id.to_s+'keyLock(e)
           {
            kc=e.keyCode?e.keyCode:e.which;
            if(kc<32 || kc==190 || kc==59) return true;
            kc=String.fromCharCode(kc);
            if(/[^' + jsRange.to_s + ']/.test(kc)) return false;
           }
          </script>'
end

#input_textarea_presence_lv(id, name, value, readonly, disabled, alt, tabindex, css, rows, cols) ⇒ Object



1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
# File 'lib/application.rb', line 1017

def input_textarea_presence_lv(id,name,value,readonly,disabled,alt,tabindex,css,rows,cols)
 if readonly.upcase=='TRUE'
  readonly = 'readonly'
 else
  readonly = ''
 end
 if disabled.upcase=='TRUE'
  disabled = 'disabled'
 else
  disabled = ''
 end
 return '<textarea id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s + '" ' +  readonly.to_s + '  ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '" rows="' + rows.to_s + '" cols="' + cols.to_s + '"></textarea>
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
          </script>'
end

#input_textField_extjs(id, name, inputType, width, allowBlank, value, disabled, cls) ⇒ Object



1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
# File 'lib/application.rb', line 1548

def input_textField_extjs(id,name,inputType,width,allowBlank,value,disabled,cls)
 if inputType.upcase=='MD5'
  inputType='password'
  return '<div id="k'+id.to_s+'"></div>
           <script>
           function '+id.to_s+'encriptar_id_md5(idEl) 
           { 
            if ('+id.to_s+'old_clave_md5!=document.getElementById(idEl).value)  
             {  
               document.getElementById(idEl).value = hex_md5(document.getElementById(idEl).value); 
               '+id.to_s+'old_clave_md5 = document.getElementById(idEl).value;  
              } 
           }
           var '+name.to_s+' = new Ext.form.TextField({
                                   id: "'+id.to_s+'",
                                   name: "'+name.to_s+'",
                                   inputType: "'+inputType.to_s+'",
                                   width: '+width.to_s+',
                                   allowBlank: '+allowBlank.to_s+',
                                   value: "'+value.to_s+'",
                                   disabled: '+disabled.to_s+',
                                   cls: "'+cls.to_s+'"
                                  });
           '+id.to_s+'El = Ext.get("k'+id.to_s+'");
           '+id.to_s+'El.addKeyListener([10,13,32], function(){
            '+id.to_s+'encriptar_id_md5('+name.to_s+'.getId());
           });
           '+name.to_s+'.on("change", function() { '+id.to_s+'encriptar_id_md5('+name.to_s+'.getId()); });
           '+name.to_s+'.render("k'+id.to_s+'");
           var '+id.to_s+'old_clave_md5 = document.getElementById('+name.to_s+'.getId()).value;
          </script>'
 else
  return '<div id="k'+id.to_s+'"></div>
           <script>
           var '+name.to_s+' = new Ext.form.TextField({
                                   id: "'+id.to_s+'",
                                   name: "'+name.to_s+'",
                                   inputType: "'+inputType.to_s+'",
                                   width: '+width.to_s+',
                                   allowBlank: '+allowBlank.to_s+',
                                   value: "'+value.to_s+'",
                                   disabled: '+disabled.to_s+',
                                   cls: "'+cls.to_s+'"
                                  });
           '+name.to_s+'.render("k'+id.to_s+'");
          </script>'
 end
end

#input_timeField_extjs(id, name, width, minValue, maxValue, increment, allowBlank, value, disabled, cls) ⇒ Object



1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
# File 'lib/application.rb', line 1627

def input_timeField_extjs(id,name,width,minValue,maxValue,increment,allowBlank,value,disabled,cls)
 return '<div id="k'+id.to_s+'"></div>
           <script>
           var '+name.to_s+' = new Ext.form.TimeField({
                                   id: "'+id.to_s+'",
                                   name: "'+name.to_s+'",
                                   minValue: "'+minValue.to_s+'",
                                   maxValue: "'+maxValue.to_s+'",
                                   increment: '+increment.to_s+',
                                   width: '+width.to_s+',
                                   allowBlank: '+allowBlank.to_s+',
                                   value: "'+value.to_s+'",
                                   disabled: '+disabled.to_s+',
                                   cls: "'+cls.to_s+'"
                                  });
           '+name.to_s+'.render("k'+id.to_s+'");
          </script>'
end

#input_validate_email_lv(id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object



1290
1291
1292
1293
1294
1295
1296
1297
# File 'lib/application.rb', line 1290

def input_validate_email_lv(id,name,value,readonly,size,maxlength,disabled,alt,tabindex,css)
 return '<input type="text" id="'+id.to_s+'" name="'+name.to_s+'" value="'+value.to_s+'" ' + readonly.to_s + ' size="'+ size.to_s + '" maxlength="' + maxlength.to_s + '" ' + disabled.to_s + ' alt="' + alt.to_s + '" tabindex="' + tabindex.to_s + '" class="' + css.to_s + '">
          <script type="text/javascript">
           var '+id.to_s+' = new LiveValidation("'+id.to_s+'");
           '+id.to_s+'.add(Validate.Presence);
           '+id.to_s+'.add(Validate.Email);
          </script>'
end

#insert_linebreaks(top) ⇒ Object



521
522
523
524
525
526
527
528
# File 'lib/application.rb', line 521

def insert_linebreaks(top)
 br = '<br/>'
 linebreak = ''
 1.upto(top) do
  linebreak = linebreak + br
 end
 return linebreak
end

#insert_text(text) ⇒ Object



529
530
531
# File 'lib/application.rb', line 529

def insert_text(text)
 return text.to_s
end

#loadmodel(model) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/application.rb', line 102

def loadmodel(model)
 # Cargar los modelos existentes en kamila/models
 @kamila_model_exist = false
 Dir.chdir("../models/")
 archivos = Dir.glob('*')
 objUtilidades = Utilidades.new()
 @kamila_array_models = Array.new()
 if (archivos.size()-1>=0)
  j = archivos.size()-1
  for i in 0..j
   @kamila_array_models[i] = objUtilidades.getNombreArchivo(archivos[i].to_s)
   if @kamila_array_models[i] == model+".rb"
    salida=false
    existeBDD = false
    File.open($kamila_home+"/models/"+model+".rb", "r") do |infile|
     while (line = infile.gets and salida==false and $kamila_MVCPlusPlus)
       if line.index("puts")!=nil or line.index("print")!=nil or line.index("render")!=nil or line.index("insert_text")!=nil
        salida=true
       end
       if line.index("ActiveRecord::Base.establish_connection")!=nil
        existeBDD = true
       end
     end
    end
    if salida==true
     $kamila_icon_mensaje = "Ext.MessageBox.ERROR"
     $kamila_titulo = "Error"
     $kamila_mensaje = $kamila_defaultMessages["message009"] + " " + $kamila_home+"/models/"+model+".rb" + " " + $kamila_defaultMessages["message010"]
     #$kamila_mensaje = "#{ e } (#{ e.class })!"
     $kamila_linkto = $kamila_site
     $kamila_cgi.redirect($kamila_site+"/public/message/message.rhtml")
    else
     @kamila_model_exist = true
     if existeBDD == false
      require "active_record"
      ActiveRecord::Base.establish_connection(
       :adapter  => $kamila_DatabaseAdapter,
       :host     => $kamila_DatabaseHost,
       :port     => $kamila_DatabasePort.to_i,
       :database => $kamila_DatabaseName,
       :username => $kamila_DatabaseUsername,
       :password => $kamila_DatabasePassword
      )
     end
     require model
    end
   end
  end
 end
 return @kamila_model_exist
end

#render(page) ⇒ Object



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/application.rb', line 153

def render(page)
 if page == "" or page == nil
  page = "index"
 end
 verifyviews(page)
 if @kamila_views_dir_exist and @kamila_views_file_exist
  ##############################################################################################
  # Antes era con redireccionamiento basado en el .htaccess                                    #
  # $kamila_cgi.redirect($kamila_site+"/views/"+$kamila_controller+"/"+page+".rhtml")          #
  # Solucion: http://www.hiveminds.co.uk/node/3189                                             #
  ##############################################################################################
  $kamila_view = $kamila_home+"/views/"+$kamila_controller+"/"+page+".rhtml"
  input = File.read($kamila_view)

  ##############################################################################################
  # Explicacion del metodo binding() en ruby                                                   #
  # http://onestepback.org/index.cgi/Tech/Ruby/RubyBindings.rdoc/style/print                   #
  ##############################################################################################
  # usando ERB con eruby
  #begin 
  # eruby = ERB.new(input)
  # eruby.result(get_binding())
  # eruby.run(get_binding())
  #rescue
  # $kamila_icon_mensaje = "Ext.MessageBox.ERROR"
  # $kamila_titulo = "Error"
  # $kamila_mensaje = $!
  # #$kamila_mensaje = "#{ e } (#{ e.class })!"
  # $kamila_linkto = $kamila_site
  # $kamila_cgi.redirect($kamila_site+"/public/message/message.rhtml")
  #end 

  ##############################################################################################
  # Usando erubis: http://www.kuwata-lab.com/erubis/ más rápido que ERB                        #
  ##############################################################################################
  #eruby = Erubis::Eruby.new(input)
  #eruby.result(get_binding())

  # Otra Forma
  
  begin
   if $kamila_MVCPlusPlus
    if input.index("loadmodel")==nil and 
      input.index(".find")==nil and 
      input.index(".save")==nil and 
      input.index(".create")==nil and 
      input.index(".delete")==nil and 
      input.index("by_sql")==nil and
      input.index("<html>")==nil and
      input.index("</html>")==nil and
      input.index("<title>")==nil and
      input.index("</title>")==nil and
      input.index("<head>")==nil and
      input.index("</head>")==nil and
      input.index("<script>")==nil and
      input.index("</script>")==nil and
      input.index("<body>")==nil and
      input.index("</body>")==nil and
      input.index("<input>")==nil and
      input.index("<textarea>")==nil and
      input.index("</textarea>")==nil and
      input.index("<select>")==nil and
      input.index("</select>")==nil and
      input.index("<link>")==nil and
      input.index("<frame>")==nil and
      input.index("</frame>")==nil and
      input.index("<frameset>")==nil and
      input.index("</frameset>")==nil and
      input.index("<iframe>")==nil and
      input.index("</iframe>")==nil and
      input.index("<table>")==nil and
      input.index("</table>")==nil and
      input.index("<tr>")==nil and
      input.index("</tr>")==nil and
      input.index("<td>")==nil and
      input.index("</td>")==nil and
      input.index("<div>")==nil and
      input.index("</div>")==nil and
      input.index("<span>")==nil and
      input.index("</span>")==nil and
      input.index("<p>")==nil and
      input.index("</p>")==nil and
      input.index("<link>")==nil and
      input.index("<a>")==nil and
      input.index("</a>")==nil and
      input.index("<img>")==nil and
      input.index("<font>")==nil and
      input.index("</font>")==nil and
      input.index("<center>")==nil and
      input.index("</center>")==nil
     ejecutarEval = true
    else 
     ejecutarEval = false
    end
   else
    ejecutarEval = true 
   end  
   if ejecutarEval
    eruby = Erubis::Eruby.new
    src = eruby.convert(input)
    begin
     print eval(src)
    #rescue SyntaxError
    rescue Exception => e
     $kamila_icon_mensaje = "Ext.MessageBox.ERROR"
     $kamila_titulo = "Error"
     if $kamila_defaultMessagesType.upcase=="RUBY"
      $kamila_mensaje = $!.to_s
      if $kamila_mensaje != ""
       $kamila_mensaje = $kamila_mensaje.gsub(/</,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/>/,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/"/,"'")
      else
      #$kamila_mensaje = $kamila_defaultMessages["message018"] + " " + $kamila_view
      end
     else 
      $kamila_mensaje = $kamila_defaultMessages["message018"] + " " + $kamila_view
     end
     $kamila_linkto = $kamila_site
     $kamila_cgi.redirect($kamila_site+"/public/message/message.rhtml")
    end
   else
    $kamila_icon_mensaje = "Ext.MessageBox.ERROR"
    $kamila_titulo = "Error"
    if $kamila_defaultMessagesType.upcase=="RUBY"
      $kamila_mensaje = $!.to_s
      if $kamila_mensaje != ""
       $kamila_mensaje = $kamila_mensaje.gsub(/</,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/>/,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/"/,"'")
      else
       $kamila_mensaje = $kamila_defaultMessages["message009"] + " " + $kamila_view + " " + $kamila_defaultMessages["message011"]
      end
    else
     $kamila_mensaje = $kamila_defaultMessages["message009"] + " " + $kamila_view + " " + $kamila_defaultMessages["message011"]
    end 
    $kamila_linkto = $kamila_site
    $kamila_cgi.redirect($kamila_site+"/public/message/message.rhtml")
   end
  rescue 
   $kamila_icon_mensaje = "Ext.MessageBox.ERROR"
   $kamila_titulo = "Error"
   if $kamila_defaultMessagesType.upcase=="RUBY"
      $kamila_mensaje = $!.to_s
      if $kamila_mensaje != ""
       $kamila_mensaje = $kamila_mensaje.gsub(/</,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/>/,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/"/,"'")
      else
       $kamila_mensaje = $kamila_defaultMessages["message012"] + " " + $kamila_view
      end
   else
    $kamila_mensaje = $kamila_defaultMessages["message012"] + " " + $kamila_view
   end
   $kamila_linkto = $kamila_site
   $kamila_cgi.redirect($kamila_site+"/public/message/message.rhtml")
  end

 else
  if @kamila_views_dir_exist == false
   $kamila_icon_mensaje = "Ext.MessageBox.ERROR"
   $kamila_titulo = "Error"
   if $kamila_defaultMessagesType.upcase=="RUBY"
      $kamila_mensaje = $!.to_s
      if $kamila_mensaje != ""
       $kamila_mensaje = $kamila_mensaje.gsub(/</,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/>/,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/"/,"'")
      else
       $kamila_mensaje = $kamila_defaultMessages["message019"] + " " + $kamila_controller
      end
   else
    $kamila_mensaje = $kamila_defaultMessages["message019"] + " " + $kamila_controller
   end
   $kamila_linkto = $kamila_site
   $kamila_cgi.redirect($kamila_site+"/public/message/message.rhtml")
  else
   if @kamila_views_file_exist == false
    $kamila_icon_mensaje = "Ext.MessageBox.ERROR"
    $kamila_titulo = "Error"
    if $kamila_defaultMessagesType.upcase=="RUBY"
      $kamila_mensaje = $!.to_s
      if $kamila_mensaje != ""
       $kamila_mensaje = $kamila_mensaje.gsub(/</,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/>/,"")
       $kamila_mensaje = $kamila_mensaje.gsub(/"/,"'")
      else
       $kamila_mensaje = $kamila_defaultMessages["message013"] + " " + page.to_s + ".rhtml"
      end
    else
     $kamila_mensaje = $kamila_defaultMessages["message013"] + " " + page.to_s + ".rhtml"
    end
    $kamila_linkto = $kamila_site
    $kamila_cgi.redirect($kamila_site+"/public/message/message.rhtml")
   end
  end
 end
end

#select_focus(form, name) ⇒ Object



755
756
757
758
759
760
# File 'lib/application.rb', line 755

def select_focus(form,name)
return '<script language="JavaScript">
  document.' + form.to_s + '.' + name.to_s + '.select();
  document.' + form.to_s + '.' + name.to_s + '.focus();
 </script> '
end

#setValueSession(variable, value) ⇒ Object



3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
# File 'lib/application.rb', line 3940

def setValueSession(variable,value)
 prefix = String.new()
 prefix = Digest::MD5.hexdigest($kamila_remoteaddr.to_s)
 #prefix = $kamila_remoteaddr.to_s
 db = PStore.new("/tmp/kamila_session."+prefix.to_s) 
 db.transaction do
  db[prefix] = Time.now
  db[variable.to_s] = value.to_s
  db.commit
 end
end

#show_Message_extjs(icon, title, message, linkto) ⇒ Object



2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
# File 'lib/application.rb', line 2023

def show_Message_extjs(icon,title,message)
 message = message.to_s.gsub(/</,"")
 message = message.gsub(/>/,"")
 message = message.gsub(/"/,"")
 message = message.gsub(/'/,"")
 message = message.gsub(/"/,"")
 message = message.gsub(/`/,"")
 if icon.to_s=="ERROR"
  $kamila_icon_mensaje = 'Ext.MessageBox.ERROR'
 end
 if icon.to_s=="QUESTION"
  $kamila_icon_mensaje = 'Ext.MessageBox.QUESTION'
 end
 if icon.to_s=="INFO"
  $kamila_icon_mensaje = 'Ext.MessageBox.INFO'
 end
 return '<script>
           Ext.MessageBox.show({
              title: "' + title.to_s + '",
                     msg: "' + message.to_s + '",
           	      width:400,
              buttons: Ext.MessageBox.OK,
                     icon: ' + $kamila_icon_mensaje + '
           });
         </script>'
end

#show_Message_rialto(top, left, width, height, title, message, gray, linkto) ⇒ Object

Funciones para rialto



3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
# File 'lib/application.rb', line 3127

def show_Message_rialto(top,left,width,height,title,message,gray)
 if gray.upcase=='GRAY'
  fondo = 'gray'
 else
  fondo = 'transparent'
 end
  return '<script>
           var sPopup = new rialto.widget.PopUp("popupRialto",'+top+','+left+',"'+width+'","'+height+'","'+message.to_s+'","'+title.to_s+'","'+fondo.to_s+'");
           var btn2pop = new rialto.widget.Button(30,65,"Aceptar","Aceptar",sPopup);
           btn2pop.onclick=function () { sPopup.closeWindow(); }
          </script>'
end