Author: kcardineaud Date: 2011-07-06 11:05:42 +0200 (Wed, 06 Jul 2011) New Revision: 159 Url: http://nuiton.org/repositories/revision/scmwebeditor/159 Log: Add a filter that allow to click only on file in svn tree Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java trunk/src/main/webapp/Search.jsp Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java 2011-07-05 14:26:01 UTC (rev 158) +++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java 2011-07-06 09:05:42 UTC (rev 159) @@ -208,7 +208,7 @@ for (UrlSvnFile file : files ) { TreeNode node = new TreeNode(); node.setId(file.toString()); - node.setTitle(file.toString()); + node.setTitle(file.toString().substring(file.toString().lastIndexOf("/")+1)); node.setState(TreeNode.NODE_STATE_LEAF); node.setIcon("ui-icon-document"); nodes.add(node); @@ -218,14 +218,12 @@ Iterator<Entry<String, String>> iter1 = directories.entrySet().iterator(); while (iter1.hasNext()) { Map.Entry<String,String> ent = (Map.Entry<String,String>) iter1.next(); - //La clé de la HashMap - //La Valeur de la HashMap String value = ent.getValue(); TreeNode node = new TreeNode(); node.setId(value); - node.setTitle(value); + node.setTitle(value.substring(value.lastIndexOf("/"))); nodes.add(node); @@ -307,7 +305,6 @@ return result; } - //public String getFileOrDirName(Strin) public static String replaceLast(String string, String toReplace, String replacement) { Modified: trunk/src/main/webapp/Search.jsp =================================================================== --- trunk/src/main/webapp/Search.jsp 2011-07-05 14:26:01 UTC (rev 158) +++ trunk/src/main/webapp/Search.jsp 2011-07-06 09:05:42 UTC (rev 159) @@ -11,44 +11,14 @@ <sj:head debug="true" jquerytheme="default"/> - - <!--<s:if test="!files.empty">--> - <!-- - <table> - <s:iterator value="files"> - <tr><td><a href="checkout.action?address=<s:property/>"><s:property/> <s:property value="level"/></a></td></tr> - </s:iterator> - - - <s:iterator value="directories" var="directory" > - <tr><td> - - <sj:a - id="%{key}Button" - targets="htmlcontent%{key}" - href="search.action?address=%{value}" - > - <s:property value="key"/> - </sj:a> - - - <div id="htmlcontent${directory.key}" ></div> - - </td></tr> - </s:iterator> - - - </table> - --> - - <!--</s:if>--> - - - <script> $.subscribe('treeClicked', function(event, data) { var item = event.originalEvent.data.rslt.obj; - document.location.href=("checkout.action?address="+item.attr("id")) + + if(item.text().indexOf("/") == -1) { + document.location.href=("checkout.action?address="+item.attr("id")); + } + }); </script>