# encoding: utf-8 require 'rubyXL' class CancerpredictsController < ApplicationController def initialize super @app_title = "cancerpredict" end def index uid = OrbitHelper.params[:uid] rescue "" tags = OrbitHelper.widget_tags categories = OrbitHelper.widget_categories || [] locale = OrbitHelper.get_site_locale.to_s @table_str = '
' @table_str_left = '
' @table_str_right = '
' create_first_field @form_to_show.form_show.each do |num,property| @field_property = {} property.each do |key,value| @value= value if @value.class == BSON::Document || @value.class == Hash @disp_value = @value[I18n.locale.to_s] rescue "" else @disp_value = @value end @field_property[key] = @disp_value end if @field_property['right'] == 0 @table_str_left += '
' break if @field_property["name"] == "" @table_str_left += '' if @field_property["comment_text"] != "" @table_str_left += '' @table_str_left += '' else @table_str_left += '
' end if @field_property["is_num"] == 1 @table_str_left += '' else @table_str_left += '
' @field_property["choice_fields"].each do |create_choice| @table_str_left += '' @table_str_left += '' end @table_str_left += '
' end if @field_property["hint"].to_s != "" @table_str_left +='
'+@field_property["hint"]+'
' end @table_str_left += '
' else @table_str_right += '
' break if @field_property["name"] == "" @table_str_right += '' if @field_property["comment_text"] != "" @table_str_right += '' @table_str_right += '' else @table_str_right += '
' end if @field_property["is_num"] == 1 @table_str_right += '' else @table_str_right += '
' @field_property["choice_fields"].each do |create_choice| @table_str_right += '' @table_str_right += '' end @table_str_right += '
' end if @field_property["hint"].to_s != "" @table_str_right +='
'+@field_property["hint"]+'
' end @table_str_right += '
' end end @table_str_left += '
' @table_str_right += '
' @table_str += (@table_str_left+@table_str_right) @table_str +='
' @submit_btn_str='' @reset_btn_str='' @table_str += (@submit_btn_str+@reset_btn_str+'
') { "cancerpredict" => [], "extras"=>{"table"=> @table_str} } end def widget uid = OrbitHelper.params[:uid] rescue "" tags = OrbitHelper.widget_tags categories = OrbitHelper.widget_categories || [] locale = OrbitHelper.get_site_locale.to_s end def create_first_field if Cancerpredictfields.where("title"=>(@app_title + "_back")).take_while{true}.count == 0 @form_to_show = Cancerpredictfields.new() @form_to_show.title = @app_title +"_back" @form_to_show.save end @form_to_show if Cancerpredictfields.where("title"=>@app_title).take_while{true}.count == 0 @form_to_show = Cancerpredictfields.new() @form_to_show.title=@app_title @form_to_show.save @form_to_show = Cancerpredictfields.where("title"=>@app_title).first else @form_to_show = Cancerpredictfields.where("title"=>@app_title).first end end end