Subversion Repositories bacoAlunos

Rev

Rev 1725 | Rev 1756 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1725 Rev 1755
Line 91... Line 91...
91
                }
91
                }
92
            });
92
            });
93
    $(document).ready(
93
    $(document).ready(
94
            function(){
94
            function(){
95
 
95
 
-
 
96
 
-
 
97
                $('.repository-interface .collapse')
-
 
98
                        .on('shown.bs.collapse', function() {
-
 
99
                            $(this)
-
 
100
                                    .parent()
-
 
101
                                    .find(".glyphicon-plus").eq(0)
-
 
102
                                    .removeClass("glyphicon-plus")
-
 
103
                                    .addClass("glyphicon-minus");
-
 
104
                        })
-
 
105
                        .on('hidden.bs.collapse', function() {
-
 
106
                            $(this)
-
 
107
                                    .parent()
-
 
108
                                    .find(".glyphicon-minus").eq(0)
-
 
109
                                    .removeClass("glyphicon-minus")
-
 
110
                                    .addClass("glyphicon-plus");
-
 
111
                        });
-
 
112
 
-
 
113
 
-
 
114
 
96
                $("#documentFilterInput").unbind("click");
115
                $("#documentFilterInput").unbind("click");
97
                $('#documentFilterInput').bind("keypress", function(e) {
116
                $('#documentFilterInput').bind("keypress", function(e) {
98
                    if (e.keyCode == 13) {
117
                    if (e.keyCode == 13) {
99
                        e.preventDefault();
118
                        e.preventDefault();
100
                        return false;
119
                        return false;
Line 106... Line 125...
106
                            {
125
                            {
107
                                $(".repository-document").show();
126
                                $(".repository-document").show();
108
                            }
127
                            }
109
                            else
128
                            else
110
                            {
129
                            {
-
 
130
                                $('.repository-interface .collapse').collapse('show');
111
                                var fields = $("#documentFilterInput").val().split(" ");
131
                                var fields = $("#documentFilterInput").val().split(" ");
112
 
132
 
113
                                $(".repository-document").show();
133
                                $(".repository-document").show();
114
                                $(".repository-document").each(
134
                                $(".repository-document").each(
115
                                        function()
135
                                        function()
Line 125... Line 145...
125
                                        }
145
                                        }
126
                                );
146
                                );
127
                            }
147
                            }
128
                        }
148
                        }
129
                );
149
                );
-
 
150
 
-
 
151
 
130
            }
152
            }
131
    );
153
    );
132
 
154
 
-
 
155
    function toogleId()
-
 
156
    {
-
 
157
 
-
 
158
    }
-
 
159
 
133
</script>
160
</script>
134
<style>
161
<style>
135
    body
162
    body
