Index: openacs-4/packages/new-portal/tcl/portal-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs-oracle.xql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/new-portal/tcl/portal-procs-oracle.xql 29 Mar 2002 19:42:08 -0000 1.13 +++ openacs-4/packages/new-portal/tcl/portal-procs-oracle.xql 16 Apr 2002 13:55:44 -0000 1.14 @@ -94,6 +94,17 @@ + + + insert into portal_element_map + (element_id, name, pretty_name, page_id, datasource_id, region, state, sort_key) + select + :new_element_id, name, pretty_name, :target_page_id, :ds_id, region, state, sort_key + from portal_element_map pem + where pem.element_id = :template_element_id + + + update portal_element_map Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v diff -u -r1.129 -r1.130 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 11 Apr 2002 20:17:52 -0000 1.129 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 16 Apr 2002 13:55:44 -0000 1.130 @@ -1,4 +1,4 @@ -# + # Copyright (C) 2001, 2002 OpenForce, Inc. # # This file is part of dotLRN. @@ -155,6 +155,10 @@ @param user_id @param layout_name optional } { + # aks debug + ns_log notice "aks1: portal::create name is $name / template_id is $template_id / csv $csv_list" + + # if we have a cvs list in the form "page_name1, layout1; # page_name2, layout2...", we get the required first page_name # and first page layout from it, overriding any other params @@ -195,7 +199,8 @@ set portal_id [db_exec_plsql create_new_portal_and_perms {}] - if {![empty_string_p $csv_list]} { + # ignore the csv list if we have a template + if {![empty_string_p $csv_list] && [empty_string_p $template_id]} { # if there are more pages in the csv_list, create them for {set i 1} {$i < [expr [llength $page_name_list]]} {incr i} { portal::page_create -portal_id $portal_id \ @@ -206,6 +211,8 @@ } + ns_log notice "aks1: portal::create leaving $name / $portal_id / $template_id" + return $portal_id } @@ -233,9 +240,7 @@ ad_require_permission $portal_id portal_read_portal if {[portal::exists_p $portal_id]} { - return [db_1row get_name_select {}] - } else { - return "" + return [db_string get_name_select {}] } } @@ -362,6 +367,7 @@ ad_proc -public configure { {-page_id ""} {-template_p "f"} + {-referer "f"} portal_id return_url } { @@ -376,7 +382,11 @@ @return_url @return A portal configuration page } { - set edit_p [permission::permission_p -object_id $portal_id -privilege portal_edit_portal] + set edit_p \ + [permission::permission_p \ + -object_id $portal_id \ + -privilege portal_edit_portal + ] if {!$edit_p} { ad_require_permission $portal_id portal_admin_portal @@ -406,15 +416,6 @@ append theme_data "" - # set up the page creation stuff - set new_page_num [expr [page_count -portal_id $portal_id] + 1] - - set page_data \ - "
- - " - - # XXXX page support if { $template_p == "f" } { set element_src "[portal::www_path]/place-element" @@ -424,10 +425,17 @@ set portal_name [get_name $portal_id] + if {[empty_string_p $referer]} { + set return_text "Go back" + } else { + set return_text "" + set return_url $referer + } + set template "

- Go back + $return_text

@@ -464,30 +472,53 @@ set element_list [array get fake_element_ids] + set page_name_chunk " + + + + +
Page: + + +
" + if {$element_count == 0} { append template " -

$portal(page_name) has no Elements" + $page_name_chunk + No Elements +

+ + + + +
" } else { append template " -

$portal(page_name) Page - - " + hide_links_p=f + page_id=$page_id + layout_id=$layout_id + edit_p=@edit_p@>" } # clear out the region array array unset fake_element_ids } + # set up the page creation stuff + set new_page_num [expr [page_count -portal_id $portal_id] + 1] append template "

Add a new page: - @page_data@ + +

