Rev 1692 | Rev 1720 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@ page import="jomm.dao.impl.AbstractDao" %>
<%@ page import="pt.estgp.estgweb.domain.RepositoryDocumentInterfaceImpl" %>
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.domain.RepositoryDocumentInterface" %>
<%@ page import="org.json.JSONArray" %>
<%@ page import="pt.estgp.estgweb.utils.ConfigProperties" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="bacoTags" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
tr.modified td
{
border: 4px dashed orange !important;
}
</style>
<%
AbstractDao.getCurrentSession().beginTransaction();
List<RepositoryDocumentInterfaceImpl> interfaces = DaoFactory.getRepositoryDocumentInterfaceDaoImpl().findAllImpls();
JSONArray interfacesArray = RepositoryDocumentInterfaceImpl.toJsonArray(interfaces);
AbstractDao.getCurrentSession().getTransaction().commit();
%>
<div class="container-fluid">
<div id="repositoryInterfacesApp" ng-app="repositoryInterfacesApp" ng-controller="repositoryInterfacesAppController">
<script>
ping();
var repoInterfaceApp = angular.module('repositoryInterfacesApp', []);
GLOBAL_BacoAngularAppDependencies.push('repositoryInterfacesApp');
<!-- estes codigos todos do remove e do toggle e etc's não mechi em nada limitei-me a copiar dos gajos-->
repoInterfaceApp.controller('repositoryInterfacesAppController', function ($scope) {
$scope.interfaces = <%=interfacesArray.toString()%>
$scope.addInterface = function()
{
if(!$scope.interfaces)
{
$scope.interfaces = [];
}
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/repositoryDoc.do",
"addRepositoryInterface",
{
},
"#repositoryInterfacesApp",
function(json)
{
$scope.interfaces.push(json);
$scope.$apply();
});
}
$scope.updateInterface = function(i)
{
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/repositoryDoc.do",
"updateInterface",
{
"interface" : JSON.stringify(i)
},
"#repositoryInterfacesApp",
function(json)
{
delete i.modified;
$scope.$apply();
});
}
$scope.setModified = function(node)
{
node.modified = "true";
}
$scope.url = function(node)
{
$('#modalUrl .url').html("<%=ConfigProperties.getProperty("site.url")%>/repositoryInterface/" + node.slug);
$('.modal').modal("hide");
$('#modalUrl').modal({
show: 'true'
});
}
}
);
function removeInterface(id)
{
angular.element($("#repositoryInterfacesApp")).scope().removeInterface(id);
angular.element($("#repositoryInterfacesApp")).scope().$apply();
}
</script>
<div class="panel panel-primary">
<div class="panel-heading clearfix">
Interfaces do Repositório Digital
</div>
<div class="panel-body">
<div class="web-messages"></div>
<table class="tablesorter-blue">
<thead>
<tr>
<th>
</th>
<th>
ID
</th>
<th>
SLUG
</th>
<th>
Visivel
</th>
<th>
Descrição
</th>
<th>
<button ng-click="addInterface()" type="button" class="btn bnt-xs btn-success"><span class="glyphicon glyphicon-plus"></span></button>
</th>
<th>Remover</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<tr ng-class="{modified: i.modified}" ng-repeat="i in interfaces">
<td>
<a ng-show="i.modified" class="btn btn-warning btn-xs" data-nodrag ng-click="updateInterface(i)" style="margin-right: 8px;">
<span class="glyphicon glyphicon-floppy-disk"></span>
</a>
</td>
<td>{{i.id}}</td>
<td>
<input class="form-control" type="text" ng-model="i.slug" ng-change="setModified(i)"/>
</td>
<td>
<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 }]">>
</select>
</td>
<td>
<input ng-change="setModified(i)" class="form-control" type="text" ng-model="i.adminDescription"/>
</td>
<td>
<html:link styleClass="btn btn-warning" action="/user/repositoryEditInterface?id={{i.id}}">
<span class="glyphicon glyphicon-pencil"></span>
</html:link>
</td>
<td>
<%--<button class="btn btn-xs btn-danger" ng-click="removeInterface(i)" ng-confirm-click="Tem a certeza que deseja remover esta interface?">
<span class="glyphicon glyphicon-remove"></span>
</button>--%>
<bacoTags:confirm targetFunction="removeInterface({{i.id}})" icon="glyphicon glyphicon-remove" msg="Tem a certeza que deseja remover esta interface?" ng_click="removeInterface(i)"/>
</td>
<td>
<button ng-click="url(i)" class="btn btn-default"><span class="glyphicon glyphicon-globe"></span></button>
</td>
</tr>
</tbody>
</table>
<%-- <pre class="code">{{ interfaces | json }}</pre>--%>
</div>
</div>
</div>
</div>
<%--URL MODAL--%>
<div class="modal fade" id="modalUrl" role="dialog" >
<div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title">URL DA INTERFACE</h1>
</div>
<div class="modal-body">
<div class="panel panel-default">
O URL desta interface é o seguinte:
<pre class="url"></pre>
</div>
<button type="button" class="btn btn-default" data-dismiss="modal">Entendi</button>
</div>
</div>
</div>
</div>