136
    {
163
    {
137
        background-color: white !important;
164
        background-color: white !important;
Line 197... Line 224...
197
 
224
 
198
                    <nested:iterate id="interfaceBlock" name="interfaceColumn" property="blocks" type="pt.estgp.estgweb.services.data.repositorydocuments.interfaces.InterfaceBlock">
225
                    <nested:iterate id="interfaceBlock" name="interfaceColumn" property="blocks" type="pt.estgp.estgweb.services.data.repositorydocuments.interfaces.InterfaceBlock">
199
                        <%
226
                        <%
200
                        List<Long> collections = interfaceBlock.getCollectionIds();
227
                        List<Long> collections = interfaceBlock.getCollectionIds();
201
                        %>
228
                        %>
-
 
229
 
-
 
230
                        <%
-
 
231
 
-
 
232
                            String idChilds = "block_" + interfaceBlock.hashCode();
-
 
233
 
-
 
234
 
-
 
235
                            //String toogleAttrs = interfaceBlock.isBrowseMinimizeMaximize() ? " data-toggle=\"collapse\" data-target=\"#" + idChilds + "\" " :"";
-
 
236
                            //String styleCol = interfaceBlock.isBrowseMinimizeMaximize() ? " style=\"cursor:hand; text-decoration:underline\" " :"";
-
 
237
 
-
 
238
                            String toogleAttrs = " data-toggle=\"collapse\" data-target=\"#" + idChilds + "\" " ;
-
 
239
                            String styleCol = " style=\"cursor:hand; text-decoration:underline\" ";
-
 
240
                            String folderIcon = !interfaceBlock.isTree() && interfaceBlock.isBrowseMinimizeMaximize() ? " glyphicon-plus " : " glyphicon-minus ";
-
 
241
 
-
 
242
 
-
 
243
                        %>
202
                        <div class="repository-block">
244
                        <div class="repository-block">
203
                            <div class="repository-intro">
245
                            <div class="repository-intro" <%=toogleAttrs%>>
204
                                <logic:equal value="true" name="interfaceBlock" property="showTitle">
246
                                <logic:equal value="true" name="interfaceBlock" property="showTitle">
-
 
247
 
205
                                    <div class="repository-title">
248
                                    <div class="repository-title">
-
 
249
                                        <span class="btn-xs glyphicon <%=folderIcon%>" style="margin-right: 5px"></span>
206
                                        <span class="btn-xs glyphicon glyphicon-bookmark"></span>
250
                                        <span class="btn-xs glyphicon glyphicon-bookmark"></span>
207
                                        ${interfaceBlock.title}
251
                                        <label <%=styleCol%>>${interfaceBlock.title}</label>
208
                                    </div>
252
                                    </div>
209
                                </logic:equal>
253
                                </logic:equal>
210
 
254
 
211
                                <baco:hasRole role="admin,all,repositoryDocs">
255
                                <baco:hasRole role="admin,all,repositoryDocs">
212
                                    <logic:notEmpty name="interfaceBlock" property="collectionIds">
256
                                    <logic:notEmpty name="interfaceBlock" property="collectionIds">
Line 227... Line 271...
227
                                    <div class="repository-description">
271
                                    <div class="repository-description">
228
                                            ${interfaceBlock.description}
272
                                            ${interfaceBlock.description}
229
                                    </div>
273
                                    </div>
230
                                </logic:equal>
274
                                </logic:equal>
231
                            </div>
275
                            </div>
-
 
276
                            <div id="<%=idChilds%>" <%=!interfaceBlock.isTree() && interfaceBlock.isBrowseMinimizeMaximize() ? " class=\"repository-block-childs collapse\"" :" class=\"repository-block-childs collapse in \" "%>>
232
                            <%!
277
                            <%!
233
 
278
 
234
                                public Criterion getAllCollectionsClauses(Long collectionId)
279
                                public Criterion getAllCollectionsClauses(Long collectionId)
235
                                {
280
                                {
236
                                    Criterion c;
281
                                    Criterion c;
Line 246... Line 291...
246
                                        }
291
                                        }
247
                                    }
292
                                    }
248
                                    return c;
293
                                    return c;
249
                                }
294
                                }
250
 
295
 
251
                            %>
296
                                %>
252
                            <%
297
                                <%
253
 
298
 
254
 
299
 
255
 
300
 
256
 
301
 
257
 
302
 
258
 
303
 
259
                                if(!interfaceBlock.isTree())
304
                                    if(!interfaceBlock.isTree())
260
                                {
-
 
261
                                    Criteria c = AbstractDao.getCurrentSession().createCriteria(RepositoryDocument.class);
-
 
262
                                    Criterion clauses = null;
-
 
263
                                    for(Long collection : collections)
-
 
264
                                    {
305
                                    {
265
                                        Criterion clausesCol = getAllCollectionsClauses(collection);
306
                                        Criteria c = AbstractDao.getCurrentSession().createCriteria(RepositoryDocument.class);
266
                                        if(clauses == null)
307
                                        Criterion clauses = null;
267
                                            clauses = clausesCol;
308
                                        for(Long collection : collections)
268
                                        else
-
 
269
                                        {
309
                                        {
-
 
310
                                            Criterion clausesCol = getAllCollectionsClauses(collection);
-
 
311
                                            if(clauses == null)
-
 
312
                                                clauses = clausesCol;
-
 
313
                                            else
-
 
314
                                            {
270
                                            clauses = or(clauses,clausesCol);
315
                                                clauses = or(clauses,clausesCol);
-
 
316
                                            }
271
                                        }
317
                                        }
272
                                    }
-
 
273
                                    c.add(clauses);
318
                                        c.add(clauses);
274
                                    c.add(eq("visible",true));
319
                                        c.add(eq("visible",true));
275
                                    if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.publishDateAsc)
320
                                        if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.publishDateAsc)
276
                                        c.addOrder(Order.asc("publishDate"));
321
                                            c.addOrder(Order.asc("publishDate"));
277
                                    else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.publishDateDesc)
322
                                        else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.publishDateDesc)
278
                                        c.addOrder(Order.desc("publishDate"));
323
                                            c.addOrder(Order.desc("publishDate"));
