Subversion Repositories bacoAlunos

Rev

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