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 @@ -
-Form->create('FileIdentifier');?> -
- - Form->input('translation_file_id'); +
+ +
+ +
+

+ +
+ Form->create('FileIdentifier');?> +
+ + 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(__('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_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 @@ -
    -Form->create('FileIdentifier');?> -
    - - Form->input('translation_file_id'); +
    + +
    + +
    +

    + +
    + Form->create('FileIdentifier');?> +
    + + 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(__('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_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.''; ?> + + > - + - - + + - - - + + + + - + + '.$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'])); ?>
    + +

    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'));?>
    -
    -

    - -
    \ 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'])); ?> -   - - > - > - -   - - > - > +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    + + + -
    -

    - + +
    +
    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.''; ?> + + > - + - - + + - - - + + + + - + + '.$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'])); ?>
    + +

    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'));?>
    -
    -

    - -
    \ 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'])); ?> -   - - > - > - -   - - > - > +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    + + + -
    -

    - + +
    +
    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');?> -
    - - + +
    + +
    +

    + +
    + Form->create('Identifier');?> +
    + + Form->input('language_id'); + echo $this->Form->input('translation_file_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));?> -
    -
    -

    -
      +
    -
  • 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');?> -
    - - + +
    + +
    +

    + +
    + Form->create('Identifier');?> +
    + Form->value('Identifier.id')); ?> + Form->input('id'); echo $this->Form->input('language_id'); + echo $this->Form->input('translation_file_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));?> -
    -
    -

    -
      +
    -
  • 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.''; ?> + + > - + + - - - - - - + + + + + + + - + + '.$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'])); ?>
    + +

    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'));?>
    -
    -

    - -
    \ 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'])); ?> -   - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - -
    -
    -
    -

    - -
    - -
    -

    - + +
    +

    + +

    + - \ No newline at end of file +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/languages/add.ctp b/code/ryzom/tools/server/www/webtt/app/views/languages/add.ctp index d839e5c26..34124ee82 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/languages/add.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/languages/add.ctp @@ -1,37 +1,36 @@ -
    -
    +
    + -
    +

    Form->create('Language');?>
    - - + Form->input('name'); echo $this->Form->input('code'); ?> diff --git a/code/ryzom/tools/server/www/webtt/app/views/languages/admin_add.ctp b/code/ryzom/tools/server/www/webtt/app/views/languages/admin_add.ctp index 5304881f2..ab56f03bb 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/languages/admin_add.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/languages/admin_add.ctp @@ -1,43 +1,48 @@ -
    -
    +
    + -
    +

    Form->create('Language');?>
    - - + Form->input('name'); echo $this->Form->input('code'); ?>
    - Form->end(__('Submit', true));?> -
    +
    +Form->end(__('Submit', true));?> +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/languages/admin_edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/languages/admin_edit.ctp index 3888cb2f2..cddd8d03d 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/languages/admin_edit.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/languages/admin_edit.ctp @@ -1,45 +1,49 @@ -
    -
    +
    + -
    +

    Form->create('Language');?>
    - - Form->value('Language.id')); ?> + Form->input('id'); echo $this->Form->input('name'); echo $this->Form->input('code'); ?>
    - Form->end(__('Submit', true));?> -
    +
    +Form->end(__('Submit', true));?> +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/languages/admin_index.ctp b/code/ryzom/tools/server/www/webtt/app/views/languages/admin_index.ctp index 270a5b1f0..c0ceca123 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/languages/admin_index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/languages/admin_index.ctp @@ -1,61 +1,60 @@ -
    -
    -

    - Actions -

    -
    -
    Languages
    - - -
    Identifiers
    - +
    + +
    -
    -

    - - - - tableHeaders(array($paginator->sort('id'),$paginator->sort('name'),$paginator->sort('code'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); -echo ''.$tableHeaders.''; ?> +
    +

    +
    tableHeaders(array($paginator->sort('id'),$paginator->sort('name'),$paginator->sort('code'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); + echo ''.$tableHeaders.''; ?> - + > - - - - - + + + + + - -'.$tableHeaders.''; ?>
          Html->link(__('View', true), array('action' => 'view', $language['Language']['id'])); ?> Html->link(__('Edit', true), array('action' => 'edit', $language['Language']['id'])); ?> Html->link(__('Delete', true), array('action' => 'delete', $language['Language']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $language['Language']['id'])); ?>
    - - + + '.$tableHeaders.''; ?> + + +

    Paginator->counter(array( @@ -65,10 +64,8 @@ echo ''.$tableHeaders.''; ?>

    Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> - | Paginator->numbers();?> - | + | Paginator->numbers();?> | Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
    -
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/languages/admin_view.ctp b/code/ryzom/tools/server/www/webtt/app/views/languages/admin_view.ctp index 202516a06..075d015e1 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/languages/admin_view.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/languages/admin_view.ctp @@ -1,65 +1,80 @@ -
    -
    -

    +
    +
    -
    +

    -
    - > - > +
    + +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    +
    @@ -69,24 +84,28 @@

    diff --git a/code/ryzom/tools/server/www/webtt/app/views/languages/edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/languages/edit.ctp index ce5d275fb..b38b855cc 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/languages/edit.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/languages/edit.ctp @@ -1,38 +1,36 @@ -
    -
    +
    + -
    +

    Form->create('Language');?>
    - - Form->value('Language.id')); ?> + Form->input('id'); echo $this->Form->input('name'); echo $this->Form->input('code'); diff --git a/code/ryzom/tools/server/www/webtt/app/views/languages/index.ctp b/code/ryzom/tools/server/www/webtt/app/views/languages/index.ctp index 270a5b1f0..153283b66 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/languages/index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/languages/index.ctp @@ -1,61 +1,48 @@ -
    -
    -

    - Actions -

    -
    -
    Languages
    - - -
    Identifiers
    - +
    -
    -

    - - - - tableHeaders(array($paginator->sort('id'),$paginator->sort('name'),$paginator->sort('code'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); -echo ''.$tableHeaders.''; ?> +
    +

    +
    tableHeaders(array($paginator->sort('id'),$paginator->sort('name'),$paginator->sort('code'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); + echo ''.$tableHeaders.''; ?> - + > - - - - - + + + + + - -'.$tableHeaders.''; ?>
          Html->link(__('View', true), array('action' => 'view', $language['Language']['id'])); ?> - Html->link(__('Edit', true), array('action' => 'edit', $language['Language']['id'])); ?> - Html->link(__('Delete', true), array('action' => 'delete', $language['Language']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $language['Language']['id'])); ?> + | Html->link(__('List Translation Files', true), array('controller' => 'translation_files', 'action' => 'index', 'language_id' => $language['Language']['id'])); ?>
    - - + + '.$tableHeaders.''; ?> + + +

    Paginator->counter(array( @@ -65,10 +52,8 @@ echo ''.$tableHeaders.''; ?>

    Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> - | Paginator->numbers();?> - | + | Paginator->numbers();?> | Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
    -
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/languages/view.ctp b/code/ryzom/tools/server/www/webtt/app/views/languages/view.ctp index 92ed15f28..e3530ff09 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/languages/view.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/languages/view.ctp @@ -1,65 +1,67 @@ -
    -
    -

    +
    +
    -
    +

    -
    - > - > +
    + +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    +
    @@ -77,8 +79,8 @@ - + @@ -97,73 +99,22 @@ > - + Html->link(__('View', true), array('controller' => 'identifiers', 'action' => 'view', $identifier['id'])); ?> - Html->link(__('Edit', true), array('controller' => 'identifiers', 'action' => 'edit', $identifier['id'])); ?> - Html->link(__('Delete', true), array('controller' => 'identifiers', 'action' => 'delete', $identifier['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $identifier['id'])); ?> + | Html->link(__('Add Translation', true), array('controller' => 'translations', 'action' => 'add', 'identifier' => $identifier['id'])); ?> + | Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index', 'identifier' => $identifier['id'])); ?> -
    -
      -
    • Html->link(sprintf(__('New %s', true), __('Identifier', true)), array('controller' => 'identifiers', 'action' => 'add'));?>
    • -
    -
    -

    -
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/layouts/new.ctp b/code/ryzom/tools/server/www/webtt/app/views/layouts/new.ctp index ccc9a96d4..761e4d8c8 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/layouts/new.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/layouts/new.ctp @@ -2,11 +2,14 @@ Html->charset(); ?> - <?php echo $title_for_layout; ?> + + <?php __('Ryzom Core: Web Translation Tool :: '); ?> + <?php echo $title_for_layout; ?> + Html->meta('icon'); //echo $this->Html->css('cake.generic'); - echo $this->Html->css(array('reset', 'text', 'grid', 'layout', 'nav')); + echo $this->Html->css(array('reset', 'text', 'grid', 'layout', 'nav', 'labelWidth')); echo ''; echo ''; echo $this->Html->script(array('jquery-1.3.2.min.js', 'jquery-ui.js', 'jquery-fluid16.js')); @@ -14,25 +17,78 @@ ?> -
    +
    -
    -
    - -
    +
    +
    +
    + params['prefix']) && $this->params['prefix'] == "admin") { + ?> +
    +
    +
    +
    + Html->link(__('Back to admin page', true), array('controller' => 'pages', 'action' => 'display', 'prefix' => 'admin', 'home')); ?> +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    / + Html->link(__(Inflector::pluralize($model), true), array('controller' => $controller, 'action' => 'index')); + if ($path) + echo " / "; + } + ?> +
    +
    +
    +
    +
    +
    + +
    +
    Session->flash(); ?> + Session->flash('auth'); ?> +
    +
    - element('sql_dump'); ?> + element('sql_dump'); ?> diff --git a/code/ryzom/tools/server/www/webtt/app/views/pages/home.ctp b/code/ryzom/tools/server/www/webtt/app/views/pages/home.ctp index 631b9f62c..fb895390b 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/pages/home.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/pages/home.ctp @@ -17,7 +17,9 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ ?> -

    -

    -Html->link(__('List Languages', true), array('controller' => 'languages', 'action' => 'index')); ?> -

    +
    +

    +

    + Html->link(__('List Languages', true), array('controller' => 'languages', 'action' => 'index')); ?> +

    +
    \ No newline at end of file diff --git a/code/ryzom/tools/server/www/webtt/app/views/raw_files/index.ctp b/code/ryzom/tools/server/www/webtt/app/views/raw_files/index.ctp index 4b0b8baef..885c9cfdf 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/raw_files/index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/raw_files/index.ctp @@ -1,32 +1,51 @@ -
    -

    +
    + +
    + +
    +

    - - - - - - - + tableHeaders(array($paginator->sort('filename'),$paginator->sort('size'),$paginator->sort('modified'),__('Actions', true),)); +echo ''.$tableHeaders.''; ?> + +> - - - + + + -
    Paginator->sort('filename');?>Paginator->sort('size');?>Paginator->sort('modified');?>
      Time->nice($object['RawFile']['modified']); ?> Time->nice($rawFile['RawFile']['modified']); ?> - Html->link(__('View', true), array('action' => 'view', $object['RawFile']['filename'])); ?> - Html->link(__('Import', true), array('action' => 'import', $object['RawFile']['filename'])); ?> - Html->link(__('Export', true), array('action' => 'export', $object['RawFile']['filename']), null, sprintf(__('Are you sure you want to export # %s?', true), $object['RawFile']['filename'])); ?> + Html->link(__('View', true), array('action' => 'view', $rawFile['RawFile']['filename'])); ?> + Html->link(__('Import', true), array('action' => 'import', $rawFile['RawFile']['filename'])); ?> + + +
    +'.$tableHeaders.''; ?> + +

    Paginator->counter(array( @@ -35,18 +54,11 @@ ?>

    - Paginator->prev('<< ' . __('previous', 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'));?> + Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
    -
    -

    -
      -
    • Html->link(__('List Raw Files', true), array('controller' => 'raw_files', 'action' => 'index')); ?>
    • -

    • -
    • 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 +
    +element('sql_dump');?> \ No newline at end of file diff --git a/code/ryzom/tools/server/www/webtt/app/views/translations/add.ctp b/code/ryzom/tools/server/www/webtt/app/views/translations/add.ctp index eaa529564..d42bdec3c 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/translations/add.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/translations/add.ctp @@ -1,25 +1,129 @@ -
    -Form->create('Translation');?> -
    - - Form->input('identifier_id'); - echo $this->Form->input('translation_text'); - echo $this->Form->input('user_id'); - ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      +
      +
    -
    \ No newline at end of file +
    Users
    + + +
    Votes
    + +
    +
    +
    +
    + + + +
    + + +

    + +
    + Form->create('Translation');?> +
    + + Form->hidden('identifier_id', array('default' => $identifier['Identifier']['id'])); + echo $this->Form->input('translation_text'); + // TODO: change user_id for authorized user + echo $this->Form->hidden('user_id', array('default' => 1)); + ?> +
    +
    + Form->end(__('Submit', true));?> +
    +
    +
    +
    +

    +
    +
    + +
    ">
    +
    "> + + +
    + +
    +
    +
    + Html->link($identifier['Language']['name'], array('controller' => 'languages', 'action' => 'view', $identifier['Language']['id'])); ?> +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    +
    +
    +
    + +
    +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/translations/admin_add.ctp b/code/ryzom/tools/server/www/webtt/app/views/translations/admin_add.ctp index 0313500b5..199001ba6 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/translations/admin_add.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/translations/admin_add.ctp @@ -1,25 +1,50 @@ -
    -Form->create('Translation');?> -
    - - + +
    + +
    +

    + +
    + Form->create('Translation');?> +
    + + Form->input('identifier_id'); echo $this->Form->input('translation_text'); echo $this->Form->input('user_id'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      +
    + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('List Translations', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
  • -
  • Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file +
    +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/translations/admin_edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/translations/admin_edit.ctp index 7387d0c59..baf23f0a6 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/translations/admin_edit.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/translations/admin_edit.ctp @@ -1,27 +1,51 @@ -
    -Form->create('Translation');?> -
    - - + +
    + +
    +

    + +
    + Form->create('Translation');?> +
    + Form->value('Translation.id')); ?> + Form->input('id'); echo $this->Form->input('identifier_id'); echo $this->Form->input('translation_text'); echo $this->Form->input('user_id'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Translation.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Translation.id'))); ?>
  • -
  • Html->link(__('List Translations', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
  • -
  • Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file +
    +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/translations/admin_index.ctp b/code/ryzom/tools/server/www/webtt/app/views/translations/admin_index.ctp index 1a377991c..b878f7bda 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/translations/admin_index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/translations/admin_index.ctp @@ -1,42 +1,65 @@ -
    -

    - - - - - - - - - - - +
    + +
    + +
    +

    +
    Paginator->sort('id');?>Paginator->sort('identifier_id');?>Paginator->sort('translation_text');?>Paginator->sort('user_id');?>Paginator->sort('created');?>Paginator->sort('modified');?>
    tableHeaders(array($paginator->sort('id'),$paginator->sort('identifier_id'),$paginator->sort('translation_text'),$paginator->sort('user_id'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); + echo ''.$tableHeaders.''; ?> + + > - + - + - - + + - + + '.$tableHeaders.''; ?>
      Html->link($translation['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $translation['Identifier']['id'])); ?>   Html->link($translation['User']['name'], array('controller' => 'users', 'action' => 'view', $translation['User']['id'])); ?>    Html->link(__('View', true), array('action' => 'view', $translation['Translation']['id'])); ?> - Html->link(__('Edit', true), array('action' => 'edit', $translation['Translation']['id'])); ?> - Html->link(__('Delete', true), array('action' => 'delete', $translation['Translation']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $translation['Translation']['id'])); ?> + Html->link(__('Edit', true), array('action' => 'edit', $translation['Translation']['id'])); ?> + Html->link(__('Delete', true), array('action' => 'delete', $translation['Translation']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $translation['Translation']['id'])); ?>
    + +

    Paginator->counter(array( @@ -45,24 +68,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 Translation', true), array('action' => 'add')); ?>
    • -

    • -
    • Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
    • -
    • Html->link(__('New Identifier', true), array('controller' => 'identifiers', 'action' => 'add')); ?>
    • -

    • -
    • Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
    • -
    • Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
    • -

    • -
    • Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?>
    • -
    • Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add')); ?>
    • -
    -
    \ No newline at end of file +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/translations/admin_view.ctp b/code/ryzom/tools/server/www/webtt/app/views/translations/admin_view.ctp index c21a808ab..6b852a9dc 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/translations/admin_view.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/translations/admin_view.ctp @@ -1,73 +1,118 @@ -
    -

    -
    - > - > +
    + +
    + +
    + +
    +
    +

    +
    +
    + +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    +
    Html->link($translation['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $translation['Identifier']['id'])); ?> -   - - > - > +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    +
    Html->link($translation['User']['name'], array('controller' => 'users', 'action' => 'view', $translation['User']['id'])); ?> -   - - > - > +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    +
    +
    +
    -
    -

    - -
    - + + + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/translations/edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/translations/edit.ctp index 0f84bd4bf..0484d295e 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/translations/edit.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/translations/edit.ctp @@ -1,28 +1,121 @@ -
    -Form->create('Translation');?> -
    - - Form->input('id'); - echo $this->Form->input('identifier_id'); - echo $this->Form->input('translation_text'); - echo $this->Form->input('user_id'); - ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    - -
    \ No newline at end of file +
    Users
    + + +
    Votes
    + + + + + + + +
    +

    + +
    + Form->create('Translation');?> +
    + Form->value('Translation.id')); ?> + Form->input('id'); + echo $this->Form->input('identifier_id', array('type' => 'text', 'name'=>'buzu', 'value'=>$identifiers[$this->Form->value('Translation.identifier_id')], 'readonly' => 'readonly')); + echo $this->Form->hidden('identifier_id', array('default' => $this->Form->value('Translation.identifier_id'))); + echo $this->Form->input('translation_text'); + // TODO: change user_id for authorized user + echo $this->Form->hidden('user_id', array('default' => 1)); + ?> +
    +
    + Form->end(__('Submit', true));?> +
    +
    + +
    +
    +

    +
    +
    + +
    ">
    +
    "> + + +
    + +
    +
    +
    + Html->link($identifier['Language']['name'], array('controller' => 'languages', 'action' => 'view', $identifier['Language']['id'])); ?> +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    +
    +
    +
    + +
    +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/translations/index.ctp b/code/ryzom/tools/server/www/webtt/app/views/translations/index.ctp index 2bf80c563..7e44b94d2 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/translations/index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/translations/index.ctp @@ -1,40 +1,65 @@ -
    -

    - - - - - - - - - - - +
    + +
    + +
    +

    +
    Paginator->sort('id');?>Paginator->sort('identifier_id');?>Paginator->sort('translation_text');?>Paginator->sort('user_id');?>Paginator->sort('created');?>Paginator->sort('modified');?>
    tableHeaders(array($paginator->sort('id'),$paginator->sort('identifier_id'),$paginator->sort('translation_text'),$paginator->sort('user_id'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); + echo ''.$tableHeaders.''; ?> + + > - + - + - - + + - + + '.$tableHeaders.''; ?>
      Html->link($translation['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $translation['Identifier']['id'])); ?>   Html->link($translation['User']['name'], array('controller' => 'users', 'action' => 'view', $translation['User']['id'])); ?>    Html->link(__('View', true), array('action' => 'view', $translation['Translation']['id'])); ?> + Html->link(__('Edit', true), array('action' => 'edit', $translation['Translation']['id'])); ?> + Html->link(__('Delete', true), array('action' => 'delete', $translation['Translation']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $translation['Translation']['id'])); ?> + | Html->link(__('Vote', true), array('controller' => 'votes', 'action' => 'vote', 'translation' => $translation['Translation']['id'])); ?>
    + +

    Paginator->counter(array( @@ -43,21 +68,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'));?>
    -
    -

    - -
    \ No newline at end of file +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/translations/view.ctp b/code/ryzom/tools/server/www/webtt/app/views/translations/view.ctp index 06302a251..a1b87c329 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/translations/view.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/translations/view.ctp @@ -1,73 +1,183 @@ -
    -

    -
    - > - > - -   - - > - > - Html->link($translation['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $translation['Identifier']['id'])); ?> - [] -   - - > - > - -   - - > - > - Html->link($translation['User']['name'], array('controller' => 'users', 'action' => 'view', $translation['User']['id'])); ?> -   - - > - > - -   - - > - > - -   - -
    +
    +
    -
    -

    -
      -
    • Html->link(__('Edit Translation', true), array('action' => 'edit', $translation['Translation']['id'])); ?>
    • -
    • Html->link(__('List Translations', true), array('action' => 'index')); ?>
    • -
    • Html->link(__('New Translation', true), array('action' => 'add')); ?>
    • -

    • -
    • Html->link(__('List Identifiers', true), array('controller' => 'identifiers', 'action' => 'index')); ?>
    • -

    • -
    • Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
    • -

    • -
    • Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?>
    • -
    + +
    + +
    +
    +

    +
    +
    + +
    ">
    +
    "> + +
    + +
    +
    +
    + Html->link($translation['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $translation['Identifier']['id'])); ?> +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    +
    + Html->link($translation['User']['name'], array('controller' => 'users', 'action' => 'view', $translation['User']['id'])); ?> +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    ">
    +
    "> + + +
    + +
    +
    +
    +
    - +
    + +
    +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/users/add.ctp b/code/ryzom/tools/server/www/webtt/app/views/users/add.ctp index 0fbe8bb8d..4bd0cc224 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/users/add.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/users/add.ctp @@ -1,21 +1,43 @@ -
    -Form->create('User');?> -
    - - + +
    + +
    +

    + +
    + Form->create('User');?> +
    + + Form->input('name'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('List Users', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/users/admin_add.ctp b/code/ryzom/tools/server/www/webtt/app/views/users/admin_add.ctp index 8272a80e3..8a3121e33 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/users/admin_add.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/users/admin_add.ctp @@ -1,21 +1,43 @@ -
    -Form->create('User');?> -
    - - + +
    + +
    +

    + +
    + Form->create('User');?> +
    + + Form->input('name'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('List Users', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/users/admin_edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/users/admin_edit.ctp index 276341ea1..ec9671ca6 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/users/admin_edit.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/users/admin_edit.ctp @@ -1,23 +1,44 @@ -
    -Form->create('User');?> -
    - - + +
    + +
    +

    + +
    + Form->create('User');?> +
    + Form->value('User.id')); ?> + Form->input('id'); echo $this->Form->input('name'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('User.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('User.id'))); ?>
  • -
  • Html->link(__('List Users', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/users/admin_index.ctp b/code/ryzom/tools/server/www/webtt/app/views/users/admin_index.ctp index b517108b3..43d7d4739 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/users/admin_index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/users/admin_index.ctp @@ -1,34 +1,55 @@ -
    -

    - - - - - - - - - +
    + +
    + +
    +

    +
    Paginator->sort('id');?>Paginator->sort('name');?>Paginator->sort('created');?>Paginator->sort('modified');?>
    tableHeaders(array($paginator->sort('id'),$paginator->sort('name'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); + echo ''.$tableHeaders.''; ?> + + > - - - - + + + + - + + '.$tableHeaders.''; ?>
         Html->link(__('View', true), array('action' => 'view', $user['User']['id'])); ?> - Html->link(__('Edit', true), array('action' => 'edit', $user['User']['id'])); ?> - Html->link(__('Delete', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?> + Html->link(__('Edit', true), array('action' => 'edit', $user['User']['id'])); ?> + Html->link(__('Delete', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?>
    + +

    Paginator->counter(array( @@ -37,21 +58,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'));?>
    -
    -

    - -
    \ No newline at end of file +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/users/admin_view.ctp b/code/ryzom/tools/server/www/webtt/app/views/users/admin_view.ctp index d43038c55..dd554f14a 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/users/admin_view.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/users/admin_view.ctp @@ -1,62 +1,102 @@ -
    -

    -
    - > - > +
    + +
    + +
    + +
    +
    +

    +
    +
    + +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    + + + -
    -

    - -
    - - + + + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/users/edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/users/edit.ctp index fb3782453..acdec0d93 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/users/edit.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/users/edit.ctp @@ -1,23 +1,44 @@ -
    -Form->create('User');?> -
    - - + +
    + +
    +

    + +
    + Form->create('User');?> +
    + Form->value('User.id')); ?> + Form->input('id'); echo $this->Form->input('name'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('User.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('User.id'))); ?>
  • -
  • Html->link(__('List Users', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/users/index.ctp b/code/ryzom/tools/server/www/webtt/app/views/users/index.ctp index b517108b3..d8cc5607e 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/users/index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/users/index.ctp @@ -1,34 +1,52 @@ -
    -

    - - - - - - - - - +
    + +
    + +
    +

    +
    Paginator->sort('id');?>Paginator->sort('name');?>Paginator->sort('created');?>Paginator->sort('modified');?>
    tableHeaders(array($paginator->sort('id'),$paginator->sort('name'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); + echo ''.$tableHeaders.''; ?> + + > - - - - + + + + - + + '.$tableHeaders.''; ?>
         Html->link(__('View', true), array('action' => 'view', $user['User']['id'])); ?> - Html->link(__('Edit', true), array('action' => 'edit', $user['User']['id'])); ?> - Html->link(__('Delete', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?>
    + +

    Paginator->counter(array( @@ -37,21 +55,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'));?>
    -
    -

    - -
    \ No newline at end of file +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/users/view.ctp b/code/ryzom/tools/server/www/webtt/app/views/users/view.ctp index d43038c55..827058785 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/users/view.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/users/view.ctp @@ -1,62 +1,99 @@ -
    -

    -
    - > - > +
    + +
    + +
    + +
    +
    +

    +
    +
    + +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    + + + -
    -

    - -
    - - + + + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/votes/add.ctp b/code/ryzom/tools/server/www/webtt/app/views/votes/add.ctp index 1c548858e..2fab35c25 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/votes/add.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/votes/add.ctp @@ -1,22 +1,42 @@ -
    -Form->create('Vote');?> -
    - - + +
    + +
    +

    + +
    + Form->create('Vote');?> +
    + + Form->input('translation_id'); echo $this->Form->input('user_id'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('List Votes', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
  • -
  • Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/votes/admin_add.ctp b/code/ryzom/tools/server/www/webtt/app/views/votes/admin_add.ctp index 64b8b7b0f..879155f32 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/votes/admin_add.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/votes/admin_add.ctp @@ -1,22 +1,44 @@ -
    -Form->create('Vote');?> -
    - - + +
    + +
    +

    + +
    + Form->create('Vote');?> +
    + + Form->input('translation_id'); echo $this->Form->input('user_id'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('List Votes', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
  • -
  • Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/votes/admin_edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/votes/admin_edit.ctp index bfddacefb..9b662d5bc 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/votes/admin_edit.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/votes/admin_edit.ctp @@ -1,24 +1,45 @@ -
    -Form->create('Vote');?> -
    - - + +
    + +
    +

    + +
    + Form->create('Vote');?> +
    + Form->value('Vote.id')); ?> + Form->input('id'); echo $this->Form->input('translation_id'); echo $this->Form->input('user_id'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Vote.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Vote.id'))); ?>
  • -
  • Html->link(__('List Votes', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
  • -
  • Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/votes/admin_index.ctp b/code/ryzom/tools/server/www/webtt/app/views/votes/admin_index.ctp index ec5ae6db7..2bbc1e9a1 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/votes/admin_index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/votes/admin_index.ctp @@ -1,40 +1,60 @@ -
    -

    - - - - - - - - - - +
    + +
    + +
    +

    +
    Paginator->sort('id');?>Paginator->sort('translation_id');?>Paginator->sort('user_id');?>Paginator->sort('created');?>Paginator->sort('modified');?>
    tableHeaders(array($paginator->sort('id'),$paginator->sort('translation_id'),$paginator->sort('user_id'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); + echo ''.$tableHeaders.''; ?> + + > - + - - + + - + + '.$tableHeaders.''; ?>
      Html->link($vote['Translation']['translation_text'], array('controller' => 'translations', 'action' => 'view', $vote['Translation']['id'])); ?> Html->link($vote['User']['name'], array('controller' => 'users', 'action' => 'view', $vote['User']['id'])); ?>    Html->link(__('View', true), array('action' => 'view', $vote['Vote']['id'])); ?> - Html->link(__('Edit', true), array('action' => 'edit', $vote['Vote']['id'])); ?> - Html->link(__('Delete', true), array('action' => 'delete', $vote['Vote']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $vote['Vote']['id'])); ?> + Html->link(__('Edit', true), array('action' => 'edit', $vote['Vote']['id'])); ?> + Html->link(__('Delete', true), array('action' => 'delete', $vote['Vote']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $vote['Vote']['id'])); ?>
    + +

    Paginator->counter(array( @@ -43,21 +63,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'));?>
    -
    -

    - -
    \ No newline at end of file +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/votes/admin_view.ctp b/code/ryzom/tools/server/www/webtt/app/views/votes/admin_view.ctp index ee5e7e265..fdc48cebd 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/votes/admin_view.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/votes/admin_view.ctp @@ -1,43 +1,79 @@ -
    -

    -
    - > - > +
    + +
    + +
    + +
    +
    +

    +
    +
    + +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    +
    Html->link($vote['Translation']['translation_text'], array('controller' => 'translations', 'action' => 'view', $vote['Translation']['id'])); ?> -   - - > - > +
    + +
    +
    +
    Html->link($vote['User']['name'], array('controller' => 'users', 'action' => 'view', $vote['User']['id'])); ?> -   - - > - > +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    + + + -
    -

    - + +
    +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/votes/edit.ctp b/code/ryzom/tools/server/www/webtt/app/views/votes/edit.ctp index 4ddbab111..c77827257 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/votes/edit.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/votes/edit.ctp @@ -1,24 +1,43 @@ -
    -Form->create('Vote');?> -
    - - + +
    + +
    +

    + +
    + Form->create('Vote');?> +
    + Form->value('Vote.id')); ?> + Form->input('id'); echo $this->Form->input('translation_id'); echo $this->Form->input('user_id'); ?> -
    -Form->end(__('Submit', true));?> -
    -
    -

    -
      + + Form->end(__('Submit', true));?> +
    -
  • Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Vote.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Vote.id'))); ?>
  • -
  • Html->link(__('List Votes', true), array('action' => 'index'));?>
  • -
  • Html->link(__('List Translations', true), array('controller' => 'translations', 'action' => 'index')); ?>
  • -
  • Html->link(__('New Translation', true), array('controller' => 'translations', 'action' => 'add')); ?>
  • -
  • Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?>
  • -
  • Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?>
  • - -
    \ No newline at end of file + +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/votes/index.ctp b/code/ryzom/tools/server/www/webtt/app/views/votes/index.ctp index ec5ae6db7..1a76ec74b 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/votes/index.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/votes/index.ctp @@ -1,40 +1,57 @@ -
    -

    - - - - - - - - - - +
    + +
    + +
    +

    +
    Paginator->sort('id');?>Paginator->sort('translation_id');?>Paginator->sort('user_id');?>Paginator->sort('created');?>Paginator->sort('modified');?>
    tableHeaders(array($paginator->sort('id'),$paginator->sort('translation_id'),$paginator->sort('user_id'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),)); + echo ''.$tableHeaders.''; ?> + + > - + - - + + - + + '.$tableHeaders.''; ?>
      Html->link($vote['Translation']['translation_text'], array('controller' => 'translations', 'action' => 'view', $vote['Translation']['id'])); ?> Html->link($vote['User']['name'], array('controller' => 'users', 'action' => 'view', $vote['User']['id'])); ?>    Html->link(__('View', true), array('action' => 'view', $vote['Vote']['id'])); ?> - Html->link(__('Edit', true), array('action' => 'edit', $vote['Vote']['id'])); ?> - Html->link(__('Delete', true), array('action' => 'delete', $vote['Vote']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $vote['Vote']['id'])); ?> + Html->link(__('Edit', true), array('action' => 'edit', $vote['Vote']['id'])); ?>
    + +

    Paginator->counter(array( @@ -43,21 +60,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'));?>
    -
    -

    - -
    \ No newline at end of file +
    diff --git a/code/ryzom/tools/server/www/webtt/app/views/votes/view.ctp b/code/ryzom/tools/server/www/webtt/app/views/votes/view.ctp index ee5e7e265..0373b8e16 100644 --- a/code/ryzom/tools/server/www/webtt/app/views/votes/view.ctp +++ b/code/ryzom/tools/server/www/webtt/app/views/votes/view.ctp @@ -1,43 +1,76 @@ -
    -

    -
    - > - > +
    + +
    + +
    + +
    +
    +

    +
    +
    + +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    +
    Html->link($vote['Translation']['translation_text'], array('controller' => 'translations', 'action' => 'view', $vote['Translation']['id'])); ?> -   - - > - > +
    + +
    +
    +
    Html->link($vote['User']['name'], array('controller' => 'users', 'action' => 'view', $vote['User']['id'])); ?> -   - - > - > +
    + +
    +
    ">
    +
    "> -   - - > - > + +
    + +
    +
    ">
    +
    "> -   - -
    + +
    + +
    + + + -
    -

    - + +
    +
    diff --git a/code/ryzom/tools/server/www/webtt/app/webroot/css/960.css b/code/ryzom/tools/server/www/webtt/app/webroot/css/960.css index 6db1bd34c..9e670fc02 100755 --- a/code/ryzom/tools/server/www/webtt/app/webroot/css/960.css +++ b/code/ryzom/tools/server/www/webtt/app/webroot/css/960.css @@ -3,6 +3,8 @@ Learn more ~ http://960.gs/ Licensed under GPL and MIT. + + WebTT template based on 960 Grid System (http://960.gs/) */ /* =Containers diff --git a/code/ryzom/tools/server/www/webtt/app/webroot/css/cake.generic.css b/code/ryzom/tools/server/www/webtt/app/webroot/css/cake.generic.css index 4f6f5a2cd..101deb26a 100644 --- a/code/ryzom/tools/server/www/webtt/app/webroot/css/cake.generic.css +++ b/code/ryzom/tools/server/www/webtt/app/webroot/css/cake.generic.css @@ -207,7 +207,7 @@ div.paging span a { dl { line-height: 2em; margin: 0em 0em; - width: 60%; + width: 80%; } dl .altrow { background: #f4f4f4; @@ -218,7 +218,7 @@ dt { vertical-align: top; } dd { - margin-left: 10em; + margin-left: 15em; margin-top: -2em; vertical-align: top; } diff --git a/code/ryzom/tools/server/www/webtt/app/webroot/css/grid.css b/code/ryzom/tools/server/www/webtt/app/webroot/css/grid.css index dd21d4e56..f39ac87fd 100755 --- a/code/ryzom/tools/server/www/webtt/app/webroot/css/grid.css +++ b/code/ryzom/tools/server/www/webtt/app/webroot/css/grid.css @@ -3,6 +3,8 @@ Learn more ~ http://960.gs/ Licensed under GPL and MIT. + + WebTT template based on 960 Grid System (http://960.gs/) */ /* =Containers diff --git a/code/ryzom/tools/server/www/webtt/app/webroot/css/ie.css b/code/ryzom/tools/server/www/webtt/app/webroot/css/ie.css index 7fe61ff28..1394ddd85 100755 --- a/code/ryzom/tools/server/www/webtt/app/webroot/css/ie.css +++ b/code/ryzom/tools/server/www/webtt/app/webroot/css/ie.css @@ -3,6 +3,8 @@ Learn more ~ http://www.designinfluences.com/ Licensed under GPL and MIT. + + WebTT template based on 960 Grid System (http://960.gs/) */ /* =Grid >> Global diff --git a/code/ryzom/tools/server/www/webtt/app/webroot/css/ie6.css b/code/ryzom/tools/server/www/webtt/app/webroot/css/ie6.css index b1ff5b5ce..091e11747 100755 --- a/code/ryzom/tools/server/www/webtt/app/webroot/css/ie6.css +++ b/code/ryzom/tools/server/www/webtt/app/webroot/css/ie6.css @@ -3,7 +3,9 @@ Learn more ~ http://www.designinfluences.com/ Licensed under GPL and MIT. -*/ + + WebTT template based on 960 Grid System (http://960.gs/) +4*/ /* =Grid >> Global --------------------------------------------------------------------------------*/ diff --git a/code/ryzom/tools/server/www/webtt/app/webroot/css/layout.css b/code/ryzom/tools/server/www/webtt/app/webroot/css/layout.css index 1c88c6c95..259166d09 100755 --- a/code/ryzom/tools/server/www/webtt/app/webroot/css/layout.css +++ b/code/ryzom/tools/server/www/webtt/app/webroot/css/layout.css @@ -1,12 +1,18 @@ -/* +/* WebTT template based on 960 Grid System (http://960.gs/) + ----------------------------------------------- Grey Box Method - Layout CSS ----------------------------------------------- */ body { - background: #eee; - border-top: 5px solid #000; - color: #333; + background: #000 ; + background-image: url("http://www.ryzom.com/data/bg.jpg"); + background-attachment:fixed; + background-repeat: repeat-x; +// border-top: 5px solid #000; + margin-top: 5px; +// color: #333; + color: #ddd; font-size: 11px; padding: 0 0 40px; } @@ -15,12 +21,16 @@ body { /* anchors ----------------------------------------------- */ a { - color: #000; +// color: #000; + color: inherit; font-weight:bold; text-decoration: none; } a:hover { - color:#333; +// color:#333; +// text-decoration: underline; +// text-shadow: #6374AB 0px 0px 2px; + text-shadow: #84AFBD 0px 0px 2px; } @@ -28,7 +38,10 @@ a:hover { ----------------------------------------------- */ .container_12, .container_16 { - background:#fff; + background: rgb(71,71,71); + background: rgba(0,0,0, 0.6); + border: 1px solid rgb(110,110,110); + border: 1px solid rgba(255,255,255, 0.5); } @@ -42,7 +55,12 @@ h6 {font-size:1em; text-transform:uppercase;} h1 a { font-weight:normal; + color: #ddd; } +h1 a:hover { + font-weight:normal; + color: #ddd; +} /* branding @@ -70,28 +88,70 @@ h2#page-heading { /* boxes ----------------------------------------------- */ .box { - background:#ddd; +// background:rgb(210,210,210); +// background:rgba(255,255,255,0.81); margin-bottom:20px; padding:10px 10px 1px 10px; +// color: #333; + color: #ddd; + border: 1px solid rgb(71,71,71); + border: 1px solid rgba(255,255,255,0.4); } .box h2 { font-size:1em; font-weight:normal; text-transform:uppercase; color:#fff; - background:#333; +// background:#333; + background:rgb(31,31,31); + background:rgba(90,90,0,0.6); margin:-10px -10px 0 -10px; padding:6px 12px; } .box h2 a, .box h2 a.visible { - color:#fff; - background:#333 url("../img/switch_minus.gif") 97% 50% no-repeat; +// color:#fff; + color: #ddd; +// background:#333 url("../img/switch_minus.gif") 97% 50% no-repeat; + background:url("../img/switch_minus.gif") 97% 50% no-repeat; + background:url("../img/switch_minus.gif") 97% 50% no-repeat; display:block; padding:6px 12px; margin:-6px -12px; border:none; } +.box h2 a.hidden, +.box h2 a.hidden:hover { + background-image: url("../img/switch_plus.gif"); +} +.box h2 a:hover { + background-color:#111; +} + +.menubox { + padding:0px; + color: #333; +} +.menubox .inbox { + background:rgb(210,210,210); + background:rgba(255,255,255,0.81); + padding: 0px 10px 1px; +} +.inbox a { + color: #000; +} +.menubox h2 { + margin: 0px; +} +.menubox h2 a, +.menubox h2 a.visible { + background:rgb(31,31,31) url("../img/switch_minus.gif") 97% 50% no-repeat; + background:rgba(90,90,0,0.6) url("../img/switch_minus.gif") 97% 50% no-repeat; +} +.menubox h2 a:hover { + background-color:#111; +} + .grid_4 .box h2 a { background-position: 97% 50%; } @@ -103,13 +163,6 @@ h2#page-heading { } -.box h2 a.hidden, -.box h2 a.hidden:hover { - background-image: url("../img/switch_plus.gif"); -} -.box h2 a:hover { - background-color:#111; -} .block { padding-top:10px; } @@ -245,7 +298,9 @@ ul.section li.current > a.active:hover { ----------------------------------------------- */ table { width:100%; - border:1px solid #bbb; +// border:1px solid #bbb; + border:1px solid #aaa; +// border: 1px solid rgba(0,0,0,0.55); margin-bottom:10px; } col.colC { @@ -254,10 +309,12 @@ col.colC { th, td { padding:.2em 1em; text-align:left; + color: #333; } thead th { border-bottom:2px solid #888; - background:#bbb; + background: #eee; + background:rgba(212,222,255,0.65); padding:.4em 1em .2em; } thead th.table-head { @@ -272,7 +329,8 @@ tbody th, tbody td { border-top:1px solid #bbb; border-bottom:1px solid #bbb; - background:#eee; + background:#eee; + background:rgba(255,255,255,0.85); } tbody tr.odd th, tbody tr.odd td { @@ -282,6 +340,7 @@ tfoot th, tfoot td { border-top:2px solid #666; background:#eee; + background:rgba(212,222,255,0.65); } tfoot tr.total th, tfoot tr.total td { @@ -295,7 +354,7 @@ td.currency { text-align:right; } tfoot.dark th, tfoot.dark td { - background: #bbbbbb; +// background: #bbbbbb; } @@ -309,12 +368,14 @@ fieldset { padding:10px; position:relative; background:#e9e9e9; + background:rgba(255,255,255,0.81); margin-bottom:10px; + color: #333; } legend { font-size:1.1em; padding:.4em .8em; - background:#fff; + background:#f5f5f5; border:1px solid #bbb; } fieldset.login p { @@ -531,7 +592,7 @@ div#flashMessage { padding: 10px; margin: 0px 13px 10px 11px; border: 1px dashed #888; - background: #eee; + background: #ffcccc; font-size: 14px; } div.flash-error { @@ -553,6 +614,11 @@ div.error-message { color: #bf0000; font-weight: bold; } +div.form div.box { + padding: 10px; + background:#e9e9e9; + background: none repeat scroll 0 0 rgba(255, 255, 255, 0.81); +} .input { margin: 0px 0px 5px 0px; } @@ -588,7 +654,35 @@ dl { margin: 0em 0em; width: 60%; } -dl .altrow { +div.dl { + border: 1px solid #aaa; + color: #333; + margin-bottom: 10px; +} +div.dh { + background: none repeat scroll 0 0 rgba(212, 222, 255, 0.65); + padding: 0.4em 1em 0.2em; + font-weight: bold; + border-bottom: 1px solid #888888; + border-top: 0px none; +} +.dt, .dd { + padding: 0.4em 1em 0.2em; + border-top: 1px solid #888888; +} +div.dt { + float: left; + width: 10em; + background: transparent; + font-weight: bold; +} +.dd { + background: none repeat scroll 0 0 rgba(255, 255, 255, 0.85); +} +.dd:after { + clear: both; +} +dl .altrow, div .altrow { background: #f4f4f4; } dt { diff --git a/code/ryzom/tools/server/www/webtt/app/webroot/css/nav.css b/code/ryzom/tools/server/www/webtt/app/webroot/css/nav.css index 53bff8d1e..cb4bf108e 100755 --- a/code/ryzom/tools/server/www/webtt/app/webroot/css/nav.css +++ b/code/ryzom/tools/server/www/webtt/app/webroot/css/nav.css @@ -1,4 +1,5 @@ -/* +/* WebTT template based on 960 Grid System (http://960.gs/) + ----------------------------------------------- Navigation ----------------------------------------------- */ diff --git a/code/ryzom/tools/server/www/webtt/app/webroot/css/text.css b/code/ryzom/tools/server/www/webtt/app/webroot/css/text.css index b6a687bba..a03be0190 100755 --- a/code/ryzom/tools/server/www/webtt/app/webroot/css/text.css +++ b/code/ryzom/tools/server/www/webtt/app/webroot/css/text.css @@ -3,6 +3,8 @@ Learn more ~ http://960.gs/ Licensed under GPL and MIT. + + WebTT template based on 960 Grid System (http://960.gs/) */ /* =Basic HTML @@ -10,7 +12,7 @@ body { - font: 13px/1.5 Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif; + font: 13px/1.5 'lucida grande',verdana,helvetica,arial,'Liberation Sans', FreeSans, sans-serif } a:focus diff --git a/code/ryzom/tools/server/www/webtt/cake/console/libs/tasks/view.php b/code/ryzom/tools/server/www/webtt/cake/console/libs/tasks/view.php index 7ccc74072..b9ff719d1 100644 --- a/code/ryzom/tools/server/www/webtt/cake/console/libs/tasks/view.php +++ b/code/ryzom/tools/server/www/webtt/cake/console/libs/tasks/view.php @@ -224,7 +224,7 @@ class ViewTask extends BakeTask { $this->controllerPath = strtolower(Inflector::underscore($this->controllerName)); $prompt = sprintf(__("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite %s views if it exist.", true), $this->controllerName); - $interactive = $this->in($prompt, array('y', 'n'), 'n'); + $interactive = $this->in($prompt, array('y', 'n'), 'y'); if (strtolower($interactive) == 'n') { $this->interactive = false; @@ -233,12 +233,13 @@ class ViewTask extends BakeTask { $prompt = __("Would you like to create some CRUD views\n(index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller\nand model classes (including associated models).", true); $wannaDoScaffold = $this->in($prompt, array('y','n'), 'y'); - $wannaDoAdmin = $this->in(__("Would you like to create the views for admin routing?", true), array('y','n'), 'n'); + $wannaDoAdmin = $this->in(__("Would you like to create the views for admin routing?", true), array('y','n'), 'y'); if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoAdmin) == 'y') { $vars = $this->__loadController(); if (strtolower($wannaDoScaffold) == 'y') { $actions = $this->scaffoldActions; + $vars['scaffoldPrefix'] = null; $this->bakeActions($actions, $vars); } if (strtolower($wannaDoAdmin) == 'y') { @@ -248,6 +249,7 @@ class ViewTask extends BakeTask { foreach ($regularActions as $action) { $adminActions[] = $admin . $action; } + $vars['scaffoldPrefix'] = $admin; $this->bakeActions($adminActions, $vars); } $this->hr(); @@ -298,17 +300,20 @@ class ViewTask extends BakeTask { $schema = $modelObj->schema(true); $fields = array_keys($schema); $associations = $this->__associations($modelObj); + $scaffoldForbiddenActions = $modelObj->scaffoldForbiddenActions; } else { $primaryKey = $displayField = null; $singularVar = Inflector::variable(Inflector::singularize($this->controllerName)); $singularHumanName = $this->_singularHumanName($this->controllerName); $fields = $schema = $associations = array(); } + $controllerMethods = get_class_methods($controllerClassName); + $pluralVar = Inflector::variable($this->controllerName); $pluralHumanName = $this->_pluralHumanName($this->controllerName); return compact('modelClass', 'schema', 'primaryKey', 'displayField', 'singularVar', 'pluralVar', - 'singularHumanName', 'pluralHumanName', 'fields','associations'); + 'singularHumanName', 'pluralHumanName', 'fields','associations', 'scaffoldForbiddenActions'); } /** @@ -484,6 +489,8 @@ class ViewTask extends BakeTask { $associations[$type][$assocKey]['foreignKey'] = $assocData['foreignKey']; $associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($assocData['className'])); $associations[$type][$assocKey]['fields'] = array_keys($model->{$assocKey}->schema(true)); + $associations[$type][$assocKey]['scaffoldForbiddenActions'] = $model->{$assocKey}->scaffoldForbiddenActions; + $associations[$type][$assocKey]['scaffoldActions'] = $model->{$assocKey}->scaffoldActions; } } return $associations; diff --git a/code/ryzom/tools/server/www/webtt/cake/libs/model/datasources/dbo_source.php b/code/ryzom/tools/server/www/webtt/cake/libs/model/datasources/dbo_source.php old mode 100755 new mode 100644 diff --git a/code/ryzom/tools/server/www/webtt/plugins/debug_kit/views/elements/log_panel.ctp b/code/ryzom/tools/server/www/webtt/plugins/debug_kit/views/elements/log_panel.ctp index ae8a406e2..1751df991 100644 --- a/code/ryzom/tools/server/www/webtt/plugins/debug_kit/views/elements/log_panel.ctp +++ b/code/ryzom/tools/server/www/webtt/plugins/debug_kit/views/elements/log_panel.ctp @@ -27,7 +27,7 @@ if ($len > 0): $headers = array(__d('debug_kit', 'Time', true), __d('debug_kit', 'Message', true)); $rows = array(); - for ($i = 0; $i < $len; $i += 2): + for ($i = 0; $i < $len; $i += 1): $rows[] = array( $logs[$i][0], h($logs[$i][1]) );