Beispiel #1
0
function make_trans($i, $wid, $trans, $word, $lang)
{
    global $tbpref;
    $trans = trim($trans);
    $widset = is_numeric($wid);
    if ($widset) {
        $alltrans = get_first_value("select WoTranslation as value from " . $tbpref . "words where WoID = " . $wid);
        $transarr = preg_split('/[' . get_sepas() . ']/u', $alltrans);
        $r = "";
        $set = false;
        foreach ($transarr as $t) {
            $tt = trim($t);
            if ($tt == '*' || $tt == '') {
                continue;
            }
            if (!$set && $tt == $trans) {
                $set = true;
                $r .= '<span class="nowrap"><input class="impr-ann-radio" checked="checked" type="radio" name="rg' . $i . '" value="' . tohtml($tt) . '" />&nbsp;' . tohtml($tt) . '</span> <br /> ';
            } else {
                $r .= '<span class="nowrap"><input class="impr-ann-radio" type="radio" name="rg' . $i . '" value="' . tohtml($tt) . '" />&nbsp;' . tohtml($tt) . '</span>  <br />  ';
            }
        }
        if (!$set) {
            $r .= '<span class="nowrap"><input class="impr-ann-radio" checked="checked" type="radio" name="rg' . $i . '" value="" />&nbsp;<input class="impr-ann-text" type="text" name="tx' . $i . '" id="tx' . $i . '" value="' . tohtml($trans) . '" maxlength="50" size="40" />';
        } else {
            $r .= '<span class="nowrap"><input class="impr-ann-radio" type="radio" name="rg' . $i . '" value="" />&nbsp;<input class="impr-ann-text" type="text" name="tx' . $i . '" id="tx' . $i . '" value="" maxlength="50" size="40" />';
        }
    } else {
        $r = '<span class="nowrap"><input checked="checked" type="radio" name="rg' . $i . '" value="" />&nbsp;<input class="impr-ann-text" type="text" name="tx' . $i . '" id="tx' . $i . '" value="' . tohtml($trans) . '" maxlength="50" size="40" />';
    }
    $r .= ' &nbsp;<img class="click" src="icn/eraser.png" title="Erase Text Field" alt="Erase Text Field" onclick="$(\'#tx' . $i . '\').val(\'\').trigger(\'change\');" />';
    $r .= ' &nbsp;<img class="click" src="icn/star.png" title="* (Set to Term)" alt="* (Set to Term)" onclick="$(\'#tx' . $i . '\').val(\'*\').trigger(\'change\');" />';
    if ($widset) {
        $r .= ' &nbsp;<img class="click" src="icn/plus-button.png" title="Save another translation to existent term" alt="Save another translation to existent term" onclick="addTermTranslation(' . $wid . ', \'#tx' . $i . '\',\'\',' . $lang . ');" />';
    } else {
        $r .= ' &nbsp;<img class="click" src="icn/plus-button.png" title="Save translation to new term" alt="Save translation to new term" onclick="addTermTranslation(0, \'#tx' . $i . '\',' . prepare_textdata_js($word) . ',' . $lang . ');" />';
    }
    $r .= '</span>';
    return $r;
}
Beispiel #2
0
include "utilities.inc.php";
$word = get_first_value("select TiText as value from textitems where TiWordCount = 1 and TiTxID = " . $_REQUEST['tid'] . " and TiOrder = " . $_REQUEST['ord']);
$wordlc = mb_strtolower($word, 'UTF-8');
$langid = get_first_value("select TxLgID as value from texts where TxID = " . $_REQUEST['tid']);
pagestart("Term: " . $word, false);
$m1 = runsql('insert into words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $langid . ', ' . convert_string_to_sqlsyntax($word) . ', ' . convert_string_to_sqlsyntax($wordlc) . ', 99, NOW(), ' . make_score_random_insert_update('id') . ')', 'Term added');
$wid = get_last_key();
echo "<p>OK, you know this term well!</p>";
$hex = strToClassName($wordlc);
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var title = make_tooltip(<?php 
echo prepare_textdata_js($word);
?>
,'*','','99');
$('.TERM<?php 
echo $hex;
?>
', context).removeClass('status0').addClass('status99 word<?php 
echo $wid;
?>
').attr('data_status','99').attr('data_wid','<?php 
echo $wid;
?>
').attr('title',title);
$('#learnstatus', contexth).html('<?php 
echo texttodocount2($_REQUEST['tid']);
?>
Beispiel #3
0
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$term = get_first_value("select WoText as value from " . $tbpref . "words where WoID = " . $wid);
pagestart("Term: " . $term, false);
$m1 = runsql('delete from ' . $tbpref . 'words where WoID = ' . $wid, '');
adjust_autoincr('words', 'WoID');
echo "<p>OK, term deleted, now unknown (" . $m1 . ").</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var title = make_tooltip(<?php 
echo prepare_textdata_js($term);
?>
,'','','');
$('.word<?php 
echo $wid;
?>
', context).removeClass('status99 status98 status1 status2 status3 status4 status5 word<?php 
echo $wid;
?>
').addClass('status0').attr('data_status','0').attr('data_trans','').attr('data_rom','').attr('data_wid','').attr('title',title);
$('#learnstatus', contexth).html('<?php 
echo texttodocount2($tid);
?>
');
window.parent.frames['l'].focus();
window.parent.frames['l'].setTimeout('cClick()', 100);
Beispiel #4
0
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$langid = get_first_value("select TxLgID as value from " . $tbpref . "texts where TxID = " . $_REQUEST['text']);
pagestart("Setting all blue words to Well-known", false);
$sql = 'select distinct TiText, TiTextLC from (' . $tbpref . 'textitems left join ' . $tbpref . 'words on (TiTextLC = WoTextLC) and (TiLgID = WoLgID)) where TiIsNotWord = 0 and WoID is null and TiWordCount = 1 and TiTxID = ' . $_REQUEST['text'] . ' order by TiOrder';
$res = do_mysql_query($sql);
$count = 0;
$javascript = "var title='';";
while ($record = mysql_fetch_assoc($res)) {
    $term = $record['TiText'];
    $termlc = $record['TiTextLC'];
    $count1 = 0 + runsql('insert into ' . $tbpref . 'words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $langid . ', ' . convert_string_to_sqlsyntax($term) . ', ' . convert_string_to_sqlsyntax($termlc) . ', 99 , NOW(), ' . make_score_random_insert_update('id') . ')', '');
    $wid = get_last_key();
    if ($count1 > 0) {
        $javascript .= "title = make_tooltip(" . prepare_textdata_js($term) . ",'*','','99');";
    }
    $javascript .= "\$('.TERM" . strToClassName($termlc) . "', context).removeClass('status0').addClass('status99 word" . $wid . "').attr('data_status','99').attr('data_wid','" . $wid . "').attr('title',title);";
    $count += $count1;
}
mysql_free_result($res);
echo "<p>OK, you know all " . $count . " word(s) well!</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
<?php 
echo $javascript;
?>
 
Beispiel #5
0
}

$(document).ready(function(){
  $("#jquery_jplayer_1").jPlayer({
    ready: function () {
      $(this).jPlayer("setMedia", { 
<?php 
    $audio = trim($audio);
    if (strcasecmp(substr($audio, -4), '.mp3') == 0) {
        echo 'mp3: ' . prepare_textdata_js(encodeURI($audio));
    } elseif (strcasecmp(substr($audio, -4), '.ogg') == 0) {
        echo 'oga: ' . prepare_textdata_js(encodeURI($audio)) . ",\n" . 'mp3: ' . prepare_textdata_js(encodeURI($audio));
    } elseif (strcasecmp(substr($audio, -4), '.wav') == 0) {
        echo 'wav: ' . prepare_textdata_js(encodeURI($audio)) . ",\n" . 'mp3: ' . prepare_textdata_js(encodeURI($audio));
    } else {
        echo 'mp3: ' . prepare_textdata_js(encodeURI($audio));
    }
    ?>
      });
    },
    swfPath: "js",
  });
  
  $("#jquery_jplayer_1").bind($.jPlayer.event.timeupdate, function(event) { 
  	$("#playTime").text(Math.floor(event.jPlayer.status.currentTime));
	});
  
  $("#backbutt").click(click_back);
  $("#forwbutt").click(click_forw);
  $("#do-single").click(click_single);
  $("#do-repeat").click(click_repeat);
Beispiel #6
0
        echo createDictLinksInEditWin2($record['WoLgID'], 'document.forms[\'editword\'].WoSentence', 'document.forms[\'editword\'].WoText');
        ?>
		&nbsp; &nbsp;
		<input type="button" value="Cancel" onclick="{resetDirty(); location.href='edit_words.php#rec<?php 
        echo $_REQUEST['chg'];
        ?>
';}" /> 
		<input type="submit" name="op" value="Change" /></td>
		</tr>
		</table>
		</form>
		<div id="exsent"><span class="click" onclick="do_ajax_show_sentences(<?php 
        echo $record['LgID'];
        ?>
, <?php 
        echo prepare_textdata_js($wordlc) . ', ' . prepare_textdata_js("document.forms['editword'].WoSentence");
        ?>
);"><img src="icn/sticky-notes-stack.png" title="Show Sentences" alt="Show Sentences" /> Show Sentences</span></div>	
<?php 
    }
    mysql_free_result($res);
} else {
    if (substr($message, 0, 24) == "Error: Duplicate entry '" && substr($message, -24) == "' for key 'WoLgIDTextLC'") {
        $lgID = $_REQUEST["WoLgID"] . "-";
        $message = substr($message, 24 + strlen($lgID));
        $message = substr($message, 0, strlen($message) - 24);
        $message = "Error: Term '" . $message . "' already exists. Please go back and correct this!";
    }
    echo error_message_with_hide($message, 0);
    if ($currenttext == '') {
        $sql = 'select count(*) as value from (select WoID from (' . $tbpref . 'words left JOIN ' . $tbpref . 'wordtags ON WoID = WtWoID) where (1=1) ' . $wh_lang . $wh_stat . $wh_query . ' group by WoID ' . $wh_tag . ') as dummy';
Beispiel #7
0
<script type="text/javascript">
//<![CDATA[
WBLINK1 = '<?php 
    echo $wb1;
    ?>
';
WBLINK2 = '<?php 
    echo $wb2;
    ?>
';
WBLINK3 = '<?php 
    echo $wb3;
    ?>
';
SOLUTION = <?php 
    echo prepare_textdata_js($testtype == 1 ? $nosent ? $trans : ' [' . $trans . '] ' : $save);
    ?>
;
OPENED = 0;
WID = <?php 
    echo $wid;
    ?>
;
$(document).ready( function() {
	$(document).keydown(keydown_event_do_test_test);
	$('.word').click(word_click_event_do_test_test);
});
//]]>
</script>

</p></div>
function makeAudioPlayer($audio)
{
    if ($audio != '') {
        $playerskin = "jplayer.blue.monday.modified";
        $repeatMode = getSettingZeroOrOne('currentplayerrepeatmode', 0);
        ?>
<link type="text/css" href="css/jplayer_skin/<?php 
        echo $playerskin;
        ?>
.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>
<table class="width99pc" cellspacing="0" cellpadding="3">
<tr>
<td class="width45pc">&nbsp;</td>
<td class="center borderleft" style="padding-left:10px;">
<span id="do-single" class="click<?php 
        echo $repeatMode ? '' : ' hide';
        ?>
"><img src="icn/arrow-repeat.png" alt="Toggle Repeat (Now ON)" title="Toogle Repeat (Now ON)" style="width:24px;height:24px;" /></span><span id="do-repeat" class="click<?php 
        echo $repeatMode ? ' hide' : '';
        ?>
"><img src="icn/arrow-norepeat.png" alt="Toggle Repeat (Now OFF)" title="Toggle Repeat (Now OFF)" style="width:24px;height:24px;" /></span>
</td>
<td class="center bordermiddle">&nbsp;</td>
<td class="bordermiddle">
<div id="jquery_jplayer_1" class="jp-jplayer">
</div>
<div id="jp_container_1" class="jp-audio">
	<div class="jp-type-single">
		<div class="jp-gui jp-interface">
			<ul class="jp-controls">
				<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
				<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
				<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
				<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
				<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
			</ul>
			<div class="jp-progress">
				<div class="jp-seek-bar">
					<div class="jp-play-bar"></div>
				</div>
			</div>
			<div class="jp-volume-bar">
				<div class="jp-volume-bar-value"></div>
			</div>
			<div class="jp-time-holder">
				<div class="jp-current-time"></div>
				<div class="jp-duration"></div>
			</div>
		</div>
	</div>
</div>
</td>
<td class="center bordermiddle">&nbsp;</td>
<td class="center borderright" style="padding-right:10px;">
<?php 
        $currentplayerseconds = getSetting('currentplayerseconds');
        if ($currentplayerseconds == '') {
            $currentplayerseconds = 5;
        }
        ?>
<select id="backtime" name="backtime" onchange="{do_ajax_save_setting('currentplayerseconds',document.getElementById('backtime').options[document.getElementById('backtime').selectedIndex].value);}"><?php 
        echo get_seconds_selectoptions($currentplayerseconds);
        ?>
</select><br />
<span id="backbutt" class="click"><img src="icn/arrow-circle-225-left.png" alt="Rewind n seconds" title="Rewind n seconds" /></span>&nbsp;&nbsp;<span id="forwbutt" class="click"><img src="icn/arrow-circle-315.png" alt="Forward n seconds" title="Forward n seconds" /></span>
<span id="playTime" class="hide"></span>
</td>
<td class="width45pc">&nbsp;</td>
</tr>
<script type="text/javascript">
//<![CDATA[

function new_pos(p) {
	$("#jquery_jplayer_1").jPlayer("playHead", p);
}

function click_single() {
	$("#jquery_jplayer_1").unbind($.jPlayer.event.ended + ".jp-repeat");
	$("#do-single").addClass('hide');
	$("#do-repeat").removeClass('hide');
	do_ajax_save_setting('currentplayerrepeatmode','0');
	return false;
}

function click_repeat() {
	$("#jquery_jplayer_1").bind($.jPlayer.event.ended + ".jp-repeat", function(event) { 
		$(this).jPlayer("play"); 
	});
	$("#do-repeat").addClass('hide');
	$("#do-single").removeClass('hide');
	do_ajax_save_setting('currentplayerrepeatmode','1');
	return false;
}

function click_back() {
	var t = parseInt($("#playTime").text(),10);
	var b = parseInt($("#backtime").val(),10);
	var nt = t - b;
	if (nt < 0) nt = 0;
	$("#jquery_jplayer_1").jPlayer("play", nt);
}

function click_forw() {
	var t = parseInt($("#playTime").text(),10);
	var b = parseInt($("#backtime").val(),10);
	var nt = t + b;
	$("#jquery_jplayer_1").jPlayer("play", nt);
}

$(document).ready(function(){
  $("#jquery_jplayer_1").jPlayer({
    ready: function () {
      $(this).jPlayer("setMedia", { <?php 
        $audio = trim($audio);
        if (strcasecmp(substr($audio, -4), '.mp3') == 0) {
            echo 'mp3: ' . prepare_textdata_js(encodeURI($audio));
        } elseif (strcasecmp(substr($audio, -4), '.ogg') == 0) {
            echo 'oga: ' . prepare_textdata_js(encodeURI($audio)) . ", " . 'mp3: ' . prepare_textdata_js(encodeURI($audio));
        } elseif (strcasecmp(substr($audio, -4), '.wav') == 0) {
            echo 'wav: ' . prepare_textdata_js(encodeURI($audio)) . ", " . 'mp3: ' . prepare_textdata_js(encodeURI($audio));
        } else {
            echo 'mp3: ' . prepare_textdata_js(encodeURI($audio));
        }
        ?>
 });
    },
    swfPath: "js",
    noVolume: {ipad: /^no$/, iphone: /^no$/, ipod: /^no$/, android_pad: /^no$/, android_phone: /^no$/, blackberry: /^no$/, windows_ce: /^no$/, iemobile: /^no$/, webos: /^no$/, playbook: /^no$/}
  });
  
  $("#jquery_jplayer_1").bind($.jPlayer.event.timeupdate, function(event) { 
  	$("#playTime").text(Math.floor(event.jPlayer.status.currentTime));
	});
  
  $("#backbutt").click(click_back);
  $("#forwbutt").click(click_forw);
  $("#do-single").click(click_single);
  $("#do-repeat").click(click_repeat);
  
  <?php 
        echo $repeatMode ? "click_repeat();\n" : '';
        ?>
});
//]]>
</script>
<?php 
    }
    // if (isset($audio))
}
Beispiel #9
0
function print_similar_terms($lang_id, $compared_term)
{
    // Get Term and translation of terms in termid array (calculated
    // in function get_similar_terms(...)) as string for echo
    global $tbpref;
    $max_count = (int) getSettingWithDefault("set-similar-terms-count");
    if ($max_count <= 0) {
        return '';
    }
    if (trim($compared_term) == '') {
        return '&nbsp;';
    }
    $compare = tohtml($compared_term);
    $termarr = get_similar_terms($lang_id, $compared_term, $max_count, 0.33);
    $rarr = array();
    foreach ($termarr as $termid) {
        $sql = "select WoText, WoTranslation, WoRomanization from " . $tbpref . "words where WoID = " . $termid;
        $res = do_mysql_query($sql);
        if ($record = mysql_fetch_assoc($res)) {
            $term = tohtml($record["WoText"]);
            if (stripos($compare, $term) !== FALSE) {
                $term = '<span class="red3">' . $term . '</span>';
            } else {
                $term = str_replace($compare, '<span class="red3"><u>' . $compare . '</u></span>', $term);
            }
            $tra = $record["WoTranslation"];
            if ($tra == "*") {
                $tra = "???";
            }
            if (trim($record["WoRomanization"]) !== '') {
                $romd = " [" . $record["WoRomanization"] . "]";
                $rom = $record["WoRomanization"];
            } else {
                $romd = "";
                $rom = "";
            }
            $rarr[] = '<img class="clickedit" src="icn/tick-button-small.png" title="Copy → Translation &amp; Romanization Field(s)" onclick="setTransRoman(' . prepare_textdata_js($tra) . ',' . prepare_textdata_js($rom) . ');" /> ' . $term . tohtml($romd) . ' — ' . tohtml($tra) . '<br />';
        }
        mysql_free_result($res);
    }
    if (count($rarr) == 0) {
        return "(none)";
    } else {
        return implode($rarr);
    }
}
Beispiel #10
0
                 foreach ($data['tuc'] as &$value) {
                     $word = '';
                     if (isset($value['phrase'])) {
                         if (isset($value['phrase']['text'])) {
                             $word = $value['phrase']['text'];
                         }
                     } else {
                         if (isset($value['meanings'])) {
                             if (isset($value['meanings'][0]['text'])) {
                                 $word = "(" . $value['meanings'][0]['text'] . ")";
                             }
                         }
                     }
                     if ($word != '') {
                         $word = trim(strip_tags($word));
                         echo '<span class="click" onclick="addTranslation(' . prepare_textdata_js($word) . ');"><img src="icn/tick-button.png" title="Copy" alt="Copy" /> &nbsp; ' . $word . '</span><br />' . "\n";
                         $i++;
                     }
                 }
                 echo "</p>";
                 if ($i) {
                     echo '<p>&nbsp;<br/>' . $i . ' translation' . ($i == 1 ? '' : 's') . ' retrieved via <a href="http://glosbe.com/a-api" target="_blank">Glosbe API</a>.</p>';
                 }
             } else {
                 echo '<p>&nbsp;<br/>No translations found (' . tohtml($from) . '-' . tohtml($dest) . ').</p>';
             }
         } else {
             echo '<p>&nbsp;<br/>Retrieval error (' . tohtml($from) . '-' . tohtml($dest) . '). Possible reason: There is a limit of Glosbe API calls that may be done from one IP address in a fixed period of time, to prevent from abuse.</p>';
         }
     }
 }
