Skip to content

Commit

Permalink
Allow Devanagari or IAST in /simple/xxx.
Browse files Browse the repository at this point in the history
  • Loading branch information
funderburkjim committed Dec 3, 2020
1 parent e89415c commit 343ca03
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 36 deletions.
13 changes: 2 additions & 11 deletions simple-search/v1.0/getword_list_1.0.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
<?php
/*
getword_list_0.1.php
Variant of getword_list_1.0.php of fetching_v0.3b.
Designed to work with list-0.2s.html
06-01-2017. based on apidev/getword_xml.php
'key' is treated as a comma-delimited list of keys
Retrieves info for a given headword; retrieves from web/sqlite/<dict>.xml
Enhancement: retrieve multiple headwords
Enhancement: retrieve based on normalized spelling
06-02-2017. In this version, the variants are generated by php, rather
than being pregenerated by javascript
06-05-2017. Compute variants with SLP
getword_list_1.0.php Begun 06-01-2017.
Used by Javascript 'simpleFunction' in list-0.2s_rw.php.
*/
require_once('getword_list_1.0_main.php');
$ans = getword_list_processone(); // Gets arguments from $_REQUEST
Expand Down
7 changes: 4 additions & 3 deletions simple-search/v1.0/getword_list_1.0_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ function getword_list_processone() {
$dal = new Dal($dict);
// WARNING: the relative path to sanhw1 is sensitive to location of
// this file.
#$dalnorm = new Dalnorm('hwnorm1c','../../../sanhw1');
$dalnorm = new Dalnorm('hwnorm1c','../hwnorm1');
// Ordering of results depends on a word frequency file.
$wfreqs = init_word_frequency();

// keyparmin is the key input. It is what the user requested.
// Assumed to be in utf-8 encoding
$keyparmin = $getParms->keyin; // original
dbgprint($dbg,"keyparmin=$keyparmin\n");

//keyparmin is original.
// php function. Convert back to utf-8
// This is done already in javascript list-0.2s_(xampp)_rw.php
//$keyparmin1 = urldecode($keyparmin);
$ssobj = new Simple_Search($keyparmin,$dict);
$keysin = $ssobj->normkeys; // normalized slp1 spelling
// 11-01-2017. user keyin, slp1, norm. So we can identify
Expand Down
25 changes: 12 additions & 13 deletions simple-search/v1.0/list-0.2s_rw.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?php
/* Same as list-0.2s_xampp.php, but accepts some or all inputs as
$_REQUEST parameters (i.e. either 'GET' or 'POST')
This is file list-0.2s_rw.php. ('rw' = rewrite)
Primarily for use on Cologne server to allow /simple/ urls to be parsed.
See .htaccess in root directory ('docs') of Cologne.
06-09-2020 Remove 'www' in urls
/* This is file list-0.2s_rw.php. ('rw' = rewrite)
Allows /simple/ urls to be parsed.
See .htaccess in root directory.
*/
// Report all errors except E_NOTICE (also E_WARNING?)
error_reporting(E_ALL & ~E_NOTICE);
Expand Down Expand Up @@ -48,7 +44,12 @@
for($i=0;$i<count($keys);$i++) {
$key=$keys[$i];
$val=$parms[$key];
$phpvals[$key] = $val; //$_REQUEST[$key];
if ($key == 'key') { //12-03-2020
$val1 = urldecode($val); // from uri-encoding to utf-8
$phpvals[$key] = $val1;
}else {
$phpvals[$key] = $val; //$_REQUEST[$key];
}
//$_REQUEST[$key] = $val;
//echo("phpvals: $key -> $val<br/>\n");
}
Expand All @@ -60,7 +61,6 @@
<META charset="UTF-8">
<title>list-0.2s Cologne</title>
<!-- ref=https://www.w3.org/TR/html4/struct/links.html#edef-BASE -->

<BASE href="/scans/awork/apidev/simple-search/v1.0/list-0.2s_rw.php">

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.css">
Expand Down Expand Up @@ -168,7 +168,7 @@
changeCorrectionHref = function () {
//console.log('changeCorrectionHref: dict=',$('#dict').val());
var dict = $('#dict').val();
var url = "/php/correction_form.php?dict=" + dict;
var url = "//www.sanskrit-lexicon.uni-koeln.de/php/correction_form.php?dict=" + dict;
$('#correction').attr('href',url);
};
keyAutocompleteActivation = function () {
Expand Down Expand Up @@ -270,7 +270,7 @@
//console.log('test: find_word=',find_word);
test.key = find_word;
// 04-18/2018. change from v1.0d to v1.0
// Currenlty getword_list_1.0.php same in both locations.
// Currently getword_list_1.0.php same in both locations.
test.url = "../../simple-search/v1.0/getword_list_1.0.php";
//console.log('simpleFunction test.url=',test.url);
test.input = 'hk';
Expand Down Expand Up @@ -483,8 +483,7 @@ classattr = ' class="sdata"'; // control font for Devanagari

}); // end ready
</script>
<script> // see MWScan/2014/web/webtcdev/main_webtc.js
</script>

</head>
<body>
<div id="logo">
Expand Down
21 changes: 12 additions & 9 deletions simple-search/v1.0/list-0.2s_xampp_rw.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Same as list-0.2s_xampp.php, but accepts some or all inputs as
$_REQUEST parameters (i.e. either 'GET' or 'POST')
/* This is file list-0.2s_xampp_rw.php. ('rw' = rewrite) for local installs
Allows /simple/ urls to be parsed.
See .htaccess in root directory.
*/
// Report all errors except E_NOTICE (also E_WARNING?)
error_reporting(E_ALL & ~E_NOTICE);
Expand Down Expand Up @@ -43,7 +44,12 @@
for($i=0;$i<count($keys);$i++) {
$key=$keys[$i];
$val=$parms[$key];
$phpvals[$key] = $val; //$_REQUEST[$key];
if ($key == 'key') { //12-03-2020
$val1 = urldecode($val); // from uri-encoding to utf-8
$phpvals[$key] = $val1;
}else {
$phpvals[$key] = $val; //$_REQUEST[$key];
}
//$_REQUEST[$key] = $val;
//echo("phpvals: $key -> $val<br/>\n");
}
Expand Down Expand Up @@ -264,7 +270,7 @@
//console.log('test: find_word=',find_word);
test.key = find_word;
// 04-18/2018. change from v1.0d to v1.0
// Currenlty getword_list_1.0.php same in both locations.
// Currently getword_list_1.0.php same in both locations.
test.url = "../../simple-search/v1.0/getword_list_1.0.php";
//console.log('simpleFunction test.url=',test.url);
test.input = 'hk';
Expand Down Expand Up @@ -477,8 +483,7 @@ classattr = ' class="sdata"'; // control font for Devanagari

}); // end ready
</script>
<script> // see MWScan/2014/web/webtcdev/main_webtc.js
</script>

</head>
<body>
<div id="logo">
Expand Down Expand Up @@ -544,8 +549,6 @@ classattr = ' class="sdata"'; // control font for Devanagari
<p>Your browser does not support iframes.</p>
</iframe>
</div>
<script>
</script>
<script src="//www.sanskrit-lexicon.uni-koeln.de/js/piwik_analytics.js"></script>

</body>
</html>

0 comments on commit 343ca03

Please sign in to comment.