Index: openacs-4/packages/edit-this-page/tcl/etp-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/tcl/etp-init.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/edit-this-page/tcl/etp-init.tcl 17 Nov 2001 19:48:47 -0000 1.2 +++ openacs-4/packages/edit-this-page/tcl/etp-init.tcl 18 Dec 2001 19:28:00 -0000 1.3 @@ -48,33 +48,48 @@ allow_symlinks t auto_page_name "" + + date_format "Month DD, YYYY" } -if { [catch {etp::define_content_type journal_issue "Journal Issue" "Journal Issues" { - { publication_date "Publication Date" "Publication Dates" string "size=60" "" } - { issue_name "Issue name" "Issue names" string "size=60" "" } - }} errmsg]} { +if { [catch { + + etp::define_content_type journal_issue "Journal Issue" "Journal Issues" { + { publication_date "Publication Date" "Publication Dates" date "" "" } + { issue_name "Issue name" "Issue names" string "size=60" "" } + } + +} errmsg]} { ns_log Notice "ETP: define 'Journal Issue' failed: $errmsg" } -if { [catch {etp::define_content_type journal_article "Journal Article" "Journal Articles" { - { section Section Sections string "" "" } - { byline Byline Bylines string "" "" } - { abstract Abstract Abstracts string "rows=24 cols=80" "" } - { citation Citation Citations string "rows=4 cols=80" "" } - }} errmsg]} { +if { [catch { + + etp::define_content_type journal_article "Journal Article" "Journal Articles" { + { section Section Sections string "" "" } + { byline Byline Bylines string "" "" } + { abstract Abstract Abstracts string "rows=24 cols=80" "" } + { citation Citation Citations string "rows=4 cols=80" "" } + } + +} errmsg]} { ns_log Notice "ETP: define 'Journal Articles' failed: $errmsg" } -if { [catch {etp::define_content_type news_item "News Item" "News Items" { - { location "Location" "Location" string "size=80" "" } - { subtitle "Subtitle" "Subtitle" string "rows=4 cols=80" "" } - { release_date "Release Date" "Release Dates" string "size=60" "" } - { archive_date "Archive Date" "Archive Dates" string "size=60" "" } - }} errmsg]} { +if { [catch { + + etp::define_content_type news_item "News Item" "News Items" { + { location "Location" "Location" string "size=80" "" } + { subtitle "Subtitle" "Subtitle" string "rows=4 cols=80" "" } + { release_date "Release Date" "Release Dates" date "size=60" "" } + { archive_date "Archive Date" "Archive Dates" date "size=60" "" } + } + +} errmsg]} { ns_log Notice "ETP: define 'News Items' failed: $errmsg" } else { + etp::define_application news { index_template packages/edit-this-page/templates/news-index content_template packages/edit-this-page/templates/news-content Index: openacs-4/packages/edit-this-page/templates/news-index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/templates/news-index-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/edit-this-page/templates/news-index-oracle.xql 18 Nov 2001 18:57:58 -0000 1.1 +++ openacs-4/packages/edit-this-page/templates/news-index-oracle.xql 18 Dec 2001 19:28:00 -0000 1.2 @@ -4,20 +4,20 @@ - sysdate between to_date(attributes.release_date, 'YYYY-MM-DD') and - to_date(attributes.archive_date, 'YYYY-MM-DD') + sysdate between to_date(attributes.release_date, 'Month DD, YYYY') and + to_date(attributes.archive_date, 'Month DD, YYYY') - sysdate >= to_date(attributes.archive_date, 'YYYY-MM-DD') + sysdate >= to_date(attributes.archive_date, 'Month DD, YYYY') - to_date(attributes.release_date, 'YYYY-MM-DD') desc + to_date(attributes.release_date, 'Month DD, YYYY') desc Index: openacs-4/packages/edit-this-page/templates/news-index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/templates/news-index-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/edit-this-page/templates/news-index-postgresql.xql 18 Nov 2001 18:57:58 -0000 1.1 +++ openacs-4/packages/edit-this-page/templates/news-index-postgresql.xql 18 Dec 2001 19:28:00 -0000 1.2 @@ -4,20 +4,20 @@ - current_timestamp between to_date(attributes.release_date, 'YYYY-MM-DD') and - to_date(attributes.archive_date, 'YYYY-MM-DD') + current_timestamp between to_date(attributes.release_date, 'Month DD, YYYY') and + to_date(attributes.archive_date, 'Month DD, YYYY') - current_timestamp >= to_date(attributes.archive_date, 'YYYY-MM-DD') + current_timestamp >= to_date(attributes.archive_date, 'Month DD, YYYY') - to_date(attributes.release_date, 'YYYY-MM-DD') desc + to_date(attributes.release_date, 'Month DD, YYYY') desc Index: openacs-4/packages/edit-this-page/templates/news-index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/templates/news-index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/edit-this-page/templates/news-index.adp 24 Sep 2001 17:24:13 -0000 1.1 +++ openacs-4/packages/edit-this-page/templates/news-index.adp 18 Dec 2001 19:28:00 -0000 1.2 @@ -7,7 +7,9 @@ -There are no current news items +There are no +currentexpired +news items + If you're looking for an old news article, check the expired news. + + +Return to the current news items. + \ No newline at end of file Index: openacs-4/packages/edit-this-page/www/etp-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/Attic/etp-edit-2.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/edit-this-page/www/etp-edit-2.tcl 20 Nov 2001 02:04:50 -0000 1.2 +++ openacs-4/packages/edit-this-page/www/etp-edit-2.tcl 18 Dec 2001 19:28:00 -0000 1.3 @@ -7,6 +7,7 @@ } { name attribute + datevalue:array,date,optional } -properties { page_title:onevalue attribute_title:onevalue @@ -15,12 +16,19 @@ etp::check_write_access -set form [ns_getform] -if { [empty_string_p $form] || [ns_set find $form $attribute] == -1 } { - ad_return_error "This is a bug" "Form must provide value for $attribute" - ad_script_abort +if {[info exists datevalue]} { + set date_string $datevalue(date) + # The date is given in YYYY-MM-DD. Transform to desired format. + set date_format [etp::get_application_param date_format] + set value [db_string transform_date ""] +} else { + set form [ns_getform] + if { [empty_string_p $form] || [ns_set find $form $attribute] == -1 } { + ad_return_error "This is a bug" "Form must provide value for $attribute" + ad_script_abort + } + set value [ns_set get $form $attribute] } -set value [ns_set get $form $attribute] # TODO: validate the html that was given to us Index: openacs-4/packages/edit-this-page/www/etp-edit-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/Attic/etp-edit-2.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/edit-this-page/www/etp-edit-2.xql 24 Sep 2001 17:24:13 -0000 1.1 +++ openacs-4/packages/edit-this-page/www/etp-edit-2.xql 18 Dec 2001 19:28:00 -0000 1.2 @@ -1,6 +1,13 @@ + + +select to_char(to_date(:date_string, 'YYYY-MM-DD'), :date_format) +from dual + + + update cr_revisions Index: openacs-4/packages/edit-this-page/www/etp-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/etp-edit-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/edit-this-page/www/etp-edit-oracle.xql 18 Nov 2001 18:57:58 -0000 1.2 +++ openacs-4/packages/edit-this-page/www/etp-edit-oracle.xql 18 Dec 2001 19:28:00 -0000 1.3 @@ -2,6 +2,13 @@ oracle8.1.6 + + + select to_char(to_date(:value, :date_format), 'YYYY-MM-DD') + from dual + + + select $attribute as value, r.title as page_title Index: openacs-4/packages/edit-this-page/www/etp-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/etp-edit-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/edit-this-page/www/etp-edit-postgresql.xql 18 Nov 2001 18:57:58 -0000 1.2 +++ openacs-4/packages/edit-this-page/www/etp-edit-postgresql.xql 18 Dec 2001 19:28:00 -0000 1.3 @@ -2,6 +2,12 @@ postgresql7.1 + + + select to_char(to_date(:value, :date_format), 'YYYY-MM-DD') + + + select $attribute as value, r.title as page_title Index: openacs-4/packages/edit-this-page/www/etp-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/etp-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/edit-this-page/www/etp-edit.tcl 24 Sep 2001 17:24:13 -0000 1.1 +++ openacs-4/packages/edit-this-page/www/etp-edit.tcl 18 Dec 2001 19:28:00 -0000 1.2 @@ -62,6 +62,15 @@ append widget "\n" } elseif {$type == "string" && [regexp -nocase {(rows|cols)} $html]} { set widget "\n" +} elseif {$type == "date"} { + if [empty_string_p $value] { + set widget [ad_dateentrywidget datevalue] + } else { + # Put the date back into YYYY-MM-DD format + set date_format [etp::get_application_param date_format] + set value [db_string transform_date ""] + set widget [ad_dateentrywidget datevalue $value] + } } else { set widget "\n" }