Subversion Repositories bacoAlunos

Rev

Rev 1731 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1484 jmachado 1
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
1312 jmachado 2
<%@ page contentType="text/html; charset=UTF-8"  language="java"%>
3
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
4
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld"  prefix="nested" %>
5
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld"  prefix="logic" %>
6
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
7
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld"  prefix="tiles" %>
1822 jmachado 8
<%@ taglib prefix="baco" uri="/WEB-INF/tlds/baco.tld" %>
1731 jmachado 9
<%--Esta declaracao tem de estar antes das proximas que sao dependentes desta--%>
10
<script>
11
    var GLOBAL_BacoAngularAppDependencies = [];
12
    var bacoAngularApp = angular.module('BacoAngularApp', GLOBAL_BacoAngularAppDependencies);
1312 jmachado 13
 
1577 jmachado 14
 
1731 jmachado 15
 
16
 
17
    /* Isto daria para colocar numa app nossa lá no meio para adicionar material vindo do Ajax
18
    bacoAngularApp.directive('dynamic', function ($compile) {
19
        return {
20
            replace: true,
21
            link: function (scope, ele, attrs) {
22
                scope.$watch(attrs.dynamic, function(html) {
23
                    if (!html) {
24
                        return;
25
                    }
26
                    ele.html((typeof(html) === 'string') ? html : html.data);
27
                    $compile(ele.contents())(scope);
28
                });
29
            }
30
        };
31
    });
32
    */
33
    /**
34
     * AngularHelper : Contains methods that help using angular without being in the scope of an angular controller or directive
35
     */
36
    var AngularHelper = (function () {
37
        var AngularHelper = function () { };
38
 
39
        /**
40
         * ApplicationName : Default application name for the helper
41
         */
42
        var defaultApplicationName = "myDefaultAppName";
43
 
44
        /**
45
         * Compile : Compile html with the rootScope of an application
46
         *  and replace the content of a target element with the compiled html
47
         * @$targetDom : The dom in which the compiled html should be placed
48
         * @htmlToCompile : The html to compile using angular
49
         * @applicationName : (Optionnal) The name of the application (use the default one if empty)
50
         */
51
        AngularHelper.Compile = function ($targetDom, htmlToCompile, applicationName) {
52
            var $injector = angular.injector(["ng", applicationName || defaultApplicationName]);
53
 
54
            $injector.invoke(["$compile", "$rootScope", function ($compile, $rootScope) {
55
                //Get the scope of the target, use the rootScope if it does not exists
56
                var $scope = $targetDom.html(htmlToCompile).scope();
57
                $compile($targetDom)($scope || $rootScope);
58
                $rootScope.$digest();
59
            }]);
60
        }
61
 
62
        return AngularHelper;
63
    })();
64
</script>
65
 
66
 
67
<jsp:include page="intranetTools/files-upload-form.jsp"/>
68
 
69
 
70
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/angularjs/angular-ui-tree/angular-ui-tree.min.css">
71
<script type="text/javascript" src="<%=request.getContextPath()%>/js/angularjs/angular-ui-tree/angular-ui-tree.js"></script>
72
 
73
 
74
<script>
75
    //COLOCAR WEB-MESSAGES WARNING E ERROR NUMA MODAL DEPOIS DE CARREGAR A PAGINA
76
    //ESTE METODO É DE AMBITO AUTOMATICO VAI BUSCAR ERROS, REPARE NA CLASSE web-messages-errors-baco que é
77
    //colocada pelo Struts nos prefixos a partir da conf no MessageResources
78
    //Todas as mensagens desta classe são apanhadas e colocadas na modal de erros abaixo
79
    //seguidamente são mostradas em Modal