279
                                    else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.saveDateAsc)
324
                                        else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.saveDateAsc)
280
                                        c.addOrder(Order.asc("saveDate"));
325
                                            c.addOrder(Order.asc("saveDate"));
281
                                    else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.saveDateDesc)
326
                                        else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.saveDateDesc)
282
                                        c.addOrder(Order.desc("saveDate"));
327
                                            c.addOrder(Order.desc("saveDate"));
283
                                    else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.updateDateAsc)
328
                                        else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.updateDateAsc)
284
                                        c.addOrder(Order.desc("updateDate"));
329
                                            c.addOrder(Order.desc("updateDate"));
285
                                    else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.updateDateDesc)
330
                                        else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.updateDateDesc)
286
                                        c.addOrder(Order.desc("updateDate"));
331
                                            c.addOrder(Order.desc("updateDate"));
287
                                    else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.title)
332
                                        else if(interfaceBlock.getOrderBy() == InterfaceBlock.Order.title)
288
                                        c.addOrder(Order.asc("title"));
333
                                            c.addOrder(Order.asc("title"));
289
 
334
 
290
                                    if(interfaceBlock.getMaxPublishDate() != null && interfaceBlock.getMaxPublishDate().getTime() > 0)
335
                                        if(interfaceBlock.getMaxPublishDate() != null && interfaceBlock.getMaxPublishDate().getTime() > 0)
291
                                    {
336
                                        {
292
                                        c.add(le("publishDate", interfaceBlock.getMaxPublishDate()));
337
                                            c.add(le("publishDate", interfaceBlock.getMaxPublishDate()));
293
                                    }
338
                                        }
294
                                    if(interfaceBlock.getMinPublishDate() != null && interfaceBlock.getMinPublishDate().getTime() > 0)
339
                                        if(interfaceBlock.getMinPublishDate() != null && interfaceBlock.getMinPublishDate().getTime() > 0)
295
                                    {
340
                                        {
296
                                        c.add(ge("publishDate", interfaceBlock.getMinPublishDate()));
341
                                            c.add(ge("publishDate", interfaceBlock.getMinPublishDate()));
297
                                    }
342
                                        }
298
                                    List<RepositoryDocument> documents = c.list();
343
                                        List<RepositoryDocument> documents = c.list();
299
                                    request.setAttribute("documents",documents);
344
                                        request.setAttribute("documents",documents);
300
                                    request.setAttribute("interfaceBlock",interfaceBlock);
345
                                        request.setAttribute("interfaceBlock",interfaceBlock);
301
 
-
 
302
                                    %>
-
 
303
                                    <jsp:include page="showInterfaceDocsFragment.jsp"/>
-
 
304
                                    <%
-
 
305
 
346
 
306
                                }
347
                                        %>
-
 
348
                                        <jsp:include page="showInterfaceDocsFragment.jsp"/>
307
                                else
349
                                        <%
-
 
350
 
308
                                {
351
                                    }
309
                                    for(Long collection : collections)
352
                                    else
310
                                    {
353
                                    {
311
                                        RepositoryDocumentCollection col = DaoFactory.getRepositoryDocumentCollectionDaoImpl().get(collection);
-
 
312
                                        for(RepositoryDocumentCollection child: col.getChilds())
354
                                        for(Long collection : collections)
313
                                        {
355
                                        {
-
 
356
                                            RepositoryDocumentCollection col = DaoFactory.getRepositoryDocumentCollectionDaoImpl().get(collection);
-
 
357
                                            for(RepositoryDocumentCollection child: col.getChilds())
-
 
358
                                            {
314
                                            request.setAttribute("collection",child);
359
                                                request.setAttribute("collection",child);
315
                                            request.setAttribute("interfaceBlock",interfaceBlock);
360
                                                request.setAttribute("interfaceBlock",interfaceBlock);
316
                                            %>
361
                                                %>
317
                                            <jsp:include page="showInterfaceColFragment.jsp"/>
362
                                                <jsp:include page="showInterfaceColFragment.jsp"/>
-
 
363
                                                <%
318
                                            <%
364
                                            }
319
                                        }
365
                                        }
320
                                    }
366
                                    }
321
                                }
367
                                %>
322
                            %>
368
                            </div>
323
                        </div>
369
                        </div>
324
                    </nested:iterate>
370
                    </nested:iterate>
325
 
371
 
326
                </div>
372
                </div>
327
            </nested:iterate>
373
            </nested:iterate>