3 Copyright (c) 2002 - 2010
4 Inclusive Design Institute
7 This program is free software. You can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation.
12 /* Note that this javascript calls on a js function ATutor.course.contentMenu.initContentMenu()
13 that is generated from php function getInitMenuJS() in ContentManager.class.php. So, must call
14 the php function before including this js script. */
18 var ATutor = ATutor || {};
19 ATutor.course = ATutor.course || {};
20 ATutor.course.contentMenu = ATutor.course.contentMenu || {};
24 var inlineEditsSetup = function () {
25 jQuery("#editable_table").find(".inlineEdits").each(function() {
26 jQuery(this).text(jQuery(this).attr("title"));
29 var tableEdit = fluid.inlineEdits("#editable_table", {
31 text : ".inlineEdits",
32 editables : "span:has(span.inlineEdits)"
35 applyEditPadding: false,
38 afterFinishEdit : function (newValue, oldValue, editNode, viewNode) {
39 if (newValue != oldValue)
41 rtn = jQuery.post(ATutor.base_path+"mods/_core/content/menu_inline_editor_submit.php", { "field":viewNode.id, "value":newValue },
42 function(data) {}, "json");
48 jQuery(".fl-inlineEdit-edit").css("width", "80px")
51 ATutor.course.contentMenu.expandContentFolder = function(contentID) {
52 jQuery("#folder"+contentID).show();
53 jQuery("#tree_icon"+contentID).attr("src", ATutor.course.collapse_icon);
54 jQuery("#tree_icon"+contentID).attr("alt", ATutor.course.text_collapse);
55 jQuery("#tree_icon"+contentID).attr("title", ATutor.course.text_collapse);
58 ATutor.course.contentMenu.collapseContentFolder = function(contentID) {
59 jQuery("#folder"+contentID).hide();
60 jQuery("#tree_icon"+contentID).attr("src", ATutor.course.expand_icon);
61 jQuery("#tree_icon"+contentID).attr("alt", ATutor.course.text_expand);
62 jQuery("#tree_icon"+contentID).attr("title", ATutor.course.text_expand);
65 ATutor.course.contentMenu.switchEditMode = function() {
66 title_edit = ATutor.course.text_enter_edit_mode;
67 img_edit = ATutor.base_path+"images/medit.gif";
69 title_view = ATutor.course.text_exit_edit_mode;
70 img_view = ATutor.base_path+"images/mlock.gif";
72 if (jQuery("#img_switch_edit_mode").attr("src") == img_edit)
74 jQuery("#img_switch_edit_mode").attr("src", img_view);
75 jQuery("#img_switch_edit_mode").attr("alt", title_view);
76 jQuery("#img_switch_edit_mode").attr("title", title_view);
80 { // refresh the content navigation to exit the edit mode
81 jQuery.post(ATutor.base_path+"mods/_core/content/refresh_content_nav.php", {},
82 function(data) {jQuery("#editable_table").replaceWith(data); ATutor.course.contentMenu.initContentMenu();});
86 jQuery(document).ready(function () {
87 ATutor.course.contentMenu.initContentMenu();