MDL-22893, assignment module should use filepicker and filemanager
[moodle.git] / mod / assignment / assignment.js
index 0a028fa..80c34bb 100644 (file)
@@ -1,3 +1,5 @@
+var assignment = {};
+
 function setNext(){
     document.getElementById('submitform').mode.value = 'next';
     document.getElementById('submitform').userid.value = assignment.nextid;
@@ -8,4 +10,28 @@ function saveNext(){
     document.getElementById('submitform').userid.value = assignment.nextid;
     document.getElementById('submitform').saveuserid.value = assignment.userid;
     document.getElementById('submitform').menuindex.value = document.getElementById('submitform').grade.selectedIndex;
-}
\ No newline at end of file
+}
+
+function initNext(nextid, usserid) {
+       assignment.nextid = nextid;
+       assignment.userid = userid;
+}
+
+M.mod_assignment = {};
+
+M.mod_assignment.init_tree = function(Y, expand_all, htmlid) {
+    Y.use('yui2-treeview', function(Y) {
+        var tree = new YAHOO.widget.TreeView(htmlid);
+
+        tree.subscribe("clickEvent", function(node, event) {
+            // we want normal clicking which redirects to url
+            return false;
+        });
+
+        if (expand_all) {
+            tree.expandAll();
+        }
+
+        tree.render();
+    });
+}