Index: openacs-4/packages/scholarship-fund/tcl/scholarship-funds-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/scholarship-fund/tcl/scholarship-funds-install-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/scholarship-fund/tcl/scholarship-funds-install-procs.tcl 31 May 2005 22:08:03 -0000 1.1 @@ -0,0 +1,70 @@ +# + +ad_library { + + Installation procedures for scholarship-funds + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-17 + @arch-tag: 766d5355-5c3f-4d02-9703-18ac04c5d21f + @cvs-id $Id: scholarship-funds-install-procs.tcl,v 1.1 2005/05/31 22:08:03 hamiltonc Exp $ +} + +namespace eval sf::install {} + +ad_proc -public sf::install::package_install { +} { + + Setup package + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-17 + + @return + + @error +} { + content::type::new \ + -content_type scholarship_fund \ + -pretty_name "Scholarship Fund" \ + -pretty_plural "Scholarship Funds" \ + -id_column "fund_id" \ + -table_name "scholarship_fund" \ + -supertype "content_revision" \ + -name_method "scholarship_fund__name" + + content::type::attribute::new \ + -content_type scholarship_fund \ + -attribute_name "account_code" \ + -datatype text \ + -pretty_name "Account Code" \ + -pretty_plural "Account Codes" \ + -column_spec "varchar(200)" + +} + +ad_proc -private sf::install::after_instantiate { + -package_id +} { + Setup package instance + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-17 + + @param package_id + + @return + + @error +} { + set folder_id [content::folder::new \ + -name "scholarship_fund_${package_id}" \ + -parent_id -100 \ + -package_id $package_id \ + -label "Scholarship Funds ${package_id}"] + + content::folder::register_content_type \ + -folder_id $folder_id \ + -content_type scholarship_find +} + Index: openacs-4/packages/scholarship-fund/www/fund-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/scholarship-fund/www/fund-add-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/scholarship-fund/www/fund-add-edit.adp 31 May 2005 22:08:03 -0000 1.1 @@ -0,0 +1,7 @@ + + @page_title@ + @header_stuff@ + @context@ + @focus@ + + \ No newline at end of file Index: openacs-4/packages/scholarship-fund/www/fund-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/scholarship-fund/www/fund-add-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/scholarship-fund/www/fund-add-edit.tcl 31 May 2005 22:08:03 -0000 1.1 @@ -0,0 +1,78 @@ +# + +ad_page_contract { + + Add or Edit a fund + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-17 + @arch-tag: b776ec1a-53c8-4c4b-8760-eb605e75b874 + @cvs-id $Id: fund-add-edit.tcl,v 1.1 2005/05/31 22:08:03 hamiltonc Exp $ +} { + item_id:integer,optional +} -properties { + page_title + context +} -validate { +} -errors { +} + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] + +if {![ad_form_new_p -key item_id] && [exists_and_not_null item_id]} { + permission::require_permission \ + -party_id $user_id \ + -object_id $item_id \ + -privilege "write" +} else { + permission::require_permission \ + -party_id $user_id \ + -object_id $package_id \ + -privilege "create" +} + +set folder_id [content::folder::get_folder_from_package -package_id $package_id] + +ad_form -name fund-add-edit \ + -form { + item_id:key + title:text + description:text(textarea) + account_code:text + } -edit_request { + # get existing fund info + db_1row get_fund "select sf.title, sf.description, sf.account_code from scholarship_fundi sf, cr_items ci where sf.revision_id=ci.live_revision and sf.item_id=:item_id" + } -new_data { + #add fund + content::item::new \ + -name "scholarship_fund_${item_id}" \ + -item_id $item_id \ + -parent_id $folder_id \ + -title $title \ + -description $description \ + -content_type scholarship_fund \ + -is_live t \ + -attributes [list [list account_code $account_code]] + + } -edit_data { + #update fund + content::revision::new \ + -item_id $item_id \ + -title $title \ + -description $description \ + -attributes [list [list account_code $account_code]] \ + -is_live t + + } -after_submit { + set return_url [export_vars -base one-fund {item_id}] + ad_returnredirect $return_url + } + + +set page_title "Add/Edit Fund" +set context [list $page_title] +set header_stuff "" +set focus "" + +ad_return_template \ No newline at end of file Index: openacs-4/packages/scholarship-fund/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/scholarship-fund/www/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/scholarship-fund/www/index.adp 31 May 2005 22:08:03 -0000 1.1 @@ -0,0 +1,7 @@ + + @page_title@ + @header_stuff@ + @context@ + @focus@ + + \ No newline at end of file Index: openacs-4/packages/scholarship-fund/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/scholarship-fund/www/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/scholarship-fund/www/index.tcl 31 May 2005 22:08:03 -0000 1.1 @@ -0,0 +1,61 @@ +# + +ad_page_contract { + + List scholarship Funds + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-17 + @arch-tag: d8a5f3d7-6fa9-441b-a082-3c8db5eb6c67 + @cvs-id $Id: index.tcl,v 1.1 2005/05/31 22:08:03 hamiltonc Exp $ +} { + +} -properties { + page_title + context +} -validate { +} -errors { +} + +set user_id [ad_conn user_id] +set package_id [ad_conn user_id] + +permission::require_permission \ + -object_id $package_id \ + -party_id $user_id \ + -privilege "read" + +set admin_p [permission::permission_p \ + -object_id $package_id \ + -party_id $user_id \ + -privilege "admin"] + +set actions [list "Add Fund" fund-add-edit "Add a new scholarship fund"] +db_multirow -extend { one_url edit_url } funds get_funds "" { + set one_url [export_vars -base one-fund {item_id}] + set edit_url [export_vars -base fund-add-edit {item_id}] +} + +template::list::create \ + -name funds \ + -multirow funds \ + -actions $actions \ + -elements { + title { label "Title" link_url_col one_url } + description { label "Description" } + actions { + label "Actions" + display_template { +
+ + } + } + } + +set page_title "Scholarship Funds" +set context [list $page_title] +set focus "" +set header_stuff "" + +ad_return_template \ No newline at end of file Index: openacs-4/packages/scholarship-fund/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/scholarship-fund/www/index.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/scholarship-fund/www/index.xql 31 May 2005 22:08:03 -0000 1.1 @@ -0,0 +1,21 @@ + + + + + + + + + + + + select sf.* + from scholarship_fundi sf, + cr_items ci + where + sf.revision_id = ci.live_revision + + + + \ No newline at end of file Index: openacs-4/packages/scholarship-fund/www/one-fund.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/scholarship-fund/www/one-fund.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/scholarship-fund/www/one-fund.adp 31 May 2005 22:08:03 -0000 1.1 @@ -0,0 +1,9 @@ + + @page_title@ + @header_stuff@ + @context@ + @focus@ + +@fund.title@
+@fund.description@
+@fund.account_code@
\ No newline at end of file Index: openacs-4/packages/scholarship-fund/www/one-fund.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/scholarship-fund/www/one-fund.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/scholarship-fund/www/one-fund.tcl 31 May 2005 22:08:03 -0000 1.1 @@ -0,0 +1,40 @@ +# + +ad_page_contract { + + Display one scholarship fund + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2005-05-17 + @arch-tag: 6db507f3-14d8-47da-aa1b-bdab2b155315 + @cvs-id $Id: one-fund.tcl,v 1.1 2005/05/31 22:08:03 hamiltonc Exp $ +} { + item_id:integer,notnull +} -properties { + page_title + context +} -validate { +} -errors { +} + +set user_id [ad_conn user_id] +permission::require_permission \ + -object_id $item_id \ + -party_id $user_id \ + -privilege "read" + +set admin_p [permission::permission_p \ + -object_id $item_id \ + -party_id $user_id \ + -privilege "admin"] + +db_1row get_fund "select sf.* from scholarship_fundi sf, cr_items ci where sf.revision_id=ci.live_revision and sf.item_id=:item_id" -column_array fund + +set edit_url [export_vars -base "fund-add-edit" {item_id}] + +set page_title "One Scholarship Fund" +set context [list $page_title] +set header_stuff "" +set focus "" + +ad_return_template