Subversion Repositories bacoAlunos

Rev

Rev 1732 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1692 jmachado 1
<%@ page import="jomm.dao.impl.AbstractDao" %>
2
<%@ page import="pt.estgp.estgweb.domain.RepositoryDocumentInterfaceImpl" %>
3
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
4
<%@ page import="java.util.List" %>
5
<%@ page import="pt.estgp.estgweb.domain.RepositoryDocumentInterface" %>
6
<%@ page import="org.json.JSONArray" %>
7
<%@ page import="pt.estgp.estgweb.utils.ConfigProperties" %>
8
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
9
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld"  prefix="nested" %>
10
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld"  prefix="logic" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
12
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld"  prefix="tiles" %>
13
<%@ taglib uri="/WEB-INF/tlds/baco.tld"  prefix="baco" %>
14
<%@ taglib tagdir="/WEB-INF/tags"  prefix="bacoTags" %>
15
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
16
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
17
 
18
<style>
19
    tr.modified td
20
    {
21
        border: 4px dashed orange !important;
22
    }
23
</style>
24
<%
25
 
26
    AbstractDao.getCurrentSession().beginTransaction();
27
    List<RepositoryDocumentInterfaceImpl> interfaces = DaoFactory.getRepositoryDocumentInterfaceDaoImpl().findAllImpls();
28
    JSONArray interfacesArray = RepositoryDocumentInterfaceImpl.toJsonArray(interfaces);
29
    AbstractDao.getCurrentSession().getTransaction().commit();
30
%>
31
 
32
<div class="container-fluid">
33
 
34
    <div id="repositoryInterfacesApp" ng-app="repositoryInterfacesApp" ng-controller="repositoryInterfacesAppController">
35
 
36
 
37
        <script>
38
            ping();
39
 
40
 
41
 
42
            var repoInterfaceApp = angular.module('repositoryInterfacesApp', []);
43
            GLOBAL_BacoAngularAppDependencies.push('repositoryInterfacesApp');
44
 
45
            <!-- estes codigos todos do remove e do toggle e etc's não mechi em nada limitei-me a copiar dos gajos-->
46
            repoInterfaceApp.controller('repositoryInterfacesAppController',  function ($scope) {
47
 
48
 
49
                        $scope.interfaces = <%=interfacesArray.toString()%>
50
 
51
 
52
 
53
 
54
                        $scope.addInterface = function()
55
                        {
56
                            if(!$scope.interfaces)
57
                            {
58
                                $scope.interfaces = [];
59
                            }
60
                            widgetCallWithActionParameters(
61
                                    "<%=request.getContextPath()%>/user/repositoryDoc.do",
62
                                    "addRepositoryInterface",
63
                                    {
64
                                    },
65
                                    "#repositoryInterfacesApp",
66
                                    function(json)
67
                                    {
68
                                        $scope.interfaces.push(json);
69
                                        $scope.$apply();
70
                                    });
71
                        }
72
 
73
                        $scope.updateInterface = function(i)
74
                        {
75
                            widgetCallWithActionParameters(
76
                                    "<%=request.getContextPath()%>/user/repositoryDoc.do",
77
                                    "updateInterface",
78
                                    {
79
                                        "interface" :  JSON.stringify(i)
80
                                    },
81
                                    "#repositoryInterfacesApp",
82
                                    function(json)
83
                                    {
84
                                        delete i.modified;
85
                                        $scope.$apply();
86
                                    });
87
                        }
88
                        $scope.setModified = function(node)
89
                        {
90
                            node.modified = "true";
91
                        }
92
 
1720 jmachado 93
                        <%
94
                            String siteUrl = ConfigProperties.getProperty("site.url");
95
                            if(siteUrl.endsWith("/"))
1722 jmachado 96
                                siteUrl = siteUrl.substring(0,siteUrl.length()-1);
1720 jmachado 97
                        %>
1692 jmachado 98
                        $scope.url = function(node)
99
                        {
1720 jmachado 100
 
101
                            $('#modalUrl .url').html("<%=siteUrl%>/repositoryInterface/" + node.slug);
1692 jmachado 102
                            $('.modal').modal("hide");
103
                            $('#modalUrl').modal({
104
                                show: 'true'
105
                            });
106
                        }
1732 jmachado 107
                        $scope.getUrl = function(node)
108
                        {
109
                            return "<%=siteUrl%>/repositoryInterface/" + node.slug;
110
                        }
1692 jmachado 111
 
112
 
113
 
114
                    }
115
 
116
            );
117
 
118
            function removeInterface(id)
