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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
|
{% extends "ndf/base.html" %}
{% load i18n %}
{% load ndf_tags %}
{% get_group_name groupid as group_name_tag %}
{% block title %} {{title}} {% endblock %}
{% block style %}
.first-load { display: none; }
.tabs dd.active a, .tabs .tab-title.active a { background-color: #f7f7f7; }
.tabs dd.active{ width: 100%; }
{% endblock %}
<!--
{% comment %}
{% block help_content %}
<h3>{% trans "Files" %}</h3>
<p>
{% trans "Upload your files from your computer to metaStudio. You can view the existing files in the group and create collections." %}
</p>
{% endblock %}
{% endcomment %}
-->
<!-- shelf part is commented for being not active -->
<!--
{% comment %}
{% block shelf_content %}
{% if user.is_authenticated %}
{% include "ndf/shelf.html" %}
{% else %}
<h4>Please Login to create your shelf</h4>
{% endif %}
{% endblock %}
{% endcomment %}
-->
<!-- left top panel -->
{% block meta_content %}
<h2 class="subheader">{% trans title %}</h2>
{% endblock %}
{% block related_content %}
{% check_user_join request groupid as user_is_joined %}
<div class="panel" style="background-color:#ddd;">
<!-- radio buttons for E-Library app: CR and XCR -->
{% comment %}
<!--
{% if title == "E-Library" %}
<input type="radio" name="crxcr" value="cr" id="cr-rad" title="Curricular">
<label for="cr-rad" title="Curricular">CR</label>
<input type="radio" name="crxcr" value="xcr" id="xcr-rad" title="Extra Curricular">
<label for="xcr-rad" title="Extra Curricular">XCR</label>
{% endif %}
-->
{% endcomment %}
<ul class="side-nav">
<dl class="tabs" data-tab >
<!-- all files -->
<dd class="active" data-filetype="all">
<a href="#view-all">
<i class="fi-eye"></i>
{% trans "All files" %}
<span class="count">
{% if file_pages.count > 0 %} ({{ file_pages.count }}) {% endif %}
</span>
</a>
</dd><br/>
<!-- Documents -->
<dd data-filetype="Documents">
<a href="#view-doc">
<i class="fi-page-filled"></i>
{% trans "Documents" %}
<span class="count">
{% if doc_pages %} ({{ doc_pages }}) {% endif %}
</span>
</a>
</dd><br/>
<!-- Interactives -->
{% if interactive_pages %}
<dd data-filetype="Interactives">
<a href="#view-interactive">
<i class="fi-arrows-compress"></i>
{% trans "Interactives" %}
<span class="count">
({{ interactive_pages }})
</span>
</a>
</dd><br/>
{% endif %}
<!-- eBooks -->
{% if ebook_pages %}
<dd data-filetype="eBooks">
<a href="#view-ebook">
<i class="fi-book"></i>
{% trans "eBooks" %}
<span class="count">
({{ ebook_pages }})
</span>
</a>
</dd><br/>
{% endif %}
<!-- Audio -->
{% if audio_pages %}
<dd data-filetype="Audios">
<a href="#view-audio">
<i class="fi-music"></i>
{% trans "Audios" %}
<span class="count">
{% if audio_pages %} ({{ audio_pages }}) {% endif %}
</span>
</a>
</dd><br/>
{% endif %}
<!-- Image -->
<dd data-filetype="Images">
<a href="#view-image"><i class="fi-camera"></i>
{% trans "Images" %}
<span class="count">
{% if image_pages %} ({{ image_pages }}) {% endif %}
</span>
</a>
</dd><br/>
<!-- Video -->
{% if site.SITE_VIDEO == 'pandora_and_local' or site.SITE_VIDEO == 'local' %}
<dd data-filetype="Videos">
<a href="#view-video"><i class="fi-video"></i>
{% trans "Videos" %}
<span class="count">
{% if video_pages %}({{ video_pages }}) {% endif %}
</span>
</a>
</dd><br/>
{% endif %}
<!-- Pandora -->
{% comment %}
<!--
{% if site.SITE_VIDEO == 'pandora_and_local' %}
<dd data-filetype="Videos">
<a href="#view-pandora-video"><i class="fi-video"></i>
{% trans "Pandora Videos" %}
</a>
</dd><br/>
{% endif %}
-->
{% endcomment %}
{% if site.SITE_VIDEO == 'pandora' %}
<dd data-filetype="Videos">
<a href="#view-pandora-video"><i class="fi-video"></i>
{% trans "Videos" %}
<span class="count">
{% if video_pages %}({{ video_pages }}){% endif %}
</span>
</a>
</dd><br/>
{% endif %}
{% if title != "E-Library" %}
<dd>
<a href="#view-collection">
<i class="fi-page-multiple"></i> {% trans "Collections" %}
</a>
</dd><br/>
{% endif %}
</dl><br/>
{% if user.is_authenticated %}
{% if user_is_joined == "joined" or user_is_joined == "author" %}
<b>{% trans "Actions" %}</b><br/><br/>
{% user_access_policy groupid request.user as user_access %}
{% if user_access == "allow" %}
<a href="{% url 'uploadDoc' group_name_tag %}?next={{request.path}}" class="tiny round button">
{% trans "Upload File" %}
</a><br/><br/>
{% endif %}
<b>{% trans "Review" %}</b><br/><br/>
{% user_access_policy groupid request.user as user_access %}
{% if user_access == "allow" %}
<a href="{% url 'data_review' group_name_tag %}" class="tiny round button">
{% trans "Data Review" %}
</a>
{% endif %}
{% endif %}
{% endif %}
<a href="#" data-reveal-id="library-statistics" class="tiny round button">
{% trans "File Statistics" %}
</a>
<div class="medium reveal-modal" id="library-statistics" data-reveal>
{% include "ndf/file_statistics.html" %}
<a class="close-reveal-modal">×</a>
</div>
</ul>
</div>
{% endblock %}
<!-- END of left panel -->
{% block body_content %}
{% if files.count > 1 and title == "E-Library" %}
{% get_filters_data "File" as filter_dict %}
{% include "ndf/filters.html" with filter_dict=filter_dict %}
{% endif %}
<div class="tabs-content gallery">
{% if already_uploaded %}
<div id="message">
<span style="color:red">
{% trans "Files Listed below are already uploaded. Duplicate file uploads are not possible." %}
</span>
<ul>
{% for each in already_uploaded %}
<li><b>"{{each}}"</b> {% trans "this file is already uploaded please choose different file" %} </li>
{% endfor %}
</ul>
</div>
{% endif %}
{% group_type_info groupid request.user as grouptype %}
<!-- Tab View #1 - All -->
<div class="content row active" id="view-all" data-filetype="all">
{% include "ndf/file_list_tab.html" with resource_type=files detail_urlname="file_detail" filetype="all" res_type_name="" page_info=file_pages %}
</div>
<!-- Tab View 2 - Documents -->
<div class="content" id="view-doc" data-filetype="Documents">
{% if title == "E-Library" %}
<a href='{% url "elib_paged_file_objs" group_name_tag "Documents" 1 %}' class="first-load">1</a>
{% else %}
<a href='{% url "paged_file_objs" group_name_tag "Documents" 1 %}' class="first-load">1</a>
{% endif %}
</div>
<!-- Tab View 3 - Interactives -->
{% if interactive_pages %}
<div class="content" id="view-interactive" data-filetype="Interactives">
{% if title == "E-Library" %}
<a href='{% url "elib_paged_file_objs" group_name_tag "Interactives" 1 %}' class="first-load">1</a>
{% else %}
<a href='{% url "paged_file_objs" group_name_tag "Interactives" 1 %}' class="first-load">1</a>
{% endif %}
</div>
{% endif %}
<!-- Tab View 4 - e-book -->
{% if ebook_pages %}
<div class="content" id="view-ebook" data-filetype="eBooks">
{% if title == "E-Library" %}
<a href='{% url "elib_paged_file_objs" group_name_tag "eBooks" 1 %}' class="first-load">1</a>
{% else %}
<a href='{% url "paged_file_objs" group_name_tag "eBooks" 1 %}' class="first-load">1</a>
{% endif %}
</div>
{% endif %}
<!-- Tab View 5 - Audios -->
{% if audio_pages %}
<div class="content" id="view-audio" data-filetype="Audios">
{% if title == "E-Library" %}
<a href='{% url "elib_paged_file_objs" group_name_tag "Audios" 1 %}' class="first-load">1</a>
{% else %}
<a href='{% url "paged_file_objs" group_name_tag "Audios" 1 %}' class="first-load">1</a>
{% endif %}
</div>
{% endif %}
<!-- Tab View 6 - Images -->
<div class="content" id="view-image" data-filetype="Images">
{% if title == "E-Library" %}
<a href='{% url "elib_paged_file_objs" group_name_tag "Images" 1 %}' class="first-load">1</a>
{% else %}
<a href='{% url "paged_file_objs" group_name_tag "Images" 1 %}' class="first-load">1</a>
{% endif %}
</div>
<!-- Tab View 7 - Videos -->
<div class="content" id="view-video" data-filetype="Videos">
{% if title == "E-Library" %}
<a href='{% url "elib_paged_file_objs" group_name_tag "Videos" 1 %}' class="first-load">1</a>
{% else %}
<a href='{% url "paged_file_objs" group_name_tag "Videos" 1 %}' class="first-load">1</a>
{% endif %}
</div>
<!-- Tab View 8 - pandora Videos -->
<div class="content" id="view-pandora-video" data-filetype="Videos">
{% if title == "E-Library" %}
<a href='{% url "elib_paged_file_objs" group_name_tag "Videos" 1 %}' class="first-load">1</a>
{% else %}
<a href='{% url "paged_file_objs" group_name_tag "Videos" 1 %}' class="first-load">1</a>
{% endif %}
</div>
<div class="content" id="view-collection" data-filetype="collection">
{% get_resource_collection groupid title as file_collections %}
{% include "ndf/file_list_tab.html" with resource_type=file_collections detail_urlname="file_detail" filetype="collection" res_type_name="collection" %}
</div>
</div>
{% endblock %}
{% block script %}
// <script type="text/javascript">
// pagination ajax
$('ul.pagination a').click(function(e)
{
e.preventDefault();
populateFileList(this);
});
isFilterChanged = false;
function ddLHSBindEvents(){
$("dl.tabs dd").click(function(e){
var tabDivId = $(this).children("a").attr("href");
if((tabDivId != "#view-collection") && (tabDivId != "view-pandora-video"))
{
var pageAnchor = $(tabDivId).children("a.first-load")[0];
if(! pageAnchor)
{
var pageAnchor = $(tabDivId).find("ul.pagination > li > a:first")[0];
}
if(pageAnchor)
{
populateFileList(pageAnchor);
}
}
// check the origin of click. Via filter-triggered or normal-click.
if(!e.originalEvent && e.isTrigger) // filter-triggered
{
isFilterChanged = true;
}
else // normal-click.
{
isFilterChanged = false;
}
$(this).off("click");
});
}
ddLHSBindEvents();
function populateFileList(pageAnchor)
{
var filetype = pageAnchor.href.split("/")[5],
page_no = pageAnchor.text.trim(),
no_of_objs_pp = 24,
url = pageAnchor.href.substr(pageAnchor.href.search(pageAnchor.host)+pageAnchor.host.length);
// getting already added filers as an array of objects, holding entire properties of it.
{% if title == "E-Library" %}
var filtersObjArr = JSON.stringify(getFiltersObjsInAndOrFormat());
{% endif %}
var tabContainerDiv = $(pageAnchor).closest("div.content");
$.ajax({
type: 'POST',
url: url,
datatype: 'html',
data: {
title: "{{title}}",
filetype: filetype,
page_no: page_no,
no_of_objs_pp: no_of_objs_pp,
{% if title == "E-Library" %}
filters: filtersObjArr,
{% endif %}
csrfmiddlewaretoken: '{{ csrf_token }}'
},
success: function(data){
$(tabContainerDiv).html(data);
// making newly loaded html pagination <a> non clickable and bind with populateFileList()
$(tabContainerDiv).find("ul.pagination a").click(function(e){
e.preventDefault();
populateFileList(this);
});
if(isFilterChanged) { updateLHSpanelCounters(); }
}
});
}
// providing function to handle filtering part
function applyFilter(filtersArr)
{
var url = html = "";
{% if title == "E-Library" %}
href = '{% url "elib_paged_file_objs" group_name_tag "replace-this" 1 %}';
urlHtml = "<a href="+href+" class='first-load'>1</a>";
{% else %}
href = '{% url "paged_file_objs" group_name_tag "replace-this" 1 %}';
urlHtml = "<a href="+href+" class='first-load'>1</a>";
{% endif %}
// console.log(url);
$("div.tabs-content.gallery > div.content").each(function(){
var tempFiletype = this.getAttribute("data-filetype");
$(this).html(urlHtml.replace("replace-this", tempFiletype));
});
ddLHSBindEvents();
$("dl.tabs dd:first a").trigger("click")
}
function updateLHSpanelCounters()
{
var educationaluse_stats = $("div[data-educationaluse-stats]").attr("data-educationaluse-stats")
// console.log("innnn : " + educationaluse_stats);
educationaluse_stats = JSON.parse(educationaluse_stats);
$("dl.tabs dd").each(function(){
var c = this.getAttribute("data-filetype");
if(educationaluse_stats.hasOwnProperty(c)){
$(this).find("a > span.count:visible").fadeOut().fadeIn().text( "(" + educationaluse_stats[c] + ")");
}
else
{
$(this).find("a > span.count:visible").fadeOut().fadeIn().text("(0)");
}
});
}
// $("input[type='radio'][name='crxcr']").change(function(){
// $("ul.pagination li.current > a").trigger("click");
// })
// --END of pagination.
// var eventhandler = function(e) { e.preventDefault();}
// $(document).on('click',".video",function(){
// //$('#body').css({opacity: "0.4"});
// $("#backcover").show();
// $('#body').bind('click', eventhandler);
// $('#pop_video').show();
// var video_id = this.id;
// var video_index = $('.video').index(this)
// var video_total = $('.video').length;
// var pre = $(".video_pre");
// var next = $(".video_next");
// var url = "/{{groupid}}/video/fullvideo/"+video_id
// $("#play_video").attr("src",url);
// $(".video_details_link").attr("href","/{{groupid}}/video/video_detail/"+video_id)
// if(video_index >= 1 && video_index < video_total-1)
// {
// pre.attr("id",video_index-1);
// next.attr("id",video_index+1);
// }
// else if(video_index == 0)
// {
// pre.hide();
// next.attr("id",video_index+1);
// }
// else if(video_index == video_total-1){
// pre.attr("id",video_index-1);
// next.hide();
// }
// else{
// pre.hide();
// next.hide();
// }
// });
// $(document).on('click',"#close",function(){
// $('#pop_video').hide();
// $("#backcover").hide();
// $("#play_video").attr("src","");
// $('#body').css({opacity: "1"});
// $('#body').unbind('click', eventhandler);
// });
// $(document).on('click',".video_pre",function(){
// var video_id = this.id;
// var video_index = parseInt(this.id);
// var video_total = $('.video').length;
// var pre = $(".video_pre");
// var next = $(".video_next");
// pre.show();
// next.show();
// var video_url = $(".video")[this.id].id
// var url = "/{{groupid}}/video/fullvideo/"+video_url
// $("#play_video").attr("src",url);
// $(".video_details_link").attr("href","/{{groupid}}/video/video_detail/"+video_url)
// if(video_index >= 1 && video_index < video_total-1)
// {
// pre.attr("id",video_index-1);
// next.attr("id",video_index + 1);
// }
// else if(video_index == 0)
// {
// pre.hide();
// next.attr("id",video_index+1);
// }
// else if(video_index == video_total-1){
// pre.attr("id",video_index-1);
// next.hide();
// }
// else{
// pre.hide();
// next.hide();
// }
// });
// $(document).on('click',".video_next",function(){
// var video_id = this.id;
// var video_index = parseInt(this.id);
// var video_total = $('.video').length;
// var pre = $(".video_pre");
// var next = $(".video_next");
// pre.show();
// next.show();
// var video_url = $(".video")[this.id].id
// var url = "/{{groupid}}/video/fullvideo/"+video_url
// $("#play_video").attr("src",url);
// $(".video_details_link").attr("href","/{{groupid}}/video/video_detail/"+video_url)
// if(video_index >= 1 && video_index < video_total-1)
// {
// pre.attr("id",video_index-1);
// next.attr("id",video_index+1);
// }
// else if(video_index == 0)
// {
// pre.hide();
// next.attr("id",video_index+1);
// }
// else if(video_index == video_total-1){
// pre.attr("id",video_index-1);
// next.hide();
// }
// else{
// pre.hide();
// next.hide();
// }
// });
{% if is_video %}
alert("Your video file uploaded succesfully, But still in process, play video about 1 hour after");
{% endif %}
// </script>
{% endblock %}
|