| |
103 |
103 |
|
| |
104 |
104 |
if v_object_type = ''content_symlink'' then |
| |
105 |
105 |
select target_id into v_item_id |
| |
106 |
106 |
from cr_symlinks |
| |
107 |
107 |
where symlink_id = p_item_id; |
| |
108 |
108 |
return etp__get_description(v_item_id, null); |
| |
109 |
109 |
end if; |
| |
110 |
110 |
|
| |
111 |
111 |
if v_object_type = ''content_item'' then |
| |
112 |
112 |
select r.description into v_description |
| |
113 |
113 |
from cr_items i, cr_revisions r |
| |
114 |
114 |
where i.item_id = v_item_id |
| |
115 |
115 |
and i.live_revision = r.revision_id; |
| |
116 |
116 |
return v_description; |
| |
117 |
117 |
end if; |
| |
118 |
118 |
|
| |
119 |
119 |
return null; |
| |
120 |
120 |
|
| |
121 |
121 |
end;' language 'plpgsql'; |
| |
122 |
122 |
|
| |
|
123 |
create or replace function etp__get_title(integer, varchar) |
| |
|
124 |
returns varchar as ' |
| |
|
125 |
declare |
| |
|
126 |
p_item_id alias for $1; |
| |
|
127 |
p_revision_title alias for $2; |
| |
|
128 |
v_item_id integer; |
| |
|
129 |
v_title varchar(400); |
| |
|
130 |
v_object_type varchar; |
| |
|
131 |
begin |
| |
|
132 |
if p_revision_title is not null then |
| |
|
133 |
return p_revision_title; |
| |
|
134 |
end if; |
| |
|
135 |
|
| |
|
136 |
select object_type from acs_objects into v_object_type |
| |
|
137 |
where object_id = p_item_id; |
| |
|
138 |
|
| |
|
139 |
if v_object_type = ''content_folder'' then |
| |
|
140 |
select r.title |
| |
|
141 |
into v_title |
| |
|
142 |
from cr_items i, cr_revisions r |
| |
|
143 |
where i.parent_id = p_item_id |
| |
|
144 |
and i.name = ''index'' |
| |
|
145 |
and i.live_revision = r.revision_id; |
| |
|
146 |
return v_title; |
| |
|
147 |
end if; |
| |
|
148 |
|
| |
|
149 |
if v_object_type = ''content_extlink'' then |
| |
|
150 |
select label into v_title |
| |
|
151 |
from cr_extlinks |
| |
|
152 |
where extlink_id = p_item_id; |
| |
|
153 |
return v_title; |
| |
|
154 |
end if; |
| |
|
155 |
|
| |
|
156 |
if v_object_type = ''content_symlink'' then |
| |
|
157 |
select target_id into v_item_id |
| |
|
158 |
from cr_symlinks |
| |
|
159 |
where symlink_id = p_item_id; |
| |
|
160 |
return etp__get_title(v_item_id, null); |
| |
|
161 |
end if; |
| |
|
162 |
|
| |
|
163 |
if v_object_type = ''content_item'' then |
| |
|
164 |
select r.title into v_title |
| |
|
165 |
from cr_items i, cr_revisions r |
| |
|
166 |
where i.item_id = v_item_id |
| |
|
167 |
and i.live_revision = r.revision_id; |
| |
|
168 |
return v_title; |
| |
|
169 |
end if; |
| |
|
170 |
|
| |
|
171 |
return null; |
| |
|
172 |
|
| |
|
173 |
end; |
| |
|
174 |
' language 'plpgsql'; |
| |
|
175 |
|
| |
123 |
176 |
/i ../edit-this-page-sc-create.sql |