lportal 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. data/README +16 -0
  2. data/install.rb +1 -0
  3. data/lib/account.rb +16 -0
  4. data/lib/address.rb +25 -0
  5. data/lib/announcement.rb +5 -0
  6. data/lib/blog_post.rb +32 -0
  7. data/lib/bookmark.rb +10 -0
  8. data/lib/company.rb +43 -0
  9. data/lib/contact.rb +52 -0
  10. data/lib/counter.rb +4 -0
  11. data/lib/dl_file.rb +24 -0
  12. data/lib/dl_folder.rb +25 -0
  13. data/lib/emailaddress.rb +18 -0
  14. data/lib/group.rb +100 -0
  15. data/lib/ig/folder.rb +12 -0
  16. data/lib/ig/image.rb +35 -0
  17. data/lib/image.rb +11 -0
  18. data/lib/journal/article.rb +43 -0
  19. data/lib/journal/article_image.rb +4 -0
  20. data/lib/journal/article_resource.rb +23 -0
  21. data/lib/mb/category.rb +47 -0
  22. data/lib/mb/discussion.rb +16 -0
  23. data/lib/mb/message.rb +45 -0
  24. data/lib/mb/thread.rb +20 -0
  25. data/lib/organization.rb +26 -0
  26. data/lib/permission.rb +32 -0
  27. data/lib/phone.rb +33 -0
  28. data/lib/resource.rb +58 -0
  29. data/lib/resource_code.rb +13 -0
  30. data/lib/role.rb +19 -0
  31. data/lib/tag/asset.rb +34 -0
  32. data/lib/tag/entry.rb +46 -0
  33. data/lib/tag/property.rb +28 -0
  34. data/lib/user.rb +248 -0
  35. data/lib/usergroup.rb +23 -0
  36. data/lib/web/layout.rb +67 -0
  37. data/lib/web/layout_set.rb +37 -0
  38. data/lib/web/portlet.rb +43 -0
  39. data/lib/web/portlet_name.rb +6 -0
  40. data/lib/web/portlet_preferences.rb +42 -0
  41. data/lib/wiki/node.rb +21 -0
  42. data/lib/wiki/page.rb +29 -0
  43. data/lib/wiki/pageresource.rb +20 -0
  44. data/lportal.rb +9 -0
  45. data/test/unit/account_test.rb +20 -0
  46. data/test/unit/address_test.rb +8 -0
  47. data/test/unit/announcement_test.rb +8 -0
  48. data/test/unit/asset_test.rb +29 -0
  49. data/test/unit/bookmark_test.rb +8 -0
  50. data/test/unit/company_test.rb +60 -0
  51. data/test/unit/contact_test.rb +23 -0
  52. data/test/unit/dl_file_test.rb +8 -0
  53. data/test/unit/dl_folder_test.rb +8 -0
  54. data/test/unit/group_test.rb +76 -0
  55. data/test/unit/ig/folder_test.rb +8 -0
  56. data/test/unit/ig/image_test.rb +20 -0
  57. data/test/unit/image_test.rb +34 -0
  58. data/test/unit/journal/article_image_test.rb +8 -0
  59. data/test/unit/journal/article_resource_test.rb +20 -0
  60. data/test/unit/journal/article_test.rb +39 -0
  61. data/test/unit/mb/category_test.rb +35 -0
  62. data/test/unit/mb/discussion_test.rb +14 -0
  63. data/test/unit/mb/message_test.rb +46 -0
  64. data/test/unit/mb/thread_test.rb +21 -0
  65. data/test/unit/organization_test.rb +57 -0
  66. data/test/unit/permission_test.rb +33 -0
  67. data/test/unit/resource_code_test.rb +29 -0
  68. data/test/unit/resource_test.rb +49 -0
  69. data/test/unit/role_test.rb +22 -0
  70. data/test/unit/tag/entry_test.rb +35 -0
  71. data/test/unit/tag/property_test.rb +27 -0
  72. data/test/unit/user_group_test.rb +8 -0
  73. data/test/unit/user_test.rb +103 -0
  74. data/test/unit/usergroup_test.rb +33 -0
  75. data/test/unit/web/layout_set_test.rb +88 -0
  76. data/test/unit/web/layout_test.rb +91 -0
  77. data/test/unit/web/portlet_preferences_test.rb +47 -0
  78. data/test/unit/web/portlet_test.rb +33 -0
  79. data/test/unit/wiki/node_test.rb +8 -0
  80. data/test/unit/wiki/page_test.rb +8 -0
  81. metadata +146 -0