Beispiel #11
0
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var status = '<?php 
echo $status;
?>
';
var title = make_tooltip(<?php 
echo prepare_textdata_js($word);
?>
, <?php 
echo prepare_textdata_js($trans);
?>
, <?php 
echo prepare_textdata_js($roman);
?>
, status);
$('.word<?php 
echo $wid;
?>
', context).removeClass('status98 status99 status1 status2 status3 status4 status5').addClass('status<?php 
echo $status;
?>
').attr('data_status','<?php 
echo $status;
?>
').attr('title',title);
$('#learnstatus', contexth).html('<?php 
echo texttodocount2($tid);
?>
Beispiel #12
0
function get20Sentences($lang, $wordlc, $jsctlname, $mode)
{
    $r = '<p><b>Sentences in active texts with <i>' . tohtml($wordlc) . '</i></b></p><p>(Click on <img src="icn/tick-button.png" title="Choose" alt="Choose" /> to copy sentence into above term)</p>';
    $sql = 'SELECT DISTINCT SeID, SeText FROM sentences, textitems WHERE TiTextLC = ' . convert_string_to_sqlsyntax($wordlc) . ' AND SeID = TiSeID AND SeLgID = ' . $lang . ' order by CHAR_LENGTH(SeText), SeText limit 0,20';
    $res = mysql_query($sql);
    if ($res == FALSE) {
        die("Invalid Query: {$sql}");
    }
    $r .= '<p>';
    $last = '';
    while ($record = mysql_fetch_assoc($res)) {
        if ($last != $record['SeText']) {
            $sent = getSentence($record['SeID'], $wordlc, $mode);
            $r .= '<span class="click" onclick="' . $jsctlname . '.value=' . prepare_textdata_js($sent[1]) . ';"><img src="icn/tick-button.png" title="Choose" alt="Choose" /></span> &nbsp;' . $sent[0] . '<br />';
        }
        $last = $record['SeText'];
    }
    mysql_free_result($res);
    $r .= '</p>';
    return $r;
}