Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1779 → Rev 1814

/branches/v3/impl/conf/WEB-INF/tags/vfs/vfsview.tag
1,9 → 1,11
<%@ tag import="jomm.dao.impl.AbstractDao" %>
<%@ tag import="org.json.JSONArray" %>
<%@ tag import="pt.estgp.estgweb.services.pageContent.dto.VfsAbstractPageContentDto" %>
<%@ tag import="pt.estgp.estgweb.services.pageContent.dto.VfsClient" %>
<%@ tag import="pt.estgp.estgweb.services.virtualfilesystem.dto.VfsAbstractPageContentDto" %>
<%@ tag import="pt.estgp.estgweb.services.virtualfilesystem.dto.VfsClient" %>
<%@ tag import="pt.estgp.estgweb.web.exceptions.NotAuthorizedException" %>
<%@ tag import="org.json.JSONObject" %>
<%@ tag import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ tag import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@tag description="Tag to Call Ajax Request" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
19,8 → 21,181
<%
//TAG CARLOS FUSCO PARA VFS VIEW
%>
<h2>Exemplo de vista do VFS VIEW</h2>
 
 
<style>
.btn {
margin-right: 8px;
}
 
.tree-node,.angular-ui-tree-handle {
background: #f8faff;
border: 1px solid #dae2ea;
color: #7c9eb2;
padding: 10px 10px;
}
 
.ui-tree-node
{
padding: 10px;
}
.angular-ui-tree-handle:hover {
color: #438eb9;
background: #f4f6f7;
border-color: #dce2e8;
}
 
.angular-ui-tree-placeholder {
background: #f0f9ff;
border: 2px dashed #bed2db;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
 
.nodeEmpty {
height: 50px;
margin:10px;
margin-left: 30px;
border: 1px dashed blue;
}
 
.group-title {
background-color: #687074 !important;
color: #FFF !important;
}
 
 
/* --- Tree --- */
.tree-node {
border: 1px solid #dae2ea;
background: #f8faff;
color: #7c9eb2;
}
.tree-node-document {
border: 1px solid #000000;
background: #ffffff;
color: #000000;
}
.tree-node-file {
border: 1px solid #e8ea99;
background: #fffae7;
color: #b2a418;
}
 
.tree-node-description {
border: 1px dashed #7f7f7e;
background: #e5e5e3;
color: #0d0c01;
}
 
.nodrop {
background-color: #f2dede;
}
 
 
.nodrag {
background-color: #f2eec1;
}
 
.tree-node-content {
margin: 10px;
}
 
.lateMoved
{
border: 2px solid #65ebff !important;
}
/*Estilo adicionado por mim para os movidos*/
.moved
{
border: 2px solid blue !important;
}
 
 
.modified
{
border: 4px dashed orange !important;
}
 
.checked
{
background-color: lightskyblue;
}
 
#container{
padding-top: 20px;
 
}
 
#treeAppPageContent, #treeAppPageContentInfo{
 
 
}
 
#panelTree{
 
}
 
#panelInfo{
min-height: 500px;
}
 
.panel-default {
min-height:100vh;
}
 
#loading{
margin: auto;
width: 40%;
}
 
.loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #7c9eb2;
border-bottom: 16px solid #7c9eb2;
width: 120px;
height: 120px;
margin-top: 80px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}
 
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
 
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
 
.progress-bar {
background-color: #7c9eb2 !important;
height: 100%;
color: white !important;
 
}
 
.blue{
color: lightblue !important;
}
 
.glyphicon.glyphicon-link.blue{
color: #7c9eb2 !important;
}
 
.glyphicon.glyphicon-download.blue{
color: #7c9eb2 !important;
}
 
</style>
 
<div class="container-fluid" id="container">
 
 
<%
AbstractDao.getCurrentSession().beginTransaction();
VfsClient vfsClient = new VfsClient();
38,186 → 213,482
throw new NotAuthorizedException("O VFS apenas pode carregar secções");
}
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{null};
//JSONArray rootsArray = (JSONArray) sm.execute(RequestUtils.getRequester(request, response),"OpenVirtualFileSystem", args, names);
 
JSONArray rootsArray = new JSONArray();
JSONObject jsonObject = vfsAbstractPageContentDto.toJsonObject();
AbstractDao.getCurrentSession().beginTransaction();
rootsArray.put(jsonObject);
//String vfsJson = rootsArray.toString();
request.setAttribute("vfsJson",rootsArray);
 
