Index: openacs-4/packages/ecommerce/www/admin/audit-one-id.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/audit-one-id.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/audit-one-id.adp 25 Aug 2008 12:06:52 -0000 1.1 @@ -0,0 +1,9 @@ + + @title;noquote@ + @context;noquote@ +

@title@

+ +

@main_table_name@

+ +@audit_trail_html;noquote@ + Index: openacs-4/packages/ecommerce/www/admin/audit-one-id.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/audit-one-id.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/admin/audit-one-id.tcl 9 Mar 2004 00:59:45 -0000 1.3 +++ openacs-4/packages/ecommerce/www/admin/audit-one-id.tcl 25 Aug 2008 12:06:52 -0000 1.4 @@ -24,24 +24,7 @@ set table_names_and_id_column [list $main_table_name $audit_table_name $id_column] -set page_content " -[ad_admin_header "[ec_system_name] Audit of $id_column $id"] +set title "Audit of $id_column $id" +set context [list $title] -

[ec_system_name] Audit Trail

- -[ad_context_bar [list index Ecommerce([ec_system_name])] [list "audit-tables?[export_url_vars table_names_and_id_column]" "Audit $main_table_name"] "[ec_system_name] Audit Trail"] -
- -

$main_table_name

-
- -[ec_audit_trail $id $audit_table_name $main_table_name $id_column] - -
- -[ad_admin_footer] -" - - - -doc_return 200 text/html $page_content +set audit_trail_html "[ec_audit_trail $id $audit_table_name $main_table_name $id_column]" Index: openacs-4/packages/ecommerce/www/admin/audit-table.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/audit-table.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/audit-table.adp 25 Aug 2008 12:06:52 -0000 1.1 @@ -0,0 +1,27 @@ + + @title;noquote@ + @context;noquote@ +

@title@

+ +
+ @export_form_vars_html;noquote@ + + + + + + + + + + + + +
From:@start_date_html;noquote@
To:@end_date_html;noquote@
+
+ +

@main_table_name@