80
    $(document).ready(function()
81
    {
82
        if($(".web-messages-errors-baco").length)
1484 jmachado 83
        {
1731 jmachado 84
            var webMessages= "";
85
            $(".web-messages-errors-baco").each( function()
86
            {
87
                webMessages += $(this).html();
88
            });
89
            $('#errorsBacoModal .content-errors').html(webMessages);
90
            $('.modal').modal("hide");
91
            $('#errorsBacoModal').modal({
92
                show: 'true'
93
            });
1484 jmachado 94
        }
1731 jmachado 95
    });
96
   /* function modalWebMessages(title)
97
    {
98
        if($(".web-messages").length)
99
        {
100
            $("#modalWebMessages modal-title").html(title);
101
            $('#modalWebMessages .content-web-messages').html( $(".web-messages").html());
102
            $('#modalWebMessages .content-aditional').html( "");
103
            $('.modal').modal("hide");
104
            $('#modalWebMessages').modal({
105
                show: 'true'
106
            });
107
        }
108
    }*/
109
    function modalWebMessages(title,aditionalHtml)
110
    {
111
        if($(".web-messages").length)
112
        {
113
            $("#modalWebMessages .modal-title").html(title);
1320 jmachado 114
 
1731 jmachado 115
            var webMessages= "";
116
            $(".web-messages").each( function()
117
            {
118
                webMessages += $(this).html();
119
            });
120
            $('#modalWebMessages .content-web-messages').html( webMessages);
121
            if(aditionalHtml)
122
                $('#modalWebMessages .content-aditional').html( aditionalHtml);
123
            $('.modal').modal("hide");
124
            $('#modalWebMessages').modal({
125
                show: 'true'
126
            });
1320 jmachado 127
        }
1731 jmachado 128
    }
129
    function modalWebMessagesGivenContainer(title,refContainer)
130
    {
131
        if($(refContainer + " .web-messages").length)
132
        {
133
            $("#modalWebMessages .modal-title").html(title);
134
            var webMessages= "";
135
            $(refContainer + " .web-messages").each( function()
136
            {
137
                webMessages += $(this).html();
138
            });
139
            $('#modalWebMessages .content-web-messages').html(webMessages);
140
            $('#modalWebMessages .content-aditional').html( "");
141
            $('.modal').modal("hide");
142
            $('#modalWebMessages').modal({
143
                show: 'true'
144
            });
145
        }
146
    }
147
    function modalWebMessagesGivenContainerAndTarget(title,refContainer,targetOkUrl)
148
    {
149
        if($(refContainer + " .web-messages").length)
150
        {
151
            $("#modalWebMessages .modal-title").html(title);
152
            var webMessages= "";
153
            $(refContainer + " .web-messages").each( function()
154
            {
155
                webMessages += $(this).html();
156
            });
157
            $('#modalWebMessages .content-web-messages').html(webMessages);
158
            $('#modalWebMessages .content-aditional').html( "");
159
            $('.modal').modal("hide");
160
            $('#modalWebMessages').modal({
161
                show: 'true'
162
            });
163
            $("#modalWebMessages button[data-dismiss='modal']").unbind( "click" );
164
            $("#modalWebMessages button[data-dismiss='modal']").click(
165
                    function()
166
                    {
167
                        window.location.href = targetOkUrl;
168
                    }
169
            );
170
        }
171
    }
172
</script>
1312 jmachado 173
 
1731 jmachado 174
<div class="modal fade" id="errorsBacoModal" role="dialog" >
175
    <div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false">
176
 
177
        <!-- Modal content-->
178
        <div class="modal-content">
179
            <div class="modal-header">
180
                <h1 class="modal-title">Existem Avisos</h1>
181
            </div>
182
            <div class="modal-body">
183
                <div class="panel panel-default">
184
                    <div class="panel-body content-errors" >
185
 
186
                    </div>
187
                </div>
188
 
189
                <button type="button" class="btn btn-default" data-dismiss="modal">Entendi</button>
190
            </div>
191
        </div>
192
 
193
    </div>
194
</div>
195
 
196
<div class="modal fade" id="modalWebMessages" role="dialog" >
197
    <div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false">
198
 
199
        <!-- Modal content-->
200
        <div class="modal-content">
