++
++ @content_alert_message;noquote@
++
+
+ @user_messages.message;noquote@
+
+diff -crBN theme-zen-54/lib/lrn-master.tcl theme-zen/lib/lrn-master.tcl
+*** theme-zen-54/lib/lrn-master.tcl 2009-01-23 15:56:22.000000000 -0600
+--- theme-zen/lib/lrn-master.tcl 2009-01-23 16:13:47.000000000 -0600
+***************
+*** 277,279 ****
+--- 277,284 ----
+ template::head::add_css -href "/resources/dotlrn/dotlrn-toolbar.css"
+ template::add_header -src "/packages/dotlrn/lib/toolbar"
+ }
++
++ ## Learn Content: set an alert message after an activity has been created
++ set content_alert_message [ad_get_cookie content_alert_message ""]
++ ad_set_cookie content_alert_message ""
++ ###
Index: openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/insert-glossary-entry.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/insert-glossary-entry.js,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/insert-glossary-entry.js 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,237 @@
+// Insert Glossary Content Plugin for xinha
+// Developed in the Learn@WU Project of the
+// Vienna University of Economics and Business Administration
+// www.wu-wien.ac.at
+//
+// Authors: G�nter Ernst guenter.ernst@wu-wien.ac.at
+// Modified by: Alvaro Rodríguez, alvaro@viaro.net
+//
+// Distributed under the same terms as HTMLArea itself.
+// This notice MUST stay intact for use (see license.txt).
+//
+
+InsertGlossaryEntry._pluginInfo = {
+ name : "InsertGlossaryEntry",
+ version : "0.1",
+ developer : "Alvaro Rodriguez",
+ developer_url : "http://www.viaro.net",
+ sponsor : "Viaro Networks",
+ sponsor_url : "http://www.viaro.net",
+ license : "htmlArea"
+};
+
+function InsertGlossaryEntry(editor) {
+ var args = arguments;
+ this.editor = editor;
+ var ArgsString = args[1].toString();
+ var additionalArgs = ArgsString.split(",");
+ InsertGlossaryEntry.script_dir = this.editor.script_dir;
+ InsertGlossaryEntry.package_id = this.editor.config.package_id;
+
+ if (typeof InsertGlossaryEntry.script_dir == "undefined") {
+ // InsertGlossaryEntry.script_dir = ".";
+ InsertGlossaryEntry.script_dir = "/learning-content";
+ }
+
+ var cfg = editor.config;
+ var tt = InsertGlossaryEntry.I18N;
+ var bl = InsertGlossaryEntry.btnList;
+ var self = this;
+
+ // register the toolbar buttons provided by this plugin
+ for (var i = 0; i < bl.length; ++i) {
+ var btn = bl[i];
+ var id = "LW-" + btn[0];
+
+ cfg.registerButton(id, HTMLArea._lc(btn[1], "InsertGlossaryEntry"), editor.imgURL(btn[0] + ".gif", "InsertGlossaryEntry"), false,
+ function(editor, id) {
+ // dispatch button press event
+ self.buttonPress(editor, id);
+ });
+
+ switch (id) {
+ case "LW-insert-glossary-entry":
+ cfg.addToolbarElement(id, "insertglossaryentry", +1);
+ break;
+ }
+ }
+
+ cfg.hideSomeButtons(" insertimage ");
+ cfg.pageStyle = "@import url(" + _editor_url +
+ "plugins/InsertGlossaryEntry/insert-glossary-entry.css) screen; "
+};
+
+InsertGlossaryEntry.btnList = [
+ ["insert-glossary-entry", "Insert Glossary Entry"]
+ ];
+
+InsertGlossaryEntry.prototype.buttonPress = function(editor, id) {
+ InsertGlossaryEntry.editor = editor;
+ switch (id) {
+ case "LW-insert-glossary-entry":
+ this.insertEntry();
+ break;
+ }
+};
+
+// Called when the user clicks on "InsertLink" button. If the link is already
+// there, it will just modify it's properties.
+InsertGlossaryEntry.prototype.insertEntry = function(link) {
+ var editor = InsertGlossaryEntry.editor;
+ var outparam = null;
+
+// Try to get the parent node of the selection
+ if (typeof link == "undefined") {
+ link = editor.getParentElement();
+ if (link) {
+ while (link && !/^a$/i.test(link.tagName))
+ link = link.parentNode;
+ }
+ }
+ if (!link) {
+// If there is no link
+ var sel = editor._getSelection();
+ var range = editor._createRange(sel);
+ var compare = 0;
+ if (HTMLArea.is_ie) {
+ if(sel.type == "Control")
+ {
+ compare = range.length;
+ }
+ else
+ {
+ compare = range.compareEndPoints("StartToEnd", range);
+ }
+ } else {
+ compare = range.compareBoundaryPoints(range.START_TO_END, range);
+ }
+ if (compare == 0) {
+ alert(HTMLArea._lc("You need to select some text before creating a link"));
+ return;
+ }
+
+ var input_text = editor.getSelectedHTML();
+ input_text = input_text.replace(' ','');
+// If there's a link tag in the selection throws an error
+ var link_exp = new RegExp('.*
.*|.*.*');
+ if (input_text.match(link_exp)){
+ alert(HTMLArea._lc("Your text should not have link tags\nTip: Select only text without links."));
+ return;
+ }
+// Replace all html tags of the selection
+ var link_exp = new RegExp('*([a-z]+)[^>]*>(.*)*\\1[^>]*>');
+ while (input_text.match(link_exp)){
+ input_text = input_text.replace(link_exp,'$2');
+ }
+// Replace all special chars '<','>'
+ var tag = new RegExp('.*<.*>.*');
+ if (input_text.match(tag)){
+ input_text = '';
+ }
+// Send the word to the glossary interface
+ outparam = {
+ f_word : input_text,
+ f_href : '',
+ f_def : '',
+ edit_mode : '0'
+ };
+ } else {
+// If there is already a link
+ var att = HTMLArea.is_ie ? "className" : "class";
+//Check if it's a glossary link, if not return an error
+ if (link.getAttribute(att) != 'glossary__content__'){
+ alert(HTMLArea._lc("You cannot add a link to another link"));
+ return;
+ } else {
+// Send the information to the glossary interface
+ var id = HTMLArea.is_ie ? editor.stripBaseURL(link.id) : link.getAttribute("id");
+ var re = new RegExp('__[0-9]+__');
+ var new_word = id.replace(re,'');
+ outparam = {
+ f_word : new_word,
+ f_href : HTMLArea.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"),
+ f_def : '',
+ edit_mode : '1'
+ };
+ }
+ }
+ var PopupUrl = InsertGlossaryEntry.script_dir + "/xinha/insert-glossary-entry";
+ PopupUrl = PopupUrl + "?package_id=" + InsertGlossaryEntry.package_id;
+
+ Dialog(PopupUrl, function(param) {
+ if (!param) { // user must have pressed Cancel
+ return false;
+ }
+// Create a random number, to append it with the id of the link in case the same word is used more than once in the same page
+ var pos = Math.floor(Math.random()*1000001);
+ var a = link;
+ if (!a) try {
+ new Ajax.Request(param.url,{method: 'get', onSuccess: function (r) {
+ editor._doc.execCommand("createlink", false, 'glossary-list#glossary_'+escape(encode(r.responseText)));
+ a = editor.getParentElement();
+ var sel = editor._getSelection();
+ var range = editor._createRange(sel);
+ if (!HTMLArea.is_ie) {
+ a = range.startContainer;
+ if (!/^a$/i.test(a.tagName)) {
+ a = a.nextSibling;
+ if (a == null)
+ a = range.startContainer.parentNode;
+ }
+ }
+ while (a && !/^a$/i.test(a.tagName))
+ a = a.parentNode;
+ editor.selectNodeContents(a);
+ a.className = 'glossary__content__';
+ a.id = r.responseText+'__'+pos+'__';
+ } });
+ } catch(e) {}
+ else {
+// If there was a link, check if the action is to take it off
+ if (param.unlink == 1) {
+ editor.selectNodeContents(a);
+ editor._doc.execCommand("unlink", false, null);
+ editor.updateToolbar();
+ return false;
+ } else {
+// Update the current glossary link
+ new Ajax.Request(param.url,{method: 'get', onSuccess: function (r) {
+ var href = 'glossary-list#glossary_'+escape(encode(r.responseText)); var id = r.responseText;
+ editor.selectNodeContents(a);
+ a.href = href;
+ a.id = r.responseText+'__'+pos+'__';
+ }});
+ }
+ }
+ if (!(a && /^a$/i.test(a.tagName)))
+ return false;
+ editor.selectNodeContents(a);
+ editor.updateToolbar();
+
+ }, outparam);
+};
+
+
+function encode(string) {
+ string = string.replace(/\r\n/g,"\n");
+ var utftext = "";
+
+ for (var n = 0; n < string.length; n++) {
+
+ var c = string.charCodeAt(n);
+
+ if (c < 128) {
+ utftext += String.fromCharCode(c);
+ }
+ else if((c > 127) && (c < 2048)) {
+ utftext += String.fromCharCode((c >> 6) | 192);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+ else {
+ utftext += String.fromCharCode((c >> 12) | 224);
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+ }
+ return utftext;
+}
Index: openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/img/insert-glossary-entry.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/img/insert-glossary-entry.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/img/insert-glossary-entry2.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/img/insert-glossary-entry2.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/de.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/de.js,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/de.js 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,4 @@
+// empty
+{
+};
+
Index: openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/en.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/en.js,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/en.js 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,2 @@
+// empty
+{};
Index: openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/fr.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/fr.js,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/fr.js 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,22 @@
+// I18N constants
+// LANG: "fr", ENCODING: UTF-8
+{
+ "Insert Image": "Insérer une image",
+ "Image Preview:": "Prévisualisation",
+ "Image URL:": "URL",
+ "Preview": "Prévisualisation",
+ "Alternate text:": "Texte alternatif",
+ "Layout": "Layout",
+ "Alignment:": "Alignement",
+ "Border thickness:": "Epaisseur bordure",
+ "Spacing": "Espacement",
+ "Horizontal:": "Horizontal",
+ "Vertical:": "Vertical",
+ "The file you are uploading doesn't have the correct extension.": "Le fichier que vous téléchargez ne possède pas la bonne extension.",
+ "The file you are uploading already exists.": "Le fichier que vous téléchargez existe déjà.",
+ "The file you are uploading is to big. The max Filesize is": "Le fichier que vous uploadez est trop gros. La taille maximum est",
+ "Images on the Server:": "Images sur le serveur",
+ "Please select a file to upload.": "Veuillez sélectionner un fichier a télécharger",
+ "Upload file": "Télécharger",
+ "Open file in new window": "Ouvrir le fichier dans une nouvelle fenêtre"
+};
\ No newline at end of file
Index: openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/no.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/no.js,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/lang/no.js 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,23 @@
+// LANG: "de", ENCODING: UTF-8 | ISO-8859-1
+// Sponsored by http://www.schaffrath-neuemedien.de
+// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com
+{
+ "Insert Image": "Sett inn bilde",
+ "Image Preview:": "Forhåndsvisning:",
+ "Image URL:": "Bildets URL:",
+ "Preview": "Forhåndsvisning",
+ "Alternate text:": "Alternativ tekst",
+ "Layout": "Oppsett",
+ "Alignment:": "Plassering",
+ "Border thickness:": "Rammetykkelse:",
+ "Spacing": "Luft rundt bildet",
+ "Horizontal:": "Horisontal:",
+ "Vertical:": "Vertikal:",
+ "The file you are uploading doesn't have the correct extension.": "Bildet du laster opp har et ugyldig format, opplastning avbrutt",
+ "The file you are uploading already exists.": "Bildet du prøver å laste opp eksisterer allerede på serveren",
+ "The file you are uploading is to big. The max Filesize is": "Bildet du laster opp er for stort, maks tillatt størrelse er",
+ "Images on the Server:": "Bilder på serveren:",
+ "Please select a file to upload.": "Velg bilde du skal laste opp",
+ "Upload file": "Last opp bilde",
+ "Open file in new window": "Åpne bilde i nytt vindu"
+};
\ No newline at end of file
Index: openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/popups/blank.html
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/popups/blank.html,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/learning-content-patch/InsertGlossaryEntry/popups/blank.html 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1 @@
\ No newline at end of file
Index: openacs-4/packages/learning-content/lib/view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/lib/view.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/lib/view.adp 5 Mar 2009 21:28:56 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+@html;noquote@
Index: openacs-4/packages/learning-content/lib/view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/lib/view.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/lib/view.tcl 5 Mar 2009 21:28:56 -0000 1.1
@@ -0,0 +1,22 @@
+set parameter [subst {
+ {-m view}
+ {-return_url "[ns_conn url]"}
+ {-template_file "view-links"}
+ {-folder_id 0}
+}]
+
+# TODO the following should be done more elegantly
+set actual_query [expr {[info exists template_file] ? "template_file=$template_file" : " "}]
+
+if {[info exists url]} {
+ # new style, the url is sufficient
+ ::xowiki::Package initialize -parameter $parameter -url $url -actual_query $actual_query
+} else {
+ # old style, use item_id
+ set page [::xowiki::Package instantiate_page_from_id \
+ -item_id $item_id -parameter $parameter]
+ ::xo::cc export_vars
+}
+
+set html [::$package_id invoke -method $m]
+
Index: openacs-4/packages/learning-content/sql/oracle/learning-content-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/sql/oracle/learning-content-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/sql/oracle/learning-content-create.sql 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,35 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+--
+-- Oracle port samir@symphinity.com 11 July 2002
+--
+
+-- table to differentiate between normal pages and activity pages inside content
+create table content_activities
+(
+ item_id number(38) constraint pk_content_activities primary key,
+ activity_id number(38)
+);
+-- table to track how many times a word of the glossary is being used in every content page
+create table content_glossary_term_count
+(
+ term varchar2(400) not null,
+ page varchar2(400) not null,
+ folder_id number(38) not null,
+ times_used number(38),
+ constraint pk_content_glossary_count primary key (term,page,folder_id)
+);
+
Index: openacs-4/packages/learning-content/sql/oracle/learning-content-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/sql/oracle/learning-content-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/sql/oracle/learning-content-drop.sql 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,22 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+--
+-- Oracle port samir@symphinity.com 11 July 2002
+--
+
+drop table content_activities;
+drop table content_glossary_term_count;
+
Index: openacs-4/packages/learning-content/sql/oracle/learning-content-tables-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/sql/oracle/learning-content-tables-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/sql/oracle/learning-content-tables-create.sql 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,35 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+--
+-- Oracle port samir@symphinity.com 11 July 2002
+--
+
+-- table to differentiate between normal pages and activity pages inside content
+create table content_activities
+(
+ item_id number(38) constraint pk_content_activities primary key,
+ activity_id number(38)
+);
+-- table to track how many times a word of the glossary is being used in every content page
+create table content_glossary_term_count
+(
+ term varchar2(400) not null,
+ page varchar2(400) not null,
+ folder_id number(38) not null,
+ times_used number(38),
+ constraint pk_content_glossary_count primary key (term,page,folder_id)
+);
+
Index: openacs-4/packages/learning-content/sql/oracle/learning-content-tables-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/sql/oracle/learning-content-tables-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/sql/oracle/learning-content-tables-drop.sql 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,22 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+--
+-- Oracle port samir@symphinity.com 11 July 2002
+--
+
+drop table content_activities;
+drop table content_glossary_term_count;
+
Index: openacs-4/packages/learning-content/sql/postgresql/learning-content-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/sql/postgresql/learning-content-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/sql/postgresql/learning-content-create.sql 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,35 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+--
+-- Oracle port samir@symphinity.com 11 July 2002
+--
+
+-- table to differentiate between normal pages and activity pages inside content
+create table content_activities
+(
+ item_id integer constraint pk_content_activities primary key,
+ activity_id integer
+);
+-- table to track how many times a word of the glossary is being used in every content page
+create table content_glossary_term_count
+(
+ term varchar(400) not null,
+ page varchar(400) not null,
+ folder_id integer not null,
+ times_used integer,
+ constraint pk_content_glossary_count primary key (term,page,folder_id)
+);
+
Index: openacs-4/packages/learning-content/sql/postgresql/learning-content-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/sql/postgresql/learning-content-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/sql/postgresql/learning-content-drop.sql 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,22 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+--
+-- Oracle port samir@symphinity.com 11 July 2002
+--
+
+drop table content_activities;
+drop table content_glossary_term_count;
+
Index: openacs-4/packages/learning-content/sql/postgresql/learning-content-tables-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/sql/postgresql/learning-content-tables-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/sql/postgresql/learning-content-tables-create.sql 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,35 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+--
+-- Oracle port samir@symphinity.com 11 July 2002
+--
+
+-- table to differentiate between normal pages and activity pages inside content
+create table content_activities
+(
+ item_id integer constraint pk_content_activities primary key,
+ activity_id integer
+);
+-- table to track how many times a word of the glossary is being used in every content page
+create table content_glossary_term_count
+(
+ term varchar(400) not null,
+ page varchar(400) not null,
+ folder_id integer not null,
+ times_used integer,
+ constraint pk_content_glossary_count primary key (term,page,folder_id)
+);
+
Index: openacs-4/packages/learning-content/sql/postgresql/learning-content-tables-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/sql/postgresql/learning-content-tables-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/sql/postgresql/learning-content-tables-drop.sql 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,21 @@
+--
+-- Copyright (C) 2001, 2002 MIT
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+--
+-- Oracle port samir@symphinity.com 11 July 2002
+--
+drop table content_activities;
+drop table content_glossary_term_count;
+
Index: openacs-4/packages/learning-content/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/apm-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/apm-callback-procs.tcl 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,68 @@
+ad_library {
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-09-10
+}
+
+::xo::db::require package xowiki
+
+namespace eval learning_content::apm {}
+
+ad_proc -public learning_content::apm::package_mount {
+ {-package_id:required}
+ {-node_id:required}
+} {
+ Check if packages needed are mounted, if not mount them!
+} {
+
+ set package_parent_id [site_node::get_parent_id -node_id $node_id]
+ set package_community_id [site_node::get_object_id \
+ -node_id $package_parent_id]
+ set community_id [dotlrn_community::get_community_id \
+ -package_id $package_community_id]
+ set community_url [dotlrn_community::get_community_url $community_id]
+ #check if assessment is mounted, if not mount it
+ if {$community_id > 0} {
+ set activity "assessment"
+ if {![site_node::exists_p -url "${community_url}${activity}" ]} {
+ dotlrn_community::add_applet_to_community \
+ $community_id dotlrn_assessment
+ }
+ #check if evaluation is mounted, if not mount it
+ set activity "evaluation"
+ if {![site_node::exists_p -url "${community_url}${activity}"]} {
+ dotlrn_community::add_applet_to_community \
+ $community_id dotlrn_evaluation
+ }
+ }
+
+ learning_content::category::map_new_tree -object_id $package_id \
+ -tree_name "\#learning-content.choose_location\#"
+
+ ::xowiki::Package initialize -package_id $package_id
+
+ set root_directory [get_server_root]
+ set prototypes_path "$root_directory/packages/learning-content/www/prototypes/"
+ foreach prototype_page [glob \
+ $prototypes_path/*.page] {
+ regexp {.*/(.*).page} $prototype_page match prototype_page_name
+
+ if {($prototype_page_name eq "glossary-list" \
+ || $prototype_page_name eq "header_page" \
+ || $prototype_page_name eq "editor")} {
+ if {$prototype_page_name eq "editor"} {
+ set folder_id [content::folder::get_folder_from_package \
+ -package_id $package_id]
+ set folder_object_id [content::item::get_id_by_name \
+ -name "::$folder_id"\
+ -parent_id $folder_id]
+ set p [::xowiki::Package instantiate_page_from_id -item_id $folder_object_id]
+ set editor_page [source "${prototypes_path}editor.page"]
+ $p set text [$editor_page set text]
+ $p save
+ }
+ } else {
+ $package_id import_prototype_page $prototype_page_name
+ }
+ }
+}
Index: openacs-4/packages/learning-content/tcl/learning-content-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/learning-content-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/learning-content-callback-procs.tcl 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,105 @@
+ad_library {
+
+ Callback Procedures offered by the Content package
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-10-01
+}
+
+ad_proc -callback learning_content::extend_form {
+ {-name:required}
+ {-page_instance_id:required}
+} {
+ Do the extend to the ad_form for each activity package
+ (currently: assessment, evaluation, forum)
+} -
+
+ad_proc -callback learning_content::insert_object {
+ {-name:required}
+ {-item_id:required}
+ {-activity_id:required}
+} {
+ Insert an activity from the create interface of the external activity
+} -
+
+
+ad_proc -public -callback search::url -impl category {} {
+
+ @author alvaro@viaro.net
+ @creation_date 2008-10-01
+
+ returns a url for a category of content to the search package
+
+} {
+ set category_id $object_id
+ set tree_id [category::get_tree $category_id]
+ set objects [db_list get_objects { *SQL* }]
+ foreach object_id $objects {
+ set object_type [acs_object_type $object_id]
+ if { [string equal $object_type "apm_package"] } {
+ set wiki_url [apm_package_url_from_id $object_id]
+ set wiki_folder_id \
+ [content::folder::get_folder_from_package_not_cached \
+ -package_id $object_id]
+ set name [learning_content::get_first_tree_item_from_category_id \
+ -category_id $category_id \
+ -folder_id $wiki_folder_id]
+ set nexturl "${wiki_url}${name}"
+ return $nexturl
+ }
+ }
+ return ""
+}
+
+ad_proc -public -callback dotlrn::blocks::edit_url -impl category {} {
+
+ @author alvaro@viaro.net
+ @creation_date 2008-10-01
+
+ returns a url for the edit action of a content category
+
+} {
+ set category_id $object_id
+ set tree_id [category::get_tree $category_id]
+ set objects [db_list get_objects { *SQL* }]
+ foreach object_id $objects {
+ set object_type [acs_object_type $object_id]
+ if { [string equal $object_type "apm_package"] } {
+ set package_url [apm_package_url_from_id $object_id]
+ return "${package_url}admin/category-view"
+ }
+ }
+ return ""
+}
+
+ad_proc -public -callback learning_content::extend_form -impl content {} {
+ Do the extend to the ad_form for each activity package
+ (currently: assessment, evaluation, forum)
+} {
+ if { [exists_and_not_null page_instance_id] && $page_instance_id != 0 } {
+ ad_form -extend -name $name \
+ -form {{page_instance_id:text(hidden) {value $page_instance_id}}}
+ }
+}
+
+ad_proc -public -callback learning_content::insert_object -impl content {} {
+ Insert an activity from the create interface of the external activity
+} {
+ if { [exists_and_not_null item_id] && $item_id != 0 } {
+ set insert_p [learning_content::activity_exists_p -item_id $item_id]
+ if { $insert_p } {
+ learning_content::activity_edit -item_id $item_id -activity_id $activity_id
+ } else {
+ learning_content::activity_new -item_id $item_id -activity_id $activity_id
+ }
+ set page [::xowiki::Package instantiate_page_from_id -item_id $item_id]
+ $page destroy_on_cleanup
+ $page set title $name
+ $page save
+
+ set content_url [apm_package_url_from_id [$page set package_id]]
+ append content_url [$page set name]
+ ad_set_cookie content_alert_message "[_ learning-content.content_new_object_alert_message]"
+ ns_cache flush xotcl_object_cache ::$item_id
+ }
+}
Index: openacs-4/packages/learning-content/tcl/learning-content-callback-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/learning-content-callback-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/learning-content-callback-procs.xql 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+
+
+ select object_id
+ from category_tree_map
+ where tree_id = :tree_id
+
+
+
+
+
+
+ select object_id
+ from category_tree_map
+ where tree_id = :tree_id
+
+
+
Index: openacs-4/packages/learning-content/tcl/learning-content-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/learning-content-procs-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/learning-content-procs-oracle.xql 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,60 @@
+
+
+ oracle8.1.6
+
+
+
+ select o.title as category_name
+ from categories c,
+ acs_objects o,
+ category_object_map m
+ where c.category_id = o.object_id
+ and m.category_id = c.category_id
+ and m.object_id = :item_id
+ and rownum <= 1
+
+
+
+
+
+ select name
+ from (
+ select ci.name
+ from category_object_map c,
+ cr_items ci,
+ xowiki_page p
+ where c.object_id = ci.item_id
+ and ci.parent_id = :folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and category_id = :category_id
+ and p.page_id = ci.live_revision
+ order by to_number(p.page_order)
+ ) where rownum <= 1
+
+
+
+
+
+ select case when count(*) = 0 then 0 else 1 end
+ from category_object_map
+ where category_id = :my_category_id
+
+
+
+
+
+ select p.page_order
+ from cr_items ci,
+ xowiki_page p
+ where ci.parent_id = :folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and p.page_id = ci.live_revision
+ and p.page_order is not null
+ order by to_number(p.page_order) desc
+
+
+
+
+
+
+
Index: openacs-4/packages/learning-content/tcl/learning-content-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/learning-content-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/learning-content-procs-postgresql.xql 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,61 @@
+
+
+
+
+ postgresql
+ 7.2
+
+
+
+
+ select o.title as category_name
+ from categories c,
+ acs_objects o,
+ category_object_map m
+ where c.category_id = o.object_id
+ and m.category_id = c.category_id
+ and m.object_id = :item_id
+ limit 1
+
+
+
+
+
+ select ci.name
+ from category_object_map c,
+ cr_items ci,
+ xowiki_page p
+ where c.object_id = ci.item_id
+ and ci.parent_id = :folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and category_id = :category_id
+ and p.page_id = ci.live_revision
+ order by p.page_order::integer
+ limit 1
+
+
+
+
+
+ select case when count(*) = 0 then 0 else 1 end
+ where exists (
+ select 1
+ from category_object_map
+ where category_id = :my_category_id)
+
+
+
+
+
+ select p.page_order
+ from cr_items ci,
+ xowiki_page p
+ where ci.parent_id = :folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and p.page_id = ci.live_revision
+ and p.page_order is not null
+ order by p.page_order::integer desc
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/tcl/learning-content-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/learning-content-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/learning-content-procs.tcl 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,987 @@
+ad_library {
+ Content package procs
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-09-04
+}
+
+namespace eval content {}
+namespace eval learning_content::category {}
+namespace eval learning_content::page {}
+
+ad_proc -public learning_content::create_page {
+ {-content ""}
+ {-page_title ""}
+} {
+ set package_id [ad_conn package_id]
+ ::xowiki::Package initialize -package_id $package_id
+ set folder_id [::xowiki::Page require_folder -name xowiki \
+ -package_id $package_id]
+ set page [::xowiki::PageInstance new ]
+ set page_index [db_string page_index {*SQL*} -default 0]
+ set page_name "en:page_[incr page_index]"
+ if {[db_string select_name {*SQL*} -default 0]} {
+ set page_name "en:page_[incr page_index]_[format "%0.0f" [expr [random] * 10]]_[format \
+ %0.0f [expr [random] * 10]]"
+ }
+ $page configure -name $page_name -parent_id $folder_id \
+ -package_id $package_id
+
+ set max_page_order [learning_content::get_next_page_order]
+
+ db_0or1row select_instance [::xowiki::PageTemplate instance_select_query \
+ -folder_id $folder_id \
+ -select_attributes {name} \
+ -where_clause "name = 'en:content_template'"]
+
+ set template_id $item_id
+ $page set page_template $template_id
+ $page set page_order $max_page_order
+ $page set nls_language "en_US"
+ $page set instance_attributes [list "contenido" $content]
+ if {![empty_string_p $page_title]} {
+ $page set title $page_title
+ }
+ $page destroy_on_cleanup
+ $page initialize_loaded_object
+ set page_id [$page save_new]
+ return [list $page_id $page_name]
+}
+
+ad_proc -public learning_content::update_page {
+ {-content ""}
+ {-page_title ""}
+ {-page_item_id 0}
+} {
+ set package_id [ad_conn package_id]
+ ::xowiki::Package initialize -package_id $package_id
+ if { $page_item_id != 0 } {
+ set page [::xowiki::Package instantiate_page_from_id -item_id $page_item_id]
+ set page_name [$page set name]
+ $page destroy_on_cleanup
+
+ if { ![empty_string_p $content] } {
+ $page set instance_attributes [list "contenido" $content]
+ }
+ if { ![empty_string_p $page_title]} {
+ $page set title $page_title
+ }
+ set page_id [$page save]
+ set result [list $page_id $page_name]
+ } else {
+ set result [list]
+ }
+ return $result
+}
+
+ad_proc -public learning_content::get_item_category_name {
+ {-item_id:required}
+} {
+ set category_name [db_string get_cat_name {} -default "NOT_FOUND"]
+ return $category_name
+}
+
+ad_proc -public learning_content::insert_item_into_category {
+ {-item_id:required}
+ {-category_name:required}
+ {-tree_id:required}
+} {
+ set category_id_list [category::get_id $category_name]
+ set this_tree [category_tree::get_tree $tree_id]
+ set categories [list]
+ foreach category $this_tree {
+ set category_id [lindex $category 0]
+ lappend categories $category_id
+ }
+ set added 0
+ foreach category_id $category_id_list {
+ if {[lsearch -exact $categories $category_id] != -1 } {
+ category::map_object -object_id $item_id $category_id
+ set added 1
+ }
+ }
+}
+
+ad_proc -public learning_content::insert_items_into_category_by_name {
+ {-object_category_list:required}
+ {-package_id:required}
+} {
+ set tree_list [category_tree::get_mapped_trees $package_id]
+ set tree_id [lindex [lindex $tree_list 0] 0]
+ set folder_id [::$package_id folder_id]
+ foreach {item_name category_name } $object_category_list {
+ set item_id [db_string get_item_id {} -default "0"]
+ if { $item_id } {
+ learning_content::insert_item_into_category \
+ -item_id $item_id \
+ -category_name $category_name \
+ -tree_id $tree_id
+ }
+ }
+}
+
+ad_proc -public learning_content::create_target_category_tree_and_map_source_category_tree {
+ {-original_categories:required}
+ {-package_id:required}
+} {
+ set tree_list [category_tree::get_mapped_trees $package_id]
+ set tree_id [lindex [lindex $tree_list 0] 0]
+ category_tree::unmap -tree_id $tree_id -object_id $package_id
+ set orig_new_category_map [list]
+ set new_tree_id [category_tree::add \
+ -name "\#learning-content.choose_location\#" \
+ -context_id $package_id ]
+ foreach orig_cat $original_categories {
+ set original_category_id [lindex $orig_cat 0]
+ set original_category_name [lindex $orig_cat 1]
+ set original_category_level [lindex $orig_cat 2]
+ set original_category_parent [lindex $orig_cat 3]
+ set new_category_id [category::add \
+ -tree_id $new_tree_id\
+ -parent_id [learning_content::get_mapped_category \
+ -category_map $orig_new_category_map \
+ -query_orig_category_id $original_category_parent]\
+ -name $original_category_name]
+ lappend orig_new_category_map [list $original_category_id \
+ $new_category_id]
+ }
+ category_tree::map -tree_id $new_tree_id -object_id $package_id -widget ""
+ return $orig_new_category_map
+}
+
+ad_proc -public learning_content::get_mapped_category {
+ {-category_map:required}
+ {-query_orig_category_id:required}
+ } {
+ if {$query_orig_category_id == 0 } {
+ return ""
+ }
+
+ foreach category_pair $category_map {
+ set original_category_id [lindex $category_pair 0]
+ set new_category_id [lindex $category_pair 1]
+ if {$original_category_id == $query_orig_category_id } {
+ return $new_category_id
+ }
+ }
+ return ""
+}
+
+ad_proc -public learning_content::map_objects_to_categories {
+ {-categories_map:required}
+ {-object_category_map:required}
+ {-package_id:required}
+ {-folder_id:required}
+} {
+ foreach object_category $object_category_map {
+ set object_name [lindex $object_category 0]
+ set orig_category_id [lindex $object_category 1]
+ if {![empty_string_p $orig_category_id]} {
+ set new_category_id [learning_content::get_mapped_category \
+ -category_map $categories_map \
+ -query_orig_category_id $orig_category_id]
+
+ set object_id [db_string get_item_id_in_context {} -default "0"]
+ if {$object_id} {
+ category::map_object -remove_old \
+ -object_id $object_id $new_category_id
+ } else {
+ set error_msg "object_id = $object_id for "
+ append error_msg "object_name = $object_name"
+ ns_log error $error_msg
+ }
+ }
+ }
+}
+
+ad_proc -public learning_content::map_activity_objects {
+ {-src_folder_id:required}
+ {-dst_folder_id:required}
+} {
+
+ With the id of every page copied check if it's an activity, if so insert
+ a new entry with the new page_id and empty activity_id in the activities table
+
+} {
+ set objects_map [db_list_of_lists get_objects { *SQL* }]
+ foreach object $objects_map {
+ set item_id [lindex $object [expr [llength $object] - 1]]
+ set item_name [lindex $object 0]
+ if { [learning_content::activity_exists_p -item_id $item_id] } {
+ set new_item_id [db_string get_new_item_id { *SQL* } -default 0]
+ learning_content::activity_new -item_id $new_item_id -activity_id 0
+ }
+ }
+}
+
+ad_proc -public learning_content::copy_glossary_words_count {
+ {-src_folder_id:required}
+ {-dst_folder_id:required}
+} {
+ Copy the words count from the source instance of content
+ to a target instance
+} {
+ db_foreach get_words_count { *SQL* } {
+ if {[db_string check_word {} -default 0]} {
+ db_dml update_word { *SQL* }
+ } else {
+ db_dml insert_word { *SQL* }
+ }
+ }
+}
+
+ad_proc -public learning_content::parse_all_instance {
+ {-original_package_id:required}
+ {-new_package_id:required}
+} {
+ set wiki_folder_id [::xowiki::Page require_folder \
+ -name xowiki -package_id $new_package_id]
+ foreach page [::xowiki::PageInstance allinstances] {
+ set new_content [learning_content::parse_for_fs \
+ -page_content "[$page set instance_attributes] "\
+ -original_package_id $original_package_id \
+ -new_package_id $new_package_id]
+ $page set instance_attributes " $new_content "
+ }
+}
+
+ad_proc -public learning_content::parse_for_fs {
+ {-page_content:required}
+ {-original_package_id:required}
+ {-new_package_id:required}
+} {
+ set match_list [list]
+ set list_of_expressions [split $page_content ">"]
+ foreach expression $list_of_expressions {
+ if {[regexp \
+ /dotlrn(.*)file-storage(.*)(\\.)(...|....)(\") \
+ $expression one_match]} {
+ set one_match [string trimright $one_match "\""]
+ set this_match [list $one_match [learning_content::replace_path \
+ -original_path $one_match \
+ -original_package_id $original_package_id \
+ -new_package_id $new_package_id ] ]
+ lappend match_list $this_match
+ }
+ }
+ foreach match_pair $match_list {
+ regsub [lindex $match_pair 0] $page_content [lindex $match_pair 1]\
+ page_content
+ }
+ return $page_content
+}
+
+ad_proc -public learning_content::replace_path {
+ {-original_path:required}
+ {-original_package_id:required}
+ {-new_package_id:required}
+} {
+ set fs_view "file-storage/view"
+ set view_start [string last $fs_view $original_path]
+ if { $view_start == -1} {
+ return $original_path
+ }
+ set view_start [expr $view_start + [string length $fs_view]]
+ set fs_url [string range $original_path \
+ [string first "/dotlrn" $original_path] \
+ [expr $view_start - [string length "/view"]] ]
+ array set orig_fs_node_info [site_node::get_from_url -url $fs_url]
+ set orig_fs_package_id $orig_fs_node_info(package_id)
+ set new_node_id [site_node::get_node_id_from_object_id \
+ -object_id $new_package_id]
+ set new_parent_id [site_node::get_parent_id -node_id $new_node_id]
+ set new_package_id [site_node::get_object_id -node_id $new_parent_id]
+ set new_fs_url [site_node::get_url_from_object_id \
+ -object_id $new_package_id]
+ append new_fs_url "file-storage/"
+ array set new_fs_node_info [ site_node::get_from_url -url $new_fs_url ]
+ set new_fs_package_id $new_fs_node_info(package_id)
+ set orig_root_folder [fs_get_root_folder -package_id $orig_fs_package_id ]
+ set new_root_folder [fs_get_root_folder -package_id $new_fs_package_id ]
+ set fs_view_path [string range $original_path $view_start end]
+ set fs_view_path [ns_urldecode $fs_view_path]
+ set file_id [::content::item::get_id -item_path " $fs_view_path " \
+ -root_folder_id $orig_root_folder \
+ -resolve_index "t"]
+ if [empty_string_p $file_id] {
+ return $original_path
+ }
+ set final_fs_view_path $fs_view_path
+ set fs_view_path [string range $fs_view_path 1 \
+ [string last "/" $fs_view_path]]
+ set fs_view_path [string trimright $fs_view_path "/" ]
+ set folder_list [split $fs_view_path "/"]
+ set root_folder $new_root_folder
+ foreach folder $folder_list {
+ set folder [ns_urldecode $folder]
+ set folder_id [fs::get_folder -name "$folder" -parent_id $root_folder]
+ if { [empty_string_p $folder_id ] } {
+ set root_folder [fs::new_folder -name "$folder" \
+ -pretty_name "$folder" -parent_id $root_folder]
+ } else {
+ set root_folder $folder_id
+ }
+ }
+ set new_file_id [fs::file_copy -file_id $file_id \
+ -target_folder_id $root_folder]
+ set new_file_path $new_fs_url
+ append new_file_path "view"
+ append new_file_path $final_fs_view_path
+ return $new_file_path
+}
+
+ad_proc -public learning_content::get_categories {
+ {-tree_id:required}
+} {
+ Get Categories from Tree Id
+} {
+ set locale "en_US"
+ set result [list]
+ set result [db_list get_categories ""]
+ return $result
+}
+
+ad_proc -public learning_content::get_category_name {
+ {-category_id:required}
+} {
+ Get Category Name from Id
+} {
+ set locale "en_US"
+ if { [catch { array set cat_lang \
+ [lindex [nsv_get categories $category_id] 1] }] } {
+ return {}
+ }
+ if { ![catch { set name $cat_lang($locale) }] } {
+ # exact match: found name for this locale
+ return $name
+ }
+ if {![catch { set name $cat_lang( [ad_parameter DefaultLocale \
+ acs-lang "en_US"] )}]} {
+ return $name
+ }
+
+}
+
+ad_proc -public learning_content::get_first_page {
+ {-package_id:required}
+} {
+ Get the first visible page in the content tree, if any
+} {
+ set trees [category_tree::get_mapped_trees $package_id]
+ set tree [lindex $trees 0]
+ set tree_id [lindex $tree 0]
+ set units [category_tree::get_categories -tree_id $tree_id]
+ set units [lsort -increasing $units]
+ if { [llength $units] > 0 } {
+ foreach unit $units {
+ set categories [category::get_children -category_id $unit]
+ set categories [lsort -increasing $categories]
+ if { [llength $categories] > 0 } {
+ foreach category $categories {
+ set subcategories [category::get_children \
+ -category_id $category]
+ set subcategories [lsort -increasing $subcategories]
+ foreach subcategory $subcategories {
+ set objects [category::get_objects \
+ -category_id $subcategory]
+ if {[llength $objects] > 0} {
+ set object_id [lindex $objects 0]
+ set page_name [db_string get_page_name {} \
+ -default ""]
+ return $page_name
+ }
+ }
+ set objects [category::get_objects -category_id $category]
+ if {[llength $objects] > 0} {
+ set object_id [lindex $objects 0]
+ set page_name [db_string get_page_name {} -default ""]
+ return $page_name
+ }
+ }
+ }
+ set objects [category::get_objects -category_id $unit]
+ if {[llength $objects] > 0} {
+ set object_id [lindex $objects 0]
+ set page_name [db_string get_page_name {} -default ""]
+ return $page_name
+ }
+ }
+ }
+ return ""
+}
+
+ad_proc -public learning_content::get_first_item_from_category_id {
+ {-category_id:required}
+ {-folder_id:required}
+} {
+ Get the first item mapped to the category
+} {
+ set name [db_string get_first_item {} -default ""]
+ return $name
+}
+
+ad_proc -public learning_content::get_first_tree_item_from_category_id {
+ {-category_id:required}
+ {-folder_id:required}
+} {
+ Get the first visible item in the tree below the category
+} {
+ set categories [category::get_children -category_id $category_id]
+ set categories [lsort -increasing $categories]
+ foreach category $categories {
+ set subcategories [category::get_children -category_id $category]
+ set subcategories [lsort -increasing $subcategories]
+ foreach subcategory $subcategories {
+ set name [learning_content::get_first_item_from_category_id \
+ -category_id $subcategory -folder_id $folder_id]
+ if { ![empty_string_p $name] } {
+ return $name
+ }
+ }
+ set name [learning_content::get_first_item_from_category_id \
+ -category_id $category -folder_id $folder_id]
+ if { ![empty_string_p $name] } {
+ return $name
+ }
+ }
+ set name [learning_content::get_first_item_from_category_id \
+ -category_id $category_id -folder_id $folder_id]
+ return $name
+}
+
+ad_proc -public learning_content::get_unit_id {
+ {-category_id:required}
+} {
+ Get the unit id of the category
+} {
+ if {![empty_string_p $category_id]} {
+ set parent_id [category::get_parent -category_id $category_id]
+ while { $parent_id != 0 && $category_id != $parent_id} {
+ set category_id $parent_id
+ set parent_id [category::get_parent -category_id $parent_id]
+ }
+ }
+ return $category_id
+}
+
+ad_proc -public learning_content::get_activity_id {
+ {-item_id:required}
+} {
+ Get the activity_id related to the item_id
+} {
+ set result [db_string activity_id { *SQL* } -default 0]
+ return $result
+}
+
+ad_proc -public learning_content::activity_exists_p {
+ {-item_id:required}
+} {
+ Check if there is an activity_id related to the item_id
+} {
+ set result [db_string activity_exists { *SQL* } -default 0]
+ return $result
+}
+
+ad_proc -public learning_content::activity_new {
+ {-item_id:required}
+ {-activity_id:required}
+} {
+ Insert a new activity
+} {
+ if { [exists_and_not_null item_id] && $item_id != 0 } {
+ if {![learning_content::activity_exists_p -item_id $item_id]} {
+ db_dml insert_activity { *SQL* }
+ }
+ }
+}
+
+ad_proc -public learning_content::activity_edit {
+ {-item_id:required}
+ {-activity_id:required}
+} {
+ Edit an existing activity
+} {
+ db_dml update_activity { *SQL* }
+}
+
+ad_proc -public learning_content::copy {
+ {-src_community_id:required}
+ {-dst_community_id:required}
+} {
+ Copy Content information from current community into another community.
+} {
+
+ set src_package_id [db_string get_src_package_id "" -default 0]
+ set dst_package_id [db_string get_dst_package_id "" -default 0]
+
+ if { $dst_package_id == 0 } {
+ dotlrn_community::add_applet_to_community \
+ $dst_community_id dotlrn_learning_content
+ set dst_package_id [db_string get_dst_package_id "" -default 0]
+ $dst_package_id destroy
+ }
+
+ ::xowiki::Package initialize -parameter {
+ {-object_type ::xowiki::Page}
+ {-objects ""}
+ } -package_id $src_package_id
+
+ set folder_id [::$package_id folder_id]
+
+ if {$objects eq ""} {
+ set sql [$object_type instance_select_query -folder_id $folder_id \
+ -with_subtypes true]
+ db_foreach instance_select $sql { lappend item_ids $item_id }
+ } else {
+ foreach o $objects {
+ if {[set id [CrItem lookup -name $o -parent_id $folder_id]] != 0} {
+ lappend item_ids $id
+ }
+ }
+ }
+
+ set content ""
+
+ append content "set object_name_category_id_map \[list\] " \n
+ append content "set objects_list \[list\] " \n
+ append content "set original_package_id $src_package_id " \n
+
+ foreach item_id $item_ids {
+
+ ::xowiki::Package instantiate_page_from_id -item_id $item_id
+ #
+ # if the page belongs to an Form/PageTemplate, include it as well
+ #
+ if {[$item_id istype ::xowiki::PageInstance]} {
+ set template_id [$item_id page_template]
+ if {[lsearch $item_ids $template_id] == -1 \
+ && ![info exists included($template_id)]} {
+ ::xowiki::Package instantiate_page_from_id -item_id $template_id
+ append content "[$template_id marshall]" \n
+ set included($template_id) 1
+ }
+ }
+
+ lappend item_category_list [list $item_id \
+ [learning_content::get_item_category_name -item_id $item_id]]
+ append content "[$item_id marshall]" \n
+ append content "lappend object_name_category_id_map { \
+ [$item_id set name] \
+ [category::get_mapped_categories $item_id] }" \n
+ append content "lappend objects_list { \
+ [$item_id set name] [$item_id item_id] }" \n
+ }
+ foreach item_id $item_ids {
+ $item_id destroy
+ }
+
+ #getting the content categories
+ set categories [list]
+ set original_categories [list]
+
+ foreach tree [category_tree::get_mapped_trees $package_id] {
+ foreach { tree_id tree_name } $tree {
+ if { [string equal $tree_name \
+ "\#learning-content.choose_location\#"] } {
+
+ foreach category_info [category_tree::get_tree $tree_id] {
+ foreach {cid category_label deprecated_p level} \
+ $category_info {break}
+ lappend categories $cid
+ lappend categories [category::get_name $cid]
+ set category_parent [category::get_parent \
+ -category_id $cid]
+ set one_category [list $cid $category_label $level \
+ $category_parent]
+ lappend original_categories $one_category
+ }
+ }
+ }
+ }
+ append content "set this_package_id $dst_package_id" \n
+ append content "set this_folder_id \[\$this_package_id folder_id\]" \n
+ append content "set category_map \
+ \[learning_content::create_target_category_tree_and_map_source_category_tree \
+ -original_categories \[list $original_categories \] -package_id \
+ $dst_package_id \]\n"
+ ## Check for activities and insert them into the new instance
+ append content "learning_content::parse_all_instance \
+ -original_package_id \$original_package_id \
+ -new_package_id \$this_package_id\n"
+ append content "ad_schedule_proc -once t 5 \
+ learning_content::map_objects_to_categories \
+ -categories_map \$category_map \
+ -object_category_map \$object_name_category_id_map \
+ -package_id $dst_package_id \
+ -folder_id \$this_folder_id\n"
+
+ set src_folder_id $folder_id
+ set package_url [apm_package_url_from_id $dst_package_id]
+ $package_id destroy
+ ::xowiki::Package initialize -package_id $dst_package_id
+ set dst_folder_id [::$package_id folder_id]
+ foreach o [::xowiki::Page allinstances] {
+ set preexists($o) 1
+ }
+
+ if {[catch {namespace eval ::xo::import $content} error]} {
+ set msg "Error: $error"
+ set result 0
+ } else {
+ set objects [list]
+ foreach o [::xowiki::Page allinstances] {
+ if {![info exists preexists($o)]} {lappend objects $o}
+ }
+ set msg [$package_id import -objects $objects -replace 0]
+ # map all the new activity pages after creating them
+ learning_content::map_activity_objects -src_folder_id $src_folder_id \
+ -dst_folder_id $dst_folder_id
+ learning_content::copy_glossary_words_count -src_folder_id $src_folder_id \
+ -dst_folder_id $dst_folder_id
+ set result 1
+ }
+ namespace delete ::xo::import
+ $package_id destroy
+ return $result
+}
+
+
+ad_proc -public learning_content::category::delete_p {
+ {-tree_id:required}
+ {-category_id:required}
+} {
+ set tree_list [learning_content::category::get_tree_levels \
+ -subtree_id $category_id -tree_id $tree_id]
+ set tree_list [linsert $tree_list 0 $category_id]
+ foreach category $tree_list {
+ set my_category_id [lindex $category 0]
+ if {[db_string check_mapped_objects {}] eq 1} {
+ return 0
+ }
+ }
+ return 1
+}
+
+ad_proc -public learning_content::category::page_order {
+ {-tree_id:required}
+ {-category_id:required}
+ {-wiki_folder_id:required}
+} {
+ set tree_list [learning_content::category::get_tree_levels \
+ -subtree_id $category_id \
+ -tree_id $tree_id]
+ set tree_list [linsert $tree_list 0 $category_id]
+ foreach cat_tree $tree_list {
+ set cat_id [lindex $cat_tree 0]
+ set page_list [db_list_of_lists select_content {}]
+ if {[llength $page_list] > 0} {
+ break
+ }
+ }
+ return $page_list
+}
+
+ad_proc -public learning_content::get_next_page_order {
+} {
+ set folder_id [content::folder::get_folder_from_package \
+ -package_id [ad_conn package_id]]
+ set list_page_order [db_list select_order ""]
+ set max_page_order [lindex [lsort -decreasing \
+ -command learning_content::simple_compare $list_page_order] 0]
+ if {[llength $list_page_order] < 1} {
+ set max_page_order 0
+ }
+ incr max_page_order
+ return $max_page_order
+}
+
+ad_proc -public learning_content::category::category_childs {
+ {-tree_id:required}
+ {-category_id:required}
+ {-wiki_folder_id:required}
+} {
+ set tree_list [learning_content::category::get_tree_levels \
+ -subtree_id $category_id -tree_id $tree_id]
+ set tree_list [linsert $tree_list 0 [list $category_id "n"]]
+ foreach category $tree_list {
+ set cat_id [lindex $category 0]
+ set count [db_string select_cat {*SQL*} -default 0]
+ if {$count > 0} {
+ return 1
+ }
+ }
+ return 0
+}
+
+ad_proc -public learning_content::category::delete {
+ {-tree_id:required}
+ {-category_ids:required}
+ {-locale ""}
+} {
+ set user_id [auth::get_user_id]
+ permission::require_permission \
+ -object_id $tree_id \
+ -privilege category_tree_write
+ set result 1
+ db_transaction {
+ foreach category_id [db_list order_categories_for_delete ""] {
+ category::delete $category_id
+ }
+ category_tree::flush_cache $tree_id
+ } on_error {
+ set result 0
+ }
+ return $result
+}
+
+ad_proc -private learning_content::category::valid_level_and_count {
+ {-tree_id:required}
+ {-category_id:required}
+} {
+ set tree_list [learning_content::category::get_tree_levels -tree_id $tree_id]
+ set my_level [lindex \
+ [lindex $tree_list \
+ [lsearch -regexp \
+ $tree_list $category_id]] \
+ 3]
+ if {$my_level > 2} {
+ return 0
+ }
+ set sub_tree_list [learning_content::category::get_tree_levels -only_level 1 \
+ -subtree_id $category_id -tree_id $tree_id]
+
+ if {[llength $sub_tree_list] >= 5} {
+ return 0
+ }
+ return 1
+}
+
+
+ad_proc -private learning_content::category::map_new_tree {
+ {-object_id:required}
+ {-tree_name:required}
+ {-user_id ""}
+} {
+
+ if {[empty_string_p $user_id]} {
+ set user_id [ad_conn user_id]
+ }
+
+ db_transaction {
+ set tree_id [category_tree::add -name $tree_name -user_id $user_id]
+ learning_content::category::new_subtree -tree_id $tree_id -user_id $user_id
+ category_tree::map -tree_id $tree_id \
+ -object_id $object_id \
+ -assign_single_p t \
+ -require_category_p t \
+ -widget ""
+ }
+ return $tree_id
+}
+
+ad_proc -private learning_content::category::new_subtree {
+ {-tree_id:required}
+ {-language "en_US"}
+ {-user_id ""}
+} {
+
+ if {[empty_string_p $user_id]} {
+ set user_id [ad_conn user_id]
+ }
+ set description "New unit for content"
+ set parent_id [db_null]
+ set unit_id [category::add -tree_id $tree_id \
+ -parent_id $parent_id \
+ -locale $language \
+ -name "Unidad N" \
+ -user_id $user_id \
+ -description $description]
+
+ category::add -tree_id $tree_id \
+ -parent_id $unit_id \
+ -locale $language \
+ -name "Introduccion" -description $description
+
+ category::add -tree_id $tree_id \
+ -parent_id $unit_id \
+ -locale $language \
+ -name "Contenido" \
+ -user_id $user_id \
+ -description $description
+
+ category::add -tree_id $tree_id \
+ -parent_id $unit_id \
+ -locale $language \
+ -name "Actividades" \
+ -user_id $user_id \
+ -description $description
+
+ category::add -tree_id $tree_id \
+ -parent_id $unit_id \
+ -locale $language \
+ -name "Anexo" \
+ -user_id $user_id \
+ -description $description
+ return $unit_id
+}
+
+ad_proc -private learning_content::category::category_parent {
+ -category_id
+ -tree_id
+ {-level 0}
+} {
+ if {[db_0or1row select_parent {*SQL*}]} {
+ if {![empty_string_p $parent_id] && $level eq 0} {
+ return [learning_content::category::category_parent -category_id $parent_id \
+ -tree_id $tree_id]
+ } elseif {![empty_string_p $parent_id] && $level ne 0} {
+ return $parent_id
+ } else {
+ return $category
+ }
+ }
+}
+
+ad_proc -public learning_content::value_compare {
+ {-def:required}
+ x
+ y
+} {
+ set xp [string first . $x]
+ set yp [string first . $y]
+ if {$xp == -1 && $yp == -1} {
+ if {$x < $y} {
+ return -1
+ } elseif {$x > $y} {
+ return 1
+ } else {
+ return $def
+ }
+ } elseif {$xp == -1} {
+ set yh [string range $y 0 [expr {$yp-1}]]
+ return [value_compare -def -1 $x $yh]
+ } elseif {$yp == -1} {
+ set xh [string range $x 0 [expr {$xp-1}]]
+ return [value_compare -def 1 $xh $y]
+ } else {
+ set xh [string range $x 0 $xp]
+ set yh [string range $y 0 $yp]
+ if {$xh < $yh} {
+ return -1
+ } elseif {$xh > $yh} {
+ return 1
+ } else {
+ incr xp
+ incr yp
+ return [value_compare -def $def [string range $x $xp end] \
+ [string range $y $yp end]]
+ }
+ }
+}
+
+ad_proc -public learning_content::compare {
+ a
+ b
+} {
+ set x [lindex $a 1]
+ set y [lindex $b 1]
+ return [learning_content::value_compare -def 0 $x $y]
+}
+
+ad_proc -public learning_content::simple_compare {
+ a
+ b
+} {
+ return [learning_content::value_compare -def 0 $a $b]
+}
+
+ad_proc -public learning_content::category::get_tree_levels {
+ {-all:boolean}
+ {-subtree_id ""}
+ {-to_level 0}
+ {-only_level 0}
+ {-tree_id:required}
+ {-locale ""}
+} {
+ Get all categories of a category tree from the cache.
+
+ @option all Indicates that phased_out categories should be included.
+ @option subtree_id Return only categories of the given subtree.
+ @param tree_id category tree to get the categories of.
+ @param locale language in which to get the categories. [ad_conn locale]
+ used by default.
+ @return tcl list of lists: category_id category_name deprecated_p level
+} {
+ if {[catch {set tree [nsv_get category_trees $tree_id]}]} {
+ return
+ }
+ if {$to_level ne 0 && $only_level ne 0} {
+ set only_level 0
+ }
+ set result ""
+ if {[empty_string_p $subtree_id]} {
+ foreach category $tree {
+ util_unlist $category category_id deprecated_p level
+ if {$all_p || $deprecated_p == "f"} {
+ if {$to_level < $level && $to_level ne 0} {
+ continue
+ }
+ if {$only_level ne $level && $only_level ne 0} {
+ continue
+ }
+ lappend result [list $category_id \
+ [category::get_name $category_id $locale] \
+ $deprecated_p $level]
+ }
+ }
+ } else {
+ set in_subtree_p 0
+ set subtree_level 0
+ foreach category $tree {
+ util_unlist $category category_id deprecated_p level
+ if {$level == $subtree_level || $level < $subtree_level} {
+ set in_subtree_p 0
+ }
+ if {$in_subtree_p && $deprecated_p == "f"} {
+ if {$to_level < [expr $level - $subtree_level] \
+ && $to_level ne 0} {
+ continue
+ }
+
+ if {$only_level ne [expr $level - $subtree_level] \
+ && $only_level ne 0} {
+ continue
+ }
+
+ lappend result [list $category_id [category::get_name \
+ $category_id $locale] $deprecated_p \
+ [expr $level - $subtree_level]]
+ }
+ if {$category_id == $subtree_id} {
+ set in_subtree_p 1
+ set subtree_level $level
+ }
+ }
+ }
+ return $result
+}
+
+ad_proc -public learning_content::category::get_under_categories {
+ {-category_id:required}
+ {-parent_id:required}
+} {
+ Get the categories under the specified category
+} {
+ set categories [db_list get_under_categories {*SQL*}]
+ return $categories
+}
+
+ad_proc -public learning_content::category::get_over_categories {
+ {-category_id:required}
+ {-parent_id:required}
+} {
+ Get the categories over the specified category
+} {
+ set categories [db_list get_over_categories {*SQL*}]
+ return $categories
+}
Index: openacs-4/packages/learning-content/tcl/learning-content-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/learning-content-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/learning-content-procs.xql 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,280 @@
+
+
+
+
+
+
+ select item_id
+ from cr_items
+ where name = :item_name
+ and parent_id = :dst_folder_id
+
+
+
+
+
+ select name, item_id
+ from cr_items
+ where parent_id = :src_folder_id
+
+
+
+
+
+ select *
+ from content_glossary_term_count
+ where folder_id = :src_folder_id
+
+
+
+
+
+ select 1
+ from content_glossary_term_count
+ where term = :term
+ and page = :page
+ and folder_id = :dst_folder_id
+
+
+
+
+
+ insert into
+ content_glossary_term_count
+ (term, page, folder_id, times_used)
+ values
+ (:term, :page, :dst_folder_id, :times_used)
+
+
+
+
+
+ update content_glossary_term_count
+ set times_used = :times_used
+ where term = :term
+ and page = :page
+ and folder_id = :dst_folder_id
+
+
+
+
+
+ select object_id from acs_objects
+ where title = :item_name
+ and context_id = :folder_id
+
+
+
+
+
+ select object_id from acs_objects
+ where title = :object_name
+ and context_id = :folder_id
+
+
+
+
+
+ select name
+ from cr_items
+ where item_id = :object_id
+
+
+
+
+
+ select activity_id
+ from content_activities
+ where item_id = :item_id
+
+
+
+
+
+ update content_activities
+ set activity_id = :activity_id
+ where item_id = :item_id
+
+
+
+
+
+ insert into
+ content_activities (item_id, activity_id)
+ values (:item_id, :activity_id)
+
+
+
+
+
+ select 1
+ from content_activities
+ where item_id = :item_id
+
+
+
+
+
+ select object_id
+ from site_nodes
+ where parent_id = (
+ select node_id
+ from site_nodes
+ where object_id = (
+ select package_id
+ from dotlrn_communities
+ where community_id = :src_community_id ) )
+ and name = 'learning-content'
+
+
+
+
+
+ select object_id
+ from site_nodes
+ where parent_id = (
+ select node_id
+ from site_nodes
+ where object_id = (
+ select package_id
+ from dotlrn_communities
+ where community_id = :dst_community_id )
+ )
+ and name = 'learning-content'
+
+
+
+
+
+ select c.category_id as category_id
+ from categories c,
+ category_translations ct
+ where parent_id is null
+ and tree_id = :tree_id
+ and c.category_id = ct.category_id
+ and ct.locale = :locale
+ order by category_id
+
+
+
+
+
+ select category_id
+ from categories
+ where tree_id = :tree_id
+ and category_id in ([join $category_ids ,])
+ order by left_ind desc
+
+
+
+
+
+ select count(ci.item_id)
+ from category_object_map c, cr_items ci,
+ cr_revisions r, xowiki_page p
+ where c.object_id = ci.item_id
+ and ci.parent_id = :wiki_folder_id
+ and ci.content_type not in ('::xowiki::PageTemplate')
+ and ci.name not in ('es:header_page','es:index','es:indexe')
+ and r.revision_id = ci.live_revision
+ and p.page_id = r.revision_id
+ and c.category_id = :cat_id
+ group by category_id
+ order by category_id desc
+
+
+
+
+
+ select ci.item_id,
+ p.page_order,
+ ci.name,
+ ci.content_type,
+ category_id,
+ xpi.page_instance_id
+ from category_object_map c,
+ cr_items ci,
+ xowiki_page p,
+ xowiki_page_instance xpi
+ where c.object_id = ci.item_id
+ and ci.parent_id = :wiki_folder_id
+ and ci.content_type not in ('::xowiki::PageTemplate')
+ and p.page_id = xpi.page_instance_id
+ and category_id = :cat_id
+ and xpi.page_instance_id = ci.live_revision
+ order by p.page_order
+
+
+
+
+
+ select ci.item_id,
+ p.page_order,
+ ci.name,
+ ci.content_type,
+ category_id,
+ xpi.page_instance_id
+ from category_object_map c,
+ cr_items ci,
+ xowiki_page p,
+ xowiki_page_instance xpi
+ where c.object_id = ci.item_id
+ and ci.parent_id = :wiki_folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and p.page_id = xpi.page_instance_id
+ and category_id in ([join $cat_id ","])
+ and xpi.page_instance_id = ci.live_revision
+ order by p.page_order
+
+
+
+
+
+ select parent_id,
+ category_id as category
+ from categories
+ where category_id = :category_id
+ and tree_id = :tree_id
+
+
+
+
+
+ select count(p.page_id)
+ from cr_items ci,
+ xowiki_page p
+ where ci.parent_id = :folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and p.page_id = ci.live_revision
+
+
+
+
+
+ select 1 from cr_items
+ where name = :page_name
+ and parent_id = :folder_id
+
+
+
+
+
+ select category_id
+ from categories
+ where parent_id = :parent_id
+ and category_id < :category_id
+ order by category_id desc
+
+
+
+
+
+ select category_id
+ from categories
+ where parent_id = :parent_id
+ and category_id > :category_id
+ order by category_id
+
+
+
+
Index: openacs-4/packages/learning-content/tcl/learning-content-xowiki-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/learning-content-xowiki-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/learning-content-xowiki-procs.tcl 5 Mar 2009 21:28:56 -0000 1.1
@@ -0,0 +1,312 @@
+ad_library {
+ Content package procs
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-09-17
+}
+
+namespace eval ::learning_content {
+
+ ::xo::PackageMgr create ::learning_content::Package \
+ -package_key "learning-content" -pretty_name "Learn Content" \
+ -superclass ::xowiki::Package
+
+ Package instproc initialize {} {
+ ::xowiki::WikiForm instmixin add ::learning_content::ContentForm
+ ::xowiki::PageInstanceEditForm instmixin add ::learning_content::ContentWikiForm
+ ::xowiki::PageTemplateForm instmixin add ::learning_content::ContentTemplateForm
+ ::xowiki::FormPage instmixin add ::learning_content::ContentFormPage
+ ::xowiki::Page instmixin add ::learning_content::ContentPage
+ next
+ }
+
+ Package instproc destroy {} {
+ ::xowiki::WikiForm instmixin delete ::learning_content::ContentForm
+ ::xowiki::PageInstanceEditForm instmixin delete \
+ ::learning_content::ContentWikiForm
+ ::xowiki::PageTemplateForm instmixin delete \
+ ::learning_content::ContentTemplateForm
+ ::xowiki::FormPage instmixin delete ::learning_content::ContentFormPage
+ ::xowiki::Page instmixin delete ::learning_content::ContentPage
+ next
+ }
+
+ Package instproc return_page {
+ {-adp:required}
+ {-variables:required}
+ {-form}
+ } {
+ foreach _var $variables {
+ if {[llength $_var] == 2} {
+ upvar [lindex $_var 0] [lindex $_var 0]
+ upvar [string trim [lindex $_var 1] $] \
+ [string trim [lindex $_var 1] $]
+ } else {
+ upvar $_var [set _var]
+ }
+ }
+ if {[string eq $adp "/packages/xowiki/www/edit"]} {
+ set adp "/packages/learning-content/www/edit"
+ }
+ if {[exists_and_not_null item_id]} {
+ set category_id [category::get_mapped_categories $item_id]
+ set tree_id [category::get_tree $category_id]
+ set category_id [learning_content::category::category_parent \
+ -category_id $category_id -level 1 -tree_id $tree_id]
+ set activity_id [learning_content::activity_exists_p -item_id $item_id]
+ if { !$activity_id } {
+ # AR: catch the case when a page has been deleted and will be imported
+ if {[catch { set page_name [$item_id name] } error]} {
+ set page_name "index"
+ set no_links_p 1
+ } else {
+ set no_links_p 0
+ }
+ if {([string first "glossary-list" $page_name] == -1 && \
+ [string first "index" $page_name] == -1) || \
+ [acs_user::site_wide_admin_p]} {
+ if { !$no_links_p } {
+ set edit_link [my make_link -privilege admin $item_id edit]
+ }
+ }
+
+ if { $no_links_p } {
+ set edit_link ""
+ set rev_link ""
+ }
+ } else {
+ set edit_link [my make_link -privilege admin \
+ -link "activity-new" [my id] edit item_id \
+ {return_url "[ad_return_url]"}]
+ }
+ set new_link2 [my make_link -privilege admin \
+ -link "page-instance-new" [my id] \
+ edit-new object_type]
+
+ set new_link3 [my make_link -privilege admin \
+ -link "activity-new" [my id] edit-new \
+ category_id {return_url "[ad_return_url]"}]
+
+ lappend variables new_link2 new_link3 category_id
+ }
+ if {[exists_and_not_null form]} {
+ upvar form [set form]
+ } else {
+ set form ""
+ }
+ return [next -adp $adp -variables $variables -form $form]
+ }
+
+ Class create ContentPage -superclass ::xowiki::Page
+
+ ContentPage instproc edit {} {
+ my instvar package_id item_id revision_id
+ set page_name [$item_id name]
+ if {([string first "glossary-list" $page_name] == -1 && \
+ [string first "index" $page_name] == -1) || \
+ [acs_user::site_wide_admin_p]} {
+ next
+ } else {
+ set content [_ learning-content.you_dont_have_perm]
+ set html [$package_id return_page \
+ -adp /packages/learning-content/www/view-plain \
+ -variables {content}]
+ return $html
+ }
+ }
+
+ ContentPage instproc delete {} {
+ my instvar package_id item_id name parent_id
+ catch {
+ db_dml [my qn delete_term_count] {
+ delete from content_glossary_term_count
+ where folder_id = :parent_id
+ and page = :name}
+ } error
+ next
+ }
+
+ Class create ContentFormPage -superclass ::xowiki::FormPage
+
+ ContentFormPage instproc footer {} {
+ if {![my exists __no_form_page_footer]} {
+ return ""
+ }
+ next
+ }
+
+ Class create ContentForm -superclass ::xowiki::WikiForm \
+ -parameter {
+ {field_list
+ {item_id name page_order title creator text description nls_language}}
+ {f.page_order
+ {page_order:text(hidden),optional}
+ }
+ {with_categories false}
+ {validate {
+ {name {\[::xowiki::validate_name\]} {Another item with this name exists \
+ already in this folder}}}
+ }
+ }
+
+ Class create ContentTemplateForm -superclass ::xowiki::PageTemplateForm \
+ -parameter {
+ {field_list {item_id name text}}
+ {f.name
+ {name:text(hidden),optional}
+ }
+ }
+
+ Class create ContentWikiForm -superclass ::xowiki::PageInstanceEditForm \
+ -parameter {
+ {field_list {item_id name title page_order text creator description}}
+ {f.name
+ {name:text(hidden),optional}
+ }
+ {f.page_order
+ {page_order:text(hidden),optional}
+ }
+ {f.title
+ {title:text(text)
+ {label #learning-content.Name#}}
+ }
+ {with_categories true}
+ }
+
+ ContentWikiForm instproc after_submit {item_id} {
+ #AR: overwrite the after submit_link
+ #to avoid redirecting to a language specific url
+ my instvar data
+ my submit_link "[[$data package_id] package_url][$data name]"
+ next
+ }
+
+ ContentWikiForm instproc edit_data {} {
+ my instvar page_instance_form_atts data
+ foreach var $page_instance_form_atts {
+ if {[string equal $var "contenido"]} {
+ set contenido [my var $var]
+ set page_name "[$data set name]"
+ set folder_id [$data set parent_id]
+ # Delete old glossary entries for the page
+ db_dml [my qn remove_old_messages] {
+ delete from content_glossary_term_count
+ where folder_id = :folder_id
+ and page = :page_name}
+ # Find all glossary words
+ while { [regexp -nocase "
\]*>" \
+ $contenido match value1 value2 value3] } {
+
+ regexp -nocase ".* id=\"(.+)__\[0-9\]+__\" .*" $match \
+ match term
+ set cont [regsub -all -nocase \
+ "\]*id=\"${term}__\[0-9\]+__\"\[^>\]*>" \
+ $contenido "" result]
+ set contenido $result
+ if {[db_string [my qn check_if_exists] "
+ select 1
+ from content_glossary_term_count
+ where folder_id = $folder_id
+ and page = '$page_name'
+ and term = '$term'" -default 0]} {
+ db_dml [my qn update_word_times] {
+ update content_glossary_term_count
+ set times_used = :cont
+ where folder_id = :folder_id
+ and page = :page_name
+ and term = :term}
+ } else {
+ db_dml [my qn insert_word_times] {
+ insert into content_glossary_term_count
+ ( term, page, folder_id, times_used )
+ values
+ ( :term, :page_name, :folder_id, :cont )}
+ }
+ # If fails to replace the words,
+ # continue with the next one to avoid loops
+ if { $cont == 0 } break
+ }
+ }
+ }
+ set item_id [next]
+ return $item_id
+ }
+
+ Class create Policy -superclass ::xo::Policy
+
+ Policy policyb -contains {
+ Class Package -array set require_permission {
+ admin swa
+ reindex swa
+ rss swa
+ google-sitemap none
+ google-sitemapindex none
+ delete {{{has_class ::xowiki::PageTemplate} id swa}
+ {{has_class ::xowiki::Object} id swa}
+ {id admin}}
+
+ edit-new {{{has_class ::xowiki::Object} id swa}
+ {{has_class ::xowiki::Page} id swa}
+ {{has_class ::xowiki::PageTemplate} id swa}
+ {id create}}
+ }
+
+ Class Page -array set require_permission {
+ view none
+ revisions {{package_id admin}}
+ diff swa
+ edit swa
+ make-live-revision {{package_id admin}}
+ delete-revision swa
+ delete swa
+ save-tags login
+ popular-tags login
+ }
+
+ Class PageInstance -array set require_permission {
+ view none
+ revisions {{package_id admin}}
+ diff {{package_id admin}}
+ edit {{package_id admin}}
+ make-live-revision {{package_id admin}}
+ delete-revision {{package_id admin}}
+ delete {{item_id admin}}
+ save-tags login
+ popular-tags login
+ }
+
+ Class Form -array set require_permission {
+ view none
+ revisions {{package_id admin}}
+ edit {{package_id admin}}
+ make-live-revision {{package_id admin}}
+ delete-revision {{package_id admin}}
+ delete {{item_id admin}}
+ create-new {{package_id admin}}
+ }
+
+ Class PageTemplate -array set require_permission {
+ edit swa
+ edit-new swa
+ revisions swa
+ diff swa
+ make-live-revision swa
+ delete-revision swa
+ delete swa
+ }
+
+ Class Object -array set require_permission {
+ edit swa
+ revisions swa
+ make-live-revision swa
+ delete-revision swa
+ delete swa
+ save-tags swa
+ popular-tags swa
+ }
+
+ Class File -array set require_permission {
+ download none
+ }
+ }
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/tcl/learning-content-xowiki-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/tcl/learning-content-xowiki-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/tcl/learning-content-xowiki-procs.xql 5 Mar 2009 21:28:57 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+
+
+
+ select 1
+ from content_activities
+ where item_id = :item_id
+
+
+
Index: openacs-4/packages/learning-content/www/activity-new.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/activity-new.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/activity-new.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,106 @@
+
+ @page_title;noquote@
+ @context;noquote@
+
+
+
+
+
+
+
+
+
+
+ |
+ 1. #learning-content.choose_activity# |
+ |
+ 2. #learning-content.choose_location# |
+ |
+
+
+
+
+
+
+
+ 1. #learning-content.select_type_of_activity#
+
+
+
+ #learning-content.cancel#
+ |
+
+
+
+
+ |
+
+
+ 2. #learning-content.choose_activity#
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+ 3. #learning-content.confirm#
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
Index: openacs-4/packages/learning-content/www/activity-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/activity-new.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/activity-new.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,142 @@
+ad_page_contract {
+ Interface for creating a new activity for content
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-15
+} {
+ {item_id 0}
+ {category_id 0}
+ {activity_id 0}
+ {activity_name ""}
+ {redirect_url ""}
+ {activity_type ""}
+ {new_activity_id 0}
+ {return_url ""}
+}
+
+if { $item_id == 0 } {
+ set page_title [_ learning-content.new_activity]
+ set context [list "[_ learning-content.new_activity]"]
+} else {
+ set page_title [_ learning-content.edit_activity]
+ set context [list "[_ learning-content.edit_activity]"]
+}
+
+set package_parent_id [site_node::get_parent_id -node_id [ad_conn node_id]]
+set package_community_id [site_node::get_object_id \
+ -node_id $package_parent_id]
+set community_id [dotlrn_community::get_community_id \
+ -package_id $package_community_id]
+set community_url [dotlrn_community::get_community_url $community_id]
+set url "${community_url}chat"
+
+if {[site_node::exists_p -url $url]} {
+ set chat_is_mounted 1
+} else {
+ set chat_is_mounted 0
+}
+
+set forward_url ""
+if { $item_id != 0 || $activity_id != 0 } {
+
+ if { $activity_id == 0 } {
+ set activity_id_o [learning_content::get_activity_id -item_id $item_id]
+ } else {
+ set activity_id_o $activity_id
+ }
+ if { $activity_id_o != 0 } {
+ set object_type [acs_object_type $activity_id_o]
+ } else {
+ set object_type ""
+ }
+
+ if {![empty_string_p $object_type]} {
+ if {[string eq $object_type content_item]} {
+ set object_type [::xo::db::CrClass get_object_type \
+ -item_id $activity_id_o]
+ }
+ set activity_type $object_type
+ if { $item_id != 0 } {
+ set revision_id [content::item::get_live_revision \
+ -item_id $item_id]
+ set page [::xowiki::Package instantiate_page_from_id -item_id $item_id \
+ -revision_id $revision_id]
+ set activity_name_o [$page set title]
+ } else {
+ set activity_name_o $activity_name
+ }
+ } else {
+ set activity_id_o 0
+ set activity_name_o ""
+ }
+
+} else {
+ set object_type ""
+ set activity_id_o 0
+ set activity_name_o ""
+}
+
+set package_id [ad_conn package_id]
+set parent_id [site_node::get_parent_id \
+ -node_id [site_node::get_node_id_from_object_id \
+ -object_id $package_id]]
+
+permission::require_permission -object_id $package_id -privilege admin
+
+ad_form -name activities \
+ -has_submit { 1 } \
+ -form {
+ {activity_id:text(text),optional {label ""}
+ {html
+ {id "activity_id"
+ value "$activity_id_o"
+ style "display: none;"}}}
+ {activity_name:text(hidden),optional
+ {html
+ {id "activity_name"
+ value "$activity_name_o"}}}
+ {redirect_url:text(hidden),optional
+ {html
+ {id "redirect_url"
+ value "$redirect_url"}}}
+ {page_item_id:text(hidden),optional
+ {html
+ {id "page_item_id"
+ value "$item_id"}}}
+ {category_id:text(hidden),optional
+ {html
+ {id "category_id"
+ value "$category_id"}}}
+ {activity_type:text(hidden),optional
+ {html
+ {id "activity_type"
+ value "$object_type"}}}
+ {new_activity_id:text(hidden),optional
+ {html
+ {id "new_activity_id"
+ value "$new_activity_id"}}}
+ {return_url:text(hidden),optional
+ {html
+ {id "return_url"
+ value "$return_url"}}}
+ {ok_submit:text(submit) {label "[_ learning-content.ok]"}}
+ } -on_submit {
+ if { ![empty_string_p $redirect_url] } {
+ ad_returnredirect [export_vars -base "activity-new2" \
+ {activity_id
+ redirect_url
+ page_item_id
+ category_id
+ activity_type
+ new_activity_id
+ return_url}]
+ } else {
+ ad_returnredirect [export_vars -base "activity-new2" \
+ {activity_id
+ activity_name
+ page_item_id
+ category_id
+ activity_type
+ new_activity_id
+ return_url}]
+ }
+ }
Index: openacs-4/packages/learning-content/www/activity-new2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/activity-new2.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/activity-new2.adp 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,62 @@
+
+ @page_title;noquote@
+ @context;noquote@
+
+
+
+
+
+
+
+ #learning-content.activity_type#: |
+ @activity_type_name@ |
+
+
+ #learning-content.Name#: |
+
+ @activity_name@#learning-content.New# |
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/activity-new2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/activity-new2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/activity-new2.tcl 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,160 @@
+ad_page_contract {
+ Interface for creating a new activity for content
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-10
+} {
+ {item_id 0}
+ {page_item_id 0}
+ {activity_id 0}
+ {redirect_url ""}
+ {activity_name ""}
+ {category_id 0}
+ {activity_type ""}
+ {new_activity_id 0}
+ {return_url "./"}
+}
+
+if { $page_item_id == 0 } {
+ set page_title [_ learning-content.new_activity]
+ set context [list "[_ learning-content.new_activity]"]
+} else {
+ set page_title [_ learning-content.edit_activity]
+ set context [list "[_ learning-content.edit_activity]"]
+}
+
+set package_id [ad_conn package_id]
+set parent_id [site_node::get_parent_id \
+ -node_id [site_node::get_node_id_from_object_id \
+ -object_id $package_id]]
+
+set trees [category_tree::get_mapped_trees $package_id id]
+set tree [lindex $trees 0]
+set tree_id [lindex $tree 0]
+
+permission::require_permission -object_id $package_id -privilege admin
+
+set activities_category 0
+set back_url [export_vars -base "activity-new" {
+ {item_id $page_item_id}
+ activity_id
+ redirect_url
+ activity_name
+ category_id
+ activity_type
+
+}]
+
+set categories [category::get_children -category_id $category_id]
+foreach category $categories {
+ if {[ string equal [category::get_name $category] "Actividades"]} {
+ set activities_category $category
+ }
+}
+switch $activity_type {
+ as_assessments {
+ set activity_type_name "[_ assessment.Assessment]"
+ }
+ forums_message {
+ set activity_type_name "[_ forums.Forum]"
+ }
+ evaluation_tasks {
+ set activity_type_name "[_ dotlrn-evaluation.Evaluation_]"
+ }
+ chat_room {
+ set activity_type_name "[_ chat.chat_rooms]"
+ }
+ default {
+ set activity_type_name ""
+ }
+}
+
+if { $page_item_id != 0 } {
+ set revision_id [content::item::get_live_revision -item_id $page_item_id]
+ set page [::xowiki::Package instantiate_page_from_id \
+ -item_id $page_item_id -revision_id $revision_id]
+ set optional_text [lindex [$page set instance_attributes] 1]
+} else {
+ set optional_text ""
+ set category_trees [category_tree::get_mapped_trees $package_id]
+ foreach tree $category_trees {
+ set cat_name "__category__ad_form__category_[lindex $tree 0]"
+ }
+}
+
+ad_form -name activities
+
+category::ad_form::add_widgets -container_object_id $package_id \
+ -form_name activities \
+ -element_name category \
+ -categorized_object_id $page_item_id
+
+ad_form -extend -name activities \
+ -has_submit { 1 } \
+ -form {
+ {optional_text:richtext(richtext),optional
+ {label "#learning-content.optional_description#"}
+ {options {
+ editor xinha plugins
+ {GetHtml
+ ContextMenu FullScreen ListType EditTag
+ Stylist OacsFs InsertGlossaryEntry}
+ }}
+ {value "$optional_text"}
+ {html {id "optional_text" rows 20 cols 100}}}
+ {activity_id:text(text),optional {label ""}
+ {html {id "activity_id" value $activity_id style "display: none;"}}}
+ {activity_name:text(hidden),optional
+ {html {id "activity_name" value "$activity_name"}}}
+ {redirect_url:text(hidden),optional
+ {html {id "redirect_url" value "$redirect_url"}}}
+ {page_item_id:text(hidden),optional
+ {html {id "page_item_id" value $page_item_id}}}
+ {ok_submit:text(submit) {label "[_ learning-content.ok]"}}
+ {cancel_submit:text(submit) {label "[_ learning-content.cancel]"}
+ {html
+ {onclick "document.getElementById('action').value = 'cancel';"}}}
+ {action:text(hidden) {html {id "action"}} {value ""}}
+ } -on_submit {
+ if { [string equal $action "cancel"] } {
+ ad_returnredirect $return_url
+ }
+ set category_trees [category_tree::get_mapped_trees $package_id]
+ foreach tree $category_trees {
+ set cat_name "__category__ad_form__category_[lindex $tree 0]"
+ set category_id [ns_queryget "$cat_name"]
+ }
+
+ if { $page_item_id == 0} {
+ set data [learning_content::create_page -content $optional_text \
+ -page_title $activity_name]
+ set item_id [lindex $data 0]
+ } else {
+ set data [learning_content::update_page -content $optional_text -page_title \
+ $activity_name -page_item_id $page_item_id]
+ set item_id $page_item_id
+ }
+ set page_name [lindex $data 1]
+
+ if { $category_id != 0 } {
+ category::map_object -remove_old -object_id $item_id $category_id
+ }
+
+ if { $activity_id != 0 } {
+ if { $page_item_id != 0 } {
+ learning_content::activity_edit -item_id $page_item_id -activity_id $activity_id
+ } else {
+ learning_content::activity_new -item_id $item_id -activity_id $activity_id
+ }
+ } elseif { ![empty_string_p $redirect_url] } {
+ if {![learning_content::activity_exists_p -item_id $item_id]} {
+ learning_content::activity_new \
+ -item_id $item_id -activity_id 0
+ }
+ set redirect_url [lindex $redirect_url 0]
+ ad_returnredirect [export_vars \
+ -base $redirect_url {{page_instance_id $item_id}}]
+ }
+ set package_id [ad_conn package_id]
+ set package_url [apm_package_url_from_id $package_id]
+ ad_returnredirect "${package_url}$page_name"
+ }
Index: openacs-4/packages/learning-content/www/content-categories.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-categories.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-categories.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,152 @@
+::xowiki::Page proc __render_html {
+ -package_id
+ {-tree_name ""}
+ -tree_style
+ -no_tree_name:boolean
+ -count:boolean
+ {-summary 0}
+ {-open_page ""}
+ {-category_ids ""}
+ {-except_category_ids ""}
+} {}
+
+##### Generating YUI Dynamic Tree for index content #####
+set glossary_id [ns_queryget category_id]
+set cont 1
+set package_id [$__including_page set package_id]
+set package_url [$package_id package_url]
+set tree_list [category_tree::get_mapped_trees $package_id]
+set tree_id [lindex [lindex $tree_list 0] 0]
+set tree_name [lindex [lindex $tree_list 0] 1]
+set folder_id [$package_id folder_id]
+set categories [learning_content::get_categories -tree_id $tree_id]
+
+set page_id [string trimleft $__including_page "::"]
+
+# Alvaro: url of the script that adds the content dynamically
+# to the tree branches
+set dynamic_tree_url "${package_url}dynamic-tree"
+
+set open_category_id 0
+set open_item_id [expr {$open_page ne "" ? [::xo::db::CrClass lookup -name $open_page \
+ -parent_id $folder_id] : 0}]
+set open_category_id [category::get_mapped_categories -tree_id $tree_id \
+ $open_item_id]
+set open_unit_id1 0
+set open_unit_id2 0
+set open_unit_id3 0
+db_0or1row get_unit_id1 {*SQL*}
+db_0or1row get_unit_id2 {*SQL*}
+
+template::multirow create category_tree category_id category_name parent_id is_open_p
+template::multirow create glossary glossary_url glossary_parent_id selected_p
+
+foreach category_id $categories {
+
+ set total 0
+ set category_name [learning_content::get_category_name -category_id $category_id ]
+# Alvaro: for each branch we need to know if the open page is inside, so we
+#set it open if the page is inside or close otherwise
+ if {$open_unit_id1 == $category_id || $open_unit_id2 == $category_id \
+ || $open_category_id == $category_id || $glossary_id == $category_id} {
+ set is_open_unit true
+ } else {
+ set is_open_unit false
+ }
+
+ set total [expr $total + [llength [category::get_objects \
+ -category_id $category_id] ]]
+ set subcategories [db_list get_childrens {*SQL*}]
+ foreach subcategory_id $subcategories {
+ set total [expr $total + [llength [category::get_objects \
+ -category_id $subcategory_id] ]]
+ set in_subcategories [category::get_children \
+ -category_id $subcategory_id]
+ foreach in_subcategory_id $in_subcategories {
+ set total [expr $total + [llength [category::get_objects \
+ -category_id $in_subcategory_id] ]]
+ }
+ }
+
+ if { $total > 0 } {
+ # Alvaro: adding a category node to the tree root :Content
+ template::multirow append category_tree $category_id $category_name $package_id $is_open_unit
+
+ if {![exists_and_not_null open_page] } {
+ set open_page ""
+ }
+
+ set is_open false
+
+ foreach subcategory_id $subcategories {
+ set subcategory_name [learning_content::get_category_name \
+ -category_id $subcategory_id ]
+ set child_list \
+ [expr [category::count_children \
+ -category_id $subcategory_id] \
+ + [llength [category::get_objects \
+ -category_id $subcategory_id]]]
+ if { $child_list } {
+
+ if {$open_category_id == $subcategory_id || \
+ $open_unit_id1 == $subcategory_id } {
+ set is_open true
+ } else {
+ set is_open false
+ }
+
+ set in_subcategories [category::get_children \
+ -category_id $subcategory_id]
+ set subtotal 0
+ set subtotal [expr $subtotal \
+ + [llength [category::get_objects \
+ -category_id $subcategory_id]]]
+ foreach in_subcategory_id $in_subcategories {
+ set subtotal [expr $subtotal \
+ + [llength [category::get_objects \
+ -category_id $in_subcategory_id]]]
+ }
+
+ if { $subtotal > 0 } {
+ # Alvaro: adding a subcategory node to the category parent node
+ template::multirow append category_tree $subcategory_id $subcategory_name $category_id $is_open
+
+ foreach in_subcategory_id $in_subcategories {
+
+ set in_subcategory_name [learning_content::get_category_name \
+ -category_id $in_subcategory_id]
+ set in_child_list [expr \
+ [category::count_children \
+ -category_id $in_subcategory_id] \
+ + [llength [category::get_objects \
+ -category_id $in_subcategory_id]]]
+ if { $in_child_list } {
+ if {$open_category_id == $in_subcategory_id } {
+ set is_sub_open true
+ } else {
+ set is_sub_open false
+ }
+ # Alvaro: adding a in_subcategory node to the category parent node
+ template::multirow append category_tree $in_subcategory_id $in_subcategory_name $subcategory_id $is_sub_open
+ }
+ }
+ }
+ }
+ }
+ # Alvaro: this is how we tell the tree which page is open
+ }
+ # Alvaro: this will add the Glosario as a category to the tree.
+ if { $glossary_id == $category_id } {
+ template::multirow append category_tree $cont [_ learning-content.glossary] $category_id true
+ template::multirow append glossary "${package_url}glossary-list?category_id=$category_id" $cont 1
+ } else {
+ template::multirow append category_tree $cont [_ learning-content.glossary] $category_id false
+ template::multirow append glossary "${package_url}glossary-list?category_id=$category_id" $cont 0
+ }
+ set cont [expr $cont + 1]
+}
+
+if {![info exists skin]} {set skin portlet-skin}
+if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin}
+template::set_file $skin
+
Index: openacs-4/packages/learning-content/www/content-categories.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-categories.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-categories.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,26 @@
+
+
+
+ select parent_id as open_unit_id1
+ from categories
+ where category_id = :open_category_id
+
+
+
+
+
+ select parent_id as open_unit_id2
+ from categories
+ where category_id = :open_unit_id1
+
+
+
+
+
+ select category_id
+ from categories
+ where parent_id = :category_id
+ order by category_id
+
+
+
Index: openacs-4/packages/learning-content/www/content-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-view.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-view.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,126 @@
+
+ @title;noquote@
+ @context;noquote@
+ @header_stuff;noquote@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @content;noquote@
+
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/delete-glossary-word.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/delete-glossary-word.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/delete-glossary-word.adp 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1 @@
+no data
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/delete-glossary-word.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/delete-glossary-word.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/delete-glossary-word.tcl 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,51 @@
+ad_page_contract {
+ Delete Glossary Word(s) from CR and CONTENT_GLOSSARY
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-20
+} {
+ item_id:multiple,integer
+ return_url
+}
+
+set words $item_id
+set p_id [ad_conn package_id]
+permission::require_permission -object_id $p_id -privilege admin
+set changed_p 0
+db_transaction {
+ ::xowiki::Package initialize -package_id $p_id
+ set folder_id [content::folder::get_folder_from_package -package_id $p_id]
+
+ db_foreach get_pages { *SQL* } {
+
+ set revision_id [content::item::get_live_revision -item_id $page_id]
+ set page [xowiki::Package instantiate_page_from_id -item_id $page_id]
+ set instance_attributes [$page set instance_attributes]
+ set content [lindex $instance_attributes 1]
+ foreach item $words {
+ set item_name [db_string get_name { *SQL* } -default ""]
+ set reg_exp_var "(.*)()(.*)"
+ while {[regexp -nocase $reg_exp_var $content \
+ match lside var2 var3 rside]} {
+ if { [regsub -nocase "(.*?)" $rside {\1} result] } {
+ set changed_p 1
+ set content "${lside}${result}"
+ }
+ }
+ }
+ if { $changed_p } {
+ set new_page [list "contenido" $content]
+ $page set instance_attributes $new_page
+ $page save
+ }
+ }
+ foreach item $words {
+ set item_name [db_string get_name { *SQL* } -default ""]
+ $package_id delete -item_id $item -name $item_name
+ catch {
+ db_dml delete_word { *SQL* }
+ } error
+ }
+}
+ad_returnredirect "$return_url"
Index: openacs-4/packages/learning-content/www/delete-glossary-word.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/delete-glossary-word.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/delete-glossary-word.xql 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,28 @@
+
+
+
+ select distinct item_id as page_id
+ from xowiki_page_instancei
+ where item_id in (select item_id
+ from cr_items
+ where parent_id = :folder_id
+ and content_type = '::xowiki::PageInstance')
+
+
+
+
+
+ select name
+ from cr_items
+ where item_id = :item
+
+
+
+
+
+ delete from content_glossary_term_count
+ where folder_id = :folder_id
+ and term = :item_name
+
+
+
Index: openacs-4/packages/learning-content/www/diff.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/diff.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/diff.adp 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,29 @@
+
+ @title;noquote@
+ @context;noquote@
+
+
+
+
+
+
+
+ Comparing
+
+- version @revision_id1@ modified by @user1@ at @time1@ with
+
- version @revision_id2@ modified by @user2@ at @time2@
+
+
+
+
+@content;noquote@
+
Index: openacs-4/packages/learning-content/www/dynamic-tree-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/dynamic-tree-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/dynamic-tree-oracle.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+
+ select ci.item_id
+ from category_object_map c,
+ cr_items ci,
+ xowiki_page p
+ where c.object_id = ci.item_id
+ and ci.parent_id = :folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and category_id = :category_id
+ and p.page_id = ci.live_revision
+ order by to_number(page_order)
+
+
+
Index: openacs-4/packages/learning-content/www/dynamic-tree-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/dynamic-tree-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/dynamic-tree-postgresql.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+
+ select ci.item_id
+ from category_object_map c,
+ cr_items ci,
+ xowiki_page p
+ where c.object_id = ci.item_id
+ and ci.parent_id = :folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and category_id = :category_id
+ and p.page_id = ci.live_revision
+ order by page_order::integer
+
+
+
Index: openacs-4/packages/learning-content/www/dynamic-tree.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/dynamic-tree.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/dynamic-tree.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,4 @@
+no data
+
+ @categories.category_id@,@categories.category_name@,@categories.is_category@,@categories.object_url@;
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/dynamic-tree.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/dynamic-tree.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/dynamic-tree.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,34 @@
+ad_page_contract {
+ gets all the objects from a category_id and adds the content
+ to the dynamic YUI tree
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-01-06
+} {
+ {category_id ""}
+ {folder_id 0}
+}
+
+set user_id [ad_conn user_id]
+set package_id [ad_conn package_id]
+
+# Alvaro: query to find all the objects inside a category
+set category_objects [db_list get_items_id {*SQL*} ]
+set total [llength $category_objects]
+template::multirow create categories \
+ category_name category_id is_category object_url
+
+# Alvaro: adding each object to the parent category node
+foreach object $category_objects {
+ set package_url [apm_package_url_from_id $package_id]
+ set page [::xowiki::Package instantiate_page_from_id -item_id $object]
+ set page_name [$page set name]
+ $page volatile
+ set object_url "${package_url}${page_name}"
+ regsub -all { } $object_url "%20" object_url
+ if { $object != 0} {
+ set object_title [db_string get_name {*SQL*} -default ""]
+ template::multirow append categories $object "$object_title" \
+ false $object_url
+ }
+}
+
Index: openacs-4/packages/learning-content/www/dynamic-tree.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/dynamic-tree.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/dynamic-tree.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+
+ select title
+ from xowiki_page_instancei
+ where object_id = (
+ select live_revision
+ from cr_items
+ where item_id = $object)
+
+
+
Index: openacs-4/packages/learning-content/www/edit-glossary-word.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/edit-glossary-word.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/edit-glossary-word.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,5 @@
+
+ @page_title;noquote@
+ @context;noquote@
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/edit-glossary-word.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/edit-glossary-word.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/edit-glossary-word.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,65 @@
+ad_page_contract {
+ Edit a glossary word
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-20
+} {
+ {word_id 0}
+ {return_url ""}
+}
+
+if { $word_id == 0 } {
+ set page_title [_ learning-content.new_word]
+ set context [list \
+ [list "$return_url" [_ learning-content.glossary]] \
+ "[_ learning-content.new_word]"]
+ set disabled ""
+} else {
+ set page_title [_ learning-content.edit_word]
+ set context [list [list "$return_url" [_ learning-content.glossary]] \
+ "[_ learning-content.edit_word]"]
+ set disabled "disabled disabled"
+}
+
+set package_id [ad_conn package_id]
+set folder_id [content::folder::get_folder_from_package \
+ -package_id $package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+set revision_id [content::item::get_live_revision -item_id $word_id]
+set data [db_string get_data {} -default ""]
+if { [llength $data] > 0 } {
+ set word [lindex $data 3]
+ set description [lindex $data 1]
+} else {
+ set word ""
+ set description ""
+}
+
+
+ad_form -name glossary -export { {word_name $word} } \
+-form {
+ {word:text(text),optional {label "[_ learning-content.word]"}
+ {html {id "word" value "$word" size 44 $disabled}}}
+ {word_id:text(hidden),optional {html {id "word_id" value "$word_id"}}}
+ {description:text(textarea),optional
+ {label "[_ learning-content.definition]"} {value "$description"}
+ {html {id "description" rows 20 cols 50}}}
+ {return_url:text(hidden),optional
+ {html {id "return_url" value "$return_url"}}}
+} -validate {
+ {word
+ {![db_string check_if_exists {} -default 0]}
+ "[_ learning-content.word_already_exist]"
+ }
+ {word
+ { ![empty_string_p $word] || $word_id != 0}
+ "[_ learning-content.word_not_blank]"
+ }
+} -on_submit {
+ if { [empty_string_p $word] } {
+ set word $word_name
+ }
+ set exp_vars [export_vars -base "insert-glossary-entry" \
+ {return_url word_id word description}]
+ ad_returnredirect $exp_vars
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/edit-glossary-word.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/edit-glossary-word.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/edit-glossary-word.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,18 @@
+
+
+
+ select instance_attributes
+ from xowiki_form_pagei
+ where revision_id = :revision_id
+
+
+
+
+
+ select 1
+ from cr_items
+ where name = lower(:word)
+ and parent_id = :folder_id
+
+
+
Index: openacs-4/packages/learning-content/www/edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/edit.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/edit.adp 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,17 @@
+
+ @edit_form_page_title;noquote@
+ @context;noquote@
+ note.title
+
+
+
+
+
+
+
Index: openacs-4/packages/learning-content/www/error-template.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/error-template.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/error-template.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,24 @@
+
+ @title;noquote@
+ @context;noquote@
+ @header_stuff;noquote@
+
+
+ @header_stuff;noquote@
+
+
+
+
+
+
+
Error:
+
+
+@error_msg;noquote@
+
+
+
+
Index: openacs-4/packages/learning-content/www/get-activities.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-activities.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-activities.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,63 @@
+
Index: openacs-4/packages/learning-content/www/get-activities.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-activities.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-activities.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,75 @@
+ad_page_contract {
+ Get the existing applications for content activities
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-12
+ } {
+ {activity ""}
+ {parent_id 0}
+}
+
+set result ""
+set prev_forum_id 0
+set prev_grade_item_id 0
+set cont 0
+set community_id [dotlrn_community::get_community_id]
+set community_url [dotlrn_community::get_community_url $community_id]
+
+switch $activity {
+ "forums_message" {
+ set activity_type "forums"
+ set package_id [dotlrn_community::get_package_id_from_package_key \
+ -package_key $activity_type -community_id $community_id]
+ set package_url [apm_package_url_from_id $package_id]
+ set forums_url "${package_url}admin"
+ db_multirow -extend { changed_p count } \
+ forums get_forums_and_messages { *SQL* } {
+ if { $prev_forum_id == 0 } {
+ set changed_p 1
+ } elseif { $prev_forum_id != $forum_id } {
+ set changed_p 1
+ } else {
+ set changed_p 0
+ }
+ set prev_forum_id $forum_id
+ set count $cont
+ incr cont
+ }
+ db_multirow empty_forums get_forums_with_no_messages { *SQL } {}
+ }
+ "as_assessments" {
+ set activity_type "assessment"
+ set package_id [dotlrn_community::get_package_id_from_package_key \
+ -package_key $activity_type -community_id $community_id]
+ set folder_id [as::assessment::folder_id -package_id $package_id]
+ db_multirow -extend { as_title } assessments get_as_item { *SQL* } {
+ set as_title [db_string get_as_title {} -default ""]
+ }
+ }
+ "evaluation_tasks" {
+ set activity_type "evaluation"
+ set package_id [dotlrn_community::get_package_id_from_package_key \
+ -package_key $activity_type -community_id $community_id]
+ db_multirow -extend { changed_p count } evaluations \
+ get_grades_with_info { *SQL* } {
+
+ if { $prev_grade_item_id == 0 } {
+ set changed_p 1
+ } elseif { $prev_grade_item_id != $grade_item_id } {
+ set changed_p 1
+ } else {
+ set changed_p 0
+ }
+ set prev_grade_item_id $grade_item_id
+ set count $cont
+ incr cont
+ }
+ db_multirow empty_evaluations get_grades_without_info { *SQL* } {}
+ }
+ "chat_room" {
+ set activity_type "chat"
+ set package_id [dotlrn_community::get_package_id_from_package_key \
+ -package_key $activity_type -community_id $community_id]
+ db_multirow chat_room get_chat_rooms { *SQL* } {}
+ }
+}
+
Index: openacs-4/packages/learning-content/www/get-activities.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-activities.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-activities.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,107 @@
+
+
+
+ select title
+ from cr_revisions
+ where revision_id = :as_revision_id
+
+
+
+
+
+ select item_id,
+ latest_revision as as_revision_id
+ from cr_items
+ where parent_id = :folder_id
+ and content_type = :activity
+ and latest_revision is not null
+
+
+
+
+
+ select forum_id, name
+ from forums_forums ff
+ where package_id = :package_id
+ and enabled_p = 't'
+ and not exists ( select forum_id
+ from forums_messages fm
+ where fm.forum_id = ff.forum_id)
+ order by forum_id
+
+
+
+
+
+ select fm.message_id,
+ fm.subject,
+ ff.name,
+ ff.forum_id
+ from forums_messages fm,
+ (select forum_id, name
+ from forums_forums
+ where package_id = :package_id
+ and enabled_p = 't') ff
+ where fm.forum_id = ff.forum_id
+ and fm.parent_id is null
+ order by forum_id
+
+
+
+
+
+ select et.task_name,
+ et.task_id,
+ et.task_item_id,
+ eg.grade_plural_name,
+ eg.grade_id,
+ eg.grade_item_id
+ from cr_revisions cr,
+ evaluation_tasksi et,
+ cr_items cri,
+ cr_mime_types crmt,
+ (select eg.grade_plural_name,
+ eg.grade_id,
+ eg.grade_item_id
+ from evaluation_grades eg,
+ acs_objects ao,
+ cr_items cri
+ where cri.live_revision = eg.grade_id
+ and eg.grade_item_id = ao.object_id
+ and ao.context_id = :package_id
+ order by grade_plural_name desc) eg
+ where cr.revision_id = et.revision_id
+ and et.grade_item_id = eg.grade_item_id
+ and cri.live_revision = et.task_id
+ and et.mime_type = crmt.mime_type
+
+
+
+
+
+ select grade_plural_name as grade_name,
+ grade_id
+ from evaluation_grades eg,
+ acs_objects ao,
+ cr_items cri
+ where cri.live_revision = eg.grade_id
+ and eg.grade_item_id = ao.object_id
+ and ao.context_id = :package_id
+ and not exists (select grade_item_id
+ from evaluation_tasksi et
+ where eg.grade_item_id = et.grade_item_id)
+ order by grade_plural_name desc
+
+
+
+
+
+ select object_id as room_id,
+ (select pretty_name
+ from chat_rooms
+ where room_id = ao.object_id) as name
+ from acs_objects ao
+ where context_id = :package_id
+
+
+
Index: openacs-4/packages/learning-content/www/get-glossary-word-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-glossary-word-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-glossary-word-oracle.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,27 @@
+
+
+
+ select name,
+ item_id
+ from cr_items
+ where (instr(name,lower(:word)) > 0
+ or instr(lower(:word),name) > 0)
+ and parent_id = :folder_id
+ and content_type = '::xowiki::FormPage'
+ order by name
+
+
+
+
+
+ select name,
+ item_id
+ from cr_items
+ where (instr(name,lower(:word)) = 0
+ and instr(lower(:word),name) = 0)
+ and parent_id = :folder_id
+ and content_type = '::xowiki::FormPage'
+ order by name
+
+
+
Index: openacs-4/packages/learning-content/www/get-glossary-word-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-glossary-word-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-glossary-word-postgresql.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,25 @@
+
+
+
+ select name,
+ item_id
+ from cr_items
+ where name like '%'||:word||'%'
+ and parent_id = :folder_id
+ and content_type = '::xowiki::FormPage'
+ order by name
+
+
+
+
+
+ select name,
+ item_id
+ from cr_items
+ where name not like '%'||:word||'%'
+ and parent_id = :folder_id
+ and content_type = '::xowiki::FormPage'
+ order by name
+
+
+
Index: openacs-4/packages/learning-content/www/get-glossary-word.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-glossary-word.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-glossary-word.adp 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,25 @@
+@content;noquote@
+
+
+
+ #learning-content.similar_words#
+
+
+ #learning-content.other_words#
+
+
+
Index: openacs-4/packages/learning-content/www/get-glossary-word.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-glossary-word.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-glossary-word.tcl 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,54 @@
+ad_page_contract {
+ Get a glossary word by name or id
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-25
+} {
+ {word_id 0}
+ {rels_p 0}
+ {word ""}
+ {def_p 0}
+ {selected_id 0}
+ {exists_p 0}
+}
+
+set content " "
+set new_content " "
+set new_p 0
+set scolor "#AE9C9C"
+set new_style "background: $scolor ;"
+set package_id [ad_conn package_id]
+set package_url [apm_package_url_from_id $package_id]
+set folder_id [content::folder::get_folder_from_package -package_id $package_id]
+if { $exists_p == 1 } {
+ set exists_p [db_string check_if_exists {} -default 0]
+ set content $exists_p
+} elseif { $rels_p } {
+ set word [string tolower [string trim $word]]
+ db_multirow -extend { style } related_words get_rel_words { *SQL* } {
+ if { $selected_id != "" && [string tolower $word] == $name } {
+ set revision_id [content::item::get_live_revision \
+ -item_id $item_id]
+ set atts [db_string get_attributes {} -default ""]
+ set desc [lindex $atts 1]
+ set style "background: $scolor ;"
+ set new_style ""
+ } else {
+ set style ""
+ }
+ }
+ db_multirow other_words get_other_words { *SQL* } { }
+} else {
+ if { $word_id == 0 } {
+ set item_id [db_string get_item_id {} -default 0]
+ } else {
+ set item_id $word_id
+ }
+ set revision_id [content::item::get_live_revision -item_id $item_id]
+ set atts [db_string get_attributes {} -default ""]
+ if { $def_p } {
+ set content [lindex $atts 3]
+ } else {
+ set content [lindex $atts 1]
+ }
+}
+
Index: openacs-4/packages/learning-content/www/get-glossary-word.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-glossary-word.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-glossary-word.xql 5 Mar 2009 21:28:58 -0000 1.1
@@ -0,0 +1,39 @@
+
+
+
+ select item_id
+ from cr_items
+ where name = lower(:word)
+ and parent_id = :folder_id
+
+
+
+
+
+ select item_id
+ from cr_items
+ where name = lower(:word)
+ and parent_id = :folder_id
+
+
+
+
+
+ select instance_attributes
+ from xowiki_form_pagei
+ where item_id = :item_id
+ and revision_id = :revision_id
+
+
+
+
+
+ select name,
+ item_id
+ from cr_items
+ where parent_id = :folder_id
+ and content_type = '::xowiki::FormPage'
+ order by name
+
+
+
Index: openacs-4/packages/learning-content/www/get-tooltip.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-tooltip.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-tooltip.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,2 @@
+@word;noquote@:
+
@desc;noquote@
Index: openacs-4/packages/learning-content/www/get-tooltip.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-tooltip.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-tooltip.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,15 @@
+ad_page_contract {
+ Get a glossary word for the tooltip
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-28
+} {
+ {word ""}
+}
+
+set package_id [ad_conn package_id]
+set folder_id [content::folder::get_folder_from_package -package_id $package_id]
+set item_id [db_string get_item_id {} -default 0]
+set revision_id [content::item::get_live_revision -item_id $item_id]
+set atts [db_string get_attributes {} -default ""]
+set word [lindex $atts 3]
+set desc [lindex $atts 1]
Index: openacs-4/packages/learning-content/www/get-tooltip.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/get-tooltip.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/get-tooltip.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,19 @@
+
+
+
+ select item_id
+ from cr_items
+ where name = lower(:word)
+ and parent_id = :folder_id
+
+
+
+
+
+ select instance_attributes
+ from xowiki_form_pagei
+ where item_id = :item_id
+ and revision_id = :revision_id
+
+
+
Index: openacs-4/packages/learning-content/www/glossary-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/glossary-view.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/glossary-view.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/glossary-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/glossary-view.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/glossary-view.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,108 @@
+ad_page_contract {
+ Display all words from the glossary in alphabetical order
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-29
+} {
+ {letter ""}
+} -properties {
+ context:onevalue
+ page_title:onevalue
+}
+
+set page_title [_ learning-content.glossary]
+set context [list $page_title]
+set package_id [ad_conn package_id]
+set admin_p [permission::permission_p -object_id $package_id \
+ -privilege admin -party_id [ad_conn user_id]]
+set folder_id [content::folder::get_folder_from_package \
+ -package_id $package_id]
+set return_url [ad_return_url]
+set category_id [ns_queryget "category_id"]
+set glossary_url "[ad_conn url]?category_id=$category_id"
+set content ""
+
+if {[string equal $letter ""]} {
+ set filter "| [_ learning-content.All] |"
+} else {
+ set letter [string tolower $letter]
+ set filter "| [_ learning-content.All] |"
+}
+set initials [db_list get_initials {}]
+foreach initial $initials {
+ if {[string equal $initial $letter]} {
+ append filter " [string toupper $initial] |"
+ } else {
+ append filter " "
+ append filter "[string toupper $initial] |"
+ }
+}
+append letter "%"
+set form_page_ids [db_list get_form_page_ids {}]
+
+set elements [list]
+if { $admin_p } {
+ lappend elements edit {
+ label "[_ learning-content.edit]"
+ html {style "width: 15px; text-align: center;"}
+ link_url_col edit_url
+ link_html { title "[_ learning-content.edit]" }
+ display_template ""
+ }
+}
+
+lappend elements word {
+ label "[_ learning-content.word] / [_ learning-content.definition]"
+ display_template "@get_words.name@
\
+ @get_words.definition@
"
+}
+
+if { $admin_p } {
+ lappend elements count {
+ label "[_ learning-content.appearances]"
+ html {style "width: 25px; text-align: center;"}
+ display_template "@get_words.count@"
+ }
+ lappend elements delete {
+ label "[_ learning-content.delete]"
+ html {style "width: 15px; text-align: center;"
+ onclick "return(confirm('Are you sure?'));"}
+ link_url_col delete_url
+ link_html { title "[_ learning-content.delete]" }
+ display_template ""
+ }
+}
+
+db_multirow -extend { definition edit_url delete_url count } \
+ get_words get_words_info {} {
+
+ set atts [db_list get_form_pages {}]
+ set definition [lindex [lindex $atts 0] 1]
+ set edit_url [export_vars -base "edit-glossary-word" {{word_id $item_id} \
+ return_url}]
+ set delete_url [export_vars -base "delete-glossary-word" \
+ {item_id return_url}]
+ set times_used [db_string get_term_count {} -default 0]
+ if { [empty_string_p $times_used] } {
+ set count 0
+ } else {
+ set count $times_used
+ }
+}
+
+set bulk_action_vars [list]
+set bulk_actions [list]
+if { $admin_p } {
+ lappend bulk_action_vars return_url
+ lappend bulk_actions "[_ learning-content.delete]" "delete-glossary-word"\
+ "[_ learning-content.delete]"
+}
+
+list::create -name glossary_words \
+ -multirow get_words \
+ -key item_id \
+ -no_data "[_ learning-content.there_are_no_words]"\
+ -bulk_action_export_vars $bulk_action_vars \
+ -bulk_actions $bulk_actions \
+ -html { style "width: 100%;" } \
+ -elements $elements \
+ -main_class { mylist }
Index: openacs-4/packages/learning-content/www/glossary-view.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/glossary-view.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/glossary-view.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,59 @@
+
+
+
+ select item_id
+ from cr_items
+ where parent_id = :folder_id
+ and content_type = '::xowiki::FormPage'
+ and name like :letter
+ order by name
+
+
+
+
+
+ select name
+ from cr_items
+ where item_id = :item_id
+
+
+
+
+
+ select distinct substr(name,1,1)
+ from cr_items
+ where parent_id = :folder_id
+ and content_type = '::xowiki::FormPage'
+ order by substr(name,1,1)
+
+
+
+
+
+ select instance_attributes
+ from xowiki_form_pagei
+ where item_id = :item_id
+
+
+
+
+
+ select item_id,
+ name
+ from cr_items
+ where parent_id = :folder_id
+ and content_type = '::xowiki::FormPage'
+ and name like :letter
+ order by name
+
+
+
+
+
+ select sum(times_used) as count
+ from content_glossary_term_count
+ where folder_id = :folder_id
+ and term = :name
+
+
+
Index: openacs-4/packages/learning-content/www/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/index.vuh,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/index.vuh 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,18 @@
+::learning_content::Package initialize -ad_doc {
+
+ This is the resolver for this package. It turns a request into
+ an object and executes the object with the computed method
+
+ @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at)
+ @creation-date July, 2006
+ @cvs-id $Id: index.vuh,v 1.1 2009/03/05 21:28:59 rocaelh Exp $
+
+} -parameter {
+ {-m view}
+ {-folder_id:integer 0}
+}
+
+::$package_id log "--starting... [ns_conn url] [ns_conn query]"
+::$package_id reply_to_user [::$package_id invoke -method $m]
+::$package_id log "--i ::$package_id DONE"
+ad_script_abort
Index: openacs-4/packages/learning-content/www/insert-glossary-entry.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/insert-glossary-entry.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/insert-glossary-entry.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1 @@
+@result;noquote@
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/insert-glossary-entry.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/insert-glossary-entry.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/insert-glossary-entry.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,54 @@
+ad_page_contract {
+ Insert Word into Content Glossary
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-19
+} {
+ {word ""}
+ {description ""}
+ {word_id 0}
+ {return_url ""}
+}
+
+set package_id [ad_conn package_id]
+set folder_id [content::folder::get_folder_from_package \
+ -package_id $package_id]
+
+permission::require_permission -object_id $package_id -privilege admin
+
+::xowiki::Package initialize -package_id $package_id
+if { $word_id == 0 } {
+ set page_template [content::item::get_id_by_name \
+ -name "en:glossary" -parent_id $folder_id]
+ set f [::xowiki::FormPage new -destroy_on_cleanup \
+ -package_id $package_id \
+ -parent_id $folder_id \
+ -publish_status "production" \
+ -page_template $page_template]
+ set word [string tolower [string trim $word]]
+ set description [string trim $description]
+ set atts [list "description" $description "word" $word]
+ $f set name $word
+ $f set instance_attributes $atts
+ set word_id [$f save_new]
+ set result $word
+} else {
+ set word [string trim $word]
+ if { $word_id != 0 } {
+ set item_id $word_id
+ } else {
+ set item_id [db_string get_item_id {} -default 0]
+ }
+ set page [xowiki::Package instantiate_page_from_id \
+ -item_id $item_id]
+ set word [string tolower [string trim $word]]
+ set description [string trim $description]
+ set atts [list "description" $description "word" $word]
+ $page set instance_attributes $atts
+ $page set name $word
+ $page save
+ ns_cache flush xotcl_object_cache ::$item_id
+ set result $word
+}
+if { ![empty_string_p $return_url] } {
+ ad_returnredirect $return_url
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/insert-glossary-entry.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/insert-glossary-entry.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/insert-glossary-entry.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+
+ select item_id
+ from cr_items
+ where name = :word
+ and parent_id = :folder_id
+
+
+
Index: openacs-4/packages/learning-content/www/page-instance-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/page-instance-new.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/page-instance-new.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,24 @@
+ad_page_contract {
+ Automatically create a page instance with a standard name
+ and the default page template
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-01-10
+} {
+ {activity_id 0}
+ {activity_name ""}
+ {redirect_url ""}
+ {optional_text ""}
+ {category_id 0}
+ {page_item_id 0}
+}
+
+set package_id [ad_conn package_id]
+set package_url [apm_package_url_from_id $package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+set data [learning_content::create_page]
+set item_id [lindex $data 0]
+set page_name [lindex $data 1]
+set link "${package_url}$page_name"
+
+ad_returnredirect [export_vars -base $link {{m edit}}]
Index: openacs-4/packages/learning-content/www/page-instance-new.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/page-instance-new.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/page-instance-new.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,52 @@
+
+
+
+ update content_activities
+ set activity_id = :activity_id
+ where item_id = :page_item_id
+
+
+
+
+
+ insert into content_activities
+ (item_id,activity_id)
+ values
+ (:item_id,:activity_id)
+
+
+
+
+
+ select count(p.page_id)
+ from cr_items ci,
+ xowiki_page p
+ where ci.parent_id = :folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and p.page_id = ci.live_revision
+
+
+
+
+
+ select p.page_order
+ from cr_items ci,
+ cr_revisions r,
+ xowiki_page p
+ where ci.parent_id = :folder_id
+ and ci.content_type not in ('::xowiki::PageTemplate')
+ and r.revision_id = ci.live_revision
+ and p.page_id = r.revision_id
+ and p.page_order is not null
+ order by p.page_order desc
+
+
+
+
+
+ select 1 from cr_items
+ where name = :page_name
+ and parent_id = :folder_id
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/plain-include.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/plain-include.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/plain-include.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/portlet-ajax.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/portlet-ajax.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/portlet-ajax.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,9 @@
+# like portlet, except with background loading via ajax
+# gustaf neumann, fecit may 2006
+::xowiki::Page requireJS "/resources/xowiki/get-http-object.js"
+if {![string match "/*" $portlet]} {
+ set folder_id [$__including_page set parent_id]
+ set package_id [$folder_id set package_id]
+ set portlet [site_node::get_url_from_object_id \
+ -object_id $package_id]portlets/$portlet
+}
Index: openacs-4/packages/learning-content/www/portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/portlet.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/portlet.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,3 @@
+if {![string match "/*" $portlet]} {
+ set portlet /packages/xowiki/www/portlets/$portlet
+}
Index: openacs-4/packages/learning-content/www/revisions.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/revisions.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/revisions.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,15 @@
+
+@title;noquote@
+@title;noquote@
+@context;noquote@
+@page_id;noquote@
+
+@content;noquote@
+
+
+ #file-storage.lt_Comments_on_this_file#
+
+
+
+ @gc_link;noquote@
+
Index: openacs-4/packages/learning-content/www/show-activity.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/show-activity.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/show-activity.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,12 @@
+
+ @msg;noquote@
+
+
+
+
+ #learning-content.activity_not_available#
+
+ #learning-content.go_to_activity#
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/show-activity.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/show-activity.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/show-activity.tcl 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,44 @@
+ad_page_contract {
+ Show activity link based on the object_id
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-04-24
+ } {
+ {-object_id 0}
+}
+
+if { $object_id > 0 } {
+ set activity_id [db_string get_object_id {} -default -1]
+ set object_id $activity_id
+}
+
+set exists_p 1
+if {![db_0or1row object_data { *SQL* }]} {
+ set exists_p 0
+}
+
+if { $exists_p } {
+ if {[string eq $object_type content_item]} {
+ db_0or1row item_data { *SQL* }
+ set object_id $item_id
+ }
+ set activity_p 1
+ switch $object_type {
+ as_assessments {
+ set activity_p [db_string get_assessment_status {} -default 0]
+ set msg [_ learning-content.assessment_not_available_yet]
+ }
+ forums_message {
+ set forum_id [db_string get_forum_id {} \
+ -default 0]
+ if { [string eq [db_string get_forum_status {} -default "t"] "f"] } {
+ set activity_p 0
+ set msg [_ learning-content.forum_not_available]
+ }
+ }
+ evaluation_tasks {
+ }
+ }
+} else {
+ set activity_p 0
+ set msg [_ learning-content.no_activity]
+}
Index: openacs-4/packages/learning-content/www/show-activity.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/show-activity.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/show-activity.xql 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,65 @@
+
+
+
+
+
+ select activity_id
+ from content_activities
+ where item_id = (
+ select item_id
+ from cr_items
+ where live_revision = :object_id)
+
+
+
+
+
+ select o.object_type,
+ o.title,
+ o.package_id
+ from acs_objects o
+ where o.object_id = :object_id
+
+
+
+
+
+ select o.object_type,
+ o.object_id,
+ o.package_id,
+ i.item_id
+ from acs_objects o,
+ cr_items i
+ where i.item_id = :object_id
+ and o.object_id = coalesce (
+ i.live_revision,
+ i.latest_revision,
+ i.item_id)
+
+
+
+
+
+ select 1
+ from cr_items
+ where item_id = :object_id
+ and publish_status is not null
+
+
+
+
+
+ select forum_id
+ from forums_messages
+ where message_id = :object_id
+
+
+
+
+
+ select enabled_p
+ from forums_forums
+ where forum_id = :forum_id
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/view-default.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/view-default.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/view-default.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,67 @@
+
+
+ @title;noquote@
+ @context;noquote@
+ @header_stuff;noquote@
+
+
+
+ @header_stuff;noquote@
+
+
+
+
+
+
+
+@top_portlets;noquote@
+@content;noquote@
+@footer;noquote@
+
Index: openacs-4/packages/learning-content/www/view-links-ges.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/view-links-ges.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/view-links-ges.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,19 @@
+
Index: openacs-4/packages/learning-content/www/view-links.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/view-links.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/view-links.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+
+
+@top_portlets;noquote@
+@content;noquote@
+
+
Index: openacs-4/packages/learning-content/www/view-nolinks.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/view-nolinks.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/view-nolinks.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,4 @@
+
+
+@content;noquote@
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/view-plain.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/view-plain.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/view-plain.adp 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,3 @@
+
+@content;noquote@
+#learning-content.go_back#
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/admin/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/admin/index.vuh,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/admin/index.vuh 5 Mar 2009 21:28:59 -0000 1.1
@@ -0,0 +1,9 @@
+if {[acs_user::site_wide_admin_p]} {
+ ::learning_content::Package initialize
+ set l [expr {[lsearch -exact [ns_conn urlv] admin] + 1 }]
+ set path [join [lrange [ns_conn urlv] $l end] /]
+ rp_internal_redirect /packages/xowiki/www/admin/$path
+} else {
+ set package_url [ad_conn package_url]
+ ad_returnredirect "${package_url}content-admin"
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/category-add-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-add-edit.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-add-edit.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1 @@
+@new_cat@
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/category-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-add-edit.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-add-edit.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,53 @@
+ad_page_contract {
+ @author byron Haroldo Linares Roman (bhlr@byronLs-Computer.local)
+ @creation-date 2007-08-24
+} {
+ tree_id:integer
+ name:notnull
+ category_id:integer,optional
+ return_url:optional
+ {parent_id 0}
+ {language "en_US"}
+ {mode 1}
+}
+
+set user_id [ad_conn user_id]
+set package_id [ad_conn package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+if { ![string equal [string trim [string tolower $name]] "glosario"] } {
+ set new_cat "1"
+ set description "User category for content package"
+ if {$mode eq 1 && [exists_and_not_null category_id]} {
+ ## edit mode####
+ category::update -category_id $category_id \
+ -locale $language \
+ -name $name \
+ -description $description
+ } elseif {$mode eq 2} {
+ if {[learning_content::category::valid_level_and_count -tree_id $tree_id \
+ -category_id $parent_id]} {
+ set new_cat [category::add -tree_id $tree_id \
+ -parent_id $parent_id \
+ -locale $language \
+ -name $name \
+ -description $description]
+ set parent_cat [learning_content::category::category_parent \
+ -category_id $new_cat -tree_id $tree_id]
+ }
+ } elseif {$mode eq 3} {
+ set new_cat [learning_content::category::new_subtree -tree_id $tree_id]
+ set parent_cat $new_cat
+ }
+ if {[exists_and_not_null return_url]} {
+ if {[exists_and_not_null new_cat]} {
+ set temp "$return_url&new_cat=$new_cat"
+ append temp "ad_returnredirect &parent_cat=$parent_cat"
+ ad_return_redirect $temp
+ } else {
+ ad_returnredirect $return_url
+ }
+ }
+} else {
+ set new_cat "0"
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/category-confirm.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-confirm.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-confirm.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,10 @@
+
+ Confirmacion
+
+
+
+
+@body_msg;noquote@
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/category-confirm.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-confirm.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-confirm.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,29 @@
+ad_page_contract {
+ @author byron Haroldo Linares Roman (bhlr@byronLs-Computer.local)
+ @creation-date 2007-09-13
+} {
+ tree_id:integer
+ category_id:integer,notnull
+ {locale ""}
+ object_id:integer,optional
+ return_url:optional
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+set body_msg "[_ learning-content.can_delete]"
+set package_id [ad_conn package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+set tree_list [learning_content::category::get_tree_levels \
+ -subtree_id $category_id $tree_id]
+set tree_list [linsert $tree_list 0 $category_id]
+foreach category $tree_list {
+ set my_category_id [lindex $category 0]
+ if {[db_string \
+ dbqd.xowiki.www.admin.category-delete.check_mapped_objects {}] \
+ eq 1} {
+ set body_msg "[_ learning-content.mapped_objects]"
+ ad_return_template
+ }
+}
+
Index: openacs-4/packages/learning-content/www/content-admin/category-delete-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-delete-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-delete-2.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,25 @@
+ad_page_contract {
+ @author byron Haroldo Linares Roman (bhlr@byronLs-Computer.local)
+ @creation-date 2007-08-27
+} {
+ tree_id:integer
+ category_id:integer,notnull
+ {locale ""}
+ object_id:integer,optional
+ return_url:optional
+}
+
+set user_id [ad_conn user_id]
+set package_id [ad_conn package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+db_transaction {
+ category::delete $category_id
+ category_tree::flush_cache $tree_id
+} on_error {
+ ad_return_complaint 1 "[_ learning-content.still_contains_subcategories]"
+ ad_script_abort
+}
+
+ad_returnredirect $return_url
+
Index: openacs-4/packages/learning-content/www/content-admin/category-delete-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-delete-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-delete-oracle.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+oracle8.1.6
+
+
+ select case
+ when count(*) = 0 then 0 else 1 end
+ from category_object_map
+ where category_id = :my_category_id
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/category-delete-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-delete-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-delete-postgresql.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+
+
+
+ postgresql 7.2
+
+
+
+ select case when count(*) = 0 then 0 else 1 end
+ where exists (select 1 from category_object_map
+ where category_id = :my_category_id)
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/category-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-delete.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-delete.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1 @@
+no data
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/category-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-delete.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-delete.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,32 @@
+ad_page_contract {
+ @author byron Haroldo Linares Roman (bhlr@byronLs-Computer.local)
+ @creation-date 2007-08-27
+} {
+ tree_id:integer
+ category_id:integer,notnull
+ {locale ""}
+ object_id:integer,optional
+ return_url:optional
+}
+
+set user_id [ad_conn user_id]
+set package_id [ad_conn package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+set tree_list [learning_content::category::get_tree_levels -subtree_id $category_id \
+ -tree_id $tree_id]
+set tree_list [linsert $tree_list 0 $category_id]
+foreach category $tree_list {
+ set my_category_id [lindex $category 0]
+ if {[db_string check_mapped_objects {*SQL*}] eq 1} {
+ ad_return_complaint 1 "[_ learning-content.mapped_objects]"
+ ad_script_abort
+ }
+ lappend category_ids $my_category_id
+}
+
+set result [learning_content::category::delete -tree_id $tree_id \
+ -category_ids $category_ids]
+if {$result eq 0} {
+ ad_return_complaint 1 "[_ learning-content.still_contains_subcategories]"
+}
Index: openacs-4/packages/learning-content/www/content-admin/category-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-view.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-view.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,43 @@
+
+ @title@
+ @context;noquote@
+
+
+#learning-content.go_back#
+
+
+
+
+
+
+
+
+
+
+#learning-content.unit_description#
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/category-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-view.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-view.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,76 @@
+ad_page_contract {
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-08-24
+
+}
+
+set package_id [ad_conn package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+set ah_sources [ah::requires -sources "scriptaculous"]
+set msg2_fade [ah::effects -element "msg_div2" \
+ -effect "Fade" \
+ -options "duration: 1.5"]
+
+set msg2_appear [ah::effects -element "msg_div2" \
+ -effect "Appear" \
+ -options "duration: 0.5"]
+
+##### Alvaro: Generating dynamic YUI tree for content index editor #####
+
+set tree_list [category_tree::get_mapped_trees $package_id]
+set tree_id [lindex [lindex $tree_list 0] 0]
+set tree_name [lindex [lindex $tree_list 0] 1]
+set categories [learning_content::get_categories -tree_id $tree_id]
+set dynamic_tree_url "[ad_conn package_url]/dynamic-tree"
+
+template::multirow create category_tree category_id category_name parent_id level
+
+set title [_ learning-content.edit_content_index]
+set context [list [list ./ [_ learning-content.admin]] $title]
+
+# Alvaro: Adding 1st level categories
+foreach category_id $categories {
+
+ set category_name [learning_content::get_category_name -category_id $category_id ]
+ template::multirow append category_tree $category_id $category_name $package_id 1
+ set subcategories [db_list get_childrens {*SQL*}]
+
+# Alvaro: Adding 2nd level subcategories
+ foreach subcategory_id $subcategories {
+ if {$subcategory_id != 0 } {
+ set subcategory_name [learning_content::get_category_name \
+ -category_id $subcategory_id ]
+ template::multirow append category_tree $subcategory_id $subcategory_name $category_id 2
+ set in_subcategories [db_list get_subchildrens {*SQL*}]
+# Alvaro: Adding 3rd level subcategories
+ foreach in_subcategory_id $in_subcategories {
+ if { $in_subcategory_id != 0 } {
+ set in_subcategory_name [learning_content::get_category_name \
+ -category_id $in_subcategory_id]
+ template::multirow append category_tree $in_subcategory_id $in_subcategory_name $subcategory_id 3
+ }
+ }
+ }
+ }
+}
+
+template::head::add_javascript \
+ -src "/resources/ajaxhelper/yui/yahoo/yahoo-min.js" \
+ -order 1
+template::head::add_javascript \
+ -src "/resources/ajaxhelper/yui/event/event-min.js" \
+ -order 2
+template::head::add_javascript \
+ -src "/resources/ajaxhelper/yui/connection/connection-min.js" \
+ -order 3
+template::head::add_javascript \
+ -src "/resources/ajaxhelper/yui/treeview/treeview-min.js" \
+ -order 4
+template::head::add_javascript \
+ -src "/resources/learning-content/dynamic-tree.js"
+template::head::add_css \
+ -href "/resources/ajaxhelper/yui/treeview/assets/folders/tree.css"
+template::head::add_css \
+ -href "/resources/learning-content/style-blue.css"
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/category-view.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/category-view.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/category-view.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ select category_id
+ from categories
+ where parent_id = :category_id
+ order by category_id
+
+
+
+
+
+ select category_id
+ from categories
+ where parent_id = :subcategory_id
+ order by category_id
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/copy_content.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/copy_content.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/copy_content.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1 @@
+@result;noquote@
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/copy_content.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/copy_content.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/copy_content.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,13 @@
+ad_page_contract {
+ Copy Content Information
+} {
+ {src_community_id}
+ {dst_community_id}
+}
+
+set package_id [ad_conn package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+set result [learning_content::copy \
+ -src_community_id $src_community_id \
+ -dst_community_id $dst_community_id]
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/edit-header.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/edit-header.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/edit-header.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,6 @@
+
+ @page_title;noquote@
+ @context;noquote@
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/edit-header.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/edit-header.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/edit-header.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,40 @@
+ad_page_contract {
+ Edit the header for the course
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2009-01-07
+} {
+ {return_url "./"}
+}
+
+set page_title [_ learning-content.edit_header]
+set context [list $page_title]
+
+set package_id [ad_conn package_id]
+set folder_id [content::folder::get_folder_from_package \
+ -package_id $package_id]
+
+set page_id [content::item::get_id_by_name \
+ -name "en:header_page" -parent_id $folder_id]
+if {![empty_string_p $page_id]} {
+ set page [xowiki::Package instantiate_page_from_id \
+ -item_id $page_id]
+} else {
+ ::xowiki::Package initialize -package_id $package_id
+ set page [$package_id import_prototype_page "header_page"]
+}
+set header [lindex [$page set instance_attributes] 1]
+
+ad_form -name header -export {page_id} \
+ -form {
+ {header:text(text)
+ {label "[_ learning-content.header]"}
+ {value $header}
+ }
+ } -on_submit {
+ set page [xowiki::Package instantiate_page_from_id \
+ -item_id $page_id]
+ set atts [list "titulo" $header]
+ $page set instance_attributes $atts
+ $page save
+ ad_returnredirect $return_url
+ }
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/header-toggle.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/header-toggle.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/header-toggle.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,10 @@
+ad_page_contract {
+} {
+ {package_id}
+ {return_url ""}
+ {value:integer}
+}
+
+parameter::set_value -package_id $package_id -parameter show_header \
+ -value $value
+ad_returnredirect $return_url
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/index-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/index-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/index-oracle.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+ oracle8.1.6
+
+
+
+ select dotlrn_communities_all.pretty_name as community_name,
+ dotlrn_communities_all.package_id as community_package_id,
+ dotlrn_communities_all.community_id as dst_community_id,
+ dotlrn_community.url(dotlrn_communities_all.community_id) as community_url
+ from dotlrn_communities_all,
+ dotlrn_member_rels_approved
+ where dotlrn_communities_all.community_id = dotlrn_member_rels_approved.community_id
+ and dotlrn_member_rels_approved.user_id = :user_id
+ and decode(dotlrn_community_admin_p(dotlrn_communities_all.community_id, dotlrn_member_rels_approved.user_id),'f',0,1) = 1
+ order by community_name
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/index-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/index-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/index-postgresql.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ select dotlrn_communities_all.pretty_name as community_name,
+ dotlrn_communities_all.package_id as community_package_id,
+ dotlrn_communities_all.community_id as dst_community_id,
+ dotlrn_community__url(dotlrn_communities_all.community_id)
+ as community_url
+ from dotlrn_communities_all,
+ dotlrn_member_rels_approved
+ where dotlrn_communities_all.community_id =
+ dotlrn_member_rels_approved.community_id
+ and dotlrn_member_rels_approved.user_id = :user_id
+ $community_type_clause
+ order by community_name
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/index.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/index.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,69 @@
+
+ @page_title;noquote@
+ @context;noquote@
+
+
+
+
+#learning-content.go_back#
+#learning-content.content_admin#
+
+
+
+
#learning-content.copy_content_to#
+
+
+
+
+
+
+No community specified
+
Index: openacs-4/packages/learning-content/www/content-admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/index.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/index.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,33 @@
+
+ad_page_contract {
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-03-01
+}
+
+set page_title [_ learning-content.admin]
+set context [list $page_title]
+set package_id [ad_conn package_id]
+permission::require_permission -object_id $package_id -privilege admin
+
+set src_community_id [dotlrn_community::get_community_id]
+set actual_package_id $package_id
+set return_url [ad_conn url]
+set show_header [parameter::get -package_id $package_id \
+ -parameter show_header \
+ -default -1]
+set copy_msg [_ learning-content.view_content]
+set error_msg [_ learning-content.copy_error_message]
+set success_msg [_ learning-content.copy_success_message]
+set content_url [apm_package_url_from_id $package_id]
+set user_id [ad_conn user_id]
+set copy_link [_ learning-content.copy]
+
+set community_type_clause \
+ "and dotlrn_communities_all.community_type in \
+('dotlrn_club', 'dotlrn_pers_community')"
+db_multirow communities get_communities { *SQL* } {}
+
+set community_type_clause \
+ "and dotlrn_communities_all.community_type not in \
+('dotlrn_community', 'dotlrn_club', 'dotlrn_pers_community')"
+db_multirow classes get_communities { *SQL* } {}
Index: openacs-4/packages/learning-content/www/content-admin/order.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/order.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/order.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,7 @@
+
+
+
+ #learning-content.order#
+
+
+
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/content-admin/order.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/order.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/order.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,33 @@
+ad_page_contract {
+ @author byron Haroldo Linares Roman
+ @creation-date 2007-07-04
+} {
+ page_id:optional
+ page_pos:optional
+ page_name:optional
+ content_id:optional
+ status:optional
+ dir:optional
+ show:optional
+ {action 0}
+}
+
+if {![string match $page_pos "@page_order@"]} {
+ set wiki_folder_id [::xowiki::Page require_folder -name xowiki \
+ -package_id $content_id]
+ set item_id [content::revision::item_id -revision_id $page_id]
+ if {![ permission::permission_p -object_id $item_id -privilege admin]} {
+ set show 0
+ } else {
+ set my_cat_id [category::get_mapped_categories $item_id]
+ set count_page [db_string select_count { *SQL* } -default 0]
+ if {$count_page > 1} {
+ set show 1
+ } else {
+ set show 0
+ }
+ }
+} else {
+ set show 0
+}
+
Index: openacs-4/packages/learning-content/www/content-admin/order.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/order.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/order.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ select count(ci.item_id)
+ from category_object_map c,
+ cr_items ci,
+ xowiki_page p
+ where c.object_id = ci.item_id
+ and ci.parent_id = :wiki_folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and p.page_id = ci.live_revision
+ and category_id = :my_cat_id
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/toggle-page-order-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/toggle-page-order-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/toggle-page-order-oracle.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+ oracle8.1.6
+
+
+
+ select ci.item_id as tmp_item_id,
+ ci.live_revision as revision_id,
+ ci.name,
+ p.page_order,
+ ci.publish_status
+ from cr_items ci,
+ xowiki_page p
+ where ci.parent_id = :wiki_folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and p.page_id = ci.live_revision
+ order by to_number(p.page_order)
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/toggle-page-order-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/toggle-page-order-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/toggle-page-order-postgresql.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ select ci.item_id as tmp_item_id,
+ ci.live_revision as revision_id,
+ ci.name,
+ p.page_order,
+ ci.publish_status
+ from category_object_map c,
+ cr_items ci,
+ xowiki_page p
+ where c.object_id = ci.item_id
+ and ci.parent_id = :wiki_folder_id
+ and ci.content_type = '::xowiki::PageInstance'
+ and p.page_id = ci.live_revision
+ and category_id = :cat_id
+ order by p.page_order::integer
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/toggle-page-order.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/toggle-page-order.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/toggle-page-order.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,5 @@
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/toggle-page-order.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/toggle-page-order.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/toggle-page-order.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,92 @@
+ad_page_contract {
+ @author byron Haroldo Linares Roman
+ @creation-date 2007-06-25
+} {
+ page_id:optional
+ page_pos:optional
+ page_name:optional
+ content_id:optional
+ status:optional
+ dir:optional
+ show:optional
+ {action 0}
+}
+
+set page_list [list]
+set next_list [list]
+if {![string match $page_pos "@page_order@"]} {
+ set wiki_url "[ad_conn package_url]$page_name"
+ set wiki_folder_id [::xowiki::Page require_folder -name xowiki \
+ -package_id $content_id]
+ set item_id [content::revision::item_id -revision_id $page_id]
+ set cat_id [category::get_mapped_categories $item_id]
+
+ if {![ permission::permission_p -object_id $item_id -privilege admin]} {
+ set show 0
+ } else {
+ db_foreach select_page {*SQL*} {
+ lappend page_list [list $tmp_item_id \
+ $page_order \
+ $name \
+ $revision_id \
+ $publish_status]
+ }
+ set order_page [lsort -$dir -command learning_content::compare $page_list]
+ set count 0
+ foreach pages $order_page {
+ set current_pos [lsearch -exact $pages $page_id]
+ if {$current_pos >= 0} {
+ incr count
+ set next_list [lindex $order_page $count]
+ break
+ }
+ incr count
+ }
+
+ if {[llength $next_list] > 0} {
+ if {$action == 0} {
+ set show 1
+ switch $dir {
+ "decreasing" {
+ set img_name "order_up"
+ }
+ "increasing" {
+ set img_name "order_down"
+ }
+ }
+ set package_url [apm_package_url_from_id [ad_conn package_id]]
+ set nexturl [export_vars \
+ -base ${package_url}content-admin/toggle-page-order \
+ {page_id
+ page_pos
+ page_name
+ content_id
+ status
+ dir
+ {action 1}
+ {show 0}}]
+ set alt "[_ learning-content.page_${dir}]"
+ } elseif {$action == 1} {
+ set tmp_order [lindex $next_list 1]
+ set tmp_item_id [lindex $next_list 0]
+ set tmp_page_id [lindex $next_list 3]
+ set tmp_status [lindex $next_list 4]
+ db_dml update_page2 {*SQL*}
+ ns_cache flush xotcl_object_cache ::$item_id
+ ns_cache flush xotcl_object_cache ::$page_id
+ content::item::set_live_revision -revision_id $page_id -publish_status $status
+ db_dml update_page {*SQL*}
+ ns_cache flush xotcl_object_cache ::$tmp_item_id
+ ns_cache flush xotcl_object_cache ::$tmp_page_id
+ content::item::set_live_revision -revision_id $tmp_page_id -publish_status $tmp_status
+ ad_returnredirect "${wiki_url}\#cont1"
+ }
+ } else {
+ set show 0
+ }
+ set content_template [parameter::get -package_id [ad_conn package_id] \
+ -parameter "content_template" -default 0]
+ }
+} else {
+ set show 0
+}
Index: openacs-4/packages/learning-content/www/content-admin/toggle-page-order.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/toggle-page-order.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/toggle-page-order.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ update xowiki_page
+ set page_order = :page_pos
+ where page_id = :tmp_page_id
+
+
+
+
+
+ update xowiki_page
+ set page_order = :tmp_order where page_id = :page_id
+
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/tracking-users.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/tracking-users.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/tracking-users.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,18 @@
+
+ @title;noquote@
+ @context;noquote@
+
+
+
+#learning-content.content_admin#
+#learning-content.visits_details_for_content#
+
+
+@t1;noquote@
+
+
+#learning-content.go_back#
Index: openacs-4/packages/learning-content/www/content-admin/tracking-users.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/tracking-users.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/tracking-users.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,44 @@
+::xowiki::Package initialize -ad_doc {
+ Views details for all users in content
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-10-10
+} -parameter {
+ {-return_url:optional ""}
+ {-orderby:optional "views"}
+}
+
+set title [_ learning-content.users_visits]
+set context [list [list ./ [_ learning-content.admin]] $title]
+permission::require_permission -object_id $package_id -privilege admin
+
+set folder_id [::$package_id folder_id]
+set community_id [dotlrn_community::get_community_id]
+if {[empty_string_p return_url]} {
+ set return_url [ad_url]
+}
+
+TableWidget t1 -volatile \
+ -columns {
+ AnchorField user -label [_ learning-content.user_name] -orderby user
+ Field views -label [_ learning-content.total_of_pages_visited] -orderby views -html {align center style "padding: 2px;"}
+ AnchorField view_details -label [_ learning-content.view_details] -html {align center style "padding: 2px;"}
+ }
+
+foreach {att order} [split $orderby ,] break
+t1 orderby -order [expr {$order eq "asc" ? "increasing" : "decreasing"}] $att
+t1 no_data "[_ learning-content.no_users]"
+
+db_foreach users_info { *SQL* } {
+
+ set view_links "[export_vars -base view-user-details {{user_id $user_id} return_url}] "
+ t1 add \
+ -user $user_name \
+ -views $views \
+ -view_details \#learning-content.view_details\# \
+ -view_details.href $view_links
+
+}
+
+set t1 [t1 asHTML]
+
Index: openacs-4/packages/learning-content/www/content-admin/tracking-users.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/tracking-users.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/tracking-users.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,20 @@
+
+
+
+
+ select dm.user_id, aa.first_names || ' ' || aa.last_name as user_name,
+ (select count(*)
+ from cr_items ci, cr_revisions cr, views_views vv
+ where ci.content_type = '::xowiki::PageInstance' and
+ coalesce(ci.live_revision,ci.latest_revision) = cr.revision_id and
+ ci.parent_id = :folder_id and vv.object_id = ci.item_id and
+ viewer_id = dm.user_id) as views
+ from acs_users_all aa,
+ dotlrn_member_rels_approved dm
+ where dm.community_id = :community_id
+ and dm.user_id = aa.user_id
+ and dm.role in ('member','student')
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/tracking.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/tracking.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/tracking.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,19 @@
+
+ @title;noquote@
+ @context;noquote@
+
+
+
+
+#learning-content.content_admin#
+#learning-content.visits_details_for_content#
+
+
+@t1;noquote@
+
+
+#learning-content.go_back#
Index: openacs-4/packages/learning-content/www/content-admin/tracking.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/tracking.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/tracking.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,120 @@
+::xowiki::Package initialize -ad_doc {
+ Views details for all pages of content
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-10-10
+} -parameter {
+ {-object_type:optional}
+ {-orderby:optional "unique_views,title"}
+}
+
+set title [_ learning-content.pages_visits]
+set context [list [list ./ [_ learning-content.admin]] $title]
+permission::require_permission -object_id $package_id -privilege admin
+
+set object_type "::xowiki::PageInstance"
+set community_id [dotlrn_community::get_community_id]
+# if object_type is specified, only list entries of this type;
+# otherwise show types and subtypes of $supertype
+if {![info exists object_type]} {
+ set per_type 0
+ set supertype ::xowiki::PageInstance
+ set object_types [$supertype object_types]
+ set title "List of all kind of [$supertype set pretty_plural]"
+ set with_subtypes true
+ set object_type $supertype
+} else {
+ set per_type 1
+ set object_types [list $object_type]
+ set title "Index of [$object_type set pretty_plural]"
+ set with_subtypes false
+}
+
+set return_url [expr {$per_type ? [export_vars -base [::$package_id url] object_type] :
+ [::$package_id url]}]
+# set up categories
+set category_map_url [export_vars -base \
+ [site_node::get_package_url -package_key categories]cadmin/one-object \
+ { { object_id $package_id } }]
+
+set actions ""
+
+
+set ::individual_permissions [expr {[$package_id set policy] eq "::xowiki::policy3"}]
+set ::with_publish_status 1
+
+TableWidget t1 -volatile \
+ -actions $actions \
+ -columns {
+ AnchorField title -label [_ xowiki.Page-title] -orderby title
+ Field unique_views -label [_ learning-content.total_users] -orderby unique_views -html {align center style "padding: 2px;"}
+ AnchorField view_details -label [_ learning-content.view_details] -html {align center style "padding: 2px;"}
+
+ }
+
+foreach {att order} [split $orderby ,] break
+t1 orderby -order [expr {$order eq "asc" ? "increasing" : "decreasing"}] $att
+
+set attributes [list ci.item_id revision_id content_length creation_user title]
+
+if {[::xo::db::has_ltree]} {
+ lappend attributes page_order
+}
+
+set folder_id [::$package_id folder_id]
+
+db_foreach instance_select \
+ [$object_type instance_select_query \
+ -folder_id $folder_id \
+ -with_subtypes $with_subtypes \
+ -from_clause ", xowiki_page p" \
+ -where_clause "p.page_id = bt.revision_id" \
+ -select_attributes $attributes \
+ -orderby ci.name \
+ ] {
+
+ set page_link [::$package_id pretty_link $name]
+ #Here we get the total views per page
+ #views::get -object_id $item_id
+ set views 0
+ set last_viewed "-"
+ set unique_views "-"
+ db_0or1row get_view { *SQL* }
+
+ set view_links "[export_vars -base view-details {{object_id $item_id} return_url}] "
+ if { $views != 1 } {
+ set views [expr $views]
+ }
+ t1 add \
+ -title $title \
+ -title.href $page_link \
+ -unique_views $unique_views \
+ -view_details \#learning-content.view_details\# \
+ -view_details.href $view_links \
+
+ if {$::individual_permissions} {
+ [t1 last_child] set permissions.href \
+ [export_vars -base permissions {item_id return_url}]
+ }
+ if {$::with_publish_status} {
+ # TODO: this should get some architectural support
+ if {$publish_status eq "ready"} {
+ set image active.png
+ set state "production"
+ } else {
+ set image inactive.png
+ set state "ready"
+ }
+ [t1 last_child] set publish_status.src /resources/xowiki/$image
+ [t1 last_child] set publish_status.href \
+ [export_vars -base [$package_id package_url]admin/set-publish-state \
+ {state revision_id return_url}]
+ }
+ if {[::xo::db::has_ltree]} {
+ [t1 last_child] set page_order $page_order
+ }
+ }
+
+t1 no_data "[_ learning-content.no_pages]"
+set t1 [t1 asHTML]
+
Index: openacs-4/packages/learning-content/www/content-admin/tracking.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/tracking.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/tracking.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+
+
+ select count(*) as unique_views
+ from acs_users_all aa, views_views vv,
+ dotlrn_member_rels_approved dm
+ where dm.community_id = :community_id
+ and dm.user_id = aa.user_id
+ and dm.role in ('member','student')
+ and vv.viewer_id = dm.user_id
+ and vv.object_id = :item_id
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/view-details.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/view-details.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/view-details.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,17 @@
+
+ @title;noquote@
+ @context;noquote@
+
+
+
+#learning-content.content_admin#
+#learning-content.visits_details_for_page#
+
+@t1;noquote@
+
+
+#learning-content.go_back#
Index: openacs-4/packages/learning-content/www/content-admin/view-details.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/view-details.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/view-details.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,43 @@
+::xowiki::Package initialize -ad_doc {
+ Views details for a page in content
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-10-10
+} -parameter {
+ {-object_id}
+ {-return_url:optional ""}
+ {-orderby:optional "views"}
+}
+
+set title [_ learning-content.page_views]
+set context [list [list ./ [_ learning-content.admin]] $title]
+permission::require_permission -object_id $package_id -privilege admin
+
+set revision_id [content::item::get_best_revision -item_id $object_id]
+set page_name [db_string get_page_name {} -default ""]
+set community_id [dotlrn_community::get_community_id]
+
+TableWidget t1 -volatile \
+ -columns {
+ AnchorField user -label [_ learning-content.user_name]
+ Field views -label [_ learning-content.total_views] -orderby views -html {align center style "padding: 2px;"}
+ Field last_viewed -label [_ learning-content.last_viewed] -orderby last_viewed -html {align center style "padding: 2px;"}
+ }
+
+foreach {att order} [split $orderby ,] break
+t1 orderby -order [expr {$order eq "asc" ? "increasing" : "decreasing"}] $att
+t1 no_data "[_ learning-content.no_visits]"
+
+db_foreach views_info { *SQL* } {
+
+ acs_user::get -user_id $viewer_id -array user
+ set user_name $user(name)
+
+ t1 add \
+ -user $user_name \
+ -last_viewed $last_viewed \
+ -views $views
+}
+
+set t1 [t1 asHTML]
+
Index: openacs-4/packages/learning-content/www/content-admin/view-details.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/view-details.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/view-details.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,25 @@
+
+
+
+
+ select views_count as views, viewer_id,
+ to_char(last_viewed,'YYYY-MM-DD HH24:MI:SS') as last_viewed
+ from acs_users_all aa, views_views vv,
+ dotlrn_member_rels_approved dm
+ where dm.community_id = :community_id
+ and dm.user_id = aa.user_id
+ and dm.role in ('member','student')
+ and vv.viewer_id = dm.user_id
+ and vv.object_id = :object_id
+
+
+
+
+
+ select title
+ from cr_revisions
+ where revision_id = :revision_id
+
+
+
+
Index: openacs-4/packages/learning-content/www/content-admin/view-user-details.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/view-user-details.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/view-user-details.adp 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,17 @@
+
+ @title;noquote@
+ @context;noquote@
+
+
+
+#learning-content.content_admin#
+#learning-content.visits_details_for_user#
+
+@t1;noquote@
+
+
+#learning-content.go_back#
Index: openacs-4/packages/learning-content/www/content-admin/view-user-details.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/view-user-details.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/view-user-details.tcl 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,40 @@
+::xowiki::Package initialize -ad_doc {
+ Views details for a user in content
+
+ @author Alvaro Rodriguez (alvaro@viaro.net)
+ @creation-date 2008-10-10
+} -parameter {
+ {-user_id}
+ {-return_url:optional ""}
+ {-orderby:optional "views"}
+}
+
+set title [_ learning-content.user_views]
+set context [list [list ./ [_ learning-content.admin]] $title]
+permission::require_permission -object_id $package_id -privilege admin
+
+set folder_id [::$package_id folder_id]
+acs_user::get -user_id $user_id -array user
+set user_name $user(name)
+
+TableWidget t1 -volatile \
+ -columns {
+ AnchorField title -label [_ xowiki.Page-title] -orderby title
+ Field views -label [_ learning-content.total_views] -orderby views -html {align center style "padding: 2px;"}
+ Field last_viewed -label [_ learning-content.last_viewed] -orderby last_viewed -html {align center style "padding: 2px;"}
+ }
+
+foreach {att order} [split $orderby ,] break
+t1 orderby -order [expr {$order eq "asc" ? "increasing" : "decreasing"}] $att
+t1 no_data "[_ learning-content.no_visits_user]"
+
+db_foreach views_info { *SQL* } {
+
+ t1 add \
+ -title $title \
+ -last_viewed $last_viewed \
+ -views $views
+}
+
+set t1 [t1 asHTML]
+
Index: openacs-4/packages/learning-content/www/content-admin/view-user-details.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/content-admin/view-user-details.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/content-admin/view-user-details.xql 5 Mar 2009 21:29:04 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+
+
+ select cr.title, views_count as views,
+ to_char(last_viewed,'YYYY-MM-DD HH24:MI:SS') as last_viewed
+ from cr_items ci, cr_revisions cr, views_views vv
+ where ci.content_type = '::xowiki::PageInstance' and
+ coalesce(ci.live_revision,ci.latest_revision) = cr.revision_id and
+ ci.parent_id = :folder_id and vv.object_id = ci.item_id and
+ viewer_id = :user_id
+ order by cr.title
+
+
+
+
Index: openacs-4/packages/learning-content/www/prototypes/categories.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/categories.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/categories.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,6 @@
+::xowiki::Page new -title "categories" -text {
+{{adp /packages/learning-content/www/content-categories {skin plain-include open_page 0} }}
+}
+
+
+
Index: openacs-4/packages/learning-content/www/prototypes/content_template.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/content_template.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/content_template.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,24 @@
+::xowiki::PageTemplate new -title "Content Template" -text {
+{{show_header -decoration none}}
+{{adp /packages/learning-content/www/content-admin/order {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ type @object_type@ dir "decreasing" action 0 page_name @name@ status @publish_status@} }}
+
+
+
+
{{adp /packages/learning-content/www/template/complete-subnavbar {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ type @object_type@} }}
+
+
+
{{adp /packages/learning-content/www/template/complete-titlebar {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ my_title "@title@"} }}
+
+
+ {{adp /packages/learning-content/www/template/complete-navigation {page_pos @page_order@ page_id @revision_id@ content_id @package_id@} }}
+
+
+
@contenido@
+
{{adp /packages/learning-content/www/show-activity {object_id @revision_id@ } }}
+
+
+
+
+
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/prototypes/editor.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/editor.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/editor.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,27 @@
+::xowiki::Object new -title "RichText Editor Config" -text {
+
+ set xinha {richtext(richtext),nospell
+ {options {editor xinha plugins {
+ GetHtml ContextMenu FullScreen
+ ListType EditTag Stylist OacsFs InsertGlossaryEntry
+ } height 350px javascript {
+xinha_config.toolbar =
+ [
+ ["popupeditor"],
+ ["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],
+ ["separator","forecolor","hilitecolor","textindicator"],
+ ["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
+ ["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
+ ["separator","inserthorizontalrule","createlink","insertimage","inserttable"],
+ ["linebreak","separator","undo","redo"],
+ ["separator","killword","clearfonts","removeformat"],
+ ["htmlmode"]
+ ];
+xinha_config.pageStyleSheets = ["/resources/learning-content/simple-style-blue.css"];
+xinha_config.stylistLoadStylesheet('/resources/learning-content/simple-style-blue.css',{'.greybox':'Grey Box','.date':'Date'});
+ }}}
+ {html {rows 15 cols 50 style {width: 100%}}}
+ {htmlarea_p 1}}
+ set tit {text {label \#xowiki.title\#} {html {size 40 maxlength 50}} {values ""}}
+ set widget_specs [list *,contenido $xinha *,title $tit]
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/prototypes/glossary-list.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/glossary-list.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/glossary-list.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,22 @@
+set folder_id [content::folder::get_folder_from_package \
+ -package_id [ad_conn package_id]]
+set content_template [content::item::get_id_by_name -name en:content_template \
+ -parent_id $folder_id]
+::xowiki::PageInstance create ::"GlossaryView" -noinit \
+ -set object_type ::xowiki::PageInstance \
+ -set page_template $content_template \
+ -set page_order [learning_content::get_next_page_order] \
+ -set lang en \
+ -set instance_attributes {contenido {{{{adp /packages/learning-content/www/glossary-view}}} text/html}} \
+ -set description {} \
+ -set render_adp 1 \
+ -set text {} \
+ -set package_id [ad_conn package_id] \
+ -set nls_language en_US \
+ -set name "glossary_view" \
+ -set mime_type text/plain \
+ -set title "\#learning-content.glossary\#" \
+ -set publish_status ready \
+ -set item_id [db_nextval acs_object_id_seq] \
+ -set contenido {{{adp /packages/learning-content/www/glossary-view}}} \
+ -set parent_id $folder_id
Index: openacs-4/packages/learning-content/www/prototypes/glossary.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/glossary.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/glossary.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,11 @@
+::xowiki::Form new \
+-set name glossary \
+-title "Glosario" \
+-set anon_instances t \
+-set form {{} text/html} \
+-set text {} \
+-set form_constraints {
+ @cr_fields:hidden {_name:optional}
+ word:text,inline=true,label=Text
+ description:text,inline=true,label=Description
+}
Index: openacs-4/packages/learning-content/www/prototypes/header_page.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/header_page.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/header_page.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,22 @@
+set folder_id [content::folder::get_folder_from_package \
+ -package_id [ad_conn package_id]]
+set content_template [content::item::get_id_by_name -name en:header_template \
+ -parent_id $folder_id]
+::xowiki::PageInstance create ::"HeaderPage" -noinit \
+ -set object_type ::xowiki::PageInstance \
+ -set page_template $content_template \
+ -set page_order [learning_content::get_next_page_order] \
+ -set lang en \
+ -set instance_attributes {} \
+ -set description {} \
+ -set render_adp 1 \
+ -set text {} \
+ -set package_id [ad_conn package_id] \
+ -set nls_language en_US \
+ -set name "header_page" \
+ -set mime_type text/plain \
+ -set title "\#learning-content.header_page\#" \
+ -set publish_status ready \
+ -set item_id [db_nextval acs_object_id_seq] \
+ -set contenido {} \
+ -set parent_id $folder_id
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/prototypes/header_template.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/header_template.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/header_template.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,6 @@
+::xowiki::PageTemplate new -title "Header Template" -text {
+
+
+ @titulo@
+
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/prototypes/index.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/index.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/index.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,4 @@
+::xowiki::Page new -title "[_ learning-content.index_page]" -text {
+{{es:o_index -decoration plain }}
+}
+
Index: openacs-4/packages/learning-content/www/prototypes/o_index.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/o_index.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/o_index.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,26 @@
+::xowiki::Object new -title "Object index" -text {
+proc content {} {
+
+set user_id [ad_conn user_id]
+set admin_p [dotlrn::user_can_admin_community_p -user_id $user_id -community_id [dotlrn_community::get_community_id]]
+if {$admin_p} {
+ return {
+
+ #learning-content.welcome#
+
+
+ #learning-content.welcome_body#
+
+ }
+} else {
+ return {
+
+ #learning-content.e_welcome#
+
+
+ #learning-content.e_welcome_body#
+
+ }
+ }
+}
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/prototypes/show_header.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/prototypes/show_header.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/prototypes/show_header.page 5 Mar 2009 21:29:01 -0000 1.1
@@ -0,0 +1,10 @@
+::xowiki::Object new -title "Show Header" -text {
+proc content {} {
+set param [parameter::get -package_id [ad_conn package_id] -parameter show_header -default 0]
+if { $param == 1 } {
+ return { {{header_page -decoration none}} }
+} else {
+ return {}
+}
+}
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/resources/activities.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/resources/activities.css,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/resources/activities.css 5 Mar 2009 21:29:02 -0000 1.1
@@ -0,0 +1,18 @@
+a {
+ cursor: pointer;
+}
+.selected_a {
+ color: #E82C0C;
+}
+.activities th {
+ text-align: left;
+ padding-left: 5px;
+ height: 30px;
+}
+.activities td {
+ height: 30px;
+}
+.margin-form fieldset {
+ border: 0;
+ margin: 0;
+}
\ No newline at end of file
Index: openacs-4/packages/learning-content/www/resources/calendar-full-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/learning-content/www/resources/calendar-full-portlet.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/learning-content/www/resources/calendar-full-portlet.tcl 5 Mar 2009 21:29:02 -0000 1.1
@@ -0,0 +1,27 @@
+�PNG
+
+
+IHDR , �]� pHYs ��
+OiCCPPhotoshop ICC profile xڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q,�
+��!���������{�kּ������>�����H3Q5��B�������.@�
+$p �d!s�# �~<<+"�� x� �M��0���B�\���t�8K� @z�B� @F���&S