Author: kcardineaud Date: 2011-06-20 17:03:57 +0200 (Mon, 20 Jun 2011) New Revision: 128 Url: http://nuiton.org/repositories/revision/scmwebeditor/128 Log: Add search file option (but isn't finish) Modified: trunk/src/main/java/org/nuiton/scmwebeditor/PrivateSvnServlet.java trunk/src/main/resources/struts.xml trunk/src/main/webapp/OutConnection.jsp trunk/src/main/webapp/PrivateSvnRedirect.jsp trunk/src/main/webapp/fileSearch.js Modified: trunk/src/main/java/org/nuiton/scmwebeditor/PrivateSvnServlet.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/PrivateSvnServlet.java 2011-06-20 12:41:21 UTC (rev 127) +++ trunk/src/main/java/org/nuiton/scmwebeditor/PrivateSvnServlet.java 2011-06-20 15:03:57 UTC (rev 128) @@ -58,7 +58,7 @@ svnSess.updateAuthentication(request.getParameter(PARAMETER_USERNAME), request.getParameter(PARAMETER_PW)); //FIXME-TC20091124 : why repush the object already in session, I don't see the point... setSvnSession(httpSession, svnSess); -// Recalling helloservlet with user information stock on session + // Recalling helloservlet with user information stock on session String url = getRedirectUrl(svnSess); if (log.isDebugEnabled()) { log.debug("redirect url = " + url); Modified: trunk/src/main/resources/struts.xml =================================================================== --- trunk/src/main/resources/struts.xml 2011-06-20 12:41:21 UTC (rev 127) +++ trunk/src/main/resources/struts.xml 2011-06-20 15:03:57 UTC (rev 128) @@ -22,5 +22,11 @@ <param name="inputName">XMLResponse</param> </result> </action> + <action name="search" class="org.nuiton.scmwebeditor.actions.SearchAction" method="execute"> + <result type="stream" > + <param name="contentType">text/xml</param> + <param name="inputName">XMLResponse</param> + </result> + </action> </package> </struts> \ No newline at end of file Modified: trunk/src/main/webapp/OutConnection.jsp =================================================================== --- trunk/src/main/webapp/OutConnection.jsp 2011-06-20 12:41:21 UTC (rev 127) +++ trunk/src/main/webapp/OutConnection.jsp 2011-06-20 15:03:57 UTC (rev 128) @@ -22,7 +22,7 @@ </center> <center> <form method="get" action="checkout.action"> - <p><label>SCM path: <input TYPE=text name="address" SIZE=100></label><input disabled="disabled" type="button" value="Search Files" name="search" onclick="javascript:fileSearch(this.form.address, 'SearchServlet');"/></p> + <p><label>SCM path: <input TYPE=text name="address" SIZE=100></label><input type="button" value="Search Files" name="search" onclick="javascript:fileSearch(this.form.address);"/></p> <input type="hidden" name="projectUrl" value="<%=request.getRequestURL()%>" /> Modified: trunk/src/main/webapp/PrivateSvnRedirect.jsp =================================================================== --- trunk/src/main/webapp/PrivateSvnRedirect.jsp 2011-06-20 12:41:21 UTC (rev 127) +++ trunk/src/main/webapp/PrivateSvnRedirect.jsp 2011-06-20 15:03:57 UTC (rev 128) @@ -13,7 +13,7 @@ </head> <body> <a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="$alt" /></a> -<form method="post" action=<%=request.getAttribute("privateServletUri")%>> +<form method="post" action="checkout.action" > <script src="cancelRedirect.js"></script> <p>You try to access a Private SCM. Please login</p> <p><label ACCESSKEY=U>User name: <input TYPE=text Modified: trunk/src/main/webapp/fileSearch.js =================================================================== --- trunk/src/main/webapp/fileSearch.js 2011-06-20 12:41:21 UTC (rev 127) +++ trunk/src/main/webapp/fileSearch.js 2011-06-20 15:03:57 UTC (rev 128) @@ -22,26 +22,29 @@ //Make the XMLHttpRequest Object var http= createRequestObject(); -function sendRequestToFileSearchServlet(scmPath, scmEditorUrl) +function sendRequestToFileSearchAction(scmPath, searchUrl) { - http.open("POST", scmEditorUrl, true); - http.onreadystatechange = handleResponseFromFileSearchServlet; + http.open("POST", searchUrl, true); + http.onreadystatechange = handleResponseFromFileSearchAction; http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - http.send("adresse="+scmPath.value); + http.send("address="+scmPath.value); } -function handleResponseFromFileSearchServlet() +function handleResponseFromFileSearchAction() { if(http.readyState == 4 && http.status != 401){ alert("Can find file Continue"); + var response = http.responseText; + alert(response); + + } else if (http.readyState == 4 && http.status == 401){ alert("Cannot find files please recheck Scm path."); } } -function fileSearch(scmPath, scmEditorUrl) +function fileSearch(scmPath) { alert(scmPath.value); - alert(scmEditorUrl); - sendRequestToFileSearchServlet(scmPath, scmEditorUrl); + sendRequestToFileSearchAction(scmPath, "search.action"); }