diff --git a/course/mod.php b/course/mod.php
index 3247db4..19a9331 100644
--- a/course/mod.php
+++ b/course/mod.php
@@ -42,6 +42,7 @@ $course        = optional_param('course', 0, PARAM_INT);
 $groupmode     = optional_param('groupmode', -1, PARAM_INT);
 $cancelcopy    = optional_param('cancelcopy', 0, PARAM_BOOL);
 $confirm       = optional_param('confirm', 0, PARAM_BOOL);
+$dajax         = optional_param('isformajax',0,PARAM_INT);
 
 // This page should always redirect
 $url = new moodle_url('/course/mod.php');
@@ -60,6 +61,10 @@ if ($type !== '') {
 if ($groupmode !== '') {
     $url->param('groupmode', $groupmode);
 }
+
+if ($dajax != 0) {
+    $url->param('isformajax', $dajax);
+}
 $PAGE->set_url($url);
 
 require_login();
@@ -71,12 +76,12 @@ if (!empty($add)) {
     $type        = optional_param('type', '', PARAM_ALPHA);
     $returntomod = optional_param('return', 0, PARAM_BOOL);
 
-    redirect("$CFG->wwwroot/course/modedit.php?add=$add&type=$type&course=$id&section=$section&return=$returntomod&sr=$sectionreturn");
+    redirect("$CFG->wwwroot/course/modedit.php?add=$add&type=$type&course=$id&section=$section&return=$returntomod&sr=$sectionreturn&isformajax=$dajax");
 
 } else if (!empty($update)) {
     $cm = get_coursemodule_from_id('', $update, 0, true, MUST_EXIST);
     $returntomod = optional_param('return', 0, PARAM_BOOL);
-    redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod&sr=$sectionreturn");
+    redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod&sr=$sectionreturn&isformajax=$dajax");
 
 } else if (!empty($duplicate) and confirm_sesskey()) {
      $cm     = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
diff --git a/course/modedit.php b/course/modedit.php
index 234e3ad..3ac707c 100644
--- a/course/modedit.php
+++ b/course/modedit.php
@@ -1,5 +1,4 @@
 <?php
-
 // This file is part of Moodle - http://moodle.org/
 //
 // Moodle is free software: you can redistribute it and/or modify
@@ -36,6 +35,7 @@ $update = optional_param('update', 0, PARAM_INT);
 $return = optional_param('return', 0, PARAM_BOOL);    //return to course/view.php if false or mod/modname/view.php if true
 $type   = optional_param('type', '', PARAM_ALPHANUM); //TODO: hopefully will be removed in 2.0
 $sectionreturn = optional_param('sr', null, PARAM_INT);
+$dajax = optional_param('isformajax',0,PARAM_INT);
 
 $url = new moodle_url('/course/modedit.php');
 $url->param('sr', $sectionreturn);
@@ -252,9 +252,9 @@ $mform = new $mformclassname($data, $cw->section, $cm, $course);
 $mform->set_data($data);
 
 if ($mform->is_cancelled()) {
-    if ($return && !empty($cm->id)) {
+    if ($dajax == 0 && $return && !empty($cm->id)) {
         redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id");
-    } else {
+    } elseif($dajax == 0) {
         redirect(course_get_url($course, $cw->section, array('sr' => $sectionreturn)));
     }
 } else if ($fromform = $mform->get_data()) {
@@ -267,14 +267,14 @@ if ($mform->is_cancelled()) {
         print_error('invaliddata');
     }
 
-    if (isset($fromform->submitbutton)) {
+    if ($dajax == 0 && isset($fromform->submitbutton)) {
         if (empty($fromform->showgradingmanagement)) {
             redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule");
         } else {
             $returnurl = new moodle_url("/mod/$module->name/view.php", array('id' => $fromform->coursemodule));
             redirect($fromform->gradingman->get_management_url($returnurl));
         }
-    } else {
+    } elseif($dajax == 0) {
         redirect(course_get_url($course, $cw->section, array('sr' => $sectionreturn)));
     }
     exit;
@@ -290,23 +290,25 @@ if ($mform->is_cancelled()) {
         $context = context_course::instance($course->id);
     }
 
-    $PAGE->set_heading($course->fullname);
-    $PAGE->set_title($streditinga);
-    $PAGE->set_cacheable(false);
-
-    if (isset($navbaraddition)) {
-        $PAGE->navbar->add($navbaraddition);
-    }
-
-    echo $OUTPUT->header();
+    if($dajax == 0) {
+        $PAGE->set_heading($course->fullname);
+        $PAGE->set_title($streditinga);
+        $PAGE->set_cacheable(false);
 
-    if (get_string_manager()->string_exists('modulename_help', $module->name)) {
-        echo $OUTPUT->heading_with_help($pageheading, 'modulename', $module->name, 'icon');
-    } else {
-        echo $OUTPUT->heading_with_help($pageheading, '', $module->name, 'icon');
+        if (isset($navbaraddition)) {
+            $PAGE->navbar->add($navbaraddition);
+        }
+        echo $OUTPUT->header();
+        if (get_string_manager()->string_exists('modulename_help', $module->name)) {
+            echo $OUTPUT->heading_with_help($pageheading, 'modulename', $module->name, 'icon');
+        } else {
+            echo $OUTPUT->heading_with_help($pageheading, '', $module->name, 'icon');
+        }
     }
 
     $mform->display();
 
-    echo $OUTPUT->footer();
+    if($dajax == 0) {
+        echo $OUTPUT->footer();
+    }
 }
diff --git a/course/modjs.php b/course/modjs.php
new file mode 100644
index 0000000..93e2647
--- /dev/null
+++ b/course/modjs.php
@@ -0,0 +1,28 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle 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 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle 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.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Create temporary file modjs.js to load its code for current form validator.
+ *
+ * @copyright 2015 Klevtsov Vadim
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package course
+ */
+
+$file = fopen("modjs.js", "w") or die("Unable to open file!");
+fwrite($file,$_POST['script']);
+fclose($file);
+exit();
diff --git a/course/view.php b/course/view.php
index f406a06..d63edcc 100644
--- a/course/view.php
+++ b/course/view.php
@@ -294,5 +294,12 @@
 
     // Include course AJAX
     include_course_ajax($course, $modnamesused);
-
+    
+    // Include update activity/resource dialog
+    $PAGE->requires->strings_for_js(array(
+                'expandall',
+                'collapseall',
+                ), 'moodle');
+    $PAGE->requires->yui_module('moodle-course-dialogupdate', 'M.course.init_dialogupdate');
+    
     echo $OUTPUT->footer();
diff --git a/course/yui/build/moodle-course-dialogadd/moodle-course-dialogadd-debug.js b/course/yui/build/moodle-course-dialogadd/moodle-course-dialogadd-debug.js
new file mode 100644
index 0000000..5a57175
--- /dev/null
+++ b/course/yui/build/moodle-course-dialogadd/moodle-course-dialogadd-debug.js
@@ -0,0 +1,222 @@
+YUI.add('moodle-course-dialogadd', function (Y, NAME) {
+/**
+ * The activity chooser dialogue for courses.
+ *
+ * @module moodle-course-modchooser
+ */
+
+var CSS = {
+    PANELCONTENT : '#panelContentAdd',
+    FORM : '#formContainer',
+    SUBMITBLOCK : '#panelContentAdd .hidden .felement.fgroup',
+    SUBMITBUTTON: '#panelContentAdd .hidden .felement.fgroup #id_submitbutton',
+    CANCELBUTTON: '#panelContentAdd .hidden .felement.fgroup #id_cancel',
+    COURSEVIEW : '#page-course-view-weeks',
+    URL : '.moodle-dialogue-base #chooserform input[type=hidden][name=jump]',
+    INITBUTTON : '.moodle-dialogue-base .submitbutton[type=submit][value=Add]'
+};
+
+var DIALOGNAME = 'course-dialogadd';
+
+/**
+ * The activity chooser dialogue for courses.
+ *
+ * @constructor
+ * @class M.course.dialogadd
+ * @extends Y.Base
+ */
+var DIALOG = function() {
+    DIALOG.superclass.constructor.apply(this, arguments);
+};
+Y.extend(DIALOG, Y.Base, {
+    /**
+     * The current panel node.
+     *
+     * @property panelContent
+     * @private
+     * @type object
+     * @default null
+     */
+    panelContent: null,
+    /**
+     * The current form node.
+     *
+     * @property form
+     * @private
+     * @type Number
+     * @default null
+     */
+    form: null,
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method submit_click
+     * @param {event} e event object
+     */
+    submit_click: function (e) {
+	e.preventDefault();
+	// Disable submit buttons to say moodle, what action we do.
+	Y.one(CSS.CANCELBUTTON).set('disabled', 'disabled');
+	Y.one(CSS.SUBMITBUTTON).set('disabled', 'disabled');
+	
+	// AJAX post form request to server side 
+	var cfg = {
+	    method: "post",
+	    on: {
+		success: this.post_success
+	    },
+	    arguments: {
+		success: this
+	    },
+	    form: { id:"mform1"}
+	}
+	Y.io("./modedit.php?isformajax=1", cfg);
+    },
+    /**
+     * Helper function, it handle response of submit form.",
+     * if no errors, update course view, else show form with errors.
+     *
+     * @method post_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    post_success : function (id, o) {
+	if(o.responseText == "") {
+	    this.panel.hide();
+	    Y.io(document.URL, {
+		on: {
+		    success: this.course_success
+		},
+		arguments: {
+		    success: this
+		}
+	    });
+	} else {
+	    this.show_form(id,o);
+	}
+    },
+     /**
+     * Helper function, update course view, else show form with errors.
+     *
+     * @method course_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    course_success : function (id, o) {
+	// Update course view
+	document.open();
+	document.write(o.responseText);
+	document.close();
+    },
+    /**
+     * Show form for setting up and update dialogue for courses.
+     *
+     * @method show_form
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    show_form: function (x, o) {
+	// Remove old panel if it exist
+	if (Y.one(CSS.PANELCONTENT)!=null) {
+	    Y.one(CSS.PANELCONTENT).remove();
+	}
+	// Create panel and append it to page
+	this.panelContent = Y.Node.create('<div>');
+	this.form = Y.Node.create('<div>');
+	this.form.set('id','formContainer');
+	this.panelContent.set('id','panelContentAdd');
+	this.panelContent.appendChild(this.form);
+	this.form.setStyle("height","500");
+	this.form.setStyle("overflow","auto");
+	Y.one(CSS.COURSEVIEW).appendChild(this.panelContent);
+	Y.one(CSS.FORM).setContent(o.responseText);
+	// Load addition js libraryes.
+	var script = Y.one(CSS.FORM).one('script').get('text');
+	Y.io("http://localhost/moodle/course/modjs.php", {
+	    method: "post",
+	    data: {'script' :script},
+	    on: {}
+	});
+	// Init moodle form js
+	if (M.form && M.form.shortforms) {
+	    M.form.shortforms({"formid":"mform1"});
+	}
+	Y.Get.js("http://localhost/moodle/course/modjs.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filemanager.js");
+	Y.Get.js("http://localhost/moodle/repository/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/javascript-static.js");
+	Y.Get.js("http://localhost/moodle/lib/form/form.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/json-stringify/json-stringify.js&amp;2in3/2.9.0/build/yui2-treeview/yui2-treeview.js&amp;3.17.2/cookie/cookie.js&amp;3.17.2/array-invoke/array-invoke.js&amp;3.17.2/model/model.js&amp;3.17.2/model-list/model-list.js&amp;3.17.2/datatable-core/datatable-core.js&amp;3.17.2/view/view.js&amp;3.17.2/datatable-head/datatable-head.js&amp;3.17.2/datatable-body/datatable-body.js&amp;3.17.2/datatable-table/datatable-table.js&amp;3.17.2/datatable-base/datatable-base.js&amp;3.17.2/datatable-column-widths/datatable-column-widths.js&amp;3.17.2/datatable-message/lang/datatable-message_en.js&amp;3.17.2/datatable-message/datatable-message.js&amp;3.17.2/datatable-mutable/datatable-mutable.js&amp;3.17.2/datatable-sort/lang/datatable-sort_en.js&amp;3.17.2/datatable-sort/datatable-sort.js&amp;3.17.2/datasource-local/datasource-local.js&amp;3.17.2/datatable-datasource/datatable-datasource.js&amp;3.17.2/resize-base/resize-base.js&amp;3.17.2/resize-plugin/resize-plugin.js&amp;m/1422191229/core_filepicker/core_filepicker.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/dd-ddm/dd-ddm.js&amp;3.17.2/dd-ddm-drop/dd-ddm-drop.js&amp;3.17.2/dd-proxy/dd-proxy.js&amp;3.17.2/dd-constrain/dd-constrain.js&amp;3.17.2/dd-drop/dd-drop.js&amp;3.17.2/dd-scroll/dd-scroll.js&amp;3.17.2/dd-drop-plugin/dd-drop-plugin.js&amp;3.17.2/dd-delegate/dd-delegate.js&amp;m/1422191229/core/notification/notification-alert-debug.js&amp;m/1422191229/core/notification/notification-exception-debug.js&amp;m/1422191229/core/notification/notification-ajaxexception-debug.js&amp;m/1422191229/core/notification/notification-debug.js&amp;m/1422191229/core/dragdrop/dragdrop-debug.js&amp;m/1422191229/core/blocks/blocks-debug.js");
+	// Create panel object
+	var panel = new Y.Panel({
+	    srcNode      : CSS.PANELCONTENT,
+	    headerContent: 'Add an activity or resource',
+	    width        : 1000,
+	    zIndex       : 5,
+	    centered     : true,
+	    modal        : true,
+	    visible      : false,
+	    render       : true,
+	    plugins      : []
+	});
+	// Set reaction on "Save and return to course" and "Cancel"
+	Y.one(CSS.SUBMITBUTTON).on('click', this.submit_click,this);
+	Y.one(CSS.CANCELBUTTON).on('click', function (e) {
+	    e.preventDefault();
+	    panel.hide();
+	},this);
+	// Move panel down, if it partially visible
+	if (Y.one(CSS.PANELCONTENT).getY() < 50) {
+	    Y.one(CSS.PANELCONTENT).setY(50);
+	}
+	//Show panel
+	panel.show();
+    },
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method on_click
+     * @param {event} e event object
+     * @param {object} self dialogue object
+     */
+    on_click: function (e) {
+	e.preventDefault();
+	var url;
+	var cfg = {
+	    on: {
+		success: this.show_form
+	    },
+	    arguments: {
+		success: this
+	    }
+	};	
+	url = Y.one(CSS.URL).get('value') + "&isformajax=1";
+	Y.io(url,cfg);
+    },
+    /**
+     * Set up the activity form.
+     *
+     * @method init
+     */
+    init: function(params){
+        Y.one(CSS.INITBUTTON).on('click', this.on_click,this);
+        M.course.coursebase.register_module(this);
+    }
+},
+{
+    NAME : DIALOGNAME,
+    ATTRS : {
+        maxheight : {
+            value : 800
+        }
+    }
+});
+M.course = M.course || {};
+M.course.init_dialogadd = function(config) {
+    return new DIALOG(config);
+};
+}, '@VERSION@', {"requires": ["moodle-core-chooserdialogue", "moodle-course-coursebase", "moodle-form-shortforms","moodle-form","moodle-form_filemanager","moodle-form_dndupload"]});
diff --git a/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate-debug.js b/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate-debug.js
new file mode 100644
index 0000000..2e574bf
--- /dev/null
+++ b/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate-debug.js
@@ -0,0 +1,241 @@
+YUI.add('moodle-course-dialogupdate', function (Y, NAME) {
+/**
+ * The activity setting up and update dialogue for courses.
+ *
+ * @module moodle-course-dialogupdate
+ */
+
+var CSS = {
+    PANELCONTENT : '#panelContentUpdate',
+    FORM : '#formContainer',
+    SUBMITBLOCK : '#panelContentUpdate .hidden .fitem.fitem_fgroup',
+    SUBMITBUTTON: '#panelContentUpdate .hidden .fitem.fitem_fgroup #id_submitbutton',
+    CANCELBUTTON: '#panelContentUpdate .hidden .fitem.fitem_fgroup #id_cancel',
+    COURSEVIEW : '#page-course-view-weeks',
+    INITBUTTON : 'a.editing_update.menu-action.cm-edit-action'
+};
+
+var DIALOGNAME = 'course-dialogupdate';
+
+/**
+ * The activity setting up and update dialogue for courses.
+ *
+ * @constructor
+ * @class M.course.modchooser
+ * @extends Y.Base
+ */
+var DIALOG = function() {
+    DIALOG.superclass.constructor.apply(this, arguments);
+};
+Y.extend(DIALOG, Y.Base, {
+    /**
+     * The current panel object.
+     *
+     * @property panel
+     * @private
+     * @type Object
+     * @default null
+     */
+    panel: null,
+    /**
+     * The current panel node.
+     *
+     * @property panelContent
+     * @private
+     * @type object
+     * @default null
+     */
+    panelContent: null,
+    /**
+     * The current form node.
+     *
+     * @property form
+     * @private
+     * @type Number
+     * @default null
+     */
+    form: null,
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method submit_click
+     * @param {event} e event object
+     */
+    submit_click: function (e) {
+	e.preventDefault();
+	// Disable submit buttons to say moodle, what action we do.
+	Y.one(CSS.CANCELBUTTON).set('disabled', 'disabled');
+	Y.one(CSS.SUBMITBUTTON).set('disabled', 'disabled');
+	
+	// AJAX post form request to server side 
+	var cfg = {
+	    method: "post",
+	    on: {
+		success: this.post_success
+	    },
+	    arguments: {
+		success: this
+	    },
+	    form: { id:"mform1"}
+	}
+	Y.io("./modedit.php?isformajax=1", cfg);
+    },
+    /**
+     * Helper function, it handle response of submit form.",
+     * if no errors, update course view, else show form with errors.
+     *
+     * @method post_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    post_success : function (id, o) {
+	if(o.responseText == "") {
+	    this.panel.hide();
+	    Y.io(document.URL, {
+		on: {
+		    success: this.course_success
+		},
+		arguments: {
+		    success: this
+		}
+	    });
+	} else {
+	    this.show_form(id,o);
+	}
+    },
+    /**
+     * Helper function, update course view, else show form with errors.
+     *
+     * @method course_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    course_success : function (id, o) {
+	// Update course view
+	document.open();
+	document.write(o.responseText);
+	document.close();
+    },
+    /**
+     * Show form for setting up and update dialogue for courses.
+     *
+     * @method show_form
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    show_form: function (x, o) {
+	// Remove old panel if it exist
+	if (Y.one(CSS.PANELCONTENT)!=null) {
+	    Y.one(CSS.PANELCONTENT).remove();
+	}
+	// Create panel and append it to page
+	this.panelContent = Y.Node.create('<div>');
+	this.form = Y.Node.create('<div>');
+	this.form.set('id','formContainer');
+	this.panelContent.set('id','panelContentUpdate');
+	this.panelContent.appendChild(this.form);
+	this.form.setStyle("height","500");
+	this.form.setStyle("overflow","auto");
+	this.form.setContent(o.responseText);
+	Y.one(CSS.COURSEVIEW).appendChild(this.panelContent);
+	// Load addition js libraryes.
+	var script = Y.one(CSS.FORM).one('script').get('text');
+	Y.io("http://localhost/moodle/course/modjs.php", {
+	    method: "post",
+	    data: {'script' :script},
+	    on: {}
+	});
+	Y.Get.js("http://localhost/moodle/course/modjs.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filemanager.js");
+	Y.Get.js("http://localhost/moodle/repository/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/javascript-static.js");
+	Y.Get.js("http://localhost/moodle/lib/form/form.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/json-stringify/json-stringify.js&amp;2in3/2.9.0/build/yui2-treeview/yui2-treeview.js&amp;3.17.2/cookie/cookie.js&amp;3.17.2/array-invoke/array-invoke.js&amp;3.17.2/model/model.js&amp;3.17.2/model-list/model-list.js&amp;3.17.2/datatable-core/datatable-core.js&amp;3.17.2/view/view.js&amp;3.17.2/datatable-head/datatable-head.js&amp;3.17.2/datatable-body/datatable-body.js&amp;3.17.2/datatable-table/datatable-table.js&amp;3.17.2/datatable-base/datatable-base.js&amp;3.17.2/datatable-column-widths/datatable-column-widths.js&amp;3.17.2/datatable-message/lang/datatable-message_en.js&amp;3.17.2/datatable-message/datatable-message.js&amp;3.17.2/datatable-mutable/datatable-mutable.js&amp;3.17.2/datatable-sort/lang/datatable-sort_en.js&amp;3.17.2/datatable-sort/datatable-sort.js&amp;3.17.2/datasource-local/datasource-local.js&amp;3.17.2/datatable-datasource/datatable-datasource.js&amp;3.17.2/resize-base/resize-base.js&amp;3.17.2/resize-plugin/resize-plugin.js&amp;m/1422191229/core_filepicker/core_filepicker.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/dd-ddm/dd-ddm.js&amp;3.17.2/dd-ddm-drop/dd-ddm-drop.js&amp;3.17.2/dd-proxy/dd-proxy.js&amp;3.17.2/dd-constrain/dd-constrain.js&amp;3.17.2/dd-drop/dd-drop.js&amp;3.17.2/dd-scroll/dd-scroll.js&amp;3.17.2/dd-drop-plugin/dd-drop-plugin.js&amp;3.17.2/dd-delegate/dd-delegate.js&amp;m/1422191229/core/notification/notification-alert-debug.js&amp;m/1422191229/core/notification/notification-exception-debug.js&amp;m/1422191229/core/notification/notification-ajaxexception-debug.js&amp;m/1422191229/core/notification/notification-debug.js&amp;m/1422191229/core/dragdrop/dragdrop-debug.js&amp;m/1422191229/core/blocks/blocks-debug.js");
+	// Init moodle form js
+	if (M.form && M.form.shortforms) { 
+	    M.form.shortforms({"formid":"mform1"});
+	}
+	// Create panel object
+	var panel = new Y.Panel({
+	    srcNode      : CSS.PANELCONTENT,
+	    headerContent: 'Add an activity or resource',
+	    width        : 1000,
+	    zIndex       : 5,
+	    centered     : true,
+	    modal        : true,
+	    visible      : false,
+	    render       : true,
+	    plugins      : []
+	});
+	// Set reaction on "Save and return to course" and "Cancel"
+	Y.one(CSS.SUBMITBUTTON).on('click', this.submit_click,this);
+	Y.one(CSS.CANCELBUTTON).on('click', function (e1) {
+	    e1.preventDefault();
+	    panel.hide();	    
+	},this);
+	// Move panel down, if it partially visible
+	if (this.panelContent.getY() < 50) {
+	    this.panelContent.setY(50);
+	}
+	//Show panel
+	panel.show();
+    },
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method on_click
+     * @param {event} e event object
+     * @param {object} self dialogue object
+     */
+    on_click: function (e,self) {
+	e.preventDefault();
+	// AJAX request to get information to form
+	var url = this.get('href') + '&isformajax=1';
+	var cfg = {
+	    on: {
+		success: self.show_form
+	    },
+	    arguments: {
+		success: self
+	    }
+	}
+	Y.io(url, cfg);			
+    },
+    /**
+     * Set up the activity form.
+     *
+     * @method init
+     */
+    init : function(){
+	var nodelist = Y.all(CSS.INITBUTTON);
+        for (var i = 0; i < nodelist.size(); i++) nodelist.item(i).on('click',this.on_click,nodelist.item(i),this); 
+	M.course.coursebase.register_module(this);
+    }
+},
+{
+    NAME : DIALOGNAME,
+    ATTRS : {
+        /**
+         * The maximum height (in pixels) of the activity chooser.
+         *
+         * @attribute maxheight
+
+         * @type Number
+         * @default 800
+         */
+        maxheight : {
+            value : 800
+        }
+    }
+});
+M.course = M.course || {};
+M.course.init_dialogupdate = function(config) {
+    return new DIALOG();
+};
+
+
+}, '@VERSION@', {"requires": ["moodle-course-coursebase", "moodle-form-shortforms","moodle-form","moodle-form_filemanager","moodle-form_dndupload"]});
diff --git a/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate-min.js b/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate-min.js
new file mode 100644
index 0000000..51323a2
--- /dev/null
+++ b/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate-min.js
@@ -0,0 +1 @@
+YUI.add('moodle-course-dialogupdate',function(Y,NAME){var CSS={PANELCONTENT:'#panelContentUpdate',FORM:'#formContainer',SUBMITBLOCK:'#panelContentUpdate .hidden .fitem.fitem_fgroup',SUBMITBUTTON:'#panelContentUpdate .hidden .fitem.fitem_fgroup #id_submitbutton',CANCELBUTTON:'#panelContentUpdate .hidden .fitem.fitem_fgroup #id_cancel',COURSEVIEW : '#page-course-view-weeks',INITBUTTON : 'a.editing_update.menu-action.cm-edit-action'};var DIALOGNAME = 'course-dialogupdate';var DIALOG=function(){DIALOG.superclass.constructor.apply(this, arguments);};Y.extend(DIALOG,Y.Base,{panel:null,panelContent:null,form:null,submit_click:function(e){e.preventDefault();Y.one(CSS.CANCELBUTTON).set('disabled','disabled');Y.one(CSS.SUBMITBUTTON).set('disabled','disabled');var cfg={method:"post",on:{success:this.post_success},arguments:{success:this},form:{id:"mform1"}};Y.io("./modedit.php?isformajax=1",cfg);},post_success:function(id,o){if(o.responseText==""){this.panel.hide();Y.io(document.URL,{on:{success:this.course_success},arguments:{success:this}});}else{this.show_form(id,o);}},course_success : function (id, o) {document.open();document.write(o.responseText);document.close();},show_form:function(x,o){if(Y.one(CSS.PANELCONTENT)!=null){Y.one(CSS.PANELCONTENT).remove();}this.panelContent=Y.Node.create('<div>');this.form=Y.Node.create('<div>');this.form.set('id','formContainer');this.panelContent.set('id','panelContentUpdate');this.panelContent.appendChild(this.form);this.form.setStyle("height","500");this.form.setStyle("overflow","auto");this.form.setContent(o.responseText);Y.one(CSS.COURSEVIEW).appendChild(this.panelContent);var script = Y.one(CSS.FORM).one('script').get('text');Y.io("http://localhost/moodle/course/modjs.php",{method:"post",data:{'script':script},on:{}});Y.Get.js("http://localhost/moodle/course/modjs.js");Y.Get.js("http://localhost/moodle/lib/form/filepicker.js");Y.Get.js("http://localhost/moodle/lib/form/filemanager.js");Y.Get.js("http://localhost/moodle/repository/filepicker.js");Y.Get.js("http://localhost/moodle/lib/javascript-static.js");Y.Get.js("http://localhost/moodle/lib/form/form.js");Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/json-stringify/json-stringify.js&amp;2in3/2.9.0/build/yui2-treeview/yui2-treeview.js&amp;3.17.2/cookie/cookie.js&amp;3.17.2/array-invoke/array-invoke.js&amp;3.17.2/model/model.js&amp;3.17.2/model-list/model-list.js&amp;3.17.2/datatable-core/datatable-core.js&amp;3.17.2/view/view.js&amp;3.17.2/datatable-head/datatable-head.js&amp;3.17.2/datatable-body/datatable-body.js&amp;3.17.2/datatable-table/datatable-table.js&amp;3.17.2/datatable-base/datatable-base.js&amp;3.17.2/datatable-column-widths/datatable-column-widths.js&amp;3.17.2/datatable-message/lang/datatable-message_en.js&amp;3.17.2/datatable-message/datatable-message.js&amp;3.17.2/datatable-mutable/datatable-mutable.js&amp;3.17.2/datatable-sort/lang/datatable-sort_en.js&amp;3.17.2/datatable-sort/datatable-sort.js&amp;3.17.2/datasource-local/datasource-local.js&amp;3.17.2/datatable-datasource/datatable-datasource.js&amp;3.17.2/resize-base/resize-base.js&amp;3.17.2/resize-plugin/resize-plugin.js&amp;m/1422191229/core_filepicker/core_filepicker.js");Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/dd-ddm/dd-ddm.js&amp;3.17.2/dd-ddm-drop/dd-ddm-drop.js&amp;3.17.2/dd-proxy/dd-proxy.js&amp;3.17.2/dd-constrain/dd-constrain.js&amp;3.17.2/dd-drop/dd-drop.js&amp;3.17.2/dd-scroll/dd-scroll.js&amp;3.17.2/dd-drop-plugin/dd-drop-plugin.js&amp;3.17.2/dd-delegate/dd-delegate.js&amp;m/1422191229/core/notification/notification-alert-debug.js&amp;m/1422191229/core/notification/notification-exception-debug.js&amp;m/1422191229/core/notification/notification-ajaxexception-debug.js&amp;m/1422191229/core/notification/notification-debug.js&amp;m/1422191229/core/dragdrop/dragdrop-debug.js&amp;m/1422191229/core/blocks/blocks-debug.js");if(M.form && M.form.shortforms){M.form.shortforms({"formid":"mform1"});}var panel=new Y.Panel({srcNode:CSS.PANELCONTENT,headerContent:'Add an activity or resource',width:1000,zIndex:5,centered:true,modal:true,visible:false,render:true,plugins:[]});Y.one(CSS.SUBMITBUTTON).on('click',this.submit_click,this);Y.one(CSS.CANCELBUTTON).on('click',function(e1){e1.preventDefault();panel.hide();this.panelContent.remove();},this);if(this.panelContent.getY()<50){this.panelContent.setY(50);}panel.show();},on_click:function(e,self){e.preventDefault();var url=this.get('href')+'&isformajax=1';var cfg={on:{success:self.show_form},arguments:{success:self}};Y.io(url, cfg);},init:function(){var nodelist = Y.all(CSS.INITBUTTON);for(var i=0;i<nodelist.size();i++)nodelist.item(i).on('click',this.on_click,nodelist.item(i),this);M.course.coursebase.register_module(this);}},{NAME:DIALOGNAME,ATTRS:{maxheight:{value:800}}});M.course=M.course||{};M.course.init_dialogupdate=function(config){return new DIALOG();};},'@VERSION@',{"requires":["moodle-course-coursebase","moodle-form-shortforms","moodle-form","moodle-form_filemanager","moodle-form_dndupload"]});
\ No newline at end of file
diff --git a/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate.js b/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate.js
new file mode 100644
index 0000000..b228e20
--- /dev/null
+++ b/course/yui/build/moodle-course-dialogupdate/moodle-course-dialogupdate.js
@@ -0,0 +1,243 @@
+YUI.add('moodle-course-dialogupdate', function (Y, NAME) {
+/**
+ * The activity setting up and update dialogue for courses.
+ *
+ * @module moodle-course-dialogupdate
+ */
+
+var CSS = {
+    PANELCONTENT : '#panelContentUpdate',
+    FORM : '#formContainer',
+    SUBMITBLOCK : '#panelContentUpdate .hidden .fitem.fitem_fgroup',
+    SUBMITBUTTON: '#panelContentUpdate .hidden .fitem.fitem_fgroup #id_submitbutton',
+    CANCELBUTTON: '#panelContentUpdate .hidden .fitem.fitem_fgroup #id_cancel',
+    COURSEVIEW : '#page-course-view-weeks',
+    INITBUTTON : 'a.editing_update.menu-action.cm-edit-action'
+};
+
+var DIALOGNAME = 'course-dialogupdate';
+
+/**
+ * The activity setting up and update dialogue for courses.
+ *
+ * @constructor
+ * @class M.course.modchooser
+ * @extends Y.Base
+ */
+var DIALOG = function() {
+    DIALOG.superclass.constructor.apply(this, arguments);
+};
+Y.extend(DIALOG, Y.Base, {
+    /**
+     * The current panel object.
+     *
+     * @property panel
+     * @private
+     * @type Object
+     * @default null
+     */
+    panel: null,
+    /**
+     * The current panel node.
+     *
+     * @property panelContent
+     * @private
+     * @type object
+     * @default null
+     */
+    panelContent: null,
+    /**
+     * The current form node.
+     *
+     * @property form
+     * @private
+     * @type Number
+     * @default null
+     */
+    form: null,
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method submit_click
+     * @param {event} e event object
+     */
+    submit_click: function (e) {
+	e.preventDefault();
+	// Disable submit buttons to say moodle, what action we do.
+	Y.one(CSS.CANCELBUTTON).set('disabled', 'disabled');
+	Y.one(CSS.SUBMITBUTTON).set('disabled', 'disabled');
+	
+	// AJAX post form request to server side 
+	var cfg = {
+	    method: "post",
+	    on: {
+		success: this.post_success
+	    },
+	    arguments: {
+		success: this
+	    },
+	    form: { id:"mform1"}
+	}
+	Y.io("./modedit.php?isformajax=1", cfg);
+    },
+    /**
+     * Helper function, it handle response of submit form.",
+     * if no errors, update course view, else show form with errors.
+     *
+     * @method post_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    post_success : function (id, o) {
+	if(o.responseText == "") {
+	    this.panel.hide();
+	    Y.io(document.URL, {
+		on: {
+		    success: this.course_success
+		},
+		arguments: {
+		    success: this
+		}
+	    });
+	} else {
+	    this.show_form(id,o);
+	}
+    },
+    /**
+     * Helper function, update course view, else show form with errors.
+     *
+     * @method course_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    course_success : function (id, o) {
+	// Update course view
+	document.open();
+	document.write(o.responseText);
+	document.close();
+    },
+    /**
+     * Show form for setting up and update dialogue for courses.
+     *
+     * @method show_form
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    show_form: function (x, o) {
+	// Remove old panel if it exist
+	if (Y.one(CSS.PANELCONTENT)!=null) {
+	    Y.one(CSS.PANELCONTENT).remove();
+	}
+	// Create panel and append it to page
+	this.panelContent = Y.Node.create('<div>');
+	this.form = Y.Node.create('<div>');
+	this.form.set('id','formContainer');
+	this.panelContent.set('id','panelContentUpdate');
+	this.panelContent.appendChild(this.form);
+	this.form.setStyle("height","500");
+	this.form.setStyle("overflow","auto");
+	this.form.setContent(o.responseText);
+	Y.one(CSS.COURSEVIEW).appendChild(this.panelContent);
+	// Load addition js libraryes.
+	var script = Y.one(CSS.FORM).one('script').get('text');
+	Y.io("http://localhost/moodle/course/modjs.php", {
+	    method: "post",
+	    data: {'script' :script},
+	    on: {}
+	});
+	Y.Get.js("http://localhost/moodle/course/modjs.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filemanager.js");
+	Y.Get.js("http://localhost/moodle/repository/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/javascript-static.js");
+	Y.Get.js("http://localhost/moodle/lib/form/form.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/json-stringify/json-stringify.js&amp;2in3/2.9.0/build/yui2-treeview/yui2-treeview.js&amp;3.17.2/cookie/cookie.js&amp;3.17.2/array-invoke/array-invoke.js&amp;3.17.2/model/model.js&amp;3.17.2/model-list/model-list.js&amp;3.17.2/datatable-core/datatable-core.js&amp;3.17.2/view/view.js&amp;3.17.2/datatable-head/datatable-head.js&amp;3.17.2/datatable-body/datatable-body.js&amp;3.17.2/datatable-table/datatable-table.js&amp;3.17.2/datatable-base/datatable-base.js&amp;3.17.2/datatable-column-widths/datatable-column-widths.js&amp;3.17.2/datatable-message/lang/datatable-message_en.js&amp;3.17.2/datatable-message/datatable-message.js&amp;3.17.2/datatable-mutable/datatable-mutable.js&amp;3.17.2/datatable-sort/lang/datatable-sort_en.js&amp;3.17.2/datatable-sort/datatable-sort.js&amp;3.17.2/datasource-local/datasource-local.js&amp;3.17.2/datatable-datasource/datatable-datasource.js&amp;3.17.2/resize-base/resize-base.js&amp;3.17.2/resize-plugin/resize-plugin.js&amp;m/1422191229/core_filepicker/core_filepicker.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/dd-ddm/dd-ddm.js&amp;3.17.2/dd-ddm-drop/dd-ddm-drop.js&amp;3.17.2/dd-proxy/dd-proxy.js&amp;3.17.2/dd-constrain/dd-constrain.js&amp;3.17.2/dd-drop/dd-drop.js&amp;3.17.2/dd-scroll/dd-scroll.js&amp;3.17.2/dd-drop-plugin/dd-drop-plugin.js&amp;3.17.2/dd-delegate/dd-delegate.js&amp;m/1422191229/core/notification/notification-alert-debug.js&amp;m/1422191229/core/notification/notification-exception-debug.js&amp;m/1422191229/core/notification/notification-ajaxexception-debug.js&amp;m/1422191229/core/notification/notification-debug.js&amp;m/1422191229/core/dragdrop/dragdrop-debug.js&amp;m/1422191229/core/blocks/blocks-debug.js");
+	// Init moodle form js
+	if (M.form && M.form.shortforms) { 
+	    M.form.shortforms({"formid":"mform1"});
+	}
+	// Create panel object
+	var panel = new Y.Panel({
+	    srcNode      : CSS.PANELCONTENT,
+	    headerContent: 'Add an activity or resource',
+	    width        : 1000,
+	    zIndex       : 5,
+	    centered     : true,
+	    modal        : true,
+	    visible      : false,
+	    render       : true,
+	    plugins      : []
+	});
+	// Set reaction on "Save and return to course" and "Cancel"
+	Y.one(CSS.SUBMITBUTTON).on('click', this.submit_click,this);
+	Y.one(CSS.CANCELBUTTON).on('click', function (e1) {
+	    e1.preventDefault();
+	    panel.hide();	    
+	    this.panelContent.remove();
+	    this.init();
+	},this);
+	// Move panel down, if it partially visible
+	if (this.panelContent.getY() < 50) {
+	    this.panelContent.setY(50);
+	}
+	//Show panel
+	panel.show();
+    },
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method submit_click
+     * @param {event} e event object
+     * @param {object} self dialogue object
+     */
+    on_click: function (e,self) {
+	e.preventDefault();
+	// AJAX request to get information to form
+	var url = this.get('href') + '&isformajax=1';
+	var cfg = {
+	    on: {
+		success: self.show_form
+	    },
+	    arguments: {
+		success: self
+	    }
+	}
+	Y.io(url, cfg);			
+    },
+    /**
+     * Set up the activity form.
+     *
+     * @method init
+     */
+    init : function(){
+	var nodelist = Y.all(CSS.INITBUTTON);
+        for (var i = 0; i < nodelist.size(); i++) nodelist.item(i).on('click',this.on_click,nodelist.item(i),this); 
+	M.course.coursebase.register_module(this);
+    }
+},
+{
+    NAME : DIALOGNAME,
+    ATTRS : {
+        /**
+         * The maximum height (in pixels) of the activity chooser.
+         *
+         * @attribute maxheight
+
+         * @type Number
+         * @default 800
+         */
+        maxheight : {
+            value : 800
+        }
+    }
+});
+M.course = M.course || {};
+M.course.init_dialogupdate = function(config) {
+    return new DIALOG();
+};
+
+
+}, '@VERSION@', {"requires": ["moodle-course-coursebase", "moodle-form-shortforms","moodle-form","moodle-form_filemanager","moodle-form_dndupload"]});
diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js
index 1689ac9..6efb12a 100644
--- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js
+++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js
@@ -130,6 +130,9 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
             this.sectionid = 0;
         }
         this.display_chooser(e);
+        // Set up mod add settings dialog
+        M.course.init_dialogadd();
+        Y.one(".moodle-dialogue-base .submitbutton[type=submit][value=Add]").on('click', this.cancel_popup, this);
     },
 
     /**
@@ -225,4 +228,4 @@ M.course.init_chooser = function(config) {
 };
 
 
-}, '@VERSION@', {"requires": ["moodle-core-chooserdialogue", "moodle-course-coursebase"]});
+}, '@VERSION@', {"requires": ["moodle-core-chooserdialogue", "moodle-course-coursebase", "moodle-course-dialogadd"]});
diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js
index 1f08287..e175777 100644
--- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js
+++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js
@@ -1 +1 @@
-YUI.add("moodle-course-modchooser",function(e,t){var n={PAGECONTENT:"body",SECTION:null,SECTIONMODCHOOSER:"span.section-modchooser-link",SITEMENU:"div.block_site_main_menu",SITETOPIC:"div.sitetopic"},r="course-modchooser",i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.chooserdialogue,{sectionid:null,initializer:function(){var t=M.course.format.get_sectionwrapperclass();t&&(n.SECTION="."+t);var r=e.one(".chooserdialoguebody"),i=e.one(".choosertitle"),s={};this.setup_chooser_dialogue(r,i,s),this.setup_for_section(),M.course.coursebase.register_module(this),e.all(".block_settings #settingsnav .type_course .modchoosertoggle a").on("click",this.toggle_mod_chooser,this)},setup_for_section:function(t){t||(t=n.PAGECONTENT),e.one(t).all(n.SITETOPIC).each(function(e){this._setup_for_section(e)},this),n.SECTION&&e.one(t).all(n.SECTION).each(function(e){this._setup_for_section(e)},this),e.one(t).all(n.SITEMENU).each(function(e){this._setup_for_section(e)},this)},_setup_for_section:function(t){var r=t.one(n.SECTIONMODCHOOSER);if(!r)return;var i=e.Node.create("<a href='#' />");r.get("children").each(function(e){i.appendChild(e)}),r.insertBefore(i),i.on("click",this.display_mod_chooser,this)},display_mod_chooser:function(e){if(e.target.ancestor(n.SITETOPIC))this.sectionid=1;else if(e.target.ancestor(n.SECTION)){var t=e.target.ancestor(n.SECTION);this.sectionid=t.get("id").replace("section-","")}else e.target.ancestor(n.SITEMENU)&&(this.sectionid=0);this.display_chooser(e)},toggle_mod_chooser:function(t){var n=e.all("div.addresourcemodchooser"),r=e.all("div.addresourcedropdown");if(n.size()===0)return;var i=e.one(".block_settings #settingsnav .type_course .modchoosertoggle a"),s=i.get("lastChild"),o;n.item(0).hasClass("visibleifjs")?(o=0,n.removeClass("visibleifjs").addClass("hiddenifjs"),r.addClass("visibleifjs").removeClass("hiddenifjs"),s.set("data",M.util.get_string("modchooserenable","moodle")),i.set("href",i.get("href").replace("off","on"))):(o=1,n.addClass("visibleifjs").removeClass("hiddenifjs"),r.removeClass("visibleifjs").addClass("hiddenifjs"),s.set("data",M.util.get_string("modchooserdisable","moodle")),i.set("href",i.get("href").replace("on","off"))),M.util.set_user_preference("usemodchooser",o),t.preventDefault()},option_selected:function(e){this.hiddenRadioValue.setAttrs({name:"jump",value:e.get("value")+"&section="+this.sectionid})}},{NAME:r,ATTRS:{maxheight:{value:800}}}),M.course=M.course||{},M.course.init_chooser=function(e){return new i(e)}},"@VERSION@",{requires:["moodle-core-chooserdialogue","moodle-course-coursebase"]});
+YUI.add("moodle-course-modchooser",function(e,t){var n={PAGECONTENT:"body",SECTION:null,SECTIONMODCHOOSER:"span.section-modchooser-link",SITEMENU:"div.block_site_main_menu",SITETOPIC:"div.sitetopic"},r="course-modchooser",i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.chooserdialogue,{sectionid:null,initializer:function(){var t=M.course.format.get_sectionwrapperclass();console.log("dialog init end222");t&&(n.SECTION="."+t);var r=e.one(".chooserdialoguebody"),i=e.one(".choosertitle"),s={};this.setup_chooser_dialogue(r,i,s),this.setup_for_section(),M.course.coursebase.register_module(this),e.all(".block_settings #settingsnav .type_course .modchoosertoggle a").on("click",this.toggle_mod_chooser,this)},setup_for_section:function(t){t||(t=n.PAGECONTENT),e.one(t).all(n.SITETOPIC).each(function(e){this._setup_for_section(e)},this),n.SECTION&&e.one(t).all(n.SECTION).each(function(e){this._setup_for_section(e)},this),e.one(t).all(n.SITEMENU).each(function(e){this._setup_for_section(e)},this)},_setup_for_section:function(t){var r=t.one(n.SECTIONMODCHOOSER);if(!r)return;var i=e.Node.create("<a href='#' />");r.get("children").each(function(e){i.appendChild(e)}),r.insertBefore(i),i.on("click",this.display_mod_chooser,this)},display_mod_chooser:function(e){if(e.target.ancestor(n.SITETOPIC))this.sectionid=1;else if(e.target.ancestor(n.SECTION)){var t=e.target.ancestor(n.SECTION);this.sectionid=t.get("id").replace("section-","")}else e.target.ancestor(n.SITEMENU)&&(this.sectionid=0);this.display_chooser(e);M.course.init_dialogadd();Y.one(".moodle-dialogue-base .submitbutton[type=submit][value=Add]").on('click',this.cancel_popup,this);},toggle_mod_chooser:function(t){var n=e.all("div.addresourcemodchooser"),r=e.all("div.addresourcedropdown");if(n.size()===0)return;var i=e.one(".block_settings #settingsnav .type_course .modchoosertoggle a"),s=i.get("lastChild"),o;n.item(0).hasClass("visibleifjs")?(o=0,n.removeClass("visibleifjs").addClass("hiddenifjs"),r.addClass("visibleifjs").removeClass("hiddenifjs"),s.set("data",M.util.get_string("modchooserenable","moodle")),i.set("href",i.get("href").replace("off","on"))):(o=1,n.addClass("visibleifjs").removeClass("hiddenifjs"),r.removeClass("visibleifjs").addClass("hiddenifjs"),s.set("data",M.util.get_string("modchooserdisable","moodle")),i.set("href",i.get("href").replace("on","off"))),M.util.set_user_preference("usemodchooser",o),t.preventDefault()},option_selected:function(e){this.hiddenRadioValue.setAttrs({name:"jump",value:e.get("value")+"&section="+this.sectionid})}},{NAME:r,ATTRS:{maxheight:{value:800}}}),M.course=M.course||{},M.course.init_chooser=function(e){return new i(e)}},"@VERSION@",{requires:["moodle-core-chooserdialogue","moodle-course-coursebase","moodle-course-dialogadd"]});
diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js
index 1689ac9..992eeb9 100644
--- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js
+++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js
@@ -44,6 +44,7 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
      * @method initializer
      */
     initializer : function() {
+    	console.log("dialog init end");
         var sectionclass = M.course.format.get_sectionwrapperclass();
         if (sectionclass) {
             CSS.SECTION = '.' + sectionclass;
@@ -130,6 +131,9 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
             this.sectionid = 0;
         }
         this.display_chooser(e);
+	// Set up mod add settings dialog
+	M.course.init_dialogadd();
+        Y.one(".moodle-dialogue-base .submitbutton[type=submit][value=Add]").on('click', this.cancel_popup, this);
     },
 
     /**
@@ -225,4 +229,4 @@ M.course.init_chooser = function(config) {
 };
 
 
-}, '@VERSION@', {"requires": ["moodle-core-chooserdialogue", "moodle-course-coursebase"]});
+}, '@VERSION@', {"requires": ["moodle-core-chooserdialogue", "moodle-course-coursebase", "moodle-course-dialog"]});
diff --git a/course/yui/src/dialogadd/build.json b/course/yui/src/dialogadd/build.json
new file mode 100644
index 0000000..5485a5d
--- /dev/null
+++ b/course/yui/src/dialogadd/build.json
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-course-dialogadd",
+  "builds": {
+    "moodle-course-dialogadd": {
+      "jsfiles": [
+        "dialogadd.js"
+      ]
+    }
+  }
+}
diff --git a/course/yui/src/dialogadd/js/dialogadd.js b/course/yui/src/dialogadd/js/dialogadd.js
new file mode 100644
index 0000000..cfac726
--- /dev/null
+++ b/course/yui/src/dialogadd/js/dialogadd.js
@@ -0,0 +1,220 @@
+/**
+ * The activity chooser dialogue for courses.
+ *
+ * @module moodle-course-modchooser
+ */
+
+var CSS = {
+    PANELCONTENT : '#panelContentAdd',
+    FORM : '#formContainer',
+    SUBMITBLOCK : '#panelContentAdd .hidden .felement.fgroup',
+    SUBMITBUTTON: '#panelContentAdd .hidden .felement.fgroup #id_submitbutton',
+    CANCELBUTTON: '#panelContentAdd .hidden .felement.fgroup #id_cancel',
+    COURSEVIEW : '#page-course-view-weeks',
+    URL : '.moodle-dialogue-base #chooserform input[type=hidden][name=jump]',
+    INITBUTTON : '.moodle-dialogue-base .submitbutton[type=submit][value=Add]'
+};
+
+var DIALOGNAME = 'course-dialogadd';
+
+/**
+ * The activity chooser dialogue for courses.
+ *
+ * @constructor
+ * @class M.course.dialogadd
+ * @extends Y.Base
+ */
+var DIALOG = function() {
+    DIALOG.superclass.constructor.apply(this, arguments);
+};
+Y.extend(DIALOG, Y.Base, {
+    /**
+     * The current panel node.
+     *
+     * @property panelContent
+     * @private
+     * @type object
+     * @default null
+     */
+    panelContent: null,
+    /**
+     * The current form node.
+     *
+     * @property form
+     * @private
+     * @type Number
+     * @default null
+     */
+    form: null,
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method submit_click
+     * @param {event} e event object
+     */
+    submit_click: function (e) {
+	e.preventDefault();
+	// Disable submit buttons to say moodle, what action we do.
+	Y.one(CSS.CANCELBUTTON).set('disabled', 'disabled');
+	Y.one(CSS.SUBMITBUTTON).set('disabled', 'disabled');
+	
+	// AJAX post form request to server side 
+	var cfg = {
+	    method: "post",
+	    on: {
+		success: this.post_success
+	    },
+	    arguments: {
+		success: this
+	    },
+	    form: { id:"mform1"}
+	}
+	Y.io("./modedit.php?isformajax=1", cfg);
+    },
+    /**
+     * Helper function, it handle response of submit form.",
+     * if no errors, update course view, else show form with errors.
+     *
+     * @method post_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    post_success : function (id, o) {
+	if(o.responseText == "") {
+	    this.panel.hide();
+	    Y.io(document.URL, {
+		on: {
+		    success: this.course_success
+		},
+		arguments: {
+		    success: this
+		}
+	    });
+	} else {
+	    this.show_form(id,o);
+	}
+    },
+     /**
+     * Helper function, update course view, else show form with errors.
+     *
+     * @method course_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    course_success : function (id, o) {
+	// Update course view
+	document.open();
+	document.write(o.responseText);
+	document.close();
+    },
+    /**
+     * Show form for setting up and update dialogue for courses.
+     *
+     * @method show_form
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    show_form: function (x, o) {
+	// Remove old panel if it exist
+	if (Y.one(CSS.PANELCONTENT)!=null) {
+	    Y.one(CSS.PANELCONTENT).remove();
+	}
+	// Create panel and append it to page
+	this.panelContent = Y.Node.create('<div>');
+	this.form = Y.Node.create('<div>');
+	this.form.set('id','formContainer');
+	this.panelContent.set('id','panelContentAdd');
+	this.panelContent.appendChild(this.form);
+	this.form.setStyle("height","500");
+	this.form.setStyle("overflow","auto");
+	Y.one(CSS.COURSEVIEW).appendChild(this.panelContent);
+	Y.one(CSS.FORM).setContent(o.responseText);
+	// Load addition js libraryes.
+	var script = Y.one(CSS.FORM).one('script').get('text');
+	Y.io("http://localhost/moodle/course/modjs.php", {
+	    method: "post",
+	    data: {'script' :script},
+	    on: {}
+	});
+	// Init moodle form js
+	if (M.form && M.form.shortforms) {
+	    M.form.shortforms({"formid":"mform1"});
+	}
+	Y.Get.js("http://localhost/moodle/course/modjs.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filemanager.js");
+	Y.Get.js("http://localhost/moodle/repository/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/javascript-static.js");
+	Y.Get.js("http://localhost/moodle/lib/form/form.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/json-stringify/json-stringify.js&amp;2in3/2.9.0/build/yui2-treeview/yui2-treeview.js&amp;3.17.2/cookie/cookie.js&amp;3.17.2/array-invoke/array-invoke.js&amp;3.17.2/model/model.js&amp;3.17.2/model-list/model-list.js&amp;3.17.2/datatable-core/datatable-core.js&amp;3.17.2/view/view.js&amp;3.17.2/datatable-head/datatable-head.js&amp;3.17.2/datatable-body/datatable-body.js&amp;3.17.2/datatable-table/datatable-table.js&amp;3.17.2/datatable-base/datatable-base.js&amp;3.17.2/datatable-column-widths/datatable-column-widths.js&amp;3.17.2/datatable-message/lang/datatable-message_en.js&amp;3.17.2/datatable-message/datatable-message.js&amp;3.17.2/datatable-mutable/datatable-mutable.js&amp;3.17.2/datatable-sort/lang/datatable-sort_en.js&amp;3.17.2/datatable-sort/datatable-sort.js&amp;3.17.2/datasource-local/datasource-local.js&amp;3.17.2/datatable-datasource/datatable-datasource.js&amp;3.17.2/resize-base/resize-base.js&amp;3.17.2/resize-plugin/resize-plugin.js&amp;m/1422191229/core_filepicker/core_filepicker.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/dd-ddm/dd-ddm.js&amp;3.17.2/dd-ddm-drop/dd-ddm-drop.js&amp;3.17.2/dd-proxy/dd-proxy.js&amp;3.17.2/dd-constrain/dd-constrain.js&amp;3.17.2/dd-drop/dd-drop.js&amp;3.17.2/dd-scroll/dd-scroll.js&amp;3.17.2/dd-drop-plugin/dd-drop-plugin.js&amp;3.17.2/dd-delegate/dd-delegate.js&amp;m/1422191229/core/notification/notification-alert-debug.js&amp;m/1422191229/core/notification/notification-exception-debug.js&amp;m/1422191229/core/notification/notification-ajaxexception-debug.js&amp;m/1422191229/core/notification/notification-debug.js&amp;m/1422191229/core/dragdrop/dragdrop-debug.js&amp;m/1422191229/core/blocks/blocks-debug.js");
+	// Create panel object
+	var panel = new Y.Panel({
+	    srcNode      : CSS.PANELCONTENT,
+	    headerContent: 'Add an activity or resource',
+	    width        : 1000,
+	    zIndex       : 5,
+	    centered     : true,
+	    modal        : true,
+	    visible      : false,
+	    render       : true,
+	    plugins      : []
+	});
+	// Set reaction on "Save and return to course" and "Cancel"
+	Y.one(CSS.SUBMITBUTTON).on('click', this.submit_click,this);
+	Y.one(CSS.CANCELBUTTON).on('click', function (e1) {
+	    e1.preventDefault();
+	    panel.hide();
+	},this);
+	// Move panel down, if it partially visible
+	if (Y.one(CSS.PANELCONTENT).getY() < 50) {
+	    Y.one(CSS.PANELCONTENT).setY(50);
+	}
+	//Show panel
+	panel.show();
+    },
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method on_click
+     * @param {event} e event object
+     * @param {object} self dialogue object
+     */
+    on_click: function (e) {
+	e.preventDefault();
+	var url;
+	var cfg = {
+	    on: {
+		success: this.show_form
+	    },
+	    arguments: {
+		success: this
+	    }
+	};	
+	url = Y.one(CSS.URL).get('value') + "&isformajax=1";
+	Y.io(url,cfg);
+    },
+    /**
+     * Set up the activity form.
+     *
+     * @method init
+     */
+    init: function(params){
+        Y.one(CSS.INITBUTTON).on('click', this.on_click,this);
+        M.course.coursebase.register_module(this);
+    }
+},
+{
+    NAME : DIALOGNAME,
+    ATTRS : {
+        maxheight : {
+            value : 800
+        }
+    }
+});
+M.course = M.course || {};
+M.course.init_dialogadd = function(config) {
+    return new DIALOG(config);
+};
\ No newline at end of file
diff --git a/course/yui/src/dialogadd/meta/dialogadd.json b/course/yui/src/dialogadd/meta/dialogadd.json
new file mode 100644
index 0000000..77fda9f
--- /dev/null
+++ b/course/yui/src/dialogadd/meta/dialogadd.json
@@ -0,0 +1,13 @@
+{
+  "moodle-course-dialogadd": {
+    "requires": [
+      "moodle-core-chooserdialogue",
+      "moodle-course-coursebase",
+      "moodle-form-shortforms",
+      "moodle-form",
+      "moodle-form_filemanager",
+      "moodle-form_dndupload"
+      ]
+
+  }
+}
diff --git a/course/yui/src/dialogupdate/build.json b/course/yui/src/dialogupdate/build.json
new file mode 100644
index 0000000..6fe8a18
--- /dev/null
+++ b/course/yui/src/dialogupdate/build.json
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-course-dialogupdate",
+  "builds": {
+    "moodle-course-dialogupdate": {
+      "jsfiles": [
+        "dialogupdate.js"
+      ]
+    }
+  }
+}
diff --git a/course/yui/src/dialogupdate/js/dialogupdate.js b/course/yui/src/dialogupdate/js/dialogupdate.js
new file mode 100644
index 0000000..e351143
--- /dev/null
+++ b/course/yui/src/dialogupdate/js/dialogupdate.js
@@ -0,0 +1,234 @@
+/**
+ * The activity setting up and update dialogue for courses.
+ *
+ * @module moodle-course-dialogupdate
+ */
+
+var CSS = {
+    PANELCONTENT : '#panelContentUpdate',
+    FORM : '#formContainer',
+    SUBMITBLOCK : '#panelContentUpdate .hidden .fitem.fitem_fgroup',
+    SUBMITBUTTON: '#panelContentUpdate .hidden .fitem.fitem_fgroup #id_submitbutton',
+    CANCELBUTTON: '#panelContentUpdate .hidden .fitem.fitem_fgroup #id_cancel',
+    COURSEVIEW : '#page-course-view-weeks',
+    INITBUTTON : 'a.editing_update.menu-action.cm-edit-action'
+};
+
+var DIALOGNAME = 'course-dialogupdate';
+
+/**
+ * The activity setting up and update dialogue for courses.
+ *
+ * @constructor
+ * @class M.course.modchooser
+ * @extends Y.Base
+ */
+var DIALOG = function() {
+    DIALOG.superclass.constructor.apply(this, arguments);
+};
+Y.extend(DIALOG, Y.Base, {
+    /**
+     * The current panel object.
+     *
+     * @property panel
+     * @private
+     * @type Object
+     * @default null
+     */
+    panel: null,
+    /**
+     * The current panel node.
+     *
+     * @property panelContent
+     * @private
+     * @type object
+     * @default null
+     */
+    panelContent: null,
+    /**
+     * The current form node.
+     *
+     * @property form
+     * @private
+     * @type Number
+     * @default null
+     */
+    form: null,
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method submit_click
+     * @param {event} e event object
+     */
+    submit_click: function (e) {
+	e.preventDefault();
+	// Disable submit buttons to say moodle, what action we do.
+	Y.one(CSS.CANCELBUTTON).set('disabled', 'disabled');
+	Y.one(CSS.SUBMITBUTTON).set('disabled', 'disabled');
+	
+	// AJAX post form request to server side 
+	var cfg = {
+	    method: "post",
+	    on: {
+		success: this.post_success
+	    },
+	    arguments: {
+		success: this
+	    },
+	    form: { id:"mform1"}
+	}
+	Y.io("./modedit.php?isformajax=1", cfg);
+    },
+    /**
+     * Helper function, it handle response of submit form.",
+     * if no errors, update course view, else show form with errors.
+     *
+     * @method post_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    post_success : function (id, o) {
+	if(o.responseText == "") {
+	    this.panel.hide();
+	    Y.io(document.URL, {
+		on: {
+		    success: this.course_success
+		},
+		arguments: {
+		    success: this
+		}
+	    });
+	} else {
+	    this.show_form(id,o);
+	}
+    },
+    /**
+     * Helper function, update course view, else show form with errors.
+     *
+     * @method course_success
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    course_success : function (id, o) {
+	// Update course view
+	document.open();
+	document.write(o.responseText);
+	document.close();
+    },
+    /**
+     * Show form for setting up and update dialogue for courses.
+     *
+     * @method show_form
+     * @param {Int} id identification number of current transaction
+     * @param {object} o response object
+     */
+    show_form: function (x, o) {
+	// Create panel and append it to page
+	this.panelContent = Y.Node.create('<div>');
+	this.form = Y.Node.create('<div>');
+	this.form.set('id','formContainer');
+	this.panelContent.set('id','panelContentUpdate');
+	this.panelContent.appendChild(this.form);
+	this.form.setStyle("height","500");
+	this.form.setStyle("overflow","auto");
+	this.form.setContent(o.responseText);
+	// Load addition js libraryes.
+	Y.one(CSS.COURSEVIEW).appendChild(this.panelContent);
+	var script = Y.one(CSS.FORM).one('script').get('text');
+	Y.io("http://localhost/moodle/course/modjs.php", {
+	    method: "post",
+	    data: {'script' :script},
+	    on: {}
+	});
+	Y.Get.js("http://localhost/moodle/course/modjs.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/form/filemanager.js");
+	Y.Get.js("http://localhost/moodle/repository/filepicker.js");
+	Y.Get.js("http://localhost/moodle/lib/javascript-static.js");
+	Y.Get.js("http://localhost/moodle/lib/form/form.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/json-stringify/json-stringify.js&amp;2in3/2.9.0/build/yui2-treeview/yui2-treeview.js&amp;3.17.2/cookie/cookie.js&amp;3.17.2/array-invoke/array-invoke.js&amp;3.17.2/model/model.js&amp;3.17.2/model-list/model-list.js&amp;3.17.2/datatable-core/datatable-core.js&amp;3.17.2/view/view.js&amp;3.17.2/datatable-head/datatable-head.js&amp;3.17.2/datatable-body/datatable-body.js&amp;3.17.2/datatable-table/datatable-table.js&amp;3.17.2/datatable-base/datatable-base.js&amp;3.17.2/datatable-column-widths/datatable-column-widths.js&amp;3.17.2/datatable-message/lang/datatable-message_en.js&amp;3.17.2/datatable-message/datatable-message.js&amp;3.17.2/datatable-mutable/datatable-mutable.js&amp;3.17.2/datatable-sort/lang/datatable-sort_en.js&amp;3.17.2/datatable-sort/datatable-sort.js&amp;3.17.2/datasource-local/datasource-local.js&amp;3.17.2/datatable-datasource/datatable-datasource.js&amp;3.17.2/resize-base/resize-base.js&amp;3.17.2/resize-plugin/resize-plugin.js&amp;m/1422191229/core_filepicker/core_filepicker.js");
+	Y.Get.js("http://localhost/moodle/theme/yui_combo.php?3.17.2/dd-ddm/dd-ddm.js&amp;3.17.2/dd-ddm-drop/dd-ddm-drop.js&amp;3.17.2/dd-proxy/dd-proxy.js&amp;3.17.2/dd-constrain/dd-constrain.js&amp;3.17.2/dd-drop/dd-drop.js&amp;3.17.2/dd-scroll/dd-scroll.js&amp;3.17.2/dd-drop-plugin/dd-drop-plugin.js&amp;3.17.2/dd-delegate/dd-delegate.js&amp;m/1422191229/core/notification/notification-alert-debug.js&amp;m/1422191229/core/notification/notification-exception-debug.js&amp;m/1422191229/core/notification/notification-ajaxexception-debug.js&amp;m/1422191229/core/notification/notification-debug.js&amp;m/1422191229/core/dragdrop/dragdrop-debug.js&amp;m/1422191229/core/blocks/blocks-debug.js");
+	// Init moodle form js
+	if (M.form && M.form.shortforms) { 
+	    M.form.shortforms({"formid":"mform1"});
+	}
+	// Create panel object
+	var panel = new Y.Panel({
+	    srcNode      : CSS.PANELCONTENT,
+	    headerContent: 'Add an activity or resource',
+	    width        : 1000,
+	    zIndex       : 5,
+	    centered     : true,
+	    modal        : true,
+	    visible      : false,
+	    render       : true,
+	    plugins      : []
+	});
+	// Set reaction on "Save and return to course" and "Cancel"
+	Y.one(CSS.SUBMITBUTTON).on('click', this.submit_click,this);
+	Y.one(CSS.CANCELBUTTON).on('click', function (e1) {
+	    e1.preventDefault();
+	    panel.hide();	    
+	    this.panelContent.remove();
+	},this);
+	// Move panel down, if it partially visible
+	if (this.panelContent.getY() < 50) {
+	    this.panelContent.setY(50);
+	}
+	//Show panel
+	panel.show();
+    },
+    /**
+     * Reaction on click "Save and return to course",
+     * validate form and update course if it's posible
+     *
+     * @method submit_click
+     * @param {event} e event object
+     * @param {object} self dialogue object
+     */
+    on_click: function (e,self) {
+	e.preventDefault();
+	// AJAX request to get information to form
+	var url = this.get('href') + '&isformajax=1';
+	var cfg = {
+	    on: {
+		success: self.show_form
+	    },
+	    arguments: {
+		success: self
+	    }
+	}
+	Y.io(url, cfg);			
+    },
+    /**
+     * Set up the activity form.
+     *
+     * @method init
+     */
+    init : function(){
+	var nodelist = Y.all(CSS.INITBUTTON);
+        for (var i = 0; i < nodelist.size(); i++) nodelist.item(i).on('click',this.on_click,nodelist.item(i),this); 
+	M.course.coursebase.register_module(this);
+    }
+},
+{
+    NAME : DIALOGNAME,
+    ATTRS : {
+        /**
+         * The maximum height (in pixels) of the activity chooser.
+         *
+         * @attribute maxheight
+
+         * @type Number
+         * @default 800
+         */
+        maxheight : {
+            value : 800
+        }
+    }
+});
+M.course = M.course || {};
+M.course.init_dialogupdate = function(config) {
+    return new DIALOG();
+};
\ No newline at end of file
diff --git a/course/yui/src/dialogupdate/meta/dialogupdate.json b/course/yui/src/dialogupdate/meta/dialogupdate.json
new file mode 100644
index 0000000..1059a83
--- /dev/null
+++ b/course/yui/src/dialogupdate/meta/dialogupdate.json
@@ -0,0 +1,11 @@
+{
+  "moodle-course-dialogupdate": {
+    "requires": [
+        "moodle-course-coursebase",
+        "moodle-form-shortforms",
+        "moodle-form",
+        "moodle-form_filemanager",
+        "moodle-form_dndupload"
+        ]
+  }
+}
diff --git a/course/yui/src/modchooser/js/modchooser.js b/course/yui/src/modchooser/js/modchooser.js
index ef6ac4d..5e20333 100644
--- a/course/yui/src/modchooser/js/modchooser.js
+++ b/course/yui/src/modchooser/js/modchooser.js
@@ -43,6 +43,7 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
      */
     initializer : function() {
         var sectionclass = M.course.format.get_sectionwrapperclass();
+
         if (sectionclass) {
             CSS.SECTION = '.' + sectionclass;
         }
@@ -128,6 +129,9 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
             this.sectionid = 0;
         }
         this.display_chooser(e);
+        // Set up mod add settings dialog
+        M.course.init_dialogadd();
+        Y.one(".moodle-dialogue-base .submitbutton[type=submit][value=Add]").on('click', this.cancel_popup, this);
     },
 
     /**