+ +@main_table_html;noquote@ + + Index: openacs-4/packages/ecommerce/www/admin/audit-table.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/audit-table.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/admin/audit-table.tcl 9 Mar 2004 00:59:45 -0000 1.3 +++ openacs-4/packages/ecommerce/www/admin/audit-table.tcl 25 Aug 2008 12:06:52 -0000 1.4 @@ -15,98 +15,62 @@ @cvs-id $Id$ @author ported by Jerry Asher (jerry@theashergroup.com) } { - table_names_and_id_column:notnull start_date:array,date start_time:array,time end_date:array,date end_time:array,time - } -validate { - - start_timestamp_valid { - if { [exists_and_not_null start_time(time)] && - ![exists_and_not_null start_date(date)] || - [exists_and_not_null end_time(time)] && - ![exists_and_not_null end_date(date)] } { - - ad_complain "You cannot leave date field empty if you're entered - something in the time field. Reverse is, however, - acceptable." - } - } + start_timestamp_valid { + if { [exists_and_not_null start_time(time)] && + ![exists_and_not_null start_date(date)] || + [exists_and_not_null end_time(time)] && + ![exists_and_not_null end_date(date)] } { + ad_complain "
  • Date field cannot be empty if you are entering + something in the time field. Time fields can be left blank.
  • " + } + } } ad_require_permission [ad_conn package_id] admin -set main_table_name [lindex $table_names_and_id_column 0] -set audit_table_name [lindex $table_names_and_id_column 1] -set id_column [lindex $table_names_and_id_column 2] +set main_table_name [string trim [lindex $table_names_and_id_column 0]] +set audit_table_name [string trim [lindex $table_names_and_id_column 1]] +set id_column [string trim [lindex $table_names_and_id_column 2]] if { ![empty_string_p $start_date(date)] && - [empty_string_p $start_time(time)] } { + [empty_string_p $start_time(time)] } { set start_time(time) "00:00:00" -} + } if { ![empty_string_p $end_date(date)] && - [empty_string_p $end_time(time)] } { + [empty_string_p $end_time(time)] } { set end_time(time) "00:00:00" -} + } + # Not compare the time (assuming usually the time boxes are left blank) -if {![empty_string_p $start_date(date)] && ![empty_string_p $end_date(date)]} { - if {[db_0or1row select_one " - select 1 +if { ![empty_string_p $start_date(date)] && ![empty_string_p $end_date(date)] } { + if { [db_0or1row select_one "select 1 from dual - where to_date('$start_date(date)','YYYY-MM-DD HH24:MI:SS') > to_date('$end_date(date)', 'YYYY-MM-DD HH24:MI:SS') - "] ==1} { - - ad_return_complaint 1 "Please enter a start date before end date." + where to_date('$start_date(date)','YYYY-MM-DD HH24:MI:SS') > to_date('$end_date(date)', 'YYYY-MM-DD HH24:MI:SS')"] == 1 } { + ad_return_complaint 1 "Please enter a start date before end date." } } -doc_body_append " -[ad_admin_header "[ec_system_name] Audit Table"] +set title "Audit Table" +set context [list $title] -

    [ec_system_name] Audit for $main_table_name

    +set export_form_vars_html [export_form_vars table_names_and_id_column] +set start_date_html "[ad_dateentrywidget start_date $start_date(date)] [ec_timeentrywidget start_time $start_time(time)]" +set end_date_html "[ad_dateentrywidget end_date $end_date(date)] [ec_timeentrywidget end_time $end_time(time)]" -[ad_context_bar [list "index.tcl" Ecommerce([ec_system_name])] [list "audit-tables" "Audit Table"] "Audit $main_table_name"] - -
    - -
    -[export_form_vars table_names_and_id_column] - - - - - - - - - - - - - -
    From:[ad_dateentrywidget start_date $start_date(date)] [ec_timeentrywidget start_time $start_time(time)]
    To:[ad_dateentrywidget end_date $end_date(date)] [ec_timeentrywidget end_time $end_time(time)]
    -
    - -

    $main_table_name

    -" - -if { ![empty_string_p $start_date(date)] } { +if { ![empty_string_p $start_date(date)] } { append start_date(date) " $start_time(time)" } -if { ![empty_string_p $end_date(date)] } { +if { ![empty_string_p $end_date(date)] } { append end_date(date) " $end_time(time)" } - -doc_body_append " -
    - [ec_audit_trail_for_table $main_table_name $audit_table_name $id_column $start_date(date) $end_date(date) "audit-one-id" ""] -
    - -[ad_admin_footer] -" +ns_log Notice ",$main_table_name,$audit_table_name,$id_column,$start_date(date),$end_date(date)," +set main_table_html [ec_audit_trail_for_table ${main_table_name} ${audit_table_name} ${id_column} $start_date(date) $end_date(date) "audit-one-id" ""] Index: openacs-4/packages/ecommerce/www/admin/audit-tables.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/audit-tables.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/audit-tables.adp 25 Aug 2008 12:06:52 -0000 1.1 @@ -0,0 +1,25 @@ + + @title;noquote@ + @context;noquote@ +

    @title@

    + +

    This page will let you see all changes to one table of the +@system_name@ database over a specified period of time. It is +recommended that you start with a narrow time window and expand as +needed. Some tables can become very large.

    + +
    +@export_form_vars_html;noquote@ +
      +@table_and_id_html;noquote@ +
    • When do you want to audit back to: (Leave blank to start at the begining of the table's history.)
      + @start_point_html;noquote@
    • +
    • When do you want to audit up to:
      + @end_point_html;noquote@
    • +
    + +
    +

    Note: if the table is very large, this may take a while.
    +

    +
    +
    Index: openacs-4/packages/ecommerce/www/admin/audit-tables.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/audit-tables.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/admin/audit-tables.tcl 9 Mar 2004 00:59:45 -0000 1.3 +++ openacs-4/packages/ecommerce/www/admin/audit-tables.tcl 25 Aug 2008 12:06:52 -0000 1.4 @@ -12,79 +12,41 @@ ad_require_permission [ad_conn package_id] admin -doc_body_append " -[ad_admin_header "Audit [ec_system_name]"] +set title "Audit [ec_system_name]" +set context [list $title] -

    Audit [ec_system_name]

    - -[ad_context_bar [list "index.tcl" Ecommerce([ec_system_name])] "Audit Tables"] - -
    - -This page will let you see all changes to one table of the -[ec_system_name] database over a specified period of time. It is -recommended that you start with a narrow time window and expand as -needed. Some tables can become very large. - -
    - -
      -" - -if { [info exists table_names_and_id_column] } { - doc_body_append "[export_form_vars table_names_and_id_column] -
      - Audit for table [lindex $table_names_and_id_column 0] -
      -" +set table_names_and_id_col_exist [info exists table_names_and_id_column] +if { $table_names_and_id_col_exist } { + set export_form_vars_html [export_form_vars table_names_and_id_column] + set table_and_id_html "Audit for table [lindex $table_names_and_id_column 0]" } else { - doc_body_append " -
    • What table do you want to audit: - -" + set export_form_vars_html "" + set table_and_id_html "
    • What table do you want to audit: +
    • " } -doc_body_append " -

      +set start_point_html "[ad_dateentrywidget start_date ""] [ec_timeentrywidget start_time ""]" +set end_point_html "[ad_dateentrywidget end_date] [ec_timeentrywidget end_time]" -

    • When do you want to audit back to: (Leave blank to start at the begining of the table's history.)
      -[ad_dateentrywidget start_date ""] [ec_timeentrywidget start_time ""] +set system_name [ec_system_name] -

      - -

    • When do you want to audit up to:
      -[ad_dateentrywidget end_date] [ec_timeentrywidget end_time] - -
    - -
    -Note: if the table is very large, this may take a while.
    - -
    - -
    - -[ad_admin_footer] -" Index: openacs-4/packages/ecommerce/www/admin/audit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/audit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/audit.adp 25 Aug 2008 12:06:52 -0000 1.1 @@ -0,0 +1,6 @@ + + @title;noquote@ + @context;noquote@ +

    @title@

    + +@main_table_html;noquote@ Index: openacs-4/packages/ecommerce/www/admin/audit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/audit.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/admin/audit.tcl 9 Mar 2004 00:59:45 -0000 1.3 +++ openacs-4/packages/ecommerce/www/admin/audit.tcl 25 Aug 2008 12:06:52 -0000 1.4 @@ -19,25 +19,13 @@ ad_require_permission [ad_conn package_id] admin -doc_body_append " -[ad_admin_header "[ec_system_name] Audit Trail"] -

    $audit_name

    +set title "[ec_system_name] Audit Trail" +set context [list $title] -[ad_context_bar [list index Ecommerce([ec_system_name])] "Audit Trail"] -
    -" - set counter 0 - +set main_table_html "" foreach main_table $main_tables { - doc_body_append "

    $main_table

    -
    - - [ec_audit_trail $audit_id [lindex $audit_tables $counter] $main_table $audit_id_column] - -
    - " + append main_table_html "

    $main_table

    [ec_audit_trail $audit_id [lindex $audit_tables $counter] $main_table $audit_id_column]" incr counter } -doc_body_append "[ad_admin_footer]" Index: openacs-4/packages/ecommerce/www/admin/restore-one-id.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/restore-one-id.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/restore-one-id.adp 25 Aug 2008 12:08:39 -0000 1.1 @@ -0,0 +1,14 @@ + + @title;noquote@ + @context;noquote@ +

    @title@

    + +

    Restore of @main_table_name@

    +

    For a the SQL insert:

    +
    +@sql_insert@
    +
    +

    This is the result:

    +
    + @result@ +
    Index: openacs-4/packages/ecommerce/www/admin/restore-one-id.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/restore-one-id.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ecommerce/www/admin/restore-one-id.tcl 1 Mar 2005 00:01:32 -0000 1.4 +++ openacs-4/packages/ecommerce/www/admin/restore-one-id.tcl 25 Aug 2008 12:08:39 -0000 1.5 @@ -1,5 +1,4 @@ # /www/[ec_url_concat [ec_url] /admin]/restore-one-id.tcl - ad_page_contract { Tries to restore from the audit table to the main table @@ -27,11 +26,8 @@ # we need them to be logged in set user_id [ad_conn user_id] - if {$user_id == 0} { - set return_url "[ad_conn url]?[export_entire_form_as_url_vars]" - ad_returnredirect "/register?[export_url_vars return_url]" ad_script_abort } @@ -41,8 +37,6 @@ set peeraddr [ns_conn peeraddr] set audit_info "sysdate, :user_id, :peeraddr" - - set sql_insert "" set result "The $main_table_name table is not supported at this time." @@ -88,19 +82,6 @@ } } -doc_return 200 text/html " -[ss_new_staff_header "Restore of $id_column $id"] -[ss_staff_context_bar "Restore Data"] - -

    Restore of $main_table_name

    -For a the SQL insert -
    -$sql_insert -
    -This result was obtained -
    -$result -
    -[ls_admin_footer]" - - +set title "Audit Restore of $id_column $id" +set context [list $title] +