+
+
\ No newline at end of file
Index: openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl 27 Apr 2015 15:28:21 -0000 1.2
@@ -0,0 +1,61 @@
+ad_page_contract {
+ Displays last n lines of long-calls log
+
+ @author Gustaf Neumann
+
+ @cvs-id $id$
+} -query {
+ {lines:naturalnum 20}
+ {readsize:naturalnum 100000}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+proc ::xo::userid_link {uid} {
+ if {[string first . $uid] > -1} {
+ set userinfo 0
+ } else {
+ set userinfo "$uid"
+ }
+ return $userinfo
+}
+proc ::xo::regsub_eval {re string cmd {prefix ""}} {
+ set map { \" \\\" \[ \\[ \] \\] \$ \\$ \\ \\\\}
+ return [uplevel [list subst [regsub -all $re [string map $map $string] "\[$cmd\]"]]]
+}
+proc ::xo::subst_user_link {prefix uid} {
+ return $prefix[::xo::userid_link $uid]
+}
+
+set long_calls_file [file dirname [ns_info log]]/long-calls.log
+set filesize [file size $long_calls_file]
+set F [open $long_calls_file]
+if {$readsize < $filesize} {seek $F -$readsize end}
+set c [read $F]; close $F
+set offsets [regexp -indices -all -inline \n $c]
+set o [lindex $offsets end-$lines]
+set c1 [string range $c [lindex $o 0]+1 end]
+set rows ""
+foreach line [lreverse [split $c1 \n]] {
+ if {$line eq ""} continue
+ lassign $line wday mon day hours tz year dash url time uid ip fmt
+ set userinfo [::xo::userid_link $uid]
+ set iplink "$ip"
+ if {$time < 6000} {
+ set class info
+ } elseif {$time < 10000} {
+ set class warning
+ } else {
+ set class danger
+ }
+ set request [ns_quotehtml $url]
+ set request [::xo::regsub_eval {user_id=([0-9]+)} $request {::xo::subst_user_link user_id= \1} user_id=]
+ append rows "
$time
$year $mon $day $hours
$userinfo
$iplink
$request
\n"
+}
+
+set title "Long Calls"
+set context [list $title]
+template::head::add_css -href //maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css -media all
+template::head::add_css -href //maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css -media all
+#ns_return 200 text/plain "$long_calls_file [file exists $long_calls_file] l=$lines o=$offsets / $o / [llength $offsets]\n$c1\n$rows"
Index: openacs-4/packages/xowf/xowf.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/xowf.info,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/xowf/xowf.info 27 Oct 2014 16:42:03 -0000 1.2
+++ openacs-4/packages/xowf/xowf.info 27 Apr 2015 15:28:22 -0000 1.3
@@ -9,15 +9,15 @@
ft
-
+ Gustaf NeumannXoWiki Content Flow - an XoWiki based workflow system implementing state-based behavior of wiki pages and forms
- 2014-09-02
+ 2015-03-23WU Vienna2
-
-
+
+
@@ -27,7 +27,7 @@
-
+
Index: openacs-4/packages/xowf/tcl/atjob-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/atjob-procs.tcl,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/xowf/tcl/atjob-procs.tcl 27 Oct 2014 16:42:03 -0000 1.2
+++ openacs-4/packages/xowf/tcl/atjob-procs.tcl 27 Apr 2015 15:28:22 -0000 1.3
@@ -48,8 +48,7 @@
set form_id [$class form_id -package_id $package_id -parent_id [[my object] parent_id]]
if {$form_id != 0} {
::xo::db::CrClass get_instance_from_db -item_id $form_id
- set instance_attributes [$form_id default_instance_attributes]
- lappend instance_attributes cmd $cmd
+ set instance_attributes [dict merge [$form_id default_instance_attributes] [list cmd $cmd]]
set name [::xowiki::autoname new -name [$form_id name] -parent_id $owner_id]
set f [::xowiki::FormPage new -destroy_on_cleanup \
-package_id $package_id \
Index: openacs-4/packages/xowf/tcl/xowf-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/xowf-procs.tcl,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/xowf/tcl/xowf-procs.tcl 27 Oct 2014 16:42:03 -0000 1.2
+++ openacs-4/packages/xowf/tcl/xowf-procs.tcl 27 Apr 2015 15:28:22 -0000 1.3
@@ -520,8 +520,7 @@
}
#my msg "forms=[my array names forms], parampages=[my array names parampages]"
set page [my object]
- $page set unresolved_references 0
- $page set __unresolved_references [list]
+ $page references clear
$page set __unresolved_object_type ::xowiki::Form
foreach {type pages} [list wf_form [my array names forms] wf_parampage [my array names parampages]] {
foreach p $pages {
@@ -532,17 +531,19 @@
set link_text [$l render]
}
}
- #my msg "-- link_text=$link_text// refs?[$page exists references]"
- if {[$page exists references]} {
- #my msg "updating references refs=[$page set references]"
- $page references_update [lsort -unique [$page set references]]
- $page set __extra_references [$page set references]
- $page unset references
+ set references [$page references get resolved]
+ #my log "-- link_text=$link_text// $references"
+
+ if {[llength $references] > 0} {
+ #my msg "updating references refs=$references"
+ $page references_update [lsort -unique $references]
+ $page set __extra_references $references
+ $page references clear
}
- if {[llength [$page set __unresolved_references]] > 0} {
+ if {[llength [$page references get unresolved]] > 0} {
# TODO: we should provide a link to create the missing forms. maybe we
# change unresolved_references to a list..., or maybe we write these into the DB.
- my msg -html t "Missing forms: [join [$page set __unresolved_references] {, }]"
+ my msg -html t "Missing forms: [join [$page references get unresolved] {, }]"
}
}
return [list rc 0]
@@ -719,8 +720,9 @@
__form_redirect_method __none \
__action_$action_name $action_name]
#ns_log notice "call_action pushed form_param to $cc: [$cc array get form_parameter]"
- $cc array set form_parameter $attributes
+ $cc load_form_parameter_from_values $attributes
+
$package_id set object "[$package_id folder_path -parent_id [$object parent_id]][$object name]"
#my log "call_action calls: ::$package_id invoke -method edit -batch_mode 1 // obj=[$package_id set object]"
@@ -820,7 +822,24 @@
}
}
- WorkflowPage ad_instproc render_form_action_buttons {{-CSSclass ""}} {
+ WorkflowPage ad_instproc render_form_action_buttons_widgets {{-CSSclass ""} buttons} {
+ With the given set of buttons, produce the HTML for the button
+ container and the included inputs.
+ } {
+ if {[llength $buttons] > 0} {
+ # take the form_button_wrapper_CSSclass from the first form field
+ ::html::div -class [[lindex $buttons 0] form_button_wrapper_CSSclass] {
+ foreach f $buttons {
+ $f render_input
+ }
+ }
+ }
+ }
+
+ WorkflowPage ad_instproc render_form_action_buttons {
+ {-formfieldButtonClass ::xowiki::formfield::submit_button}
+ {-CSSclass ""}
+ } {
Render the defined actions in the current state with submit buttons
} {
if {[my is_wf_instance]} {
@@ -834,21 +853,17 @@
if {$success} break
}
if {$success} {
- set f [::xowiki::formfield::submit_button new -destroy_on_cleanup \
+ set f [$formfieldButtonClass new -destroy_on_cleanup \
-name __action_[namespace tail $action] -CSSclass $CSSclass]
if {[$action exists title]} {$f title [$action title]}
$f value [$action label]
lappend buttons $f
}
}
- if {[llength $buttons] > 0} {
- # take the form_button_wrapper_CSSclass from the first form field
- ::html::div -class [[lindex $buttons 0] form_button_wrapper_CSSclass] {
- foreach f $buttons {
- $f render_input
- }
- }
- }
+ #
+ # render the widgets
+ #
+ my render_form_action_buttons_widgets -CSSclass $CSSclass $buttons
} else {
next
}
@@ -1112,7 +1127,7 @@
if {[regexp {^__action_(.+)$} $name _ action]} {
set ctx [::xowf::Context require [self]]
set next_state [my activate $ctx $action]
- my log "after activate next_state=$next_state, current_state=[$ctx get_current_state], [my set instance_attributes]"
+ #my log "after activate next_state=$next_state, current_state=[$ctx get_current_state], [my set instance_attributes]"
if {$next_state ne ""} {
if {[${ctx}::$next_state exists assigned_to]} {
my assignee [my get_assignee [${ctx}::$next_state assigned_to]]
@@ -1176,42 +1191,59 @@
my array unset __wf
next
}
+
WorkflowPage instproc save_data args {
if {[my is_wf_instance]} {
- #array set __ia [my instance_attributes]
- set ctx [::xowf::Context require [self]]
- my state [$ctx get_current_state]
- #my msg "saving ia: [array get __ia]"
- #my instance_attributes [array get __ia]
#
- # we have to flag currently storing in hstore here, since
- # saving removes the temporary variables for properties
+ # update the state in the workflow instance
#
- if {[::xo::dc has_hstore] && [[my package_id] get_parameter use_hstore 0]} {set save_in_hstore 1}
- } elseif {[my is_wf]} {
- if {[::xo::dc has_hstore] && [[my package_id] get_parameter use_hstore 0]} {set save_in_hstore 1}
+ set ctx [::xowf::Context require [self]]
+ my state [$ctx get_current_state]
}
next
- #my msg "save_in_hstore=[info exists save_in_hstore]"
- if {[info exists save_in_hstore]} {
- # "next" sets the revision_id, by not e.g. page_instance_id
- my set page_instance_id [my revision_id]
- my save_in_hstore
- }
}
+
+ WorkflowPage instproc save args {
+ set r [next]
+ my save_in_hstore
+ return $r
+ }
+ WorkflowPage instproc save_new args {
+ set r [next]
+ my save_in_hstore
+ return $r
+ }
+
+ WorkflowPage instproc hstore_attributes {} {
+ #
+ # We do not want to save the workflow definition in every workflow
+ # instance.
+ #
+ return [dict remove [my instance_attributes] workflow_definition]
+ }
+
WorkflowPage instproc save_in_hstore {} {
- # experimental code for testing with hstore
- # to use it, do for now something like:
#
- # /usr/local/pg820/bin/psql -U nsadmin -d dotlrn-test5 < /usr/local/pg820/share/postgresql/contrib/hstore.sql
- # alter table xowiki_page_instance add column hkey hstore;
- # CREATE INDEX hidx ON xowiki_page_instance using GIST(hkey);
+ # Experimental code for storing instance attributes in hstore. To
+ # use it, make sure to active hstore for the database with a
+ # command like:
#
- set hkey [::xowf::dict_as_hkey [dict remove [my instance_attributes] workflow_definition]]
- xo::dc dml update_hstore "update xowiki_page_instance \
- set hkey = '$hkey'
- where page_instance_id = [my revision_id]"
+ # $PGBIN/psql -U nsadmin -d dotlrn-test5 < /usr/local/pg/share/postgresql/contrib/hstore.sql
+ #
+ # .... and add a index for the hstore key to xowiki_page_instance:
+ #
+ # CREATE INDEX hidx ON xowiki_page_instance using GIST(hkey);
+ #
+ # ... and set the parameter "use_hstore" to 1. Then the following condition will be true.
+ #
+ if {[::xo::dc has_hstore] && [[my package_id] get_parameter use_hstore 0]} {
+ set hkey [::xowiki::hstore::dict_as_hkey [my hstore_attributes]]
+ set revision_id [my revision_id]
+ xo::dc dml update_hstore "update xowiki_page_instance \
+ set hkey = '$hkey' \
+ where page_instance_id = :revision_id"
+ }
}
WorkflowPage instproc wf_property {name {default ""}} {
if {[my exists __wf]} {set key __wf($name)} else {set key __wfi($name)}
@@ -1775,28 +1807,6 @@
}
- ad_proc ::xowf::double_quote {value} {
- @return double_quoted value as appropriate for hstore
- } {
- if {[regexp {[ ,\"\\=>\n\']} $value]} {
- set value \"[string map [list \" \\\" \\ \\\\ ' ''] $value]\"
- }
- return $value
- }
-
- ad_proc ::xowf::dict_as_hkey {dict} {
- @return dict value in form of a hstore key.
- } {
- set keys {}
- foreach {key value} $dict {
- set v [xowf::double_quote $value]
- if {$v eq ""} continue
- lappend keys [::xowf::double_quote $key]=>$v
- }
- return [join $keys ,]
- }
-
-
::xo::library source_dependent
#
Index: openacs-4/packages/xowiki/xowiki.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v
diff -u -N -r1.149 -r1.150
--- openacs-4/packages/xowiki/xowiki.info 27 Oct 2014 16:42:04 -0000 1.149
+++ openacs-4/packages/xowiki/xowiki.info 27 Apr 2015 15:28:22 -0000 1.150
@@ -10,10 +10,10 @@
txowiki
-
+ Gustaf NeumannA xotcl-based enterprise wiki system with multiple object types
- 2014-09-01
+ 2015-03-23WU Vienna<pre>
XoWiki is a Wiki implementation for OpenACS in XOTcl. Instead of
@@ -55,30 +55,32 @@
BSD-Style2
-
+
-
+
-
-
+
+
+
+
-
+
+
Index: openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml,v
diff -u -N -r1.44 -r1.45
--- openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml 27 Oct 2014 16:42:04 -0000 1.44
+++ openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml 27 Apr 2015 15:28:22 -0000 1.45
@@ -3,22 +3,24 @@
ZusammenfassungHinzuf�gen
+ hinzugef�gtVerwaltenAlle Arten von %pretty_plural% verwaltenVerwaltungsoptionen f�r dieses Wiki...vor %time%Alle Eintr�geZur�ckvon User/in
+ Auswahlm�glichkeitenKategorienGeben Sie hier die Antworten ein.
+ l�schen%errorMsg%EinstellungenInhaltKopiere EintragNeuen Eintrag vom Typ %type% erstellenErzeuge diese Seite in der folgenden Sprache:
- Ersteller/inTagTageL�schen
@@ -28,9 +30,9 @@
Alle Eintr�ge dieser Art l�schenL�schen best�tigen?L�sche diese Seite ...
- KurzbeschreibungDetailsBearbeiten
+ Kategorienbaum bearbeitenbearbeitenDiese Seite bearbeiten ...Eintr�ge f�r das Formular %form%:
@@ -44,6 +46,7 @@
OrtBeginnzeitVortragsbeginn
+ ZeitTitelVortragstitelExportieren
@@ -76,32 +79,39 @@
Wiki EinstellungenWiki FormPageWiki FormPages
+ hat diese Seite ver�ndert w�hrend sie von Ihnen bearbeitet wurdeStundeStundenImportierenUser-IDs erstellenFalls dieses K�stchen aktiviert ist, werden beim Import gegebenenfalls neue User-IDs erstellt.Objekte ersetzenFalls dieses K�stchen aktiviert ist, werden beim Import bereits bestehende Objekte ersetzt. Bei Nicht-Aktivieren wird beim Import eine neue Version des Objekts hinzugef�gt.
+ Die Objekte wurden erfolgreich importiertWiki Seiten importierenDatei f�r Upload ausw�hlenBesucher/innenBesucheIndexZur Startseite
+ vererbt
+ vererbt (Aktualisierung ignoriert)Eintr�geSpracheZuletzt besuchte SeitenInhaltsverzeichnis der %pretty_plural%Liste aller Arten von %pretty_plural%
+ Kategorien verwaltenHinzuf�genInhaltKopierenKopierenExportArchiv importieren
+ Wiki-SeiteMinuteMinuten
+ die ver�nderte SeiteMonatMonatenDie h�ufigsten Besucher/innen
@@ -110,13 +120,18 @@
Neue SeiteNeue SeiteNeue Seite erstellen ...
+ in einem neuen Fenster oder speichern Sie diese Seite erneut abQuelleKurztext
+ keine Daten vorhandenBenachrichtigungenVerwalten der Benachrichtigungen...ung�ltiger numerischer WertWiki ObjektWiki Objekte
+ Objekte neu eingef�gt
+ Objekte ersetzt
+ Objekte aktualisiertAbschnittErsteller/inKurzbeschreibung
@@ -134,6 +149,7 @@
InstanzattributeSeitenvorlageAutomatische Namensvergabe
+ Bitte �ffnen SieDauerSchl�sselwortePublikationsdatum
@@ -148,6 +164,7 @@
Zuletzt ge�nderte Seiten (nach Kategorien)Verweise auf diese Seite:Verweise dieser Seite:
+ ersetztVerlauf�nderungsgeschichte dieser Seite ...RSS-Klient
@@ -156,12 +173,15 @@
Suche in diesem Wiki...SekundeSekunden
+ Aktuelle AuswahlZuf�llige ReihenfolgeAlternativen in zuf�lliger Reihenfolge darstellen?AbonnierenTitelTitelUngelesene Seiten
+ aktualisiert
+ Benutzer/inAnsehenmehr...Woche
Index: openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml,v
diff -u -N -r1.65 -r1.66
--- openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 27 Oct 2014 16:42:04 -0000 1.65
+++ openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 27 Apr 2015 15:28:22 -0000 1.66
@@ -3,17 +3,24 @@
AbstractAdd
+ addedAdminAdminister all kind of %pretty_plural%Administer this package ...%time% agoAll items
+ Answers_for_Survey
+ Attached images
+ Attached mediaBackBy User
+ CandidatesCategoriesEinfachauswahlEinfachauswahl bedeutet, dass nur eine Antwortm�glichkeit korrekt ist.Enter some choices.
+ Choose file
+ clear%errorMsg%ConfigureContent
@@ -30,8 +37,9 @@
Delete all such items of this instancesConfirm delete?Delete this page ...
- Details
+ Detail LinkEdit
+ Edit Category Treeedit tagsEdit this page ...Entries for form %form%
@@ -59,7 +67,9 @@
LocationStart TimeStart of Lecture
- Title
+ Summary of the Event
+ Time
+ Title of the EventTitle of LectureExportFeedback
@@ -76,6 +86,8 @@
Workflow %form_name%Instances of %form_name%Fill out
+ [add another]
+ [x] OK TemplateUpdated form
@@ -94,24 +106,32 @@
Wiki parametersWiki FormPageWiki FormPages
+ has modified this page while you were editing it
+ Heighthourhours
+ The width and height are calculated in pixels (proportions might get lost).ImportCreate user_idsIf checked, import will create new user_ids if necessaryReplace objectsIf checked, import will delete the object if it exists and create it new, otherwise import just adds a revision
+ Import was successfulImport Wiki PagesImport file for uploadVisitorsVisitsIndexGo to the start page of this package ...
+ inherited
+ inherited (update ignored)
+ Insert imageInstancesLanguageLast Visited PagesIndex of %pretty_plural%List of all kind of %pretty_plural%
+ Manage CategoriesAddClearContent
@@ -123,6 +143,7 @@
Pageminuteminutes
+ modified pagemonthmonthsMost Frequent Visitors
@@ -131,13 +152,18 @@
New PageNew PageCreate a new page ...
+ in new window or save this page againSourceTeaser
+ no dataNotificationsManage notifications ...Invalid numeric valueWiki ObjectWiki Objects
+ objects newly inserted
+ objects replaced
+ objects updatedSectionCreation UserCreator
@@ -170,6 +196,7 @@
Manage Permissions for Page: %page_name%Wiki Plain PageWiki Plain Pages
+ Please openDurationE.g. 9:16 means 9 minutes 16 seconds (if ffmpeg is installed and configured, it will get the value automatically)Keywords
@@ -194,6 +221,7 @@
Recently Changed Pages (by categories)References to this Page:References of this Page:
+ replacedRevisionsShow revisions of this page ...%errorMsg%
@@ -205,19 +233,24 @@
secondsecondsTo create a click, click on a page name
+ SelectionShuffle AnswersShould the order of choices be presented in randomized order?SizeSubscribeTitleTitleUnread Items
+ updated
+ Upload file
+ UserViewView page in original context %context%View this page ...more...weekweeks
+ Width%errorMsg%yearyears
Index: openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl,v
diff -u -N -r1.43 -r1.44
--- openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl 27 Oct 2014 16:42:04 -0000 1.43
+++ openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl 27 Apr 2015 15:28:22 -0000 1.44
@@ -9,7 +9,7 @@
namespace eval ::xowiki {
- Class ADP_Generator -parameter {
+ Class create ADP_Generator -parameter {
{master 1}
{wikicmds 1}
{footer 1}
Index: openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl 27 Oct 2014 16:42:04 -0000 1.2
+++ openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl 27 Apr 2015 15:28:22 -0000 1.3
@@ -152,20 +152,16 @@
namespace eval ::xo::Table {
- Class ::xowiki::BootstrapTable \
+ Class create ::xowiki::BootstrapTable \
-superclass ::xo::Table \
-parameter {
skin
}
::xowiki::BootstrapTable instproc init {} {
- ns_log notice "init"
set trn_mixin [expr {[lang::util::translator_mode_p] ?"::xo::TRN-Mode" : ""}]
- ns_log notice "call render_with ::xo::Table::BootstrapTableRenderer $trn_mixin"
my render_with BootstrapTableRenderer $trn_mixin
- ns_log notice "init-next"
next
- ns_log notice "init-next DONE"
}
Class create BootstrapTableRenderer \
Index: openacs-4/packages/xowiki/tcl/folder-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/folder-procs.tcl,v
diff -u -N -r1.28 -r1.29
--- openacs-4/packages/xowiki/tcl/folder-procs.tcl 27 Oct 2014 16:42:04 -0000 1.28
+++ openacs-4/packages/xowiki/tcl/folder-procs.tcl 27 Apr 2015 15:28:22 -0000 1.29
@@ -55,10 +55,32 @@
return [$tree render -style yuitree -js $js]
}
+ folders instproc folder_query {
+ -form_id:required
+ -package_id:required
+ {-parent_id ""}
+ } {
+ if {$parent_id eq ""} {
+ return [subst {
+ select * from xowiki_form_instance_item_view
+ where page_template = '$form_id' and package_id = '$package_id'
+ and publish_status = 'ready'
+ }]
+ }
+ return [subst {
+ select * from xowiki_form_instance_children ch
+ left join xowiki_form_instance_attributes xa on (ch.item_id = xa.item_id)
+ where page_template = '$form_id' and ch.package_id = '$package_id'
+ and root_item_id = '$parent_id'
+ and publish_status = 'ready'
+ }]
+ }
+
folders instproc collect_folders {
-package_id:required
-folder_form_id:required
-link_form_id:required
+ {-parent_id ""}
{-subtree_query ""}
{-depth 3}
} {
@@ -70,17 +92,25 @@
#
# get folders
#
- set folder_pages [::xowiki::FormPage get_form_entries \
- -base_item_ids $folder_form_id -form_fields "" \
- -extra_where_clause $subtree_query \
- -publish_status ready -package_id $package_id]
+ set sql [my folder_query -form_id $folder_form_id \
+ -parent_id $parent_id \
+ -package_id $package_id]
+ ns_log notice "folder_pages:\n$sql"
+ set folder_pages [::xowiki::FormPage instantiate_objects -sql $sql \
+ -named_objects true -object_named_after "item_id" \
+ -object_class ::xowiki::FormPage -initialize true]
+
#
# get links
#
- set links [::xowiki::FormPage get_form_entries \
- -base_item_ids $link_form_id -form_fields "" \
- -extra_where_clause $subtree_query \
- -publish_status ready -package_id $package_id]
+ set sql [my folder_query -form_id $link_form_id \
+ -parent_id $parent_id \
+ -package_id $package_id]
+ ns_log notice "links:\n$sql"
+ set links [::xowiki::FormPage instantiate_objects -sql $sql \
+ -named_objects true -object_named_after "item_id" \
+ -object_class ::xowiki::FormPage -initialize true]
+
#my msg "[llength [$links children]] links"
set folders [$folder_pages children]
@@ -101,17 +131,10 @@
# we found a cross-package link. These kind of links require further queries
#
set target [$l get_target_from_link_page]
-
- # the following clause needs an oracle counter-part
- set tree_sortkey [::xo::dc get_value get_tree_sort_key \
- "select tree_sortkey from acs_objects where object_id = [$target item_id]"]
- set extra_where "and bt.item_id in (select object_id from acs_objects \
- where tree_sortkey between '$tree_sortkey' and tree_right('$tree_sortkey') \
- and object_type = 'content_item')"
-
set sub_folders [my collect_folders -package_id [$target physical_package_id] \
-folder_form_id $folder_form_id -link_form_id $link_form_id \
- -subtree_query $extra_where -depth [expr {$depth -1}]]
+ -parent_id [$target item_id] \
+ -depth [expr {$depth -1}]]
foreach f $sub_folders {
@@ -130,12 +153,12 @@
# TODO we could save the double-fetch by collecing in
# get_form_entries via item-ids, not via new-objects
#
- ::xo::db::CrClass get_instance_from_db -item_id [$f item_id]
+ #::xo::db::CrClass get_instance_from_db -item_id [$f item_id]
[$f item_id] set_resolve_context -package_id [$l package_id] -parent_id [$l item_id]
} else {
#my msg "2 found child [$f name] and reset parent_id from [$f parent_id] to [$f parent_id], package id [$l package_id]"
$f set_resolve_context -package_id [$l package_id] -parent_id [$f parent_id]
- ::xo::db::CrClass get_instance_from_db -item_id [$f item_id]
+ #::xo::db::CrClass get_instance_from_db -item_id [$f item_id]
[$f item_id] set_resolve_context -package_id [$l package_id] -parent_id [$f parent_id]
}
@@ -305,14 +328,15 @@
set label "[$top_folder_of_tree title] ..."
}
- set t [::xowiki::Tree new -id foldertree_[my id] ]
+ set t [::xowiki::Tree new -id foldertree_[my id] -destroy_on_cleanup]
set node [::xowiki::TreeNode new \
-href $href \
-label $label \
-highlight [expr {$current_folder_id == [$top_folder_of_tree item_id]}] \
-object $top_folder_of_tree \
-expanded 1 \
- -open_requests 1]
+ -open_requests 1 \
+ -destroy_on_cleanup]
$t add $node
set folders [my collect_folders \
-package_id $package_id \
@@ -364,7 +388,8 @@
-object $c \
-highlight $is_current \
-expanded $is_open \
- -open_requests 1]
+ -open_requests 1 \
+ -destroy_on_cleanup]
$node add $subnode
if {$is_current} {
@@ -469,7 +494,7 @@
# scoping in "-columns"
set ::with_publish_status [expr {$publish_status ne "ready"}]
- switch [$package_id get_parameter "PreferredCSSToolkit" yui] {
+ switch [$package_id get_parameter PreferredCSSToolkit yui] {
bootstrap {set tableWidgetClass ::xowiki::BootstrapTable}
default {set tableWidgetClass ::xowiki::YUIDataTable}
}
@@ -620,7 +645,7 @@
#
###########################################################
- Class menuentries -superclass textarea -parameter {
+ Class create menuentries -superclass textarea -parameter {
{rows 10}
{cols 80}
}
Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v
diff -u -N -r1.241 -r1.242
--- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 27 Oct 2014 16:42:04 -0000 1.241
+++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 27 Apr 2015 15:28:22 -0000 1.242
@@ -10,7 +10,7 @@
# Second approximation for form fields.
# FormFields are objects, which can be outputed as well in ad_forms
- # or asHTML included in wiki pages. FormFields support
+ # or asHTML included in wiki pages. FormFields support
#
# - validation
# - help_text
@@ -20,7 +20,7 @@
# and inherit properties of the original datatypes via slots
# (e.g. for boolean entries). FormFields can be subclassed
# to ensure tailorability and high reuse.
- #
+ #
# todo: at some later time, this could go into xotcl-core
###########################################################
@@ -29,22 +29,22 @@
#
###########################################################
Class create FormField -superclass ::xo::tdom::Object -parameter {
- {required false}
- {display_field true}
- {hide_value false}
+ {required false}
+ {display_field true}
+ {hide_value false}
{inline false}
{mode edit}
{disabled}
{show_raw_value}
{CSSclass}
{style}
- {type text}
- {label}
- {name}
- {id}
+ {type text}
+ {label}
+ {name}
+ {id}
{title}
- {value ""}
- {spec ""}
+ {value ""}
+ {spec ""}
{help_text ""}
{error_msg ""}
{validator ""}
@@ -139,7 +139,7 @@
my instvar label
return [_ acs-templating.Element_is_required]
}
- #
+ #
#my msg "++ [my name] [my info class] validator=[my validator] ([llength [my validator]]) value=$value"
foreach validator [my validator] {
set errorMsg ""
@@ -152,9 +152,9 @@
#my msg "++ [my name]: field-level validator exists '$validator_method' ? [expr {$proc_info ne {}}]"
if {$proc_info ne ""} {
# we have a slot checker, call it
- #my msg "++ call-field level validator $validator_method '$value'"
+ #my msg "++ call-field level validator $validator_method '$value'"
set success [my validation_check $validator_method $value]
- }
+ }
if {$success == 1} {
# the previous check was ok, check now for a validator on the
# object level
@@ -163,7 +163,7 @@
#my msg "++ [my name]: page-level validator exists ? [expr {$proc_info ne {}}]"
if {$proc_info ne ""} {
set success [$obj $validator_method $value]
- #my msg "++ call page-level validator $validator_method '$value' returns $success"
+ #my msg "++ call page-level validator $validator_method '$value' returns $success"
}
}
if {$success == 0} {
@@ -226,7 +226,7 @@
}
return $success
}
-
+
FormField set cond_regexp {^([^=?]+)[?]([^:]*)[:](.*)$}
FormField proc get_single_spec {-package_id -object string} {
@@ -256,7 +256,7 @@
FormField instproc behavior {mixin} {
#
- # Specify the behavior of a form field via
+ # Specify the behavior of a form field via
# per object mixins
#
set obj [my object]
@@ -306,10 +306,10 @@
}
if {[catch {
#
- # We want to allow a programmer to use e.g. options=[xowiki::locales]
+ # We want to allow a programmer to use e.g. options=[xowiki::locales]
#
# Note: do not allow users to use [] via forms, since they might
- # execute arbitrary commands. The validator for the form fields
+ # execute arbitrary commands. The validator for the form fields
# makes sure, that the input specs are free from square brackets.
#
if {[string match {\[*\]} $value]} {
@@ -321,9 +321,9 @@
}
}
default {
- # Check, if the spec value $s is a class.
+ # Check, if the spec value $s is a class.
set old_class [my info class]
- # Don't allow to use namespaced values, since we would run
+ # Don't allow to use namespaced values, since we would run
# into a recursive loop for richtext::wym (could be altered there as well).
if {[my isclass ::xowiki::formfield::$s] && ![string match "*:*" $s]} {
my class ::xowiki::formfield::$s
@@ -397,11 +397,11 @@
append spec " {label " [list $label] "} "
if {[my exists html]} {
- append spec " {html {"
+ append spec " {html {"
foreach {key value} [array get html] {
append spec $key " " [list $value] " "
}
- append spec "}} "
+ append spec "}} "
}
if {[my exists options]} {
@@ -424,7 +424,7 @@
FormField instproc render {} {
# In case, we use an asHTML of a FormField, we use this
- # render definition
+ # render definition
if {[my inline]} {
# with label, error message, help text
my render_form_widget
@@ -434,7 +434,7 @@
}
my set __rendered 1
}
-
+
FormField instproc render_form_widget {} {
# This method provides the form-widget wrapper
set CSSclass [my form_widget_CSSclass]
@@ -472,8 +472,8 @@
FormField instproc render_input {} {
#
- # This is the most general widget content renderer.
- # If no special renderer is defined, we fall back to this one,
+ # This is the most general widget content renderer.
+ # If no special renderer is defined, we fall back to this one,
# which is in most cases a simple input fied of type string.
#
if {[my mode] ne "edit"} {
@@ -509,7 +509,7 @@
::html::input [list type hidden name [my name] value [my set value]] {}
}
my set __rendered 1
- }
+ }
FormField instproc render_item {} {
::html::div -class [my form_item_wrapper_CSSclass] {
@@ -563,7 +563,7 @@
}
FormField instproc localize {v} {
- # We localize in pretty_value the message keys in the
+ # We localize in pretty_value the message keys in the
# language of the item (not the connection item).
if {[regexp "^#(.*)#$" $v _ key]} {
return [lang::message::lookup [my locale] $key]
@@ -680,7 +680,7 @@
if {$entry_name eq ""} return
if {[my set value] eq ""} return
my instvar object value
-
+
array set "" [$object item_ref -default_lang [$object lang] -parent_id $parent_id $entry_name]
set label [my label] ;# the label is used for alt und title
@@ -690,7 +690,7 @@
# parent object as label.
set label [[my object] title]
}
-
+
set l [::xowiki::Link create new -destroy_on_cleanup \
-page $object -type "image" -lang $(prefix) \
[list -stripped_name $(stripped_name)] [list -label $label] \
@@ -705,7 +705,7 @@
foreach option {
href cssclass
- float width height
+ float width height
padding padding-right padding-left padding-top padding-bottom
margin margin-left margin-right margin-top margin-bottom
border border-width position top botton left right
@@ -719,14 +719,14 @@
###########################################################
#
- # helper method for extending slots:
- # either, we make a meta class for form-fields, or this should
+ # helper method for extending slots:
+ # either, we make a meta class for form-fields, or this should
# should go into xotcl-core
#
###########################################################
::Serializer exportMethods {
- ::xotcl::Class instproc extend_slot_default
+ ::xotcl::Class instproc extend_slot_default
}
Class instproc extend_slot_default {name value} {
# Search for the slot. If the slot exists, extend it's default
@@ -748,7 +748,7 @@
#
###########################################################
- Class create submit_button -superclass FormField
+ Class create submit_button -superclass FormField
submit_button instproc initialize {} {
my set type submit
my set value [::xo::localize [_ xowiki.Form-submit_button]]
@@ -778,7 +778,13 @@
link_label
}
file instproc check=virus {value} {
- if {[my viruscheck] && $value ne "" && [::xowiki::virus check [my set tmpfile]]} {
+ set tmpfile [my set tmpfile]
+ # In case of an upgrade script, the (uploaded) tmp file might not exist
+ if {[my viruscheck]
+ && $value ne ""
+ && [file exists $tmpfile]
+ && [::xowiki::virus check $tmpfile]
+ } {
#util_user_message -message "uploaded file contains a virus; upload rejected"
return 0
}
@@ -828,7 +834,7 @@
return [my get_old_value]
}
return [my set value]
- }
+ }
return [next]
}
@@ -848,7 +854,7 @@
array set entry_info [my entry_info $value]
set content_type [my set content-type]
- if {$content_type eq "application/octetstream"
+ if {$content_type eq "application/octetstream"
|| $content_type eq "application/force-download"
} {
set content_type [::xowiki::guesstype $value]
@@ -863,7 +869,7 @@
$file_object set title $value
$file_object save
} else {
- # create a new file
+ # create a new file
#my msg "new file"
set file_object [::xowiki::File new -destroy_on_cleanup \
-title $value \
@@ -923,7 +929,7 @@
append href &revision_id=$revision_id
}
}
-
+
#
# The HTML5 handling of "required" would force us to upload in
# every form the file again. To implement the sticky option, we
@@ -944,15 +950,15 @@
::html::input -type hidden -name $id -id $id -value $value
::html::span -class file-control -id __a$id {
::html::a -href $href {::html::t [my label_or_value $fn] }
-
+
# Show the clear button just when
# - there is something to clear, and
# - the formfield is not disabled, and
# - the form-field is not sticky (default)
-
+
set disabled [expr {[my exists disabled] && [my disabled] != "false"}]
if {$value ne "" && !$disabled && ![my sticky] } {
- ::html::input -type button -value clear \
+ ::html::input -type button -value [_ xowiki.clear] \
-onClick "document.getElementById('$id').value = ''; document.getElementById('__a$id').style.display = 'none';"
}
}
@@ -1010,7 +1016,7 @@
Class create image -superclass file -parameter {
href cssclass
- float width height
+ float width height
padding padding-right padding-left padding-top padding-bottom
margin margin-left margin-right margin-top margin-bottom
border border-width position top botton left right
@@ -1060,7 +1066,7 @@
# ::xowiki::formfield::inform
#
###########################################################
-
+
Class create inform -superclass FormField
inform instproc initialize {} {
my type hidden
@@ -1095,7 +1101,7 @@
#
###########################################################
- Class create color -superclass text
+ Class create color -superclass text
color instproc initialize {} {
next
my type color
@@ -1107,22 +1113,46 @@
#
###########################################################
- Class create datetime -superclass text
+ Class create datetime -superclass text
datetime instproc initialize {} {
next
my type datetime
}
- # names for HTML5 types
- # date, month
- # already in use, should redefine accordingly when avail
###########################################################
#
+ # ::xowiki::formfield::h5date
+ #
+ # HTML 5 input type "date", to avoid naming conflict with
+ # pre-existing formfield of type "date"
+ ###########################################################
+ Class create h5date -superclass text
+ h5date instproc initialize {} {
+ next
+ my type date
+ }
+
+ ###########################################################
+ #
+ # ::xowiki::formfield::h5time
+ #
+ # HTML 5 input type "time", to avoid naming conflict with
+ # pre-existing formfield of type "time"
+ ###########################################################
+ Class create h5time -superclass text
+ h5time instproc initialize {} {
+ next
+ my type time
+ }
+
+
+ ###########################################################
+ #
# ::xowiki::formfield::datetime-local
#
###########################################################
- Class create datetime-local -superclass text
+ Class create datetime-local -superclass text
datetime-local instproc initialize {} {
next
my type datetime-local
@@ -1134,7 +1164,7 @@
#
###########################################################
- Class create time -superclass text
+ Class create time -superclass text
time instproc initialize {} {
next
my type time
@@ -1146,7 +1176,7 @@
#
###########################################################
- Class create week -superclass text
+ Class create week -superclass text
week instproc initialize {} {
next
my type datetime
@@ -1158,7 +1188,7 @@
#
###########################################################
- Class create email -superclass text
+ Class create email -superclass text
email instproc initialize {} {
next
my type email
@@ -1170,7 +1200,7 @@
#
###########################################################
- Class create search -superclass text
+ Class create search -superclass text
search instproc initialize {} {
next
my type search
@@ -1181,7 +1211,7 @@
#
###########################################################
- Class create tel -superclass text
+ Class create tel -superclass text
tel instproc initialize {} {
next
my type tel
@@ -1230,7 +1260,7 @@
#
###########################################################
- Class create password -superclass text
+ Class create password -superclass text
password instproc initialize {} {
next
my set widget_type password
@@ -1244,7 +1274,7 @@
Class create numeric -superclass text -parameter {
{format %.2f}
- } -extend_slot_default validator numeric
+ } -extend_slot_default validator numeric
numeric instproc initialize {} {
next
my set widget_type numeric
@@ -1436,6 +1466,7 @@
}
textarea instproc initialize {} {
my set widget_type text(textarea)
+ my set booleanHTMLAttributes {required readonly disabled formnovalidate}
foreach p [list rows cols style] {if {[my exists $p]} {my set html($p) [my $p]}}
if {![my istype ::xowiki::formfield::richtext] && [my exists editor]} {
# downgrading
@@ -1447,7 +1478,7 @@
}
textarea instproc render_input {} {
- set booleanAtts [my booleanAttributes required readonly disabled formnovalidate]
+ set booleanAtts [my booleanAttributes {*}[my set booleanHTMLAttributes]]
::html::textarea [my get_attributes id name cols rows style wrap placeholder {CSSclass class} \
{*}$booleanAtts] {
::html::t [my value]
@@ -1485,15 +1516,15 @@
Class create richtext -superclass textarea \
-extend_slot_default validator safe_html \
-parameter {
- plugins
+ plugins
folder_id
script_dir
{displayMode standard}
width
height
{wiki false}
}
-
+
richtext instproc editor {args} {
#
# TODO: this should be made a slot setting
@@ -1519,7 +1550,7 @@
#my msg "MIXIN $editor: [my info precedence]"
my reset_parameter
my set __initialized 1
- }
+ }
my set editor $editor
}
@@ -1531,11 +1562,16 @@
standard {}
default {error "value '[my set displayMode]' invalid: valid entries for displayMode are inplace, inline or standard (default)"}
}
+ #
+ # Don't set HTML5 attribute required, since this does not match
+ # well with Richtext Editors (at least ckeditor4 has problems,
+ # other probably as well).
+ #
+ my set booleanHTMLAttributes {readonly disabled formnovalidate}
next
if {![my exists editor]} {
- # set the default editor; TODO: should be a parameter
- my set editor xinha
- #my set editor ckeditor4
+ my set editor [parameter::get_global_value -package_key xowiki \
+ -parameter PreferredRichtextEditor -default xinha]
#my msg "setting default of [my name] to [my set editor]"
}
if {![my exists __initialized]} {
@@ -1550,9 +1586,7 @@
#my msg "[my get_attributes id style {CSSclass class}]"
::html::div [my get_attributes id style {CSSclass class}] {
if {[my wiki]} {
- [my object] set unresolved_references 0
- [my object] set __unresolved_references [list]
- #::html::t -disableOutputEscaping [[my object] substitute_markup [list [my value] text/html]]
+ [my object] references clear
::html::t -disableOutputEscaping [[my object] substitute_markup [my value]]
} else {
::html::t -disableOutputEscaping [my value]
@@ -1634,7 +1668,7 @@
});
editor.setData(calc_wiki_image_links_to_image_tags(editor.getData()));
}
-
+
function calc_image_tags_to_wiki_image_links (form) {
var calc = function() {
var wiki_link = $(this).attr('alt');
@@ -1643,15 +1677,15 @@
$(form).find('iframe').each(function() {
$(this).contents().find('img[type="wikilink"]').each(calc);
});
-
+
$(form).find('textarea.ckeip').each(function() {
var contents = $('
'+this.value+'
');
contents.find('img[type="wikilink"]').each(calc);
this.value = contents.html();
});
return true;
}
-
+
function calc_wiki_image_links_to_image_tags (data) {
var pathname = window.location.pathname;
pathname = pathname.substr(pathname.lastIndexOf("/")+1,pathname.length)
@@ -1688,9 +1722,9 @@
::xo::Page requireCSS "/resources/xowiki/jquery-ui-1.8.17.custom.css"
# In contrary to the doc, ckeditor names instances after the id,
- # not the name.
+ # not the name.
set id [my id]
- set name [my name]
+ set name [my name]
set package_id [[my object] package_id]
#my extraPlugins {timestamp xowikiimage}
@@ -1700,7 +1734,7 @@
} else {
set ready_callback "/*none*/;"
}
-
+
set options [subst {
toolbar : '[my toolbar]',
uiColor: '[my uiColor]',
@@ -1778,25 +1812,26 @@
Class create richtext::ckeditor4 -superclass richtext -parameter {
{editor ckeditor4}
{mode wysiwyg}
- {skin kama}
+ {skin bootstrapck}
{toolbar Full}
{CSSclass xowiki-ckeditor}
{uiColor ""}
{CSSclass xowiki-ckeditor}
{customConfig "config.js"}
{callback "/* callback code */"}
{destroy_callback "/* callback code */"}
- {extraPlugins ""}
+ {submit_callback ""}
+ {extraPlugins "xowikiimage"}
{templatesFiles ""}
{templates ""}
{contentsCss /resources/xowiki/ck_contents.css}
{imageSelectorDialog /xowiki/ckeditor-images/}
+ {additionalConfigOptions ""}
}
richtext::ckeditor4 set editor_mixin 1
richtext::ckeditor4 instproc initialize {} {
switch -- [my set displayMode] {
inplace { my append help_text " #xowiki.ckeip_help#" }
- inline { if {![my exists default]} {my set default " "} }
}
next
my set widget_type richtext
@@ -1816,7 +1851,7 @@
editor.setData(calc_wiki_image_links_to_image_tags(editor.getData()));
}
}
-
+
function calc_image_tags_to_wiki_image_links (form) {
var calc = function() {
var wiki_link = $(this).attr('alt');
@@ -1825,24 +1860,25 @@
$(form).find('iframe').each(function() {
$(this).contents().find('img[type="wikilink"]').each(calc);
});
-
+
$(form).find('textarea.ckeip').each(function() {
var contents = $('
'+this.value+'
');
contents.find('img[type="wikilink"]').each(calc);
this.value = contents.html();
});
return true;
}
-
+
function calc_image_tags_to_wiki_image_links_inline (e) {
- var data = $('
'+e.editor.getData()+'
');
+ var data = $('
'+CKEDITOR.instances[e].getData()+'
');
data.find('img[type="wikilink"]').each( function() {
var wiki_link = $(this).attr('alt');
$(this).replaceWith('[['+wiki_link+']]');
});
- document.getElementById(e.editor.config.textarea_id).innerHTML=data.html();
+ CKEDITOR.instances[e].setData(data.html());
+ CKEDITOR.instances[e].updateElement();
}
-
+
function calc_wiki_image_links_to_image_tags (data) {
var pathname = window.location.pathname;
pathname = pathname.substr(pathname.lastIndexOf("/")+1,pathname.length)
@@ -1854,7 +1890,7 @@
}
}
}
-
+
richtext::ckeditor4 instproc pathNames {fileNames} {
set result [list]
foreach fn $fileNames {
@@ -1866,44 +1902,43 @@
}
return $result
}
-
+
richtext::ckeditor4 instproc render_input {} {
set disabled [expr {[my exists disabled] && [my disabled] != "false"}]
set is_repeat_template [expr {[my exists is_repeat_template] && [my set is_repeat_template] == "true"}]
# my msg "[my id] [my name] - $is_repeat_template"
-
- # if value is empty, we need something to be clickable for display mode inline or inplace
- if {[my value] eq "" && [my set displayMode] in {inline inplace}} {
+
+ # if value is empty, we need something to be clickable for display mode inplace
+ if {[my value] eq "" && [my set displayMode] eq "inplace"} {
my value " "
}
-
+
if {![my istype ::xowiki::formfield::richtext] || ($disabled && !$is_repeat_template)} {
my render_richtext_as_div
} else {
::xo::Page requireJS "/resources/xowiki/jquery/jquery.min.js"
::xo::Page requireJS "/resources/xowiki/ckeditor4/ckeditor.js"
::xo::Page requireJS "/resources/xowiki/ckeditor4/adapters/jquery.js"
- ::xo::Page requireJS "/resources/xowiki/jquery-ui-1.8.17.custom.min.js"
- ::xo::Page requireCSS "/resources/xowiki/jquery-ui-1.8.17.custom.css"
-
+ #::xo::Page requireJS "/resources/xowiki/jquery-ui-1.8.17.custom.min.js"
+ #::xo::Page requireCSS "/resources/xowiki/jquery-ui-1.8.17.custom.css"
+
# In contrary to the doc, ckeditor4 names instances after the id,
- # not the name.
+ # not the name.
set id [my id]
- set name [my name]
+ set name [my name]
set package_id [[my object] package_id]
- my extraPlugins {timestamp xowikiimage tlflrn}
- # my extraPlugins {timestamp}
if {[my set displayMode] eq "inline"} {my lappend extraPlugins sourcedialog}
-
+
if {"xowikiimage" in [my extraPlugins]} {
my js_image_helper
set ready_callback {xowiki_image_callback(e.editor);}
} else {
set ready_callback "/*none*/;"
- set blur_callback "/*none*/;"
+ set submit_callback "/*none*/;"
}
-
+
set options [subst {
+ [my set additionalConfigOptions]
toolbar : '[my toolbar]',
uiColor: '[my uiColor]',
language: '[lang::conn::language]',
@@ -1925,17 +1960,17 @@
if {[my templates] ne ""} {
append options " , templates: '[my templates]'\n"
}
-
+
#set parent [[[my object] package_id] get_page_from_item_or_revision_id [[my object] parent_id]];# ???
-
+
if {[my set displayMode] eq "inplace"} {
if {!$is_repeat_template} {
set callback [my callback]
set destroy_callback [my destroy_callback]
-
+
my lappend CSSclass ckeip
::xo::Page requireJS "/resources/xowiki/ckeip.js"
-
+
::xo::Page requireJS [subst -nocommands {
function load_$id () {
\$( '\#$id' ).ckeip(function() { $callback }, {
@@ -1947,48 +1982,62 @@
});
}
\$(document).ready(function() {
- load_$id ();
+ if (\$('#$id').parents('.repeatable').length != 0) {
+ if (\$('#$id').is(':visible')) {
+ load_$id ();
+ }
+ } else {
+ //this is not inside a repeatable container, load normally
+ load_$id ();
+ }
} );
}]
}
my render_richtext_as_div
} elseif {[my set displayMode] eq "inline"} {
if {!$is_repeat_template} {
if {"xowikiimage" in [my extraPlugins]} {
- set ready_callback "xowiki_image_callback(CKEDITOR.instances\['ckinline_$id'\]);"
- set blur_callback "calc_image_tags_to_wiki_image_links_inline(e);"
+ set ready_callback "xowiki_image_callback(CKEDITOR.instances\['$id'\]);"
+ set submit_callback "calc_image_tags_to_wiki_image_links_inline('$id');"
}
-
- ::xo::Page requireJS [subst -nocommands {
+
+ set submit_callback "$submit_callback [my submit_callback]"
+ ::xo::Page requireJS [subst {
function load_ckinline_$id () {
- CKEDITOR.inline('ckinline_$id', {
+ CKEDITOR.inline('$id', {
on: {
- blur: function(e) {
- $blur_callback
+ instanceReady: function(e) {
+ \$(e.editor.element.\$).attr('title', '[my set label]');
+ \$(e.editor.element.\$.form).submit(function(e) {
+ $submit_callback
+ });
}
},
$options
});
}
\$(document).ready(function() {
- load_ckinline_$id ();
+ if (\$('#$id').parents('.repeatable').length != 0) {
+ if (\$('#$id').is(':visible')) {
+ load_ckinline_$id ();
+ }
+ } else {
+ //this is not inside a repeatable container, load normally
+ load_ckinline_$id ();
+ }
$ready_callback
- });
+ });
}]
}
- my set style "display:none;"
next
- ::html::div "id ckinline_[my set id] name [my set name] class xowiki-ckeditor contenteditable true" {
- ::html::t -disableOutputEscaping [my value]
- }
} else {
if {!$is_repeat_template} {
set callback [my callback]
::xo::Page requireJS [subst -nocommands {
function load_$id () {
\$( '#$id' ).ckeditor(function() { $callback }, {
$options
- });
+ });
}
\$(document).ready(function() {
load_$id ();
@@ -1999,8 +2048,8 @@
next
}
}
- }
-
+ }
+
###########################################################
#
# ::xowiki::formfield::richtext::wym
@@ -2043,7 +2092,7 @@
}
}
regsub -all {[.:]} [my id] {\\\\&} JID
-
+
# possible skins are per in the distribution: "default", "sliver", "minimal" and "twopanels"
set config [list "skin: '[my skin]'"]
@@ -2070,7 +2119,7 @@
jQuery("#$JID").wymeditor($config);
});
}]
-
+
next
}
}
@@ -2092,13 +2141,13 @@
richtext::xinha set editor_mixin 1
richtext::xinha instproc initialize {} {
switch -- [my set displayMode] {
- inplace {
+ inplace {
::xo::Page requireJS "/resources/xowiki/xinha-inplace.js"
if {![info exists ::__xinha_inplace_init_done]} {
template::add_body_handler -event onload -script "xinha.inplace.init();"
- set ::__xinha_inplace_init_done 1
+ set ::__xinha_inplace_init_done 1
}
- }
+ }
inline { error "inline is not supported for xinha"}
}
@@ -2111,18 +2160,18 @@
-package_key "acs-templating" -parameter "XinhaDefaultPlugins"]]
}
my set options [my get_attributes editor plugins width height folder_id script_dir javascript wiki_p]
- # for the time being, we can't set the defaults via parameter,
+ # for the time being, we can't set the defaults via parameter,
# but only manually, since the editor is used as a mixin, the parameter
# would have precedence over the defaults of subclasses
- if {![my exists slim]} {my set slim false}
+ if {![my exists slim]} {my set slim false}
if {![my exists style]} {my set style "width: 100%;"}
if {![my exists height]} {my set height 350px}
if {![my exists wiki_p]} {my set wiki_p 1}
if {[my set slim]} {
my lappend options javascript {
- xinha_config.toolbar = [['popupeditor', 'formatblock', 'bold','italic','createlink','insertimage'],
+ xinha_config.toolbar = [['popupeditor', 'formatblock', 'bold','italic','createlink','insertimage'],
['separator','insertorderedlist','insertunorderedlist','outdent','indent'],
- ['separator','killword','removeformat','htmlmode']
+ ['separator','killword','removeformat','htmlmode']
];
}
}
@@ -2133,13 +2182,13 @@
if {![my istype ::xowiki::formfield::richtext] || $disabled} {
my render_richtext_as_div
} else {
- # we use for the time being the initialization of xinha based on
+ # we use for the time being the initialization of xinha based on
# the site master
set ::acs_blank_master(xinha) 1
set quoted [list]
foreach e [my plugins] {lappend quoted '$e'}
set ::acs_blank_master(xinha.plugins) [join $quoted ", "]
-
+
array set o [my set options]
set xinha_options ""
foreach e {width height folder_id fs_package_id file_types attach_parent_id wiki_p package_id} {
@@ -2244,7 +2293,7 @@
set package_id [[my object] package_id]
set tree_ids [::xowiki::Category get_mapped_trees -object_id $package_id -locale [my locale] \
-names $tree_name -output tree_id]
-
+
# In case there are multiple trees with the same name,
# take the first one.
#
@@ -2255,7 +2304,7 @@
return
}
set subtree_id ""
- set options [list]
+ set options [list]
foreach category [::xowiki::Category get_category_infos \
-subtree_id $subtree_id -tree_id $tree_id] {
@@ -2407,7 +2456,7 @@
::xowiki::Includelet require_YUI_JS -ajaxhelper $ajaxhelper "utilities/utilities.js"
::xowiki::Includelet require_YUI_JS -ajaxhelper $ajaxhelper "selector/selector-min.js"
::xo::Page requireJS "/resources/xowiki/yui-selection-area.js"
-
+
set js ""
foreach o [my options] {
lassign $o label rep
@@ -2416,9 +2465,9 @@
append js "YAHOO.xo_sel_area.DDApp.values\['$js_label'\] = '$js_rep';\n"
append js "YAHOO.xo_sel_area.DDApp.dict\['$js_rep'\] = '$js_label';\n"
}
-
+
::html::div -class workarea {
- ::html::h3 { ::html::t "Selection"}
+ ::html::h3 { ::html::t "#xowiki.Selection#"}
set values ""
foreach v [my value] {
append values $v \n
@@ -2427,14 +2476,14 @@
my CSSclass selection
my set cols 30
set atts [my get_attributes id name disabled {CSSclass class}]
-
+
# TODO what todo with DISABLED?
::html::textarea [my get_attributes id name cols rows style {CSSclass class} disabled] {
::html::t $values
}
}
::html::div -class workarea {
- ::html::h3 { ::html::t "Candidates"}
+ ::html::h3 { ::html::t "#xowiki.Candidates#"}
::html::ul -id [my id]_candidates -class region {
#my msg [my options]
foreach o [my options] {
@@ -2472,7 +2521,7 @@
#my compute_options
next
}
-
+
abstract_page instproc fetch_entry_label {entry_label item_id} {
# The following is a temporary solution, only working with cr-item attributes
# We should support as well user level instance attributes.
@@ -2490,7 +2539,7 @@
}
return ""
}
-
+
abstract_page instproc pretty_value {v} {
my instvar package_id
set object [my object]
@@ -2522,7 +2571,7 @@
#my log "comparing '$value' with '$v'"
if {$value eq $v} {
if {[my as_box]} {
- return [$object include [list $value -decoration rightbox]]
+ return [$object include [list $value -decoration rightbox]]
}
set href [$package_id pretty_link -parent_id $parent_id $value]
return "$label"
@@ -2560,7 +2609,7 @@
#set form_obj [[my object] resolve_included_page_name $form_name]
if {$form_objs eq ""} {error "Cannot lookup Form '$form_name'"}
-
+
set form_object_item_ids [list]
foreach form_obj $form_objs {lappend form_object_item_ids [$form_obj item_id]}
}
@@ -2570,7 +2619,7 @@
if {![my exists form]} {
return
}
-
+
array set wc {tcl true h "" vars "" sql ""}
if {[info exists where]} {
array set wc [::xowiki::FormPage filter_expression $where &&]
@@ -2705,9 +2754,9 @@
Class create HH24 -superclass select
HH24 instproc initialize {} {
my options {
- {00 0} {01 1} {02 2} {03 3} {04 4} {05 5} {06 6} {07 7} {08 8} {09 9}
- {10 10} {11 11} {12 12} {13 13} {14 14} {15 15} {16 16} {17 17} {18 18} {19 19}
- {20 20} {21 21} {22 22} {23 23}
+ {00 0} {01 1} {02 2} {03 3} {04 4} {05 5} {06 6} {07 7} {08 8} {09 9}
+ {10 10} {11 11} {12 12} {13 13} {14 14} {15 15} {16 16} {17 17} {18 18} {19 19}
+ {20 20} {21 21} {22 22} {23 23}
}
next
}
@@ -2730,7 +2779,7 @@
}
MI instproc initialize {} {
my options {
- {00 0} {05 5} {10 10} {15 15} {20 20} {25 25}
+ {00 0} {05 5} {10 10} {15 15} {20 20} {25 25}
{30 30} {35 35} {40 40} {45 45} {50 50} {55 55}
}
next
@@ -2746,7 +2795,7 @@
MM instproc initialize {} {
my options {
{01 1} {02 2} {03 3} {04 4} {05 5} {06 6} {07 7} {08 8} {09 9} {10 10}
- {11 11} {12 12}
+ {11 11} {12 12}
}
next
}
@@ -2812,7 +2861,7 @@
###########################################################
Class create youtube_url -superclass text
youtube_url set urlre {^http://www.youtube.com/watch[?]v=([^?]+)([?]?)}
-
+
youtube_url instproc initialize {} {
next
if {[my help_text] eq ""} {my help_text "#xowiki.formfield-youtube_url-help_text#"}
@@ -2841,7 +2890,7 @@
-extend_slot_default validator image_check \
-parameter {
href cssclass
- {float left} width height
+ {float left} width height
padding {padding-right 10px} padding-left padding-top padding-bottom
margin margin-left margin-right margin-top margin-bottom
border border-width position top botton left right
@@ -2874,7 +2923,7 @@
if {[regexp {^file://(.*)$} $value _ path]} {
set f [open $path r]
fconfigure $f translation binary
- set img [read $f]
+ set img [read $f]
close $f
} elseif {[catch {
set r [::xo::HttpRequest new -url $value -volatile]
@@ -2929,7 +2978,7 @@
return "Cannot resolve symbolic link '$v'"
}
set link_type [$object get_property_from_link_page link_type]
- $object lappend references [list $item_id $link_type]
+ $object references resolved [list $item_id $link_type]
#
# resetting esp. the item-id is dangerous. Therefore we reset it immediately after the rendering
@@ -3011,7 +3060,7 @@
foreach {n1 value1} $v1 {n2 value2} $v2 {
set f [my set component_index($n1)]
if {![$f same_value $value1 $value2]} { return 0 }
- }
+ }
return 1
}
@@ -3053,7 +3102,7 @@
}
}
}
-
+
CompoundField instproc get_compound_value {} {
# Set the internal representation based on the components values.
set value [list]
@@ -3166,18 +3215,37 @@
}
}
+ CompoundField instproc pretty_value {v} {
+ #
+ # Typically, subtypes of CompoundFields should define their own
+ # "pretty_value". This is a simple renderer that provides a
+ # default behavior.
+ #
+ set ff [dict create {*}$v]
+ set html "
\n"
+ foreach c [my components] {
+ set componentName [$c set name]
+ if {[dict exists $ff $componentName]} {
+ append html "
$componentName: " \
+ "[$c pretty_value [dict get $ff $componentName]]
\n"
+ }
+ }
+ append html "
\n"
+ return $html
+ }
+
CompoundField instproc has_instance_variable {var value} {
set r [next]
if {$r} {return 1}
- foreach c [my components] {
+ foreach c [my components] {
set r [$c has_instance_variable $var $value]
if {$r} {return 1}
}
return 0
}
CompoundField instproc convert_to_internal {} {
- foreach c [my components] {
+ foreach c [my components] {
$c convert_to_internal
}
# Finally, update the compound value entry with the compound
@@ -3294,7 +3362,7 @@
-name [my name].$name -id [my id].$name \
-locale [my locale] -object [my object] \
-value $element]
- $c set_disabled [my exists disabled]
+ $c set_disabled 1; # this is a dummy field, never query for its value
if {$c ni [my components]} {my lappend components $c}
continue
}
@@ -3322,7 +3390,7 @@
# instances of this class can be used as flyweight
# objects. Otherwise, we get side-effects when
# we render the input widget.
- foreach c [my components] {
+ foreach c [my components] {
$c value ""
}
return
@@ -3357,7 +3425,7 @@
$c value $value_part
}
}
-
+
date instproc get_compound_value {} {
# Set the internal representation of the date based on the components values.
# Internally, the ansi date format is used.
@@ -3383,12 +3451,12 @@
#my msg "$year-$month-$day ${hour}:${min}:${sec}"
if {[catch {set ticks [clock scan "$year-$month-$day ${hour}:${min}:${sec}"]}]} {
set ticks 0 ;# we assume that the validator flags these values
- }
+ }
# TODO: TZ???
#my msg "DATE [my name] get_compound_value returns [clock format $ticks -format {%Y-%m-%d %T}]"
return [clock format $ticks -format "%Y-%m-%d %T"]
}
-
+
date instproc same_value {v1 v2} {
if {$v1 eq $v2} {return 1}
return 0
@@ -3397,7 +3465,7 @@
date instproc pretty_value {v} {
my instvar display_format
#
- # Internally, we use the ansi date format. For displaying the date,
+ # Internally, we use the ansi date format. For displaying the date,
# use the specified display format and present the time localized.
#
# Drop of the value after the "." we assume to have a date in the local zone
@@ -3446,7 +3514,7 @@
###########################################################
Class create boolean_image -superclass FormField -parameter {
- {default t}
+ {default t}
{t_img_url /resources/xowiki/examples/check_richtig.png}
{f_img_url /resources/xowiki/examples/check_falsch.png}
{CSSclass img_boolean}
@@ -3468,7 +3536,7 @@
::xo::Page requireJS {
function toggle_img_boolean (element,t_img_url,f_img_url) {
var input = $(element).next();
- var state = input.val()== "t";
+ var state = input.val()== "t";
if (state) {
input.val('f');
$(element).attr('src',f_img_url);
@@ -3534,14 +3602,21 @@
#
# ::xowiki::formfield::event
#
+ # This formfield is rendered following the conventions of the
+ # h-event of microformats2.
+ #
+ # See: http://microformats.org/wiki/h-event
+ #
###########################################################
Class create event -superclass CompoundField -parameter {
{multiday false}
+ {calendar}
+ {time_label #xowiki.event-time#}
}
event instproc initialize {} {
- #my msg "event initialize [my exists __initialized], multi=[my multiday] state=[my set __state]"
+ #my log "event initialize [my exists __initialized], multi=[my multiday] state=[my set __state]"
if {[my set __state] ne "after_specs"} return
my set widget_type event
if {[my multiday]} {
@@ -3552,11 +3627,13 @@
set dtend_display_format %X
}
my create_components [subst {
- {summary {richtext,required,editor=wym,height=150px,label=#xowiki.event-title_of_event#}}
- {dtstart {date,required,format=DD_MONTH_YYYY_#xowiki.event-hour_prefix#_HH24_MI,
+ {title {text,label=#xowiki.event-title_of_event#}}
+ {summary {richtext,height=150px,label=#xowiki.event-summary_of_event#}}
+ {dtstart {date,required,format=DD_MONTH_YYYY_#xowiki.event-hourprefix#_HH24_MI,
default=now,label=#xowiki.event-start_of_event#,display_format=%Q_%X}}
{dtend date,format=$dtend_format,default=now,label=#xowiki.event-end_of_event#,display_format=$dtend_display_format}
{location text,label=#xowiki.event-location#}
+ {cal_item_id hidden}
}]
my set __initialized 1
}
@@ -3579,20 +3656,31 @@
}
event instproc pretty_value {v} {
- array set {} [my value]
+ #array set {} [my value]
set dtstart [my get_component dtstart]
set dtstart_val [$dtstart value]
set dtstart_iso [::xo::ical clock_to_iso [clock scan $dtstart_val]]
+ set dtstart_pretty [$dtstart pretty_value $dtstart_val]
set dtend [my get_component dtend]
set dtend_val [$dtend value]
set dtend_txt ""
if {$dtend_val ne ""} {
set dtend_iso [::xo::ical clock_to_iso [clock scan $dtend_val]]
- set dtend_txt " - [$dtend pretty_value $dtend_val]"
+ set dtend_txt " - "
}
- set summary_txt "[[my get_component summary] value]"
+ set time_label [my time_label]
+ if {[regexp {^#(.+)#$} $time_label _ msg_key]} {
+ set time_label [lang::message::lookup [my locale] $msg_key]
+ }
+
+ set title_val [[my get_component title] value]
+ if {$title_val eq ""} {
+ set title_val [[my object] property _title]
+ }
+ set summary_val [[my get_component summary] value]
+
set location [my get_component location]
set location_val [$location value]
set location_txt ""
@@ -3601,18 +3689,105 @@
if {[regexp {^#(.+)#$} $location_label _ msg_key]} {
set location_label [lang::message::lookup [my locale] $msg_key]
}
- set location_txt "$location_label: $location_val"
+ set location_txt "
"
}
if {$l eq ""} {return ""}
set html [$l render]
- $l destroy
+ if {[info commands $l] ne ""} {
+ $l destroy
+ } else {
+ ns_log notice "link object already destroyed. This might be due to a recurisive inclusion"
+ }
return $html
}
@@ -1766,9 +2145,8 @@
if {[info exists $__v]} continue
[my info class] instvar $__v
}
- set __ignorelist [list __v __vars __l __ignorelist __varlist \
- __last_includelet __unresolved_references \
- text item_id content lang_links]
+ set __ignorelist [list __v __vars __l __ignorelist __varlist __references \
+ __last_includelet text item_id content lang_links]
# set variables current_* to ease personalization
set current_user [::xo::cc set untrusted_user_id]
@@ -1835,7 +2213,6 @@
Page instproc render_content {} {
#my log "-- '[my set text]'"
- set html ""; set mime ""
lassign [my set text] html mime
if {[my render_adp]} {
set html [my adp_subst $html]
@@ -2001,31 +2378,30 @@
#
# prepare references management
#
- my set references [list]
+ my references clear
if {[my exists __extra_references]} {
#
# xowiki content-flow uses extra references, e.g. to forms.
# TODO: provide a better interface for providing these kind of
# non-link references.
#
- my set references [my set __extra_references]
+ foreach ref [my set __extra_references] {
+ my references resolved $ref
+ }
my unset __extra_references
}
- #my msg "[my name] setting unresolved_references 0"
- my set unresolved_references 0
- my set __unresolved_references [list]
#
# get page content and care about reference management
#
set content [my render_content]
#
# record references and clear it
#
- #my msg "we have the content, update=$update_references, unresolved=[my set unresolved_references]"
- if {$update_references || [my set unresolved_references] > 0} {
- my references_update [lsort -unique [my set references]]
+ #my msg "we have the content, update=$update_references, unresolved=[my references get unresolved]"
+ if {$update_references || [llength [my references get unresolved]] > 0} {
+ my references_update [lsort -unique [my references get resolved]]
}
- my unset -nocomplain references
+ #my unset -nocomplain __references
#
# handle footer
#
@@ -2142,7 +2518,7 @@
return $f
}
}
- if {$name ni {fontname fontsize formatblock}} {
+ if {$name ni {langmarks fontname fontsize formatblock}} {
set names [list]
foreach f $form_fields {lappend names [$f name]}
my msg "No form field with name '$name' found\
@@ -2206,8 +2582,7 @@
{-publish_status production}
{-source_item_id ""}
} {
- set ia [my default_instance_attributes]
- foreach {att value} $instance_attributes {lappend ia $att $value}
+ set ia [dict merge [my default_instance_attributes] $instance_attributes]
if {$nls_language eq ""} {
set nls_language [my query_parameter nls_language [my nls_language]]
@@ -2271,7 +2646,7 @@
{render_adp 0}
}
PlainPage array set RE {
- include {{{(.+?)}}([ \n\r])}
+ include {{{(.+?)}}([^\}]|$)}
anchor {\\\[\\\[([^\]]+?)\\\]\\\]}
div {>>([^<]*?)<<}
clean {[\\](\{\{|>>|\[\[)}
@@ -2484,12 +2859,13 @@
switch -glob $mime_type {
image/* {
- set l [Link new -volatile \
+ set l [Link new \
-page [self] -query $query \
-type image -name $name -lang "" \
-stripped_name $stripped_name -label $label \
-parent_id $parent_id -item_id $item_id -package_id $package_id]
set preview "
[$l render]
"
+ $l destroy
}
text/plain {
set text [::xowiki::read_file [my full_file_name]]
@@ -3024,21 +3400,14 @@
return 0
}
- FormPage proc h_double_quote {value} {
- if {[regexp {[ ,\"\\=>]} $value]} {
- set value \"[string map [list \" \\\\\" \\ \\\\ ' \\\\'] $value]\"
- }
- return $value
- }
-
FormPage proc filter_expression {
{-sql true}
input_expr
logical_op
} {
array set tcl_op {= eq < < > > >= >= <= <=}
array set sql_op {= = < < > > >= >= <= <=}
- array set op_map {contains,sql {$lhs_var like '%$rhs%'} contains,tcl {[lsearch $lhs_var {$rhs}] > -1}}
+ array set op_map {contains,sql {$lhs_var like '%$rhs%'} contains,tcl {{$rhs} in $lhs_var}}
#my msg unless=$unless
#example for unless: wf_current_state = closed|accepted || x = 1
set tcl_clause [list]
@@ -3070,7 +3439,7 @@
lappend tcl_clause "\[my property $lhs\] $tcl_op($op) {$rhs}"
}
} else {
- set hleft [my h_double_quote $lhs]
+ set hleft [::xowiki::hstore::double_quote $lhs]
lappend vars $lhs ""
if {$op eq "contains"} {
#make approximate query
@@ -3089,7 +3458,7 @@
# TODO: think about a solution for other operators with
# hstore maybe: extracting it by a query via hstore and
# compare in plain SQL
- lappend h_clause "$hleft=>[my h_double_quote $rhs]"
+ lappend h_clause "$hleft=>[::xowiki::hstore::double_quote $rhs]"
}
}
}
@@ -3138,33 +3507,35 @@
# "-always_queried_attributes *" means to obtain enough attributes
# to allow a save operatons etc. on the instances.
#
-
- set sql_atts [list ci.parent_id bt.revision_id bt.instance_attributes \
- bt.creation_date bt.creation_user bt.last_modified \
- "bt.object_package_id as package_id" bt.title \
- bt.page_template bt.state bt.assignee
- ]
+
+ set sql_atts {
+ item_id name publish_status object_type
+ parent_id revision_id instance_attributes
+ creation_date creation_user last_modified
+ package_id title page_template state assignee
+ }
+
if {$always_queried_attributes eq "*"} {
lappend sql_atts \
- bt.object_type bt.object_id \
- bt.description bt.publish_date bt.mime_type nls_language "bt.data as text" \
- bt.creator bt.page_order bt.page_id \
- bt.page_instance_id bt.xowiki_form_page_id
+ object_type object_id \
+ description publish_date mime_type nls_language text \
+ creator page_order page_id \
+ page_instance_id xowiki_form_page_id
} else {
foreach att $always_queried_attributes {
set name [string range $att 1 end]
- lappend sql_atts bt.$name
+ lappend sql_atts $name
}
- }
+ }
#
# Compute the list of field_names from the already covered sql
# attributes
#
set covered_attributes [list _name _publish_status _item_id _object_type]
foreach att $sql_atts {
- regexp {[.]([^ ]+)} $att _ name
- lappend covered_attributes _$name
+ #regexp {[.]([^ ]+)} $att _ name
+ lappend covered_attributes _$att
}
#
@@ -3179,16 +3550,16 @@
if {$field_name eq "_text"} {
lappend sql_atts "bt.data as text"
} else {
- lappend sql_atts bt.[$f set __base_field]
+ lappend sql_atts [$f set __base_field]
}
}
#my msg sql_atts=$sql_atts
#
# Build parts of WHERE clause
#
- set publish_status_clause [::xowiki::Includelet publish_status_clause -base_table ci $publish_status]
-
+ set publish_status_clause [::xowiki::Includelet publish_status_clause \
+ -base_table "" $publish_status]
#
# Build filter clause (uses hstore if configured)
#
@@ -3198,7 +3569,7 @@
[$package_id get_parameter use_hstore 0]
}]
if {$use_hstore && $wc(h) ne ""} {
- set filter_clause " and '$wc(h)' <@ bt.hkey"
+ set filter_clause " and '$wc(h)' <@ hkey"
}
#my msg "exists sql=[info exists wc(sql)]"
if {$wc(sql) ne "" && $wc(h) ne ""} {
@@ -3212,37 +3583,48 @@
# Build package clause
#
if {$from_package_ids eq ""} {
- set package_clause "and object_package_id = :package_id"
+ set package_clause "and package_id = :package_id"
} elseif {$from_package_ids eq "*"} {
set package_clause ""
} elseif {[llength $from_package_ids] == 1} {
- set package_clause "and object_package_id = :from_package_ids"
+ set package_clause "and package_id = :from_package_ids"
} else {
- set package_clause "and object_package_id in ([join $from_package_ids ,])"
+ set package_clause "and package_id in ([join $from_package_ids ,])"
}
if {$parent_id eq "*"} {
# instance_select_query expects "" for all parents, but for the semantics
# of this method, "*" looks more appropriate
set parent_id ""
}
+
+ set parent_clause ""
+ if {$parent_id ne ""} {
+ set parent_clause " and parent_id = :parent_id"
+ }
+
+ if {[llength $base_item_ids] == 0} {
+ error "base_item_ids must not be empty"
+ }
#
# transform all into an SQL query
#
- set sql [::xowiki::FormPage instance_select_query \
- -select_attributes $sql_atts \
- -from_clause "" \
- -where_clause " bt.page_template in ([join $base_item_ids ,]) \
- $publish_status_clause $filter_clause $package_clause \
+ if {$page_number ne ""} {
+ set limit $page_size
+ set offset [expr {$page_size*($page_number-1)}]
+ } else {
+ set limit ""
+ set offset ""
+ }
+ set sql [::xo::dc select \
+ -vars [join $sql_atts ", "] \
+ -from xowiki_form_instance_item_view \
+ -where " page_template in ([join $base_item_ids ,]) \
+ $publish_status_clause $filter_clause $package_clause $parent_clause \
$extra_where_clause" \
- -orderby $orderby \
- -with_subtypes false \
- -parent_id $parent_id \
- -page_size $page_size \
- -page_number $page_number \
- -base_table xowiki_form_pagei \
- ]
- #my ds $sql
+ -orderby $orderby \
+ -limit $limit -offset $offset]
+ #ns_log notice "NEW SQL:\n\n$sql\n"
#
# When we query all attributes, we return objects named after the
@@ -3822,6 +4204,22 @@
}
my map_categories $category_ids
+ #
+ # Handle now further database operations that should be saved in
+ # a transaction. Examples are calender-items defined in a
+ # FormPage, that should show up in the calender.
+ #
+ # Problably, categories should also be moved into the
+ # transaction queue.
+ #
+ set queue ::__xowiki__transaction_queue([my item_id])
+ if {[info exists $queue]} {
+ foreach cmd [set $queue] {
+ #ns_log notice ".... executing transaction command: $cmd"
+ {*}$cmd
+ }
+ }
+
my save -use_given_publish_date $use_given_publish_date
if {$old_name ne $name} {
$package_id flush_name_cache -name $old_name -parent_id [my parent_id]
Index: openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl,v
diff -u -N -r1.38 -r1.39
--- openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl 27 Oct 2014 16:42:05 -0000 1.38
+++ openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl 27 Apr 2015 15:28:23 -0000 1.39
@@ -71,7 +71,7 @@
#
$page instvar item_id
catch {
- db_dml delete_old_revisions {
+ ::xo::dc dml delete_old_revisions {
delete from txt where object_id in \
(select revision_id from cr_revisions
where item_id = :item_id and revision_id != :revision_id)
Index: openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl,v
diff -u -N -r1.32 -r1.33
--- openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 27 Oct 2014 16:42:06 -0000 1.32
+++ openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 27 Apr 2015 15:28:23 -0000 1.33
@@ -33,7 +33,6 @@
}
#
- #
# Helper for tidying up HTML
#
::xotcl::Object create tidy
@@ -59,11 +58,15 @@
#
# Helper for virus checks
#
+ # Install clamav daemon with
+ # FC21: yum install clamav-scanner
+ # Ununtu: apt-get install clamav-daemon
+ #
::xotcl::Object create virus
virus proc check {fn} {
if {[[::xo::cc package_id] get_parameter clamav 1]
&& [info commands ::util::which] ne ""} {
- set clamscanCmd [::util::which clamscan]
+ set clamscanCmd [::util::which clamdscan]
if {$clamscanCmd ne "" && [file readable $fn]} {
if {[catch {exec $clamscanCmd $fn 2>@1} result]} {
ns_log warning "[self] virus found:\n$result"
@@ -73,7 +76,110 @@
}
return 0
}
+}
+namespace eval ::xowiki::hstore {
+ #
+ # Helper functions for hstore
+ #
+ ad_proc double_quote {value} {
+ @return double_quoted value as appropriate for hstore
+ } {
+ if {[regexp {[ ,\"\\=>\n\']} $value]} {
+ set value \"[string map [list \" \\\" \\ \\\\ ' ''] $value]\"
+ }
+ return $value
+ }
+
+ ad_proc dict_as_hkey {dict} {
+ @return dict value in form of a hstore key.
+ } {
+ set keys {}
+ foreach {key value} $dict {
+ set v [double_quote $value]
+ if {$v eq ""} continue
+ lappend keys [double_quote $key]=>$v
+ }
+ return [join $keys ,]
+ }
+
+ ad_proc ::xowiki::hstore::update_form_instance_item_index {
+ {-package_id}
+ {-object_class ::xowiki::FormPage}
+ {-initialize false}
+ } {
+ update all instance attributes in hstore
+ } {
+ #
+ # This proc can be used from ds/shell as follows
+ #
+ # ::xowiki::hstore::update_form_instance_item_index -package_id $package_id
+ #
+ # Check the packages which do not have the hkey set:
+ #
+ # select hkey from xowiki_form_instance_item_index where hkey is null;
+ #
+ set t0 [clock clicks -milliseconds]
+ ns_log notice "start to work on -package_id $package_id"
+
+ ::xo::Package initialize -package_id $package_id -init_url false -user_id 0
+
+ set t1 [clock clicks -milliseconds]
+ ns_log notice "$package_id: ::xo::Package initialize took [expr {$t1-$t0}]ms"
+ set t0 $t1
+
+ if {![::xo::dc has_hstore] && [$package_id get_parameter use_hstore 0] } {return 0}
+
+ set sql {
+ select * from xowiki_form_instance_item_view
+ where package_id = :package_id
+ }
+ set items [::xowiki::FormPage instantiate_objects -sql $sql \
+ -object_class $object_class -initialize $initialize]
+
+ set t1 [clock clicks -milliseconds]
+ ns_log notice "$package_id: obtaining [llength [$items children]] items took [expr {$t1-$t0}]ms"
+ set t0 $t1
+
+ set count 0
+ foreach p [$items children] {
+
+ set hkey [::xowiki::hstore::dict_as_hkey [$p hstore_attributes]]
+ set item_id [$p item_id]
+
+ set t0 [clock clicks -milliseconds]
+
+ xo::dc dml update_hstore "update xowiki_form_instance_item_index \
+ set hkey = '$hkey' \
+ where item_id = :item_id"
+
+ set t1 [clock clicks -milliseconds]
+ ns_log notice "$package_id $count: update took [expr {$t1-$t0}]ms"
+ set t0 $t1
+
+ incr count
+ }
+
+ $items log "updated $count objects from package $package_id"
+ return $count
+ }
+
+ proc ::xowiki::hstore::update_update_all_form_instances {} {
+ #::xo::db::select_driver DB
+ foreach package_id [lsort [::xowiki::Package instances -closure true]] {
+ if {[catch {xowiki::hstore::update_form_instance_item_index -package_id $package_id} errorMsg]} {
+ ns_log Warning "initializing package $package_id lead to error: $errorMsg"
+ }
+ db_release_unused_handles
+ }
+ }
+}
+
+
+namespace eval ::xowiki {
+ #
+ # Functions used by upgrade procs.
+ #
proc copy_parameter {from to} {
set parameter_obj [::xo::parameter get_parameter_object \
-parameter_name $from -package_key xowiki]
@@ -104,11 +210,11 @@
set folder_id [::xo::dc list get_folder_id "select f.folder_id from cr_items c, cr_folders f \
where c.name = 'xowiki: :package_id' and c.item_id = f.folder_id"]
if {$folder_id ne ""} {
- db_dml update_package_id {update acs_objects set package_id = :package_id
+ ::xo::dc dml update_package_id {update acs_objects set package_id = :package_id
where object_id in
(select item_id as object_id from cr_items where parent_id = :folder_id)
and package_id is NULL}
- db_dml update_package_id {update acs_objects set package_id = :package_id
+ ::xo::dc dml update_package_id {update acs_objects set package_id = :package_id
where object_id in
(select r.revision_id as object_id from cr_revisions r, cr_items i where
i.item_id = r.item_id and i.parent_id = :folder_id)
@@ -124,7 +230,7 @@
::xo::db::sql::content_type refresh_view -content_type $object_type
}
- catch {db_dml drop_live_revision_view "drop view xowiki_page_live_revision"}
+ catch {::xo::dc dml drop_live_revision_view "drop view xowiki_page_live_revision"}
if {[db_driverkey ""] eq "postgresql"} {
set sortkeys ", ci.tree_sortkey, ci.max_child_sortkey "
} else {
@@ -265,7 +371,7 @@
}
proc form_upgrade {} {
- db_dml from_upgrade {
+ ::xo::dc dml from_upgrade {
update xowiki_form f set form = xowiki_formi.data from xowiki_formi
where f.xowiki_form_id = xowiki_formi.revision_id
}
@@ -312,20 +418,20 @@
set f [FormPage get_instance_from_db -item_id $item_id]
if {[$f page_template] != $form_id} {
ns_log notice "... must change form_id from [$f page_template] to $form_id"
- db_dml chg0 "update xowiki_page_instance set page_template = $form_id where page_instance_id = [$f revision_id]"
+ ::xo::dc dml chg0 "update xowiki_page_instance set page_template = $form_id where page_instance_id = [$f revision_id]"
}
return
}
set revision_id [::xo::db::sql::content_revision new \
-title [$package_id instance_name] -text "" \
-item_id $item_id -package_id $package_id]
- db_dml chg1 "insert into xowiki_page (page_id) values ($revision_id)"
- db_dml chg2 "insert into xowiki_page_instance (page_instance_id, page_template) values ($revision_id, $form_id)"
- db_dml chg3 "insert into xowiki_form_page (xowiki_form_page_id) values ($revision_id)"
+ ::xo::dc dml chg1 "insert into xowiki_page (page_id) values ($revision_id)"
+ ::xo::dc dml chg2 "insert into xowiki_page_instance (page_instance_id, page_template) values ($revision_id, $form_id)"
+ ::xo::dc dml chg3 "insert into xowiki_form_page (xowiki_form_page_id) values ($revision_id)"
- db_dml chg4 "update acs_objects set object_type = 'content_item' where object_id = :item_id"
- db_dml chg5 "update acs_objects set object_type = '::xowiki::FormPage' where object_id = :revision_id"
- db_dml chg6 "update cr_items set content_type = '::xowiki::FormPage', publish_status = 'ready', live_revision = :revision_id, latest_revision = :revision_id where item_id = :item_id"
+ ::xo::dc dml chg4 "update acs_objects set object_type = 'content_item' where object_id = :item_id"
+ ::xo::dc dml chg5 "update acs_objects set object_type = '::xowiki::FormPage' where object_id = :revision_id"
+ ::xo::dc dml chg6 "update cr_items set content_type = '::xowiki::FormPage', publish_status = 'ready', live_revision = :revision_id, latest_revision = :revision_id where item_id = :item_id"
}
ad_proc -public -callback subsite::url -impl apm_package {
Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v
diff -u -N -r1.321 -r1.322
--- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 27 Oct 2014 16:42:06 -0000 1.321
+++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 27 Apr 2015 15:28:23 -0000 1.322
@@ -654,7 +654,7 @@
}
FormPage instproc setCSSDefaults {} {
- my log setCSSDefaults
+ #my log setCSSDefaults
# check empty
if {[parameter::get_global_value -package_key xowiki -parameter PreferredCSSToolkit -default yui] eq "bootstrap"} {
::xowiki::formfield::FormField parameter {
@@ -797,12 +797,14 @@
} else {
if {$redirect_method ne "view"} {set qp "?m=$redirect_method"} {set qp ""}
set url [my pretty_link]$qp
- set return_url [$package_id get_parameter return_url $url]
- # We had query_parameter here. however, to be able to
- # process the output of ::xo::cc set_parameter ...., we
- # changed it to "parameter".
+ #
+ # The method query_parameter uses now "::xo::cc set_parameter ...."
+ # with highest precedence
+ #
+ set return_url [$package_id query_parameter return_url $url]
#my log "[my name]: url=$url, return_url=$return_url"
$package_id returnredirect $return_url
+
return
}
}
@@ -1078,8 +1080,7 @@
}
}
#my show_fields $form_fields
- foreach {validation_errors category_ids} \
- [my get_form_data -field_names $query_field_names $form_fields] break
+ lassign [my get_form_data -field_names $query_field_names $form_fields] validation_erors category_ids
if {$validation_errors == 0} {
#
@@ -1179,8 +1180,8 @@
break
}
}
- foreach {validation_errors category_ids} \
- [my get_form_data -field_names $query_field_names $form_fields] break
+ lassign [my get_form_data -field_names $query_field_names $form_fields] \
+ validation_errors category_ids
set error ""
if {$validation_errors == 0} {
set status_code 200
@@ -1535,6 +1536,7 @@
set short_spec [::xowiki::PageInstance get_short_spec_from_form_constraints \
-name $field_name \
-form_constraints $form_constraints]
+ #my log "short_spec of $field_name <$short_spec> field_spec <$field_spec> cr_field_spec <$cr_field_spec>"
switch -glob -- $field_name {
__* {error not_allowed}
@@ -1543,10 +1545,12 @@
if {![info exists __att($varname)]} {
error "unknown attribute $field_name"
}
+ #my log "create_raw_form_field of $field_name <$cr_field_spec,$short_spec>"
set f [$base_item create_raw_form_field \
-name $field_name \
-slot [$base_item find_slot $varname] \
-spec $cr_field_spec,$short_spec]
+ #my log "---> $f <[$f label]>"
$f set __base_field $varname
}
default {
@@ -1636,14 +1640,28 @@
{-spec ""}
{-configuration ""}
} {
- set short_spec [my get_short_spec $name]
- #my msg "create form-field '$name', short_spec = '$short_spec', slot=$slot"
+ # For workflows, we do not want to get the form constraints of the
+ # page itself (i.e. the property of the generic workflow form) but
+ # just the configured properties. Otherwise, we get for a
+ # wrong results for e.g. "{{form-usages -form de:Thread.wf ...}}"
+ # which picks up the label for the _title from the generic Workflow.
+ # So, when we have configured properties, we use it, use the
+ # primitive one just on despair. Not sure, what the best solution
+ # is,... maybe an additional flag.
+ if {[string trim $spec ,] eq ""} {
+ set short_spec [my get_short_spec $name]
+ #my log "[self] get_short_spec $name returns <$short_spec>"
+ } else {
+ set short_spec ""
+ }
+
+ #my log "create form-field '$name', short_spec '$short_spec' spec '$spec', slot=$slot"
set spec_list [list]
if {$spec ne ""} {lappend spec_list $spec}
if {$short_spec ne ""} {lappend spec_list $short_spec}
- #my msg "$name: short_spec '$short_spec', spec_list 1 = '[join $spec_list ,]'"
+ #my log "$name: short_spec '$short_spec', spec_list 1 = '[join $spec_list ,]'"
set f [next -name $name -slot $slot -spec [join $spec_list ,] -configuration $configuration]
- #my msg "created form-field '$name' $f [$f info class] validator=[$f validator]" ;#p=[$f info precedence]
+ #my log "created form-field '$name' $f [$f info class] validator=[$f validator] p=[$f info precedence]"
return $f
}
@@ -1838,10 +1856,9 @@
}
Page instproc mutual_overwrite_occurred {} {
- util_user_message -html \
- -message "User [::xo::get_user_name [my set modifying_user]] has modifyed this page \
- while you were editing it.\
- Open modified page in new window or press OK again to save this page."
+ util_user_message -html \
+ -message "[_ xowiki.User] [::xo::get_user_name [my set modifying_user]] [_ xowiki.has_modified_this_page]. \
+ [_ xowiki.Please_open] [_ xowiki.modified_page] [_ xowiki.new_window_or_OK]."
# return 1 to flag validation error, 0 to ignore this fact
return 1
}
@@ -2007,7 +2024,7 @@
#
set validation_error [$f validate [self]]
if {$validation_error ne ""} {
- #my msg "validation of $f [$f name] with value '[$f value]' returns '$validation_error'"
+ #my log "validation of $f [$f name] with value '[$f value]' returns '$validation_error'"
$f error_msg $validation_error
incr validation_errors
}
@@ -2047,6 +2064,7 @@
#my instance_attributes [array get __ia]
#my msg category_ids=$category_ids
+
return [list $validation_errors [lsort -unique $category_ids]]
}
Index: openacs-4/packages/xowiki/tcl/yui-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/yui-procs.tcl,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/xowiki/tcl/yui-procs.tcl 27 Oct 2014 16:42:06 -0000 1.2
+++ openacs-4/packages/xowiki/tcl/yui-procs.tcl 27 Apr 2015 15:28:23 -0000 1.3
@@ -11,7 +11,7 @@
namespace eval ::xowiki {
- ::xo::tdom::Class YUIMenuItemList \
+ ::xo::tdom::Class create YUIMenuItemList \
-superclass Menu \
-parameter {
header
@@ -204,7 +204,7 @@
# TODO: Support for Multiple Element IDs/Refs as Trigger
- ::xo::tdom::Class YUIContextMenu \
+ ::xo::tdom::Class create YUIContextMenu \
-superclass YUIMenu \
-parameter {
{trigger "document"}
@@ -231,7 +231,7 @@
#
# YUIContextMenuItem
#
- ::xo::tdom::Class YUIContextMenuItem \
+ ::xo::tdom::Class create YUIContextMenuItem \
-superclass YUIMenuItem
@@ -408,7 +408,7 @@
}
- Class AnchorField \
+ Class create AnchorField \
-superclass ::xo::Table::AnchorField \
-ad_doc "
In addition to the standard TableWidget's AnchorField, we also allow the attributes
@@ -434,7 +434,7 @@
namespace eval ::xo::Table {
- Class ::xowiki::YUIDataTable \
+ Class create ::xowiki::YUIDataTable \
-superclass ::xo::Table \
-parameter {
{skin "yui-skin-sam"}
Index: openacs-4/packages/xowiki/tcl/upgrade/upgrade.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/upgrade/upgrade.tcl,v
diff -u -N -r1.7 -r1.8
--- openacs-4/packages/xowiki/tcl/upgrade/upgrade.tcl 13 Sep 2012 16:05:29 -0000 1.7
+++ openacs-4/packages/xowiki/tcl/upgrade/upgrade.tcl 27 Apr 2015 15:28:23 -0000 1.8
@@ -1,9 +1,9 @@
::xo::library doc {
- XoWiki - upgrade script (no need to keep this always in memory)
+ XoWiki - upgrade script (no need to keep this always in memory)
- @creation-date 2010-06-26
- @author Gustaf Neumann
- @cvs-id $Id$
+ @creation-date 2010-06-26
+ @author Gustaf Neumann
+ @cvs-id $Id$
}
namespace eval ::xowiki {
@@ -23,9 +23,9 @@
ns_log notice "-- upgrading to 0.13"
set package_id [::xo::package_id_from_package_key xowiki]
set folder_id [::xowiki::Page require_folder \
- -package_id $package_id \
- -content_types ::xowki::Page* \
- -name xowiki]
+ -package_id $package_id \
+ -content_types ::xowki::Page* \
+ -name xowiki]
set r [::CrWikiPage get_instances_from_db -folder_id $folder_id]
db_transaction {
array set map {
@@ -127,7 +127,7 @@
where page_title != '' and revision_id = p.page_id"
db_list delete_deprecated_types_from_ancient_versions \
- "select [::xo::db::sql map_function_name content_item__delete(i.item_id)] from cr_items i \
+ "select [::xo::db::sql map_function_name content_item__delete(i.item_id)] from cr_items i \
where content_type in ('CrWikiPage', 'CrWikiPlainPage', \
'PageInstance', 'PageTemplate','CrNote', 'CrSubNote')"
}
@@ -183,7 +183,7 @@
[apm_version_names_compare $to_version_name "0.39"] > -1} {
ns_log notice "-- upgrading to 0.39"
catch {db_dml create-xowiki-last-visited-time-idx \
- "create index xowiki_last_visited_time_idx on xowiki_last_visited(time)"
+ "create index xowiki_last_visited_time_idx on xowiki_last_visited(time)"
}
}
@@ -193,10 +193,10 @@
::xowiki::add_ltree_order_column
# get rid of obsolete column
catch {
- ::xo::db::sql::content_type delete_attribute \
- -content_type ::xowiki::Page \
- -attribute_name page_title \
- -drop_column t
+ ::xo::db::sql::content_type delete_attribute \
+ -content_type ::xowiki::Page \
+ -attribute_name page_title \
+ -drop_column t
}
# drop old non-conformant indices
foreach index { xowiki_ref_index
@@ -212,26 +212,26 @@
[apm_version_names_compare $to_version_name "0.56"] > -1} {
ns_log notice "-- upgrading to 0.56"
db_dml add_integer_column \
- "alter table xowiki_page_instance add npage_template \
- integer references cr_items(item_id)"
+ "alter table xowiki_page_instance add npage_template \
+ integer references cr_items(item_id)"
db_dml copy_old_values \
- "update xowiki_page_instance set npage_template = cast(page_template as integer)"
+ "update xowiki_page_instance set npage_template = cast(page_template as integer)"
db_dml rename_old_column \
- "alter table xowiki_page_instance rename column page_template to old_page_template"
+ "alter table xowiki_page_instance rename column page_template to old_page_template"
db_dml rename_new_column \
- "alter table xowiki_page_instance rename column npage_template to page_template"
+ "alter table xowiki_page_instance rename column npage_template to page_template"
# a few releases later, drop old column
if {[db_0or1row in_between_version \
- "select 1 from acs_object_types where \
- object_type = '::xowiki::Form' and supertype = '::xowiki::Page'"]} {
- # we have a version with a type hierarchy not compatible with the new one.
- # this comes by updating often from head.
- # The likelyhood to have such as version is rather low.
- ns_log notice "Deleting incompatible version of ::xowiki::Form"
- ::xo::db::sql::content_type drop_type -content_type ::xowiki::FormInstance \
- -drop_children_p t -drop_table_p t -drop_objects_p t
- ::xo::db::sql::content_type drop_type -content_type ::xowiki::Form \
- -drop_children_p t -drop_table_p t -drop_objects_p t
+ "select 1 from acs_object_types where \
+ object_type = '::xowiki::Form' and supertype = '::xowiki::Page'"]} {
+ # we have a version with a type hierarchy not compatible with the new one.
+ # this comes by updating often from head.
+ # The likelyhood to have such as version is rather low.
+ ns_log notice "Deleting incompatible version of ::xowiki::Form"
+ ::xo::db::sql::content_type drop_type -content_type ::xowiki::FormInstance \
+ -drop_children_p t -drop_table_p t -drop_objects_p t
+ ::xo::db::sql::content_type drop_type -content_type ::xowiki::Form \
+ -drop_children_p t -drop_table_p t -drop_objects_p t
}
::xowiki::update_views
}
@@ -271,8 +271,8 @@
ns_log notice "-- upgrading to 0.60"
# load for all xowiki package instances the weblog-portlet prototype page
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page weblog-portlet
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page weblog-portlet
}
}
@@ -286,18 +286,18 @@
# for all xowiki package instances
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- # rename swf:name and image:name to file:name
- db_dml change_swf \
- "update cr_items set name = 'file' || substr(name,4) \
- where name like 'swf:%' and parent_id = [$package_id folder_id]"
- db_dml change_image \
- "update cr_items set name = 'file' || substr(name,6) \
- where name like 'image:%' and parent_id = [$package_id folder_id]"
- # reload updated prototype pages
- $package_id import-prototype-page book
- $package_id import-prototype-page weblog
- # TODO check: jon.griffin
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ # rename swf:name and image:name to file:name
+ db_dml change_swf \
+ "update cr_items set name = 'file' || substr(name,4) \
+ where name like 'swf:%' and parent_id = [$package_id folder_id]"
+ db_dml change_image \
+ "update cr_items set name = 'file' || substr(name,6) \
+ where name like 'image:%' and parent_id = [$package_id folder_id]"
+ # reload updated prototype pages
+ $package_id import-prototype-page book
+ $package_id import-prototype-page weblog
+ # TODO check: jon.griffin
}
}
@@ -307,26 +307,26 @@
ns_log notice "-- upgrading to $v"
# for all xowiki package instances
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page categories-portlet
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page categories-portlet
}
# perform the upgrate of 0.62 for the s5 package as well
if {[info command ::s5::Package] ne ""} {
- foreach package_id [::s5::Package instances] {
- ::s5::Package initialize -package_id $package_id -init_url false
- # rename swf:name and image:name to file:name
- db_dml change_swf \
- "update cr_items set name = 'file' || substr(name,4) \
- where name like 'swf:%' and parent_id = [$package_id folder_id]"
- db_dml change_image \
- "update cr_items set name = 'file' || substr(name,6) \
- where name like 'image:%' and parent_id = [$package_id folder_id]"
- }
+ foreach package_id [::s5::Package instances] {
+ ::s5::Package initialize -package_id $package_id -init_url false
+ # rename swf:name and image:name to file:name
+ db_dml change_swf \
+ "update cr_items set name = 'file' || substr(name,4) \
+ where name like 'swf:%' and parent_id = [$package_id folder_id]"
+ db_dml change_image \
+ "update cr_items set name = 'file' || substr(name,6) \
+ where name like 'image:%' and parent_id = [$package_id folder_id]"
+ }
}
catch {
- # for new installs, the old column might not exist, therefor the catch
- db_dml drop_old_column \
- "alter table xowiki_page_instance drop column old_page_template cascade"
+ # for new installs, the old column might not exist, therefor the catch
+ db_dml drop_old_column \
+ "alter table xowiki_page_instance drop column old_page_template cascade"
}
::xowiki::update_views
}
@@ -337,10 +337,10 @@
ns_log notice "-- upgrading to $v"
# load for all xowiki package instances the weblog-portlet prototype page
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page announcements
- $package_id import-prototype-page news
- $package_id import-prototype-page weblog-portlet
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page announcements
+ $package_id import-prototype-page news
+ $package_id import-prototype-page weblog-portlet
}
}
@@ -350,9 +350,9 @@
ns_log notice "-- upgrading to $v"
# load for all xowiki package instances the weblog-portlet prototype page
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page news
- $package_id import-prototype-page weblog-portlet
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page news
+ $package_id import-prototype-page weblog-portlet
}
# To iterate over all kind of xowiki packages, we could do
# foreach package [concat ::xowiki::Package [::xowiki::Package info subclass]] {
@@ -367,8 +367,8 @@
ns_log notice "-- upgrading to $v"
# load for all xowiki package instances the weblog-portlet prototype page
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page news-item
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page news-item
}
copy_parameter top_portlet top_includelet
}
@@ -385,9 +385,9 @@
[apm_version_names_compare $to_version_name $v] > -1} {
ns_log notice "-- upgrading to $v"
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page weblog
- $package_id import-prototype-page weblog-portlet
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page weblog
+ $package_id import-prototype-page weblog-portlet
}
}
@@ -434,8 +434,8 @@
[apm_version_names_compare $to_version_name $v] > -1} {
ns_log notice "-- upgrading to $v"
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page ical
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page ical
}
}
@@ -444,11 +444,11 @@
[apm_version_names_compare $to_version_name $v] > -1} {
ns_log notice "-- upgrading to $v"
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page weblog
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page weblog
}
db_dml strip_colons_from_tags \
- "update xowiki_tags set tag = trim(both ',' from tag) where tag like '%,%'"
+ "update xowiki_tags set tag = trim(both ',' from tag) where tag like '%,%'"
}
set v 0.120
@@ -466,22 +466,22 @@
::xowiki::Package initialize -package_id [::xowiki::Package first_instance]
::xowiki::Package require_site_wide_pages
foreach p [::xowiki::Package instances -closure true] {
- ::xowiki::transform_root_folder $p
+ ::xowiki::transform_root_folder $p
}
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id
- set item_id [$package_id lookup -name ::[$package_id folder_id]]
- if {$item_id ne 0} {
- ::xowiki::Object get_instance_from_db -item_id $item_id
- set p [$item_id get_payload widget_specs]
- if {$p ne ""} {
- ns_log notice "Transfering widget_specs to parameter WidgetSpecs for $package_id [$package_id package_url]"
- parameter::set_value -package_id $package_id -parameter WidgetSpecs -value $p
- }
- } else {
- ns_log notice "no folder object found for $package_id - [$package_id package_url]"
- }
+ ::xowiki::Package initialize -package_id $package_id
+ set item_id [$package_id lookup -name ::[$package_id folder_id]]
+ if {$item_id ne 0} {
+ ::xowiki::Object get_instance_from_db -item_id $item_id
+ set p [$item_id get_payload widget_specs]
+ if {$p ne ""} {
+ ns_log notice "Transfering widget_specs to parameter WidgetSpecs for $package_id [$package_id package_url]"
+ parameter::set_value -package_id $package_id -parameter WidgetSpecs -value $p
+ }
+ } else {
+ ns_log notice "no folder object found for $package_id - [$package_id package_url]"
+ }
}
}
@@ -492,9 +492,9 @@
# load for all xowiki package instances the weblog-portlet prototype page
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page weblog-portlet
- $package_id import-prototype-page news
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page weblog-portlet
+ $package_id import-prototype-page news
}
}
@@ -503,16 +503,16 @@
[apm_version_names_compare $to_version_name $v] > -1} {
ns_log notice "-- upgrading to $v"
foreach package_id [::xowiki::Package instances -closure true] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- # strip language prefix from folder pages
- set ff [::xowiki::Weblog instantiate_forms -forms en:folder.form -package_id $package_id]
- set e [::xowiki::FormPage get_form_entries -form_fields "" \
- -base_item_ids $ff -package_id $package_id \
- -always_queried_attributes *]
- foreach fp [$e children] {
- set n [$fp name]
- regexp {^..:(.+)$} $n . n
- $fp rename -old_name [$fp name] -new_name $n
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ # strip language prefix from folder pages
+ set ff [::xowiki::Weblog instantiate_forms -forms en:folder.form -package_id $package_id]
+ set e [::xowiki::FormPage get_form_entries -form_fields "" \
+ -base_item_ids $ff -package_id $package_id \
+ -always_queried_attributes *]
+ foreach fp [$e children] {
+ set n [$fp name]
+ regexp {^..:(.+)$} $n . n
+ $fp rename -old_name [$fp name] -new_name $n
}
}
}
@@ -525,8 +525,8 @@
::xowiki::Package initialize -package_id [::xowiki::Package first_instance]
::xowiki::Package require_site_wide_pages -refetch true
foreach package_id [::xowiki::Package instances] {
- ::xowiki::Package initialize -package_id $package_id -init_url false
- $package_id import-prototype-page weblog
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import-prototype-page weblog
}
}
@@ -544,35 +544,94 @@
ns_log notice "-- upgrading to $v"
db_dml fix_transformed_folders \
- "update acs_objects set object_type = '::xowiki::FormPage' where object_id in (select object_id from acs_objects,cr_revisions cr,cr_items ci where ci.item_id = cr.item_id and revision_id = object_id and object_type = 'content_folder' and content_type = '::xowiki::FormPage')"
+ "update acs_objects set object_type = '::xowiki::FormPage' where object_id in (select object_id from acs_objects,cr_revisions cr,cr_items ci where ci.item_id = cr.item_id and revision_id = object_id and object_type = 'content_folder' and content_type = '::xowiki::FormPage')"
# Reset potentially wrong context-ids
# (the context id of the root folder should be the package id)
foreach p [::xowiki::Package instances -closure true] {
- ::xowiki::Package initialize -package_id $p
- set folder_id [$p folder_id]
- set c [db_string get_ctx "select context_id from acs_objects where object_id = $folder_id" ]
- if {$c == -100} {
- ::xo::db::sql::acs_object set_attribute -object_id_in $folder_id \
- -attribute_name_in context_id -value_in $p
- }
+ ::xowiki::Package initialize -package_id $p
+ set folder_id [$p folder_id]
+ set c [db_string get_ctx "select context_id from acs_objects where object_id = $folder_id" ]
+ if {$c == -100} {
+ ::xo::db::sql::acs_object set_attribute -object_id_in $folder_id \
+ -attribute_name_in context_id -value_in $p
+ }
}
}
set v 0.138
if {[apm_version_names_compare $from_version_name $v] == -1 &&
[apm_version_names_compare $to_version_name $v] > -1} {
- ns_log notice "-- upgrading to $v"
-
- foreach object_type {PlainPage Page File PodcastItem PageTemplate PageInstance Object Form FormPage} {
- set pretty_name_key "#xowiki.${object_type}_pretty_name#"
- set pretty_plural_key "#xowiki.${object_type}_pretty_plural#"
- set xowiki_object_type "::xowiki::${object_type}"
- db_dml i18_name "
+ ns_log notice "-- upgrading to $v"
+
+ foreach object_type {PlainPage Page File PodcastItem PageTemplate PageInstance Object Form FormPage} {
+ set pretty_name_key "#xowiki.${object_type}_pretty_name#"
+ set pretty_plural_key "#xowiki.${object_type}_pretty_plural#"
+ set xowiki_object_type "::xowiki::${object_type}"
+ db_dml i18_name "
update acs_object_types set pretty_name = :pretty_name_key, pretty_plural = :pretty_plural_key
where object_type = :xowiki_object_type
"
- }
+ }
}
+
+ set v 0.162
+ if {[apm_version_names_compare $from_version_name $v] == -1 &&
+ [apm_version_names_compare $to_version_name $v] > -1} {
+ ns_log notice "-- upgrading to $v"
+
+ foreach package_id [::xowiki::Package instances -closure true] {
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ # reload updated prototype pages
+ $package_id import-prototype-page categories-portlet
+ }
+ }
+
+ set v 0.163
+ if {[apm_version_names_compare $from_version_name $v] == -1 &&
+ [apm_version_names_compare $to_version_name $v] > -1} {
+ ns_log notice "-- upgrading to $v"
+
+ if {[::xo::dc has_hstore]} {
+ set hkey_in_view "xi.hkey,"
+ } else {
+ set hkey_in_view ""
+ }
+
+ ::xo::dc dml drop-view "drop view xowiki_form_instance_item_view"
+
+ ::xo::db::require view xowiki_form_instance_item_view [subst {
+ SELECT
+ xi.package_id, xi.parent_id, xi.name,
+ $hkey_in_view xi.publish_status, xi.assignee, xi.state, xi.page_template, xi.item_id,
+ o.object_id, o.object_type, o.title AS object_title, o.context_id,
+ o.security_inherit_p, o.creation_user, o.creation_date, o.creation_ip,
+ o.last_modified, o.modifying_user, o.modifying_ip, o.tree_sortkey, o.max_child_sortkey,
+ cr.revision_id, cr.title, content_revision__get_content(cr.revision_id) AS text,
+ cr.description, cr.publish_date, cr.mime_type, cr.nls_language,
+ xowiki_form_page.xowiki_form_page_id,
+ xowiki_page_instance.page_instance_id,
+ xowiki_page_instance.instance_attributes,
+ xowiki_page.page_id,
+ xowiki_page.page_order,
+ xowiki_page.creator
+ FROM
+ xowiki_form_instance_item_index xi
+ left join cr_items ci on (ci.item_id = xi.item_id)
+ left join cr_revisions cr on (cr.revision_id = ci.live_revision)
+ left join acs_objects o on (o.object_id = ci.live_revision)
+ left join xowiki_page on (o.object_id = xowiki_page.page_id)
+ left join xowiki_page_instance on (o.object_id = xowiki_page_instance.page_instance_id)
+ left join xowiki_form_page on (o.object_id = xowiki_form_page.xowiki_form_page_id)
+ }]
+ }
}
+
}
+
+#
+# Local variables:
+# mode: tcl
+# tcl-indent-level: 2
+# indent-tabs-mode: nil
+# End:
Index: openacs-4/packages/xowiki/www/oacs-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/oacs-view.adp,v
diff -u -N -r1.69 -r1.70
--- openacs-4/packages/xowiki/www/oacs-view.adp 27 Oct 2014 16:42:06 -0000 1.69
+++ openacs-4/packages/xowiki/www/oacs-view.adp 27 Apr 2015 15:28:23 -0000 1.70
@@ -1,4 +1,4 @@
-
+
@title;noquote@@context;noquote@
Index: openacs-4/packages/xowiki/www/oacs-view2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/oacs-view2.adp,v
diff -u -N -r1.48 -r1.49
--- openacs-4/packages/xowiki/www/oacs-view2.adp 27 Oct 2014 16:42:06 -0000 1.48
+++ openacs-4/packages/xowiki/www/oacs-view2.adp 27 Apr 2015 15:28:23 -0000 1.49
@@ -1,4 +1,4 @@
-
+
@title;noquote@@context;noquote@
Index: openacs-4/packages/xowiki/www/oacs-view3.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/oacs-view3.adp,v
diff -u -N -r1.43 -r1.44
--- openacs-4/packages/xowiki/www/oacs-view3.adp 27 Oct 2014 16:42:06 -0000 1.43
+++ openacs-4/packages/xowiki/www/oacs-view3.adp 27 Apr 2015 15:28:23 -0000 1.44
@@ -1,4 +1,4 @@
-
+
@title;noquote@@context;noquote@
Index: openacs-4/packages/xowiki/www/view-book-no-ajax.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/view-book-no-ajax.adp,v
diff -u -N -r1.26 -r1.27
--- openacs-4/packages/xowiki/www/view-book-no-ajax.adp 27 Oct 2014 16:42:06 -0000 1.26
+++ openacs-4/packages/xowiki/www/view-book-no-ajax.adp 27 Apr 2015 15:28:23 -0000 1.27
@@ -1,4 +1,4 @@
-
+
@title;noquote@@context;noquote@
Index: openacs-4/packages/xowiki/www/view-book.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/view-book.adp,v
diff -u -N -r1.37 -r1.38
--- openacs-4/packages/xowiki/www/view-book.adp 27 Oct 2014 16:42:06 -0000 1.37
+++ openacs-4/packages/xowiki/www/view-book.adp 27 Apr 2015 15:28:23 -0000 1.38
@@ -1,4 +1,4 @@
-
+
@title;noquote@@context;noquote@
Index: openacs-4/packages/xowiki/www/view-default.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/view-default.adp,v
diff -u -N -r1.66 -r1.67
--- openacs-4/packages/xowiki/www/view-default.adp 27 Oct 2014 16:42:06 -0000 1.66
+++ openacs-4/packages/xowiki/www/view-default.adp 27 Apr 2015 15:28:23 -0000 1.67
@@ -1,4 +1,4 @@
-
+
@title;noquote@@context;noquote@
Index: openacs-4/packages/xowiki/www/view-links.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/view-links.adp,v
diff -u -N -r1.56 -r1.57
--- openacs-4/packages/xowiki/www/view-links.adp 27 Oct 2014 16:42:06 -0000 1.56
+++ openacs-4/packages/xowiki/www/view-links.adp 27 Apr 2015 15:28:23 -0000 1.57
@@ -1,4 +1,4 @@
-
+