by Nima Mazloumi
+
Enabling WYSIWYGby Nima Mazloumi
OpenACS docs are written by the named authors, and may be edited
by OpenACS documentation staff.
-
Most of the forms in OpenACS are created using the form builder, see ???. For detailed information on the
+
Most of the forms in OpenACS are created using the form builder, see the section called “Using Form Builder: building html forms dynamically”. For detailed information on the
API take a look here.
The following section shows how you can modify your form to allow WYSIWYG functionalities.
Convert your page to use ad_form
(some changes but worth it)
Here an examples. From:
template::form create my_form
template::element create my_form my_form_id -label "The ID" -datatype integer -widget hidden
@@ -57,34 +57,34 @@
set htmlarea_p $use_wysiwyg_p
All you need now is a configuration page where the user can change this setting. Create a
configure.tcl
file:
- ad_page_contract {
+ad_page_contract {
- This page allows a faq admin to change the UseWysiwygP setting
+ This page allows a faq admin to change the UseWysiwygP setting
- } {
- {return_url ""}
- }
+} {
+ {return_url ""}
+}
- set title "Should we support WYSIWYG?"
- set context [list $title]
+ set title "Should we support WYSIWYG?"
+ set context [list $title]
- set use_wysiwyg_p
+ set use_wysiwyg_p
- ad_form -name categories_mode -form {
- {enabled_p:text(radio)
- {label "Enable WYSIWYG"}
- {options {{Yes t} {No f}}}
- {value $use_wysiwyg_p}
- }
- {return_url:text(hidden) {value $return_url}}
- {submit:text(submit) {label "Change"}}
- } -on_submit {
- parameter::set_value -parameter "UseWysiwygP" -value $enabled_p
- if {$return_url ne ""} {
- ns_returnredirect $return_url
- }
- }
-
In the corresponding ADP file write
+ ad_form -name categories_mode -form {
+ {enabled_p:text(radio)
+ {label "Enable WYSIWYG"}
+ {options {{Yes t} {No f}}}
+ {value $use_wysiwyg_p}
+ }
+ {return_url:text(hidden) {value $return_url}}
+ {submit:text(submit) {label "Change"}}
+ } -on_submit {
+ parameter::set_value -parameter "UseWysiwygP" -value $enabled_p
+ if {$return_url ne ""} {
+ ns_returnredirect $return_url
+ }
+ }
+
In the corresponding ADP file write
<master>
<property name="title">@title@</property>
<property name="context">@context@</property>
@@ -96,4 +96,4 @@
#ADP:
<a href=configure?<%=[export_vars -url {return_url}]%>>Configure</a>
-