119
            {
120
                angular.element($("#repositoryInterfacesApp")).scope().removeInterface(id);
121
                angular.element($("#repositoryInterfacesApp")).scope().$apply();
122
            }
123
        </script>
124
 
125
 
126
 
127
            <div class="panel panel-primary">
128
                <div class="panel-heading clearfix">
129
                    Interfaces do Repositório Digital
130
                </div>
131
                <div class="panel-body">
132
 
133
                    <div class="web-messages"></div>
134
 
135
                    <table class="tablesorter-blue">
136
                        <thead>
137
                            <tr>
138
                                <th>
139
 
140
                                </th>
141
                                <th>
142
                                    ID
143
                                </th>
144
                                <th>
145
                                    SLUG
146
                                </th>
147
                                <th>
148
                                    Visivel
149
                                </th>
150
                                <th>
151
                                    Descrição
152
                                </th>
153
                                <th>
154
                                    <button ng-click="addInterface()" type="button" class="btn bnt-xs btn-success"><span class="glyphicon glyphicon-plus"></span></button>
155
                                </th>
156
                                <th>Remover</th>
157
                                <th>URL</th>
1732 jmachado 158
                                <th>IR</th>
1692 jmachado 159
                            </tr>
160
                        </thead>
161
                        <tbody>
162
                            <tr ng-class="{modified: i.modified}" ng-repeat="i in interfaces">
163
                                <td>
164
                                    <a ng-show="i.modified" class="btn btn-warning btn-xs" data-nodrag ng-click="updateInterface(i)" style="margin-right: 8px;">
165
                                        <span class="glyphicon glyphicon-floppy-disk"></span>
166
                                    </a>
167
                                </td>
168
                                <td>{{i.id}}</td>
169
                                <td>
170
                                    <input class="form-control" type="text" ng-model="i.slug" ng-change="setModified(i)"/>
171
                                </td>
172
                                <td>
173
                                    <select ng-class="{'bg-red': i.visible == false, 'bg-green': i.visible == true}"  ng-change="setModified(i)" class="form-control chosenOff" type="text" ng-model="i.visible" ng-options="o.v as o.n for o in [{ n: 'Visivel', v: true }, { n: 'Invisivel', v: false }]">>
174
 
175
                                    </select>
176
                                </td>
177
                                <td>
178
                                    <input ng-change="setModified(i)" class="form-control" type="text" ng-model="i.adminDescription"/>
179
                                </td>
180
                                <td>
181
                                    <html:link styleClass="btn btn-warning" action="/user/repositoryEditInterface?id={{i.id}}">
182
                                        <span class="glyphicon glyphicon-pencil"></span>
183
                                    </html:link>
184
                                </td>
185
                                <td>
186
                                    <%--<button  class="btn btn-xs btn-danger" ng-click="removeInterface(i)" ng-confirm-click="Tem a certeza que deseja remover esta interface?">
187
                                        <span class="glyphicon glyphicon-remove"></span>
188
                                    </button>--%>
189
                                    <bacoTags:confirm targetFunction="removeInterface({{i.id}})" icon="glyphicon glyphicon-remove" msg="Tem a certeza que deseja remover esta interface?" ng_click="removeInterface(i)"/>
190
 
191
                                </td>
192
                                <td>
193
                                    <button ng-click="url(i)" class="btn btn-default"><span class="glyphicon glyphicon-globe"></span></button>
194
                                </td>
1732 jmachado 195
                                <td>
1760 jmachado 196
                                    <a class="btn btn-default" target="_blank" ng-href="{{getUrl(i)}}"><span class="glyphicon glyphicon-play"></span></a>
1732 jmachado 197
                                </td>
1692 jmachado 198
                            </tr>
199
                        </tbody>
200
                    </table>
201
 
202
 
203
 
204
 
205
                   <%-- <pre class="code">{{ interfaces | json }}</pre>--%>
206
 
207
                </div>
208
 
209
 
210
            </div>
211
 
212
 
213
    </div>
214
</div>
215
 
216
 
217
<%--URL MODAL--%>
218
<div class="modal fade" id="modalUrl" role="dialog" >
219
    <div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false">
220
 
221
        <!-- Modal content-->
222
        <div class="modal-content">
223
            <div class="modal-header">
224
                <h1 class="modal-title">URL DA INTERFACE</h1>
225
            </div>
226
            <div class="modal-body">
227
                <div class="panel panel-default">
228
                    O URL desta interface é o seguinte:
229
                    <pre class="url"></pre>
230
                </div>
231
                <button type="button" class="btn btn-default" data-dismiss="modal">Entendi</button>
232
            </div>
233
        </div>
234
 
235
    </div>
236
</div>
237