" @@ -514,9 +545,17 @@ @param formdata an ns_set with all the formdata } { - ad_require_permission $portal_id portal_read_portal - ad_require_permission $portal_id portal_edit_portal + set edit_p \ + [permission::permission_p \ + -object_id $portal_id \ + -privilege portal_edit_portal + ] + if {!$edit_p} { + ad_require_permission $portal_id portal_admin_portal + set edit_p 1 + } + set op [ns_set get $form op] switch $op { @@ -603,6 +642,20 @@ } page_create -pretty_name $pretty_name -portal_id $portal_id } + "Remove Empty Page" { + set page_id [ns_set get $form page_id] + page_delete -page_id $page_id + } + "Rename Page" { + set pretty_name [ns_set get $form pretty_name] + set page_id [ns_set get $form page_id] + + if {[empty_string_p $pretty_name]} { + ad_return_complaint 1 "You must enter new name for the page." + } + set_page_pretty_name \ + -pretty_name $pretty_name -page_id $page_id + } "toggle_pinned" { set element_id [ns_set get $form element_id] @@ -670,19 +723,11 @@ portal_id return_url } { - Just a wrapper for the configure proc + Just a wrapper for the configure proc. @param portal_id @return A portal configuration page } { - if { ! [template_p $portal_id] } { - ns_log error "portal::template_configure called with portal_id - $portal_id!" - ad_return_complaint 1 "There is an error in our code. - Please inform your system administrator of the following error: - portal::template_configure called with portal_id $portal_id" - } - portal::configure -template_p "t" $portal_id $return_url } @@ -719,7 +764,7 @@ if {![empty_string_p $page_name]} { return [db_string get_page_id_from_name {} -default ""] } else { - return [db_string get_page_id_select {}] + return [db_string get_page_id_select {}] } } @@ -742,6 +787,23 @@ return [db_string get_page_pretty_name_select {}] } + ad_proc -public set_page_pretty_name { + {-page_id:required} + {-pretty_name:required} + } { + Updates the pn + } { + return [db_dml set_page_pretty_name_update {}] + } + + ad_proc -public page_delete { + {-page_id:required} + } { + deletes the page + } { + return [db_dml page_delete {}] + } + ad_proc -public page_create { {-layout_name ""} {-pretty_name:required} @@ -835,6 +897,8 @@ @param page_num the number of the portal page to add to, def 0 @param ds_name } { + ns_log notice "aks6: portal_id $portal_id" + if {[empty_string_p $pretty_name]} { set pretty_name $ds_name } @@ -939,12 +1003,15 @@ # so, copy stuff. If not, just insert normally. if { [db_0or1row get_template_info_select {}] == 1 } { - db_transaction { set new_element_id [db_nextval acs_object_id_seq] db_1row get_target_page_id {} + + set bar [db_string foobar { select name from portal_element_map pem where pem.page_id = :target_page_id and pem.sort_key = :template_element_sk and pem.region = 1} -default NONE ] + + ns_log notice "aks5 $template_page_sort_key / $template_element_region / $template_element_name / $template_element_sk / $bar" + db_dml template_insert {} db_dml template_params_insert {} - } } else { # no template, or the template dosen't have this DS, Index: openacs-4/packages/new-portal/tcl/portal-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.xql,v diff -u -r1.24 -r1.25 --- openacs-4/packages/new-portal/tcl/portal-procs.xql 11 Apr 2002 20:14:43 -0000 1.24 +++ openacs-4/packages/new-portal/tcl/portal-procs.xql 16 Apr 2002 13:55:44 -0000 1.25 @@ -199,14 +199,27 @@ - + select pretty_name from portal_pages where page_id = :page_id + + + update portal_pages set pretty_name = :pretty_name + where page_id = :page_id + + + + + + delete from portal_pages where page_id = :page_id + + + select page_id @@ -253,7 +266,10 @@ select pp.page_id as template_page_id, pp.sort_key as template_page_sort_key, - pem.element_id as template_element_id + pem.element_id as template_element_id, + pem.sort_key as template_element_sk, + pem.name as template_element_name, + pem.region as template_element_region from portals p, portal_element_map pem, portal_pages pp where p.portal_id = :portal_id and p.template_id = pp.portal_id @@ -271,24 +287,6 @@ - - - insert into portal_element_map - (element_id, name, pretty_name, page_id, datasource_id, region, sort_key, state) - select - :new_element_id, - name, - pretty_name, - :target_page_id, - :ds_id, - region, - sort_key, - state - from portal_element_map pem - where pem.element_id = :template_element_id - - - insert into portal_element_parameters Index: openacs-4/packages/new-portal/www/place-element-other-page.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/place-element-other-page.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/new-portal/www/place-element-other-page.adp 2 Apr 2002 22:43:12 -0000 1.4 +++ openacs-4/packages/new-portal/www/place-element-other-page.adp 16 Apr 2002 13:55:44 -0000 1.5 @@ -20,6 +20,7 @@

