Index: openacs-4/packages/acs-subsite/www/admin/themes/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/themes/index.tcl,v
diff -u -r1.1.2.4 -r1.1.2.5
--- openacs-4/packages/acs-subsite/www/admin/themes/index.tcl 24 Jan 2017 11:35:46 -0000 1.1.2.4
+++ openacs-4/packages/acs-subsite/www/admin/themes/index.tcl 25 Jan 2017 12:33:13 -0000 1.1.2.5
@@ -22,7 +22,9 @@
view {
sub_class narrow
display_template {
+
+
}
link_url_eval {[export_vars -base view { {theme $key} }]}
link_html { title "#acs-subsite.View_this_theme#" }
Index: openacs-4/packages/acs-subsite/www/admin/themes/view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/themes/view.adp,v
diff -u -r1.1.2.1 -r1.1.2.2
--- openacs-4/packages/acs-subsite/www/admin/themes/view.adp 24 Jan 2017 11:35:46 -0000 1.1.2.1
+++ openacs-4/packages/acs-subsite/www/admin/themes/view.adp 25 Jan 2017 12:33:13 -0000 1.1.2.2
@@ -3,5 +3,7 @@
@context;literal@
theme.key
+
@page_title@
+@sub_title@
Index: openacs-4/packages/acs-subsite/www/admin/themes/view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/themes/view.tcl,v
diff -u -r1.1.2.1 -r1.1.2.2
--- openacs-4/packages/acs-subsite/www/admin/themes/view.tcl 24 Jan 2017 11:35:46 -0000 1.1.2.1
+++ openacs-4/packages/acs-subsite/www/admin/themes/view.tcl 25 Jan 2017 12:33:13 -0000 1.1.2.2
@@ -15,9 +15,11 @@
}
}
-set page_title "View parameters of theme $theme"
-set context [list $page_title]
+set subsite_id [ad_conn subsite_id]
+set instance_name [apm_instance_name_from_id $subsite_id]
+
+
set settings {
template DefaultMaster
css ThemeCSS
@@ -33,42 +35,89 @@
set subsite_id [ad_conn subsite_id]
set currentThemeKey [parameter::get -parameter ThemeKey -package_id $subsite_id]
+ns_log notice currentThemeKey=$currentThemeKey
+#ns_log notice ACTION=[template::form get_action theme]-[ns_set array [ns_getform]]
+
db_1row get_vars_of_seleted_theme {select * from subsite_themes where key = :theme}
+#
+# Since the standard display mode does not produce good results in our
+# case, we try to implement our own management here. Probably, the
+# display mode of textarea should be fixed to reduce complexity here.
+#
+if {[ns_queryget formbutton:edit] eq "Edit"} {
+ set htmlSpecs ""
+ ns_log notice "true edit mode"
+ set editMode 1
+ set editButtons [list [list Save save] ]
+ set page_title "Edit Theme Parameters of Subsite: $instance_name"
+ #
+ # Since we are doing our own display/edit modes, we have to tell
+ # ad_form, that this request should be treated like a fresh
+ # request.
+ #
+ ns_set truncate [ns_getform] 0
+} else {
+ set htmlSpecs [list disabled disabled]
+ ns_log notice "view mode"
+ set editMode 0
+ set editButtons [list [list Edit edit] ]
+ set page_title "View Theme Parameters of Subsite: $instance_name"
+}
+
+set context [list $page_title]
+
+
+
+set nr_differs 0
set formSpec {}
foreach {var param} $settings {
if {$var in {css js}} {
- set currentSpec [list ${var}:text(textarea),nospell,optional [list label $var] [list html {rows 5 cols 100 disabled disabled}]]
+ lappend htmlSpecs rows 5 cols 100
+ set currentSpec [list ${var}:text(textarea),nospell,optional [list label $var] [list html $htmlSpecs]]
} else {
- set currentSpec [list ${var}:text,optional [list label $var] [list html {size 50 disabled disabled}]]
+ lappend htmlSpecs size 80
+ set currentSpec [list ${var}:text,optional [list label $var] [list html $htmlSpecs]]
}
if {$currentThemeKey eq $key} {
set currentValue [string trim [parameter::get -parameter $param -package_id $subsite_id]]
regsub -all {\r\n} $currentValue "\n" currentValue
if {$currentValue ne [string trim [set $var]]} {
lappend currentSpec [list help_text "differs"]
- ns_log notice "current value \n<$currentValue>\ndiffers from\n<[string trim [set $var]]>"
+ #ns_log notice "current value \n<$currentValue>\ndiffers from\n<[string trim [set $var]]>"
+ incr nr_differs
}
+ #
+ # set the variable in the form to the value obtained from the parameters
+ #
+ set $var $currentValue
}
lappend formSpec $currentSpec
}
lappend formSpec [list theme:text(hidden)]
+if {$nr_differs > 0} {
+ set sub_title "Subsite uses modified theme parameters based on $theme"
+} else {
+ set sub_title "Subsite uses theme parameters of $theme"
+}
+
#set return_url [export_vars -base view {theme}]
set return_url "."
-
ad_form -name theme \
- -cancel_url $return_url \
- -mode display \
+ -cancel_url $return_url \
+ -edit_buttons $editButtons \
-form $formSpec \
-on_request {
ns_log notice "on request"
} -on_submit {
ns_log notice "on submit"
} -after_submit {
- ad_returnredirect $return_url
- ad_script_abort
+ if {!$editMode} {
+ ad_returnredirect $return_url
+ ad_script_abort
+ }
}
# Local variables: