Index: openacs-4/packages/curriculum/lib/admin-curriculums-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/lib/admin-curriculums-oracle.xql 4 Jun 2003 16:43:42 -0000 1.2 +++ openacs-4/packages/curriculum/lib/admin-curriculums-oracle.xql 15 Jun 2003 15:33:02 -0000 1.3 @@ -7,11 +7,15 @@ select cc.curriculum_id, cc.name as curriculum_name, - cc.description as curriculum_desc, + dbms_lob.substr(cc.description,:truncation_length,1) as curriculum_desc, + case when dbms_lob.getlength(cc.description) > :truncation_length + then 1 else 0 end as curr_desc_trunc_p, cc.sort_key as curriculum_sort_order, ce.element_id, ce.name as element_name, - ce.description as element_desc, + dbms_lob.substr(ce.description,:truncation_length,1) as element_desc, + case when dbms_lob.getlength(ce.description) > :truncation_length + then 1 else 0 end as elem_desc_trunc_p, ce.url as element_url, ce.enabled_p as element_enabled_p, ce.sort_key as element_sort_order, Index: openacs-4/packages/curriculum/lib/admin-curriculums-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/lib/admin-curriculums-postgresql.xql 4 Jun 2003 16:43:42 -0000 1.2 +++ openacs-4/packages/curriculum/lib/admin-curriculums-postgresql.xql 15 Jun 2003 15:33:02 -0000 1.3 @@ -7,11 +7,15 @@ select cc.curriculum_id, cc.name as curriculum_name, - cc.description as curriculum_desc, + substring(cc.description from 1 for :truncation_length) as curriculum_desc, + case when length(cc.description) > :truncation_length + then 1 else 0 end as curr_desc_trunc_p, cc.sort_key as curriculum_sort_order, ce.element_id, ce.name as element_name, - ce.description as element_desc, + substring(ce.description from 1 for :truncation_length) as element_desc, + case when length(ce.description) > :truncation_length + then 1 else 0 end as elem_desc_trunc_p, ce.url as element_url, ce.enabled_p as element_enabled_p, ce.sort_key as element_sort_order, Index: openacs-4/packages/curriculum/lib/admin-curriculums.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/curriculum/lib/admin-curriculums.adp 13 Jun 2003 11:44:33 -0000 1.4 +++ openacs-4/packages/curriculum/lib/admin-curriculums.adp 15 Jun 2003 15:33:02 -0000 1.5 @@ -2,7 +2,6 @@ Available columns:

@curriculums:columns@

-@debug_output;noquote@