201
            <div class="modal-header">
202
                <h1 class="modal-title"></h1>
203
            </div>
204
            <div class="modal-body">
205
                <div class="panel panel-default">
206
                    <div class="panel-body content-web-messages" >
207
 
208
                    </div>
209
                </div>
210
                <div class="content-aditional" >
211
 
212
                </div>
213
                <button type="button" class="btn btn-default" data-dismiss="modal">Entendi</button>
214
            </div>
215
        </div>
216
 
217
    </div>
218
</div>
219
 
220
 
1312 jmachado 221
<div class="modal fade" id="historyFilesModal" role="dialog" >
222
    <div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false">
223
 
224
        <!-- Modal content-->
225
        <div class="modal-content">
226
            <div class="modal-header">
227
                <h1 class="modal-title"><bean:message key="data.history.title"/></h1>
228
            </div>
229
            <div class="modal-body">
230
                <div class="panel panel-default">
231
                    <div class="panel-body" id="contentForm">
232
                        <form class="form-horizontal" onsubmit="submitDataVersionForm();return false;">
233
                            <div class="form-group">
234
                                <label class="control-label col-sm-4" for="filesVersionsId"><bean:message key="data.history.form.input"/></label>
235
                                <div class="col-sm-6">
236
                                    <input type="text" id="filesVersionsId" class="form-control"/>
237
                                </div>
238
                            </div>
239
                            <input type="button" class="btn btn-default" onclick="submitDataVersionForm()" value="<bean:message key="submit"/>"/>
240
                            <button type="button" class="btn btn-danger" data-dismiss="modal"><bean:message key="cancel"/></button>
241
                        </form>
242
                    </div>
243
                </div>
244
                <div class="panel panel-default">
245
                    <div class="panel-body" id="contentVersions">
246
 
247
                    </div>
248
                </div>
249
                <button type="button" class="btn btn-danger" data-dismiss="modal"><bean:message key="cancel"/></button>
250
            </div>
251
        </div>
252
 
253
    </div>
254
</div>
1326 jmachado 255
 
256
 
257
 
1387 jmachado 258
 
1326 jmachado 259
<script>
1717 jmachado 260
 
261
    function alertModal(msg)
262
    {
263
        $('#alertModal').find('.InfoMessageToUser').html(msg);
264
        $('#alertModal').modal({
265
            show: 'true'
266
        });
267
    }
268
    function infoModal(msg)
269
    {
270
        $('.dynamicInfoModal').find('.InfoMessageToUser').html(msg);
271
        $('.dynamicInfoModal').modal({
272
            show: 'true'
273
        });
274
    }
275
 
1326 jmachado 276
    $(document).ready(function(){
277
        $('.confirmModal').on('show.bs.modal', function(e) {
278
            $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
279
            $(this).find('.ConfirmMessageToUser').html($(e.relatedTarget).data('message'));
280
        });
1332 jmachado 281
 
282
        $('.dynamicInfoModal').on('show.bs.modal', function(e)
283
        {
1717 jmachado 284
            if(e.relatedTarget && e.relatedTarget.data('message'))
285
            {
286
                $(this).find('.InfoMessageToUser').html($(e.relatedTarget).data('message'));
287
            }
1332 jmachado 288
        });
1333 jmachado 289
 
1717 jmachado 290
        $('.alertModal').on('show.bs.modal', function(e)
291
        {
292
            if(e.relatedTarget && e.relatedTarget.data('message'))
293
            {
294
                $(this).find('.InfoMessageToUser').html($(e.relatedTarget).data('message'));
295
            }
296
        });
297
 
1333 jmachado 298
        $('.maximize-button').click(function(e)
299
        {
300
            $($(e.currentTarget).data("target")).toggleClass('fullscreen');
301
        });
302
 
1350 jmachado 303
 
304
 
305
 
306
        $('.confirmModalFunction').on('show.bs.modal', function(e) {
307
            callbackscript = $(e.relatedTarget).data('script');
308
            $(this).find('.btn-ok').unbind('click').click(
309
                    function(){
310
                        eval(callbackscript);
311
                    }
312
            );
313
            $(this).find('.ConfirmMessageToUser').html($(e.relatedTarget).data('message'));
314
        });
315
 
1394 jmachado 316
        $('.confirmModal').on('show.bs.modal', function(e) {
317
            href = $(e.relatedTarget).data('href');
318
            $(this).find('.btn-ok').unbind('click').click(
319
                    function(){
320
                        window.location=href;
321
                    }
322
            );
323
            $(this).find('.ConfirmMessageToUser').html($(e.relatedTarget).data('message'));
324
        });
1350 jmachado 325
 
326
 
327
 
1394 jmachado 328
 
1326 jmachado 329
    });