//CODIGO PARA ALTERAR ESTE É APENAS PROVISORIO
 
%>
<%-- chamar aqui outro serviço em vez de ser o openvfs!!! tem que ser o loadsection ou do género!!! substituir o que está em cima que diz respeito ao dto
 
 
JSONArray rootsArray = new JSONArray();
<%--JSONArray rootsArray = new JSONArray();
JSONObject jsonObject = vfsAbstractPageContentDto.toJsonObject();
rootsArray.put(jsonObject);
request.setAttribute("rootsArray",rootsArray);
%>
request.setAttribute("rootsArray",rootsArray);--%>
 
 
<div class="col-md-6" id="treeAppPageContent" ng-app="treeAppPageContent" ng-controller="treeAppPageContentController">
 
<div id="treeAppPageContent" ng-app="treeAppPageContent" ng-controller="treeAppPageContentController">
<script>
var treeAppPageContent = angular.module('treeAppPageContent', ['ui.tree']);
GLOBAL_BacoAngularAppDependencies.push('treeAppPageContent');
<script>
 
<!-- estes codigos todos do remove e do toggle e etc's não mechi em nada limitei-me a copiar dos gajos-->
treeAppPageContent.controller('treeAppPageContentController', function ($scope,$filter) {
$scope.treeOptions = {
accept: function(sourceNodeScope, destNodesScope, destIndex) {
return true;
},
dropped: function(e) {
console.log (e.source.nodeScope.$modelValue);
//alert ("Largado o nó com titulo: " + e.source.nodeScope.$modelValue.title);
e.source.nodeScope.$modelValue.moved = true;
var treeAppPageContent = angular.module('treeAppPageContent', ['ui.tree']);
GLOBAL_BacoAngularAppDependencies.push('treeAppPageContent');
 
}
};
$scope.remove = function (scope) {
scope.remove();
};
treeAppPageContent.controller('treeAppPageContentController', function($scope){
 
$scope.toggle = function (scope) {
scope.toggle();
};
$scope.data = ${vfsJson};
$scope.onlyVisibles = false;
 
$scope.moveLastToTheBeginning = function () {
var a = $scope.data.pop();
$scope.data.splice(0, 0, a);
};
$scope.lateItemsMovedIds = [];
 
$scope.newSubItem = function (scope) {
var nodeData = scope.$modelValue;
var newSlug =nodeData.slug + '_' + (nodeData.childs.length + 1);
nodeData.childs.push({
id: nodeData.id * 10 + nodeData.childs.length,
title: nodeData.title + '.' + (nodeData.childs.length + 1),
slug: newSlug,
path: nodeData.path + '/' + newSlug,
nodes: []
});
};
$scope.itemToShow = {};
 
$scope.collapseAll = function () {
$scope.$broadcast('angular-ui-tree:collapse-all');
};
$scope.treeOptions = {
accept: function(sourceNodeScope, destNodesScope, destIndex) {
return true;
},
dropped: function(e) {
//nothing to drop
}
};
 
$scope.expandAll = function () {
$scope.$broadcast('angular-ui-tree:expand-all');
};
$scope.openItem = function(parentNode){
if(parentNode.open && parentNode.open == true){
 
$scope.openItem = function(item)
{
if(item.open && item.open==true)
{
//Desligamos o Close se nao isto é uma trapalhada para os elementos que já perderam filhos
//e depois iamos abri-los novamente
//item.open=false;
//delete item.childs;
//$scope.removeCheckedItems(parentNode);
parentNode.open=false;
 
delete parentNode.childs;
}
else{
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/virtuaFileSystemControl.do",
"openVfs",{
"id": parentNode.id
},
"#treeAppPageContent",
function(json){
parentNode.childs = json.itemGroups;
parentNode.open = true;
$scope.$apply();
}
else
{
$.getJSON("<%=request.getContextPath()%>/user/pagecontent/jorgeaux/section.jsp",{path:item.path},
function(json){
item.childs = json;
item.open = true;
angular.element($("#treeAppPageContent")).scope().$apply();
});
}
);
}
}
 
$scope.checkedItems = [];
 
$scope.checkItem = function(item,parent){
if(item.checked){
var itemContainer={
"item": item,
"parent": parent
}
$scope.checkedItems.push(itemContainer);
}
else{
angular.forEach($scope.checkedItems, function(itemContainer){
if(itemContainer.item == item){
var index = $scope.checkedItems.indexOf(itemContainer);
$scope.checkedItems.splice(index,1);
}
});
}
}
 
$scope.data = ${rootsArray}
$scope.moveItem = function(parent){
var itemIdsToMove = [];
 
$scope.findContent = function(contents,id)
{
var i = 0;
for(i = 0; i < contents.length;i++)
{
if(contents[i].id == id)
return contents[i];
if(contents[i].childs)
{
var innerCol = $scope.findContent(contents[i].childs,id);
if(innerCol != null)
return innerCol;
}
angular.forEach($scope.checkedItems, function(itemContainer){
itemIdsToMove.push(itemContainer.item.id)
});
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/virtuaFileSystemControl.do",
"changeItemSection",{
"newSectionId": parent.id,
"elementsIds": JSON.stringify(itemIdsToMove)
},
"#treeAppPageContent",
function(){
$scope.movedIds = [];
angular.forEach($scope.checkedItems, function(itemContainer){
$scope.movedIds.push(itemContainer.item.id);
$scope.lateItemsMovedIds.push(itemContainer.item.id);
});
 
if(parent.open && parent.open == true){
angular.forEach($scope.checkedItems, function(itemContainer){
parent.childs.push(itemContainer.item);
delete itemContainer.item.checked;
});
}
else{
$scope.openItem(parent);
}
 
return null;
angular.forEach($scope.checkedItems, function(itemContainer){
var index = itemContainer.parent.childs.indexOf(itemContainer.item);
itemContainer.parent.childs.splice(index,1);
});
 
$scope.checkedItems = [];
$scope.$apply();
},
 
function(){
alert("Falha ao mover o(s) item(s) seleccionados. Verifique os erros!");
}
}
);
);
}
 
function aclCallback(jsonAcl,contentId)
{
var $scope = angular.element("#treeAppPageContent").scope();
var content = $scope.findContent($scope.data, contentId);
content.acls = jsonAcl;
$(".modal").modal('hide');
$scope.$apply();
$scope.openAndHasNotChilds = function(node){
if(node.childs == null){
return false;
}
return node.childs.length == 0;
}
 
</script>
$scope.showDetails = function(node, parentNode){
if(parentNode.open){
$scope.itemToShow = node;
/*var scope = angular.element($("#treeAppPageContentInfo")).scope();
scope.$apply(function(){
scope.itemToShow = node;
});*/
var scope = angular.element($("#treeAppPageContentInfo")).scope()
//scope.test = "Hello, world!";
scope.toShow = {};
scope.toShow = node;
scope.id = node.id;
}
else{
alert("error");
}
}
 
<script type="text/ng-template" id="childs_renderer.html">
<!-- Coloquei aqui o predicado no NGClass que quando existe uma property nodrop = true o angular coloca nodrop na class o que faz o elemento ficar a vermelho e nao permite drop-->
<div ng-attr-data-nodrag="{{node.nodrag}}" class="tree-node tree-node-content" ng-class="{nodrop: node.nodrop, nodrag: node.nodrag, moved: node.moved}">
<a class="btn btn-success btn-xs" ng-if="node.isDirectory" data-nodrag ng-click="openItem(node)"><span
class="glyphicon"
ng-class="{
'glyphicon-chevron-right': !node.open,
'glyphicon-chevron-down': node.open
$scope.onNavigate = function(node){
window.open(node.title, "_blank");
}
 
}"></span></a>
{{node.slug}} {{node.title}} <span ng-if="node.nodrop">No drop</span> <span ng-if="node.nodrag">No drag</span>
});
 
</script>
 
<bacoVfsTags:selectVfsAcl title="MUDAR ACLS DESTE CONTEUDO" btnLabel="ACLS" btnClass="btn btn-default" callbackTargetFunction="aclCallback" callbackTargetFunctionTokenParameter="{{node.id}}"/>
<script type="text/ng-template" id="childs_renderer.html">
<div ng-show="node.directory">
<!--Para nao deixar fazer drag-->
<div ng-init="itemGroup = node" data-nodrag class="tree-node tree-node-content clearfix" ng-class="{ modified: node.modified, nodrop: node.nodrop, nodrag: node.nodrag, bacoInvisible: node.visible == 'false' || node.PageSection.visible == 'false', hidden: hideNode(node)}">
 
<div class="col-md-1">
<a class="btn btn-default btn-xs" title="Expandir directoria"
data-nodrag ng-click="openItem(node)">
<span class="glyphicon"
ng-class="{
'glyphicon-folder-close': !node.open,
'glyphicon-folder-open': node.open
}">
</span>
</a>
</div>
<div class="col-md-11">
 
<a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="remove(this)"><span
class="glyphicon glyphicon-remove"></span></a>
<a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubItem(this)" style="margin-right: 8px;"><span
class="glyphicon glyphicon-plus"></span></a>
<button ng-click="moveItem(node)" data-toggle="tooltip" title="Mover items para aqui" class="btn btn-xs btn-warning" ng-show="checkedItems.length"><span class="glyphicon glyphicon-arrow-left"></span></button>
 
<span style="margin-right: 5px" class="glyphicon glyphicon-folder-close"></span> {{node.title}} {{node.pageSection.title}}
<label style="float: right; vertical-align: middle" data-toggle="tooltip" title="Esta secção está oculta!" ng-show="node.visible == false">
<span class="glyphicon glyphicon-ban-circle"/>
</label>
</div>
<!--<button ng-click="" data-toggle="tooltip" title="Remover Item" class="btn btn-xs btn-danger pull-right"><span class="glyphicon glyphicon-remove"></span></button>-->
</div>
</div>
 
<ol ng-if="node.nodrop" ui-tree-nodes="" data-nodrop-enabled="true" ng-model="node.childs" ng-class="{hidden: collapsed}">
<li ng-repeat="node in node.childs" ui-tree-node ng-include="'childs_renderer.html'">
</li>
</ol>
<ol ng-if="!node.nodrop" ui-tree-nodes="" ng-model="node.childs" ng-class="{hidden: collapsed}">
<li ng-repeat="node in node.childs" ui-tree-node ng-include="'childs_renderer.html'">
</li>
</ol>
</script>
<div ng-show="node.textBox">
<div ng-init="itemGroup = node" data-nodrag class="tree-node tree-node-content clearfix" ng-class="{ modified: node.modified, nodrop: node.nodrop, nodrag: node.nodrag, bacoInvisible: !node.visible, hidden: hideNode(node)}">
<div class="col-md-1">
<input type="checkbox" ng-click="checkItem(node,parent)" ng-model="node.checked" style="font-size: 1.4em; margin-right: 10px; vertical-align:middle;">
</div>
 
<div class="row">
<div class="col-sm-12">
<h3>Basic Example</h3>
<div class="col-md-11">
<span style="margin-right: 5px" class="glyphicon glyphicon-font"></span> {{node.title}} <button ng-click="showDetails(node,parent)" data-toggle="tooltip" title="Mostrar Detalhes" class="btn btn-default btn-xs" style="float: right"> Mostrar Detalhes</button>
<label style="float: right; vertical-align: middle" data-toggle="tooltip" title="Este item de texto está oculto!" ng-show="node.visible == false">
<span class="glyphicon glyphicon-ban-circle"/>
</label>
</div>
</div>
</div>
 
<button ng-click="expandAll()">Expand all</button>
<button ng-click="collapseAll()">Collapse all</button>
<div ng-show="node.file">
<div ng-init="itemGroup = node" data-nodrag class="tree-node tree-node-content clearfix" ng-class="{ modified: node.modified, nodrop: node.nodrop, nodrag: node.nodrag, bacoInvisible: !node.visible, hidden: hideNode(node)}">
 
<div class="col-md-1">
<input type="checkbox" ng-click="checkItem(node,parent)" ng-model="node.checked" style="font-size: 1.4em; margin-right: 10px; vertical-align:middle;">
</div>
 
<div class="col-md-11">
<span style="margin-right: 5px" class="glyphicon glyphicon-file"></span>
{{node.title}}
<label style="float: right; vertical-align: middle" data-toggle="tooltip" title="Este ficheiro está oculto!" ng-show="node.visible == false">
<span class="glyphicon glyphicon-ban-circle"/>
</label>
<button ng-click="showDetails(node,parent)" data-toggle="tooltip" title="Mostrar Detalhes" class="btn btn-default btn-xs" style="float: right"> Mostrar Detalhes</button>
</div>
</div>
</div>
 
<!-- E finalmente este é o unico codigo dos gajos que metem no HTML puro-->
<div class="row">
<div class="col-sm-6">
<div ui-tree="treeOptions" id="page-content-root">
<ol ui-tree-nodes ng-model="data">
<li ng-repeat="node in data" ui-tree-node ng-include="'childs_renderer.html'"></li>
</ol>
<div ng-show="node.url">
<div ng-init="itemGroup = node" data-nodrag class="tree-node tree-node-content clearfix" ng-class="{ modified: node.modified, nodrop: node.nodrop, nodrag: node.nodrag, bacoInvisible: !node.visible, hidden: hideNode(node)}">
 
<div class="col-md-1">
<input type="checkbox" ng-click="checkItem(node,parent)" ng-model="node.checked" style="font-size: 1.4em; margin-right: 10px; vertical-align:middle;">
</div>
 
<div class="col-md-11">
<span style="margin-right: 5px" class="glyphicon glyphicon-link"></span>
<a class="item" href="#" ng-click="onNavigate(node)"; return false;"> {{node.title}}</a>
<button ng-click="showDetails(node,parent)" data-toggle="tooltip" title="Mostrar Detalhes" class="btn btn-default btn-xs" style="float: right"> Mostrar Detalhes</button>
</div>
 
<label data-toggle="tooltip" title="Este link está oculto!" ng-show="node.visible == false">
<span class="glyphicon glyphicon-ban-circle"/>
</label>
</div>
</div>
 
<div class="col-sm-6">
<div class="info">
{{info}}
 
<ol data-nodrag ui-tree-nodes="" data-nodrop-enabled="true" ng-model="node" ng-class="{hidden: collapsed }">
<li ng-repeat="node in node.childs" ui-tree-node ng-include="'childs_renderer.html'" ng-init="parent = itemGroup">
</li>
</ol>
</script>
 
<div class="panel panel-default" id="panelTree">
<div class="panel-heading clearfix">
Navegador do Sistema de Ficheiros Virtual
 
<baco:hasRole role="admin,all,repositoryDocs">
<!--<select class="chosenOff pull-right" type="text" ng-model="onlyVisibles" ng-options="o.v as o.n for o in [{ n: 'Ver Todos', v: false }, { n: 'Ocultar invisiveis', v: true }]">>
</select>-->
</baco:hasRole>
</div>
 
<div class="panel-body">
<div class="web-messages"></div>
 
<div class="row">
<div class="col-sm-12 form-horizontal">
<div ui-tree="treeOptions" id="page-content-root">
<ol ui-tree-nodes ng-model="data">
<li ng-repeat="node in data" ui-tree-node ng-include="'childs_renderer.html'"></li>
</ol>
</div>
</div>
</div>
 
<div class="col-sm-12">
<pre class="code">{{ data | json }}</pre>
</div>
<div class="col-sm-12">
<pre class="code">{{ itemToShow | json }}</pre>
</div>
</div>
</div>
</div>
 
<%
AbstractDao.getCurrentSession().getTransaction().commit();
%>
<div class="col-md-6" id="treeAppPageContentInfo">
 
<div class="panel panel-default" id="panelInfo">
<div ng-show="toShow.title" class="panel-heading clearfix">
Detalhes de "{{toShow.title}}"
</div>
 
<div ng-show="!toShow.title" class="panel-heading clearfix">
Detalhes
</div>
 
<div class="panel-body">
 
<div ng-show="!toShow" class="alert alert-info" role="alert" style="margin-top:10px;">Seleccione um item da árvore para ver aqui apresentados os seus detalhes!</div>
 
<div ng-show="!toShow" id="loading">
 
<div class="progress" style="margin-top: 150px;">
<div class="progress-bar progress-bar-danger progress-bar-striped active" role="progressbar" aria-valuenow="110" aria-valuemin="0" aria-valuemax="100" style="width:100%;">
Waiting...
</div>
</div>
</div>
 
 
<div ng-show="toShow.file" style="margin-top: -30px;">
<div class="page-header">
<h1>A mostrar detalhes do ficheiro <small>{{toShow.repositoryFileProxy.repositoryFile.lastVersion.name}}</small></h1>
</div>
 
<div id="bodyInfoFile">
<div class="form-group">
<label class="col-md-4 control-label">Designação VFS: </label>
{{toShow.title}}
<span ng-if="!toShow.title">Sem título atribuído.</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Descrição: </label>
{{toShow.description}}
<span ng-if="!toShow.title">Sem descrição.</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Visível: </label>
<span ng-show="toShow.visible==true">Sim</span>
<span ng-show="toShow.visible==false">Não</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Slug: </label>
{{toShow.slug}}
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">VFS Path: </label>
{{toShow.path}}
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Nome do Ficheiro: </label>
{{toShow.repositoryFileProxy.repositoryFile.lastVersion.name}}
<span ng-if="!toShow.repositoryFileProxy.repositoryFile.lastVersion.name">Sem nome.</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Tipo de Ficheiro: </label>
{{toShow.repositoryFileProxy.repositoryFile.lastVersion.contentType}}
<span ng-if="!toShow.repositoryFileProxy.repositoryFile.lastVersion.contentType">Tipo desconhecido.</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Tamanho do Ficheiro: </label>
{{toShow.repositoryFileProxy.repositoryFile.lastVersion.sizeKb}} Kb
<span ng-if="!toShow.repositoryFileProxy.repositoryFile.lastVersion.sizeKb">Tamanho desconhecido.</span>
</div>
 
 
<div class="panel panel-info" style="margin: 50px;">
<div class="panel-heading clearfix">
Download
</div>
<div class="panel-body">
<div style="text-align: center">
<div>
<span class= "glyphicon glyphicon-download blue" style="font-size: 75px; padding: 50px;"></span>
</div>
<bacoTags:repositoryFile btnXs="true" transactional="false" staticTag="true" repositoryStream="{{toShow.repositoryId}}" showHistory="true"/>
{{toShow.repositoryFileProxy.repositoryFile.lastVersion.name}}
({{toShow.repositoryFileProxy.repositoryFile.lastVersion.size / 1024 | number:0}} KB)
</div>
</div>
</div>
</div>
</div>
 
<div ng-show="toShow.url" style="margin-top: -30px;">
<div class="page-header">
<h1>A mostrar detalhes do link <small>{{toShow.title}}</small></h1>
</div>
 
<div id="bodyInfoUrl">
<div class="form-group">
<label class="col-md-4 control-label">Link: </label>
{{toShow.title}}
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Descrição: </label>
{{toShow.description}}
<span ng-if="!toShow.description">Sem descrição.</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Visível: </label>
<span ng-show="toShow.visible==true">Sim</span>
<span ng-show="toShow.visible==false">Não</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Slug: </label>
{{toShow.slug}}
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">VFS Path: </label>
{{toShow.path}}
</div>
 
<div style="text-align: center">
<div>
 
<span class= "glyphicon glyphicon-link blue" style="font-size: 75px; padding: 50px;"></span>
 
</div>
 
</div>
 
</div>
</div>
 
<div ng-show="toShow.textBox" style="margin-top: -30px;">
<div class="page-header">
<h1>A mostrar detalhes da Caixa de Texto <small>{{toShow.title}}</small></h1>
</div>
 
<div id="bodyInfoText">
<div class="form-group">
<label class="col-md-4 control-label">Título: </label>
{{toShow.title}}
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Descrição: </label>
{{toShow.description}}
<span ng-if="!toShow.description">Sem descrição.</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Visível: </label>
<span ng-show="toShow.visible==true">Sim</span>
<span ng-show="toShow.visible==false">Não</span>
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">Slug: </label>
{{toShow.slug}}
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">VFS Path: </label>
{{toShow.path}}
</div>
 
<div class="form-group">
<label class="col-md-4 control-label">HTML: </label>
<div><html>{{toShow.html}}</html></div>
</div>
</div>
</div>
 
 
<!--<div class="col-sm-12">
<pre class="code">{{ toShow | json }}</pre>
</div>-->
</div>
</div>
</div>
</div>
/branches/v3/impl/conf/WEB-INF/tags/vfs/selectVfsPath.tag
15,4 → 15,4
<%@attribute name="callbackTargetFunctionTokenParameter" type="java.lang.String" required="true" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="bacoTags" %>
 
<bacoTags:callAjaxModal targetUrl="/user/pagecontent/widgets/selectPath.jsp" btnClass="${btnClass}" btnLabel="${btnLabel}" title="${title}" callbackTargetFunction="${callbackTargetFunction}" callbackTargetFunctionTokenParameter="${callbackTargetFunctionTokenParameter}" />
<bacoTags:callAjaxModal targetUrl="/user/virtualFileSystem/widgets/selectPath.jsp" btnClass="${btnClass}" btnLabel="${btnLabel}" title="${title}" callbackTargetFunction="${callbackTargetFunction}" callbackTargetFunctionTokenParameter="${callbackTargetFunctionTokenParameter}" />
/branches/v3/impl/conf/WEB-INF/tags/vfs/selectVfsAcl.tag
15,4 → 15,4
<%@attribute name="callbackTargetFunctionTokenParameter" type="java.lang.String" required="true" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="bacoTags" %>
 
<bacoTags:callAjaxModal targetUrl="/user/pagecontent/widgets/selectAclWidget.jsp" btnClass="${btnClass}" btnLabel="${btnLabel}" title="${title}" callbackTargetFunction="${callbackTargetFunction}" callbackTargetFunctionTokenParameter="${callbackTargetFunctionTokenParameter}" />
<bacoTags:callAjaxModal targetUrl="/user/virtualFileSystem/widgets/selectAclWidget.jsp" btnClass="${btnClass}" btnLabel="${btnLabel}" title="${title}" callbackTargetFunction="${callbackTargetFunction}" callbackTargetFunctionTokenParameter="${callbackTargetFunctionTokenParameter}" />
/branches/v3/impl/conf/WEB-INF/tags/vfs/old/vfsview.tag
New file
0,0 → 1,223
<%@ tag import="jomm.dao.impl.AbstractDao" %>
<%@ tag import="org.json.JSONArray" %>
<%@ tag import="pt.estgp.estgweb.services.virtualfilesystem.dto.VfsAbstractPageContentDto" %>
<%@ tag import="pt.estgp.estgweb.services.virtualfilesystem.dto.VfsClient" %>
<%@ tag import="pt.estgp.estgweb.web.exceptions.NotAuthorizedException" %>
<%@ tag import="org.json.JSONObject" %>
<%@tag description="Tag to Call Ajax Request" pageEncoding="UTF-8"%>
<%@ 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 uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@attribute name="pageSectionId" type="java.lang.Long" required="false" %>
<%@attribute name="pageSectionPath" type="java.lang.String" required="false" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="bacoTags" %>
<%@ taglib tagdir="/WEB-INF/tags/vfs" prefix="bacoVfsTags" %>
<%
//TAG CARLOS FUSCO PARA VFS VIEW
%>
<h2>Exemplo de vista do VFS VIEW</h2>
 
<%
AbstractDao.getCurrentSession().beginTransaction();
VfsClient vfsClient = new VfsClient();
VfsAbstractPageContentDto vfsAbstractPageContentDto = null;
if(pageSectionId != null)
{
vfsAbstractPageContentDto = vfsClient.selectById(pageSectionId);
}
else if(pageSectionPath != null)
{
vfsAbstractPageContentDto = vfsClient.selectPath(pageSectionPath);
}
if(vfsAbstractPageContentDto == null || !vfsAbstractPageContentDto.isDirectory())
{
throw new NotAuthorizedException("O VFS apenas pode carregar secções");
}
 
 
 
//CODIGO PARA ALTERAR ESTE É APENAS PROVISORIO
 
 
 
JSONArray rootsArray = new JSONArray();
JSONObject jsonObject = vfsAbstractPageContentDto.toJsonObject();
rootsArray.put(jsonObject);
request.setAttribute("rootsArray",rootsArray);
%>
 
 
 
<div id="treeAppPageContent" ng-app="treeAppPageContent" ng-controller="treeAppPageContentController">
<script>
var treeAppPageContent = angular.module('treeAppPageContent', ['ui.tree']);
GLOBAL_BacoAngularAppDependencies.push('treeAppPageContent');
 
<!-- estes codigos todos do remove e do toggle e etc's não mechi em nada limitei-me a copiar dos gajos-->
treeAppPageContent.controller('treeAppPageContentController', function ($scope,$filter) {
$scope.treeOptions = {
accept: function(sourceNodeScope, destNodesScope, destIndex) {
return true;
},
dropped: function(e) {
console.log (e.source.nodeScope.$modelValue);
//alert ("Largado o nó com titulo: " + e.source.nodeScope.$modelValue.title);
e.source.nodeScope.$modelValue.moved = true;
 
}
};
$scope.remove = function (scope) {
scope.remove();
};
 
$scope.toggle = function (scope) {
scope.toggle();
};
 
$scope.moveLastToTheBeginning = function () {
var a = $scope.data.pop();
$scope.data.splice(0, 0, a);
};
 
$scope.newSubItem = function (scope) {
var nodeData = scope.$modelValue;
var newSlug =nodeData.slug + '_' + (nodeData.childs.length + 1);
nodeData.childs.push({
id: nodeData.id * 10 + nodeData.childs.length,
title: nodeData.title + '.' + (nodeData.childs.length + 1),
slug: newSlug,
path: nodeData.path + '/' + newSlug,
nodes: []
});
};
 
$scope.collapseAll = function () {
$scope.$broadcast('angular-ui-tree:collapse-all');
};
 
$scope.expandAll = function () {
$scope.$broadcast('angular-ui-tree:expand-all');
};
 
$scope.openItem = function(item)
{
if(item.open && item.open==true)
{
//Desligamos o Close se nao isto é uma trapalhada para os elementos que já perderam filhos
//e depois iamos abri-los novamente
//item.open=false;
//delete item.childs;
}
else
{
$.getJSON("<%=request.getContextPath()%>/user/virtualFileSystem/old/jorgeaux/section.jsp",{path:item.path},
function(json){
item.childs = json;
item.open = true;
angular.element($("#treeAppPageContent")).scope().$apply();
});
}
 
 
}
 
$scope.data = ${rootsArray}
 
$scope.findContent = function(contents,id)
{
var i = 0;
for(i = 0; i < contents.length;i++)
{
if(contents[i].id == id)
return contents[i];
if(contents[i].childs)
{
var innerCol = $scope.findContent(contents[i].childs,id);
if(innerCol != null)
return innerCol;
}
}
 
return null;
}
}
);
 
function aclCallback(jsonAcl,contentId)
{
var $scope = angular.element("#treeAppPageContent").scope();
var content = $scope.findContent($scope.data, contentId);
content.acls = jsonAcl;
$(".modal").modal('hide');
$scope.$apply();
}
 
</script>
 
<script type="text/ng-template" id="childs_renderer.html">
<!-- Coloquei aqui o predicado no NGClass que quando existe uma property nodrop = true o angular coloca nodrop na class o que faz o elemento ficar a vermelho e nao permite drop-->
<div ng-attr-data-nodrag="{{node.nodrag}}" class="tree-node tree-node-content" ng-class="{nodrop: node.nodrop, nodrag: node.nodrag, moved: node.moved}">
<a class="btn btn-success btn-xs" ng-if="node.isDirectory" data-nodrag ng-click="openItem(node)"><span
class="glyphicon"
ng-class="{
'glyphicon-chevron-right': !node.open,
'glyphicon-chevron-down': node.open
 
}"></span></a>
{{node.slug}} {{node.title}} <span ng-if="node.nodrop">No drop</span> <span ng-if="node.nodrag">No drag</span>
 
 
<bacoVfsTags:selectVfsAcl title="MUDAR ACLS DESTE CONTEUDO" btnLabel="ACLS" btnClass="btn btn-default" callbackTargetFunction="aclCallback" callbackTargetFunctionTokenParameter="{{node.id}}"/>
 
 
<a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="remove(this)"><span
class="glyphicon glyphicon-remove"></span></a>
<a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubItem(this)" style="margin-right: 8px;"><span
class="glyphicon glyphicon-plus"></span></a>
</div>
 
