Class Web::PortletPreferences
In: lib/web/portlet_preferences.rb
Parent: ActiveRecord::Base

Methods

name   preferences_   primkey   resource  

Public Instance methods

[Source]

    # File lib/web/portlet_preferences.rb, line 16
16:     def name
17:       self.portletid.split(/_INSTANCE_/)[0]
18:     end

loads the preferences XML structure to Ruby Hash

[Source]

    # File lib/web/portlet_preferences.rb, line 32
32:     def preferences_
33:       xml = REXML::Document.new(self.preferences)
34:       preferences = []
35:       xml.elements.each("portlet-preferences/preference") do |pref|
36:         phash = {
37:           :name  => pref.elements["name"].text,
38:           :value => (pref.elements["value"] ? pref.elements["value"].text : "")
39:         }
40:         preferences << phash
41:       end
42:       return preferences
43:     end

primkey in resource_ table

[Source]

    # File lib/web/portlet_preferences.rb, line 21
21:     def primkey
22:       "#{self.plid}_LAYOUT_#{self.portletid}"
23:     end

argument plid is to comply API with Web::Portlet.resource

[Source]

    # File lib/web/portlet_preferences.rb, line 26
26:     def resource(plid=nil)
27:       Resource.find_by_primkey(self.primkey)
28:   #     Resource.find(:all, :conditions => "primkey='#{self.primkey}'")
29:     end

[Validate]