20 include(
'TranslationBackend.php');
21 include_once(
'export/ExporterFactory.php');
43 $this->xActiveRootID = (empty($_POST[
"xActiveRootID"]) ? 0 : $_POST[
"xActiveRootID"]);
44 parent::__construct();
56 $this->Event = (empty($_POST[
"__Event"]) ?
"" : $_POST[
"__Event"] );
58 if($this->Event !=
"")
63 $this->xBrowserHelper = (empty($_POST[
"xBrowserHelper"]) ?
"" : $_POST[
"xBrowserHelper"]);
64 $this->txtEditString = (empty($_POST[
"txtEditString_".$this->xBrowserHelper]) ?
"" : $_POST[
"txtEditString_".$this->xBrowserHelper] );
65 $this->txtEditString = trim($this->txtEditString);
67 $this->txtFindText = (empty($_POST[
"txtFindText"]) ?
"" : $_POST[
"txtFindText"] );
68 $this->ddlFindPercent = (empty($_POST[
"ddlFindPercent"]) ? 60 : $_POST[
"ddlFindPercent"]);
69 $this->xStringID = (empty($_POST[
"xStringID"]) ? 0 : $_POST[
"xStringID"]);
70 $this->xProjectID = (empty($_POST[
"xProjectID"]) ? 0 : $_POST[
"xProjectID"]);
71 $this->ddlLocaleID = (empty($_POST[
"xOldLocaleID"]) ?
"" : $_POST[
"xOldLocaleID"]);
72 $this->xOldLocaleID = (empty($_POST[
"xOldLocaleID"]) ?
"" : $_POST[
"xOldLocaleID"]);
73 $this->ddlSearchType = (empty($_POST[
"ddlSearchType"]) ? 0 : $_POST[
"ddlSearchType"]);
74 $this->xStringStack = (empty($_POST[
"xStringStack"]) ?
"" : $_POST[
"xStringStack"]);
75 $this->xDelStringID = (empty($_POST[
"xDelStringID"]) ?
"" : $_POST[
"xDelStringID"]);
76 $this->xDelProjectID = (empty($_POST[
"xDelProjectID"]) ?
"" : $_POST[
"xDelProjectID"]);
79 if(empty($_POST[
"chkSearchSelects"]))
81 unset($this->chkSearchSelects);
85 $this->chkSearchSelects = $_POST[
"chkSearchSelects"];
89 if($this->xProjectID == 0)
110 case "deleteproject":
114 case "savenextmissing":
120 case "savetoallchecked":
144 if(!empty($this->LocatedString))
146 $this->xBrowserHelper = md5($this->LocatedString->GetOriginal());
162 if($this->xStringID != 0)
183 if(!empty($this->LocatedString))
185 $this->ddlSearchType = 0;
186 $this->txtFindText = $this->LocatedString->GetOriginal();
199 if($this->xDelStringID == $this->xStringID)
202 $this->xStringID = 0;
222 $this->xProjectID = $this->
DeleteProject($this->xDelProjectID);
223 $this->xStringID = 0;
237 if($this->Event ==
"savenext" ||
238 $this->Event ==
"savenextmissing" ||
239 $this->Event ==
"savepopstack" ||
240 $this->Event ==
"save" ||
241 $this->Event ==
"savetoallchecked")
247 if($this->Event ==
"savetoallchecked")
249 if(count($this->chkSearchSelects) > 0)
251 foreach($this->chkSearchSelects as $stringID)
255 $string->SetTranslation($this->txtEditString);
264 if($this->Event ==
"savenext" || $this->Event ==
"next")
268 else if($this->Event ==
"savenextmissing" || $this->Event ==
"nextmissing")
272 else if($this->Event ==
"savepopstack")
277 $stack = split(
",", $this->xStringStack);
278 $this->xStringID = array_pop($stack);
279 $this->xStringStack = join($stack,
",");
288 if(!empty($this->LocatedString))
290 $this->ddlSearchType = 0;
291 $this->txtFindText = $this->LocatedString->GetOriginal();
305 if(!empty($this->LocatedString))
307 $this->ddlSearchType = 0;
308 $this->txtFindText = $this->LocatedString->GetOriginal();
319 $id = (empty($_POST[
"ddlActiveRoot"]) ?
"0" : $_POST[
"ddlActiveRoot"]);
323 if($id && $proj->LoadByID($id,
true) && $proj->GetParentID() == 0)
325 $this->xActiveRootID = $id;
326 $this->xProjectID = $id;
331 throw new Exception(
"Invalid root project selected to set.");
341 $this->xOldLocaleID = (empty($_POST[
"ddlLocaleID"]) ?
"" : $_POST[
"ddlLocaleID"]);
357 if(!$CONFIG[
'enable_web_export'])
359 throw new Exception(
"Web GUI export function is disabled in configuration.");
366 if($id == $this->ddlLocaleID)
373 if($localeName ==
"")
375 throw new Exception(
"Cannot find locale name for current locale id: " + $this->ddlLocaleID);
384 $proc->Export($localeName,
true);
387 $languagePack = $localeName.
"_".date(
'Y-m-d').
".tar.gz";
388 system(
"tar -C ".$CONFIG[
'export_path'].
" --exclude $localeName/php -czf ".$CONFIG[
'language_pack_dir'].
"/$languagePack $localeName", $ret);
391 echo(
"<p>Tar returned $ret, the package may be incomplete.</p>");
393 $link = $CONFIG[
'language_pack_url'].
"/$languagePack";
394 echo(
"<p>Language pack saved to: <a href=\"$link\">$link</a>.</p>");
397 if($this->xStringID != 0)
412 $this->xStringID = 0;
414 if($this->xProjectID == 0)
422 if($this->CurrentStrings->valid())
425 $this->xStringID = $this->CurrentStrings->current()->GetStringID();
429 $this->txtFindText = $this->LocatedString->GetOriginal();
435 $this->xStringID = 0;
448 if($this->xStringID == 0)
455 if(!empty($this->LocatedString))
458 $this->xProjectID = $this->LocatedString->GetProjectID();
if($argc !=3||empty(TranslationProject::$LocaleIDCache[$argv[1]])) $factory
LocateString($locate=LOCATE_CURR)
DeleteProject($projectID)