Skip to Content.
Sympa Menu

idok-commit - [idok-commit] idok commit r259 - in trunk/sites/psi/java/ch/psi/idok/gwt/twiki: client public

idok-commit AT lists.psi.ch

Subject: Commit emails of the iDok project

List archive

[idok-commit] idok commit r259 - in trunk/sites/psi/java/ch/psi/idok/gwt/twiki: client public


Chronological Thread 
  • From: "AFS account Roman Geus" <geus AT savannah.psi.ch>
  • To: idok-commit AT lists.psi.ch
  • Subject: [idok-commit] idok commit r259 - in trunk/sites/psi/java/ch/psi/idok/gwt/twiki: client public
  • Date: Mon, 29 Sep 2008 10:35:10 +0200
  • List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
  • List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>

Author: geus
Date: Mon Sep 29 10:35:10 2008
New Revision: 259

Log:
Fixed support for umlauts in query string, fixed hrefs to iDok documents,
fixed href to iDok search results

Modified:

trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchTwikiMashup.java

trunk/sites/psi/java/ch/psi/idok/gwt/twiki/public/IdokSearchTwikiMashup.html

Modified:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchTwikiMashup.java
==============================================================================
---
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchTwikiMashup.java
(original)
+++
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchTwikiMashup.java
Mon Sep 29 10:35:10 2008
@@ -42,15 +42,17 @@
* @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
*/
public void onModuleLoad() {
- // Extract parameters from URL and DOM
- String queryParam = Window.Location.getParameter("search");
-
/*
- * If the search parameter cannot be obtained from the URL, try to
- * extract it from the DOM. This is used for debugging in hosted
mode.
+ * Extract parameters from DOM
+ *
+ * We fetch the query string from an invisible div element from the
DOM
+ * instead of from the URL to avoid problems with character encoding:
+ * The URL parameter fetching functions expect UTF-8 encoding, but
TWiki
+ * sends ISO-8859-1. The DOM getInnerText works for any encoding.
*/
- RootPanel idokQueryDebugPanel = RootPanel.get("idokQueryDebug");
- if (queryParam == null && idokQueryDebugPanel != null)
+ String queryParam = null;
+ RootPanel idokQueryDebugPanel = RootPanel.get("idokQueryParam");
+ if (idokQueryDebugPanel != null)
queryParam = idokQueryDebugPanel.getElement().getInnerText();

String idokEnabled = null;
@@ -84,11 +86,13 @@
*/
protected void doRestCall(String repository, String query) {
String url = BASEURL + repository + "?q=" + query
- + "&outputfields=env,meta";
+ + "&outputfields=env,meta&num=100";
+ GWT.log("Requesting " + url + " using JSONP", null);

JSONRequest.get(URL.encode(url) + "&callback=",
new JSONRequestHandler() {
public void onRequestComplete(JavaScriptObject jso) {
+ GWT.log("entering callback", null);
if (jso != null) {
if (debug) {
final Label lb = new Label();
@@ -192,10 +196,15 @@
.get("idokJumpToResult");
if (idokJumpToResultsPanel == null)
Window.alert("Error in HTML: idokJumpToResult element
missing");
- idokJumpToResultsPanel.add(new HTML("<a href=\""
- + Window.Location.getHref()
- + "#idokResultAnchor\">Jump to iDok search results ("
- + numHits + " documents found)</a>"));
+ String url = Window.Location.getHref();
+ int hashIndex = url.lastIndexOf('#');
+ if (hashIndex != -1)
+ url = url.substring(0, hashIndex) + "#idokResultAnchor";
+ else
+ url += "#idokResultAnchor";
+ idokJumpToResultsPanel.add(new HTML("<a href=\"" + url
+ + "\">Jump to iDok search results (" + numHits
+ + " documents found)</a>"));

} catch (Throwable e) {
GWT.log("Error in 'renderQueryResult()' method", e);
@@ -208,8 +217,8 @@
* @return the URL to the iDok document referenced by the search result
item
*/
private String getDocumentURL(SearchResultItem hit) {
- return "https://dms02.psi.ch/"; + hit.getRepo() + "/"
- + hit.getId();
+ return "https://dms02.psi.ch/"; + hit.getRepo() + "/!svn/ver/"
+ + hit.getRev() + "/" + hit.getId();
}

}

Modified:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/public/IdokSearchTwikiMashup.html
==============================================================================
---
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/public/IdokSearchTwikiMashup.html
(original)
+++
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/public/IdokSearchTwikiMashup.html
Mon Sep 29 10:35:10 2008
@@ -36,7 +36,7 @@

<p />
<!-- <ul>
-<li> Set IDOKDEFAULTREPOSITORY = foo/bar
+<li> Set IDOKDEFAULTREPOSITORY = ait/intern
</li> <li> Set IDOKENABLED = on
</li></ul>
-->
@@ -80,8 +80,8 @@

<p />
<div id="idokEnabled" style="visibility: hidden;">on</div>
-<div id="idokDefaultRepository" style="visibility: hidden;">foo/bar</div>
-<div id="idokQueryDebug" style="visibility: hidden;">copy</div>
+<div id="idokDefaultRepository" style="visibility: hidden;">ait/intern</div>
+<div id="idokQueryParam" style="visibility: hidden;">geus</div>

<div id="idokSearchResult"></div>
<p />



  • [idok-commit] idok commit r259 - in trunk/sites/psi/java/ch/psi/idok/gwt/twiki: client public, AFS account Roman Geus, 09/29/2008

Archive powered by MHonArc 2.6.19.

Top of Page