+ Index: openacs-4/packages/new-portal/www/template-place-element.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/template-place-element.adp,v diff -u -r1.13 -r1.14 --- openacs-4/packages/new-portal/www/template-place-element.adp 2 Apr 2002 22:43:12 -0000 1.13 +++ openacs-4/packages/new-portal/www/template-place-element.adp 16 Apr 2002 13:55:44 -0000 1.14 @@ -94,6 +94,7 @@ target_stub=@target_stub@ portal_id=@portal_id@ page_id=@element_multi.page_id@ + return_url=@return_url@ action_string=@action_string@> Index: openacs-4/packages/new-portal/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/admin/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/www/admin/index.tcl 29 Mar 2002 18:48:29 -0000 1.2 +++ openacs-4/packages/new-portal/www/admin/index.tcl 16 Apr 2002 13:55:46 -0000 1.3 @@ -14,20 +14,17 @@ # details. # -# www/index.tcl - ad_page_contract { - Page that displays a list of the user's portals and gives - the option to create a new/additional portal + Page that displays a system-wide list of portals and gives + the option to view or edit them @author Arjun Sanyal (arjun@openforce.net) @creation-date @cvs-id $Id$ } { } -set user_id [ad_conn user_id] -set master_template [ad_parameter master_template] +permission::require_permission -object_id [ad_conn package_id] -privilege admin set query "select portal_id, name Index: openacs-4/packages/new-portal/www/admin/portal-admin-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/admin/portal-admin-master.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/new-portal/www/admin/portal-admin-master.adp 12 Apr 2002 04:12:18 -0000 1.1 +++ openacs-4/packages/new-portal/www/admin/portal-admin-master.adp 16 Apr 2002 13:55:46 -0000 1.2 @@ -18,16 +18,10 @@ -

+


Portal: @name@

-Go to portal admin - - or edit this portal - - - or view this portal - -

+Go back +