<ol ng-if="node.nodrop" ui-tree-nodes="" data-nodrop-enabled="true" ng-model="node.childs" ng-class="{hidden: collapsed}">
<li ng-repeat="node in node.childs" ui-tree-node ng-include="'childs_renderer.html'">
</li>
</ol>
<ol ng-if="!node.nodrop" ui-tree-nodes="" ng-model="node.childs" ng-class="{hidden: collapsed}">
<li ng-repeat="node in node.childs" ui-tree-node ng-include="'childs_renderer.html'">
</li>
</ol>
</script>
 
<div class="row">
<div class="col-sm-12">
<h3>Basic Example</h3>
 
<button ng-click="expandAll()">Expand all</button>
<button ng-click="collapseAll()">Collapse all</button>
</div>
</div>
 
<!-- E finalmente este é o unico codigo dos gajos que metem no HTML puro-->
<div class="row">
<div class="col-sm-6">
<div ui-tree="treeOptions" id="page-content-root">
<ol ui-tree-nodes ng-model="data">
<li ng-repeat="node in data" ui-tree-node ng-include="'childs_renderer.html'"></li>
</ol>
</div>
</div>
 
<div class="col-sm-6">
<div class="info">
{{info}}
</div>
<pre class="code">{{ data | json }}</pre>
</div>
</div>
</div>
 
<%
AbstractDao.getCurrentSession().getTransaction().commit();
%>