Class: ODDB::View::Admin::EntityForm

Inherits:
Form
  • Object
show all
Includes:
HtmlGrid::ErrorMessage
Defined in:
src/view/admin/entity.rb

Constant Summary

LABELS =
true
LEGACY_INTERFACE =
false
LOOKANDFEEL_MAP =
{
  :name => :email, 
}
COMPONENTS =
{
  [0,0] =>  :name,
  [0,1] =>  :salutation,
  [0,2] =>  :name_first,
  [2,2] =>  :name_last,
  [0,3] =>  :address,
  [0,4] =>  :plz,
  [2,4] =>  :city,
  [0,5] =>  :groups,
  [2,5] =>  :privileges,
  [0,6] =>  :association,
  [0,7] =>  :set_pass_1,
  [1,7] =>  :set_pass,
  [2,7] =>  :set_pass_2,
  [1,8] =>  :submit,
}
COMPONENT_CSS_MAP =
{
  [1,0,4,5] =>  'standard',
  [1,6]     =>  'standard',
}
CSS_MAP =
{
  [0,0,4,5] =>  'list',
  [0,5,4]   =>  'list top', 
  [0,6,4,3] =>  'list',
}
SYMBOL_MAP =
{
  :salutation => HtmlGrid::Select,
}

Constants included from FormMethods

ACCEPT_CHARSET, DEFAULT_CLASS, EVENT

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from FormMethods

#delete_item, #delete_item_warn, #get_event_button, #post_event_button

Class Method Details

+ (Object) preferences(*args)



87
88
89
90
91
92
93
94
95
# File 'src/view/admin/entity.rb', line 87

def EntityForm.preferences(*args)
  args.each { |name|
    define_method(name) { |model|
      input = HtmlGrid::InputText.new(name, model, @session, self)
      input.value = @session.yus_get_preference(model.name, name)
      input
    }
  }
end

Instance Method Details

- (Object) association(model)



135
136
137
138
139
140
141
142
143
144
145
# File 'src/view/admin/entity.rb', line 135

def association(model)
  ass, priv = nil
  input = HtmlGrid::InputText.new(:yus_association, model, @session, self)
  if(model.respond_to?(:association) && (priv = model.association))
    input.value = priv
  elsif(ass = @session.app.yus_model(model.name))
    priv = ass.pointer.to_yus_privilege
    input.value = priv
  end
  input
end

- (Object) groups(model)



149
150
151
# File 'src/view/admin/entity.rb', line 149

def groups(model)
  YusGroups.new(model, @session, self)
end

- (Object) init



131
132
133
134
# File 'src/view/admin/entity.rb', line 131

def init
  super
  error_message()
end

- (Object) pass(model, key)



152
153
154
155
156
# File 'src/view/admin/entity.rb', line 152

def pass(model, key)
  if(set_pass? && @session.allowed?('set_password', model.name))
    HtmlGrid::Pass.new(key, model, @session, self)
  end
end

- (Object) privileges(model)



146
147
148
# File 'src/view/admin/entity.rb', line 146

def privileges(model)
  YusPrivileges.new(model, @session, self)
end

- (Object) salutation(model)



157
158
159
160
161
# File 'src/view/admin/entity.rb', line 157

def salutation(model)
  input = HtmlGrid::Select.new(:salutation, model, @session, self)
  input.selected = @session.yus_get_preference(model.name, :salutation)
  input
end

- (Object) set_pass(model)



168
169
170
171
172
173
174
175
# File 'src/view/admin/entity.rb', line 168

def set_pass(model)
  unless(set_pass? || !@session.allowed?('set_password', model.name))
    button = HtmlGrid::Button.new(:set_pass, model, @session, self)
    script = 'this.form.event.value="set_pass"; this.form.submit();'
    button.set_attribute('onClick', script)
    button
  end
end

- (Boolean) set_pass?

Returns:

  • (Boolean)


176
177
178
# File 'src/view/admin/entity.rb', line 176

def set_pass?
  @model.is_a?(Persistence::CreateItem) || @session.event == :set_pass
end

- (Object) set_pass_1(model)



162
163
164
# File 'src/view/admin/entity.rb', line 162

def set_pass_1(model)
  pass(model, :set_pass_1)
end

- (Object) set_pass_2(model)



165
166
167
# File 'src/view/admin/entity.rb', line 165

def set_pass_2(model)
  pass(model, :set_pass_2)
end