diff --git a/seed/sensmotdire/dictionaries/40_sensmotdire.xml b/seed/sensmotdire/dictionaries/40_sensmotdire.xml new file mode 100644 index 00000000..e5b01607 --- /dev/null +++ b/seed/sensmotdire/dictionaries/40_sensmotdire.xml @@ -0,0 +1,9 @@ + + + + + /etc/sensmotdire/config.php + /etc/nginx/default.d/sensmotdire.conf + + + diff --git a/seed/sensmotdire/extras/machine/20_sensmotdire.xml b/seed/sensmotdire/extras/machine/20_sensmotdire.xml new file mode 100644 index 00000000..ac4f5b31 --- /dev/null +++ b/seed/sensmotdire/extras/machine/20_sensmotdire.xml @@ -0,0 +1,20 @@ + + + + + 256 + + + False + + + False + + + False + + + 512 + + + diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire.sh b/seed/sensmotdire/manual/image/postinstall/sensmotdire.sh new file mode 100644 index 00000000..7b442010 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire.sh @@ -0,0 +1,8 @@ +set -e + +mkdir -p "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share" +cp -a $IMAGE_DIR_RECIPIENT_IMAGE/postinstall/sensmotdire "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share" +chown -R root: "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share/sensmotdire" +ln -s /etc/sensmotdire/config.php "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/usr/local/share/sensmotdire/config.php" + +cd $ORIPWD diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/about.php b/seed/sensmotdire/manual/image/postinstall/sensmotdire/about.php new file mode 100644 index 00000000..dc9a866a --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/about.php @@ -0,0 +1,14 @@ +head(); +$content="\n\t
"; +$content.="\n\t\t

\"sensmotdire\"

"; +$content.="

sensmotdire

"; +$content.=display_about(); +$content.="\n\t\t" . display_close_button(); +$content.="\n\t
"; +$display->body($content, "about"); +print $display->close(); + diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/accessibility.php b/seed/sensmotdire/manual/image/postinstall/sensmotdire/accessibility.php new file mode 100644 index 00000000..3271f206 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/accessibility.php @@ -0,0 +1,13 @@ +head(); +$content="\n\t
"; +$content.="\n\t\t

" . $title . "

"; +$content.=display_access(); +$content.="\n\t\t" . display_close_button(); +$content.="\n\t
"; +$display->body($content, "access"); +print $display->close(); + diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/add_browser.php b/seed/sensmotdire/manual/image/postinstall/sensmotdire/add_browser.php new file mode 100644 index 00000000..53d5bc68 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/add_browser.php @@ -0,0 +1,15 @@ +head(); +$content="\n\t
"; +$content.="\n\t\t

$title

"; +$content.=display_add_browser(); +$content.="\n\t\t" . '

' . translate("Add sensmotdire to your browser") . '

'; +$content.="\n\t\t" . display_close_button(); +$content.="\n\t" .'
'; +$display->body($content, "addbrowser"); +print $display->close(); +?> diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/autosuggest.php b/seed/sensmotdire/manual/image/postinstall/sensmotdire/autosuggest.php new file mode 100644 index 00000000..2ac326c7 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/autosuggest.php @@ -0,0 +1,76 @@ +execRequest("SELECT infinitif FROM `verbsfr` WHERE `infinitif` REGEXP \"^" . $input . "\" LIMIT 0 , $limit"); + header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past + header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified + header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 + header ("Pragma: no-cache"); // HTTP/1.0 + header("Content-Type: application/json; charset=UTF-8"); + + if (isset($firefox)) + echo "[\"$input_orig\", ["; + else + echo "{ \"results\": ["; + $id=1; + $arr=array(); + while ($row = $search->nextResult()) + { + if (isset($firefox)) + $arr[]= " \"" . $old . $row['infinitif'] . "\" "; + else + $arr[]= "{ \"id\": \"$id\", \"value\": \"" . $old . $row['infinitif'] . "\", \"info\": \"\" }"; + $id++; + } + echo implode(", ", $arr); + $search->close(); + if (isset($firefox)) + echo "] ]"; + else + echo "] }"; + } +?> diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/css/sensmotdire.css b/seed/sensmotdire/manual/image/postinstall/sensmotdire/css/sensmotdire.css new file mode 100644 index 00000000..a58bf470 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/css/sensmotdire.css @@ -0,0 +1,394 @@ +body { + font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; + font-size: 12px; + position: relative; + margin: 0px; +} +#index { + background: white url(../images/sensmotdire-background.png) no-repeat right top; +} +#about { + text-align: center; +} +#addbrowser { + background: white url(../images/sensmotdire-background.png) no-repeat center center; +} +h1 { + padding: 1em; + clear: right; + color: #448; +} +.error { + clear: both; + text-align: center; + color: red; + font-weight: bold; + margin-bottom: 2em; +} +.wiktionary, .verbiste { + border: 1px dotted #778; + padding: .5em; + clear: both; + margin-bottom: 1em; +} + +span.combined { + color: #448; +} +strong { + color: #F00; +} +strong span.combined { + color: #F55; +} +#menu { + border-bottom: 1px dotted #778; + border-left: 1px dotted #778; + font-size: 8px; + margin: 0px; + float: right; + text-align: right; +} +p.report { + text-align: center; + background-color: #DDE; + border: 1px dotted #778; + padding: .5px; +} +#menu ul li { + padding-left: 1em; + display: inline; +} + +#menu ul li a:hover, #menu ul li a:link, #menu ul li a:visited { + color: #448; + font-weight: bold; +} +#addbrowser h2 { + color: #636363; +} +#addbrowser p { + margin-left: 3em; +} +#paddbrowser { + font-weight:bold; + text-align: center; +} +#pclose { + text-align: center; + margin-bottom: 2em; +} +div.suggest { + clear: left; +} +form { + margin: 0px; +} +fieldset { + margin: 1em; + border: 1px dotted #778; + padding: 1em; +} +a.hidden img { + border: none; +} +a.hidden { + text-decoration: none; +} + +#fieldword { + float: left; +} +h1 span { + border: 1px dotted #778; + padding: .5em; +} +fieldset legend { + color: #448; + padding: .4em .5em; + border: 1px dotted #778; + font-weight: bold; + background-color:white; +} +textarea { + margin-top: 1em; +} +div.tab { + float:left; + margin-left: 1em; +} +div.tabbertab { + clear: both; + border-bottom: 1px solid #778; + border-left: 1px solid #778; + border-right: 1px solid #778; + float:left; + min-width: 640px; +} +div.mod { + margin:1px; + margin-bottom: 1em; + float:left; + display:block; + border:1px solid #B3B3B3; + background-color:white; + min-width: 10em; +} +div.tense { + float:left; + display:block; + min-width: 10em; +} +p { + margin:0px; + padding:0px; + border:0px; + padding-top:2px; +} +div.mod h3 { + margin:0px; + padding:0px; + border:0px; + background-color:#B3B3B3; + text-align: center; +} +div.mod h4 { + margin:0px; + padding:0px; + border:0px; + background-color:#E3E3E3; + text-align: center; +} +ul { + list-style: none; + padding: 5px; + border: 0px; + margin: 0px; +} +li { + width: 100%; +} +li.impaire { + background-color:#EBEBEB; +} + +/*tabber*/ +/*-------------------------------------------------- + REQUIRED to hide the non-active tab content. + But do not hide them in the print stylesheet! + --------------------------------------------------*/ +.tabberlive .tabbertabhide { + display:none; +} + +/*-------------------------------------------------- + .tabber = before the tabber interface is set up + .tabberlive = after the tabber interface is set up + --------------------------------------------------*/ +.tabberlive { + margin-top:1em; +} + +/*-------------------------------------------------- + ul.tabbernav = the tab navigation list + li.tabberactive = the active tab + --------------------------------------------------*/ +ul.tabbernav +{ + margin:0; + padding: 3px 0; + border-bottom: 1px solid #778; + font-weight: bold ; +} + +ul.tabbernav li +{ + list-style: none; + margin: 0; + display: inline; +} +ul.tabbernav li.tabberactive a +{ + background-color: #fff; + border-bottom: 1px solid #fff; +} + +ul.tabbernav li.tabberactive a:hover +{ + color: #000; + background: white; + border-bottom: 1px solid white; +} + +ul.tabbernav li a +{ + padding: 3px 0.5em; + margin-left: 3px; + border: 1px solid #778; + border-bottom: none; + background: #DDE; + text-decoration: none; +} + +ul.tabbernav li a:link, #tabbernav li a:visited { color: #448; } + +ul.tabbernav li a:hover +{ + color: #000; + background: #AAE; + border-color: #227; +} + +ul.tabbernav li.tabberactive a +{ + background-color: #fff; + border-bottom: 1px solid #fff; +} + +ul.tabbernav li.tabberactive a:hover +{ + color: #000; + background: white; + border-bottom: 1px solid white; +} + +/*-------------------------------------------------- + .tabbertab = the tab content + Add style only after the tabber interface is set up (.tabberlive) + --------------------------------------------------*/ +.tabberlive .tabbertab { + padding:5px; + border-top:0; +} + +.tabberlive .tabbertab h2 { + display:none; +} + +/* +================================================ +autosuggest, inquisitor style +================================================ +*/ + +div.autosuggest +{ + position: absolute; + background-image: url(../images/as_pointer.gif); + background-position: top; + background-repeat: no-repeat; + padding: 10px 0 0 0; +} + +div.autosuggest ul +{ + background-color: transparent; + list-style: none; + margin: -1px 0 -4px 0; + padding: 0; + overflow: hidden; + background-color: #FFF; + border: 1px dotted #778; +} + +div.autosuggest ul li +{ + color: #448; + padding: 0; + margin: 0 0 0; + text-align: left; +} + +div.autosuggest ul li a +{ + color: #448; + display: block; + text-decoration: none; + background-color: transparent; + position: relative; + padding: 0; + width: 100%; +} +div.autosuggest ul li a:hover +{ + background-color: #FFF; +} +div.autosuggest ul li.as_highlight a:hover +{ + background-color: #778; +} + +div.autosuggest ul li a span +{ + display: block; + padding: 3px 6px; + font-weight: bold; +} + +div.autosuggest ul li a span small +{ + font-weight: normal; + color: #999; +} + +div.autosuggest ul li.as_highlight a span small +{ + color: #448; +} + +div.autosuggest ul li.as_highlight a +{ + color: #fff; + background-color: #778; + background-image: url(../images/hl_corner_br.gif); + background-position: bottom right; + background-repeat: no-repeat; +} + +div.autosuggest ul li.as_highlight a span +{ + background-image: url(../images/hl_corner_bl.gif); + background-position: bottom left; + background-repeat: no-repeat; +} + +div.autosuggest ul li a .tl, +div.autosuggest ul li a .tr +{ + width: 6px; + height: 6px; + position: absolute; + top: 0; + padding: 0; + margin: 0; +} +div.autosuggest ul li a .tr +{ + right: 0; +} + +div.autosuggest ul li.as_highlight a .tl +{ + left: 0; + background-image: url(../images/hl_corner_tl.gif); + background-position: bottom left; +} + +div.autosuggest ul li.as_highlight a .tr +{ + right: 0; + background-image: url(../images/hl_corner_tr.gif); + background-position: bottom right; +} + +div.autosuggest ul li.as_warning +{ + font-weight: bold; + text-align: center; +} + +div.autosuggest ul em +{ + font-style: normal; + color: #000; +} diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/f0000112.html b/seed/sensmotdire/manual/image/postinstall/sensmotdire/f0000112.html new file mode 100644 index 00000000..87d3b992 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/f0000112.html @@ -0,0 +1,53 @@ + + + sensmotdire - conjugaison francaise libre + + + + + + + + + + + + +
+
+ Verbe à conjuguer"; }; ?> + />
+

+ +
+
+ + + \ No newline at end of file diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/faq.php b/seed/sensmotdire/manual/image/postinstall/sensmotdire/faq.php new file mode 100644 index 00000000..f13e1464 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/faq.php @@ -0,0 +1,13 @@ +head(); +$content="\n\t
"; +$content.="\n\t\t

$title

"; +$content.=display_faq(); +$content.="\n\t\t" . display_close_button(); +$content.="\n\t
"; +$display->body($content, "faq"); +print $display->close(); + diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/favicon.png b/seed/sensmotdire/manual/image/postinstall/sensmotdire/favicon.png new file mode 100644 index 00000000..68b98057 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/favicon.png differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/as_pointer.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/as_pointer.gif new file mode 100644 index 00000000..37a42532 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/as_pointer.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_bl.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_bl.gif new file mode 100644 index 00000000..b701d01c Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_bl.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_br.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_br.gif new file mode 100644 index 00000000..11debd7f Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_br.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_tl.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_tl.gif new file mode 100644 index 00000000..1c2bbaf7 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_tl.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_tr.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_tr.gif new file mode 100644 index 00000000..38b1eff9 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/hl_corner_tr.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-background-widget.png b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-background-widget.png new file mode 100644 index 00000000..9f391e3d Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-background-widget.png differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-background.png b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-background.png new file mode 100644 index 00000000..8716c589 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-background.png differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-logo.png b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-logo.png new file mode 100644 index 00000000..59af04ec Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire-logo.png differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire.png b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire.png new file mode 100644 index 00000000..68b98057 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/sensmotdire.png differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-do-down.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-do-down.gif new file mode 100644 index 00000000..009a7086 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-do-down.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-do-hidden.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-do-hidden.gif new file mode 100644 index 00000000..3b1e43bb Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-do-hidden.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-down.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-down.gif new file mode 100644 index 00000000..7c9a301c Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-down.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-hidden.gif b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-hidden.gif new file mode 100644 index 00000000..4282d11c Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/twisty-hidden.gif differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/widget-google-shot.jpg b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/widget-google-shot.jpg new file mode 100644 index 00000000..5f267eb6 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/images/widget-google-shot.jpg differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/index.php b/seed/sensmotdire/manual/image/postinstall/sensmotdire/index.php new file mode 100644 index 00000000..82e831f2 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/index.php @@ -0,0 +1,123 @@ + index.html +$uri=explode("/",$_SERVER['REQUEST_URI']); +if ( $uri[count($uri)-1] == "index.php" ) +{ + header("Location: /index.html\n\n"); + exit; +} + +//is word var : stripword +if (isset($_GET['word'])) +{ + $word=stripword($_GET['word']); + if ( $word == "" ) + $wrong_char=1; +} else + $word=""; + +//check accent var +$add_accent="no"; +if (array_key_exists('accent', $_COOKIE) && $_COOKIE['accent'] == 'yes') +{ + $add_accent="yes"; +} +if ( mb_substr($word, 0, 1) == ":" ) +{ + $word = removeaccent(mb_substr($word, 1)); + $add_accent="yes"; + setcookie("accent", $add_accent, time()+3600*24*30, "/"); +} + +//title +$title = "sensmotdire - conjugaison francaise libre"; +if (($word != "") and (!isset($wrong_char))) + $title .= " de $word"; + +//class display_html +$display_html = new display_html($title); +$display_html->head(); + +//default charset : UTF-8 +mb_internal_encoding("UTF-8"); + +//menu +$content = "\n\t
"; +$content .= "\n\t\t"; +$content .= "\n\t
"; + +//search form +$content .= "\t" . '
' . "\n\t\t
" . translate("Verb to be combined") . "\n\t\t\t" . '' . "\n\t\t\t" . '' . "\n\t\t
\n\t
"; + +//if forbidden char +if (isset($wrong_char)) + $content .= "\n\t\t\t
" . translate("Only alphabetical characters, accentuated characters, apostrophe and space are accepted.") . "
" . display_suggest("error"); +else { + +//array with all the search word (remove null word) + if ($word != "") + { + $orig_word=$word; + $word_array=is_a_conjugated_verb($word, $add_accent); + $content .= "\n\t

" . translate("Conjugation to") . " $word

\n\t
\n\t\t
"; + + if ($word != "" and mb_strlen($word) < 25 ) + { + // if array $verbs with all infinitive verb exist + if (isset($word_array)) + { + $i=0; + foreach ($word_array as $verb=>$info) + { + $i++; + $display = new display($verb, $word); + $display->display_tenses($tenses, $add_accent, $info); + $return .= $display->close(); + if ($i > $NB_VERBS) + break; + } + $error_404="no"; + } else { + // if $verbs is not set + if ( $error_404 == "unknown" ) + $error_404="yes"; +// if (is_array($add_pronouns)) +// $return .= "\n\t\t\t
' . "\n\t\t\t\t

" . translate("Unknown verb") . ': ' . $word . "

\n\t\t\t\t
" . translate("Unknown verb or wrong conjugation") . ": $orig_word
"; +// else + $return .= "\n\t\t\t
' . "\n\t\t\t\t

" . translate("Unknown verb") . ': ' . $word . "

\n\t\t\t\t
" . translate("Unknown verb") . ": $word
"; + $return .= display_suggest($word); + $return .= "\n\t\t\t
"; + } + // display all + unset($verbs); + } else + $return .= "\n\t\t\t
' . "\n\t\t\t\t

" . translate("Wrong verb") . ': ' . $word . "

\n\t\t\t\t
" . translate("Your demand is too long") . ": $orig_word
"; + } +} + +if (isset($return)) + $return .= "\n\t\t
\n\t
"; +else + $return = ""; + +if ($error_404 == "yes") + header("HTTP/1.1 404 Not Found"); + +$display_html->body($content . $return, "index"); +print $display_html->close(); diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/.htaccess b/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/.htaccess new file mode 100644 index 00000000..bfa4fa51 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/.htaccess @@ -0,0 +1,4 @@ + + ForceType application/x-httpd-php + + diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/.htaccess.swp b/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/.htaccess.swp new file mode 100644 index 00000000..e87ef065 Binary files /dev/null and b/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/.htaccess.swp differ diff --git a/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/bsn.AutoSuggest_c_2.0.js b/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/bsn.AutoSuggest_c_2.0.js new file mode 100644 index 00000000..cf578e02 --- /dev/null +++ b/seed/sensmotdire/manual/image/postinstall/sensmotdire/js/bsn.AutoSuggest_c_2.0.js @@ -0,0 +1,745 @@ +/** + * author: Timothy Groves - http://www.brandspankingnew.net + * version: 1.2 - 2006-11-17 + * 1.3 - 2006-12-04 + * 2.0 - 2007-02-07 + * + */ + +var useBSNns; + +if (useBSNns) +{ + if (typeof(bsn) == "undefined") + bsn = {} + _bsn = bsn; +} +else +{ + _bsn = this; +} + +if (typeof(_bsn.Autosuggest) == "undefined") + _bsn.Autosuggest = {} + +_bsn.AutoSuggest = function (fldID, param) +{ + // no DOM - give up! + // + if (!document.getElementById) + return false; + + // get field via DOM + // + this.fld = _bsn.DOM.getElement(fldID); + + if (!this.fld) + return false; + + // init variables + // + this.sInput = ""; + this.nInputChars = 0; + this.aSuggestions = []; + this.iHighlighted = 0; + + // parameters object + // + this.oP = (param) ? param : {}; + + // defaults + // + if (!this.oP.minchars) this.oP.minchars = 1; + if (!this.oP.method) this.oP.meth = "get"; + if (!this.oP.varname) this.oP.varname = "input"; + if (!this.oP.className) this.oP.className = "autosuggest"; + if (!this.oP.timeout) this.oP.timeout = 2500; + if (!this.oP.delay) this.oP.delay = 500; + if (!this.oP.offsety) this.oP.offsety = -5; + if (!this.oP.shownoresults) this.oP.shownoresults = true; + if (!this.oP.noresults) this.oP.noresults = "No results!"; + if (!this.oP.maxheight && this.oP.maxheight !== 0) this.oP.maxheight = 250; + if (!this.oP.cache && this.oP.cache != false) this.oP.cache = true; + + // set keyup handler for field + // and prevent autocomplete from client + // + var pointer = this; + + // NOTE: not using addEventListener because UpArrow fired twice in Safari + //_bsn.DOM.addEvent( this.fld, 'keyup', function(ev){ return pointer.onKeyPress(ev); } ); + + this.fld.onkeypress = function(ev){ return pointer.onKeyPress(ev); } + this.fld.onkeyup = function(ev){ return pointer.onKeyUp(ev); } + + this.fld.setAttribute("autocomplete","off"); +} + +_bsn.AutoSuggest.prototype.onKeyPress = function(ev) +{ + + var key = (window.event) ? window.event.keyCode : ev.keyCode; + + // set responses to keydown events in the field + // this allows the user to use the arrow keys to scroll through the results + // ESCAPE clears the list + // TAB sets the current highlighted value + // + var RETURN = 13; + var TAB = 9; + var ESC = 27; + + var bubble = true; + + switch(key) + { + + case RETURN: + this.setHighlightedValue(); + bubble = false; + this.clearHighlight(); + break; + + + case ESC: + this.clearSuggestions(); + this.clearHighlight(); + break; + } + + return bubble; +} + +_bsn.AutoSuggest.prototype.onKeyUp = function(ev) +{ + var key = (window.event) ? window.event.keyCode : ev.keyCode; + + // set responses to keydown events in the field + // this allows the user to use the arrow keys to scroll through the results + // ESCAPE clears the list + // TAB sets the current highlighted value + // + + var ARRUP = 38; + var ARRDN = 40; + + var bubble = true; + + switch(key) + { + + case ARRUP: + this.changeHighlight(key); + bubble = false; + break; + + case ARRDN: + this.changeHighlight(key); + bubble = false; + break; + + default: + this.getSuggestions(this.fld.value); + } + + return bubble; +} + +_bsn.AutoSuggest.prototype.getSuggestions = function (val) +{ + + // if input stays the same, do nothing + // + if (val == this.sInput) + return false; + + // input length is less than the min required to trigger a request + // reset input string + // do nothing + // + if (val.length < this.oP.minchars) + { + this.sInput = ""; + return false; + } + + // if caching enabled, and user is typing (ie. length of input is increasing) + // filter results out of aSuggestions from last request + // + if (val.length>this.nInputChars && this.aSuggestions.length && this.oP.cache) + { + var arr = []; + for (var i=0;i" + val.substring(st, st+this.sInput.length) + "" + val.substring(st+this.sInput.length); + + var span = _bsn.DOM.createElement("span", {}, output, true); + if (arr[i].info != "") + { + var br = _bsn.DOM.createElement("br", {}); + span.appendChild(br); + var small = _bsn.DOM.createElement("small", {}, arr[i].info); + span.appendChild(small); + } + + var a = _bsn.DOM.createElement("a", { href:"#" }); + + var tl = _bsn.DOM.createElement("span", {className:"tl"}, " "); + var tr = _bsn.DOM.createElement("span", {className:"tr"}, " "); + a.appendChild(tl); + a.appendChild(tr); + + a.appendChild(span); + + a.name = i+1; + a.onclick = function () { pointer.setHighlightedValue(); return false; } + a.onmouseover = function () { pointer.setHighlight(this.name); } + + var li = _bsn.DOM.createElement( "li", {}, a ); + + ul.appendChild( li ); + } + + // no results + // + if (arr.length == 0) + { + var li = _bsn.DOM.createElement( "li", {className:"as_warning"}, this.oP.noresults ); + + ul.appendChild( li ); + } + + div.appendChild( ul ); + + var fcorner = _bsn.DOM.createElement("div", {className:"as_corner"}); + var fbar = _bsn.DOM.createElement("div", {className:"as_bar"}); + var footer = _bsn.DOM.createElement("div", {className:"as_footer"}); + footer.appendChild(fcorner); + footer.appendChild(fbar); + div.appendChild(footer); + + // get position of target textfield + // position holding div below it + // set width of holding div to width of field + // + var pos = _bsn.DOM.getPos(this.fld); + + div.style.left = pos.x + "px"; + div.style.top = ( pos.y + this.fld.offsetHeight + this.oP.offsety ) + "px"; + div.style.width = this.fld.offsetWidth + "px"; + + // set mouseover functions for div + // when mouse pointer leaves div, set a timeout to remove the list after an interval + // when mouse enters div, kill the timeout so the list won't be removed + // + div.onmouseover = function(){ pointer.killTimeout() } + div.onmouseout = function(){ pointer.resetTimeout() } + + // add DIV to document + // + document.getElementsByTagName("body")[0].appendChild(div); + + // currently no item is highlighted + // + this.iHighlighted = 0; + + // remove list after an interval + // + var pointer = this; + this.toID = setTimeout(function () { pointer.clearSuggestions() }, this.oP.timeout); +} + +_bsn.AutoSuggest.prototype.changeHighlight = function(key) +{ + var list = _bsn.DOM.getElement("as_ul"); + if (!list) + return false; + + var n; + + if (key == 40) + n = this.iHighlighted + 1; + else if (key == 38) + n = this.iHighlighted - 1; + + if (n > list.childNodes.length) + n = list.childNodes.length; + if (n < 1) + n = 1; + + this.setHighlight(n); +} + + + +_bsn.AutoSuggest.prototype.setHighlight = function(n) +{ + var list = _bsn.DOM.getElement("as_ul"); + if (!list) + return false; + + if (this.iHighlighted > 0) + this.clearHighlight(); + + this.iHighlighted = Number(n); + + list.childNodes[this.iHighlighted-1].className = "as_highlight"; + + this.killTimeout(); +} + + +_bsn.AutoSuggest.prototype.clearHighlight = function() +{ + var list = _bsn.DOM.getElement("as_ul"); + if (!list) + return false; + + if (this.iHighlighted > 0) + { + list.childNodes[this.iHighlighted-1].className = ""; + this.iHighlighted = 0; + } +} + + +_bsn.AutoSuggest.prototype.setHighlightedValue = function () +{ + if (this.iHighlighted) + { + this.sInput = this.fld.value = this.aSuggestions[ this.iHighlighted-1 ].value; + + // move cursor to end of input (safari) + // + this.fld.focus(); + if (this.fld.selectionStart) + this.fld.setSelectionRange(this.sInput.length, this.sInput.length); + + this.clearSuggestions(); + + // pass selected object to callback function, if exists + // + if (typeof(this.oP.callback) == "function") + this.oP.callback( this.aSuggestions[this.iHighlighted-1] ); + } else { + if (document.getElementById('conjuguer')) { + //document.formword.submit(); + document.getElementById('conjuguer').click(); + } + } +} + +_bsn.AutoSuggest.prototype.killTimeout = function() +{ + clearTimeout(this.toID); +} + +_bsn.AutoSuggest.prototype.resetTimeout = function() +{ + clearTimeout(this.toID); + var pointer = this; + this.toID = setTimeout(function () { pointer.clearSuggestions() }, 1000); +} + +_bsn.AutoSuggest.prototype.clearSuggestions = function () +{ + + this.killTimeout(); + + var ele = _bsn.DOM.getElement(this.idAs); + var pointer = this; + if (ele) + { + var fade = new _bsn.Fader(ele,1,0,250,function () { _bsn.DOM.removeElement(pointer.idAs) }); + } + this.clearHighlight(); +} + +// AJAX PROTOTYPE _____________________________________________ + +if (typeof(_bsn.Ajax) == "undefined") + _bsn.Ajax = {} + +_bsn.Ajax = function () +{ + this.req = {}; + this.isIE = false; +} + +_bsn.Ajax.prototype.makeRequest = function (url, meth, onComp, onErr) +{ + + if (meth != "POST") + meth = "GET"; + + this.onComplete = onComp; + this.onError = onErr; + + var pointer = this; + + // branch for native XMLHttpRequest object + if (window.XMLHttpRequest) + { + this.req = new XMLHttpRequest(); + this.req.onreadystatechange = function () { pointer.processReqChange() }; + this.req.open("GET", url, true); // + this.req.send(null); + // branch for IE/Windows ActiveX version + } + else if (window.ActiveXObject) + { + this.req = new ActiveXObject("Microsoft.XMLHTTP"); + if (this.req) + { + this.req.onreadystatechange = function () { pointer.processReqChange() }; + this.req.open(meth, url, true); + this.req.send(); + } + } +} + + +_bsn.Ajax.prototype.processReqChange = function() +{ + + // only if req shows "loaded" + if (this.req.readyState == 4) { + // only if "OK" + if (this.req.status == 200) + { + this.onComplete( this.req ); + } else { + this.onError( this.req.status ); + } + } +} + +// DOM PROTOTYPE _____________________________________________ + +if (typeof(_bsn.DOM) == "undefined") + _bsn.DOM = {} + +_bsn.DOM.createElement = function ( type, attr, cont, html ) +{ + var ne = document.createElement( type ); + if (!ne) + return false; + + for (var a in attr) + ne[a] = attr[a]; + + if (typeof(cont) == "string" && !html) + ne.appendChild( document.createTextNode(cont) ); + else if (typeof(cont) == "string" && html) + ne.innerHTML = cont; + else if (typeof(cont) == "object") + ne.appendChild( cont ); + + return ne; +} + +_bsn.DOM.clearElement = function ( id ) +{ + var ele = this.getElement( id ); + + if (!ele) + return false; + + while (ele.childNodes.length) + ele.removeChild( ele.childNodes[0] ); + + return true; +} + +_bsn.DOM.removeElement = function ( ele ) +{ + var e = this.getElement(ele); + + if (!e) + return false; + else if (e.parentNode.removeChild(e)) + return true; + else + return false; +} + +_bsn.DOM.replaceContent = function ( id, cont, html ) +{ + var ele = this.getElement( id ); + + if (!ele) + return false; + + this.clearElement( ele ); + + if (typeof(cont) == "string" && !html) + ele.appendChild( document.createTextNode(cont) ); + else if (typeof(cont) == "string" && html) + ele.innerHTML = cont; + else if (typeof(cont) == "object") + ele.appendChild( cont ); +} + +_bsn.DOM.getElement = function ( ele ) +{ + if (typeof(ele) == "undefined") + { + return false; + } + else if (typeof(ele) == "string") + { + var re = document.getElementById( ele ); + if (!re) + return false; + else if (typeof(re.appendChild) != "undefined" ) { + return re; + } else { + return false; + } + } + else if (typeof(ele.appendChild) != "undefined") + return ele; + else + return false; +} + +_bsn.DOM.appendChildren = function ( id, arr ) +{ + var ele = this.getElement( id ); + + if (!ele) + return false; + + + if (typeof(arr) != "object") + return false; + + for (var i=0;i + +/* Optional: Temporarily hide the "tabber" class so it does not "flash" + on the page as plain HTML. After tabber runs, the class is changed + to "tabberlive" and it will appear. */ + +document.write('