data/lib/permission.rb ADDED
@@ -0,0 +1,32 @@
1
+ class Permission < ActiveRecord::Base
2
+ set_table_name :permission_
3
+ set_primary_key :permissionid
4
+
5
+ belongs_to :company,
6
+ :foreign_key => 'companyid'
7
+
8
+ belongs_to :resource,
9
+ :foreign_key => 'resourceid'
10
+
11
+ # association to users
12
+ has_and_belongs_to_many :users,
13
+ :join_table => 'users_permissions',
14
+ :foreign_key => 'permissionid',
15
+ :association_foreign_key => 'userid'
16
+
17
+ has_and_belongs_to_many :roles,
18
+ :join_table => 'roles_permissions',
19
+ :foreign_key => 'permissionid',
20
+ :association_foreign_key => 'roleid'
21
+
22
+ has_and_belongs_to_many :groups,
23
+ :join_table => 'groups_permissions',
24
+ :foreign_key => 'permissionid',
25
+ :association_foreign_key => 'groupid'
26
+
27
+ def holders
28
+ self.users + self.roles + self.groups
29
+ end
30
+
31
+
32
+ end
data/lib/phone.rb ADDED
@@ -0,0 +1,33 @@
1
+ class Phone < ActiveRecord::Base
2
+ set_table_name :phone
3
+ set_primary_key :phoneid
4
+
5
+ belongs_to :company,
6
+ :foreign_key => 'companyid'
7
+
8
+ belongs_to :user,
9
+ :foreign_key => 'userid'
10
+
11
+ def initialize(params)
12
+ super(params)
13
+ self.classnameid = 10005
14
+ self.createdate = Time.now
15
+ unless self.companyid
16
+ u = User.find self.userid
17
+ self.companyid = u.companyid
18
+ end
19
+ unless self.username
20
+ u = User.find self.userid
21
+ self.username = u.fullname
22
+ end
23
+ end
24
+
25
+ def number
26
+ self.number_
27
+ end
28
+
29
+ def number=(val)
30
+ self.number_ = val
31
+ end
32
+
33
+ end
data/lib/resource.rb ADDED
@@ -0,0 +1,58 @@
1
+ class Resource < ActiveRecord::Base
2
+ set_table_name :resource_
3
+ set_primary_key :resourceid
4
+
5
+ public
6
+
7
+ belongs_to :resourcecode,
8
+ :class_name => 'ResourceCode',
9
+ :foreign_key => 'codeid'
10
+ alias :code :resourcecode
11
+
12
+ has_many :permissions,
13
+ :foreign_key => 'resourceid'
14
+
15
+ belongs_to :articleresource,
16
+ :class_name => 'Journal::ArticleResource',
17
+ :foreign_key => 'primkey'
18
+
19
+ belongs_to :layout,
20
+ :class_name => 'Web::Layout',
21
+ :foreign_key => 'primkey'
22
+
23
+ def plid
24
+ self.primkey[/([0-9]*)_LAYOUT_(.*)/,1]
25
+ end
26
+
27
+ def portletid
28
+ self.primkey[/([0-9]*)_LAYOUT_(.*)/,2]
29
+ end
30
+
31
+ # finds content for primkey
32
+ def content
33
+ key = self.primkey
34
+
35
+ case self.code.name
36
+ when 'com.liferay.portlet.journal.model.JournalArticle'
37
+ Journal::ArticleResource.find key
38
+ when 'com.liferay.portal.model.Layout'
39
+ Web::Layout.find key
40
+
41
+ # when "56" #journal_content
42
+ # when "58" #login
43
+ # when "101" #tagged_content
44
+ # when "103" #tags_compiler
45
+
46
+ else
47
+ if key[/LAYOUT/]
48
+ Web::PortletPreferences.find(:first, :conditions => "plid=#{self.plid} AND portletid='#{self.portletid}'" )
49
+ else
50
+ # unless groups_ids.include? key
51
+ STDERR.puts "fixme: #{x.code.name} (#{key})"
52
+ # end
53
+ end
54
+ end
55
+ end
56
+
57
+ end
58
+
@@ -0,0 +1,13 @@
1
+ class ResourceCode < ActiveRecord::Base
2
+ set_table_name :resourcecode
3
+ set_primary_key :codeid
4
+
5
+ public
6
+
7
+ belongs_to :company,
8
+ :foreign_key => "companyid"
9
+
10
+ has_many :resources,
11
+ :foreign_key => "codeid"
12
+
13
+ end
data/lib/role.rb ADDED
@@ -0,0 +1,19 @@
1
+ class Role < ActiveRecord::Base
2
+ set_table_name :role_
3
+ set_primary_key :roleid
4
+
5
+ belongs_to :company,
6
+ :foreign_key => "companyid"
7
+
8
+ has_and_belongs_to_many :permissions,
9
+ :join_table => "roles_permissions",
10
+ :foreign_key => "roleid",
11
+ :association_foreign_key => "permissionid"
12
+
13
+ # association to users
14
+ has_and_belongs_to_many :users,
15
+ :join_table => "users_roles",
16
+ :foreign_key => "roleid",
17
+ :association_foreign_key => "userid"
18
+
19
+ end
data/lib/tag/asset.rb ADDED
@@ -0,0 +1,34 @@
1
+ module Tag
2
+ # Represents the table tagsasset
3
+ class Asset < ActiveRecord::Base
4
+ set_table_name :tagsasset
5
+ set_primary_key :assetid
6
+
7
+ # com.liferay.portlet.tags.model.TagsAsset
8
+ def liferay_class
9
+ 'com.liferay.portlet.tags.model.TagsAsset'
10
+ end
11
+
12
+ belongs_to :company,
13
+ :foreign_key => 'companyid'
14
+
15
+ # association to user
16
+ belongs_to :user,
17
+ :foreign_key => 'userid'
18
+ alias :owner :user
19
+
20
+ # association to groups (communities)
21
+ belongs_to :group,
22
+ :foreign_key => 'groupid'
23
+ alias :community :group
24
+
25
+ # association to tags
26
+ has_and_belongs_to_many :tags,
27
+ :class_name => 'Tag::Entry',
28
+ :join_table => 'tagsassets_tagsentries',
29
+ :foreign_key => 'assetid',
30
+ :association_foreign_key => 'entryid'
31
+
32
+
33
+ end
34
+ end
data/lib/tag/entry.rb ADDED
@@ -0,0 +1,46 @@
1
+ module Tag
2
+ class Entry < ActiveRecord::Base
3
+ set_table_name :tagsentry
4
+ set_primary_key :entryid
5
+
6
+ # com.liferay.portlet.tags.model.TagsEntry
7
+ def liferay_class
8
+ 'com.liferay.portlet.tags.model.TagsEntry'
9
+ end
10
+
11
+ # association to user
12
+ belongs_to :user,
13
+ :foreign_key => 'userid'
14
+ alias :owner :user
15
+
16
+ belongs_to :company,
17
+ :foreign_key => 'companyid'
18
+
19
+ has_many :properties,
20
+ :class_name => 'Tag::Property',
21
+ :foreign_key => 'entryid'
22
+
23
+ # association to assets
24
+ has_and_belongs_to_many :assets,
25
+ :join_table => 'tagsassets_tagsentries',
26
+ :foreign_key => 'entryid',
27
+ :association_foreign_key => 'assetid'
28
+
29
+ def categories
30
+ self.properties.map{|p| p.category}.compact.uniq
31
+ end
32
+
33
+ # def categories<<(category)
34
+ # return false if self.categories.include? category
35
+ # Tag::Property.create(
36
+ # :entryid => self.id,
37
+ # :key_ => 'category',
38
+ # :value => category,
39
+ # :companyid => self.company.id,
40
+ # :createdate => Time.now,
41
+ # :modifieddate => Time.now
42
+ # )
43
+ # end
44
+
45
+ end
46
+ end
@@ -0,0 +1,28 @@
1
+ module Tag
2
+ class Property < ActiveRecord::Base
3
+ set_table_name :tagsproperty
4
+ set_primary_key :propertyid
5
+
6
+ # com.liferay.portlet.tags.model.TagsProperty
7
+ def liferay_class
8
+ 'com.liferay.portlet.tags.model.TagsProperty'
9
+ end
10
+
11
+ # association to user
12
+ belongs_to :user,
13
+ :foreign_key => 'userid'
14
+ alias :owner :user
15
+
16
+ belongs_to :company,
17
+ :foreign_key => 'companyid'
18
+
19
+ belongs_to :tag,
20
+ :class_name => 'Tag::Entry',
21
+ :foreign_key => 'entryid'
22
+
23
+ def category
24
+ (self.key_=='category' ? self.value : nil)
25
+ end
26
+
27
+ end
28
+ end
data/lib/user.rb ADDED
@@ -0,0 +1,248 @@
1
+ # Liferay users.
2
+ class User < ActiveRecord::Base
3
+ set_table_name :user_
4
+ set_primary_key :userid
5
+
6
+ public
7
+
8
+ def liferay_class
9
+ 'com.liferay.portal.model.User'
10
+ end
11
+
12
+ def initialize(params)
13
+ super(params)
14
+ unless self.uuid_
15
+ require 'rubygems'
16
+ require 'uuidtools'
17
+ self.uuid_ = UUID.random_create.to_s
18
+ end
19
+ self.createdate = Time.now
20
+ self.modifieddate = Time.now
21
+ self.defaultuser = false
22
+ self.gracelogincount = 0
23
+ self.portraitid ||= 0
24
+ self.timezoneid ||= 'Europe/Istanbul'
25
+ self.failedloginattempts = 0
26
+ self.lockout = false
27
+ self.agreedtotermsofuse = true
28
+ self.active_ = true
29
+
30
+ end
31
+
32
+ has_one :account,
33
+ :foreign_key => 'userid'
34
+
35
+ has_many :phones,
36
+ :class_name => 'Phone',
37
+ :foreign_key => 'userid'
38
+
39
+ belongs_to :contact,
40
+ :foreign_key => 'contactid'
41
+
42
+ belongs_to :company,
43
+ :foreign_key => 'companyid'
44
+
45
+ # association to organizations
46
+ has_and_belongs_to_many :organizations,
47
+ :join_table => 'users_orgs',
48
+ :foreign_key => 'userid',
49
+ :association_foreign_key => 'organizationid'
50
+ alias :orgs :organizations
51
+
52
+ # association to groups
53
+ has_and_belongs_to_many :groups,
54
+ :join_table => 'users_groups',
55
+ :foreign_key => 'userid',
56
+ :association_foreign_key => 'groupid'
57
+ alias :communities :groups
58
+
59
+ # association to roles
60
+ has_and_belongs_to_many :roles,
61
+ :join_table => 'users_roles',
62
+ :foreign_key => 'userid',
63
+ :association_foreign_key => 'roleid'
64
+
65
+ # association to direct user permissions.
66
+ has_and_belongs_to_many :user_permissions,
67
+ :class_name => 'Permission',
68
+ :join_table => 'users_permissions',
69
+ :foreign_key => 'userid',
70
+ :association_foreign_key => 'permissionid'
71
+
72
+ def group_permissions
73
+ self.groups.map{|g| g.permissions }.flatten
74
+ end
75
+
76
+ def role_permissions
77
+ self.roles.map{|g| g.permissions }.flatten
78
+ end
79
+
80
+ # permissions are summed up from user, group and role permissions
81
+ def permissions
82
+ user_permissions + group_permissions + role_permissions
83
+ end
84
+
85
+ def fullname
86
+ self.contact ?
87
+ self.contact.fullname : nil
88
+ end
89
+ def firstname
90
+ self.contact.firstname
91
+ end
92
+ def firstname=(v)
93
+ if self.contact
94
+ c = self.contact
95
+ c.firstname = v
96
+ c.save
97
+ else
98
+ c = Contact.create(
99
+ :userid => self.userid,
100
+ :firstname => v )
101
+ self.contact = c
102
+ self.save
103
+ end
104
+ end
105
+ def lastname
106
+ self.contact.lastname
107
+ end
108
+ def lastname=(v)
109
+ if self.contact
110
+ c = self.contact
111
+ c.lastname = v
112
+ c.save
113
+ else
114
+ c = Contact.create(
115
+ :userid => self.userid,
116
+ :lastname => v )
117
+ self.contact = c
118
+ self.save
119
+ end
120
+ end
121
+
122
+ # 1=female, 2=male
123
+ def sex=(v)
124
+ male = (v==2 ? true : false)
125
+ if self.contact
126
+ c = self.contact
127
+ c.male=male
128
+ c.save
129
+ else
130
+ c = Contact.create(
131
+ :userid => self.userid,
132
+ :male => male )
133
+ self.contact = c
134
+ self.save
135
+ end
136
+ end
137
+
138
+ # User's own group
139
+ has_one :hive,
140
+ :class_name => 'Group',
141
+ :foreign_key => 'classpk'
142
+
143
+ # association to usergroups
144
+ # has_and_belongs_to_many :usergroups,
145
+ # :class_name => 'Usergroup',
146
+ # :join_table => 'users_usergroups',
147
+ # :foreign_key => 'userid',
148
+ # :association_foreign_key => 'usergroupid'
149
+
150
+ # association to tags
151
+ has_many :tags,
152
+ :class_name => 'Tag::Entry',
153
+ :foreign_key => 'userid'
154
+
155
+ # association to assets
156
+ has_many :assets,
157
+ :foreign_key => 'userid'
158
+
159
+ # association to wiki pages
160
+ has_many :wikipages,
161
+ :class_name => 'Wiki::Page',
162
+ :foreign_key => 'userid'
163
+ alias :articles :wikipages
164
+
165
+ # association to MessageBoardMessages
166
+ has_many :messages,
167
+ :class_name => 'MB::Message',
168
+ :foreign_key => 'userid'
169
+
170
+
171
+ # def address
172
+ # self.address || Address.new(:user=>self, :company=>self.company)
173
+ # end
174
+
175
+ def address
176
+ return @address if @address
177
+ @address = Address.find_by_userid self.id
178
+ if @address.nil?
179
+ @address = Address.new(
180
+ :user => self,
181
+ :createdate => Time.now,
182
+ :company => self.company)
183
+ end
184
+ return @address
185
+ end
186
+
187
+ def lang
188
+ self.languageid
189
+ end
190
+ def lang=(value)
191
+ self.languageid=value
192
+ end
193
+
194
+ def gsm
195
+ self.phones.any? ? self.phones.first.number : nil
196
+ end
197
+ def gsm=(number)
198
+ if self.phones.any?
199
+ phone = self.phones.first
200
+ phone.number=number
201
+ phone.save
202
+ else
203
+ Phone.create(
204
+ :userid => self.id,
205
+ :number => number,
206
+ :primary_ => true
207
+ )
208
+ end
209
+ end
210
+
211
+ def birthday
212
+ self.contact.birthday
213
+ end
214
+
215
+ def streetaddress
216
+ self.address.street1
217
+ end
218
+ def streetaddress=(val)
219
+ self.address.street1 = val
220
+ self.address.save
221
+ end
222
+
223
+ def zipcode
224
+ self.address.zip
225
+ end
226
+ def zipcode=(val)
227
+ self.address.zip = val
228
+ self.address.save
229
+ end
230
+
231
+ def city
232
+ self.address.city
233
+ end
234
+ def city=(val)
235
+ self.address.city = val
236
+ self.address.save
237
+ end
238
+
239
+ def is_active?
240
+ self.active_
241
+ end
242
+
243
+ def is_default?
244
+ self.defaultuser
245
+ end
246
+
247
+
248
+ end
data/lib/usergroup.rb ADDED
@@ -0,0 +1,23 @@
1
+ class Usergroup < ActiveRecord::Base
2
+ set_table_name :usergroup
3
+ set_primary_key :usergroupid
4
+
5
+ # com.liferay.portal.model.UserGroup
6
+ def liferay_class
7
+ 'com.liferay.portal.model.UserGroup'
8
+ end
9
+
10
+ belongs_to :company,
11
+ :foreign_key => 'companyid'
12
+
13
+ # association to direct groups
14
+ has_and_belongs_to_many :groups,
15
+ :join_table => 'groups_usergroups',
16
+ :foreign_key => 'usergroupid',
17
+ :association_foreign_key => 'groupid'
18
+
19
+ has_one :parent,
20
+ :class_name => 'Usergroup',
21
+ :foreign_key => 'parentusergroupid'
22
+
23
+ end
data/lib/web/layout.rb ADDED
@@ -0,0 +1,67 @@
1
+ module Web
2
+ # Page layouts. These are individual layouts for items in the navigation bar.
3
+ # Layouts have portlets, these are modeled by parsing (by regexp) the typesettings xml. Layouts belong to a certain LayoutSet.
4
+ class Layout < ActiveRecord::Base
5
+ set_table_name :layout
6
+ set_primary_key :plid
7
+
8
+ # com.liferay.portal.model.Layout
9
+ def liferay_class
10
+ 'com.liferay.portal.model.Layout'
11
+ end
12
+
13
+ public
14
+
15
+ belongs_to :group,
16
+ :foreign_key => 'groupid'
17
+
18
+ belongs_to :company,
19
+ :foreign_key => 'companyid'
20
+
21
+ has_many :resources,
22
+ :foreign_key => 'primkey'
23
+
24
+ def portletids
25
+ begin
26
+ ts = self.typesettings
27
+ c1= ts[/column-1=(.*)/,1] || ""
28
+ c2= ts[/column-2=(.*)/,1] || ""
29
+ c3= ts[/column-3=(.*)/,1] || ""
30
+ (c1+c2+c3).split(",").uniq
31
+ rescue
32
+ end
33
+ end
34
+
35
+ # def instanceids
36
+ # self.portletids.map{|p| p if p[/INSTANCE/]}.compact.uniq
37
+ # end
38
+
39
+ #
40
+ def portlets
41
+ portlets = []
42
+ return portlets unless self.portletids
43
+ self.portletids.each do |id|
44
+ portlets << (Web::Portlet.find_by_portletid(id) or Web::PortletPreferences.find_by_portletid(id))
45
+ end
46
+ return portlets.compact
47
+ end
48
+
49
+ # Portlet instances on the Layout.
50
+ def instances
51
+ Web::PortletPreferences.find(:all, :conditions => "plid=#{self.plid} AND portletid LIKE '%INSTANCE%'")
52
+ end
53
+
54
+ def is_public?
55
+ !self.privatelayout
56
+ end
57
+
58
+ def is_private?
59
+ self.privatelayout
60
+ end
61
+
62
+ def is_hidden?
63
+ self.hidden_
64
+ end
65
+
66
+ end
67
+ end
@@ -0,0 +1,37 @@
1
+ module Web
2
+ # LayoutSets contain individual Layout s. They are either private or public.
3
+ class LayoutSet < ActiveRecord::Base
4
+ set_table_name :layoutset
5
+ set_primary_key :layoutsetid
6
+
7
+ # com.liferay.portal.model.LayoutSet
8
+ def liferay_class
9
+ 'com.liferay.portal.model.LayoutSet'
10
+ end
11
+
12
+ public
13
+
14
+ belongs_to :group,
15
+ :foreign_key => 'groupid'
16
+
17
+ belongs_to :company,
18
+ :foreign_key => 'companyid'
19
+
20
+ def is_public?
21
+ !self.privatelayout
22
+ end
23
+
24
+ def is_private?
25
+ self.privatelayout
26
+ end
27
+
28
+ def has_logo?
29
+ self.logo
30
+ end
31
+
32
+ #?
33
+ # has_one :resource,
34
+ # :foreign_key => 'primkey'
35
+
36
+ end
37
+ end
@@ -0,0 +1,43 @@
1
+ module Web
2
+ # Not all portlets are necessarily saved in the database.
3
+ class Portlet < ActiveRecord::Base
4
+ set_table_name :portlet
5
+ set_primary_key :id_
6
+
7
+ public
8
+
9
+ belongs_to :company,
10
+ :foreign_key => "companyid"
11
+
12
+ # primkey in resource_ table
13
+ def primkey(plid)
14
+ "#{plid}_LAYOUT_#{self.portletid}"
15
+ end
16
+
17
+ def resource(plid)
18
+ Resource.find_by_primkey(self.primkey(plid))
19
+ end
20
+
21
+ # all instances
22
+ def resources
23
+ # Resource.find_by_primkey(self.primkey)
24
+ # Resource.find(:all, :conditions => "primkey='#{self.primkey}'")
25
+ resources = []
26
+ ResourceCode.find(:all, :conditions => "name='#{portletid}'").each do |rc|
27
+ resources << Resource.find(:all, :conditions => "codeid='#{rc.id}'")
28
+ end
29
+
30
+ return resources.flatten
31
+ end
32
+
33
+ def is_active?
34
+ self.active_
35
+ end
36
+
37
+ # comply API with Web::Portlet.resource
38
+ def preferences_
39
+ ""
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,6 @@
1
+ module Web
2
+ # This model does not appear in the lportal database. This is created by a migration and contains the portlet id => name mappings.
3
+ class PortletName < ActiveRecord::Base
4
+ set_table_name :web_portlet_names
5
+ end
6
+ end