Commit c0fe0ee7 authored by Malte Sussdorff's avatar Malte Sussdorff

- Malte

parent 4ff9d97a
Pipeline #154 failed with stages
This diff is collapsed.
<?xml version="1.0" encoding="ISO-8859-1"?>
<message_catalog package_key="general-comments" package_version="5.2.0" locale="nl_ZA" charset="ISO-8859-1">
<msg key="Actions">Aksies</msg>
<msg key="Add_a_comment_to">'n Opmerking toevoeg aan</msg>
<msg key="Add_comment">Voeg opmerking toe</msg>
<msg key="Add_file_attachment">Voeg bylae toe</msg>
<msg key="Add_url_comment">Voeg opmerking aan URL toe</msg>
<msg key="Administer">Beheer</msg>
<msg key="all">alle</msg>
<msg key="approve">goedkeur</msg>
<msg key="Approved">Goedgekeur</msg>
<msg key="approved">goedgekeur</msg>
<msg key="Attach_a_web_link">Skakel naar die web byvoeg</msg>
<msg key="Attachments">Bylae</msg>
<msg key="Author">Outeur</msg>
<msg key="by">deur</msg>
<msg key="bytes">grepe</msg>
<msg key="Cancel">Kanseleer</msg>
<msg key="Comment">Opmerking:</msg>
<msg key="Comments">Opmerkingen</msg>
<msg key="Confirm">Bevestigen</msg>
<msg key="Confirm_comment">Opmerking bevestigen</msg>
<msg key="Confirm_comment_on">Opmerking bevestigen over </msg>
<msg key="delete">verwyder</msg>
<msg key="Delete_a_comment">Verwyder 'n opmerking</msg>
<msg key="Delete_attachment">Bijlage verwijderen</msg>
<msg key="details">details</msg>
<msg key="edit">bewerk</msg>
<msg key="Edit_comment">Bewerk opmerking</msg>
<msg key="Edit_comment_on">Bewerk opmerking op</msg>
<msg key="Edit_file_attachment">Bewerk lerbylae</msg>
<msg key="Edit_url_attachment">Bewerk URL-bylage</msg>
<msg key="edit_your_comment">(opmerking bewerken)</msg>
<msg key="Filename">Lernaam:</msg>
<msg key="Full_Comments">Gehele opmerkinge</msg>
<msg key="gc_is_not_mounted">Die module vir Algemene Opmerkingen (General Comments) is nie aangekoppel nie</msg>
<msg key="General_Comments">Algemene Opmerkingen</msg>
<msg key="Go_back_to_comment">Ga terug naar opmerking</msg>
<msg key="Has_live_version">Openbare versie is aanwezig</msg>
<msg key="HTML">HTML</msg>
<msg key="ID">ID#</msg>
<msg key="if_general_comments_not_mounted">As &lt;code&gt;general-comments&lt;/code&gt; nie geaktiveer is nie en daar tog 'nn beroep word gedoen op &lt;code&gt;general_comments_get_comments&lt;/code&gt; of &lt;code&gt;general_comments_create_link&lt;/code&gt;, dan word daar 'n fout geregistreer. Dit gebeur omdat hierdie kode skakels (hyperlinks) gebruik, wat sou moet refereer na genstalleerde &lt;code&gt;general-comments&lt;/code&gt; instansies.
</msg>
<msg key="Image_attachment">Bylae by beeld</msg>
<msg key="Label">Label:</msg>
<msg key="last_24_hours">laatste 24 uur</msg>
<msg key="Last_Modified">Laatste wysiging</msg>
<msg key="last_month">afgelope maand</msg>
<msg key="last_week">afgelope week</msg>
<msg key="live">(live)</msg>
<msg key="lt_Add_a_file_attachment">Voeg ler as bylae aan opmerking toe</msg>
<msg key="lt_Add_url_attachment_to">Webkoppeling als bijlage aan opmerking toevoegen</msg>
<msg key="lt_approve_this_revision">keur hierdie revisie goed</msg>
<msg key="lt_Attach_a_file_or_pict">Voeg ler of foto toe</msg>
<msg key="lt_Attaching_files_to_co">Functie om bestanden als bijlage aan opmerkingen toe te kunnen voegen is uitgeschakeld. </msg>
<msg key="lt_Attaching_links_to_co">Functie om webkoppelingen als bijlage aan opmerkingen toe te kunnen voegen is uitgeschakeld. </msg>
<msg key="lt_Current_values_for_Ge">Huidige instellinge vir die module Algemene Opmerkingen (General Comments).</msg>
<msg key="lt_Do_you_really_wish_to">Die volgende opmerking met bylaes eg verwyder?</msg>
<msg key="lt_Do_you_really_wish_to_1">Wil u hierdie bylae eg verwyder?</msg>
<msg key="lt_Edit_file_attachment_">Lerbylage by opmerking wysig</msg>
<msg key="lt_Edit_url_attachment_o">Wysig URL-bylae op opmerking</msg>
<msg key="lt_Example_httpwwwarsdig">Voorbeeld: http://www.arsdigita.com/</msg>
<msg key="lt_General_Comments_Admi">Beheer van Algemene Opmerkingen</msg>
<msg key="lt_Go_back_to_where_you_">Gaan terug</msg>
<msg key="lt_has_chosen_to_limit_a">het besluit om bylaes te limiteer tot</msg>
<msg key="lt_Here_is_how_your_comm">Die opmerking sal daar so uit sien:</msg>
<msg key="lt_I_would_like_to_uploa">'n Ler of een webskakel aan die opmerking toevoeg</msg>
<msg key="lt_No_comments_available">Geen opmerkinge beschikbaar nie</msg>
<msg key="lt_no_gc_package_instanc">geen instance van Algemene Opmerkingen module (General Comments)</msg>
<msg key="lt_Note_if_the_text_abov">Toeligting:
as die paragraafindeling van bostaande teks verstoor is, dan had u waarskynlik beter &quot;Platte Tekst&quot; in plaas van &quot;HTML&quot; gekies.
Gebruik de knop &quot;Terug&quot; van uw browser om dit te corrigeren. </msg>
<msg key="lt_Note_if_the_text_abov_1">Toeligting:
as bostaande teks HTML-tags bevat, dan had u waarskynlik &quot;HTML&quot; moet kies in plaas van &quot;Platte Teks&quot;.
Gebruik die knop &quot;Terug&quot; van u blaaier om dit te korrigeer. </msg>
<msg key="lt_Test_page_for_General">Testbladsy vir Algemene Opmerkinge</msg>
<msg key="lt_The_comment_id_does_n">Die comment_id verwys nie na 'n geldige opmerking nie. </msg>
<msg key="lt_This_revision_is_live">Hierdie versie is openbaar.</msg>
<msg key="lt_This_revision_is_not_">Hierdie versie is nie openbaar nie.</msg>
<msg key="lt_Use_the_Browse_button">Gebruik die knop \&quot;Blader\&quot; om 'n bestand te vind en kliek dan op \&quot;Open\&quot;</msg>
<msg key="lt_Your_file_is_too_larg">Die ler is te groot.</msg>
<msg key="lt_Your_file_is_zero-len">Die omvang van die ler is nul.
Dit kan wees dat er 'n ler aangebied is wat nie bestaan nie of daar het iets misgegaan tydens die oordrag. </msg>
<msg key="no_attachments">geen bylae beschikbaar nie</msg>
<msg key="none">geen</msg>
<msg key="not_set">nie ingestel nie</msg>
<msg key="Num">Nr</msg>
<msg key="on">op</msg>
<msg key="Plain_text">Platte teks</msg>
<msg key="Proceed">Doorgaan</msg>
<msg key="reject">weier</msg>
<msg key="reject_this_revision">Hierdie versie weier</msg>
<msg key="Revisions">Versies</msg>
<msg key="Status">Status</msg>
<msg key="test">test</msg>
<msg key="Text_above_is">Teks hierbo is</msg>
<msg key="The_publisher_of">Die eindverantwoordelike van</msg>
<msg key="Title">Titel:</msg>
<msg key="Title_1">Titel</msg>
<msg key="unapproved">nie beoordeel nie</msg>
<msg key="URL">URL:</msg>
<msg key="View_comment">Bekyk opmerking</msg>
<msg key="View_comment_on">Bekyk opmerking op</msg>
<msg key="view_details">Bekyk details</msg>
<msg key="you">u</msg>
</message_catalog>
<?xml version="1.0"?>
<!-- Generated by the OpenACS Package Manager -->
<package key="general-comments" url="http://openacs.org/repository/apm/packages/general-comments" type="apm_application">
<package key="general-comments" url="http://www.arsdgita.com/acs-repository/apm/packages/general-comments" type="apm_application">
<package-name>General Comments</package-name>
<pretty-plural>General Comments</pretty-plural>
<initial-install-p>f</initial-install-p>
<singleton-p>t</singleton-p>
<auto-mount>comments</auto-mount>
<version name="4.6.1" url="http://openacs.org/repository/download/apm/general-comments-4.6.1.apm">
<owner url="mailto:dhogaza@pacifier.com">Don Baccus</owner>
<version name="5.2.0" url="http://openacs.org/repository/download/apm/general-comments-5.2.0.apm">
<owner url="mailto:dave@thedesignexperience.org">Dave Bauer</owner>
<owner url="mailto:dhogaza@pacifier.com">Don Baccus</owner>
<summary>Service to provide comment entry and display on objects.</summary>
<release-date>2004-11-29</release-date>
<release-date>2006-02-12</release-date>
<vendor url="http://openacs.org">OpenACS</vendor>
<description format="text/html">General comments provides the widgets and UI to support commentability on any object. There is also an admin interface to edit/hide/delete comments.</description>
<maturity>0</maturity>
<provides url="general-comments" version="4.6.1"/>
<requires url="acs-content-repository" version="5.0.0b4"/>
<requires url="acs-kernel" version="5.0.0b4"/>
<requires url="acs-messaging" version="5.0.0b4"/>
<provides url="general-comments" version="5.2.0"/>
<requires url="acs-content-repository" version="5.2.1d2"/>
<requires url="acs-kernel" version="5.2.1d2"/>
<requires url="acs-messaging" version="5.2.1d2"/>
<callbacks>
</callbacks>
......
......@@ -34,27 +34,12 @@ comment on column general_comments.category is '
create index general_comments_object_id_idx on general_comments (object_id);
-- define and grant privileges
declare
registered_users acs_objects.object_id%TYPE;
default_context acs_objects.object_id%TYPE;
begin
-- retreive object ids for magic objects
registered_users := acs.magic_object_id('registered_users');
default_context := acs.magic_object_id('default_context');
-- create privileges
acs_privilege.create_privilege('general_comments_create');
-- associte privileges to global privileges
acs_privilege.add_child('create','general_comments_create');
-- allow registered users to create comments
acs_permission.grant_permission (
object_id => default_context,
grantee_id => registered_users,
privilege => 'general_comments_create'
);
acs_privilege.add_child('annotate', 'general_comments_create');
end;
/
......
......@@ -37,28 +37,13 @@ create index general_comments_object_id_idx on general_comments (object_id);
create function inline_0 ()
returns integer as '
-- define and grant privileges
declare
registered_users acs_objects.object_id%TYPE;
default_context acs_objects.object_id%TYPE;
begin
-- retreive object ids for magic objects
registered_users := acs__magic_object_id(''registered_users'');
default_context := acs__magic_object_id(''default_context'');
-- create privileges
PERFORM acs_privilege__create_privilege(''general_comments_create'', null, null);
-- associte privileges to global privileges
PERFORM acs_privilege__add_child(''create'',''general_comments_create'');
-- allow registered users to create comments
PERFORM acs_permission__grant_permission (
default_context,
registered_users,
''general_comments_create''
);
PERFORM acs_privilege__add_child(''create'', ''general_comments_create'');
return 0;
end;' language 'plpgsql';
......
......@@ -11,8 +11,7 @@
r.mime_type,
o.creation_user,
acs_object.name(o.creation_user) as author,
to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date,
to_char(o.creation_date, 'Month DD, YYYY HH12:MI PM') as pretty_date2
o.creation_date
$content_select
from general_comments g,
cr_revisions r,
......
......@@ -11,8 +11,7 @@
r.mime_type,
o.creation_user,
acs_object__name(o.creation_user) as author,
to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date,
to_char(o.creation_date, 'Month DD, YYYY HH12:MI PM') as pretty_date2
o.creation_date
$content_select
from general_comments g,
cr_revisions r,
......@@ -68,7 +67,7 @@
:comment_mime_type, -- 8 p_mime_type
NULL, -- 9 p_text
NULL, -- empty_blob(), -- 10 p_data
0, -- 11 p_parent_id
-4, -- 11 p_parent_id
:context_id, -- 12 p_context_id
:user_id, -- 13 p_creation_user
:creation_ip, -- 14 p_creation_ip
......
......@@ -28,7 +28,13 @@ ad_proc general_comment_new {
-category:required
-content:required
} {
Creates a comment and attaches it to a given object ID
@return
@error
} {
db_transaction {
db_exec_plsql insert_comment { }
......@@ -59,6 +65,7 @@ ad_proc general_comment_new {
ad_proc -public general_comments_get_comments {
{ -print_content_p 0 }
{ -print_attachments_p 0 }
{ -print_user_info_p 1}
{ -context_id "" }
{ -my_comments_only_p 0 }
object_id
......@@ -102,9 +109,10 @@ ad_proc -public general_comments_get_comments {
-parameter "AllowDisplayMyCommentsLinkP" \
-default t]
if {[string is true $my_comments_only_p] && \
[string is true $allow_my_comments_only_p]} {
set my_comments_clause "and o.creation_user = :user_id"
if {[string is true $my_comments_only_p]
&& [string is true $allow_my_comments_only_p]} {
set user_id [ad_conn user_id]
set my_comments_clause "and o.creation_user = :user_id "
} else {
set my_comments_clause ""
}
......@@ -125,10 +133,12 @@ ad_proc -public general_comments_get_comments {
set html ""
db_foreach get_comments {} {
set pretty_date [lc_time_fmt $creation_date %x]
set pretty_date2 [lc_time_fmt $creation_date "%q %X"]
# call on helper proc to print out comment
append html [general_comments_print_comment $comment_id $title $mime_type \
$creation_user $author $pretty_date $pretty_date2 $content \
$print_content_p $print_attachments_p $package_url $return_url]
$print_content_p $print_attachments_p $package_url $return_url $print_user_info_p]
}
return $html
}
......@@ -146,6 +156,7 @@ ad_proc -private general_comments_print_comment {
print_attachments_p
package_url
return_url
print_user_info_p
} {
Helper proc to format and print out a single comment.
@param comment_id The id of the comment.
......@@ -160,6 +171,7 @@ ad_proc -private general_comments_print_comment {
@param print_attachments_p Pass in 1 to print out attachments of comments.
@param package_url The url to the mounted general-comments package instance.
@param return_url A url for the user to return to after viewing a comment.
@param print_user_info_p Pass 1 in to print out user name and time of entry.
} {
# -- create query statements to retrieve attachments
......@@ -185,9 +197,9 @@ ad_proc -private general_comments_print_comment {
append attachments_html "<li>$title "
if { $mime_type == "image_gif" || $mime_type == "image/jpeg" } {
append attachments_html "(<a href=\"${package_url}view-image?image_id=$item_id&return_url=$return_url\">$name</a>)\n"
append attachments_html "(<a href=\"[ad_quotehtml ${package_url}view-image?image_id=$item_id&return_url=$return_url]\">$name</a>)\n"
} else {
append attachments_html "(<a href=\"${package_url}file-download?item_id=$item_id\">$name</a>)\n"
append attachments_html "(<a href=\"[ad_quotehtml ${package_url}file-download?item_id=$item_id]\">$name</a>)\n"
}
}
......@@ -195,15 +207,20 @@ ad_proc -private general_comments_print_comment {
select i.item_id, e.label, e.url
from cr_items i, cr_extlinks e
where i.parent_id = :comment_id and e.extlink_id = i.item_id" {
append attachments_html "<li><a href=\"$url\">$label</a>\n"
append attachments_html "<li><a href=\"[ad_quotehtml $url]\">$label</a>\n"
}
if { ![empty_string_p $attachments_html] } {
append html "<h5>[_ general-comments.Attachments]</h5>\n<ul>\n$attachments_html</ul>\n"
}
}
append html "<p>-- <a href=\"/shared/community-member?user_id=$creation_user\">$author</a> [_ general-comments.on] $pretty_date2 (<a href=\"${package_url}view-comment?[export_url_vars comment_id return_url]\">[_ general-comments.view_details]</a>)</p>\n"
append html "<p>-- <a href=\"[ad_quotehtml /shared/community-member?user_id=$creation_user]\">$author</a> [_ general-comments.on] $pretty_date2 (<a href=\"[ad_quotehtml ${package_url}view-comment?[export_url_vars comment_id return_url]]\">[_ general-comments.view_details]</a>)</p>\n"
} else {
append html "<li><a href=\"${package_url}view-comment?[export_url_vars comment_id return_url]\">$title</a> [_ general-comments.by] <a href=\"/shared/community-member?user_id=$creation_user\">$author</a> [_ general-comments.on] $pretty_date<br>\n"
append html "<li><a href=\"[ad_quotehtml ${package_url}view-comment?[export_url_vars comment_id return_url]]\">$title</a>"
if {$print_user_info_p} {
append html " [_ general-comments.by] <a href=\"[ad_quotehtml /shared/community-member?user_id=$creation_user]\">$author</a> [_ general-comments.on] $pretty_date<br>\n"
} else {
append html "<br>\n"
}
}
return $html
......@@ -212,7 +229,7 @@ ad_proc -private general_comments_print_comment {
ad_proc -public general_comments_create_link {
-object_name
{ -link_text {Add a comment} }
{ -link_text #general-comments.Add_comment# }
-context_id
{ -category {} }
{ -link_attributes "" }
......@@ -241,7 +258,7 @@ ad_proc -public general_comments_create_link {
if { ![info exists object_name] } { set object_name [acs_object_name $object_id] }
if { ![info exists context_id] } { set context_id $object_id }
set html "<a href=\"${package_url}comment-add?[export_url_vars object_id object_name return_url context_id category]\" $link_attributes>$link_text</a>"
set html "<a href=\"[ad_quotehtml ${package_url}comment-add?[export_url_vars object_id object_name return_url context_id category]]\" $link_attributes>$link_text</a>"
return $html
}
......@@ -288,7 +305,7 @@ ad_proc -deprecated get_comments {object_id return_url} {
o.object_id = g.comment_id and
p.person_id = o.creation_user
order by creation_date" {
append html "<li><a href=\"${package_url}view-comment?[export_url_vars comment_id return_url]\">$title</a> by $author, $creation_date<br>\n"
append html "<li><a href=\"[ad_quotehtml ${package_url}view-comment?[export_url_vars comment_id return_url]]\">$title</a> by $author, $creation_date<br>\n"
}
return "$html"
}
......@@ -306,7 +323,7 @@ ad_proc -deprecated create_link {object_id object_name return_url link_text {con
# get the package url
set package_url [general_comments_package_url]
set html "<a href=\"${package_url}comment-add?[export_url_vars object_id object_name return_url context_id category]\">$link_text</a>"
set html "<a href=\"[ad_quotehtml ${package_url}comment-add?[export_url_vars object_id object_name return_url context_id category]]\">$link_text</a>"
return $html
}
......
......@@ -16,7 +16,7 @@
:comment_mime_type, -- 8 p_mime_type
NULL, -- 9 p_text
NULL, -- empty_blob(), -- 10 p_data
0, -- 11 p_parent_id
-4, -- 11 p_parent_id
:context_id, -- 12 p_context_id
:user_id, -- 13 p_creation_user
:creation_ip, -- 14 p_creation_ip
......
......@@ -19,8 +19,14 @@ ad_page_contract {
{ attach_p "f" }
}
# This authentication actually is not necessary anymore due to the fact that we already check for the permission
# afterwards, so it should be enough to query the user_id from the connection to allow anonymous users who have
# create permissions to access the site.
# authenticate the user
set user_id [ad_maybe_redirect_for_registration]
# set user_id [auth::require_login]
set user_id [ad_conn user_id]
# check to see if the user can create comments on this object
ad_require_permission $object_id general_comments_create
......
......@@ -19,7 +19,7 @@ ad_page_contract {
ad_require_permission $comment_id write
# authenticate the user
set user_id [ad_verify_and_get_user_id]
set user_id [ad_conn user_id]
# insert the revision into the database
set is_live [ad_parameter AutoApproveCommentsP {general-comments} {t}]
......
# /packages/general-comments/www/admin/delete-2.tcl
ad_page_contract {
Deletes a comment and its attachments
@param comment_id The id of the comment to delete
@author Phong Nguyen (phong@arsdigita.com)
@author Pascal Scheffers (pascal@scheffers.net)
@creation-date 2000-10-12
@cvs-id $Id$
} {
comment_id:integer,notnull
{ return_url {} }
}
# There is a bug in content_item.delete that results in
# referential integrity violations when deleting a content
# item that has an image attachment. This is a temporary fix
# until ACS 4.1 is released.
db_dml delete_image_attachments {
delete from images
where image_id in (select latest_revision
from cr_items
where parent_id = :comment_id)
}
# Only need to call on acs_message.delete since
# deletion of row from general_comments table
# relies on "on delete cascade"
db_exec_plsql delete_comment {
select acs_message__delete(:comment_id) from dual
}
ad_returnredirect $return_url
<?xml version="1.0"?>
<queryset>
<fullquery name="delete_image_attachments">
<querytext>
delete from images
where image_id in (select latest_revision
from cr_items
where parent_id = :comment_id)
</querytext>
</fullquery>
</queryset>
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
#general-comments.lt_Do_you_really_wish_to#
<blockquote>
<b>@title@</b> (<a href="../view-comment?comment_id=@comment_id@">#general-comments.details#</a>)<br><br>
<if @mime_type@ eq text/plain>
<%= [util_convert_plaintext_to_html $content] %>
</if>
<else>
@content@
</else>
<br><br>-- <a href="/shared/community-member?user_id=@creation_user@">@author@</a>
(@pretty_date@)
</blockquote>
<center>
<table>
<tr>
<td>
<form action=delete-2 method=post>
<%= [export_form_vars comment_id return_url] %>
<input type=submit name=submit value="#general-comments.Proceed#">
</form>
</td>
<td>
<form action="@return_url@">
<input type=submit name=submit value="#general-comments.Cancel#">
</form>
</td
</tr>
</table>
</center>
</form>
# /packages/general-comments/www/admin/delete.tcl
ad_page_contract {
Delete a comment
@param comment_id The id of the comment to delete
@author Phong Nguyen (phong@arsdigita.com)
@author Pascal Scheffers (pascal@scheffers.net)
@creation-date 2000-10-12
@cvs-id $Id$
} {
comment_id:integer,notnull
{ return_url {}}
} -properties {
page_title:onevalue
context:onevalue
title:onevalue
comment_id:onevalue
mime_type:onevalue
content:onevalue
creation_user:onevalue
author:onevalue
pretty_date:onevalue
return_url:onevalue
}
permission::require_permission -party_id [ad_conn user_id] -object_id $comment_id -privilege "write"
set revision_id [content::item::get_best_revision -item_id $comment_id]
# get data from database
set sql "
select r.title,
r.content,
r.mime_type,
o.creation_user,
to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date
from acs_objects o,
cr_revisions r,
general_comments g
where g.comment_id = :comment_id and
g.comment_id = o.object_id and
r.revision_id = $revision_id"
if { ![db_0or1row get_comment $sql] } {
ad_return_complaint 1 "[_ general-comments.lt_The_comment_id_does_n]"
}
set author [person::name -person_id $creation_user]
set page_title "[_ general-comments.Delete_a_comment]"
set context [list "[_ general-comments.Delete_a_comment]"]
ad_return_template
......@@ -40,7 +40,7 @@ ad_page_contract {
# authenticate the user
set user_id [ad_verify_and_get_user_id]
set user_id [ad_conn user_id]
# check to see if the user can create comments
ad_require_permission $parent_id write
......
......@@ -12,7 +12,7 @@
o.creation_user,
decode(i.live_revision,null,0,1) as live_version_p,
decode(i.live_revision,r.revision_id,1,0) as approved_p,
to_char(o.creation_date, 'MM-DD-YYYY HH12:MI:AM') as pretty_date
o.creation_date
from general_comments g,
cr_items i,
cr_revisions r,
......
......@@ -12,7 +12,6 @@
o.creation_user,
case when i.live_revision=null then 0 else 1 end as live_version_p,
case when i.live_revision=r.revision_id then 0 else 1 end as approved_p,
to_char(o.creation_date, 'MM-DD-YYYY HH12:MI:AM') as pretty_date,
o.creation_date
from general_comments g,
cr_items i,
......
......@@ -17,7 +17,7 @@ ad_page_contract {
}
# authenticate the user
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
# check for admin privileges
set package_id [ad_conn package_id]
......@@ -45,44 +45,23 @@ set dimensional_bar [ad_dimensional $dimensional]
# ad_table definition
set table_def [list \
[list num "[_ general-comments.Num]" {} {<td>$Tcount</td>}] \
[list comment_id "[_ general-comments.ID]" {} \
{<td><a href="view-comment?comment_id=$comment_id">$comment_id</a></td>}] \
[list title "[_ general-comments.Title_1]" {} {}] \
[list approved_p "[_ general-comments.Approved]" {} 01] \
[list live_version_p "[_ general-comments.Has_live_version]" {} 01] \
[list pretty_date "[_ general-comments.Last_Modified]" {creation_date $order} {}] \
[list num "[_ general-comments.Num]" {} {<td>$Tcount</td>}] \
[list comment_id "[_ general-comments.ID]" {} \
{<td><a href="view-comment?comment_id=$comment_id">$comment_id</a></td>}] \
[list title "[_ general-comments.Title_1]" {} {}] \
[list approved_p "[_ general-comments.Approved]" {} 01] \
[list live_version_p "[_ general-comments.Has_live_version]" {} 01] \
[list pretty_date "[_ general-comments.Last_Modified]" {creation_date $order} {<td>[lc_time_fmt $creation_date "%x %X"]</td>}] \
]
# sql to retrieve comments
set sql "
select g.comment_id,
r.title,
acs_object.name(o.creation_user) as author,
o.creation_user,
decode(i.live_revision,null,0,1) as live_version_p,
decode(i.live_revision,r.revision_id,1,0) as approved_p,
to_char(o.creation_date, 'MM-DD-YYYY HH12:MI:AM') as pretty_date
from general_comments g,
cr_items i,
cr_revisions r,
acs_objects o
where g.comment_id = i.item_id and
r.revision_id = o.object_id and
r.revision_id = content_item.get_latest_revision(g.comment_id) and
o.creation_user = :user_id
[ad_dimensional_sql $dimensional]
[ad_order_by_from_sort_spec $orderby $table_def]
"
# create the table to display the comments
set bind_ns_set [ad_tcl_vars_to_ns_set user_id]
set extra_var_list [list return_url $return_url]
set comments_table [ad_table -Torderby $orderby \
-Tmissing_text "<i>[_ general-comments.lt_No_comments_available]</i>" \
-Textra_vars $extra_var_list \
-bind $bind_ns_set \
comments_select $sql $table_def]
-Tmissing_text "<i>[_ general-comments.lt_No_comments_available]</i>" \
-Textra_vars $extra_var_list \
-bind $bind_ns_set \
comments_select {} $table_def]
set page_title "[_ general-comments.General_Comments]"
set context {}
......
......@@ -23,7 +23,7 @@ ad_page_contract {
}
# authenticate the user
set user_id [ad_verify_and_get_user_id]
set user_id [ad_conn user_id]
# check to see if the user can add an attachment
ad_require_permission $parent_id write
......
......@@ -16,7 +16,7 @@ ad_page_contract {
}
# authenticate the user
set user_id [ad_verify_and_get_user_id]
set user_id [ad_conn user_id]
# check to see if the user can edit this attachment
ad_require_permission $attach_id write
......
......@@ -61,19 +61,4 @@
</fullquery>
<fullquery name="get_revisions">
<querytext>
select r.revision_id,
to_char(o.creation_date, 'MM-DD-YY HH24:MI:SS') as revision_date
from cr_revisions r,
acs_objects o
where r.item_id = :comment_id and
o.object_id = r.revision_id
order by o.creation_date desc
</querytext>
</fullquery>
</queryset>
......@@ -60,20 +60,4 @@
</querytext>
</fullquery>
<fullquery name="get_revisions">
<querytext>
select r.revision_id,
to_char(o.creation_date, 'MM-DD-YY HH24:MI:SS') as revision_date
from cr_revisions r,
acs_objects o
where r.item_id = :comment_id and
o.object_id = r.revision_id
order by o.creation_date desc
</querytext>
</fullquery>
</queryset>
......@@ -115,15 +115,9 @@ db_multirow links get_links {
where i.parent_id = :comment_id and
e.extlink_id = i.item_id
}
db_multirow revisions get_revisions {
select r.revision_id,
to_char(o.creation_date, 'MM-DD-YY HH24:MI:SS') as revision_date
from cr_revisions r,
acs_objects o
where r.item_id = :comment_id and
o.object_id = r.revision_id
order by o.creation_date desc
db_multirow revisions get_revisions {*SQL*} {
set revision_date [lc_time_fmt $revision_date %c]
}
set allow_file_p [ad_parameter AllowFileAttachmentsP {general-comments} {t}]
......
......@@ -38,4 +38,18 @@
</fullquery>
</queryset>
<fullquery name="get_revisions">
<querytext>
select r.revision_id,
o.creation_date as revision_date
from cr_revisions r,
acs_objects o
where r.item_id = :comment_id and
o.object_id = r.revision_id
order by o.creation_date desc
</querytext>
</fullquery>
</queryset></queryset>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment