From eaedcae9f0ad24531dc1ce246f1872c47b133496 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 11 Jul 2008 20:39:18 +0000 Subject: [PATCH] fix search box path when there is no PLT_Root cookie svn: r10720 original commit: 5726d77d87a698407942222214d9056443281b1d --- collects/scribble/html-render.ss | 9 ++++++--- collects/scribble/scribble-common.js | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index d527132d..99489ed8 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -189,7 +189,7 @@ ) -(define search-box ; appears on every page +(define (make-search-box top-path) ; appears on every page (let ([sa string-append] [emptylabel "...search manuals..."] [dimcolor "#888"]) @@ -201,7 +201,8 @@ [type "text"] [value ,emptylabel] [title "Enter a search string to search the manuals"] - [onkeypress ,(format "return DoSearchKey(event, this, ~s);" (version))] + [onkeypress ,(format "return DoSearchKey(event, this, ~s, ~s);" + (version) top-path)] [onfocus ,(sa "this.style.color=\"black\"; " "this.style.textAlign=\"left\"; " "if (this.value == \""emptylabel"\") this.value=\"\";")] @@ -209,6 +210,8 @@ " this.style.color=\""dimcolor"\";" " this.style.textAlign=\"center\";" " this.value=\""emptylabel"\"; }")])))) +(define search-box (make-search-box "../")) +(define top-search-box (make-search-box "")) ;; ---------------------------------------- ;; main mixin @@ -643,7 +646,7 @@ `[onclick . ,(format "return GotoPLTRoot(\"~a\");" (version))])) (define navleft `(span ([class "navleft"]) - ,search-box + ,(if up-path search-box top-search-box) ,@(render sep-element (and up-path (make-element top-link top-content)) diff --git a/collects/scribble/scribble-common.js b/collects/scribble/scribble-common.js index 91250e4c..89b35492 100644 --- a/collects/scribble/scribble-common.js +++ b/collects/scribble/scribble-common.js @@ -44,11 +44,11 @@ function NormalizePath(path) { return path; } -function DoSearchKey(event, field, ver) { +function DoSearchKey(event, field, ver, top_path) { var val = field.value; if (event && event.keyCode == 13) { var u = GetCookie("PLT_Root."+ver, null); - if (u == null) u = "../"; // default: go up + if (u == null) u = top_path; // default: go to the top path location = u + "search/index.html" + "?q=" + escape(val); return false; }