Class: Application
- Inherits:
-
Object
- Object
- Application
- Defined in:
- lib/application.rb
Instance Method Summary collapse
-
#callController(controller, message, link) ⇒ Object
Llamada a un controlador desde otro controlador.
- #close_body ⇒ Object
- #close_center ⇒ Object
- #close_div ⇒ Object
- #close_font ⇒ Object
- #close_form ⇒ Object
- #close_head ⇒ Object
- #close_heading(h) ⇒ Object
- #close_href ⇒ Object
- #close_html ⇒ Object
- #close_javascript ⇒ Object
- #close_li ⇒ Object
- #close_ol ⇒ Object
- #close_paragraphs ⇒ Object
- #close_span ⇒ Object
- #close_table ⇒ Object
- #close_td ⇒ Object
- #close_tr ⇒ Object
- #close_ul ⇒ Object
- #create_AjaxCancel_extjs(nameFunction, action, ids, pageserver) ⇒ Object
- #create_AjaxDelete_extjs(nameFunction, action, params, ids, pageserver) ⇒ Object
- #create_AjaxFind_extjs(nameFunction, action, params, ids, pageserver) ⇒ Object
- #create_AjaxPrint_extjs(nameFunction, action, pageserver) ⇒ Object
- #create_AjaxSave_extjs(nameFunction, action, params, pageserver) ⇒ Object
- #create_body(marginheight, marginwidth, topmargin, leftmargin, bgcolor) ⇒ Object
- #create_center ⇒ Object
- #create_ContentSlider_image(id, content, link, label1, label2, isTable) ⇒ Object
- #create_ContentSlider_text(id, content, link, label1, label2) ⇒ Object
- #create_css(css) ⇒ Object
-
#create_css_contentslider(borderline, bordercolor, width, height, ctp, btp, sctp, sbtp) ⇒ Object
Content Slider 2.4 fuente: www.dynamicdrive.com.
- #create_div(id, css, align, text) ⇒ Object
- #create_font(face, size, color, css) ⇒ Object
- #create_form(id, name, method, action, multipart) ⇒ Object
-
#create_graph_gruff(type, theme, font, fontsize, title, x_axis_label, y_axis_label, titlearray, dataarray, xlabels, xvalue, file) ⇒ Object
Funciones basadas en Gruff.
- #create_gridAjaxView_extjs(nameFunction, width, height, title, idCatalogo, ds, cm, widthcm, pageserver) ⇒ Object
- #create_gridAjaxView_rialto(top, left, width, height, nameFunction, title, nameCatalogo, nameFields, cn, widthc, typec, pageserver) ⇒ Object
- #create_gridView_extjs(nameFunction, title, idCatalogo, ids, ds, cm, widthcm, data) ⇒ Object
- #create_gridView_rialto(top, left, width, height, nameFunction, title, nameCatalogo, nameFields, cn, widthc, typec, data) ⇒ Object
- #create_head ⇒ Object
- #create_heading(h, id, texto) ⇒ Object
- #create_href(url, texto, target) ⇒ Object
-
#create_html ⇒ Object
Funciones de HTML.
- #create_img(id, src, alt, border, height, width) ⇒ Object
- #create_img_lightbox2(url, text, altura, amplitud) ⇒ Object
- #create_javascript(js, flag) ⇒ Object
- #create_javascript_extjs ⇒ Object
- #create_javascript_language_extjs(language, charset) ⇒ Object
- #create_javascript_lightbox2 ⇒ Object
- #create_javascript_livevalidation(idiom) ⇒ Object
- #create_javascript_md5 ⇒ Object
- #create_javascript_rialto(theme) ⇒ Object
- #create_javascript_validate_rangedate_extjs(funcion) ⇒ Object
- #create_javascript_view_file(left, top, width, height, file) ⇒ Object
- #create_label_extjs(id, width, text, disabled, cls, x, y) ⇒ Object
- #create_label_rialto(name, top, left, parent, text, className) ⇒ Object
- #create_li(id, css) ⇒ Object
- #create_massValidate_extjs(name, ids, mensaje) ⇒ Object
- #create_massValidate_lv(ids, messageError) ⇒ Object
- #create_massValidate_rialto(form, name, ids, mensaje) ⇒ Object
- #create_meta(httpequiv, content, charset) ⇒ Object
- #create_ol(id, css) ⇒ Object
- #create_paragraphs(id, text, css) ⇒ Object
- #create_showVideo_flash(id, width, height, url) ⇒ Object
- #create_showVideo_jwplayer(id, width, height, url) ⇒ Object
- #create_showVideo_wmv(id, width, height, url) ⇒ Object
- #create_span(text, id, css) ⇒ Object
- #create_table(cellpadding, cellspacing, border, align, width, height, background) ⇒ Object
- #create_tabpanel_extjs(id, active, collapsible, floating, width, height, plain, titles, icons, tabtips, urls, closeable, col, row) ⇒ Object
- #create_td(width, height, align, border, css) ⇒ Object
- #create_text_lightbox2(src, title, description) ⇒ Object
- #create_title(title) ⇒ Object
- #create_tr ⇒ Object
- #create_ul(id) ⇒ Object
- #deleteSession ⇒ Object
-
#format_number(number, separator) ⇒ Object
Formato a un numero.
- #getValueSession(variable) ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
-
#initSession(minutes) ⇒ Object
Manejo de Sesiones por Kamila.
- #input_button(id, name, value, css, js) ⇒ Object
-
#input_button_extjs(id, name, value, css, form, fieldNames, messageError, js) ⇒ Object
Funciones usando Extjs.
- #input_button_rialto(name, top, left, text, alt, parent, options, form, js) ⇒ Object
- #input_checkbox_lv(id, name, value, readonly, disabled, alt, tabindex) ⇒ Object
- #input_checkbox_rialto(name, top, left, parent, text, isChecked, className) ⇒ Object
-
#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; # alert(cg.items.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.split(‘,’) if i==registros.length-1 theitems = theitems + ‘“’
campos[0].to_s
‘”, inputValue: “’campos[1].to_s
‘”, name: “’campos[2].to_s
‘”, checked: ’campos[3].to_s
‘’ else theitems = theitems + ‘“’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. - #input_combo_rialto(name, top, left, width, items, selWithText, parent, enable, heightItem) ⇒ Object
- #input_comboBox_extjs(id, name, width, store, emptyText, disabled, cls) ⇒ Object
- #input_combobox_lv(id, name, range, readonly, disabled, alt, tabindex) ⇒ Object
- #input_datefield_extjs(id, name, value, readonly, blankText, invalidText, type, vtype, disabled, dateField) ⇒ Object
- #input_emailField_extjs(id, name, width, allowBlank, value, disabled, cls) ⇒ Object
- #input_exclusion_lv(range, partial, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object
- #input_file_extjs(id, name, width, allowBlank, value, disabled, cls) ⇒ Object
- #input_file_presence_lv(id, name, value, readonly, disabled, alt, tabindex, css) ⇒ Object
- #input_hidden(id, name, value) ⇒ Object
- #input_htmlEditor_extjs(id, name, value, width, height, allowBlank, disabled, cls) ⇒ Object
- #input_inclusion_lv(range, partial, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object
- #input_length_lv(typelength, typesize, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object
- #input_numberField_extjs(id, name, inputType, width, allowBlank, value, disabled, cls) ⇒ Object
- #input_numericality_lv(typeinteger, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object
- #input_radio_button_lv(id, name, value, readonly, disabled, alt, tabindex) ⇒ Object
-
#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; # alert(rg.items.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.split(‘,’) if i==registros.length-1 theitems = theitems + ‘“’
campos[0].to_s
‘”, name: “’name.to_s
‘”, inputValue: “’campos[1].to_s
‘”, checked: ’campos[2].to_s
‘’ else theitems = theitems + ‘“’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. - #input_reset(id, name, value, css) ⇒ Object
- #input_reset_extjs(id, name, value, css) ⇒ Object
-
#input_reset_lv(id, name, value, css) ⇒ Object
Funciones usando Live Validation.
- #input_reset_rialto(name, top, left, text, alt, parent, options, form) ⇒ Object
- #input_submit(id, name, value, css) ⇒ Object
- #input_submit_extjs(id, name, value, css, form, fieldsHidden, fieldNames, messageError) ⇒ Object
- #input_submit_lv(id, name, value, css, form, fieldsHidden, ids, messageError) ⇒ Object
- #input_submit_rialto(name, top, left, text, alt, parent, options, form, fieldsHidden, fieldsName, messageError) ⇒ Object
- #input_text_key_validate_lv(nameform, range, type, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object
- #input_text_presence_lv(type, nameform, id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object
- #input_text_rialto(name, top, left, width, type, parent, value, options) ⇒ Object
- #input_textArea_extjs(id, name, width, height, allowBlank, value, disabled, cls) ⇒ Object
- #input_textarea_key_validate_lv(range, id, name, value, readonly, disabled, alt, tabindex, css, rows, cols) ⇒ Object
- #input_textarea_presence_lv(id, name, value, readonly, disabled, alt, tabindex, css, rows, cols) ⇒ Object
- #input_textField_extjs(id, name, inputType, width, allowBlank, value, disabled, cls) ⇒ Object
- #input_timeField_extjs(id, name, width, minValue, maxValue, increment, allowBlank, value, disabled, cls) ⇒ Object
- #input_validate_email_lv(id, name, value, readonly, size, maxlength, disabled, alt, tabindex, css) ⇒ Object
- #insert_linebreaks(top) ⇒ Object
- #insert_text(text) ⇒ Object
- #loadmodel(model) ⇒ Object
- #render(page) ⇒ Object
- #select_focus(form, name) ⇒ Object
- #setValueSession(variable, value) ⇒ Object
- #show_Message_extjs(icon, title, message, linkto) ⇒ Object
-
#show_Message_rialto(top, left, width, height, title, message, gray, linkto) ⇒ Object
Funciones para rialto.
Constructor Details
#initialize ⇒ Application
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
3412 3413 3414 3415 |
# File 'lib/application.rb', line 3412 def callController(controller) objetoMyCgi = MyCGI.new objetoMyCgi.redirect($kamila_site+"/"+controller.to_s) end |
#close_body ⇒ Object
393 394 395 |
# File 'lib/application.rb', line 393 def close_body() return '</body>' end |
#close_center ⇒ Object
370 371 372 |
# File 'lib/application.rb', line 370 def close_center() return '</center>' end |
#close_div ⇒ Object
608 609 610 |
# File 'lib/application.rb', line 608 def close_div() return '</div>' end |
#close_font ⇒ Object
614 615 616 |
# File 'lib/application.rb', line 614 def close_font() return '</font>' end |
#close_form ⇒ Object
752 753 754 |
# File 'lib/application.rb', line 752 def close_form() return '</form>' end |
#close_head ⇒ Object
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_href ⇒ Object
629 630 631 |
# File 'lib/application.rb', line 629 def close_href() return '</a>' end |
#close_html ⇒ Object
355 356 357 |
# File 'lib/application.rb', line 355 def close_html() return '</html>' end |
#close_javascript ⇒ Object
415 416 417 |
# File 'lib/application.rb', line 415 def close_javascript() return '</script>' end |
#close_li ⇒ Object
585 586 587 |
# File 'lib/application.rb', line 585 def close_li() return '</li>' end |
#close_ol ⇒ Object
570 571 572 |
# File 'lib/application.rb', line 570 def close_ol() return '</ol>' end |
#close_paragraphs ⇒ Object
518 519 520 |
# File 'lib/application.rb', line 518 def close_paragraphs() return '</p>' end |
#close_span ⇒ Object
544 545 546 |
# File 'lib/application.rb', line 544 def close_span() return '</span>' end |
#close_table ⇒ Object
644 645 646 |
# File 'lib/application.rb', line 644 def close_table() return '</table>' end |
#close_td ⇒ Object
677 678 679 |
# File 'lib/application.rb', line 677 def close_td() return '</td>' end |
#close_tr ⇒ Object
650 651 652 |
# File 'lib/application.rb', line 650 def close_tr() return '</tr>' end |
#close_ul ⇒ Object
555 556 557 |
# File 'lib/application.rb', line 555 def close_ul() return '</ul>' end |
#create_AjaxCancel_extjs(nameFunction, action, ids, pageserver) ⇒ Object
2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 |
# File 'lib/application.rb', line 2584 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
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 |
# File 'lib/application.rb', line 2613 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ón", mensaje); '+theIds+' }, failure: function ( result, request) { Ext.MessageBox.alert("Error", result.responseText); } }); } </script>' end |
#create_AjaxFind_extjs(nameFunction, action, params, ids, pageserver) ⇒ Object
2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 |
# File 'lib/application.rb', line 2450 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
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 |
# File 'lib/application.rb', line 2654 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
2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 |
# File 'lib/application.rb', line 2541 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ó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_center ⇒ Object
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
3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 |
# File 'lib/application.rb', line 3342 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
3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 |
# File 'lib/application.rb', line 3316 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
3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 |
# File 'lib/application.rb', line 3274 def (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
3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 |
# File 'lib/application.rb', line 3210 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) ⇒ Object
2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 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 |
# File 'lib/application.rb', line 2138 def create_gridAjaxView_extjs(nameFunction,title,idCatalogo,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 = '+idCatalogo+'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+' '+idCatalogo+'onoff_clave = true; '+idCatalogo+'win.hide(); } },' else botonAceptar = '' end return '<div id="'+idCatalogo+'"></div><div id="'+idCatalogo+'Grid"></div> <script> var '+idCatalogo+'gridOnOff = false; var '+idCatalogo+'winOnOff = false; var '+idCatalogo+'grid = null; var '+idCatalogo+'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 (!'+idCatalogo+'gridOnOff) { '+idCatalogo+'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 } }); '+idCatalogo+'gridOnOff = true; } else { var storeDatos = new Ext.data.Store({ reader: new Ext.data.ArrayReader({}, [ '+itemsds+' ]), data: Ext.grid.Datos }); '+idCatalogo+'grid.reconfigure(storeDatos,'+idCatalogo+'grid.getColumnModel()); } if(!'+idCatalogo+'winOnOff) { '+idCatalogo+'win = new Ext.Window( { el:"'+idCatalogo+'", layout:"fit", title: "'+title.to_s+'", width:500, height:300, modal: true, closeAction:"hide", plain: true, items: '+idCatalogo+'grid, buttons: ['+botonAceptar+' { text: "Salir", handler: function() { '+idCatalogo+'win.hide(); } }] }); '+idCatalogo+'winOnOff = true; } '+idCatalogo+'win.show(this); '+idCatalogo+'grid.render("'+idCatalogo.to_s+'Grid"); '+idCatalogo+'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) ⇒ Object
3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 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 |
# File 'lib/application.rb', line 3128 def create_gridAjaxView_rialto(top,left,width,height,nameFunction,title,nameCatalogo,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('+nameCatalogo+'oGrid.getCellData('+nameCatalogo+'oGrid.getIndLineClic(),'+i.to_s+'));' end return '<script> var '+nameCatalogo+'sPopup = null; var '+nameCatalogo+'oGrid = null; function '+nameCatalogo+'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++; } '+nameCatalogo+'oGrid.fillGrid(Datos2); '+nameCatalogo+'oGrid.clickLine(0,0); var aceptar = new rialto.widget.Button(parseInt(screen.height * 0.40),parseInt(screen.width * 0.15), "Aceptar","Seleccionar usuario",'+nameCatalogo+'sPopup,{adaptToText:true,widthMin:70}); aceptar.onclick= function() { '+ciclo+nameCatalogo+'sPopup.closeWindow(); } var salir = new rialto.widget.Button(parseInt(screen.height * 0.40),parseInt(screen.width * 0.25), "Salir","Salir",'+nameCatalogo+'sPopup,{adaptToText:true,widthMin:70}); salir.onclick= function() { '+nameCatalogo+'sPopup.closeWindow(); } } function '+nameFunction+'() { '+nameCatalogo+'sPopup = new rialto.widget.PopUp("'+nameCatalogo+'",'+top+','+left+',"'+width+'","'+height+'","'+title+'","","gray"); '+nameCatalogo+'oGrid = new rialto.widget.Grid({top:30,left:5,height:220,witdh:200, arrHeader:[ '+itemsHeader+' ], name:"'+nameCatalogo+'oTable",parent:'+nameCatalogo+'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 '+nameCatalogo+'ajaxReq=new rialto.io.AjaxRequest({ url:"'+$kamila_site+'/'+pageserver+'", method: "post", withWaitWindow:true, callBackObjectOnSuccess:this, onSuccess: '+nameCatalogo+'Repuesta, onFailure: function(){ alert("Error Ajax conexion"); } }); '+nameCatalogo+'ajaxReq.load(""); } </script>' end |
#create_gridView_extjs(nameFunction, title, idCatalogo, ids, ds, cm, widthcm, data) ⇒ Object
2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 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 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 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 |
# File 'lib/application.rb', line 2006 def create_gridView_extjs(nameFunction,title,idCatalogo,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 = '+idCatalogo+'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+' '+idCatalogo+'onoff_clave = true; '+idCatalogo+'win.hide(); } },' else botonAceptar = '' end return '<div id="'+idCatalogo+'"></div><div id="'+idCatalogo+'Grid"></div> <script> var '+idCatalogo+'gridOnOff = false; var '+idCatalogo+'winOnOff = false; var '+idCatalogo+'grid = null; var '+idCatalogo+'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 (!'+idCatalogo+'gridOnOff) { '+idCatalogo+'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 } }); '+idCatalogo+'gridOnOff = true; } else { var storeDatos = new Ext.data.Store({ reader: new Ext.data.ArrayReader({}, [ '+itemsds+' ]), data: Ext.grid.Datos }); '+idCatalogo+'grid.reconfigure(storeDatos,'+idCatalogo+'grid.getColumnModel()); } if(!'+idCatalogo+'winOnOff) { '+idCatalogo+'win = new Ext.Window( { el:"'+idCatalogo+'", layout:"fit", title: "'+title.to_s+'", width:500, height:300, modal: true, closeAction:"hide", plain: true, items: '+idCatalogo+'grid, buttons: ['+botonAceptar+' { text: "Salir", handler: function() { '+idCatalogo+'win.hide(); } }] }); '+idCatalogo+'winOnOff = true; } '+idCatalogo+'win.show(this); '+idCatalogo+'grid.render("'+idCatalogo.to_s+'Grid"); '+idCatalogo+'grid.getSelectionModel().selectFirstRow(); } </script>' end |
#create_gridView_rialto(top, left, width, height, nameFunction, title, nameCatalogo, nameFields, cn, widthc, typec, data) ⇒ Object
3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 |
# File 'lib/application.rb', line 3060 def create_gridView_rialto(top,left,width,height,nameFunction,title,nameCatalogo,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('+nameCatalogo+'oGrid.getCellData('+nameCatalogo+'oGrid.getIndLineClic(),'+i.to_s+'));' end return '<script> var '+nameCatalogo+'sPopup = null; var '+nameCatalogo+'oGrid = null; function '+nameCatalogo+'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++; } '+nameCatalogo+'oGrid.fillGrid(Datos2); '+nameCatalogo+'oGrid.clickLine(0,0); var aceptar = new rialto.widget.Button(parseInt(screen.height * 0.40),parseInt(screen.width * 0.15), "Aceptar","Seleccionar usuario",'+nameCatalogo+'sPopup,{adaptToText:true,widthMin:70}); aceptar.onclick= function() { '+ciclo+nameCatalogo+'sPopup.closeWindow(); } var salir = new rialto.widget.Button(parseInt(screen.height * 0.40),parseInt(screen.width * 0.25), "Salir","Salir",'+nameCatalogo+'sPopup,{adaptToText:true,widthMin:70}); salir.onclick= function() { '+nameCatalogo+'sPopup.closeWindow(); } } function '+nameFunction+'() { '+nameCatalogo+'sPopup = new rialto.widget.PopUp("'+nameCatalogo+'",'+top+','+left+',"'+width+'","'+height+'","'+title+'","","gray"); '+nameCatalogo+'oGrid = new rialto.widget.Grid({top:30,left:5,height:220,witdh:200, arrHeader:[ '+itemsHeader+' ], name:"'+nameCatalogo+'oTable",parent:'+nameCatalogo+'sPopup,row:10, cellActive:false,sortable:true,multiSelect:false, lineHeight:26,boolPrint:true,switchable:true, clickable:true,autoResizableW:true,autoResizableH:false, writable:false}); '+nameCatalogo+'LoadData(); } </script>' end |
#create_head ⇒ Object
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_html ⇒ Object
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_extjs ⇒ Object
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();</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_lightbox2 ⇒ Object
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_md5 ⇒ Object
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
2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 |
# File 'lib/application.rb', line 2829 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,) 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: "' + .to_s + '" , width:400, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.ERROR }); }); } return false; } </script>' end |
#create_massValidate_rialto(form, name, ids, mensaje) ⇒ Object
3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 |
# File 'lib/application.rb', line 3008 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 () return '<meta name="GENERATOR" content="kamila version 1.0.1">' 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
3392 3393 3394 3395 3396 3397 3398 |
# File 'lib/application.rb', line 3392 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
3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 |
# File 'lib/application.rb', line 3399 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
3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 |
# File 'lib/application.rb', line 3374 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
1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 |
# File 'lib/application.rb', line 1942 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_tr ⇒ Object
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 |
#deleteSession ⇒ Object
3461 3462 3463 3464 3465 3466 3467 3468 |
# File 'lib/application.rb', line 3461 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
3206 3207 3208 |
# File 'lib/application.rb', line 3206 def format_number(number, separator) return number.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1"+separator) end |
#getValueSession(variable) ⇒ Object
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 3480 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
3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 |
# File 'lib/application.rb', line 3423 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 (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 (id,name,value,css,form,fieldNames,,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: "' + .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
2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 |
# File 'lib/application.rb', line 2893 def (name,top,left,text,alt,parent,,form,js) property = Array.new property = .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
3035 3036 3037 3038 3039 3040 |
# File 'lib/application.rb', line 3035 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
1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 |
# File 'lib/application.rb', line 1835 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
3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 |
# File 'lib/application.rb', line 3041 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
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 1794 1795 1796 1797 1798 1799 1800 1801 |
# File 'lib/application.rb', line 1765 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_datefield_extjs(id, name, value, readonly, blankText, invalidText, type, vtype, disabled, dateField) ⇒ Object
1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 |
# File 'lib/application.rb', line 1481 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_emailField_extjs(id, name, width, allowBlank, value, disabled, cls) ⇒ Object
1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 |
# File 'lib/application.rb', line 1858 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
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 |
# File 'lib/application.rb', line 1567 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_htmlEditor_extjs(id, name, value, width, height, allowBlank, disabled, cls) ⇒ Object
1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 |
# File 'lib/application.rb', line 1874 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
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 |
# File 'lib/application.rb', line 1616 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 (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
1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 |
# File 'lib/application.rb', line 1725 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
2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 |
# File 'lib/application.rb', line 2911 def input_reset_rialto(name,top,left,text,alt,parent,,form) property = Array.new property = .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
2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 |
# File 'lib/application.rb', line 2929 def input_submit_rialto(name,top,left,text,alt,parent,,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 = .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
2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 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 |
# File 'lib/application.rb', line 2843 def input_text_rialto(name,top,left,width,type,parent,value,) property = Array.new property = .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
1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 |
# File 'lib/application.rb', line 1582 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
1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 |
# File 'lib/application.rb', line 1519 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
1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 |
# File 'lib/application.rb', line 1598 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
3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 |
# File 'lib/application.rb', line 3469 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
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 |
# File 'lib/application.rb', line 1891 def show_Message_extjs(icon,title,) 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: "' + .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
2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 |
# File 'lib/application.rb', line 2803 def show_Message_rialto(top,left,width,height,title,,gray) if gray.upcase=='GRAY' fondo = 'gray' else fondo = 'transparent' end return '<script> var sPopup = new rialto.widget.PopUp("popupRialto",'+top+','+left+',"'+width+'","'+height+'","'+.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 |