+
+ @context;noquote@
+ @title;noquote@
+
+
+
+ #news.lt_Could_not_find_the_re#
+
+
+
+
+
+ #news.Comments#
+ @comments;noquote@
+
+
+
+ - @comment_link;noquote@
+
+ - @edit_link;noquote@
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/news/lib/item.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news/lib/item.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/news/lib/item.tcl 26 Mar 2005 13:49:54 -0000 1.1
@@ -0,0 +1,133 @@
+# /packages/news/www/item.tcl
+
+ad_page_contract {
+
+ Page to view one item (live or archived) in its active revision
+ @author stefan@arsdigita.com
+ @creation-date 2000-12-20
+ @cvs-id $Id: item.tcl,v 1.1 2005/03/26 13:49:54 jeffd Exp $
+
+} {
+
+ item_id:integer,notnull
+
+} -properties {
+ title:onevalue
+ context:onevalue
+ item_exist_p:onevalue
+ publish_title:onevalue
+ publish_lead:onevalue
+ publish_date:onevalue
+ publish_body:onevalue
+ publish_image:onevalue
+ html_p:onevalue
+ creator_link:onevalue
+ comments:onevalue
+ comment_link:onevalue
+}
+
+
+set user_id [ad_conn untrusted_user_id]
+
+permission::require_permission \
+ -object_id $item_id \
+ -party_id $user_id \
+ -privilege read
+
+
+# live view of a news item in its active revision
+set item_exist_p [db_0or1row one_item "
+select item_id,
+ live_revision,
+ publish_title,
+ publish_lead,
+ html_p,
+ publish_date,
+ '' || item_creator || '' as creator_link
+from news_items_live_or_submitted
+where item_id = :item_id"]
+
+
+if { $item_exist_p } {
+
+ # workaround to get blobs with >4000 chars into a var, content.blob_to_string fails!
+ # when this'll work, you get publish_body by selecting 'publish_body' directly from above view
+ #
+ # RAL: publish_body is already snagged in the 1st query above for postgres.
+ #
+ set get_content [db_map get_content]
+ if {![string match "" $get_content]} {
+ set publish_body [db_string get_content "select content
+ from cr_revisions
+ where revision_id = :live_revision"]
+ }
+
+ # text-only body
+ if {[info exists html_p] && [string equal $html_p "f"]} {
+ set publish_body [ad_text_to_html -- $publish_body]
+ }
+
+ if { [ad_parameter SolicitCommentsP "news" 0]} {
+
+ if {[permission::permission_p -object_id $item_id -privilege general_comments_create] } {
+ set comment_link [general_comments_create_link $item_id "[ad_conn package_url]item?item_id=$item_id"]
+
+ } else {
+ set comment_link "Log in to add a comment"
+ }
+
+ set comments [general_comments_get_comments -print_content_p 1 -print_attachments_p 1 \
+ $item_id "[ad_conn package_url]item?item_id=$item_id"]
+
+ } else {
+ set comment_link ""
+ set comments ""
+ }
+
+ # get image info, if any
+ set image_id [news_get_image_id $item_id]
+ if {![empty_string_p $image_id]} {
+ set publish_image "image/$image_id"
+ } else {
+ set publish_image {}
+ }
+
+ if {[permission::permission_p -object_id $item_id -privilege write] } {
+ set edit_link "Revise"
+ } else {
+ set edit_link ""
+ }
+
+
+ set title $publish_title
+ set context [list $title]
+ set publish_title {}
+
+} else {
+ set context {}
+ set title "[_ news.Error]"
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/news/sql/postgresql/news-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/postgresql/news-package-create.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/news/sql/postgresql/news-package-create.sql 24 Feb 2005 18:03:04 -0000 1.1
+++ openacs-4/packages/news/sql/postgresql/news-package-create.sql 26 Mar 2005 13:49:55 -0000 1.2
@@ -7,6 +7,8 @@
-- OpenACS Port: Robert Locke (rlocke@infiniteinfo.com)
-- *** PACKAGE NEWS, plsql to create content_item ***
+select define_function_args ('news__new','item_id,locale,publish_date,text,nls_language,title,mime_type;text/plain,package_id,archive_date,approval_user,approval_date,approval_ip,relation_tag,creation_ip,creation_user,is_live_p;f,lead');
+
create or replace function news__new (integer,varchar,timestamptz,text,varchar,varchar,
varchar,integer,timestamptz,integer,timestamptz,varchar,varchar,
varchar,integer,boolean, varchar)
@@ -37,7 +39,7 @@
p_creation_user alias for $15; -- default null
--
p_is_live_p alias for $16; -- default ''f''
- p_lead alias for $17; -- default ''f''
+ p_lead alias for $17;
v_news_id integer;
v_item_id integer;
@@ -47,25 +49,23 @@
v_name varchar;
v_log_string varchar;
begin
- select content_item__get_id(''news'',null,''f'')
- into v_parent_id
- from dual;
+ select content_item__get_id(''news'',null,''f'')
+ into v_parent_id
+ from dual;
--
-- this will be used for 2xClick protection
if p_item_id is null then
- select acs_object_id_seq.nextval
- into v_id
+ select acs_object_id_seq.nextval
+ into v_id
from dual;
- else
+ else
v_id := p_item_id;
- end if;
+ end if;
--
- select ''news'' || to_char(current_timestamp,''YYYYMMDD'') || v_id
- into v_name
- from dual;
- --
- v_log_string := ''initial submission'';
- --
+ v_name := ''news-'' || to_char(current_timestamp,''YYYYMMDD'') || ''-'' || v_id;
+ --
+ v_log_string := ''initial submission'';
+ --
v_item_id := content_item__new(
v_name, -- name
v_parent_id, -- parent_id
@@ -77,15 +77,18 @@
p_creation_ip, -- creation_ip
''content_item'', -- item_subtype
''news'', -- content_type
- null, -- title
+ p_title, -- title
null, -- description
p_mime_type, -- mime_type
p_nls_language, -- nls_language
+ null, -- text
null, -- data
- ''text'' -- storage_type
- -- relation tag is not used by any callers or any
- -- implementations of content_item__new
+ null, -- relation_tag
+ p_is_live_p, -- live_p
+ ''text'', -- storage_type
+ p_package_id -- package_id
);
+
v_revision_id := content_revision__new(
p_title, -- title
v_log_string, -- description
@@ -99,38 +102,41 @@
p_creation_user, -- creation_user
p_creation_ip -- creation_ip
);
- insert into cr_news
- (news_id,
+
+ insert into cr_news
+ (news_id,
lead,
- package_id,
+ package_id,
archive_date,
- approval_user,
- approval_date,
+ approval_user,
+ approval_date,
approval_ip)
values
- (v_revision_id,
+ (v_revision_id,
p_lead,
- p_package_id,
+ p_package_id,
p_archive_date,
- p_approval_user,
- p_approval_date,
+ p_approval_user,
+ p_approval_date,
p_approval_ip);
-- make this revision live when immediately approved
if p_is_live_p = ''t'' then
- update
+ update
cr_items
set
live_revision = v_revision_id,
publish_status = ''ready''
- where
+ where
item_id = v_item_id;
end if;
v_news_id := v_revision_id;
+
return v_news_id;
end;
' language 'plpgsql';
+
-- deletes a news item along with all its revisions and possible attachements
create or replace function news__delete (integer)
returns integer as '
Index: openacs-4/packages/news/tcl/news-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs.tcl,v
diff -u -r1.17 -r1.18
--- openacs-4/packages/news/tcl/news-procs.tcl 24 Feb 2005 18:03:05 -0000 1.17
+++ openacs-4/packages/news/tcl/news-procs.tcl 26 Mar 2005 13:49:55 -0000 1.18
@@ -1,9 +1,7 @@
# /packages/news/tcl/news-procs.tcl
-
ad_library {
-
Utility functions for News Application
-
+
@author stefan@arsdigita.com
@creation-date 12-14-00
@cvs-id $Id$
@@ -12,39 +10,39 @@
# News specific db-API wrapper functions and interpreters
-ad_proc news_items_archive { id_list when } {
-
+ad_proc news_items_archive { id_list when } {
+
immediately gives all news items in list id_list
a status of archived as of ANSI date in when, i.e. when must be like 2000-10-11.
-
+
} {
-
- foreach id $id_list {
+
+ foreach id $id_list {
db_exec_plsql news_item_archive {
begin
news.archive(
item_id => :id,
archive_date => :when);
end;
}
- }
+ }
}
-ad_proc news_items_make_permanent { id_list } {
+ad_proc news_items_make_permanent { id_list } {
immediately gives all news items in list id_list
a status of permanently published
} {
-
+
foreach id $id_list {
db_exec_plsql news_item_make_permanent {
begin
news.make_permanent(:id);
end;
- }
+ }
}
}
@@ -122,13 +120,57 @@
ad_proc news__datasource {
object_id
} {
- We currently use the default content repository
- datasource proc.
- @author Robert Locke
+
+
+ @author Jeff Davis (davis@xarg.net)
} {
+ db_1row get {
+ select
+ item_id,
+ package_id,
+ live_revision,
+ publish_title,
+ publish_lead,
+ html_p,
+ publish_date,
+ publish_body,
+ creation_user,
+ item_creator
+ from news_items_live_or_submitted
+ where item_id = :object_id
+ or item_id = (select item_id from cr_revisions where revision_id = :object_id)}
- return [content_search__datasource $object_id]
+ set url_stub [news_util_get_url $package_id]
+ set url "[ad_url]${url_stub}item/$item_id"
+ if {[empty_string_p $publish_lead]} {
+ set publish_lead $publish_body
+ }
+
+ set content [template::adp_include /packages/news/www/news \
+ [list \
+ item_id $object_id \
+ publish_title $publish_title \
+ publish_title $publish_lead \
+ publish_body $publish_body \
+ publish_image {} \
+ creator_link $item_creator ]]
+
+ return [list \
+ object_id $object_id \
+ title $publish_title \
+ content $content \
+ mime text/html \
+ keywords {} \
+ storage_type text \
+ syndication [list link $url \
+ description $publish_lead \
+ author $item_creator \
+ category News \
+ guid "[ad_url]/o/$item_id" \
+ pubDate $publish_date \
+ ] \
+ ]
}
@@ -147,7 +189,7 @@
where revision_id=:object_id
"
- set url "${url_stub}item?item_id=$item_id"
+ set url "${url_stub}item/$item_id"
return $url
}
@@ -229,17 +271,17 @@
ad_proc -public news__last_updated {
package_id
} {
-
+
Return the timestamp of the most recent item in this news instance
-
+
@author Dave Bauer (dave@thedesignexperience.org)
@creation-date 2005-01-22
-
+
@param package_id
- @return
-
- @error
+ @return
+
+ @error
} {
return [db_string get_last_updated ""]
}
@@ -260,7 +302,7 @@
set package_url [news_util_get_url $summary_context_id]
db_foreach get_news_items {} {
set entry_url [export_vars -base "[ad_url]${package_url}item" {item_id}]
-
+
set content_as_text [ad_html_text_convert -from $mime_type -to text/plain $content]
# for now, support only full content in feed
set description $content_as_text
@@ -300,17 +342,16 @@
ad_proc -private news_update_rss {
-summary_context_id
} {
-
Regenerate RSS feed
-
+
@author Dave Bauer (dave@thedesignexperience.org)
@creation-date 2005-02-04
-
+
@param summary_context_id
- @return
-
- @error
+ @return
+
+ @error
} {
set subscr_id [rss_support::get_subscr_id \
-summary_context_id $summary_context_id \
Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/news/www/item-oracle.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/news/www/item-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.12 refers to a dead (removed) revision in file `openacs-4/packages/news/www/item.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.13 refers to a dead (removed) revision in file `openacs-4/packages/news/www/item.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/news/www/item.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/item.vuh,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/news/www/item.vuh 26 Mar 2005 13:49:55 -0000 1.1
@@ -0,0 +1,9 @@
+if {[regexp {^/([0-9]+)} [ad_conn path_info] match item_id]} {
+ if {[ns_set find [rp_getform] item_id] == -1} {
+ rp_form_put item_id $item_id
+ } else {
+ ns_set update [rp_getform] item_id $item_id
+ }
+}
+
+rp_internal_redirect /packages/news/lib/item
Index: openacs-4/packages/news/www/news.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/news.adp,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/news/www/news.adp 24 Feb 2005 18:03:05 -0000 1.6
+++ openacs-4/packages/news/www/news.adp 26 Mar 2005 13:49:55 -0000 1.7
@@ -4,12 +4,3 @@
@publish_lead@
@publish_body;noquote@
#news.Contributed_by# @creator_link;noquote@
-
-
-
-
-
-
-
-
-