Index: openacs-4/packages/new-portal/sql/oracle/add-sloan-theme.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/Attic/add-sloan-theme.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/oracle/add-sloan-theme.sql 16 Oct 2002 15:39:16 -0000 1.1 @@ -0,0 +1,49 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- Arjun Sanyal (arjun@openforce.net) +-- $Id: add-sloan-theme.sql,v 1.1 2002/10/16 15:39:16 jeffd Exp $ +-- + + +-- ampersands break if I don't do this. +set scan off + +-- Insert some default templates. +declare + layout_id portal_layouts.layout_id%TYPE; + theme_id portal_element_themes.theme_id%TYPE; +begin + + theme_id := portal_element_theme.new ( + name => 'Sloan', + description => 'MIT Sloan theme', + filename => 'themes/sloan-theme', + resource_dir => 'themes/sloan-theme'); + + +end; +/ + + + + + Index: openacs-4/packages/new-portal/sql/postgresql/add-sloan-theme.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/Attic/add-sloan-theme.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/add-sloan-theme.sql 16 Oct 2002 15:39:16 -0000 1.1 @@ -0,0 +1,43 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- Arjun Sanyal (arjun@openforce.net) +-- $Id: add-sloan-theme.sql,v 1.1 2002/10/16 15:39:16 jeffd Exp $ +-- + + +-- Insert some default templates. +create function inline_0() +returns integer as ' +begin + perform portal_element_theme__new ( + ''Sloan'', -- name + ''MIT Sloan theme'', -- description + ''themes/sloan-theme'', -- filename + ''themes/sloan-theme'' -- directory + ); + return 0; +end;' language 'plpgsql'; + +select inline_0(); + +drop function inline_0(); + 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 -N -r1.156 -r1.157 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 9 Aug 2002 20:56:29 -0000 1.156 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 16 Oct 2002 15:39:16 -0000 1.157 @@ -346,6 +346,7 @@ ad_proc -public configure { {-referer ""} {-template_p f} + {-allow_theme_change_p 1} portal_id return_url } { @@ -429,14 +430,18 @@ } append theme_chunk "" + if {$allow_theme_change_p} { append template "$theme_chunk" + } # # Per-page template chunks # set list_of_page_ids [list_pages_tcl_list -portal_id $portal_id] + set last_page [lindex $list_of_page_ids [expr [llength $list_of_page_ids] - 1]] + ns_log warning "last_page is $last_page" foreach page_id $list_of_page_ids { set first_page_p [portal::first_page_p -portal_id $portal_id -page_id $page_id] @@ -448,18 +453,20 @@ # # Page rename chunk # - - set page_name_chunk " - -
+ set page_name_chunk " + + + " + append template "$page_name_chunk" if {[portal::non_hidden_elements_p -page_id $page_id] || $first_page_p} { @@ -478,7 +485,7 @@ set element_list [array get fake_element_ids] append template " -

$page_name

+ - + -
Page: - - " + + +
+
" + + + + if { $page_id == $last_page } { append template "
@@ -564,7 +580,7 @@ # close the page's table - append template "
" + append template "

" } @@ -575,30 +591,38 @@ set new_page_num [expr [page_count -portal_id $portal_id] + 1] append template " - +

+ + +

Create a new page

+
- + - Add a new page: +
+
+
" # # Revert page chunk # if {![empty_string_p [get_portal_template_id $portal_id]]} { - append template " -
-

+ append template "

+
+ - Revert to the default arrangement: +

Revert the entire portal to the default arrangement

+
- " +
+
" } # @@ -641,69 +665,70 @@ switch $op { "Revert" { - db_transaction { - set template_id [get_portal_template_id $portal_id] + #Transaction here was causeing uncaught deadlocks so it was removed. - CM 9-11-02 + #It doesn't seem necessary to have a transaction here. Its not a big deal if this fails in the the middle. The user can just revert again. - # revert theme - set theme_id [get_theme_id -portal_id $template_id] - db_dml revert_theme_update {} + set template_id [get_portal_template_id $portal_id] - # revert pages - # first equalize number of pages in the target - set template_page_count [page_count -portal_id $template_id] - set target_page_count [page_count -portal_id $portal_id] - set difference [expr $template_page_count - $target_page_count] - - if {$difference > 0} { - # less pages in target - for {set x 0} {$x < $difference} {incr x} { - - set pretty_name "portal revert dummy page $x" - page_create \ - -pretty_name $pretty_name \ - -portal_id $portal_id - } - } elseif {$difference < 0} { - # more pages in target, delete them from the end, - # putting any elements on them on the first page, - # we put them in the right place later - for {set x 0} {$x < [expr abs($difference)]} {incr x} { - - set max_page_id [db_string revert_max_page_id_select {}] - set page_id [db_string revert_min_page_id_select {}] - set region 1 - - db_foreach revert_move_elements_for_del {} { - portal::move_element_to_page \ + # revert theme + set theme_id [get_theme_id -portal_id $template_id] + db_dml revert_theme_update {} + + # revert pages + # first equalize number of pages in the target + set template_page_count [page_count -portal_id $template_id] + set target_page_count [page_count -portal_id $portal_id] + set difference [expr $template_page_count - $target_page_count] + + if {$difference > 0} { + # less pages in target + for {set x 0} {$x < $difference} {incr x} { + + set pretty_name "portal revert dummy page $x" + page_create \ + -pretty_name $pretty_name \ + -portal_id $portal_id + } + } elseif {$difference < 0} { + # more pages in target, delete them from the end, + # putting any elements on them on the first page, + # we put them in the right place later + for {set x 0} {$x < [expr abs($difference)]} {incr x} { + + set max_page_id [db_string revert_max_page_id_select {}] + set page_id [db_string revert_min_page_id_select {}] + set region 1 + + db_foreach revert_move_elements_for_del {} { + portal::move_element_to_page \ -page_id $page_id \ -element_id $element_id \ -region 1 - } + } - page_delete -page_id $max_page_id - } - } + page_delete -page_id $max_page_id + } + } + + # now that they have the same number of pages, get to it + foreach source_page_id \ + [list_pages_tcl_list -portal_id $template_id] { + + db_1row revert_get_source_page_info {} - # now that they have the same number of pages, get to it - foreach source_page_id \ - [list_pages_tcl_list -portal_id $template_id] { - - db_1row revert_get_source_page_info {} - - set target_page_id [db_string revert_get_target_page_id {}] - - db_dml revert_page_update {} - - # revert elements in two steps like "swap" - db_foreach revert_get_source_elements {} { - # the element might not be on the target page... - set target_element_id \ - [db_string revert_get_target_element {}] - - db_dml revert_element_update {} - } - } - } + set target_page_id [db_string revert_get_target_page_id {}] + + db_dml revert_page_update {} + + # revert elements in two steps like "swap" + db_foreach revert_get_source_elements {} { + # the element might not be on the target page... + set target_element_id \ + [db_string revert_get_target_element {}] + + db_dml revert_element_update {} + } + } } "Rename" { portal::update_name $portal_id [ns_set get $form new_name] @@ -987,6 +1012,7 @@ {-link_all 0} {-extra_td_html ""} {-table_html_args ""} + {-extra_td_selected_p 0} } { Wraps portal::dimensional to create a dotlrn navbar @@ -1010,6 +1036,7 @@ -pre_html $pre_html \ -post_html $post_html \ -extra_td_html $extra_td_html \ + -extra_td_selected_p $extra_td_selected_p \ -table_html_args $table_html_args \ $ad_dim_struct \ $link] @@ -1358,6 +1385,8 @@ db_dml update {} + util_memoize_flush "portal::element_params_not_cached $element_id" + # ns_log notice "aks81 [get_element_param $element_id $key]" return 1 } @@ -1399,6 +1428,9 @@ @author ben@openforce } { db_dml insert {} + + util_memoize_flush "portal::element_params_not_cached $element_id" + } ad_proc -private remove_element_param_value { @@ -1409,6 +1441,10 @@ removes a value for a param } { db_dml delete {} + + # DRB: Remove the cached copy of this element, too. + util_memoize_flush "portal::element_params_not_cached $element_id" + } ad_proc -private remove_all_element_param_values { @@ -1437,6 +1473,12 @@ } } + ad_proc -private element_params_not_cached element_id { + Return a list of lists of key value pairs for this portal element. + } { + return [db_list_of_lists params_select {}] + } + ad_proc -private get_element_id_from_unique_param { {-portal_id:required} {-key:required} @@ -1473,9 +1515,14 @@ db_1row element_select {} -column_array element # get the element's params - db_foreach params_select {} { - lappend config($key) $value - } if_no_rows { + set element_params [util_memoize "portal::element_params_not_cached $element_id" 86400] + if [llength $element_params] { + foreach param $element_params { + set key [lindex $param 0] + set value [lindex $param 1] + lappend config($key) $value + } + } else { # this element has no config, set up some defaults set config(shaded_p) "f" set config(shadeable_p) "f" @@ -2142,17 +2189,20 @@ } { return [db_list_of_ns_sets get_theme_info_select {}] } - + ad_proc dimensional { {-no_header:boolean} {-no_bars:boolean} {-link_all 0} + {-names_in_cells_p 1} {-th_bgcolor "#ECECEC"} {-td_align "center"} {-extra_td_html ""} {-table_html_args "border=0 cellspacing=0 cellpadding=3 width=100%"} + {-class_html ""} {-pre_html ""} {-post_html ""} + {-extra_td_selected_p 0} option_list {url {}} {options_set ""} @@ -2163,31 +2213,53 @@ if {[empty_string_p $option_list]} { return } - + if {[empty_string_p $options_set]} { set options_set [ns_getform] } - + if {[empty_string_p $url]} { set url [ad_conn url] } - - set html "\n\n \n" - + + set html "\n
\n" + if {!$no_header_p} { foreach option $option_list { - append html " \n" + append html "\n" } } - - append html " \n \n" - + + append html " \n" + foreach option $option_list { - append html " " + set end_html "" + set break_html "" + set post_selected_html "$post_html" + } else { + append html " \n" + if {$extra_td_selected_p} { + append html "${pre_selected_td_html}${pre_html}$extra_td_html${post_html}\n" + } else { + append html "${pre_td_html}$extra_td_html${post_html}\n" + } } - append html " \n
[lindex $option 1]
[lindex $option 1]
" - + if {!$no_bars_p} { append html "\[" } + + + if { $names_in_cells_p } { + set pre_td_html "" + set pre_selected_td_html "" + set post_html "$post_html" + set td_html "" + set pre_selected_td_html "" + set post_selected_html "$post_html" + set end_html "" + set td_html "" + post_html "$post_html" + if {!$no_bars_p} { + set break_html " | " + } else { + append break_html "   " + } + } # find out what the current option value is. # check if a default is set otherwise the first value is used @@ -2196,7 +2268,7 @@ if {![empty_string_p $options_set]} { set option_val [ns_set get $options_set $option_key] } - + set first_p 1 foreach option_value [lindex $option 3] { set thisoption_name [lindex $option_value 0] @@ -2208,29 +2280,33 @@ if {$first_p} { set first_p 0 - } else { - if {!$no_bars_p} { - append html " | " - } else { - append html "   " - } + } else { + append html $break_html } - + if {([string equal $option_val $thisoption_name] == 1 && !$link_all) || !$thisoption_link_p} { - append html "${pre_html}${thisoption_value}${post_html}" + append html "${pre_selected_td_html}${pre_html}${thisoption_value}${post_selected_html}\n" } else { - append html "${pre_html}${thisoption_value}${post_html}" + append html "${pre_td_html}${pre_html}${thisoption_value}${post_html}\n" } } if {!$no_bars_p} { append html "\]" } - - append html "$extra_td_html
\n" + append html " \n$end_html\n" } } + + + + + 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 -N -r1.41 -r1.42 --- openacs-4/packages/new-portal/tcl/portal-procs.xql 21 Aug 2002 15:22:39 -0000 1.41 +++ openacs-4/packages/new-portal/tcl/portal-procs.xql 16 Oct 2002 15:39:16 -0000 1.42 @@ -515,7 +515,7 @@ - + select key, value Index: openacs-4/packages/new-portal/www/place-element.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/place-element.adp,v diff -u -N -r1.36 -r1.37 --- openacs-4/packages/new-portal/www/place-element.adp 9 Aug 2002 20:56:29 -0000 1.36 +++ openacs-4/packages/new-portal/www/place-element.adp 16 Oct 2002 15:39:16 -0000 1.37 @@ -23,42 +23,46 @@ - - -
+ +
- - -
-
+
+ + + + + +
@element_multi.name@ - @element_multi.name@ - - [remove] + + remove portlet - move up + + move up - move down + + move down - move right + + move right - move left + + move left move right - move left + + + move left @@ -67,36 +71,33 @@ - +
+
+

+ - - - -

- - - - -@show_html@ - - - - - -
- + Index: openacs-4/packages/new-portal/www/show-here.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/show-here.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/www/show-here.adp 16 Oct 2002 15:39:17 -0000 1.1 @@ -0,0 +1,27 @@ +

+

+ + + +
+
Unused Portlets
+
+ +
+ + + + + + +@show_html@ + + + + +None. You can not add any portlets to this page because they are all in use. + + +
+
+ Index: openacs-4/packages/new-portal/www/show-here.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/show-here.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/www/show-here.tcl 16 Oct 2002 15:39:17 -0000 1.1 @@ -0,0 +1,44 @@ +# +# Copyright (C) 2001, 2002 OpenForce, Inc. +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_page_contract { + Add porlet form + + @author Caroline@meekshome.com + @creation-date 9/28/2001 + @cvs_id $Id: show-here.tcl,v 1.1 2002/10/16 15:39:17 jeffd Exp $ +} -properties { + region:onevalue + action_string:onevalue + portal_id:onevalue +} + +# generate some html for the hidden elements +set show_avail_p 0 +set show_html "" + +append show_html " + + + + + + + + + + + +
+ <%= [string toupper @name@] %> +
+ + + +
+ + + + + +
+ + + + +
+ +
+
+ + + + + Index: openacs-4/packages/new-portal/www/themes/sloan-theme/e.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/themes/sloan-theme/e.gif,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/www/themes/sloan-theme/e.gif 16 Oct 2002 15:39:17 -0000 1.1 @@ -0,0 +1 @@ +GIF89a�������fff!�Made with GIMP,6����� �Z+�=7�1U����!�F)jU�#̞o��6���3��NI�L*��&�; \ No newline at end of file Index: openacs-4/packages/new-portal/www/themes/sloan-theme/edit.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/themes/sloan-theme/edit.gif,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/www/themes/sloan-theme/edit.gif 16 Oct 2002 15:39:17 -0000 1.1 @@ -0,0 +1,2 @@ +GIF89a��������fff,@N���;aދ�y�0�ia�Ɓ扒Mʢ����eo�`U��l�Ģ�X,��*\�ē�n� Ŋ�Pc�]��d����6 +; \ No newline at end of file Index: openacs-4/packages/new-portal/www/themes/sloan-theme/shade.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/themes/sloan-theme/shade.gif,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/www/themes/sloan-theme/shade.gif 16 Oct 2002 15:39:17 -0000 1.1 @@ -0,0 +1,2 @@ +GIF89a�������fff!�Made with GIMP,-����� �Z+��5��(��Ȩq��i۽0��qm�SN +� ���; \ No newline at end of file Index: openacs-4/packages/new-portal/www/themes/sloan-theme/unshade.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/themes/sloan-theme/unshade.gif,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/www/themes/sloan-theme/unshade.gif 16 Oct 2002 15:39:17 -0000 1.1 @@ -0,0 +1,2 @@ +GIF89a�������fff!�Made with GIMP,2����� �Z+��5��(��Ȩ +\������'�mˮy�y��QH����) ; \ No newline at end of file Index: openacs-4/packages/new-portal/www/themes/sloan-theme/x.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/themes/sloan-theme/x.gif,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/www/themes/sloan-theme/x.gif 16 Oct 2002 15:39:17 -0000 1.1 @@ -0,0 +1 @@ +GIF89a�������fff,@9�����0�h�5zM}b�uV�j�ʫ�L�@8z�z,���RA_�˹��� ; \ No newline at end of file