330
</script>
1333 jmachado 331
<style>
332
    .fullscreen{
333
        z-index: 9999;
334
        width: 100%;
335
        height: 100%;
336
        position: fixed;
337
        top: 0;
338
        left: 0;
339
    }
340
</style>
341
 
1731 jmachado 342
<%--
343
    PODEMOS CRIAR OUTRAS  MODAL DA CLASSE MODAL CONFIRM sempre que quisermos
344
    A função generica acima permite que qualquer modal da classe .modalConfirm
345
    seja automaticamente preenchida com os campos ConfirmMessageToUser vindos
346
    do attributo data-message e com o btn-ok vindo do data-href
347
--%>
1326 jmachado 348
<div class="modal fade confirmModal" id="confirm-ModalGeneric" tabindex="-1" role="dialog" >
349
    <div class="modal-dialog" data-width="450" style="display: block; width: 450px; margin-top: 50px;" aria-hidden="false">
350
        <div class="modal-content">
351
            <div class="modal-header">
352
                <h4 class="modal-title">Tem a certeza que deseja efectuar a seguinte operação?</h4>
353
            </div>
354
            <div class="modal-body">
355
 
356
                <p class="ConfirmMessageToUser">
357
 
358
                </p>
359
 
360
            </div>
361
            <div class="modal-footer">
362
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
1350 jmachado 363
                <button class="btn btn-danger btn-ok">Sim</button>
364
            </div>
365
        </div>
366
    </div>
367
</div>
368
 
369
 
370
<div class="modal fade confirmModalFunction" id="confirm-ModalFunction" tabindex="-1" role="dialog" >
371
    <div class="modal-dialog" data-width="450" style="display: block; width: 450px; margin-top: 50px;" aria-hidden="false">
372
        <div class="modal-content">
373
            <div class="modal-header">
374
                <h4 class="modal-title">Tem a certeza que deseja efectuar a seguinte operação?</h4>
375
            </div>
376
            <div class="modal-body">
377
 
378
                <p class="ConfirmMessageToUser">
379
 
380
                </p>
381
 
382
            </div>
383
            <div class="modal-footer">
384
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
1326 jmachado 385
                <a class="btn btn-danger btn-ok">Sim</a>
386
            </div>
387
        </div>
388
    </div>
389
</div>
1327 jmachado 390
 
1332 jmachado 391
<div class="modal fade dynamicInfoModal" id="dynamicInfo-ModalGeneric" tabindex="-1" role="dialog" >
392
    <div class="modal-dialog" data-width="450" style="display: block; width: 450px; margin-top: 50px;" aria-hidden="false">
393
        <div class="modal-content">
394
            <div class="modal-header">
395
                <h4 class="modal-title">Informação</h4>
396
            </div>
397
            <div class="modal-body">
1327 jmachado 398
 
1332 jmachado 399
                <p class="InfoMessageToUser">
400
 
401
                </p>
402
 
403
            </div>
404
            <div class="modal-footer">
405
                <button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>
406
            </div>
407
        </div>
408
    </div>
409
</div>
410
 