I'm done now, update the bar for everyone! (Use sparingly) @@ -32,6 +31,10 @@ @curriculums.curriculum_desc;noquote@ + + ... + [more] + @curriculums.pretty_state@ @@ -70,6 +73,10 @@ @curriculums.element_desc;noquote@ + + ... + [more] + Index: openacs-4/packages/curriculum/lib/admin-curriculums.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/lib/admin-curriculums.tcl 13 Jun 2003 11:44:33 -0000 1.2 +++ openacs-4/packages/curriculum/lib/admin-curriculums.tcl 15 Jun 2003 15:33:02 -0000 1.3 @@ -38,6 +38,9 @@ # Construct a nicely formatted string to use in the query file. set where_clauses [ad_decode $where_clauses {} {} " and [join $where_clauses "\n and "]"] +set truncation_length [parameter::get -package_id $package_id \ + -parameter DescTruncLength -default 200] + # List of curriculums and their elements. db_multirow -extend { curriculum_id_export @@ -50,14 +53,4 @@ set curriculum_count [curriculum::conn -nocache curriculum_count] -## -## DEBUG. FIXME. -## -set debug_output " -debug_output -
package_id: $package_id -
workflow_id: $workflow_id -
action_role: $action_role -" - ad_return_template Index: openacs-4/packages/curriculum/lib/curriculum-ave.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/curriculum-ave.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/lib/curriculum-ave.tcl 3 Jun 2003 10:21:50 -0000 1.1 +++ openacs-4/packages/curriculum/lib/curriculum-ave.tcl 15 Jun 2003 15:33:02 -0000 1.2 @@ -37,58 +37,73 @@ # Edit/display curriculum. #### - permission::require_permission -object_id $curriculum_id -privilege write + set write_p [permission::permission_p -object_id $curriculum_id -privilege write] - #### - # Workflow. - #### + if { $write_p } { + + #permission::require_permission -object_id $curriculum_id -privilege write - # The form goes into "edit" mode if there is a workflow action ... - set action_id [form get_action curriculum] - set wf_action_exists_p [expr ![empty_string_p $action_id]] + #### + # Workflow. + #### - # FIXME. Do we need this when we require permission above already? - # Registration required for all actions. -# if { $wf_action_exists_p } { -# ad_maybe_redirect_for_registration -# } - - set case_id [workflow::case::get_id \ - -object_id $curriculum_id \ - -workflow_short_name [curriculum::workflow_short_name]] - - # Check permissions. - if { ![workflow::case::action::available_p -case_id $case_id -action_id $action_id] } { - curriculum::security_violation -user_id $user_id -curriculum_id $curriculum_id -action $action_id - } - - # Action buttons. - if { !$wf_action_exists_p } { - foreach available_action_id [workflow::case::get_available_actions -case_id $case_id] { - workflow::action::get -action_id $available_action_id -array available_action - lappend actions [list " $available_action(pretty_name) " $available_action(action_id)] + # The form goes into "edit" mode if there is a workflow action ... + set action_id [form get_action curriculum] + set wf_action_exists_p [expr ![empty_string_p $action_id]] + + # FIXME. Do we need this when we require permission above already? + # Registration required for all actions. + # if { $wf_action_exists_p } { + # ad_maybe_redirect_for_registration + # } + + set case_id [workflow::case::get_id \ + -object_id $curriculum_id \ + -workflow_short_name [curriculum::workflow_short_name]] + + # Check permissions. + if { ![workflow::case::action::available_p -case_id $case_id -action_id $action_id] } { + curriculum::security_violation -user_id $user_id -curriculum_id $curriculum_id -action $action_id } - } + + # Action buttons. + if { !$wf_action_exists_p } { + foreach available_action_id [workflow::case::get_available_actions -case_id $case_id] { + workflow::action::get -action_id $available_action_id -array available_action + lappend actions [list " $available_action(pretty_name) " $available_action(action_id)] + } + } + + # Action pretty names. + if { $wf_action_exists_p } { + + # Hmm... Not elegant but initially we need to set the mode for each element + # of the form to display mode, thus overriding the default form mode, + # and then "open up" the edit_fields for the given action for editing. + # We can't just change the mode of the entire form to display mode because + # then the form will lose its OK and Cancel buttons when an action button is pressed. + + set element_mode display + + set action_pretty_name [workflow::action::get_element -action_id $action_id -element pretty_name] + } else { + set action_pretty_name {} + } + + set curriculum_name [acs_object_name $curriculum_id] + set title "[ad_decode $action_pretty_name "" "View" $action_pretty_name] Curriculum: $curriculum_name" + } else { - # Action pretty names. - if { $wf_action_exists_p } { + # Display mode only! (User doesn't have write perms) - # Hmm... Not elegant but initially we need to set the mode for each element - # of the form to display mode, thus overriding the default form mode, - # and then "open up" the edit_fields for the given action for editing. - # We can't just change the mode of the entire form to display mode because - # then the form will lose its OK and Cancel buttons when an action button is pressed. + set wf_action_exists_p 0 + set curriculum_name [acs_object_name $curriculum_id] + set title "Curriculum: $curriculum_name" - set element_mode display - - set action_pretty_name [workflow::action::get_element -action_id $action_id -element pretty_name] - } else { - set action_pretty_name {} } - + + set form_mode display - set curriculum_name [acs_object_name $curriculum_id] - set title "[ad_decode $action_pretty_name "" "View" $action_pretty_name] Curriculum ($curriculum_name)" } set context {$title} @@ -118,8 +133,8 @@ } } -# Add status field on display/edit. -if { !$new_p } { +# Add status field on display/edit mode for people with write privs. +if { !$new_p && $write_p } { ad_form -extend -name curriculum -form { {pretty_state:text(inform) {label Status} @@ -141,32 +156,32 @@ if { !$new_p } { - # Extend the form with assignee widgets (only in edit or display mode). - workflow::case::role::add_assignee_widgets -case_id $case_id -form_name curriculum - - # FIXME. Get values for the role assignment widgets. - workflow::case::role::set_assignee_values -case_id $case_id -form_name curriculum - - # Set values for description field. - # Is before_html the right placement of this? Perhaps we should link - # to a different page where we show the case log? - element set_properties curriculum description \ - -before_html "[workflow::case::get_activity_html -case_id $case_id][ad_decode $action_id "" "" "

$action_pretty_name by user_first_names user_last_name

"]" + if { $write_p } { + # Extend the form with assignee widgets (only in edit or display mode). + workflow::case::role::add_assignee_widgets -case_id $case_id -form_name curriculum + + # FIXME. Get values for the role assignment widgets. + workflow::case::role::set_assignee_values -case_id $case_id -form_name curriculum + + # Set values for description field. + # Is before_html the right placement of this? Perhaps we should link + # to a different page where we show the case log? + element set_properties curriculum description \ + -before_html "[workflow::case::get_activity_html -case_id $case_id][ad_decode $action_id "" "" "

$action_pretty_name by user_first_names user_last_name

"]" + + } # Single-curriculum notifications and "start over" link. - if { !$wf_action_exists_p } { - - set notification_link [curriculum::get_watch_link -curriculum_id $curriculum_id] - foreach { notification_url notification_label notification_title } $notification_link { - # Do nothing! - } - - set start_over_url "start-over?[export_vars -url curriculum_id]" - set start_over_label "Restart this curriculum" - set start_over_title "Clear all checkboxes in $curriculum_name" - - } - + set notification_link [curriculum::get_watch_link -curriculum_id $curriculum_id] + foreach { notification_url notification_label notification_title } $notification_link { + # Do nothing! + } + + #set start_over_url "start-over?[export_vars -url curriculum_id]" + #set start_over_label "Restart this curriculum" + #set start_over_title "Clear all checkboxes in $curriculum_name" + + } # More fixed form elements Index: openacs-4/packages/curriculum/lib/element-ave.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/element-ave.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/lib/element-ave.tcl 3 Jun 2003 10:21:50 -0000 1.1 +++ openacs-4/packages/curriculum/lib/element-ave.tcl 15 Jun 2003 15:33:02 -0000 1.2 @@ -1,6 +1,6 @@ ad_page_contract { - Add/edit curriculum element. + Add/edit/view curriculum element. @author Ola Hansson (ola@polyxena.net) @creation-date 2003-05-26 @@ -38,17 +38,24 @@ # Since we permit several curriculums per package instance we # require permission on curriculum_id, not package_id basis. - permission::require_permission -object_id $curriculum_id -privilege write + set write_p [permission::permission_p -object_id $curriculum_id -privilege write] + #permission::require_permission -object_id $curriculum_id -privilege write + set form_mode display set curriculum_name [acs_object_name $curriculum_id] set element_name [acs_object_name $element_id] - set title "Edit Element \"$element_name\" (part of $curriculum_name)" + set title "$element_name, part of $curriculum_name" } set context {$title} -ad_form -name element -export {curriculum_id} -cancel_url $return_url -mode $form_mode -form { +ad_form -name element \ + -export {curriculum_id} \ + -cancel_url $return_url \ + -mode $form_mode \ + -has_edit [expr !$write_p] \ + -form { element_id:key {name:text {label Name} Index: openacs-4/packages/curriculum/lib/user-curriculums.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/user-curriculums.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/curriculum/lib/user-curriculums.adp 14 Jun 2003 16:29:23 -0000 1.7 +++ openacs-4/packages/curriculum/lib/user-curriculums.adp 15 Jun 2003 15:33:02 -0000 1.8 @@ -23,7 +23,12 @@ @elements.curriculum_name@ - @elements.curriculum_desc@ + @elements.curriculum_desc;noquote@ + + ... + [more] + + @@ -68,7 +73,12 @@ @elements.element_name@ - @elements.element_desc;noquote@ + @elements.element_desc;noquote@ + + ... + [more] + + Visited Index: openacs-4/packages/curriculum/www/TODO.TXT =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/Attic/TODO.TXT,v diff -u -r1.3 -r1.4 --- openacs-4/packages/curriculum/www/TODO.TXT 10 Jun 2003 09:30:07 -0000 1.3 +++ openacs-4/packages/curriculum/www/TODO.TXT 15 Jun 2003 15:33:25 -0000 1.4 @@ -9,8 +9,6 @@ - Documentation. - Optimize bar and admin page queries (compare with the user page query!). -- Fix desc truncation and the "more" link on index page. - (dbms_lob.instr() doesn't return the substr on Oracle ...) - Host problem in ext.tcl and remove-from-bar.tcl ("hostname" vs. "localhost"). - Deleting the curriculum package when both curriculums @@ -55,4 +53,6 @@ not per user and instance! ("util_memoize_flush_regexp" is pretty expensive considering that each user has one cache per instance, so we provided - a link instead, that the admin should hit when done admin'ing.) \ No newline at end of file + a link instead, that the admin should hit when done admin'ing.) +- Fix desc truncation and the "more" link on index page. + (dbms_lob.instr() doesn't return the substr on Oracle ...)