class DrbForm
this file is part of manqod manqod is distributed under the CDDL licence the owner of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)
Attributes
moditem[R]
tabs[R]
Public Class Methods
new(drbdb,my_id)
click to toggle source
# File lib/DrbDB/DrbForm.rb, line 9 def initialize(drbdb,my_id) @my_id=my_id.to_i @drbdb=drbdb @title="not loaded" end
Public Instance Methods
cache()
click to toggle source
# File lib/DrbDB/DrbForm.rb, line 60 def cache @drbdb.cache end
create_skeleton()
click to toggle source
# File lib/DrbDB/DrbForm.rb, line 16 def create_skeleton @moditem=@drbdb.admin.qrow("select * from moditems where id='#{@my_id}'") @title=@moditem["display"] if @table=gtk_attribute("table") @querySQL="select * from `#{@table}` where id='\#{@parentselected}'" edebug("table(from attribute): #{@table.inspect}") unless @drbdb.main_server.starting_up else @querySQL=@moditem["querysql"] @table=@drbdb.admin.guess_base(@querySQL) edebug("table(guessed): #{@table.inspect}") unless @drbdb.main_server.starting_up end @batch=false @tabs=Hash.new items=Array.new @drbdb.admin.rows("select gtkformitems.*,modules.modname from gtkformitems left join moditems on gtkformitems.to_call = moditems.id left join modules on modules.id=moditems.modid where formid='#{@my_id}' order by y,x").each{|itemp| #Form suppots batch if at least one item supports it @batch=true if (@drbdb.gtk_attribute_of_object("batch",itemp["id"],"form-item") || "false").upcase == "TRUE" itemp["tab"]=@drbdb.gtk_attribute_of_object("tab",itemp["id"],"form-item") || "default" #add the missing tab item requires unless tabs.has_key?(itemp["tab"]) tabs[itemp["tab"]]=Hash.new tabs[itemp["tab"]]["title"]=(itemp["tab"] == "default" ? "" : itemp["tab"]) end tabs[itemp["tab"]]["minX"]=itemp["x"].to_i if !tabs[itemp["tab"]].has_key?("minX") || tabs[itemp["tab"]]["minX"]>itemp["x"].to_i tabs[itemp["tab"]]["minY"]=itemp["y"].to_i if !tabs[itemp["tab"]].has_key?("minY") || tabs[itemp["tab"]]["minY"]>itemp["y"].to_i tabs[itemp["tab"]]["maxX"]=itemp["x"].to_i if !tabs[itemp["tab"]].has_key?("maxX") || tabs[itemp["tab"]]["maxX"]<itemp["x"].to_i tabs[itemp["tab"]]["maxY"]=itemp["y"].to_i if !tabs[itemp["tab"]].has_key?("maxY") || tabs[itemp["tab"]]["maxY"]<itemp["y"].to_i items.push(itemp) } cache.set("#{@my_id}moditem",@moditem) cache.set("#{@my_id}attributes",{ :querySQL=>@querySQL, :title=>@title, :table=>@table, :tabs=>tabs, :batch=>@batch }) cache.set("#{@my_id}items",items) self end
get_id()
click to toggle source
# File lib/DrbDB/DrbForm.rb, line 65 def get_id @my_id end
gtk_attribute(gattr)
click to toggle source
# File lib/DrbDB/DrbForm.rb, line 68 def gtk_attribute(gattr) @drbdb.gtk_attribute(gattr,self) end
mod_type()
click to toggle source
# File lib/DrbDB/DrbForm.rb, line 71 def mod_type "form" end
to_s()
click to toggle source
# File lib/DrbDB/DrbForm.rb, line 74 def to_s "DrbForm{#{@drbdb.name}:#{@title}(#{@my_id})}" end