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 ca5057ba0..a4183b950 100644
--- a/code/ryzom/tools/server/www/webtt/app/config/database.php
+++ b/code/ryzom/tools/server/www/webtt/app/config/database.php
@@ -8,11 +8,14 @@ class DATABASE_CONFIG {
'login' => 'webtt',
'password' => 'webtt77',
'database' => 'webtt2',
- 'encoding' => 'y'
+ 'encoding' => 'utf8'
);
var $raw_files = array(
- 'driver' => "",
- 'datasource' => 'raw_files',
+ 'datasource' => 'RawFilesSource',
+ 'path' => '/home/kaczorek/projects/webtt/distfiles/translation',
+ 'extension' => '(uxt|txt)',
+ 'readonly' => true,
+ 'recursive' => true,
);
}
?>
\ No newline at end of file
diff --git a/code/ryzom/tools/server/www/webtt/app/config/routes.php b/code/ryzom/tools/server/www/webtt/app/config/routes.php
index a186e49b4..7f5ab74fe 100644
--- a/code/ryzom/tools/server/www/webtt/app/config/routes.php
+++ b/code/ryzom/tools/server/www/webtt/app/config/routes.php
@@ -31,3 +31,9 @@
* ...and connect the rest of 'Pages' controller's urls.
*/
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
+/**
+ * Connect 'Pages' controller's urls for admin prefix.
+ */
+ Router::connect('/admin/pages/*', array('controller' => 'pages', 'action' => 'display', 'admin' => true));
+ Router::connect('/admin/pages', array('controller' => 'pages', 'action' => 'display', 'admin' => true, 'home'));
+ Router::connect('/admin', array('controller' => 'pages', 'action' => 'display', 'admin' => true, 'home'));
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 458137748..a60584a71 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,5 +33,41 @@
* @link http://book.cakephp.org/view/957/The-App-Controller
*/
class AppController extends Controller {
- var $components = array('DebugKit.Toolbar', 'Session');
+ var $components = array('DebugKit.Toolbar', 'Session', 'PathResolver', 'Auth' => array("authorize"=>"controller"));
+ var $layout = "new";
+
+ function beforeFilter() {
+ parent::beforeFilter();
+ $this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
+
+ if ($this->Auth->user('role') == "admin")
+ $this->Auth->allow("*");
+ else if ($this->Auth->user())
+ {
+ // $this->Auth->allow('index', 'view', 'add', 'delete', 'edit');
+ foreach ($this->methods as $method)
+ if (mb_strpos($method, 'admin_') !== 0)
+ $this->Auth->allow($method);
+ }
+ }
+
+ function isAuthorized() {
+/* if (isset($this->params['prefix']) && $this->params['prefix'] == "admin" && $this->Auth->user('role') != "admin")
+ {
+ return false;
+ }
+
+ return true;*/
+ $action = $this->params['action'];
+ $allowedActions = array_map('strtolower', $this->Auth->allowedActions);
+ $isAllowed = (
+ $this->Auth->allowedActions == array('*') ||
+ in_array($action, $allowedActions)
+ );
+// $this->log($isAllowed);
+ return $isAllowed;
+//
+ }
+
+
}
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 4a8d61a58..eabc80e77 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
@@ -26,9 +26,9 @@ class FileIdentifiersController extends AppController {
$this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
}
}
- $translationFiles = $this->FileIdentifier->TranslationFile->find('list');
+ $importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
- $this->set(compact('translationFiles', 'identifiers'));
+ $this->set(compact('importedTranslationFiles', 'identifiers'));
}
function edit($id = null) {
@@ -47,9 +47,9 @@ class FileIdentifiersController extends AppController {
if (empty($this->data)) {
$this->data = $this->FileIdentifier->read(null, $id);
}
- $translationFiles = $this->FileIdentifier->TranslationFile->find('list');
+ $importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
- $this->set(compact('translationFiles', 'identifiers'));
+ $this->set(compact('importedTranslationFiles', 'identifiers'));
}
function delete($id = null) {
@@ -87,9 +87,9 @@ class FileIdentifiersController extends AppController {
$this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
}
}
- $translationFiles = $this->FileIdentifier->TranslationFile->find('list');
+ $importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
- $this->set(compact('translationFiles', 'identifiers'));
+ $this->set(compact('importedTranslationFiles', 'identifiers'));
}
function admin_edit($id = null) {
@@ -108,9 +108,9 @@ class FileIdentifiersController extends AppController {
if (empty($this->data)) {
$this->data = $this->FileIdentifier->read(null, $id);
}
- $translationFiles = $this->FileIdentifier->TranslationFile->find('list');
+ $importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
- $this->set(compact('translationFiles', 'identifiers'));
+ $this->set(compact('importedTranslationFiles', 'identifiers'));
}
function admin_delete($id = null) {
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 cae46aa55..01c5911e7 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
@@ -2,10 +2,42 @@
class IdentifiersController extends AppController {
var $name = 'Identifiers';
-
+// var $layout = "new";
function index() {
$this->Identifier->recursive = 0;
- $this->set('identifiers', $this->paginate());
+// Router::connectNamed(array('language'));
+
+ $conditions = null;
+ if (isset($this->passedArgs['language']) && $lang = $this->passedArgs['language'])
+ $conditions = array('Identifier.language_id' => $lang);
+ if (isset($this->passedArgs['translation_file_id']) && $translation_file_id = $this->passedArgs['translation_file_id'])
+ $conditions = array('Identifier.translation_file_id' => $translation_file_id);
+ $this->set('identifiers', $this->paginate($conditions));
+ }
+
+ function admin_withoutBestTranslation()
+ {
+ if (isset($this->passedArgs['imported_translation_file_id']) && $imported_translation_file_id = $this->passedArgs['imported_translation_file_id'])
+ {
+ $identifier_ids = $this->Identifier->withoutBestTranslation(array('ImportedTranslationFile.id' => $this->passedArgs['imported_translation_file_id']));
+ if ($identifier_ids === false)
+ {
+ $this->Session->setFlash(__('Error: no conditions specified', true));
+ }
+ else
+ {
+ $conditions = array('Identifier.id' => $identifier_ids, 'BestTranslation.id' => NULL);
+ $this->set('identifiers', $this->paginate($conditions));
+ }
+// $this->log($this->Identifier->withoutBestTranslation(array('ImportedTranslationFile.id' => $this->passedArgs['imported_translation_file_id'])));
+ // TOTHINK: try to achieve that with custom find with pagination
+ }
+ else
+ {
+ $this->Session->setFlash(__('No imported file specified', true));
+ $this->redirect($this->referer());
+ }
+ $this->render('index');
}
function view($id = null) {
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 77576c003..58296aed4 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
@@ -2,7 +2,7 @@
class ImportedTranslationFilesController extends AppController {
var $name = 'ImportedTranslationFiles';
- var $layout = "default_debug";
+// var $layout = "default_debug";
function index() {
$this->ImportedTranslationFile->recursive = 0;
$this->set('importedTranslationFiles', $this->paginate());
@@ -149,6 +149,7 @@ class ImportedTranslationFilesController extends AppController {
}
function admin_index() {
$this->ImportedTranslationFile->recursive = 0;
+// FireCake::dump("??",$_SERVER);
$this->set('importedTranslationFiles', $this->paginate());
}
@@ -157,7 +158,7 @@ class ImportedTranslationFilesController extends AppController {
$this->Session->setFlash(__('Invalid translation file', true));
$this->redirect(array('action' => 'index'));
}
- $this->set('translationFile', $this->ImportedTranslationFile->read(null, $id));
+ $this->set('importedTranslationFile', $this->ImportedTranslationFile->read(null, $id));
}
function admin_add() {
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 f88ee9739..53e8405d1 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
@@ -9,6 +9,7 @@ class LanguagesController extends AppController {
FireCake::enable();
firecake('testestestes');
FireCake::dump('test','testsss');*/
+ App::import("Vendor","functions_render");
$this->Language->recursive = 0;
$this->set('languages', $this->paginate());
}
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 e49bdf14f..618110db2 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
@@ -5,33 +5,51 @@ class RawFilesController extends AppController {
var $helpers = array('Paginator', 'Time', 'Session');
var $components = array('Session');
- function index() {
+ function admin_index() {
$this->RawFile->recursive = 1;
// var_dump($this->RawFile->find('count'));
// $db =& ConnectionManager::getDataSource($this->RawFile->useDbConfig);
// var_dump($db->calculate($this->RawFile, 'count'));
- $this->set('rawFiles', $this->paginate());
+ $conditions['RawFile.dir'] = array("diff","translated");
+ $this->set('rawFiles', $this->paginate($conditions));
+// $this->log(Router::parse($this->referer()));
// var_dump($this->paginate());
}
- function admin_index() {
- $this->index();
- }
-
- function listdir($ext = null) {
+ function admin_listdir($extension = null) {
$this->RawFile->recursive = 0;
- $this->set('rawFiles', $this->paginate(array("ext" => $ext)));
+ $this->set('rawFiles', $this->paginate(array("RawFile.extension" => $extension)));
+ $this->rendeR("admin_index");
// var_dump($this->paginate());
}
- function view($id = null) {
- if (!$id) {
+ function admin_view($dir = null, $filename = null) {
+ if (!$filename) {
$this->Session->setFlash(__('Invalid raw file', true));
$this->redirect(array('action' => 'index'));
}
- $this->set('rawFile', $this->RawFiles->read(null, $id));
+ if (!$this->RawFile->open($dir, $filename))
+ {
+ $this->Session->setFlash(__('Can\'t open file', true));
+ $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,
+ "RawFile.filename" => $filename,
+ ),
+ )));
+
+ $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'));
@@ -47,12 +65,16 @@ class RawFilesController extends AppController {
return 0;
}
$importedTranslationFileModel = $this->RawFile->ImportedTranslationFile;
- $languageModel = $importedTranslationFileModel->Language;
- $identifierModel = $languageModel->Identifier;
+ $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)));
+ $importedTranslationFile = $importedTranslationFileModel->find('first', array('conditions' => array('ImportedTranslationFile.filename' => $dir . DS . $filename), "recursive" => -1));
/* var_dump($translationFile);
return 0;*/
if ($importedTranslationFile)
@@ -63,8 +85,6 @@ class RawFilesController extends AppController {
}
// var_dump($file);
// $parser = new UxtParser();
- $parsedFile = $this->RawFile->parseFile($filename);
-// var_dump($parsedFile);
// $arr = explode("_", basename($filename, ".uxt"));
// var_dump($arr);
@@ -76,7 +96,7 @@ class RawFilesController extends AppController {
$this->redirect(array('action' => 'index'));
return 0;
}
- $language = $importedTranslationFileModel->Language->find('first', array('conditions' => array('code' => $languageCode)));
+ $language = $languageModel->find('first', array('conditions' => array('code' => $languageCode), "recursive" => -1));
$language_id = $language['Language']['id'];
if (!$language_id)
{
@@ -89,66 +109,451 @@ class RawFilesController extends AppController {
// var_dump($language_id);
}
+ $filename_template = preg_replace('/_diff/', '', $filename);
+ $filename_template = preg_replace('/_[A-F0-9]{8}/', '', $filename_template);
+
+// for global identifiers
+/* if (preg_match('|^.*_' . $language['Language']['code'] . '.*$|', $filename_template, $matches))
+ $filename_template = preg_replace('/_' . $language['Language']['code'] . '/', '_LC', $filename_template);
+ else if (preg_match('|^.*' . $language['Language']['code'] . '.*$|', $filename_template, $matches))
+ $filename_template = preg_replace('/' . $language['Language']['code'] . '/', 'LC', $filename_template);
+ else
+ {
+ $this->Session->setFlash(__('Can\'t create master translation filename template from current filename', true));
+ $this->redirect(array('action' => 'index'));
+ return 0;
+ }*/
+
+ $translationFile = $translationFileModel->find('first', array('conditions' => array('filename_template' => $filename_template), "recursive" => -1));
+ if (!$translationFile)
+ {
+ $tf_data['filename_template'] = $filename_template;
+ $tf_data['language_id'] = $language_id;
+ }
+ else
+ $tf_data['id'] = $translationFile['TranslationFile']['id'];
+
+ $res = $translationFileModel->saveAll(array('TranslationFile' => $tf_data));
+ $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);
+
+ $processedEntities = 0;
+
$importedTranslationFileModel->create();
$data['ImportedTranslationFile']['language_id'] = $language_id;
+ $data['ImportedTranslationFile']['translation_file_id'] = $translation_file_id;
$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)
{
- $fi_data = array();
- if ($ent['type'] != "string")
+ if (!isset($ent['type']))
+ var_dump($ent);
+
+ if ($ent['type'] == 'sheet_description')
+ {
+ $_columns = $ent['columns'];
+ $_sheet_id_column = $ent['sheet_id_column'];
+ }
+
+ if ($ent['type'] != "string" && $ent['type'] != "phrase" && $ent['type'] != 'sheet')
continue;
+ $newIdentifier = false;
+ $i_data = array();
$i_data['language_id'] = $language_id;
- $i_data['translation_index'] = $ent['index'];
- $i_data['reference_string'] = $ent['string'];
+ $i_data['translation_file_id'] = $translation_file_id;
+ if (isset($ent['index']))
+ $i_data['translation_index'] = $ent['index'];
+ if (isset($ent['arguments']))
+ $i_data['arguments'] = $ent['arguments'];
+
+ if (isset($ent['diff']) && isset($ent['string']))
+ {
+ $i_data['reference_string'] = $ent['string'];
+ }
unset($identifierModel->id);
- $identifier = $identifierModel->find('first',array('conditions' => array('Identifier.identifier' => $ent['identifier'], 'Identifier.language_id' => $language_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
{
+ $identifierModel->create();
$i_data['identifier'] = $ent['identifier'];
- $i_data['translated'] = false;
+ 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);
- $identifierModel->save(array('Identifier' => $i_data));
+ $res = $identifierModel->saveAll($tarr = array('Identifier' => $i_data));
$identifier_id = $identifierModel->id;
-// var_dump($identifier_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['columns']) && is_array($ent['columns']))
+ {
+/* $this->log($_columns);
+ $this->log($ent['columns']);*/
+ $ic_data = array();
+ foreach ($ent['columns'] as $column_no => $value)
+ {
+ unset($identifierColumnModel->id);
+ $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)
+ {
+ if ($identifierColumn['column_name'] == $column_name)
+ {
+ $ic_arr['id'] = $identifierColumn['id'];
+ break;
+ }
+ }
+ }
+ $ic_arr['column_name'] = $column_name;
+ 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);
+ 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));
+
+ 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;
+ }
+ else
+ $t_data['id'] = $translation['Translation']['id'];
+// var_dump($i_data);
+ $translationModel->save(array('Translation' => $t_data));
+ }
+
+ }
+/* $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));
+ }
+ }
unset($fileIdentifierModel->id);
- //TODO - set FileIdentifier['id'] if we import already imported file (importing imported file temporarly disabled)
+ $fi_data = array();
+ $fi_data['imported_translation_file_id'] = $importedTranslationFile_id;
+ // TOTHINK - set FileIdentifier['id'] if we import already imported file (not supporting importing imported file)
// $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;
+ if (isset($ent['arguments']))
+ $fi_data['arguments'] = $ent['arguments'];
+
+ if (isset($_sheet_id_column))
+ $fi_data['arguments'] = $_sheet_id_column;
+
+ if (isset($ent['diff'])) // it is diff file
+ {
+ if (isset($ent['command']))
+ $fi_data['command'] = $ent['command'];
+ else
+ $fi_data['command'] = "DIFF " . mb_strtoupper($ent['diff']);
+
+ if (isset($ent['string']))
+ $fi_data['reference_string'] = $ent['string'];
+
+ 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;
+// $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);
- $importedTranslationFileModel->saveAll($data);
- $this->Session->setFlash(__('Translation file imported', true));
- $this->redirect(array('controller' => 'imported_translation_files', 'action' => 'view', $importedTranslationFileModel->id));
+ 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;
+ }
+ else
+ {
+ $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;
+ }
+
+ $importedTranslationFileModel = $this->RawFile->ImportedTranslationFile;
+
+ $importedTranslationFileModel->contain(array(
+ 'TranslationFile',
+ 'FileIdentifier' => array('Identifier' => array(
+ 'Translation',
+ 'IdentifierColumn' => 'Translation',
+ )),
+ ));
+
+ $importedTranslationFile = $importedTranslationFileModel->find('first', array(
+ '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
+ $identifier_ids = $identifierModel->withoutBestTranslation(array('ImportedTranslationFile.id' => $importedTranslationFile['ImportedTranslationFile']['id']));
+ if ($identifier_ids === false)
+ {
+ $this->Session->setFlash(__('Error: no conditions specified', true));
+ $this->redirect($this->referer());
+ return 0;
+ }
+ else if (count($identifier_ids) > 0)
+ {
+ $this->Session->setFlash(__('Best translation is not set for some of the identifiers in this file. Set best translation before export.', true));
+ $this->redirect(array('controller' => 'identifiers', 'action' => 'withoutBestTranslation', 'imported_translation_file_id' => $importedTranslationFile['ImportedTranslationFile']['id']));
+ return 0;
+ }
+
+ $translationFile_id = $importedTranslationFile['ImportedTranslationFile']['translation_file_id'];
+
+ $i=0;
+ $sortResult = Set::sort($importedTranslationFile['FileIdentifier'], '{n}.translation_index', 'asc');
+ if (!$sortResult)
+ {
+ $this->Session->setFlash(__('Sorting error', true));
+ $this->redirect($this->referer());
+ return 0;
+ }
+
+ foreach ($sortResult as $fileIdentifier)
+ {
+ if ($fileIdentifier['Identifier']['IdentifierColumn'] && !isset($entities[0]))
+ {
+ foreach ($fileIdentifier['Identifier']['IdentifierColumn'] as $column_no => $identifierColumn)
+ $_columns[$column_no] = $identifierColumn['column_name'];
+ $ent['columns'] = $_columns;
+ $ent['type'] = 'sheet_description';
+ $ent['sheet_id_column'] = $fileIdentifier['arguments'];
+ $ent['diff'] = ((isset($fileIdentifier['command']) && !empty($fileIdentifier['command'])) ? true : null);
+ $entities[] = $ent;
+ $ent = array();
+ }
+ $ent = array(
+ 'diff' => ((isset($fileIdentifier['command']) && !empty($fileIdentifier['command'])) ? $fileIdentifier['command'] : null),
+ 'command' => ((isset($fileIdentifier['command']) && !empty($fileIdentifier['command'])) ? $fileIdentifier['command'] : null),
+ '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']))
+ $ent['string'] = $fileIdentifier['Identifier']['Translation']['translation_text'];
+
+ if (isset($fileIdentifier['Identifier']['BestTranslation']['translation_text']))
+ $ent['string'] = $fileIdentifier['Identifier']['BestTranslation']['translation_text'];
+
+ if (($export_reference_if_empty_translation = true) && !isset($ent['string']))
+ $ent['string'] = $fileIdentifier['Identifier']['reference_string'];
+ else if (!isset($ent['string']))
+ $ent['string'] = '';
+
+ 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']))
+ $ent['columns'][$column_no] = $identifierColumn['Translation']['translation_text'];
+
+ if (isset($identifierColumn['BestTranslation']['translation_text']))
+ $ent['columns'][$column_no] = $identifierColumn['BestTranslation']['translation_text'];
+
+ if ($export_reference_if_empty_translation && !isset($ent['columns'][$column_no]))
+ $ent['columns'][$column_no] = $identifierColumn['reference_string'];
+ else if (!isset($ent['columns'][$column_no]))
+ $ent['columns'][$column_no] = '';
+ }
+ if ($fileIdentifier['command'])
+ $ent['command'] = $ent['diff'] = $fileIdentifier['command'];
+
+ $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));
+ $this->redirect(array('action' => 'index'));
+ return 0;
+ }
+ }
}
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 b565b925a..f50e265d5 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
@@ -5,7 +5,10 @@ class TranslationsController extends AppController {
function index() {
$this->Translation->recursive = 0;
- $this->set('translations', $this->paginate());
+ $conditions = null;
+ if (isset($this->passedArgs['identifier_id']) && $identifier = $this->passedArgs['identifier_id'])
+ $conditions = array('Translation.identifier_id' => $identifier);
+ $this->set('translations', $this->paginate($conditions));
}
function view($id = null) {
@@ -14,21 +17,34 @@ class TranslationsController extends AppController {
$this->redirect(array('action' => 'index'));
}
// $this->recursive=2;
- $this->set('translation', $bumz = $this->Translation->read(null, $id));
-// var_dump($bumz);
+ $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);
}
function add() {
if (!empty($this->data)) {
$this->Translation->create();
- if ($this->Translation->save($this->data)) {
+ if ($res = $this->Translation->save($this->data)) {
$this->Session->setFlash(__('The translation has been saved', true));
- $this->redirect(array('action' => 'index'));
+ $this->redirect(array('action' => 'index', 'identifier_id' => $res['Translation']['identifier_id']));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
}
- $identifiers = $this->Translation->Identifier->find('list');
+ if (empty($this->passedArgs['identifier_id']))
+ {
+ $this->Session->setFlash(__('You need to choose identifier for translation', true));
+ $this->redirect(array('controller' => 'identifiers', 'action' => 'index'));
+ }
+ 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;
+ }
+// $identifiers = $this->Translation->Identifier->find('list', array('recursive' => -1));
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users'));
}
@@ -49,9 +65,11 @@ class TranslationsController extends AppController {
if (empty($this->data)) {
$this->data = $this->Translation->read(null, $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'));
+ $this->set(compact('identifiers', 'users', 'identifier'));
}
function delete($id = null) {
@@ -61,14 +79,28 @@ class TranslationsController extends AppController {
}
if ($this->Translation->delete($id)) {
$this->Session->setFlash(__('Translation deleted', true));
- $this->redirect(array('action'=>'index'));
+// $this->redirect(array('action'=>'index'));
+ $this->redirect($this->referer());
}
$this->Session->setFlash(__('Translation was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
- $this->Translation->recursive = 0;
- $this->set('translations', $this->paginate());
+ return $this->index();
+ }
+
+ function admin_setBest($id) {
+ if (!$id) {
+ $this->Session->setFlash(__('Invalid id for translation', true));
+ $this->redirect($this->referer());
+ }
+ if ($this->Translation->setBest($id))
+ $this->Session->setFlash(__('Set successful', true));
+ else
+ $this->Session->setFlash(__('Set error', true));
+ $this->redirect($this->referer());
+// $this->index();
+// $this->render('index');
}
function admin_view($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 a7d996e70..5c8cbcb70 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
@@ -3,6 +3,8 @@ class UsersController extends AppController {
var $name = 'Users';
+ var $components = array('Email');
+
function index() {
$this->User->recursive = 0;
$this->set('users', $this->paginate());
@@ -113,4 +115,60 @@ class UsersController extends AppController {
$this->Session->setFlash(__('User was not deleted', true));
$this->redirect(array('action' => 'index'));
}
+
+ function login() {
+ }
+
+ function logout() {
+ $this->redirect($this->Auth->logout());
+ }
+
+ function beforeFilter() {
+ parent::beforeFilter();
+ $this->Auth->allow(array('register', 'login', 'logout', 'confirm'));
+ }
+
+ 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';
+ $this->Email->sendAs = 'text';
+ $this->Email->template = 'registration';
+ $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->redirect('/');
+ }
+ }
+ }
+
+ function confirm($confirm_hash)
+ {
+ $user = $this->User->find('first', array('conditions' => array('User.confirm_hash' => $confirm_hash)));
+ if (!$user)
+ {
+ $this->Session->setFlash('No user found. Please register again.');
+ $this->redirect('/');
+ }
+ $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->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 25e63147f..7be099b29 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
@@ -5,6 +5,13 @@ class VotesController extends AppController {
function index() {
$this->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());
}
@@ -31,6 +38,36 @@ class VotesController extends AppController {
$this->set(compact('translations', 'users'));
}
+ function vote() {
+ if (empty($this->passedArgs['translation']))
+ {
+ $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 = $this->Vote->Translation->read(null, $translation_id);
+ if (!$translation)
+ {
+ $this->Session->setFlash(__("Translation doesn't exist.", true));
+ $this->redirect(array('controller' => 'translations', 'action' => 'index'));
+ }
+ $vote = array("Vote" => array(
+ 'translation_id' => $translation_id,
+ // TODO: authorized user
+ 'user_id' => 1,
+ ),
+ );
+ $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;
+ }
+ }
+
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid vote', true));
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 6dd28c9e0..9def128fd 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
@@ -33,4 +33,6 @@
*/
class AppModel extends Model {
// var $useDbConfig = 'raw_files';
+ var $scaffoldForbiddenActions = null;
+ var $scaffoldActions = null;
}
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 4b38b0342..cc8ed26e4 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
@@ -50,28 +50,7 @@ class RawFilesSource extends DataSource {
*
* @var string
*/
- public $description = 'File Data Source';
-
-/**
- * Column delimiter
- *
- * @var string
- */
- public $delimiter = ';';
-
-/**
- * Maximum Columns
- *
- * @var integer
- */
- public $maxCol = 0;
-
-/**
- * Field Names
- *
- * @var mixed
- */
- public $fields = null;
+ public $description = 'Directory Contents Data Source';
/**
* File Handle
@@ -80,42 +59,39 @@ class RawFilesSource extends DataSource {
*/
public $handle = false;
-/**
- * Page to start on
- *
- * @var integer
- */
- public $page = 1;
-
-/**
- * Limit of records
- *
- * @var integer
- */
- public $limit = 99999;
-
/**
* Default configuration.
*
* @var array
*/
var $_baseConfig = array(
- 'datasource' => 'raw_files',
- 'path' => '/home/kaczorek/projects/webtt/distfiles/translation',
- 'extension' => 'uxt',
+ 'datasource' => 'Datasources.RawFilesSource',
+ 'path' => '.',
+ 'extension' => 'txt',
'readonly' => true,
- 'recursive' => true);
+ 'recursive' => false);
- protected $_schema = array(
- 'files' => array(
+ var $_schema = array(
+// 'files' => array(
'filename' => array(
'type' => 'string',
'null' => false,
'key' => 'primary',
- 'lenght' => 255
- )
- )
+ 'length' => 255
+ ),
+ 'size' => array(
+ 'type' => 'string',
+ 'null' => false,
+ 'length' => 40,
+ ),
+ 'modified' => array(
+ 'type' => 'string',
+ 'null' => false,
+ 'length' => 40,
+ ),
+ // )
);
+
/**
* Constructor
*
@@ -132,7 +108,7 @@ class RawFilesSource extends DataSource {
}
/**
- * Connects to the mailbox using options in the given configuration array.
+ * Connects to the directory using options in the given configuration array.
*
* @return boolean True if the file could be opened.
*/
@@ -159,68 +135,19 @@ class RawFilesSource extends DataSource {
/**
* List available sources
*
- * @return array of available CSV files
+ * @return array of available files
*/
- public function listSources() {
- $this->config['database'] = 'csv';
- $cache = parent::listSources();
- if ($cache !== null) {
- return $cache;
- }
-
- $extPattern = '\.' . preg_quote($this->config['extension']);
- if ($this->config['recursive']) {
- $list = $this->connection->findRecursive('.*' . $extPattern, true);
- foreach($list as &$item) {
- $item = mb_substr($item, mb_strlen($this->config['path'] . DS));
- }
- } else {
- $list = $this->connection->find('.*' . $extPattern, true);
- }
-
- foreach ($list as &$item) {
- $item = preg_replace('/' . $extPattern . '$/i', '', $item);
- }
-
- parent::listSources($list);
- unset($this->config['database']);
- return $list;
+ public function listSources() {
+ return array('raw_files');
}
/**
- * Returns a Model description (metadata) or null if none found.
+ * Returns a Model description (metadata).
*
* @return mixed
*/
public function describe($model) {
- $this->__getDescriptionFromFirstLine($model);
- return $this->fields;
- }
-
-/**
- * Get Description from First Line, and store into class vars
- *
- * @param Model $model
- * @return boolean True, Success
- */
- private function __getDescriptionFromFirstLine($model) {
- $filename = $model->table . '.' . $this->config['extension'];
- $handle = fopen($this->config['path'] . DS . $filename, 'r');
- $line = rtrim(fgets($handle));
- $data_comma = explode(',', $line);
- $data_semicolon = explode(';', $line);
-
- if (count($data_comma) > count($data_semicolon)) {
- $this->delimiter = ',';
- $this->fields = $data_comma;
- $this->maxCol = count($data_comma);
- } else {
- $this->delimiter = ';';
- $this->fields = $data_semicolon;
- $this->maxCol = count($data_semicolon);
- }
- fclose($handle);
- return true;
+ return $this->_schema;
}
/**
@@ -232,7 +159,7 @@ class RawFilesSource extends DataSource {
if ($this->connected) {
if ($this->handle) {
foreach($this->handle as $h) {
- @fclose($h);
+ @fclose($h);
}
$this->handle = false;
}
@@ -240,31 +167,99 @@ class RawFilesSource extends DataSource {
}
}
+/**
+ * Private method to determine if file is in one of given directories
+ *
+ * @return boolean
+ */
+ private function fileInDir($filepath, $dirs)
+ {
+ foreach ($dirs as $dir)
+ {
+ $dir = $this->connection->realpath($this->config['path']) . DS . $dir;
+ if ($dir . DS . basename($filepath) === $filepath)
+ return true;
+ }
+ return false;
+ }
+
+/**
+ * Read Data
+ *
+ * @param Model $model
+ * @param array $queryData
+ * @param integer $recursive Number of levels of association
+ * @return mixed
+ */
public function read(&$model, $queryData = array(), $recursive = null) {
- if ($queryData["conditions"] && $queryData["conditions"]["ext"])
- $extension = $queryData["conditions"]["ext"];
+ if (isset($queryData["conditions"][$model->alias . ".extension"]))
+ $extension = preg_quote($queryData["conditions"][$model->alias . ".extension"]);
else
$extension = $this->config['extension'];
- $extPattern = '\.' . preg_quote($extension);
+ if (isset($queryData["conditions"][$model->alias . ".filename"]))
+ {
+ $filename = $queryData["conditions"][$model->alias .".filename"];
+ $searchPattern = preg_quote($queryData["conditions"][$model->alias .".filename"], '/');
+ }
+ else
+ {
+// $searchPattern = '.*' . '\.' . preg_quote($extension);
+ $searchPattern = '.*' . '\.' . $extension;
+ }
+
+ if (isset($queryData["conditions"][$model->alias . ".dir"]))
+ {
+// $dir = $this->connection->realpath($this->config['path']) . DS . $queryData["conditions"][$model->alias . ".dir"];
+ $dir = is_array($dir = $queryData["conditions"][$model->alias . ".dir"]) ? $dir : array($dir);
+ }
+
+/* var_dump($queryData);*/
+// var_dump($searchPattern);
+
if ($this->config['recursive']) {
- $list = $this->connection->findRecursive('.*' . $extPattern, true);
+ $list = $this->connection->findRecursive($searchPattern, true);
+/* $this->log($list);
+ echo "list#\n";
+ var_dump($list);*/
foreach($list as &$item) {
- $item = mb_substr($item, mb_strlen($this->connection->realpath($this->config['path']) . DS));
+ $temp = $item;
+ $item = array();
+ $item["full"] = $temp;
+ $item["short"] = mb_substr($temp, mb_strlen($this->connection->realpath($this->config['path']) . DS));
}
unset($item);
} else {
- $list = $this->connection->find('.*' . $extPattern, true);
+ $list = $this->connection->find($searchPattern, true);
+ foreach($list as &$item) {
+ $temp = $item;
+ $item = array();
+ $item["full"] = $this->config['path'] . DS .$temp;
+ $item["short"] = $temp;
+ }
+ unset($item);
}
- $nlist = array();
+ $resultSet = array();
foreach ($list as $item) {
- $file = new File($path = $this->config['path'] . DS . $item, false);
+/* if (isset($dir) && isset($filename))
+ {
+ echo "dirconcat#\n";
+ var_dump($dir . DS . $filename);
+ echo "itemfull#\n";
+ var_dump($item["full"]);
+ if ($dir . DS . $filename === $item["full"])
+ continue;
+ }*/
+ if (isset($dir))
+ if (!$this->fileInDir($item["full"], $dir))
+ continue;
+ $file = new File($path = $this->config['path'] . DS . $item["short"], false);
// var_dump($item);
// $item = preg_replace('/' . $extPattern . '$/i', '', $item);
$resultSet[] = array(
$model->alias => array(
- 'filename' => $item,
+ 'filename' => $item["short"],
'size' => $file->size(),
'modified' => $file->lastChange(),
),
@@ -276,168 +271,6 @@ class RawFilesSource extends DataSource {
return $resultSet;
}
-/**
- * Read Data
- *
- * @param Model $model
- * @param array $queryData
- * @param integer $recursive Number of levels of association
- * @return mixed
- */
- public function read_z(&$model, $queryData = array(), $recursive = null) {
- $config = $this->config;
- $filename = $config['path'] . DS . $model->table . '.' . $config['extension'];
- if (!Set::extract($this->handle, $model->table)) {
- $this->handle[$model->table] = fopen($filename, 'r');
- } else {
- fseek($this->handle[$model->table], 0, SEEK_SET) ;
- }
- $queryData = $this->__scrubQueryData($queryData);
-
- if (isset($queryData['limit']) && !empty($queryData['limit'])) {
- $this->limit = $queryData['limit'];
- }
-
- if (isset($queryData['page']) && !empty($queryData['page'])) {
- $this->page = $queryData['page'];
- }
-
- if (empty($queryData['fields'])) {
- $fields = $this->fields;
- $allFields = true;
- } else {
- $fields = $queryData['fields'];
- $allFields = false;
- $_fieldIndex = array();
- $index = 0;
- // generate an index array of all wanted fields
- foreach($this->fields as $field) {
- if (in_array($field, $fields)) {
- $_fieldIndex[] = $index;
- }
- $index++;
- }
- }
-
- $lineCount = 0;
- $recordCount = 0;
- $findCount = 0;
- $resultSet = array();
-
- // Daten werden aus der Datei in ein Array $data gelesen
- while (($data = fgetcsv($this->handle[$model->table], 8192, $this->delimiter)) !== FALSE) {
- if ($lineCount == 0) {
- $lineCount++;
- continue;
- } else {
- // Skip over records, that are not complete
- if (count($data) < $this->maxCol) {
- continue;
- }
-
- $record = array();
- $i = 0;
- foreach($this->fields as $field) {
- $record[$model->alias][$field] = $data[$i++];
- }
-
- if ($this->__checkConditions($record, $queryData['conditions'], $model)) {
- // Compute the virtual pagenumber
- $_page = floor($findCount / $this->limit) + 1;
- if ($this->page <= $_page) {
- if (!$allFields) {
- $record = array();
- if (count($_fieldIndex) > 0) {
- foreach($_fieldIndex as $i) {
- $record[$model->alias][$this->fields[$i]] = $data[$i];
- }
- }
- }
- $resultSet[] = $record ;
- $recordCount++;
- }
- }
- unset($record);
- $findCount++;
-
- if ($recordCount >= $this->limit) {
- break;
- }
- }
- }
-
- if ($model->findQueryType === 'count') {
- return array(array(array('count' => count($resultSet))));
- }
- return $resultSet;
- }
-
-/**
- * Private helper method to remove query metadata in given data array.
- *
- * @param array $data Data
- * @return array Cleaned Data
- */
- private function __scrubQueryData($data) {
- foreach (array('conditions', 'fields', 'joins', 'order', /*'limit', 'offset',*/ 'group') as $key) {
- if (!isset($data[$key]) || empty($data[$key])) {
- $data[$key] = array();
- }
- }
- if (!isset($data['limit']) || empty($data['limit'])) {
- $data['limit'] = PHP_INT_MAX;
- }
- if (!isset($data['offset']) || empty($data['offset'])) {
- $data['offset'] = 0;
- }
- return $data;
- }
-
-/**
- * Private helper method to check conditions.
- *
- * @param array $record
- * @param array $conditions
- * @return bool
- */
- private function __checkConditions($record, $conditions, $model) {
- $result = true;
- foreach ($conditions as $name => $value) {
- $alias = $model->alias;
- if (strpos($name, '.') !== false) {
- list($alias, $name) = explode('.', $name);
- }
-
- if (strtolower($name) === 'or') {
- $cond = $value;
- $result = false;
- foreach ($cond as $name => $value) {
- if (Set::matches($this->__createRule($name, $value), $record[$alias])) {
- return true;
- }
- }
- } else {
- if (!Set::matches($this->__createRule($name, $value), $record[$alias])) {
- return false;
- }
- }
- }
- return $result;
- }
-
-/**
- * Private helper method to crete rule.
- *
- * @param string $name
- * @param string $value
- * @return string
- */
- private function __createRule($name, $value) {
- if (strpos($name, ' ') !== false) {
- return array(str_replace(' ', '', $name) . $value);
- }
- return array("{$name}={$value}");
- }
/**
* Calculate
@@ -445,7 +278,7 @@ class RawFilesSource extends DataSource {
* @param Model $model
* @param mixed $func
* @param array $params
- * @return array
+ * @return array with the field name with records count
*/
public function calculate(&$model, $func, $params = array()) {
return array('count');
diff --git a/code/ryzom/tools/server/www/webtt/app/models/file_identifier.php b/code/ryzom/tools/server/www/webtt/app/models/file_identifier.php
index 885749702..1df085930 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/file_identifier.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/file_identifier.php
@@ -2,6 +2,9 @@
class FileIdentifier extends AppModel {
var $name = 'FileIdentifier';
var $displayField = 'command';
+ var $order = 'FileIdentifier.id';
+
+ var $scaffoldForbiddenActions = array("index", "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(
@@ -10,14 +13,14 @@ class FileIdentifier extends AppModel {
'foreignKey' => 'imported_translation_file_id',
'conditions' => '',
'fields' => '',
- 'order' => ''
+// 'order' => ''
),
'Identifier' => array(
'className' => 'Identifier',
'foreignKey' => 'identifier_id',
'conditions' => '',
'fields' => '',
- 'order' => ''
+// 'order' => ''
)
);
}
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 a3e1246a2..5f4d2da69 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/identifier.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/identifier.php
@@ -3,17 +3,18 @@ class Identifier extends AppModel {
var $name = 'Identifier';
var $displayField = 'identifier';
var $actsAs = array('Containable');
+
var $validate = array(
- 'translation_index' => array(
+/* 'translation_index' => array(
'numeric' => array(
'rule' => array('numeric'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
+ '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_@]+/',
@@ -25,22 +26,56 @@ 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(
+/* 'Language' => array(
'className' => 'Language',
'foreignKey' => 'language_id',
'conditions' => '',
'fields' => '',
'order' => ''
- )
+ ),*/
+ 'TranslationFile' => array(
+ 'className' => 'TranslationFile',
+ 'foreignKey' => 'translation_file_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ );
+
+ var $hasOne = array(
+ 'BestTranslation' => array(
+ 'className' => 'Translation',
+ 'foreignKey' => 'identifier_id',
+ 'dependent' => false,
+ 'conditions' => array('BestTranslation.best' => true),
+ 'fields' => '',
+ 'order' => '',
+ ),
);
var $hasMany = array(
'Translation' => array(
'className' => 'Translation',
'foreignKey' => 'identifier_id',
+ 'dependent' => true,
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'exclusive' => '',
+ 'finderQuery' => '',
+ 'counterQuery' => ''
+ ),
+ 'Comment' => array(
+ 'className' => 'Comment',
+ 'foreignKey' => 'identifier_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
@@ -63,7 +98,36 @@ class Identifier extends AppModel {
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
- )
+ ),
+ 'IdentifierColumn' => array(
+ 'className' => 'IdentifierColumn',
+ 'foreignKey' => 'identifier_id',
+ 'dependent' => true,
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'exclusive' => '',
+ 'finderQuery' => '',
+ 'counterQuery' => ''
+ ),
);
+
+ function withoutBestTranslation($conditions = array())
+ {
+/* $this->contain(array(
+ 'FileIdentifier' => array('ImportedTranslationFile' => array(
+ 'conditions' => array('ImportedTranslationFile.id' => 248)
+ )),
+ ));
+ $res = $this->find('all', array('conditions' => array('Identifier.id' => array(125219, 131609, 67133))));*/
+// $fileIdentifier_ids = $this->FileIdentifier->find('list', array('fields' => array('FileIdentifier.id', 'FileIdentifier.id'), 'conditions' => array('FileIdentifier.imported_translation_file_id' => 248)));
+ // TOTHINK: try to achieve that with Linkable behaviour
+ if (isset($conditions['ImportedTranslationFile.id']))
+ return $identifier_ids = $this->FileIdentifier->find('list', array('fields' => array('Identifier.id', 'Identifier.id'), 'conditions' => array('FileIdentifier.imported_translation_file_id' => $conditions['ImportedTranslationFile.id']), 'recursive' => 1));
+ else
+ return false;
+ }
}
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 c45bc435f..4a816da63 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
@@ -2,6 +2,9 @@
class ImportedTranslationFile extends AppModel {
var $name = 'ImportedTranslationFile';
var $displayField = 'filename';
+
+ var $scaffoldForbiddenActions = array("index", "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 $actsAs = array('Containable');
@@ -13,7 +16,14 @@ class ImportedTranslationFile extends AppModel {
'conditions' => '',
'fields' => '',
'order' => ''
- )
+ ),
+ 'TranslationFile' => array(
+ 'className' => 'TranslationFile',
+ 'foreignKey' => 'translation_file_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
);
var $hasMany = array(
@@ -23,7 +33,7 @@ class ImportedTranslationFile extends AppModel {
'dependent' => true,
'conditions' => '',
'fields' => '',
- 'order' => '',
+ 'order' => 'FileIdentifier.id',
'limit' => '',
'offset' => '',
'exclusive' => '',
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 eef16ce9e..bd82c0fcb 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/language.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/language.php
@@ -2,11 +2,13 @@
class Language extends AppModel {
var $name = 'Language';
var $displayField = 'name';
+
+ 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 $hasMany = array(
- 'Identifier' => array(
- 'className' => 'Identifier',
+ 'TranslationFile' => array(
+ 'className' => 'TranslationFile',
'foreignKey' => 'language_id',
'dependent' => false,
'conditions' => '',
@@ -30,7 +32,20 @@ class Language extends AppModel {
'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 cd77639e1..8911bab90 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
@@ -3,7 +3,7 @@ class RawFile extends AppModel {
var $name = 'RawFile';
var $useDbConfig = 'raw_files';
var $displayField = 'filename';
- var $useTable = false;
+// var $useTable = false;
var $primaryKey = 'filename';
var $_parser;
@@ -34,28 +34,103 @@ class RawFile extends AppModel {
)
);*/
- public function open($dir, $filename)
+ public function open($dir, $filename, $write = false)
{
+ $this->_currentFile = null;
+ $this->_currentFileLastModified = null;
+
$ds = $this->getDataSource();
$file = new File($filepath = $ds->config['path'] . DS . $dir . DS . $filename, false);
if (!$file)
return false;
if (!$file->readable())
return false;
+ if ($write && !$file->writable())
+ return false;
// var_dump($filename);
$this->_currentFile = $file;
+ $this->_currentFileLastChange = $file->lastChange();
return $file;
}
- public function parseFile($file)
+ public function parseFile()
{
- App::import("Vendor","UxtParser", array("file" => 'UxtParser.php'));
- $parser = $this->_parser = new UxtParser();
+// var_dump($this->_currentFile);
if (!$this->_currentFile)
return false;
+
+ // TODO: file types array with filenames regex
+ if (
+ preg_match('|^([a-z]{2})_diff_[A-F0-9]{8}\.uxt$|', $this->_currentFile->name, $matches)
+ || preg_match('|^([a-z]{2})\.uxt$|', $this->_currentFile->name, $matches)
+ || preg_match('|^r2_([a-z]{2})\.uxt$|', $this->_currentFile->name, $matches)
+ )
+ {
+ App::import("Vendor","StringParser", array("file" => 'StringParser.php'));
+ $parser = $this->_parser = new StringParser();
+ }
+ else if (
+ preg_match('|^phrase_([a-z]{2})_diff_[A-F0-9]{8}\.txt$|', $this->_currentFile->name, $matches)
+ || preg_match('|^phrase_([a-z]{2})\.txt$|', $this->_currentFile->name, $matches)
+ )
+ {
+ App::import("Vendor","PhraseParser", array("file" => 'PhraseParser.php'));
+ $parser = $this->_parser = new PhraseParser();
+ }
+ else if (preg_match('|^.*_words_([a-z]{2})_diff_[A-F0-9]{8}\..*$|', $this->_currentFile->name, $matches)
+ || preg_match('|^.*_words_([a-z]{2})\..*$|', $this->_currentFile->name, $matches))
+ {
+ App::import("Vendor","SheetParser", array("file" => 'SheetParser.php'));
+ $parser = $this->_parser = new SheetParser();
+ }
+ else
+ {
+ return false;
+ }
$entities = $parser->parseFile($this->_currentFile->read());
return $entities;
}
+
+ public function buildFile($entities)
+ {
+// var_dump($this->_currentFile);
+ if (!$this->_currentFile)
+ return false;
+
+ // TODO: file types array with filenames regex
+ if (
+ preg_match('|^([a-z]{2})_diff_[A-F0-9]{8}\.uxt$|', $this->_currentFile->name, $matches)
+ || preg_match('|^([a-z]{2})\.uxt$|', $this->_currentFile->name, $matches)
+ || preg_match('|^r2_([a-z]{2})\.uxt$|', $this->_currentFile->name, $matches)
+ )
+ {
+ App::import("Vendor","StringParser", array("file" => 'StringParser.php'));
+ $parser = $this->_parser = new StringParser();
+ }
+ else if (
+ preg_match('|^phrase_([a-z]{2})_diff_[A-F0-9]{8}\.txt$|', $this->_currentFile->name, $matches)
+ || preg_match('|^phrase_([a-z]{2})\.txt$|', $this->_currentFile->name, $matches)
+ )
+ {
+ App::import("Vendor","PhraseParser", array("file" => 'PhraseParser.php'));
+ $parser = $this->_parser = new PhraseParser();
+ }
+ else if (preg_match('|^.*_words_([a-z]{2})_diff_[A-F0-9]{8}\..*$|', $this->_currentFile->name, $matches)
+ || preg_match('|^.*_words_([a-z]{2})\..*$|', $this->_currentFile->name, $matches))
+ {
+ App::import("Vendor","SheetParser", array("file" => 'SheetParser.php'));
+ $parser = $this->_parser = new SheetParser();
+ }
+ else
+ {
+ return false;
+ }
+ $content = $parser->buildFile($entities);
+ $ret = $this->_currentFile->write($content);
+ return $ret;
+ }
+
+
public function getLanguageCode($filename)
{
// var_dump($filename);
@@ -63,5 +138,15 @@ class RawFile extends AppModel {
return $matches[1];
else if (preg_match('|^([a-z]{2})\.uxt$|', $filename, $matches))
return $matches[1];
+ else if (preg_match('|^r2_([a-z]{2})\.uxt$|', $filename, $matches))
+ return $matches[1];
+ else if (preg_match('|^phrase_([a-z]{2})_diff_[A-F0-9]{8}\..*$|', $filename, $matches))
+ return $matches[1];
+ else if (preg_match('|^phrase_([a-z]{2})\..*$|', $filename, $matches))
+ return $matches[1];
+ else if (preg_match('|^.*_words_([a-z]{2})_diff_[A-F0-9]{8}\..*$|', $filename, $matches))
+ return $matches[1];
+ else if (preg_match('|^.*_words_([a-z]{2})\..*$|', $filename, $matches))
+ return $matches[1];
}
}
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 1a1859261..6c8ecafdc 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/translation.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/translation.php
@@ -2,6 +2,9 @@
class Translation extends AppModel {
var $name = 'Translation';
var $displayField = 'translation_text';
+
+ var $scaffoldForbiddenActions = array();
+ var $scaffoldActions = array("add" => "fk", "index" => "fk");
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
@@ -12,6 +15,13 @@ class Translation extends AppModel {
'fields' => '',
'order' => ''
),
+ 'IdentifierColumn' => array(
+ 'className' => 'IdentifierColumn',
+ 'foreignKey' => 'identifier_column_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
@@ -34,7 +44,44 @@ class Translation extends AppModel {
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
- )
+ ),
+/* 'Comment' => array(
+ 'className' => 'Comment',
+ 'foreignKey' => 'translation_id',
+ 'dependent' => false,
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'exclusive' => '',
+ 'finderQuery' => '',
+ 'counterQuery' => ''
+ ),*/
);
+ function setBest()
+ {
+ if (!$this->id)
+ return false;
+ $this->read();
+ if (!isset($this->data['Translation']['identifier_id']))
+ return false;
+
+ // set best on chosen translation
+ $ret = $this->save(array('best' => 1));
+ $best_id = $this->id;
+
+ // reset best on other translations
+ $ret = $this->updateAll(array('Translation.best' => 0), array(
+ 'AND' => array(
+ 'Translation.identifier_id' => $ret['Translation']['identifier_id'],
+ 'Translation.id !=' => $best_id,
+ ),
+ ));
+ $this->log($ret);
+ // TODO: test!
+
+ return $this->id;
+ }
}
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 fe5157be9..0daa4b852 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/user.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/user.php
@@ -2,6 +2,23 @@
class User extends AppModel {
var $name = 'User';
var $displayField = 'name';
+
+ var $validate = array(
+ 'username' => array(
+ 'alphaNumeric',
+/* 'uniqueCheck' => array(
+ 'rule' => 'isUnique',
+ 'message' => 'That username has already been taken.',
+ ),*/
+ ),
+ 'email' => array('rule' => 'email', 'message' => 'Wrong format'),
+ 'name' => array('rule' => 'notEmpty'),
+// 'password' => array('rule' => 'notEmpty'),
+ 'passwd' => array('rule' => 'notEmpty'),
+ );
+
+ 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 $hasMany = array(
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 b3de691b0..f03d6b910 100644
--- a/code/ryzom/tools/server/www/webtt/app/models/vote.php
+++ b/code/ryzom/tools/server/www/webtt/app/models/vote.php
@@ -2,6 +2,8 @@
class Vote extends AppModel {
var $name = 'Vote';
var $displayField = 'translation_id';
+
+ var $scaffoldForbiddenActions = array("delete");
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
diff --git a/code/ryzom/tools/server/www/webtt/app/tests/cases/controllers/translation_files_controller.test.php b/code/ryzom/tools/server/www/webtt/app/tests/cases/controllers/translation_files_controller.test.php
index f60450a86..19f94096d 100644
--- a/code/ryzom/tools/server/www/webtt/app/tests/cases/controllers/translation_files_controller.test.php
+++ b/code/ryzom/tools/server/www/webtt/app/tests/cases/controllers/translation_files_controller.test.php
@@ -1,5 +1,5 @@
TranslationFiles =& new TestTranslationFilesController();
@@ -23,4 +23,44 @@ class TranslationFilesControllerTestCase extends CakeTestCase {
ClassRegistry::flush();
}
+ function testIndex() {
+
+ }
+
+ function testView() {
+
+ }
+
+ function testAdd() {
+
+ }
+
+ function testEdit() {
+
+ }
+
+ function testDelete() {
+
+ }
+
+ function testAdminIndex() {
+
+ }
+
+ function testAdminView() {
+
+ }
+
+ function testAdminAdd() {
+
+ }
+
+ function testAdminEdit() {
+
+ }
+
+ function testAdminDelete() {
+
+ }
+
}
diff --git a/code/ryzom/tools/server/www/webtt/app/tests/cases/models/translation_file.test.php b/code/ryzom/tools/server/www/webtt/app/tests/cases/models/translation_file.test.php
index 0ba6d97ee..cb5d08ecd 100644
--- a/code/ryzom/tools/server/www/webtt/app/tests/cases/models/translation_file.test.php
+++ b/code/ryzom/tools/server/www/webtt/app/tests/cases/models/translation_file.test.php
@@ -1,9 +1,9 @@
TranslationFile =& ClassRegistry::init('TranslationFile');
diff --git a/code/ryzom/tools/server/www/webtt/app/tests/fixtures/translation_file_fixture.php b/code/ryzom/tools/server/www/webtt/app/tests/fixtures/translation_file_fixture.php
index 4b9440ea4..bd562dbd4 100644
--- a/code/ryzom/tools/server/www/webtt/app/tests/fixtures/translation_file_fixture.php
+++ b/code/ryzom/tools/server/www/webtt/app/tests/fixtures/translation_file_fixture.php
@@ -1,12 +1,12 @@
array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'language_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'filename' => array('type' => 'string', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
+ 'filename_template' => array('type' => 'string', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
@@ -17,9 +17,9 @@ class TranslationFileFixture extends CakeTestFixture {
array(
'id' => 1,
'language_id' => 1,
- 'filename' => 'Lorem ipsum dolor sit amet',
- 'created' => '2011-05-29 19:13:14',
- 'modified' => '2011-05-29 19:13:14'
+ 'filename_template' => 'Lorem ipsum dolor sit amet',
+ 'created' => '2011-07-04 13:04:11',
+ 'modified' => '2011-07-04 13:04:11'
),
);
}
diff --git a/code/ryzom/tools/server/www/webtt/app/tmp/cache/models/empty b/code/ryzom/tools/server/www/webtt/app/tmp/cache/models/empty
new file mode 100755
index 000000000..e69de29bb
diff --git a/code/ryzom/tools/server/www/webtt/app/tmp/cache/persistent/empty b/code/ryzom/tools/server/www/webtt/app/tmp/cache/persistent/empty
new file mode 100644
index 000000000..e69de29bb
diff --git a/code/ryzom/tools/server/www/webtt/app/tmp/sessions/empty b/code/ryzom/tools/server/www/webtt/app/tmp/sessions/empty
new file mode 100755
index 000000000..e69de29bb
diff --git a/code/ryzom/tools/server/www/webtt/app/tmp/tests/empty b/code/ryzom/tools/server/www/webtt/app/tmp/tests/empty
new file mode 100755
index 000000000..e69de29bb
diff --git a/code/ryzom/tools/server/www/webtt/app/vendors/UxtParser.php b/code/ryzom/tools/server/www/webtt/app/vendors/UxtParser.php
index 6d1855632..520801069 100644
--- a/code/ryzom/tools/server/www/webtt/app/vendors/UxtParser.php
+++ b/code/ryzom/tools/server/www/webtt/app/vendors/UxtParser.php
@@ -2,6 +2,7 @@
class UxtParser
{
var $pipeline_directory = "/home/kaczorek/projects/webtt/distfiles/translation/";
+ var $debug = false;
function removeComments($str)
{
@@ -12,12 +13,16 @@ class UxtParser
// var_dump($str);
//As a pertinent note, there's an issue with this function where parsing any string longer than 94326 characters long will silently return null. So be careful where you use it at.
//http://pl.php.net/manual/en/function.preg-replace.php#98843
- $returnString = preg_replace('!/\*.*?\*/!s', '', $str); // /* .*? */ s
+ ini_set('pcre.backtrack_limit', 10000000);
+ //$returnString = preg_replace('!/\*.*?\*/!s', '', $str); // /* .*? */ s
+ // added [^/] because there was //******* in translation file
+ $returnString = preg_replace('![^/]/\*.*?\*/!s', '', $str); // /* .*? */ s
// PHP 5.2.0
// if (PREG_NO_ERROR !== preg_last_error())
if ($returnString === null)
{
$returnStr = $str;
+ var_dump("PREG ERROR");
// exception
}
return $returnString;
@@ -57,11 +62,17 @@ class UxtParser
else
unset($type);
}
-/* else if (mb_substr($str, 0, 8) == "// INDEX")
+ else if (mb_substr($str, 0, 8) == "// INDEX")
{
list($j, $type, $index) = explode(" ", $str);
+ $type = "internal_index";
// $arr = explode(" ", $str);
- }*/
+ }
+ else if (mb_substr($str, 0, 13) == "// HASH_VALUE")
+ {
+ list($j, $type, $hash_value) = explode(" ", $str);
+ $type = "hash_value";
+ }
/* if (!isset($type))
{
var_dump(isset($type));
@@ -71,7 +82,7 @@ class UxtParser
if (isset($type))
{
$type = mb_strtolower($type);
- $arr = compact("type","command","index");
+ $arr = compact("type","command","index","hash_value");
}
}
else if (!(mb_substr($str, 0, 2) == "//") && mb_strlen($str))
@@ -104,6 +115,7 @@ class UxtParser
{
$parsedEnt = array();
$newEnt = false;
+ $prevStringLine = false;
$entities = array();
// $file = file_get_contents($this->pipeline_directory . $file);
@@ -115,55 +127,108 @@ class UxtParser
$file = $this->removeComments($file);
// var_dump($file);
$lines = explode("\n", $file);
-// echo "
################################\n";
+ if ($this->debug)
+ {
+ echo "\n\n";
+ }
+ $line_no=1;
foreach ($lines as $line)
{
+ if ($this->debug)
+ {
+ echo "\n\t#################### LINE NUMBER " . $line_no++ . "\n\n";
+ }
+
+// var_dump($line);
$line = rtrim($line);
$parsedLine = $this->parseLine($line);
+ if ($this->debug)
+ {
+ echo "%%%% parsedLine\n";
+ var_dump($parsedLine);
+ echo "\n";
+
+ echo "%%%% prevStringLine\n";
+ var_dump($prevStringLine);
+ echo "\n";
+ }
+
if (!$parsedLine)
continue;
- if ($parsedLine["type"] == "index")
- $parsedEnt["index"] = $parsedLine["index"];
+ // if line start with diff (diff files) or hash_value (translated files) and before was line with translation, then we start new ent
- if ($parsedLine["type"] == "string")
+ if ($prevStringLine && (
+ ($parsedLine["type"] == "diff" && $parsedEnt) || ($parsedLine["type"] == "hash_value" && $parsedEnt)
+ ))
{
-/* echo "%%%% parsedEnt %%%%%\n";
- var_dump($parsedEnt);
-
- echo "%%%% parsedLine %%%%%\n";
- var_dump($parsedLine);
-*/
-
- if (!$parsedLine['identifier'])
- {
-// echo "ZLACZENIE \n";
- $parsedEnt['string'] .= "\n" . $parsedLine['string'];
- }
- else
- {
-// echo "DODANIE \n";
- $parsedEnt += $parsedLine;
- }
-
-/* echo "%%%% parsedEnt after %%%%%\n";
+/* echo "%%%% prevStringLine %%%%%\n";
var_dump($parsedEnt);*/
- }
-
- if ($parsedLine["type"] == "diff" && $parsedEnt)
- {
$newEnt = true;
}
if ($newEnt)
{
-// var_dump($parsedEnt);
+ if ($this->debug)
+ {
+ echo "\t%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
+ echo "\t%%%% newEnt %%%%%%%%% newEnt %%%%%%%%% newEnt %%%%%%%%% newEnt %%%%%\n";
+ echo "\t%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n";
+ var_dump($parsedEnt);
+ }
+ if (!isset($parsedEnt["diff"]) && !isset($parsedEnt["index"]))
+ $parsedEnt["index"] = $parsedEnt["internal_index"];
+
$entities[] = $parsedEnt;
$parsedEnt =array();
$newEnt = false;
}
+ if ($parsedLine["type"] == "internal_index")
+ $parsedEnt["internal_index"] = $parsedLine["index"];
+
+ if ($parsedLine["type"] == "string")
+ {
+ $prevStringLine = true;
+
+ if ($this->debug)
+ {
+ echo "%%%% parsedEnt %%%%%\n";
+ var_dump($parsedEnt);
+
+// echo "%%%% parsedLine %%%%%\n";
+// var_dump($parsedLine);
+ }
+
+ if (!$parsedLine['identifier'])
+ {
+ if ($this->debug) echo "ZLACZENIE \n";
+ if ($this->debug && !isset($parsedEnt['string']))
+ {
+ echo "!isset parsedEnt['string']\n";
+ var_dump($line);
+ var_dump($parsedEnt);
+ var_dump($parsedLine);
+ }
+ $parsedEnt['string'] .= $parsedLine['string'] . "\n";
+ }
+ else
+ {
+ if ($this->debug) echo "DODANIE \n";
+ $parsedEnt += $parsedLine;
+ $parsedEnt['string'] .= "\n";
+ }
+
+ if ($this->debug)
+ {
+ echo "%%%% parsedEnt after %%%%%\n";
+ var_dump($parsedEnt);
+ }
+ }
+ else
+ $prevStringLine = false;
+
if ($parsedLine["type"] == "diff")
{
$parsedEnt["diff"] = $parsedLine["command"];
@@ -171,9 +236,19 @@ class UxtParser
}
}
if ($parsedEnt)
+ {
+ if (!isset($parsedEnt["diff"]) && !isset($parsedEnt["index"]))
+ $parsedEnt["index"] = $parsedEnt["internal_index"];
+
$entities[] = $parsedEnt;
-/* var_dump($entities);
- echo " \n";*/
+ }
+
+ if ($this->debug)
+ {
+ echo "";
+ var_dump($entities);
+ echo " \n";
+ }
return $entities;
}
}
diff --git a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/add.ctp b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/add.ctp
index fa9470120..7a7d0c0be 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/add.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/add.ctp
@@ -1,25 +1,46 @@
-
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_add.ctp b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_add.ctp
index 4f3898be9..0073afd78 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_add.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_add.ctp
@@ -1,25 +1,46 @@
-
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_edit.ctp
index 9a6609be7..2d69ae33f 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_edit.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_edit.ctp
@@ -1,27 +1,47 @@
-
-Form->create('FileIdentifier');?>
-
-
-
+
+
+
+
+
+
+
+ Form->create('FileIdentifier');?>
+
+ Form->value('FileIdentifier.id')); ?>
+ Form->input('id');
- echo $this->Form->input('translation_file_id');
+ echo $this->Form->input('imported_translation_file_id');
echo $this->Form->input('command');
echo $this->Form->input('translation_index');
echo $this->Form->input('identifier_id');
+ echo $this->Form->input('arguments');
echo $this->Form->input('reference_string');
?>
-
-Form->end(__('Submit', true));?>
-
-
-
-
+
+ Form->end(__('Submit', true));?>
+
-
Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('FileIdentifier.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('FileIdentifier.id'))); ?>
-
Html->link(__('List File Identifiers', true), array('action' => 'index'));?>
-
Html->link(__('List Translation Files', true), array('controller' => 'translation_files', 'action' => 'index')); ?>
-
Html->link(__('New Translation File', true), array('controller' => 'translation_files', 'action' => 'add')); ?>
-
Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
-
Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
-
-
\ No newline at end of file
+
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_index.ctp b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_index.ctp
index c62d5dc8e..9220d8a55 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_index.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_index.ctp
@@ -1,46 +1,59 @@
-
-
-
-
- Paginator->sort('id');?>
- Paginator->sort('translation_file_id');?>
- Paginator->sort('command');?>
- Paginator->sort('translation_index');?>
- Paginator->sort('identifier_id');?>
- Paginator->sort('reference_string');?>
- Paginator->sort('created');?>
- Paginator->sort('modified');?>
-
-
-
+
+
+
+
+
+
+
tableHeaders(array($paginator->sort('id'),$paginator->sort('imported_translation_file_id'),$paginator->sort('command'),$paginator->sort('translation_index'),$paginator->sort('identifier_id'),$paginator->sort('arguments'),$paginator->sort('reference_string'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),));
+ echo ''.$tableHeaders.' '; ?>
+
+
>
-
+
- Html->link($fileIdentifier['TranslationFile']['filename'], array('controller' => 'translation_files', 'action' => 'view', $fileIdentifier['TranslationFile']['id'])); ?>
+ Html->link($fileIdentifier['ImportedTranslationFile']['filename'], array('controller' => 'imported_translation_files', 'action' => 'view', $fileIdentifier['ImportedTranslationFile']['id'])); ?>
-
-
+
+
Html->link($fileIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $fileIdentifier['Identifier']['id'])); ?>
-
-
-
+
+
+
+
Html->link(__('View', true), array('action' => 'view', $fileIdentifier['FileIdentifier']['id'])); ?>
- Html->link(__('Edit', true), array('action' => 'edit', $fileIdentifier['FileIdentifier']['id'])); ?>
- Html->link(__('Delete', true), array('action' => 'delete', $fileIdentifier['FileIdentifier']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $fileIdentifier['FileIdentifier']['id'])); ?>
-
+
+ '.$tableHeaders.''; ?>
+
+
Paginator->counter(array(
@@ -49,19 +62,9 @@
?>
- Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
- | Paginator->numbers();?>
- |
- Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
+ Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
+ | Paginator->numbers();?> |
+ Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
-
-
-
- Html->link(__('New File Identifier', true), array('action' => 'add')); ?>
- Html->link(__('List Translation Files', true), array('controller' => 'translation_files', 'action' => 'index')); ?>
- Html->link(__('New Translation File', true), array('controller' => 'translation_files', 'action' => 'add')); ?>
- Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
- Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
-
-
\ No newline at end of file
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_view.ctp b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_view.ctp
index 8f375c882..6c945cae1 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_view.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/admin_view.ctp
@@ -1,58 +1,101 @@
-
-
-
- >
- >
+
+
+
+
+
+
+
+
+
+
+
+
+
">
+
">
-
-
-
>
- >
- Html->link($fileIdentifier['TranslationFile']['filename'], array('controller' => 'translation_files', 'action' => 'view', $fileIdentifier['TranslationFile']['id'])); ?>
-
-
- >
- >
+
+
+
+
+
+
+ Html->link($fileIdentifier['ImportedTranslationFile']['filename'], array('controller' => 'imported_translation_files', 'action' => 'view', $fileIdentifier['ImportedTranslationFile']['id'])); ?>
+
+
+
+
">
+
">
-
-
-
>
- >
+
+
+
+
+
">
+
">
-
-
-
>
- >
+
+
+
+
+
+
Html->link($fileIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $fileIdentifier['Identifier']['id'])); ?>
-
-
-
>
- >
-
-
-
- >
- >
+
+
+
+
">
+
">
+
+
+
+
+
+
">
+
">
+
+
+
+
+
">
+
">
-
-
-
>
- >
+
+
+
+
+
">
+
">
-
-
-
+
+
+
+
+
+
+
-
-
-
- Html->link(__('Edit File Identifier', true), array('action' => 'edit', $fileIdentifier['FileIdentifier']['id'])); ?>
- Html->link(__('Delete File Identifier', true), array('action' => 'delete', $fileIdentifier['FileIdentifier']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $fileIdentifier['FileIdentifier']['id'])); ?>
- Html->link(__('List File Identifiers', true), array('action' => 'index')); ?>
- Html->link(__('New File Identifier', true), array('action' => 'add')); ?>
- Html->link(__('List Translation Files', true), array('controller' => 'translation_files', 'action' => 'index')); ?>
- Html->link(__('New Translation File', true), array('controller' => 'translation_files', 'action' => 'add')); ?>
- Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
- Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
-
+
+
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/edit.ctp
index d85d2e100..326ee782a 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/edit.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/edit.ctp
@@ -1,27 +1,47 @@
-
-Form->create('FileIdentifier');?>
-
-
-
+
+
+
+
+
+
+
+ Form->create('FileIdentifier');?>
+
+ Form->value('FileIdentifier.id')); ?>
+ Form->input('id');
- echo $this->Form->input('translation_file_id');
+ echo $this->Form->input('imported_translation_file_id');
echo $this->Form->input('command');
echo $this->Form->input('translation_index');
echo $this->Form->input('identifier_id');
+ echo $this->Form->input('arguments');
echo $this->Form->input('reference_string');
?>
-
-Form->end(__('Submit', true));?>
-
-
-
-
+
+ Form->end(__('Submit', true));?>
+
-
Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('FileIdentifier.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('FileIdentifier.id'))); ?>
-
Html->link(__('List File Identifiers', true), array('action' => 'index'));?>
-
Html->link(__('List Translation Files', true), array('controller' => 'translation_files', 'action' => 'index')); ?>
-
Html->link(__('New Translation File', true), array('controller' => 'translation_files', 'action' => 'add')); ?>
-
Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
-
Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
-
-
\ No newline at end of file
+
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/index.ctp b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/index.ctp
index c62d5dc8e..9220d8a55 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/index.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/index.ctp
@@ -1,46 +1,59 @@
-
-
-
-
- Paginator->sort('id');?>
- Paginator->sort('translation_file_id');?>
- Paginator->sort('command');?>
- Paginator->sort('translation_index');?>
- Paginator->sort('identifier_id');?>
- Paginator->sort('reference_string');?>
- Paginator->sort('created');?>
- Paginator->sort('modified');?>
-
-
-
+
+
+
+
+
+
+
tableHeaders(array($paginator->sort('id'),$paginator->sort('imported_translation_file_id'),$paginator->sort('command'),$paginator->sort('translation_index'),$paginator->sort('identifier_id'),$paginator->sort('arguments'),$paginator->sort('reference_string'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),));
+ echo ''.$tableHeaders.' '; ?>
+
+
>
-
+
- Html->link($fileIdentifier['TranslationFile']['filename'], array('controller' => 'translation_files', 'action' => 'view', $fileIdentifier['TranslationFile']['id'])); ?>
+ Html->link($fileIdentifier['ImportedTranslationFile']['filename'], array('controller' => 'imported_translation_files', 'action' => 'view', $fileIdentifier['ImportedTranslationFile']['id'])); ?>
-
-
+
+
Html->link($fileIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $fileIdentifier['Identifier']['id'])); ?>
-
-
-
+
+
+
+
Html->link(__('View', true), array('action' => 'view', $fileIdentifier['FileIdentifier']['id'])); ?>
- Html->link(__('Edit', true), array('action' => 'edit', $fileIdentifier['FileIdentifier']['id'])); ?>
- Html->link(__('Delete', true), array('action' => 'delete', $fileIdentifier['FileIdentifier']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $fileIdentifier['FileIdentifier']['id'])); ?>
-
+
+ '.$tableHeaders.''; ?>
+
+
Paginator->counter(array(
@@ -49,19 +62,9 @@
?>
- Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
- | Paginator->numbers();?>
- |
- Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
+ Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
+ | Paginator->numbers();?> |
+ Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
-
-
-
- Html->link(__('New File Identifier', true), array('action' => 'add')); ?>
- Html->link(__('List Translation Files', true), array('controller' => 'translation_files', 'action' => 'index')); ?>
- Html->link(__('New Translation File', true), array('controller' => 'translation_files', 'action' => 'add')); ?>
- Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
- Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
-
-
\ No newline at end of file
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/view.ctp b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/view.ctp
index 8f375c882..6c945cae1 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/view.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/file_identifiers/view.ctp
@@ -1,58 +1,101 @@
-
-
-
- >
- >
+
+
+
+
+
+
+
+
+
+
+
+
+
">
+
">
-
-
-
>
- >
- Html->link($fileIdentifier['TranslationFile']['filename'], array('controller' => 'translation_files', 'action' => 'view', $fileIdentifier['TranslationFile']['id'])); ?>
-
-
- >
- >
+
+
+
+
+
+
+ Html->link($fileIdentifier['ImportedTranslationFile']['filename'], array('controller' => 'imported_translation_files', 'action' => 'view', $fileIdentifier['ImportedTranslationFile']['id'])); ?>
+
+
+
+
">
+
">
-
-
-
>
- >
+
+
+
+
+
">
+
">
-
-
-
>
- >
+
+
+
+
+
+
Html->link($fileIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $fileIdentifier['Identifier']['id'])); ?>
-
-
-
>
- >
-
-
-
- >
- >
+
+
+
+
">
+
">
+
+
+
+
+
+
">
+
">
+
+
+
+
+
">
+
">
-
-
-
>
- >
+
+
+
+
+
">
+
">
-
-
-
+
+
+
+
+
+
+
-
-
-
- Html->link(__('Edit File Identifier', true), array('action' => 'edit', $fileIdentifier['FileIdentifier']['id'])); ?>
- Html->link(__('Delete File Identifier', true), array('action' => 'delete', $fileIdentifier['FileIdentifier']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $fileIdentifier['FileIdentifier']['id'])); ?>
- Html->link(__('List File Identifiers', true), array('action' => 'index')); ?>
- Html->link(__('New File Identifier', true), array('action' => 'add')); ?>
- Html->link(__('List Translation Files', true), array('controller' => 'translation_files', 'action' => 'index')); ?>
- Html->link(__('New Translation File', true), array('controller' => 'translation_files', 'action' => 'add')); ?>
- Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
- Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
-
+
+
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/identifiers/add.ctp b/code/ryzom/tools/server/www/webtt/app/views/identifiers/add.ctp
index 0ac7bb80b..f45fb34b8 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/identifiers/add.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/identifiers/add.ctp
@@ -1,25 +1,52 @@
-
-Form->create('Identifier');?>
-
-
-
+
+
+
+
+
+
+
+ Form->create('Identifier');?>
+
+
+ Form->input('language_id');
echo $this->Form->input('translation_index');
echo $this->Form->input('identifier');
+ echo $this->Form->input('arguments');
echo $this->Form->input('reference_string');
echo $this->Form->input('translated');
?>
-
-Form->end(__('Submit', true));?>
-
-
-
-
+
+ Form->end(__('Submit', true));?>
+
-
Html->link(__('List Identifiers', true), array('action' => 'index'));?>
-
Html->link(__('List Languages', true), array('controller' => 'languages', 'action' => 'index')); ?>
-
Html->link(__('New Language', true), array('controller' => 'languages', 'action' => 'add')); ?>
-
Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
-
Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
-
-
\ No newline at end of file
+
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_add.ctp b/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_add.ctp
index 41b9cf94b..12fd5bdab 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_add.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_add.ctp
@@ -1,25 +1,69 @@
-
-Form->create('Identifier');?>
-
-
-
+
+
+
+
+
+
+
-
Html->link(__('List Identifiers', true), array('action' => 'index'));?>
-
Html->link(__('List Languages', true), array('controller' => 'languages', 'action' => 'index')); ?>
-
Html->link(__('New Language', true), array('controller' => 'languages', 'action' => 'add')); ?>
-
Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
-
Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
-
-
\ No newline at end of file
+
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_edit.ctp
index ab749fd75..78c2e80f4 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_edit.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_edit.ctp
@@ -1,27 +1,70 @@
-
-Form->create('Identifier');?>
-
-
-
+
+
+
+
+
+
+
-
Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Identifier.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Identifier.id'))); ?>
-
Html->link(__('List Identifiers', true), array('action' => 'index'));?>
-
Html->link(__('List Languages', true), array('controller' => 'languages', 'action' => 'index')); ?>
-
Html->link(__('New Language', true), array('controller' => 'languages', 'action' => 'add')); ?>
-
Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
-
Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
-
-
\ No newline at end of file
+
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_index.ctp b/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_index.ctp
index 7f5a60a26..187df0bd3 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_index.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_index.ctp
@@ -1,44 +1,77 @@
-
-
-
-
- Paginator->sort('id');?>
- Paginator->sort('language_id');?>
- Paginator->sort('translation_index');?>
- Paginator->sort('identifier');?>
- Paginator->sort('reference_string');?>
- Paginator->sort('translated');?>
- Paginator->sort('created');?>
- Paginator->sort('modified');?>
-
-
-
+
+
+
+
+
+
+
tableHeaders(array($paginator->sort('id'),$paginator->sort('language_id'),$paginator->sort('translation_file_id'),$paginator->sort('translation_index'),$paginator->sort('identifier'),$paginator->sort('arguments'),$paginator->sort('reference_string'),$paginator->sort('translated'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),));
+ echo ''.$tableHeaders.' '; ?>
+
+
>
-
+
+
- Html->link($identifier['Language']['name'], array('controller' => 'languages', 'action' => 'view', $identifier['Language']['id'])); ?>
+ Html->link($identifier['TranslationFile']['filename_template'], array('controller' => 'translation_files', 'action' => 'view', $identifier['TranslationFile']['id'])); ?>
-
-
-
-
-
-
+
+
+
+
+
+
+
Html->link(__('View', true), array('action' => 'view', $identifier['Identifier']['id'])); ?>
- Html->link(__('Edit', true), array('action' => 'edit', $identifier['Identifier']['id'])); ?>
- Html->link(__('Delete', true), array('action' => 'delete', $identifier['Identifier']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $identifier['Identifier']['id'])); ?>
-
+
+ '.$tableHeaders.''; ?>
+
+
Paginator->counter(array(
@@ -47,19 +80,9 @@
?>
- Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
- | Paginator->numbers();?>
- |
- Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
+ Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
+ | Paginator->numbers();?> |
+ Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
-
-
-
- Html->link(__('New Identifier', true), array('action' => 'add')); ?>
- Html->link(__('List Languages', true), array('controller' => 'languages', 'action' => 'index')); ?>
- Html->link(__('New Language', true), array('controller' => 'languages', 'action' => 'add')); ?>
- Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
- Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
-
-
\ No newline at end of file
+
diff --git a/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_view.ctp b/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_view.ctp
index a75ccf2ca..e4335a348 100644
--- a/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_view.ctp
+++ b/code/ryzom/tools/server/www/webtt/app/views/identifiers/admin_view.ctp
@@ -1,152 +1,394 @@
-
-
-
- >
- >
-
-
-
- >
- >
- Html->link($identifier['Language']['name'], array('controller' => 'languages', 'action' => 'view', $identifier['Language']['id'])); ?>
-
-
- >
- >
-
-
-
- >
- >
-
-
-
- >
- >
-
-
-
- >
- >
-
-
-
- >
- >
-
-
-
- >
- >
-
-
-
-
-
-
-
-
- Html->link(__('Edit Identifier', true), array('action' => 'edit', $identifier['Identifier']['id'])); ?>
- Html->link(__('Delete Identifier', true), array('action' => 'delete', $identifier['Identifier']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $identifier['Identifier']['id'])); ?>
- Html->link(__('List Identifiers', true), array('action' => 'index')); ?>
- Html->link(__('New Identifier', true), array('action' => 'add')); ?>
- Html->link(__('List Languages', true), array('controller' => 'languages', 'action' => 'index')); ?>
- Html->link(__('New Language', true), array('controller' => 'languages', 'action' => 'add')); ?>
- Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
- Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
- Html->link(__('List File Identifiers', true), array('controller' => 'file_identifiers', 'action' => 'index')); ?>
- Html->link(__('New File Identifier', true), array('controller' => 'file_identifiers', 'action' => 'add')); ?>
-
-
-