1717 jmachado 411
<div class="modal fade alertModal" id="alertModal" tabindex="-1" role="dialog" >
412
    <div class="modal-dialog" data-width="450" style="display: block; width: 450px; margin-top: 50px;" aria-hidden="false">
413
        <div class="modal-content">
414
            <div class="modal-header">
415
                <h4 class="modal-title">Alerta</h4>
416
            </div>
417
            <div class="modal-body">
418
                <div class="alert alert-warning InfoMessageToUser">
1332 jmachado 419
 
1717 jmachado 420
                </div>
421
            </div>
422
            <div class="modal-footer">
423
                <button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>
424
            </div>
425
        </div>
426
    </div>
427
</div>
428
 
429
 
1327 jmachado 430
<script>
431
    $(document).ready(function(){
432
        $('#modalAjaxRequest').on('show.bs.modal', function(e)
433
        {
434
            reloadAjaxRequestModal($(e.relatedTarget));
435
        });
436
    });
437
    function reloadAjaxRequestModal(target)
438
    {
439
        $("#modalAjaxRequest .modal-title .title-wrap").html($(target).data('title'));
1524 jmachado 440
        $("#modalAjaxRequest .contentAjaxRequest").html('Por favor aguarde ... <img src="<%=request.getContextPath()%>/imgs/wait.gif"/>');
1579 jmachado 441
        var ajaxCallbackParameters = {
442
            'callback-target-url': $(target).data('callbackTargetUrl'),
1730 jmachado 443
            'callback-target-function': $(target).data('callbackTargetFunction'),
444
            'callback-target-function-token-parameter': $(target).data('callbackTargetFunctionTokenParameter')
1579 jmachado 445
        };
446
        $.post($(target).data('href'),
447
                ajaxCallbackParameters
448
                , function(data) {
1731 jmachado 449
                    $("#modalAjaxRequest .contentAjaxRequest").html(data);
450
                    evaluateTableSortersInside("#modalAjaxRequest");
451
                    invokeChosenSelects();
1524 jmachado 452
 
1731 jmachado 453
                    $('#modalAjaxRequest .reloadAjaxRequestModal').on("click",
454
                            function(e){
455
                                reloadAjaxRequestModal(e.currentTarget);
456
                            }
457
                    );
458
                });
1327 jmachado 459
    }
460
</script>
461
 
462
<div class="modal fade" id="modalAjaxRequest" role="dialog" >
463
    <div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false">
464
 
465
        <!-- Modal content-->
466
        <div class="modal-content">
1337 jmachado 467
            <div class="modal-header clearfix">
1327 jmachado 468
                <h3 class="modal-title">
469
                    <label class="title-wrap"></label>
470
                    <button type="button" class="btn btn-danger btn-xs pull-right" data-dismiss="modal"><span class="glyphicon glyphicon-remove small"></span></button>
471
                </h3>
472
            </div>
473
            <div class="modal-body">
474
                <div class="contentAjaxRequest">
475
 
476
                </div>
1332 jmachado 477
                <button type="button" class="btn btn-danger" data-dismiss="modal">Sair</button>
1327 jmachado 478
            </div>
479
        </div>
480
    </div>
1354 jmachado 481
</div>
482
 
483
 
484
<div class="modal fade" id="modalPleaseWait" role="dialog" >
485
    <div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false">
486
        <!-- Modal content-->
487
        <div class="modal-content">
488
            <div class="modal-header clearfix">
489
                <h3 class="modal-title">
490
                    <label class="title-wrap"></label>
491
                </h3>
492
            </div>
493
            <div class="modal-body">
494
                <div class="panel panel-info">
495
                    <div class="panel-body">
496
                        <p>Por favor aguarde um momento, o sistema está a carregar <img src="<%=request.getContextPath()%>/imgs/wait.gif"/></p>
497
                    </div>
498
                </div>
499
            </div>
500
        </div>
501
    </div>
502
</div>
1576 jmachado 503
 
504
 
1670 jmachado 505
 
1686 jmachado 506
<jsp:include page="/auth/loginWidget.jsp"/>