Subversion Repositories bacoAlunos

Rev

Rev 1637 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@ page import="org.json.JSONArray" %>
<%@ page import="pt.estgp.estgweb.services.pageContent.dto.VfsClient" %>
<%@ page import="jomm.dao.impl.AbstractDao" %>

<%@ 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-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    AbstractDao.getCurrentSession().beginTransaction();
    VfsClient client = new VfsClient();
    JSONArray rootsArray = client.getRootsJsonArray();
    request.setAttribute("rootsArray",rootsArray);
%>

<script>
    function criarPath()
    {
        $.post("<%=request.getContextPath()%>/user/pagecontent/jorgeaux/criarPathCompleta.jsp",
                {
                    path : $("#pathToCreate").val()
                },
                function(response){
                    if(response.indexOf("ok")>=0)
                        location.reload();
                    else
                        alert(response);
                });
    }
</script>
<div class="container-fluid">

    <div class="form-group col-md-12">
        <div class="col-md-2 control-label">Caminho pastas a criar</div>
        <div class="col-md-3">
                <input type="text" class="form-control" id="pathToCreate">
        </div>
        <div class="col-md-1">
            <button type="button" class="btn btn-default" onclick="criarPath()">Criar</button>
        </div>
        <div class="col-md-6">
            Exemplo:  /ipp/publicacoes/deliberacoesPresidente
        </div>
    </div>

    <div class="col-md-12">
        <div id="vfsApp" ng-app="vfsApp" ng-controller="vfsAppController">
            <script>
                var vfsApp = angular.module('vfsApp', []);
                GLOBAL_BacoAngularAppDependencies.push('vfsApp');

                vfsApp.controller('vfsAppController', function($scope) {
                    $scope.menu = ${rootsArray}


                    $scope.openItem = function(item, ancestors)
                    {

                        $.getJSON("<%=request.getContextPath()%>/user/pagecontent/jorgeaux/section.jsp",{path:item.path},
                        function(json){
                            item.childs = json;
                            angular.element($("#vfsApp")).scope().$apply();
                        });
                    }
                });

            </script>
            <script type="text/ng-template" id="menu_sublevel.html">
                <a href="#" ng-click="openItem(item, $$ancestors)"
                      ng-class="{'open': item.isOpen}">{{item.slug}} {{ item.title }}</a>

                <ul ng-if="item.childs">

                    <li ng-repeat="item in item.childs"
                        ng-include="'menu_sublevel.html'">
                        {{item.slug}} {{ item.title }}
                    </li>
                </ul>
            </script>

            <ul>
                <li ng-repeat="item in menu"
                    ng-include="'menu_sublevel.html'"></li>
            </ul>
            <%--<ul>
                <li ng-repeat="root in vfs">
                    <a href="#" ng-href="openVfsSection('{{root.pathForIdHtml}}')"><span class="glyphicon glyphicon-folder-close"></span></a> {{ root.slug }} {{ root.title }}
                    <div id="{{root.pathForIdHtml}}">
                        <ul>
                            <li ng-repeat="section in root.childs">
                                <a href="javascript:openVfsSection('{{section.pathForIdHtml}}')"><span class="glyphicon glyphicon-folder-close"></span></a> {{ section.slug }} {{ section.title }}
                                <div id="{{section.pathForIdHtml}}"></div>
                            </li>
                        </ul>
                    </div>
                </li>
            </ul>--%>
        </div>
    </div>
</div>
<%
    AbstractDao.getCurrentSession().getTransaction().commit();
%>

Generated by GNU Enscript 1.6.5.2.