-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule1.js
More file actions
118 lines (101 loc) · 4.6 KB
/
module1.js
File metadata and controls
118 lines (101 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
M.show_forum_panel = {
init: function(Y, options) {
this.Y = Y;
this.spinnerpic = options.spinner;
this.mid = options.mid;
var showForumBtn = Y.one('#showForum');
showForumBtn.on('click', this.show_on_click);
},
show_on_click: function(e) {
M.show_forum_panel.showforumpanel();
},
showforumpanel: function() {
var Y = this.Y;
var url = M.cfg.wwwroot + "/blocks/ned_teacher_tools/forum_view.php?id=" + this.mid;
var div = Y.Node.create('</div><div/>');
div.set("id", "forumiframecontainer");
// Create iframe.
var ifrm = Y.Node.create('<iframe frameborder="0"><iframe>');
ifrm.set("src", url);
ifrm.set("name", "forumiframe");
ifrm.set("id", "forumiframe");
ifrm.setStyle('width', '100%');
ifrm.setStyle('height', '430px');
ifrm.setStyle('display', 'none');
div.append(ifrm);
Y.on('contentready', function(){
ifrm.setStyle('display', 'block');
}, '#forumiframe');
var panel;
panel = new Y.Panel({
bodyContent : div,
headerContent: 'Forum marking Area',
width : 950,
height : 500,
zIndex : 5,
xy : [300, -300],
centered : true,
modal : true,
visible : false,
render : true,
scroll : true,
focusOn : Y.one('#region-main-box'),
buttons: [{value : 'Close the panel',
section: 'footer',
action : function (e) {
e.preventDefault();
panel.hide();
window.location.reload();
}
},
{value : 'Close the panel',
section: 'header',
action : function (e) {
e.preventDefault();
panel.hide();
window.location.reload();
}
}]
});
panel.show();
}
};
M.block_ned_teacher_tools = {};
M.block_ned_teacher_tools.init_popup = function(Y) {
Y.on('click', function(e) {
var w = 900;
var h = 500;
// Fixes dual-screen position.
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
var newWindow = window.open(this.get('href'), M.cfg.wwwroot, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
// Puts focus on the newWindow.
if (window.focus) {
newWindow.focus();
}
e.preventDefault();
}, '.popup');
};
M.block_ned_teacher_tools.init_filter_icon = function(Y) {
Y.on('click', function(e) {
var w = 900;
var h = 500;
// Fixes dual-screen position.
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
var newWindow = window.open(this.get('href'), M.cfg.wwwroot, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
// Puts focus on the newWindow.
if (window.focus) {
newWindow.focus();
}
e.preventDefault();
}, '.popup');
};