Przeglądaj źródła

参考字典 翻译未完成

visuddhinanda 4 lat temu
rodzic
commit
952bcceb53
1 zmienionych plików z 63 dodań i 40 usunięć
  1. 63 40
      app/dict/dict_lookup.php

+ 63 - 40
app/dict/dict_lookup.php

@@ -1,4 +1,4 @@
-<?php
+<?php
 //查询参考字典
 include("../log/pref_log.php");
 require_once '../path.php';
@@ -106,7 +106,7 @@ $right_word_list = "";
 				}
 
 				
-                $query = "SELECT dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,30";
+                $query = "SELECT dict.id,dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,30";
                 $Fetch = PDO_FetchAll($query, array($x));
                 $iFetch = count($Fetch);
                 $count_return += $iFetch;
@@ -131,12 +131,7 @@ $right_word_list = "";
                         $dictid = $Fetch[$i]["dict_id"];
                         $dict_list[$dictid] = $Fetch[$i]["shortname"];
                         $dict_list_a[] = array("ref_dict_$dictid", $Fetch[$i]["shortname"]);
-                        echo "<div class='dict_word'>";
-                        echo "<a name='ref_dict_$dictid'></a>";
-                        echo "<div class='dict'>" . $Fetch[$i]["shortname"] . "</div>";
-						$mean = GrmAbbr($mean,$dictid);
-                        echo "<div class='mean'>" . $mean . "</div>";
-                        echo "</div>";
+						RenderWordDiv($dictid,$Fetch[$i]["shortname"],$Fetch[$i]["id"],$x,$mean);
                     }
                 }
             }
@@ -166,7 +161,6 @@ $right_word_list = "";
 							} else {
 								$arrBase[$newbase]['grammar'] = $thiscase;
 								$arrBase[$newbase]['parent'] = $base;
-
 							}
 						}
 					}
@@ -328,35 +322,6 @@ $right_word_list = "";
         echo "<span>{$_local->gui->click_to_chart}</span></a></div>";
 		echo $right_word_list;
 		
-		/*
-        echo "<div class='dict_word' ><b>{$_local->gui->undone_function}</b>";
-        echo "<div class='' onclick=\"dict_show_edit()\">{$_local->gui->edit}</div>";
-        echo "<div class='pali'>{$word}</div>";
-
-        if ($iFetch > 0) {
-            echo "<div id='user_word_edit' style='display:none'>";
-        } else {
-            echo "<div id='user_word_edit'>";
-        }
-        echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->wordtype}</legend>";
-        echo "<select id=\"id_type\" name=\"type\" >";
-        foreach ($_local->type_str as $type) {
-            echo "<option value=\"{$type->id}\" >{$type->value}</option>";
-        }
-        echo "</select>";
-        echo "</fieldset>";
-        echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->gramma}</legend><input type='input' value=''/></fieldset>";
-        echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->parent}</legend><input type='input' value=''/></fieldset>";
-        echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->g_mean}</legend><input type='input' value=''/></fieldset>";
-        echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->note}</legend><textarea></textarea></fieldset>";
-        echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->factor}</legend><input type='input' value=''/></fieldset>";
-        echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->f_mean}</legend><input type='input' value=''/></fieldset>";
-        echo "<div class=''><button>{$_local->gui->add_to} {$_local->gui->my_dictionary}</button></div>";
-		echo "</div>";
-		
-
-		echo "</div>";
-		*/
 		echo "</div>";
 
         //查用户词典结束
@@ -595,9 +560,67 @@ function GrmAbbr($input,$dictid){
 	foreach (GRM_ABBR as $key => $value) {
 		# code...
 		if($value["dictid"]==$dictid && strpos($input,$value["abbr"]."</guide>") == false){
-			$mean = str_replace($value["abbr"],"<guide gid='grammar_{$value["replace"]}' class='grammar_tag' style='display:unset;'>{$value["abbr"]}</guide>",$mean);
+			$mean = str_ireplace($value["abbr"],"<guide gid='grammar_{$value["replace"]}' class='grammar_tag' style='display:unset;'>{$value["abbr"]}</guide>",$mean);
 		}
-
 	}
 	return $mean;
+}
+
+function RenderWordDiv($dictId,$dictName,$refWordId,$word,$meaning){
+	echo "<div class='dict_word'>";
+	echo "<a name='ref_dict_$dictId'></a>";
+	echo "<div class='dict'>" . $dictName . "</div>";
+	$mean = GrmAbbr($meaning,$dictId);
+	echo "<div class='mean'>" . $mean . "</div>";
+
+	/*
+	echo "<div class='tool'>";
+	echo "<button onclick='refDictShowTranslateDiv(this)'>我要翻译</button>";
+	echo "<div class='tool_innter'>";
+	RenderUserDictEdit($word,$dictId,$refWordId);
+	echo "</div>";
+	echo "</div>";
+*/
+	echo "</div>";
+}
+
+function RenderUserDictEdit($word,$dictId,$refWordId){
+	global $_local;
+	        //用户词典编辑窗口
+			echo "<div >";
+			echo "<form >";
+			echo "<input type='hidden' name='word' value='{$word}'/>";
+			echo "<input type='hidden' name='dictid' value='{$dictId}'/>";
+			echo "<input type='hidden' name='wordid' value='{$refWordId}'/>";
+			if ($dictId == 0) {
+				echo "<div id='user_word_edit'>";
+			} else {
+				echo "<div id='user_word_edit'>";
+			}
+			
+			echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->language}</legend><input type='input' name='lang' value='zh-hans'/></fieldset>";
+
+			echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->wordtype}</legend>";
+
+			echo "<select id=\"id_type\" name=\"type\" >";
+			foreach ($_local->type_str as $type) {
+				echo "<option value=\"{$type->id}\" >{$type->value}</option>";
+			}
+			echo "</select>";
+
+			echo "</fieldset>";
+
+			echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->gramma}</legend><input type='input' name='grammar' value=''/></fieldset>";
+			echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->parent}</legend><input type='input' name='parent' placeholder='{$word}' value=''/></fieldset>";
+			echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->g_mean}</legend><input type='input' name='mean' value=''/></fieldset>";
+			echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->note}</legend><textarea name='note'></textarea></fieldset>";
+			echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->factor}</legend><input type='input' name='parts' value=''/></fieldset>";
+			echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->f_mean}</legend><input type='input' name='part_mean' value=''/></fieldset>";
+			echo "</form>";
+			echo "<div class=''><button onclick='SaveToMyDict()'>{$_local->gui->save}</button></div>";
+			echo "</div>";
+			
+	
+			echo "</div>";
+	
 }