diff --git a/code/ryzom/tools/server/www/webtt/README b/code/ryzom/tools/server/www/webtt/CakePHP_README
similarity index 100%
rename from code/ryzom/tools/server/www/webtt/README
rename to code/ryzom/tools/server/www/webtt/CakePHP_README
diff --git a/code/ryzom/tools/server/www/webtt/app/config/database.php b/code/ryzom/tools/server/www/webtt/app/config/database.php
index a4183b950..3119752d2 100644
--- a/code/ryzom/tools/server/www/webtt/app/config/database.php
+++ b/code/ryzom/tools/server/www/webtt/app/config/database.php
@@ -12,7 +12,7 @@ class DATABASE_CONFIG {
);
var $raw_files = array(
'datasource' => 'RawFilesSource',
- 'path' => '/home/kaczorek/projects/webtt/distfiles/translation',
+ 'path' => '/path/to/translation',
'extension' => '(uxt|txt)',
'readonly' => true,
'recursive' => true,
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/app_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/app_controller.php
index a60584a71..03bfdf4cb 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/app_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/app_controller.php
@@ -33,11 +33,16 @@
* @link http://book.cakephp.org/view/957/The-App-Controller
*/
class AppController extends Controller {
- var $components = array('DebugKit.Toolbar', 'Session', 'PathResolver', 'Auth' => array("authorize"=>"controller"));
+ var $components = array('DebugKit.Toolbar' => array(
+// 'panels' => array('variables'=>false)
+ ), 'Session', 'PathResolver', 'Auth');
var $layout = "new";
function beforeFilter() {
parent::beforeFilter();
+ $this->Auth->autoRedirect = false;
+ $this->Auth->authorize = 'controller';
+ $this->Auth->userScope = array('User.activated' => true, 'User.confirm_hash' => null);
$this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
if ($this->Auth->user('role') == "admin")
@@ -66,8 +71,5 @@ class AppController extends Controller {
);
// $this->log($isAllowed);
return $isAllowed;
-//
}
-
-
}
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/comments_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/comments_controller.php
index e6ddb365e..a746622e4 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/comments_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/comments_controller.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+Session->setFlash(__('The comment could not be saved. Please, try again.', true));
}
}
+ $this->set('comment', $comment_data = $this->Comment->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->Comment->read(null, $id);
+ $this->data = $comment_data;
}
$translations = $this->Comment->Translation->find('list');
$identifiers = $this->Comment->Identifier->find('list');
@@ -119,8 +139,9 @@ class CommentsController extends AppController {
$this->Session->setFlash(__('The comment could not be saved. Please, try again.', true));
}
}
+ $this->set('comment', $comment_data = $this->Comment->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->Comment->read(null, $id);
+ $this->data = $comment_data;
}
$translations = $this->Comment->Translation->find('list');
$identifiers = $this->Comment->Identifier->find('list');
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/components/path_resolver.php b/code/ryzom/tools/server/www/webtt/app/controllers/components/path_resolver.php
index 2fffe0f3f..8dcd96c99 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/components/path_resolver.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/components/path_resolver.php
@@ -1,98 +1,42 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+belongsTo as $childModel => $junk)
{
- $names[] = $this->getAssociationsTree($model->{$childModel});
+ if ($model->alias != $model->{$childModel}->alias)
+ $names[] = $this->getAssociationsTree($model->{$childModel});
}
return array($model->alias => $names);
}
- function node_path ($node_name, $tree) {
- foreach ($tree as $name => $val) {
- if ($name == $node_name) return $name;
- foreach ($val as $subtree) {
- $ret = $this->node_path($node_name, $subtree);
- if ($ret != '') return "$name => $ret";
- }
- }
- }
-
- function findModelPath_old2($name, $assocTree, $path = null)
- {
-// debug($name, $assocTree, $path);
-// debug($name);
-// debug($assocTree);
-// debug($path);
- foreach ($assocTree as $model => $childs)
- {
- if (!isset($path))
- $path = array($model => "");
- if ($model == $name)
- {
-// $newPath[$childModel] = $path;
-// debug($childModel);
- return array($model => $model);
-// return $model;
- }
- foreach ($childs as $childModelArray => $subTree)
- {
-// debug(array($childModel => $newAssocTree));
-// debug_print_backtrace();
-// if ($ret = $this->findModelPath($name, $subTree, $newPath))
- if ($ret = $this->findModelPath($name, $subTree))
- {
- echo "## model: "; var_dump($model);
- echo "## key subTree: "; var_dump(key($subTree));
- echo "## ret:\n"; var_dump($ret);
-// var_dump(array(key($subTree) => $ret));
-// return array(key($subTree) => $ret);
-// return array($model => key($subTree));
-// return array($model => $ret);
- return array($model => $ret);
- }
- }
- }
-// return $path;
-
- }
-
function t($i)
{
return str_repeat("\t",$i);
}
- function getAssociationsGraph($name, $assocTree)
- {
- static $graph = array();
- foreach ($assocTree as $model => $childs)
- {
- if ($model == $name)
- return true;
- foreach ($childs as $childModelArray)
- {
- foreach ($childModelArray as $childModel => $newAssocTree)
- {
- if ($ret = $this->getAssociationsGraph($name, array($childModel => $newAssocTree)))
- {
- $graph[$childModel][] = $model;
-// var_dump($graph);
- }
- }
- }
- }
-// var_dump($graph);
- return $graph;
- }
-
function findModelPath($name, $assocTree, $path = null)
{
-// debug($name, $assocTree, $path);
-// debug($name);
-// debug($assocTree);
-// debug($path);
foreach ($assocTree as $model => $childs)
{
if (!isset($path))
@@ -101,12 +45,9 @@ class PathResolverComponent extends Object {
{
foreach ($childModelArray as $childModel => $newAssocTree)
{
-// debug(array($childModel => $newAssocTree));
-// debug_print_backtrace();
$newPath[$childModel] = $path;
if ($name == $childModel)
{
-// debug($childModel);
return $newPath;
}
else
@@ -117,36 +58,9 @@ class PathResolverComponent extends Object {
}
}
}
-// return $path;
}
-
- function printPath($model)
- {
- if (!isset($model->belongsTo))
- return null;
- $assocTree = $this->getAssociationsTree($model);
- $path = $this->findModelPath('Language', $assocTree);
-// $path = $this->findModelPath('User', $assocTree);
-// var_dump($path);
-// return 0;
- $text = null;
- while ($path)
- {
- $model = key($path);
-/* foreach ($path as $model => $childs)
- {
- $controller = Inflector::pluralize(Inflector::underscore($model));
- }
- $path = $childs;*/
- $controller = Inflector::pluralize(Inflector::underscore($model));
- $path = $path[$model];
- $new_path[$controller] = $new_path;
- var_dump($new_path);
- $text .= " => " . $controller;
- }
- return $text;
- }
+
function beforeRender($controller)
{
if (!isset($controller->{$controller->modelClass}))
@@ -155,11 +69,10 @@ class PathResolverComponent extends Object {
if (!isset($model->belongsTo))
return 0;
$assocTree = $this->getAssociationsTree($model);
-// var_dump($assocTree);
- $path = $this->findModelPath('Language', $assocTree);
- if (!$path)
- $path = array('Language' => array());
-// var_dump($path);
+ $rootModel = 'Language';
+ $path = $this->findModelPath($rootModel, $assocTree);
+ if (!$path && $model->alias == $rootModel)
+ $path = array($rootModel => array());
$controller->set('assocPath', $path);
}
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/file_identifiers_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/file_identifiers_controller.php
index eabc80e77..fd87e4928 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/file_identifiers_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/file_identifiers_controller.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+set('fileIdentifier', $this->FileIdentifier->read(null, $id));
}
- function add() {
- if (!empty($this->data)) {
- $this->FileIdentifier->create();
- if ($this->FileIdentifier->save($this->data)) {
- $this->Session->setFlash(__('The file identifier has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
- }
- }
- $importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
- $identifiers = $this->FileIdentifier->Identifier->find('list');
- $this->set(compact('importedTranslationFiles', 'identifiers'));
- }
-
- function edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid file identifier', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if ($this->FileIdentifier->save($this->data)) {
- $this->Session->setFlash(__('The file identifier has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->FileIdentifier->read(null, $id);
- }
- $importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
- $identifiers = $this->FileIdentifier->Identifier->find('list');
- $this->set(compact('importedTranslationFiles', 'identifiers'));
- }
-
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for file identifier', true));
- $this->redirect(array('action'=>'index'));
- }
- if ($this->FileIdentifier->delete($id)) {
- $this->Session->setFlash(__('File identifier deleted', true));
- $this->redirect(array('action'=>'index'));
- }
- $this->Session->setFlash(__('File identifier was not deleted', true));
- $this->redirect(array('action' => 'index'));
- }
- function admin_index() {
- $this->FileIdentifier->recursive = 0;
- $this->set('fileIdentifiers', $this->paginate());
- }
-
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid file identifier', true));
@@ -105,8 +71,9 @@ class FileIdentifiersController extends AppController {
$this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
}
}
+ $this->set('fileIdentifier', $fileIdentifier_data = $this->FileIdentifier->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->FileIdentifier->read(null, $id);
+ $this->data = $fileIdentifier_data;
}
$importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/identifier_columns_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/identifier_columns_controller.php
index 19695fa20..0c29ebe22 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/identifier_columns_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/identifier_columns_controller.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+set('identifierColumn', $this->IdentifierColumn->read(null, $id));
}
- function add() {
- if (!empty($this->data)) {
- $this->IdentifierColumn->create();
- if ($this->IdentifierColumn->save($this->data)) {
- $this->Session->setFlash(__('The identifier column has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The identifier column could not be saved. Please, try again.', true));
- }
- }
- $identifiers = $this->IdentifierColumn->Identifier->find('list');
- $this->set(compact('identifiers'));
- }
-
- function edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid identifier column', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if ($this->IdentifierColumn->save($this->data)) {
- $this->Session->setFlash(__('The identifier column has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The identifier column could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->IdentifierColumn->read(null, $id);
- }
- $identifiers = $this->IdentifierColumn->Identifier->find('list');
- $this->set(compact('identifiers'));
- }
-
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for identifier column', true));
- $this->redirect(array('action'=>'index'));
- }
- if ($this->IdentifierColumn->delete($id)) {
- $this->Session->setFlash(__('Identifier column deleted', true));
- $this->redirect(array('action'=>'index'));
- }
- $this->Session->setFlash(__('Identifier column was not deleted', true));
- $this->redirect(array('action' => 'index'));
- }
function admin_index() {
$this->IdentifierColumn->recursive = 0;
$this->set('identifierColumns', $this->paginate());
@@ -102,8 +75,9 @@ class IdentifierColumnsController extends AppController {
$this->Session->setFlash(__('The identifier column could not be saved. Please, try again.', true));
}
}
+ $this->set('identifierColumn', $identifierColumn_data = $this->IdentifierColumn->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->IdentifierColumn->read(null, $id);
+ $this->data = $identifierColumn_data;
}
$identifiers = $this->IdentifierColumn->Identifier->find('list');
$this->set(compact('identifiers'));
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/identifiers_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/identifiers_controller.php
index 01c5911e7..57bb7e812 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/identifiers_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/identifiers_controller.php
@@ -1,12 +1,27 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+Identifier->recursive = 0;
-// Router::connectNamed(array('language'));
-
$conditions = null;
if (isset($this->passedArgs['language']) && $lang = $this->passedArgs['language'])
$conditions = array('Identifier.language_id' => $lang);
@@ -45,55 +60,11 @@ class IdentifiersController extends AppController {
$this->Session->setFlash(__('Invalid identifier', true));
$this->redirect(array('action' => 'index'));
}
- $this->set('identifier', $this->Identifier->read(null, $id));
+ $this->set('identifier', $identifier = $this->Identifier->read(null, $id));
+ if ($identifier)
+ $this->set('identifierNeighbours', $this->Identifier->getNeighbours($id));
}
- function add() {
- if (!empty($this->data)) {
- $this->Identifier->create();
- if ($this->Identifier->save($this->data)) {
- $this->Session->setFlash(__('The identifier has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The identifier could not be saved. Please, try again.', true));
- }
- }
- $languages = $this->Identifier->Language->find('list');
- $this->set(compact('languages'));
- }
-
- function edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid identifier', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if ($this->Identifier->save($this->data)) {
- $this->Session->setFlash(__('The identifier has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The identifier could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->Identifier->read(null, $id);
- }
- $languages = $this->Identifier->Language->find('list');
- $this->set(compact('languages'));
- }
-
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for identifier', true));
- $this->redirect(array('action'=>'index'));
- }
- if ($this->Identifier->delete($id)) {
- $this->Session->setFlash(__('Identifier deleted', true));
- $this->redirect(array('action'=>'index'));
- }
- $this->Session->setFlash(__('Identifier was not deleted', true));
- $this->redirect(array('action' => 'index'));
- }
function admin_index() {
$this->Identifier->recursive = 0;
$this->set('identifiers', $this->paginate());
@@ -104,7 +75,9 @@ class IdentifiersController extends AppController {
$this->Session->setFlash(__('Invalid identifier', true));
$this->redirect(array('action' => 'index'));
}
- $this->set('identifier', $this->Identifier->read(null, $id));
+ $this->set('identifier', $identifier = $this->Identifier->read(null, $id));
+ if ($identifier)
+ $this->set('identifierNeighbours', $this->Identifier->getNeighbours($id));
}
function admin_add() {
@@ -134,8 +107,9 @@ class IdentifiersController extends AppController {
$this->Session->setFlash(__('The identifier could not be saved. Please, try again.', true));
}
}
+ $this->set('identifier', $identifier_data = $this->Identifier->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->Identifier->read(null, $id);
+ $this->data = $identifier_data;
}
$languages = $this->Identifier->Language->find('list');
$this->set(compact('languages'));
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/imported_translation_files_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/imported_translation_files_controller.php
index 58296aed4..2a64123bb 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/imported_translation_files_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/imported_translation_files_controller.php
@@ -1,8 +1,26 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ImportedTranslationFile->recursive = 0;
$this->set('importedTranslationFiles', $this->paginate());
@@ -14,142 +32,10 @@ class ImportedTranslationFilesController extends AppController {
$this->redirect(array('action' => 'index'));
}
$this->set('importedTranslationFile', $this->ImportedTranslationFile->read(null, $id));
-// var_dump($this->ImportedTranslationFile->RawFile);
}
- function admin_import($filename = null) {
-// $this->view = "index";
- App::import("Vendor","UxtParser", array("file" => 'UxtParser.php'));
-/* if (!$filename) {
- $this->Session->setFlash(__('Invalid file', true));
- $this->redirect(array('action' => 'index'));
- return 0;
- }*/
- $filename="diff/pl_diff_4DEC868A.uxt";
- $translationFile = $this->ImportedTranslationFile->find('first', array('conditions' => array('ImportedTranslationFile.filename' => $filename)));
- if ($translationFile)
- {
- $this->Session->setFlash(__('Translation file already imported', true));
- $this->redirect(array('action' => 'index'));
- return 0;
- }
-// var_dump($file);
- $parser = new UxtParser();
- $parsedFile = $parser->parseFile($filename);
-// var_dump($parsedFile);
- $arr = explode("_", basename($filename, ".uxt"));
-// var_dump($arr);
- $language_id = 1;
-
- $this->ImportedTranslationFile->create();
- $data['ImportedTranslationFile']['language_id'] = $language_id;
- $data['ImportedTranslationFile']['filename'] = $filename;
- //$this->ImportedTranslationFile->save($data);
- foreach ($parsedFile as $ent)
- {
- $fi_data = array();
- if ($ent['type'] != "string")
- continue;
-
-
- $i_data['language_id'] = $language_id;
- $i_data['translation_index'] = $ent['index'];
- $i_data['reference_string'] = $ent['string'];
- unset($this->ImportedTranslationFile->Language->Identifier->id);
- $identifier = $this->ImportedTranslationFile->Language->Identifier->find('first',array('conditions' => array('Identifier.identifier' => $ent['identifier'], 'Identifier.language_id' => $language_id)));
- if ($identifier)
- {
-// var_dump($identifier);
- $i_data['id']=$identifier['Identifier']['id'];
- }
- else
- {
- $i_data['identifier'] = $ent['identifier'];
- $i_data['translated'] = false;
- }
- var_dump($i_data);
- $this->ImportedTranslationFile->Language->Identifier->save(array('Identifier' => $i_data));
- $identifier_id = $this->ImportedTranslationFile->Language->Identifier->id;
- var_dump($identifier_id);
-
- unset($this->ImportedTranslationFile->FileIdentifier->id);
- //TODO - set FileIdentifier['id'] if we import already imported file (imported imported file temporarly disabled)
-// $identifier = $this->ImportedTranslationFile->FileIdentifier->find('first',array('conditions' => array('FileIdentifier.identifier' => $ent['identifier'], 'FileIdentifier.translation_file_id' => $)));
-// $data['FileIdentifier']['translation_file_id'] = $this->ImportedTranslationFile->id;
- if ($ent['diff'])
- $fi_data['command'] = "DIFF " . mb_strtoupper($ent['diff']);
- $fi_data['translation_index'] = $ent['index'];
-// $data['FileIdentifier']['identifier_id'] = ;
- $fi_data['reference_string'] = $ent['string'];
- $fi_data['identifier_id'] = $identifier_id;
-
-// $this->ImportedTranslationFile->FileIdentifier->create();
-// $this->ImportedTranslationFile->FileIdentifier->save($data);
- $data['FileIdentifier'][] = $fi_data;
-// $l_data['Language']['id'] = $language_id;
-// $l_data['Identifier'][] = $i_data;
-// $data['Identifier'][] = $i_data;
- }
-// var_dump($data);
-// $this->ImportedTranslationFile->Language->saveAll($l_data);
- $this->ImportedTranslationFile->saveAll($data);
- $this->Session->setFlash(__('Translation file imported', true));
- $this->redirect(array('action' => 'view', $this->ImportedTranslationFile->id));
- $this->ImportedTranslationFile->recursive = 0;
- $this->set('importedTranslationFiles', $this->paginate());
-// $this->render('index');
- }
-
-
- function add() {
- if (!empty($this->data)) {
- $this->ImportedTranslationFile->create();
- if ($this->ImportedTranslationFile->save($this->data)) {
- $this->Session->setFlash(__('The translation file has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
- }
- }
- $languages = $this->ImportedTranslationFile->Language->find('list');
- $this->set(compact('languages'));
- }
-
- function edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid translation file', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if ($this->ImportedTranslationFile->save($this->data)) {
- $this->Session->setFlash(__('The translation file has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->ImportedTranslationFile->read(null, $id);
- }
- $languages = $this->ImportedTranslationFile->Language->find('list');
- $this->set(compact('languages'));
- }
-
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for translation file', true));
- $this->redirect(array('action'=>'index'));
- }
- if ($this->ImportedTranslationFile->delete($id)) {
- $this->Session->setFlash(__('Translation file deleted', true));
- $this->redirect(array('action'=>'index'));
- }
- $this->Session->setFlash(__('Translation file was not deleted', true));
- $this->redirect(array('action' => 'index'));
- }
function admin_index() {
$this->ImportedTranslationFile->recursive = 0;
-// FireCake::dump("??",$_SERVER);
$this->set('importedTranslationFiles', $this->paginate());
}
@@ -188,8 +74,9 @@ class ImportedTranslationFilesController extends AppController {
$this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
}
}
+ $this->set('importedTranslationFile', $importedTranslationFile_data = $this->ImportedTranslationFile->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->ImportedTranslationFile->read(null, $id);
+ $this->data = $importedTranslationFile_data;
}
$languages = $this->ImportedTranslationFile->Language->find('list');
$this->set(compact('languages'));
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/languages_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/languages_controller.php
index 53e8405d1..7b0626316 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/languages_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/languages_controller.php
@@ -1,14 +1,29 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+Language->recursive = 0;
$this->set('languages', $this->paginate());
@@ -22,48 +37,6 @@ class LanguagesController extends AppController {
$this->set('language', $this->Language->read(null, $id));
}
- function add() {
- if (!empty($this->data)) {
- $this->Language->create();
- if ($this->Language->save($this->data)) {
- $this->Session->setFlash(__('The language has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
- }
- }
- }
-
- function edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid language', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if ($this->Language->save($this->data)) {
- $this->Session->setFlash(__('The language has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->Language->read(null, $id);
- }
- }
-
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for language', true));
- $this->redirect(array('action'=>'index'));
- }
- if ($this->Language->delete($id)) {
- $this->Session->setFlash(__('Language deleted', true));
- $this->redirect(array('action'=>'index'));
- }
- $this->Session->setFlash(__('Language was not deleted', true));
- $this->redirect(array('action' => 'index'));
- }
function admin_index() {
$this->Language->recursive = 0;
$this->set('languages', $this->paginate());
@@ -102,8 +75,9 @@ class LanguagesController extends AppController {
$this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
}
}
+ $this->set('language', $language_data = $this->Language->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->Language->read(null, $id);
+ $this->data = $language_data;
}
}
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/pages_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/pages_controller.php
index e669a9113..a6d2362b6 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/pages_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/pages_controller.php
@@ -89,12 +89,10 @@ class PagesController extends AppController {
/* if (isset($this->params['admin']))
array_shift($path);*/
-//var_dump($path);
if (!isset($path[0]) || $path[0] != 'admin') {
//This adds admin to the beginning of the path so the pages controller will look in the 'admin' folder in pages directory
$path = array_merge((array)'admin', $path);
}
-// var_dump($path);
$count = count($path);
if (!$count) {
$this->redirect('/');
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/raw_files_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/raw_files_controller.php
index 618110db2..0620a1312 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/raw_files_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/raw_files_controller.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+RawFile->recursive = 1;
-// var_dump($this->RawFile->find('count'));
-// $db =& ConnectionManager::getDataSource($this->RawFile->useDbConfig);
-// var_dump($db->calculate($this->RawFile, 'count'));
$conditions['RawFile.dir'] = array("diff","translated");
$this->set('rawFiles', $this->paginate($conditions));
-// $this->log(Router::parse($this->referer()));
-// var_dump($this->paginate());
}
function admin_listdir($extension = null) {
$this->RawFile->recursive = 0;
$this->set('rawFiles', $this->paginate(array("RawFile.extension" => $extension)));
$this->rendeR("admin_index");
-// var_dump($this->paginate());
}
function admin_view($dir = null, $filename = null) {
@@ -34,8 +47,6 @@ class RawFilesController extends AppController {
$this->redirect(array('action' => 'index'));
return 0;
}
-// $id = $dir . DS . $filename;
-// $this->set('rawFile', $this->RawFile->read(null, $id));
$this->set('rawFile', $rawFile = $this->RawFile->find('first', array(
"conditions" => array(
"RawFile.dir" => $dir,
@@ -46,13 +57,7 @@ class RawFilesController extends AppController {
$this->set('fileContent', $this->RawFile->_currentFile->read());
}
-/* function import($dir = null, $filename = null) {
- $this->admin_import($dir, $filename);
- }*/
-
function admin_import($dir = null, $filename = null) {
-// $this->view = "index";
-// App::import("Vendor","UxtParser", array("file" => 'UxtParser.php'));
if (!$filename) {
$this->Session->setFlash(__('Invalid file', true));
$this->redirect(array('action' => 'index'));
@@ -67,28 +72,19 @@ class RawFilesController extends AppController {
$importedTranslationFileModel = $this->RawFile->ImportedTranslationFile;
$translationFileModel = $importedTranslationFileModel->TranslationFile;
$languageModel = $translationFileModel->Language;
-// $identifierModel = $languageModel->Identifier;
$identifierModel = $translationFileModel->Identifier;
$identifierColumnModel = $identifierModel->IdentifierColumn;
$translationModel = $identifierModel->Translation;
$fileIdentifierModel = $importedTranslationFileModel->FileIdentifier;
-// $filename="diff/pl_diff_4DEC868A.uxt";
$importedTranslationFile = $importedTranslationFileModel->find('first', array('conditions' => array('ImportedTranslationFile.filename' => $dir . DS . $filename), "recursive" => -1));
-/* var_dump($translationFile);
- return 0;*/
if ($importedTranslationFile)
{
$this->Session->setFlash(__('Translation file already imported', true));
$this->redirect(array('action' => 'index'));
return 0;
}
-// var_dump($file);
-// $parser = new UxtParser();
-// $arr = explode("_", basename($filename, ".uxt"));
-// var_dump($arr);
-// $language_id = 1;
$languageCode = $this->RawFile->getLanguageCode($filename);
if (!$languageCode)
{
@@ -104,10 +100,6 @@ class RawFilesController extends AppController {
$this->redirect(array('action' => 'index'));
return 0;
}
- else
- {
-// var_dump($language_id);
- }
$filename_template = preg_replace('/_diff/', '', $filename);
$filename_template = preg_replace('/_[A-F0-9]{8}/', '', $filename_template);
@@ -137,18 +129,12 @@ class RawFilesController extends AppController {
$translation_file_id = $translationFileModel->id;
$parsedFile = $this->RawFile->parseFile();
-/* var_dump($parsedFile);
- $this->render('index');
- return 0;*/
-// $this->log($parsedFile);
if (!$parsedFile)
{
$this->Session->setFlash(__('Error importing file', true));
$this->redirect(array('action' => 'index'));
return 0;
}
-// $this->log($parsedFile);
-// return 0;
ini_set('max_execution_time',0);
@@ -160,11 +146,9 @@ class RawFilesController extends AppController {
$data['ImportedTranslationFile']['filename'] = $dir . DS . $filename;
$data['ImportedTranslationFile']['file_last_modified_date'] = $this->RawFile->_currentFileLastChange;
-// $data['TranslationFile'] = $tf_data;
$importedTranslationFileModel->saveAll($data);
$importedTranslationFile_id = $importedTranslationFileModel->id;
- //$this->ImportedTranslationFile->save($data);
foreach ($parsedFile as $ent)
{
if (!isset($ent['type']))
@@ -188,23 +172,25 @@ class RawFilesController extends AppController {
if (isset($ent['arguments']))
$i_data['arguments'] = $ent['arguments'];
- if (isset($ent['diff']) && isset($ent['string']))
+ if (isset($ent['columns']) && is_array($ent['columns']) && !isset($ent['string']))
+ {
+ foreach ($ent['columns'] as $column_no => $value)
+ {
+ $ent['string'] .= $value . "\t";
+ }
+ $ent['string'] = substr($ent['string'], 0, -1);
+ }
+
+ if (isset($ent['diff']))
{
$i_data['reference_string'] = $ent['string'];
}
unset($identifierModel->id);
$identifier = $identifierModel->find('first',array('conditions' => array('Identifier.identifier' => $ent['identifier'], 'Identifier.translation_file_id' => $translation_file_id), 'contain' => 'IdentifierColumn'));
- //App::import('Vendor', 'DebugKit.FireCake');
-// FireCake::log($ent['identifier'], "Identifier");
-// FireCake::dump("identifier",$identifier);
-/* $this->log($ent['identifier']);
- $this->log($identifier);*/
if ($identifier)
{
-// var_dump($identifier);
$i_data['id']=$identifier['Identifier']['id'];
-// $this->log("found");
}
else
{
@@ -213,28 +199,51 @@ class RawFilesController extends AppController {
if (isset($ent['diff']))
$i_data['translated'] = false;
$newIdentifier = true;
-// $this->log("not found");
-// $this->log("id: # " . $identifierModel->id . " #");
-// $this->log($i_data);
-
}
-// var_dump($i_data);
$res = $identifierModel->saveAll($tarr = array('Identifier' => $i_data));
$identifier_id = $identifierModel->id;
-/* $this->log('identifier saveAll res');
- $this->log($res);
- $this->log(var_export($res,true));
- $this->log($identifierModel->validationErrors);
- $this->log($identifierModel);
- $this->log('#identifier id');
- $this->log($identifier_id);
- $this->log("tarr");
- $this->log($tarr);*/
+
+ if (!isset($ent['diff'])) // it is translated file and we add translation
+ {
+ unset($translationModel->id);
+ unset($t_data);
+ $translationHash = $translationModel->makeHash($ent);
+
+ if ($newIdentifier) // ovbiously there's no translation for identifier we just created
+ $translation = array();
+ else
+ {
+ $this->log('new translation check');
+ $this->log($translationHash);
+ $translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_id' => $identifier_id, 'Translation.translation_text' => $ent["string"], 'Translation.translation_hash' => NULL), "recursive" => -1));
+ $this->log($translation);
+ if (!$translation)
+ {
+ $translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_id' => $identifier_id, 'Translation.translation_hash' => $translationHash), "recursive" => -1));
+ $this->log($translation);
+ }
+ $this->log('new translation check end');
+ }
+
+ if (!$translation)
+ {
+ $this->log('new translation');
+ $t_data['identifier_id'] = $identifier_id;
+ $t_data['translation_text'] = $ent['string'];
+ $t_data['user_id'] = $this->Auth->user('id');
+ $t_data['translation_hash'] = $translationHash;
+ $translationModel->save(array('Translation' => $t_data));
+ }
+/* else
+ $t_data['id'] = $translation['Translation']['id'];*/
+ if ($translation)
+ $parentTranslation_id = $translation['Translation']['id'];
+ else
+ $parentTranslation_id = $translationModel->id;
+ }
if (isset($ent['columns']) && is_array($ent['columns']))
{
-/* $this->log($_columns);
- $this->log($ent['columns']);*/
$ic_data = array();
foreach ($ent['columns'] as $column_no => $value)
{
@@ -242,8 +251,6 @@ class RawFilesController extends AppController {
$ic_arr = array();
$ic_arr['identifier_id'] = $identifier_id;
$column_name = $_columns[$column_no];
-/* $this->log($identifier);
- $this->log($column_name);*/
if (!$newIdentifier)
{
foreach ($identifier['IdentifierColumn'] as $identifierColumn_no => $identifierColumn)
@@ -259,61 +266,29 @@ class RawFilesController extends AppController {
if (isset($ent['diff']))
$ic_arr['reference_string'] = $value;
$ic_data[] = $ic_arr;
-// $this->log($ic_arr);
$res = $identifierColumnModel->save($ic_arr);
-// $this->log($res);
$identifierColumn_id = $identifierColumnModel->id;
-/* $this->log($identifierColumnModel->validationErrors);
- $this->log(var_export($res,true));*/
if (!isset($ent['diff'])) // it is translated file and we add translation
{
unset($translationModel->id);
+ unset($t_data);
if ($newIdentifier) // ovbiously there's no translation for identifier we just created
$translation = array();
else
- $translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_column_id' => $identifierColumn_id, 'Translation.translation_text' => $value), "recursive" => -1));
+ $translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_column_id' => $identifierColumn_id, 'Translation.translation_text' => $value, 'Translation.parent_id' => $parentTranslation_id), "recursive" => -1));
if (!$translation)
{
$t_data['identifier_column_id'] = $identifierColumn_id;
$t_data['translation_text'] = $value;
- // TODO: change user_id for authorized user
- $t_data['user_id'] = 1;
+ $t_data['user_id'] = $this->Auth->user('id');
+ $t_data['parent_id'] = $parentTranslation_id;
+ $translationModel->save(array('Translation' => $t_data));
}
- else
- $t_data['id'] = $translation['Translation']['id'];
-// var_dump($i_data);
- $translationModel->save(array('Translation' => $t_data));
+/* else
+ $t_data['id'] = $translation['Translation']['id'];*/
}
-
- }
-/* $res = $identifierColumnModel->saveAll($tarr = array('IdentifierColumn' => $ic_data));
- $this->log($tarr);
- $this->log(var_export($res,true));
- $this->log($identifierColumnModel->validationErrors);*/
- }
- else
- {
- if (!isset($ent['diff'])) // it is translated file and we add translation
- {
- unset($translationModel->id);
- if ($newIdentifier) // ovbiously there's no translation for identifier we just created
- $translation = array();
- else
- $translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_id' => $identifier_id, 'Translation.translation_text' => $ent["string"]), "recursive" => -1));
- if (!$translation)
- {
- $t_data['identifier_id'] = $identifier_id;
- if (isset($ent['string'])) // sheets doesn't have string (they have columns)
- $t_data['translation_text'] = $ent['string'];
- // TODO: change user_id for authorized user
- $t_data['user_id'] = 1;
- }
- else
- $t_data['id'] = $translation['Translation']['id'];
-// var_dump($i_data);
- $translationModel->save(array('Translation' => $t_data));
}
}
@@ -341,35 +316,19 @@ class RawFilesController extends AppController {
if (isset($ent['index']))
$fi_data['translation_index'] = $ent['index'];
-// $data['FileIdentifier']['identifier_id'] = ;
$fi_data['identifier_id'] = $identifier_id;
$res = $fileIdentifierModel->saveAll($tarr = array('FileIdentifier' => $fi_data));
-// $this->log($res);
-/* $this->log("#fi_data");
- $this->log($fi_data);*/
$fileIdentifier_id = $fileIdentifierModel->id;
}
-// $this->ImportedTranslationFile->FileIdentifier->create();
-// $this->ImportedTranslationFile->FileIdentifier->save($data);
-// $data['FileIdentifier'][] = $fi_data;
-// $l_data['Language']['id'] = $language_id;
-// $l_data['Identifier'][] = $i_data;
-// $data['Identifier'][] = $i_data;
-
$processedEntities++;
}
-/* $this->render('admin_index');
- return 0;*/
-// var_dump($data);
-// $this->ImportedTranslationFile->Language->saveAll($l_data);
if ($processedEntities == 0)
{
$importedTranslationFileModel->delete($importedTranslationFile_id);
$this->Session->setFlash(__('File was not imported because it seems empty', true));
-// $this->redirect(array('action' => 'index'));
$this->redirect($this->referer());
return 0;
}
@@ -377,26 +336,20 @@ class RawFilesController extends AppController {
{
$this->Session->setFlash(__('Translation file imported into database successfully. Processed entities: ' . $processedEntities, true));
$this->redirect(array('controller' => 'imported_translation_files', 'action' => 'view', $importedTranslationFileModel->id));
-// $this->render('admin_index');
return 0;
}
-// $this->ImportedTranslationFile->recursive = 0;
-// $this->set('importedTranslationFiles', $this->paginate());
-// $this->render('index');
}
function admin_export($dir = null, $filename = null, $importedTranslationFileId = null) {
if (!$filename) {
$this->Session->setFlash(__('Invalid file', true));
$this->redirect($this->referer());
-// $this->redirect(array('action' => 'index'));
return 0;
}
if (!$this->RawFile->open($dir, $filename, $writable = true))
{
$this->Session->setFlash(__('Can\'t open file for writing', true));
$this->redirect($this->referer());
-// $this->redirect(array('action' => 'index'));
return 0;
}
@@ -414,24 +367,19 @@ class RawFilesController extends AppController {
'conditions' => array(
'ImportedTranslationFile.filename' => $dir . DS . $filename
),
-// 'recursive' => 3
-// 'order' => 'FileIdentifier.translation_index',
)
);
-/* var_dump($translationFile);
- return 0;*/
if (!$importedTranslationFile)
{
$this->Session->setFlash(__('No imported translation file found for chosen file', true));
$this->redirect($this->referer());
-// $this->redirect(array('controller' => 'imported_translation_files', 'action' => 'index'));
return 0;
}
$translationFileModel = $importedTranslationFileModel->TranslationFile;
$identifierModel = $translationFileModel->Identifier;
- // TODO: check if all identifiers have "best" translation
+ // check if all identifiers have "best" translation
$identifier_ids = $identifierModel->withoutBestTranslation(array('ImportedTranslationFile.id' => $importedTranslationFile['ImportedTranslationFile']['id']));
if ($identifier_ids === false)
{
@@ -476,16 +424,11 @@ class RawFilesController extends AppController {
'index' => ((isset($fileIdentifier['translation_index']) && !empty($fileIdentifier['translation_index'])) ? $fileIdentifier['translation_index'] : null),
'internal_index' => $i++,
'type' => ((count($fileIdentifier['Identifier']['IdentifierColumn']) > 0) ? 'sheet' : 'string'),
-// 'type' => ((isset($fileIdentifier['command']) && !empty($fileIdentifier['command'])) ? $fileIdentifier['command'] : null),
'identifier' => $fileIdentifier['Identifier']['identifier'],
'arguments' => ((isset($fileIdentifier['arguments']) && !empty($fileIdentifier['arguments'])) ? $fileIdentifier['arguments'] : null),
-// 'string' => '',
);
-// $this->log($fileIdentifier['Identifier']['Translation']);
-// if (Set::numeric(array_keys($fileIdentifier['Identifier']['Translation'])))
if (isset($fileIdentifier['Identifier']['Translation'][0]))
{
-// $this->log('numeric');
$ent['string'] = $fileIdentifier['Identifier']['Translation'][0]['translation_text'];
}
else if (isset($fileIdentifier['Identifier']['Translation']['translation_text']))
@@ -501,9 +444,6 @@ class RawFilesController extends AppController {
foreach ($fileIdentifier['Identifier']['IdentifierColumn'] as $column_no => $identifierColumn)
{
-/* if (isset($identifierColumn['Translation']['translation_text']))
- $ent['columns'][$column_no] = $identifierColumn['Translation']['translation_text'];*/
-
if (isset($identifierColumn['Translation'][0]))
$ent['columns'][$column_no] = $identifierColumn['Translation'][0]['translation_text'];
else if (isset($identifierColumn['Translation']['translation_text']))
@@ -522,33 +462,10 @@ class RawFilesController extends AppController {
$entities[] = $ent;
}
-/* $sources = ConnectionManager::sourceList();
- $sqlLogs = array();
- foreach ($sources as $source)
- {
- $db =& ConnectionManager::getDataSource($source);
- if (!$db->isInterfaceSupported('getLog'))
- continue;
- $sqlLogs[$source] = $db->getLog();
- }
- $this->log($sqlLogs);*/
-
-// $this->log($importedTranslationFile);
-/* $this->log($sortResult);
- $this->log($entities);*/
ini_set('max_execution_time',0);
$result = $this->RawFile->buildFile($entities);
-// $this->log($result);
-// $this->render('admin_index');
-// $this->redirect(array('controller' => 'imported_translation_files', 'action' => 'index'));
-// return 0;
-
-/* var_dump($parsedFile);
- $this->render('index');
- return 0;*/
-// $this->log($parsedFile);
if (!$result)
{
$this->Session->setFlash(__('Error exporting file', true));
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/translation_files_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/translation_files_controller.php
index 4af5324c1..dc386711b 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/translation_files_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/translation_files_controller.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+set('translationFile', $this->TranslationFile->read(null, $id));
}
- function add() {
- if (!empty($this->data)) {
- $this->TranslationFile->create();
- if ($this->TranslationFile->save($this->data)) {
- $this->Session->setFlash(__('The translation file has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
- }
- }
- $languages = $this->TranslationFile->Language->find('list');
- $this->set(compact('languages'));
- }
-
- function edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid translation file', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if ($this->TranslationFile->save($this->data)) {
- $this->Session->setFlash(__('The translation file has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->TranslationFile->read(null, $id);
- }
- $languages = $this->TranslationFile->Language->find('list');
- $this->set(compact('languages'));
- }
-
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for translation file', true));
- $this->redirect(array('action'=>'index'));
- }
- if ($this->TranslationFile->delete($id)) {
- $this->Session->setFlash(__('Translation file deleted', true));
- $this->redirect(array('action'=>'index'));
- }
- $this->Session->setFlash(__('Translation file was not deleted', true));
- $this->redirect(array('action' => 'index'));
- }
function admin_index() {
$this->TranslationFile->recursive = 0;
$this->set('translationFiles', $this->paginate());
@@ -106,8 +79,9 @@ class TranslationFilesController extends AppController {
$this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
}
}
+ $this->set('translationFile', $translationFile_data = $this->TranslationFile->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->TranslationFile->read(null, $id);
+ $this->data = $translationFile_data;
}
$languages = $this->TranslationFile->Language->find('list');
$this->set(compact('languages'));
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/translations_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/translations_controller.php
index f50e265d5..875799e10 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/translations_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/translations_controller.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+Session->setFlash(__('Invalid translation', true));
$this->redirect(array('action' => 'index'));
}
-// $this->recursive=2;
$this->set('translation', $translation = $this->Translation->read(null, $id));
- $this->set('identifier', $identifier = $this->Translation->Identifier->read(null, $translation['Translation']['identifier_id']));
-// var_dump($translation);
-// var_dump($identifier);
+ if (isset($translation['Translation']['identifier_id']))
+ {
+ $this->set('identifier', $identifier = $this->Translation->Identifier->read(null, $translation['Translation']['identifier_id']));
+ $this->set('columnTranslations', $columnTranslations = $this->Translation->find('all', array('conditions' => array('Translation.parent_id' => $translation['Translation']['id']), 'order' => 'Translation.id')));
+ }
+ if ($identifier_id = $translation['Translation']['identifier_id'])
+ $this->set('identifierNeighbours', $this->Translation->Identifier->getNeighbours($identifier_id));
}
function add() {
if (!empty($this->data)) {
$this->Translation->create();
- if ($res = $this->Translation->save($this->data)) {
+ if ($this->data['ChildTranslation'])
+ {
+ unset($translationText);
+ foreach ($this->data['ChildTranslation'] as $num => $childTranslation)
+ {
+ $ent['columns'][] = $childTranslation['translation_text'];
+ $translationText .= $childTranslation['translation_text'] . "\t";
+ }
+ $this->data['Translation']['translation_text'] = substr($translationText, 0, -1);
+ }
+ else
+ $ent['string'] = $this->data['Translation']['translation_text'];
+ sort($ent['columns']);
+ $this->data['Translation']['translation_hash'] = $this->Translation->makeHash($ent);
+ $this->data['Identifier']['id'] = $this->data['Translation']['identifier_id'];
+ $this->data['Identifier']['translated'] = 1;
+ $res = $this->Translation->saveAll($this->data);
+ $this->log($this->data);
+ if ($res) {
$this->Session->setFlash(__('The translation has been saved', true));
- $this->redirect(array('action' => 'index', 'identifier_id' => $res['Translation']['identifier_id']));
+ if ($this->params['form']['Next'])
+ {
+ $identifier_id = $this->data['Translation']['identifier_id'];
+ $identifier = $this->Translation->Identifier->read(null, $identifier_id);
+ $identifierNeighbors = $this->Translation->Identifier->find('neighbors', array('field' => 'id', 'value' => $identifier_id, 'conditions' => array('translation_file_id' => $identifier['Identifier']['translation_file_id'])));
+ if ($nextIdentifier = $identifierNeighbors['next'])
+ $this->redirect(array('action' => 'add', 'identifier_id' => $nextIdentifier['Identifier']['id']));
+ else
+ $this->redirect(array('controller' => 'identifiers', 'action' => 'index', 'translation_file_id' => $identifier['Identifier']['translation_file_id']));
+ }
+ else
+ $this->redirect(array('controller' => 'identifiers', 'action' => 'view', $this->data['Translation']['identifier_id']));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
@@ -36,15 +87,17 @@ class TranslationsController extends AppController {
if (empty($this->passedArgs['identifier_id']))
{
$this->Session->setFlash(__('You need to choose identifier for translation', true));
- $this->redirect(array('controller' => 'identifiers', 'action' => 'index'));
+ $this->redirect($this->referer());
}
else
{
$identifier_id = $this->passedArgs['identifier_id'];
$this->set('identifier', $identifier = $this->Translation->Identifier->read(null, $identifier_id));
-// $this->data['Translation.identifier_id'] = $identifier_id;
+ $this->set('identifierNeighbours', $this->Translation->Identifier->getNeighbours($identifier_id));
+ $this->set('identifierColumns', $identifierColumns = $this->Translation->IdentifierColumn->find('list', array('conditions' => array('identifier_id' => $identifier_id), 'order' => 'IdentifierColumn.id')));
+ if ($identifierColumns)
+ $this->set('identifierColumnsDetails', Set::combine($this->Translation->IdentifierColumn->find('all', array('conditions' => array('identifier_id' => $identifier_id), 'order' => 'IdentifierColumn.id')), '{n}.IdentifierColumn.id', '{n}.IdentifierColumn'));
}
-// $identifiers = $this->Translation->Identifier->find('list', array('recursive' => -1));
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users'));
}
@@ -55,19 +108,51 @@ class TranslationsController extends AppController {
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
- if ($this->Translation->save($this->data)) {
+ if ($this->data['ChildTranslation'])
+ {
+ unset($translationText);
+ foreach ($this->data['ChildTranslation'] as $num => $childTranslation)
+ {
+ $ent['columns'][] = $childTranslation['translation_text'];
+ $translationText .= $childTranslation['translation_text'] . "\t";
+ }
+ $this->data['Translation']['translation_text'] = substr($translationText, 0, -1);
+ }
+ else
+ $ent['string'] = $this->data['Translation']['translation_text'];
+ $this->data['Translation']['translation_hash'] = $this->Translation->makeHash($ent);
+ $this->data['Identifier']['id'] = $this->data['Translation']['identifier_id'];
+ $this->data['Identifier']['translated'] = 1;
+ if ($this->Translation->saveAll($this->data)) {
$this->Session->setFlash(__('The translation has been saved', true));
- $this->redirect(array('action' => 'index'));
+ $this->redirect(array('controller' => 'identifiers', 'action' => 'view', $this->data['Translation']['identifier_id']));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
}
+ $this->set('translation', $translation_data = $this->Translation->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->Translation->read(null, $id);
+ $this->data = $translation_data;
+ }
+ $identifier_id= $translation_data['Translation']['identifier_id'];
+ $this->set('identifierNeighbours', $this->Translation->Identifier->getNeighbours($identifier_id));
+ $this->set('identifierColumns', $identifierColumns = $this->Translation->IdentifierColumn->find('list', array('conditions' => array('identifier_id' => $identifier_id), 'order' => 'IdentifierColumn.id')));
+ if ($identifierColumns)
+ {
+ $contain = array('Translation' => array(
+ 'conditions' => array('Translation.parent_id' => $translation_data['Translation']['id']),
+ ));
+ $identifierColumnsAll = $this->Translation->IdentifierColumn->find('all', array('conditions' => array('identifier_id' => $identifier_id), 'order' => 'IdentifierColumn.id', 'contain' => $contain));
+ foreach ($translation_data['ChildTranslation'] as $childTranslationKey => $childTranslation)
+ {
+ $mapChildTranslationsColumns[$childTranslation['identifier_column_id']] = $childTranslationKey;
+
+ }
+ $this->set(compact('mapChildTranslationsColumns'));
+ $this->set('identifierColumnsDetails', Set::combine($identifierColumnsAll, '{n}.IdentifierColumn.id', '{n}.IdentifierColumn'));
+ $this->set('identifierColumnTranslations', Set::combine($translation_data['ChildTranslation'], '{n}.identifier_column_id'));//, '{n}.identifier_column_id'));
}
-// var_dump($this->data);
$identifier = $this->Translation->Identifier->read(null, $this->data['Translation']['identifier_id']);
- $identifiers = $this->Translation->Identifier->find('list');
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users', 'identifier'));
}
@@ -79,7 +164,6 @@ class TranslationsController extends AppController {
}
if ($this->Translation->delete($id)) {
$this->Session->setFlash(__('Translation deleted', true));
-// $this->redirect(array('action'=>'index'));
$this->redirect($this->referer());
}
$this->Session->setFlash(__('Translation was not deleted', true));
@@ -99,52 +183,18 @@ class TranslationsController extends AppController {
else
$this->Session->setFlash(__('Set error', true));
$this->redirect($this->referer());
-// $this->index();
-// $this->render('index');
}
function admin_view($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid translation', true));
- $this->redirect(array('action' => 'index'));
- }
- $this->set('translation', $this->Translation->read(null, $id));
+ return $this->view($id);
}
function admin_add() {
- if (!empty($this->data)) {
- $this->Translation->create();
- if ($this->Translation->save($this->data)) {
- $this->Session->setFlash(__('The translation has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
- }
- }
- $identifiers = $this->Translation->Identifier->find('list');
- $users = $this->Translation->User->find('list');
- $this->set(compact('identifiers', 'users'));
+ return $this->add();
}
function admin_edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid translation', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if ($this->Translation->save($this->data)) {
- $this->Session->setFlash(__('The translation has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->Translation->read(null, $id);
- }
- $identifiers = $this->Translation->Identifier->find('list');
- $users = $this->Translation->User->find('list');
- $this->set(compact('identifiers', 'users'));
+ return $this->edit($id);
}
function admin_delete($id = null) {
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/users_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/users_controller.php
index 5c8cbcb70..adc42655b 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/users_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/users_controller.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+set('user', $this->User->read(null, $id));
}
- function add() {
- if (!empty($this->data)) {
- $this->User->create();
- if ($this->User->save($this->data)) {
- $this->Session->setFlash(__('The user has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
- }
- }
- }
-
- function edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid user', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if ($this->User->save($this->data)) {
- $this->Session->setFlash(__('The user has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->User->read(null, $id);
- }
- }
-
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for user', true));
- $this->redirect(array('action'=>'index'));
- }
- if ($this->User->delete($id)) {
- $this->Session->setFlash(__('User deleted', true));
- $this->redirect(array('action'=>'index'));
- }
- $this->Session->setFlash(__('User was not deleted', true));
- $this->redirect(array('action' => 'index'));
- }
function admin_index() {
$this->User->recursive = 0;
$this->set('users', $this->paginate());
@@ -98,8 +75,9 @@ class UsersController extends AppController {
$this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
}
}
+ $this->set('user', $user_data = $this->User->read(null, $id));
if (empty($this->data)) {
- $this->data = $this->User->read(null, $id);
+ $this->data = $user_data;
}
}
@@ -117,6 +95,32 @@ class UsersController extends AppController {
}
function login() {
+ if (!empty($this->data))
+ {
+ $user = $this->User->find('first', array('conditions' => array('User.username' => $this->data['User']['username'])));
+ $this->log($user);
+ if ($user['User']['confirm_hash'])
+ {
+ $this->Session->delete('Message.auth');
+ $this->Session->setFlash('This account is not yet confirmed. Please use confirmation link from email to finalize registration.');
+ $this->redirect($this->referer());
+ }
+ if (!$user['User']['activated'])
+ {
+ $this->Session->delete('Message.auth');
+ $this->Session->setFlash('This account is not yet activated. Please wait until administrator activates your account.');
+ $this->redirect($this->referer());
+ }
+
+ }
+ if (!(empty($this->data)) && $this->Auth->user())
+ {
+ $this->log('a');
+ $this->User->id = $this->Auth->user('id');
+ $this->User->saveField('last_login', date('Y-m-d H:i:s'));
+ $this->redirect($this->Auth->redirect());
+ }
+ $this->log('b');
}
function logout() {
@@ -131,16 +135,10 @@ class UsersController extends AppController {
function register() {
if(!empty($this->data)) {
$this->User->create();
-/* $assigned_password = 'newpass';
- $this->data['User']['password'] = $this->Auth->password($assigned_password);*/
$this->data['User']['password'] = $this->Auth->password($this->data['User']['passwd']);
$this->data['User']['confirm_hash'] = $this->Auth->password($this->data['User']['name'] . time());
if($user = $this->User->save($this->data)) {
// send signup email containing password to the user
-// $this->Session->setFlash('your password is ' . $assigned_password);
-// $this->Session->setFlash('your password is ' . var_export($this->data['User']['password'], true));
-// $this->Auth->login($this->data);
-// $this->Email->delivery = 'debug';
$this->Email->from = 'webtt-noreply@openlink.pl';
$this->Email->to = $user['User']['email'];
$this->Email->subject = 'WebTT registration';
@@ -149,10 +147,9 @@ class UsersController extends AppController {
$this->set('user', $this->data);
$this->set('serverName', $_SERVER['SERVER_NAME']);
$this->params['url']['ext'] = 'no_debug';
-// var_dump($this->helpers);
unset($this->helpers['DebugKit.Toolbar']);
$this->Email->send();
- $this->Session->setFlash('Thank you for registreation. Please use confirm link from email to finalize registration.');
+ $this->Session->setFlash('Thank you for registrating. Please use confirmation link from email to finalize registration.');
$this->redirect('/');
}
}
@@ -168,7 +165,7 @@ class UsersController extends AppController {
}
$this->User->id = $user['User']['id'];
$this->User->save(array('confirm_hash' => null));
- $this->Session->setFlash('Thank you for registreation. You can now log in.');
+ $this->Session->setFlash('Thank you for registrating. You will be able to log in after your account is activated by administrator.');
$this->redirect('/');
}
}
diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/votes_controller.php b/code/ryzom/tools/server/www/webtt/app/controllers/votes_controller.php
index 7be099b29..7a0e0bb9e 100644
--- a/code/ryzom/tools/server/www/webtt/app/controllers/votes_controller.php
+++ b/code/ryzom/tools/server/www/webtt/app/controllers/votes_controller.php
@@ -1,18 +1,33 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+Vote->recursive = 0;
-// var_dump($this->Vote->belongsTo);
-// var_dump($this->Vote->getAssociated());
-// $model = $this->{$this->modelClass};
-// $this->log($tree=$this->PathResolver->getAssociationsTree($model));
-// $this->log($this->PathResolver->getAssociationsGraph('User',$tree));
-// $this->log($this->PathResolver->printPath($model), 'info');
-// $this->log($this->PathResolver->node_path('Language', $tree));
- $this->set('votes', $this->paginate());
+ $conditions = null;
+ if (isset($this->passedArgs['translation_id']) && $translation_id = $this->passedArgs['translation_id'])
+ $conditions = array('Vote.translation_id' => $translation_id);
+ $this->set('votes', $this->paginate($conditions));
}
function view($id = null) {
@@ -39,14 +54,14 @@ class VotesController extends AppController {
}
function vote() {
- if (empty($this->passedArgs['translation']))
+ if (empty($this->passedArgs['translation_id']))
{
$this->Session->setFlash(__('You need to choose translation for your vote', true));
$this->redirect(array('controller' => 'translations', 'action' => 'index'));
}
else
{
- $translation_id = $this->passedArgs['translation'];
+ $translation_id = $this->passedArgs['translation_id'];
$translation = $this->Vote->Translation->read(null, $translation_id);
if (!$translation)
{
@@ -55,16 +70,13 @@ class VotesController extends AppController {
}
$vote = array("Vote" => array(
'translation_id' => $translation_id,
- // TODO: authorized user
- 'user_id' => 1,
+ 'user_id' => $this->Auth->user('id'),
),
);
$this->Vote->create();
$this->Vote->save($vote);
$this->Session->setFlash(__('Vote added', true));
- $this->redirect($this->referer(array('controller' => 'translations', 'action' => 'index')));
-// $this->redirect(array('controller' => 'translations', 'action' => 'index'));
-// $this->data['Translation.identifier_id'] = $identifier_id;
+ $this->redirect($this->referer());
}
}
diff --git a/code/ryzom/tools/server/www/webtt/app/models/app_model.php b/code/ryzom/tools/server/www/webtt/app/models/app_model.php
index 9def128fd..82b358feb 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/app_model.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/app_model.php
@@ -32,7 +32,9 @@
* @subpackage cake.cake.libs.model
*/
class AppModel extends Model {
-// var $useDbConfig = 'raw_files';
+// var $recursive = 0;
+
var $scaffoldForbiddenActions = null;
var $scaffoldActions = null;
+ var $scaffoldForbiddenFields = null;
}
diff --git a/code/ryzom/tools/server/www/webtt/app/models/behaviors/null.php b/code/ryzom/tools/server/www/webtt/app/models/behaviors/null.php
new file mode 100644
index 000000000..6e8b406c9
--- /dev/null
+++ b/code/ryzom/tools/server/www/webtt/app/models/behaviors/null.php
@@ -0,0 +1,39 @@
+settings[$model->name] = $config;
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param AppModel $model
+ */
+ function beforeSave(&$model)
+ {
+ foreach ($this->settings[$model->name] as $field)
+ {
+ if(
+ true === array_key_exists($field,$model->data[$model->name]) &&
+ true === empty($model->data[$model->name][$field]) &&
+ 0 === strlen($model->data[$model->name][$field]) )
+ {
+ $model->data[$model->name][$field] = null;
+ }
+ }
+ return true;
+ }
+}
+?>
diff --git a/code/ryzom/tools/server/www/webtt/app/models/comment.php b/code/ryzom/tools/server/www/webtt/app/models/comment.php
index f7419d50d..94e51f1df 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/comment.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/comment.php
@@ -1,10 +1,28 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ "fk");
- //The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
/* 'Translation' => array(
diff --git a/code/ryzom/tools/server/www/webtt/app/models/datasources/raw_files_source.php b/code/ryzom/tools/server/www/webtt/app/models/datasources/raw_files_source.php
index cc8ed26e4..b775a09bc 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/datasources/raw_files_source.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/datasources/raw_files_source.php
@@ -1,34 +1,23 @@
'Datasources.CsvSource',
- * 'path' => '/path/to/file', // Path
- * 'extension' => 'csv', // File extension
- * 'readonly' => true, // Mark for read only access
- * 'recursive' => false // Only false is supported at the moment
- * );
- */
+/*
+ Ryzom Core Web-Based Translation Tool
+ Copyright (C) 2011 Piotr Kaczmarek
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array(
diff --git a/code/ryzom/tools/server/www/webtt/app/models/identifier.php b/code/ryzom/tools/server/www/webtt/app/models/identifier.php
index 5f4d2da69..14796c74f 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/identifier.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/identifier.php
@@ -1,20 +1,29 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array(
- 'numeric' => array(
- 'rule' => array('numeric'),
- 'message' => 'Your custom message here',
- 'allowEmpty' => false,
- //'required' => true,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),*/
'identifier' => array(
'A_Za_z0_9' => array(
'rule' => '/[A-Za-z0-9_@]+/',
@@ -29,16 +38,7 @@ class Identifier extends AppModel {
var $scaffoldForbiddenActions = array("add", "admin_add", "edit", "admin_edit", "delete", "admin_delete");
- //The Associations below have been created with all possible keys, those that are not needed can be removed
-
var $belongsTo = array(
-/* 'Language' => array(
- 'className' => 'Language',
- 'foreignKey' => 'language_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- ),*/
'TranslationFile' => array(
'className' => 'TranslationFile',
'foreignKey' => 'translation_file_id',
@@ -130,4 +130,15 @@ class Identifier extends AppModel {
else
return false;
}
+
+ function getNeighbours($id)
+ {
+ $identifierNeighbours['current'][] = $this->read(null, $id);
+ if ($identifierNeighbours['current'])
+ {
+ $identifierNeighbours['prev'] = $this->find('all', array('order' => 'Identifier.id DESC', 'limit' => 5, 'conditions' => array('Identifier.translation_file_id' => $identifierNeighbours['current'][0]['Identifier']['translation_file_id'], 'Identifier.id <' => $identifierNeighbours['current'][0]['Identifier']['id'])));
+ $identifierNeighbours['next'] = $this->find('all', array('order' => 'Identifier.id ASC', 'limit' => 5, 'conditions' => array('Identifier.translation_file_id' => $identifierNeighbours['current'][0]['Identifier']['translation_file_id'], 'Identifier.id >' => $identifierNeighbours['current'][0]['Identifier']['id'])));
+ }
+ return $identifierNeighbours;
+ }
}
diff --git a/code/ryzom/tools/server/www/webtt/app/models/identifier_column.php b/code/ryzom/tools/server/www/webtt/app/models/identifier_column.php
index c6770212b..abb038407 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/identifier_column.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/identifier_column.php
@@ -1,12 +1,30 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array(
'className' => 'Identifier',
diff --git a/code/ryzom/tools/server/www/webtt/app/models/imported_translation_file.php b/code/ryzom/tools/server/www/webtt/app/models/imported_translation_file.php
index 4a816da63..9c4021977 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/imported_translation_file.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/imported_translation_file.php
@@ -1,22 +1,32 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array(
- 'className' => 'Language',
- 'foreignKey' => 'language_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- ),
'TranslationFile' => array(
'className' => 'TranslationFile',
'foreignKey' => 'translation_file_id',
diff --git a/code/ryzom/tools/server/www/webtt/app/models/language.php b/code/ryzom/tools/server/www/webtt/app/models/language.php
index bd82c0fcb..bc8bdadcd 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/language.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/language.php
@@ -1,10 +1,28 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array(
@@ -20,32 +38,5 @@ class Language extends AppModel {
'finderQuery' => '',
'counterQuery' => ''
),
- 'ImportedTranslationFile' => array(
- 'className' => 'ImportedTranslationFile',
- 'foreignKey' => 'language_id',
- 'dependent' => false,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'exclusive' => '',
- 'finderQuery' => '',
- 'counterQuery' => ''
- ),
- 'Identifier' => array(
- 'className' => 'Identifier',
- 'foreignKey' => 'language_id',
- 'dependent' => false,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'exclusive' => '',
- 'finderQuery' => '',
- 'counterQuery' => ''
- ),
);
-
}
diff --git a/code/ryzom/tools/server/www/webtt/app/models/raw_file.php b/code/ryzom/tools/server/www/webtt/app/models/raw_file.php
index 8911bab90..b1a72e26c 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/raw_file.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/raw_file.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array(
@@ -18,21 +36,6 @@ class RawFile extends AppModel {
'order' => ''
),
);
-/* var $hasOne = array(
- 'FileIdentifier' => array(
- 'className' => 'FileIdentifier',
- 'foreignKey' => 'translation_file_id',
- 'dependent' => true,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'exclusive' => '',
- 'finderQuery' => '',
- 'counterQuery' => ''
- )
- );*/
public function open($dir, $filename, $write = false)
{
@@ -47,7 +50,6 @@ class RawFile extends AppModel {
return false;
if ($write && !$file->writable())
return false;
-// var_dump($filename);
$this->_currentFile = $file;
$this->_currentFileLastChange = $file->lastChange();
return $file;
@@ -55,7 +57,6 @@ class RawFile extends AppModel {
public function parseFile()
{
-// var_dump($this->_currentFile);
if (!$this->_currentFile)
return false;
@@ -93,7 +94,6 @@ class RawFile extends AppModel {
public function buildFile($entities)
{
-// var_dump($this->_currentFile);
if (!$this->_currentFile)
return false;
@@ -133,7 +133,6 @@ class RawFile extends AppModel {
public function getLanguageCode($filename)
{
-// var_dump($filename);
if (preg_match('|^([a-z]{2})_diff_[A-F0-9]{8}\.uxt$|', $filename, $matches))
return $matches[1];
else if (preg_match('|^([a-z]{2})\.uxt$|', $filename, $matches))
diff --git a/code/ryzom/tools/server/www/webtt/app/models/translation.php b/code/ryzom/tools/server/www/webtt/app/models/translation.php
index 6c8ecafdc..fd481f1e9 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/translation.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/translation.php
@@ -1,11 +1,29 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ "fk", "index" => "fk");
- //The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'Identifier' => array(
@@ -28,7 +46,14 @@ class Translation extends AppModel {
'conditions' => '',
'fields' => '',
'order' => ''
- )
+ ),
+ 'ParentTranslation' => array(
+ 'className' => 'Translation',
+ 'foreignKey' => 'parent_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
);
var $hasMany = array(
@@ -58,6 +83,19 @@ class Translation extends AppModel {
'finderQuery' => '',
'counterQuery' => ''
),*/
+ 'ChildTranslation' => array(
+ 'className' => 'Translation',
+ 'foreignKey' => 'parent_id',
+ 'dependent' => false,
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'exclusive' => '',
+ 'finderQuery' => '',
+ 'counterQuery' => ''
+ ),
);
function setBest()
@@ -80,8 +118,18 @@ class Translation extends AppModel {
),
));
$this->log($ret);
- // TODO: test!
return $this->id;
}
+
+ function makeHash($ent)
+ {
+ if (isset($ent['columns']) && is_array($ent['columns']))
+ {
+ sort($ent['columns']);
+ return md5(serialize($ent['columns']));
+ }
+ else if (isset($ent['string']))
+ return md5($ent['string']);
+ }
}
diff --git a/code/ryzom/tools/server/www/webtt/app/models/translation_file.php b/code/ryzom/tools/server/www/webtt/app/models/translation_file.php
index d972e88ac..ef4ed9421 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/translation_file.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/translation_file.php
@@ -1,12 +1,29 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array(
'className' => 'Language',
diff --git a/code/ryzom/tools/server/www/webtt/app/models/user.php b/code/ryzom/tools/server/www/webtt/app/models/user.php
index 0daa4b852..75dde4d62 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/user.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/user.php
@@ -1,15 +1,38 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array('confirm_hash'));
+
+ var $recursive = 0;
+
var $validate = array(
'username' => array(
'alphaNumeric',
-/* 'uniqueCheck' => array(
+ 'uniqueCheck' => array(
'rule' => 'isUnique',
'message' => 'That username has already been taken.',
- ),*/
+ ),
),
'email' => array('rule' => 'email', 'message' => 'Wrong format'),
'name' => array('rule' => 'notEmpty'),
@@ -18,8 +41,7 @@ class User extends AppModel {
);
var $scaffoldForbiddenActions = array("add", "edit", "delete");
-
- //The Associations below have been created with all possible keys, those that are not needed can be removed
+ var $scaffoldForbiddenFields = array("" => array("activated","password","confirm_hash","created","modified"),/* "admin_" => array("password")*/);
var $hasMany = array(
'Translation' => array(
@@ -47,7 +69,20 @@ class User extends AppModel {
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
- )
+ ),
+ 'Comment' => array(
+ 'className' => 'Comment',
+ 'foreignKey' => 'user_id',
+ 'dependent' => false,
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'exclusive' => '',
+ 'finderQuery' => '',
+ 'counterQuery' => ''
+ ),
);
}
diff --git a/code/ryzom/tools/server/www/webtt/app/models/vote.php b/code/ryzom/tools/server/www/webtt/app/models/vote.php
index f03d6b910..18737144d 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/vote.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/vote.php
@@ -1,10 +1,28 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+ array(
diff --git a/code/ryzom/tools/server/www/webtt/app/vendors/PhraseParser.php b/code/ryzom/tools/server/www/webtt/app/vendors/PhraseParser.php
index 4e63870dd..91da72a72 100644
--- a/code/ryzom/tools/server/www/webtt/app/vendors/PhraseParser.php
+++ b/code/ryzom/tools/server/www/webtt/app/vendors/PhraseParser.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+\n\n";
}
$line_no=1;
+
+/* var_dump(setlocale(LC_ALL,NULL));
+ var_dump(setlocale(LC_ALL,'pl_PL.UTF-8'));*/
+ // Need to set UTF-8 locale to get str_getcsv to work with UTF-8 cyryllic
+ setlocale(LC_ALL,'pl_PL.UTF-8');
+
foreach ($lines as $line)
{
if ($this->debug)
@@ -36,11 +61,6 @@ class SheetParser
// var_dump($line);
$line = rtrim($line,"\r\n");
-/* var_dump(setlocale(LC_ALL,NULL));
- var_dump(setlocale(LC_ALL,'pl_PL.UTF-8'));*/
- // Need to set UTF-8 locale to get str_getcsv to work with UTF-8 cyryllic
- setlocale(LC_ALL,'pl_PL.UTF-8')
-
$parsedLine = $this->parseLine($line);
if (!$line || mb_strpos($line, "DIFF NOT") === 0 || mb_strpos($line, "REMOVE THE") === 0)
diff --git a/code/ryzom/tools/server/www/webtt/app/vendors/StringParser.php b/code/ryzom/tools/server/www/webtt/app/vendors/StringParser.php
index e559c0ba6..f2b4bc184 100644
--- a/code/ryzom/tools/server/www/webtt/app/vendors/StringParser.php
+++ b/code/ryzom/tools/server/www/webtt/app/vendors/StringParser.php
@@ -1,4 +1,23 @@
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+?>
+debug) echo "DODANIE \n";
$parsedEnt += $parsedLine;
- $parsedEnt['string'] .= "\n";
+// $parsedEnt['string'] .= "\n";
}
if ($this->debug)
diff --git a/code/ryzom/tools/server/www/webtt/app/vendors/shells/templates/webtt/views/form.ctp b/code/ryzom/tools/server/www/webtt/app/vendors/shells/templates/webtt/views/form.ctp
index 58b63a389..1845005c0 100644
--- a/code/ryzom/tools/server/www/webtt/app/vendors/shells/templates/webtt/views/form.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/vendors/shells/templates/webtt/views/form.ctp
@@ -23,7 +23,6 @@
?>