Index: openacs-4/packages/new-portal/www/admin/portal-config-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/admin/portal-config-2.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/www/admin/portal-config-2.tcl 29 Mar 2002 18:48:29 -0000 1.2 +++ openacs-4/packages/new-portal/www/admin/portal-config-2.tcl 16 Apr 2002 13:55:46 -0000 1.3 @@ -25,10 +25,11 @@ set form [ns_getform] set portal_id [ns_set get $form portal_id] +set return_url [ns_set get $form return_url] set user_id [ad_conn user_id] portal::configure_dispatch $portal_id $form -ns_returnredirect "portal-config?portal_id=$portal_id" +ns_returnredirect "portal-config?portal_id=$portal_id&referer=$return_url" Index: openacs-4/packages/new-portal/www/admin/portal-config.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/admin/portal-config.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/new-portal/www/admin/portal-config.adp 12 Apr 2002 04:12:18 -0000 1.4 +++ openacs-4/packages/new-portal/www/admin/portal-config.adp 16 Apr 2002 13:55:46 -0000 1.5 @@ -20,8 +20,7 @@ -@portal_id@ +@referer@ @name@ -1 @rendered_page@ Index: openacs-4/packages/new-portal/www/admin/portal-config.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/admin/portal-config.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/new-portal/www/admin/portal-config.tcl 12 Apr 2002 04:12:18 -0000 1.5 +++ openacs-4/packages/new-portal/www/admin/portal-config.tcl 16 Apr 2002 13:55:46 -0000 1.6 @@ -23,6 +23,7 @@ @creation-date 10/20/2001 @cvs-id $Id$ } { + {referer:notnull} portal_id:naturalnum,notnull } @@ -34,5 +35,5 @@ set template_p "f" } -set rendered_page [portal::configure -template_p $template_p $portal_id "index"] +set rendered_page [portal::configure -referer $referer -template_p $template_p $portal_id ""] set name [portal::get_name $portal_id] Index: openacs-4/packages/new-portal/www/admin/portal-show.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/admin/portal-show.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/www/admin/portal-show.adp 12 Apr 2002 04:12:18 -0000 1.2 +++ openacs-4/packages/new-portal/www/admin/portal-show.adp 16 Apr 2002 13:55:46 -0000 1.3 @@ -17,7 +17,6 @@ %> -@portal_id@ +@referer@ @name@ -1 @html@ Index: openacs-4/packages/new-portal/www/admin/portal-show.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/admin/portal-show.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/new-portal/www/admin/portal-show.tcl 12 Apr 2002 04:12:18 -0000 1.4 +++ openacs-4/packages/new-portal/www/admin/portal-show.tcl 16 Apr 2002 13:55:46 -0000 1.5 @@ -23,11 +23,11 @@ @creation-date @cvs-id $Id$ } { + {referer:notnull} portal_id:naturalnum,notnull {page_num 0} } - set name "[portal::get_name $portal_id]" set html "[portal::navbar -portal_id $portal_id] [portal::render -page_num $page_num $portal_id]" Index: openacs-4/packages/static-portlet/sql/oracle/static-core.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/sql/oracle/static-core.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/static-portlet/sql/oracle/static-core.sql 29 Mar 2002 19:43:33 -0000 1.3 +++ openacs-4/packages/static-portlet/sql/oracle/static-core.sql 16 Apr 2002 13:55:32 -0000 1.4 @@ -32,11 +32,8 @@ references acs_objects(object_id) constraint static_p_c_pk primary key, - instance_id constraint static_p_c_instance_id_nn - not null - constraint static_p_c_instance_id_fk - references apm_packages (package_id) - on delete cascade, + instance_id integer + not null, pretty_name varchar2(100) constraint static_p_c_pretty_name_nn not null, Index: openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 2 Apr 2002 06:13:47 -0000 1.4 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 16 Apr 2002 13:55:32 -0000 1.5 @@ -59,7 +59,12 @@ } { db_transaction { # Generate the element - set element_id [portal::add_element -pretty_name [get_pretty_name -content_id $content_id] -force_region 1 $portal_id [static_portlet::my_name]] + set element_id [portal::add_element \ + -pretty_name [get_pretty_name -content_id $content_id] \ + -force_region 1 \ + $portal_id \ + [static_portlet::my_name] + ] # Set the parameter portal::set_element_param $element_id content_id $content_id Index: openacs-4/packages/static-portlet/www/element-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/Attic/element-new.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/static-portlet/www/element-new.tcl 29 Mar 2002 19:43:33 -0000 1.5 +++ openacs-4/packages/static-portlet/www/element-new.tcl 16 Apr 2002 13:55:32 -0000 1.6 @@ -21,7 +21,7 @@ @creation-date 2001-12-03 @version $Id$ } -query { - {referer "../one-community-admin"} + referer:notnull portal_id:integer,notnull } -properties { title:onevalue @@ -52,13 +52,17 @@ -widget hidden \ -value $portal_id +element create new_static_element referer \ + -label "referer" \ + -datatype text \ + -widget hidden \ + -value $referer + if {[form is_valid new_static_element]} { form get_values new_static_element \ - pretty_name content portal_id + pretty_name content portal_id referer # insert the new content item - # ad_return_complaint 1 "$pretty_name, $content, $instance_id, $referer" - db_transaction { set item_id [static_portal_content::new \ -instance_id $instance_id \ Index: openacs-4/packages/static-portlet/www/element.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/element.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/static-portlet/www/element.tcl 29 Mar 2002 19:43:33 -0000 1.4 +++ openacs-4/packages/static-portlet/www/element.tcl 16 Apr 2002 13:55:32 -0000 1.5 @@ -21,14 +21,13 @@ @cvs_id $Id$ } -query { {content_id ""} - {referer "../one-community-admin"} + referer:notnull portal_id:integer,notnull } -properties { title:onevalue } set title "Edit content element" - set element_pretty_name [ad_parameter static_admin_portlet_element_pretty_name static-portlet] db_1row get_content_element { @@ -65,9 +64,15 @@ -widget hidden \ -value $portal_id +element create static_element referer \ + -label "referer" \ + -datatype text \ + -widget hidden \ + -value $referer + if {[form is_valid static_element]} { form get_values static_element \ - pretty_name content content_id portal_id + pretty_name content content_id portal_id referer db_transaction { static_portal_content::update \ Index: openacs-4/packages/static-portlet/www/static-admin-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-admin-portlet.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/static-portlet/www/static-admin-portlet.adp 29 Mar 2002 19:43:33 -0000 1.7 +++ openacs-4/packages/static-portlet/www/static-admin-portlet.adp 16 Apr 2002 13:55:32 -0000 1.8 @@ -24,10 +24,14 @@

-New @element_pretty_name@ + Index: openacs-4/packages/static-portlet/www/static-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-admin-portlet.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/static-portlet/www/static-admin-portlet.tcl 29 Mar 2002 19:43:33 -0000 1.6 +++ openacs-4/packages/static-portlet/www/static-admin-portlet.tcl 16 Apr 2002 13:55:32 -0000 1.7 @@ -39,4 +39,5 @@ where instance_id = :instance_id" set template_portal_id [dotlrn_community::get_portal_template_id [dotlrn_community::get_community_id]] -# set url [dotlrn_community::get_url_from_package_id -package_id $instance_id] +set applet_url "[dotlrn_applet::get_url]/[static_portlet::my_package_key]" +set referer [ad_conn url]