Changed: #1315 Merged WebTT tool into default.

This commit is contained in:
sfb 2012-03-22 14:31:47 -05:00
commit ecc8d15748
1027 changed files with 255572 additions and 0 deletions

View file

@ -208,3 +208,5 @@ code/ryzom/server/src/ryzom_admin_service/ryzom_admin_service
code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service
code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service
code/ryzom/server/src/tick_service/tick_service
# WebTT temp dir
code/ryzom/tools/server/www/webtt/app/tmp

View file

@ -0,0 +1,4 @@
/app/config
/app/tmp
/plugins
/vendors

View file

@ -0,0 +1,5 @@
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

View file

@ -0,0 +1,28 @@
CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.
The Cake Software Foundation - promoting development related to CakePHP
http://cakefoundation.org/
CakePHP - the rapid development PHP framework
http://www.cakephp.org
Cookbook - user documentation for learning about CakePHP
http://book.cakephp.org
API - quick reference to CakePHP
http://api.cakephp.org
The Bakery - everything CakePHP
http://bakery.cakephp.org
The Show - live and archived podcasts about CakePHP and more
http://live.cakephp.org
CakePHP TV - screen casts from events and video tutorials
http://tv.cakephp.org
CakePHP Google Group - community mailing list and forum
http://groups.google.com/group/cake-php
#cakephp on irc.freenode.net - chat with CakePHP developers
irc://irc.freenode.net/cakephp

View file

@ -0,0 +1,5 @@
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>

View file

@ -0,0 +1,70 @@
;<?php die() ?>
; SVN FILE: $Id$
;/**
; * ACL configuration
; *
; *
; * PHP versions 4 and 5
; *
; * CakePHP(tm) : Rapid Development Framework http://cakephp.org
; * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
; *
; * Licensed under The MIT License
; * Redistributions of files must retain the above copyright notice.
; *
; * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
; * @link http://cakephp.org CakePHP(tm) Project
; * @package cake
; * @subpackage cake.app.config
; * @since CakePHP(tm) v 0.10.0.1076
; * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
; */
; acl.ini.php - Cake ACL Configuration
; ---------------------------------------------------------------------
; Use this file to specify user permissions.
; aco = access control object (something in your application)
; aro = access request object (something requesting access)
;
; User records are added as follows:
;
; [uid]
; groups = group1, group2, group3
; allow = aco1, aco2, aco3
; deny = aco4, aco5, aco6
;
; Group records are added in a similar manner:
;
; [gid]
; allow = aco1, aco2, aco3
; deny = aco4, aco5, aco6
;
; The allow, deny, and groups sections are all optional.
; NOTE: groups names *cannot* ever be the same as usernames!
;
; ACL permissions are checked in the following order:
; 1. Check for user denies (and DENY if specified)
; 2. Check for user allows (and ALLOW if specified)
; 3. Gather user's groups
; 4. Check group denies (and DENY if specified)
; 5. Check group allows (and ALLOW if specified)
; 6. If no aro, aco, or group information is found, DENY
;
; ---------------------------------------------------------------------
;-------------------------------------
;Users
;-------------------------------------
[username-goes-here]
groups = group1, group2
deny = aco1, aco2
allow = aco3, aco4
;-------------------------------------
;Groups
;-------------------------------------
[groupname-goes-here]
deny = aco5, aco6
allow = aco7, aco8

View file

@ -0,0 +1,50 @@
<?php
/**
* This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php
*
* This is an application wide file to load any function that is not used within a class
* define. You can also use this to include or require any files in your application.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP(tm) v 0.10.8.2117
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* The settings below can be used to set additional paths to models, views and controllers.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
*
* App::build(array(
* 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'),
* 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'),
* 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
* 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
* 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
* 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'),
* 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
* 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
* 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
* 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
* ));
*
*/
/**
* As of 1.3, additional rules for the inflector are added below
*
* Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
* Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
*
*/

View file

@ -0,0 +1,304 @@
<?php
/**
* This is core configuration file.
*
* Use it to configure core behavior of Cake.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* CakePHP Debug Level:
*
* Production Mode:
* 0: No error messages, errors, or warnings shown. Flash messages redirect.
*
* Development Mode:
* 1: Errors and warnings shown, model caches refreshed, flash messages halted.
* 2: As in 1, but also with full debug messages and SQL output.
*
* In production mode, flash messages redirect after a time interval.
* In development mode, you need to click the flash message to continue.
*/
Configure::write('debug', 2);
/**
* CakePHP Log Level:
*
* In case of Production Mode CakePHP gives you the possibility to continue logging errors.
*
* The following parameters can be used:
* Boolean: Set true/false to activate/deactivate logging
* Configure::write('log', true);
*
* Integer: Use built-in PHP constants to set the error level (see error_reporting)
* Configure::write('log', E_ERROR | E_WARNING);
* Configure::write('log', E_ALL ^ E_NOTICE);
*/
Configure::write('log', true);
/**
* Application wide charset encoding
*/
Configure::write('App.encoding', 'UTF-8');
/**
* To configure CakePHP *not* to use mod_rewrite and to
* use CakePHP pretty URLs, remove these .htaccess
* files:
*
* /.htaccess
* /app/.htaccess
* /app/webroot/.htaccess
*
* And uncomment the App.baseUrl below:
*/
//Configure::write('App.baseUrl', env('SCRIPT_NAME'));
/**
* Uncomment the define below to use CakePHP prefix routes.
*
* The value of the define determines the names of the routes
* and their associated controller actions:
*
* Set to an array of prefixes you want to use in your application. Use for
* admin or other prefixed routes.
*
* Routing.prefixes = array('admin', 'manager');
*
* Enables:
* `admin_index()` and `/admin/controller/index`
* `manager_index()` and `/manager/controller/index`
*
* [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead]
*/
Configure::write('Routing.prefixes', array('admin'));
/**
* Turn off all caching application-wide.
*
*/
//Configure::write('Cache.disable', true);
/**
* Enable cache checking.
*
* If set to true, for view caching you must still use the controller
* var $cacheAction inside your controllers to define caching settings.
* You can either set it controller-wide by setting var $cacheAction = true,
* or in each action using $this->cacheAction = true.
*
*/
//Configure::write('Cache.check', true);
/**
* Defines the default error type when using the log() function. Used for
* differentiating error logging and debugging. Currently PHP supports LOG_DEBUG.
*/
define('LOG_ERROR', 2);
/**
* The preferred session handling method. Valid values:
*
* 'php' Uses settings defined in your php.ini.
* 'cake' Saves session files in CakePHP's /tmp directory.
* 'database' Uses CakePHP's database sessions.
*
* To define a custom session handler, save it at /app/config/<name>.php.
* Set the value of 'Session.save' to <name> to utilize it in CakePHP.
*
* To use database sessions, run the app/config/schema/sessions.php schema using
* the cake shell command: cake schema create Sessions
*
*/
Configure::write('Session.save', 'php');
/**
* The model name to be used for the session model.
*
* 'Session.save' must be set to 'database' in order to utilize this constant.
*
* The model name set here should *not* be used elsewhere in your application.
*/
//Configure::write('Session.model', 'Session');
/**
* The name of the table used to store CakePHP database sessions.
*
* 'Session.save' must be set to 'database' in order to utilize this constant.
*
* The table name set here should *not* include any table prefix defined elsewhere.
*
* Please note that if you set a value for Session.model (above), any value set for
* Session.table will be ignored.
*
* [Note: Session.table is deprecated as of CakePHP 1.3]
*/
//Configure::write('Session.table', 'cake_sessions');
/**
* The DATABASE_CONFIG::$var to use for database session handling.
*
* 'Session.save' must be set to 'database' in order to utilize this constant.
*/
//Configure::write('Session.database', 'default');
/**
* The name of CakePHP's session cookie.
*
* Note the guidelines for Session names states: "The session name references
* the session id in cookies and URLs. It should contain only alphanumeric
* characters."
* @link http://php.net/session_name
*/
Configure::write('Session.cookie', 'CAKEPHP');
/**
* Session time out time (in seconds).
* Actual value depends on 'Security.level' setting.
*/
Configure::write('Session.timeout', '120');
/**
* If set to false, sessions are not automatically started.
*/
Configure::write('Session.start', true);
/**
* When set to false, HTTP_USER_AGENT will not be checked
* in the session. You might want to set the value to false, when dealing with
* older versions of IE, Chrome Frame or certain web-browsing devices and AJAX
*/
Configure::write('Session.checkAgent', true);
/**
* The level of CakePHP security. The session timeout time defined
* in 'Session.timeout' is multiplied according to the settings here.
* Valid values:
*
* 'high' Session timeout in 'Session.timeout' x 10
* 'medium' Session timeout in 'Session.timeout' x 100
* 'low' Session timeout in 'Session.timeout' x 300
*
* CakePHP session IDs are also regenerated between requests if
* 'Security.level' is set to 'high'.
*/
Configure::write('Security.level', 'medium');
/**
* A random string used in security hashing methods.
*/
Configure::write('Security.salt', '3928c5uM398u4R39m4u8c3m493U49');
/**
* A random numeric string (digits only) used to encrypt/decrypt strings.
*/
Configure::write('Security.cipherSeed', '849713027853098175087095830289');
/**
* Apply timestamps with the last modified time to static assets (js, css, images).
* Will append a querystring parameter containing the time the file was modified. This is
* useful for invalidating browser caches.
*
* Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable
* timestamping.
*/
//Configure::write('Asset.timestamp', true);
/**
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
* This requires a/var/cache directory to be writable by the web server for caching.
* and /vendors/csspp/csspp.php
*
* To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css().
*/
//Configure::write('Asset.filter.css', 'css.php');
/**
* Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the
* output, and setting the config below to the name of the script.
*
* To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link().
*/
//Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
/**
* The classname and database used in CakePHP's
* access control lists.
*/
Configure::write('Acl.classname', 'DbAcl');
Configure::write('Acl.database', 'default');
/**
* If you are on PHP 5.3 uncomment this line and correct your server timezone
* to fix the date & time related errors.
*/
//date_default_timezone_set('UTC');
/**
*
* Cache Engine Configuration
* Default settings provided below
*
* File storage engine.
*
* Cache::config('default', array(
* 'engine' => 'File', //[required]
* 'duration'=> 3600, //[optional]
* 'probability'=> 100, //[optional]
* 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
* 'prefix' => 'cake_', //[optional] prefix every cache file with this string
* 'lock' => false, //[optional] use file locking
* 'serialize' => true, [optional]
* ));
*
*
* APC (http://pecl.php.net/package/APC)
*
* Cache::config('default', array(
* 'engine' => 'Apc', //[required]
* 'duration'=> 3600, //[optional]
* 'probability'=> 100, //[optional]
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
* ));
*
* Xcache (http://xcache.lighttpd.net/)
*
* Cache::config('default', array(
* 'engine' => 'Xcache', //[required]
* 'duration'=> 3600, //[optional]
* 'probability'=> 100, //[optional]
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
* 'user' => 'user', //user from xcache.admin.user settings
* 'password' => 'password', //plaintext password (xcache.admin.pass)
* ));
*
*
* Memcache (http://www.danga.com/memcached/)
*
* Cache::config('default', array(
* 'engine' => 'Memcache', //[required]
* 'duration'=> 3600, //[optional]
* 'probability'=> 100, //[optional]
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
* 'servers' => array(
* '127.0.0.1:11211' // localhost, default port 11211
* ), //[optional]
* 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
* 'persistent' => true, // [optional] set this to false for non-persistent connections
* ));
*
*/
Cache::config('default', array('engine' => 'File'));

View file

@ -0,0 +1,21 @@
<?php
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysqli',
'persistent' => false,
'host' => 'localhost',
'login' => 'webtt',
'password' => 'webtt77',
'database' => 'webtt2',
'encoding' => 'utf8'
);
var $raw_files = array(
'datasource' => 'RawFilesSource',
'path' => '/path/to/translation',
'extension' => '(uxt|txt)',
'readonly' => true,
'recursive' => true,
);
}
?>

View file

@ -0,0 +1,95 @@
<?php
/**
* This is core configuration file.
*
* Use it to configure core behaviour ofCake.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* In this file you set up your database connection details.
*
* @package cake
* @subpackage cake.config
*/
/**
* Database configuration class.
* You can specify multiple configurations for production, development and testing.
*
* driver => The name of a supported driver; valid options are as follows:
* mysql - MySQL 4 & 5,
* mysqli - MySQL 4 & 5 Improved Interface (PHP5 only),
* sqlite - SQLite (PHP5 only),
* postgres - PostgreSQL 7 and higher,
* mssql - Microsoft SQL Server 2000 and higher,
* db2 - IBM DB2, Cloudscape, and Apache Derby (http://php.net/ibm-db2)
* oracle - Oracle 8 and higher
* firebird - Firebird/Interbase
* sybase - Sybase ASE
* adodb-[drivername] - ADOdb interface wrapper (see below),
* odbc - ODBC DBO driver
*
* You can add custom database drivers (or override existing drivers) by adding the
* appropriate file to app/models/datasources/dbo. Drivers should be named 'dbo_x.php',
* where 'x' is the name of the database.
*
* persistent => true / false
* Determines whether or not the database should use a persistent connection
*
* connect =>
* ADOdb set the connect to one of these
* (http://phplens.com/adodb/supported.databases.html) and
* append it '|p' for persistent connection. (mssql|p for example, or just mssql for not persistent)
* For all other databases, this setting is deprecated.
*
* host =>
* the host you connect to the database. To add a socket or port number, use 'port' => #
*
* prefix =>
* Uses the given prefix for all the tables in this database. This setting can be overridden
* on a per-table basis with the Model::$tablePrefix property.
*
* schema =>
* For Postgres and DB2, specifies which schema you would like to use the tables in. Postgres defaults to
* 'public', DB2 defaults to empty.
*
* encoding =>
* For MySQL, MySQLi, Postgres and DB2, specifies the character encoding to use when connecting to the
* database. Uses database default.
*
*/
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'database_name',
'prefix' => '',
);
var $test = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'test_database_name',
'prefix' => '',
);
}

View file

@ -0,0 +1,39 @@
<?php
/**
* Routes configuration
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different urls to chosen controllers and their actions (functions).
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/views/pages/home.ctp)...
*/
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
* ...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'));

View file

@ -0,0 +1,73 @@
<?php
/*DbAcl schema generated on: 2007-11-24 15:11:13 : 1195945453*/
/**
* This is Acl Schema file
*
* Use it to configure database for ACL
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/*
*
* Using the Schema command line utility
* cake schema run create DbAcl
*
*/
class DbAclSchema extends CakeSchema {
var $name = 'DbAcl';
function before($event = array()) {
return true;
}
function after($event = array()) {
}
var $acos = array(
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'model' => array('type'=>'string', 'null' => true),
'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'alias' => array('type'=>'string', 'null' => true),
'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
var $aros = array(
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'model' => array('type'=>'string', 'null' => true),
'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'alias' => array('type'=>'string', 'null' => true),
'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
var $aros_acos = array(
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'aro_id' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
'aco_id' => array('type'=>'integer', 'null' => false, 'length' => 10),
'_create' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
'_read' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
'_update' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
'_delete' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1))
);
}

View file

@ -0,0 +1,50 @@
<?php
/*i18n schema generated on: 2007-11-25 07:11:25 : 1196004805*/
/**
* This is i18n Schema file
*
* Use it to configure database for i18n
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/*
*
* Using the Schema command line utility
* cake schema run create i18n
*
*/
class i18nSchema extends CakeSchema {
var $name = 'i18n';
function before($event = array()) {
return true;
}
function after($event = array()) {
}
var $i18n = array(
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'),
'model' => array('type'=>'string', 'null' => false, 'key' => 'index'),
'foreign_key' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
'field' => array('type'=>'string', 'null' => false, 'key' => 'index'),
'content' => array('type'=>'text', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
);
}

View file

@ -0,0 +1,47 @@
<?php
/*Sessions schema generated on: 2007-11-25 07:11:54 : 1196004714*/
/**
* This is Sessions Schema file
*
* Use it to configure database for Sessions
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/*
*
* Using the Schema command line utility
* cake schema run create Sessions
*
*/
class SessionsSchema extends CakeSchema {
var $name = 'Sessions';
function before($event = array()) {
return true;
}
function after($event = array()) {
}
var $cake_sessions = array(
'id' => array('type'=>'string', 'null' => false, 'key' => 'primary'),
'data' => array('type'=>'text', 'null' => true, 'default' => NULL),
'expires' => array('type'=>'integer', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
}

View file

@ -0,0 +1,75 @@
<?php
/**
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* This is a placeholder class.
* Create the same file in app/app_controller.php
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package cake
* @subpackage cake.cake.libs.controller
* @link http://book.cakephp.org/view/957/The-App-Controller
*/
class AppController extends Controller {
var $components = array('DebugKit.Toolbar' => array(
// 'panels' => array('variables'=>false)
), 'Session', 'PathResolver', 'Auth');
var $layout = "new";
function beforeFilter() {
parent::beforeFilter();
$this->Auth->autoRedirect = false;
$this->Auth->authorize = 'controller';
$this->Auth->userScope = array('User.activated' => true, 'User.confirm_hash' => null);
$this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
if ($this->Auth->user('role') == "admin")
$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;
}
}

View file

@ -0,0 +1,164 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class CommentsController extends AppController {
var $name = 'Comments';
function index() {
$this->Comment->recursive = 0;
$this->set('comments', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid comment', true));
$this->redirect(array('action' => 'index'));
}
$this->set('comment', $this->Comment->read(null, $id));
}
function add() {
if (!empty($this->data)) {
$this->Comment->create();
if ($this->Comment->save($this->data)) {
$this->Session->setFlash(__('The comment has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The comment could not be saved. Please, try again.', true));
}
}
if (empty($this->passedArgs['identifier_id']))
{
$this->Session->setFlash(__('You need to choose identifier to comment', true));
$this->redirect(array('controller' => 'identifiers', 'action' => 'index'));
}
else
{
$identifier_id = $this->passedArgs['identifier_id'];
$this->set('identifier', $identifier = $this->Comment->Identifier->read(null, $identifier_id));
// $this->data['Translation.identifier_id'] = $identifier_id;
}
// $translations = $this->Comment->Translation->find('list');
$identifiers = $this->Comment->Identifier->find('list');
$users = $this->Comment->User->find('list');
$this->set(compact('translations', 'identifiers', 'users'));
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid comment', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Comment->save($this->data)) {
$this->Session->setFlash(__('The comment has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The comment could not be saved. Please, try again.', true));
}
}
$this->set('comment', $comment_data = $this->Comment->read(null, $id));
if (empty($this->data)) {
$this->data = $comment_data;
}
$translations = $this->Comment->Translation->find('list');
$identifiers = $this->Comment->Identifier->find('list');
$users = $this->Comment->User->find('list');
$this->set(compact('translations', 'identifiers', 'users'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for comment', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Comment->delete($id)) {
$this->Session->setFlash(__('Comment deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Comment was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
$this->Comment->recursive = 0;
$this->set('comments', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid comment', true));
$this->redirect(array('action' => 'index'));
}
$this->set('comment', $this->Comment->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->Comment->create();
if ($this->Comment->save($this->data)) {
$this->Session->setFlash(__('The comment has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The comment could not be saved. Please, try again.', true));
}
}
$translations = $this->Comment->Translation->find('list');
$identifiers = $this->Comment->Identifier->find('list');
$users = $this->Comment->User->find('list');
$this->set(compact('translations', 'identifiers', 'users'));
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid comment', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Comment->save($this->data)) {
$this->Session->setFlash(__('The comment has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The comment could not be saved. Please, try again.', true));
}
}
$this->set('comment', $comment_data = $this->Comment->read(null, $id));
if (empty($this->data)) {
$this->data = $comment_data;
}
$translations = $this->Comment->Translation->find('list');
$identifiers = $this->Comment->Identifier->find('list');
$users = $this->Comment->User->find('list');
$this->set(compact('translations', 'identifiers', 'users'));
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for comment', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Comment->delete($id)) {
$this->Session->setFlash(__('Comment deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Comment was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,80 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class PathResolverComponent extends Object {
function getAssociationsTree($model)
{
$names = array();
foreach ($model->belongsTo as $childModel => $junk)
{
if ($model->alias != $model->{$childModel}->alias)
$names[] = $this->getAssociationsTree($model->{$childModel});
}
return array($model->alias => $names);
}
function t($i)
{
return str_repeat("\t",$i);
}
function findModelPath($name, $assocTree, $path = null)
{
foreach ($assocTree as $model => $childs)
{
if (!isset($path))
$path = array($model => "");
foreach ($childs as $childModelArray)
{
foreach ($childModelArray as $childModel => $newAssocTree)
{
$newPath[$childModel] = $path;
if ($name == $childModel)
{
return $newPath;
}
else
{
if ($ret = $this->findModelPath($name, array($childModel => $newAssocTree), $newPath))
return $ret;
}
}
}
}
}
function beforeRender($controller)
{
if (!isset($controller->{$controller->modelClass}))
return 0;
$model = $controller->{$controller->modelClass};
if (!isset($model->belongsTo))
return 0;
$assocTree = $this->getAssociationsTree($model);
$rootModel = 'Language';
$path = $this->findModelPath($rootModel, $assocTree);
if (!$path && $model->alias == $rootModel)
$path = array($rootModel => array());
$controller->set('assocPath', $path);
}
}
?>

View file

@ -0,0 +1,95 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class FileIdentifiersController extends AppController {
var $name = 'FileIdentifiers';
function index() {
$this->FileIdentifier->recursive = 0;
$this->set('fileIdentifiers', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid file identifier', true));
$this->redirect(array('action' => 'index'));
}
$this->set('fileIdentifier', $this->FileIdentifier->read(null, $id));
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid file identifier', true));
$this->redirect(array('action' => 'index'));
}
$this->set('fileIdentifier', $this->FileIdentifier->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->FileIdentifier->create();
if ($this->FileIdentifier->save($this->data)) {
$this->Session->setFlash(__('The file identifier has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
}
}
$importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
$this->set(compact('importedTranslationFiles', 'identifiers'));
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid file identifier', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->FileIdentifier->save($this->data)) {
$this->Session->setFlash(__('The file identifier has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
}
}
$this->set('fileIdentifier', $fileIdentifier_data = $this->FileIdentifier->read(null, $id));
if (empty($this->data)) {
$this->data = $fileIdentifier_data;
}
$importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
$this->set(compact('importedTranslationFiles', 'identifiers'));
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for file identifier', true));
$this->redirect(array('action'=>'index'));
}
if ($this->FileIdentifier->delete($id)) {
$this->Session->setFlash(__('File identifier deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('File identifier was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,98 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class IdentifierColumnsController extends AppController {
var $name = 'IdentifierColumns';
function index() {
$this->IdentifierColumn->recursive = 0;
$this->set('identifierColumns', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid identifier column', true));
$this->redirect(array('action' => 'index'));
}
$this->set('identifierColumn', $this->IdentifierColumn->read(null, $id));
}
function admin_index() {
$this->IdentifierColumn->recursive = 0;
$this->set('identifierColumns', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid identifier column', true));
$this->redirect(array('action' => 'index'));
}
$this->set('identifierColumn', $this->IdentifierColumn->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->IdentifierColumn->create();
if ($this->IdentifierColumn->save($this->data)) {
$this->Session->setFlash(__('The identifier column has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The identifier column could not be saved. Please, try again.', true));
}
}
$identifiers = $this->IdentifierColumn->Identifier->find('list');
$this->set(compact('identifiers'));
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid identifier column', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->IdentifierColumn->save($this->data)) {
$this->Session->setFlash(__('The identifier column has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The identifier column could not be saved. Please, try again.', true));
}
}
$this->set('identifierColumn', $identifierColumn_data = $this->IdentifierColumn->read(null, $id));
if (empty($this->data)) {
$this->data = $identifierColumn_data;
}
$identifiers = $this->IdentifierColumn->Identifier->find('list');
$this->set(compact('identifiers'));
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for identifier column', true));
$this->redirect(array('action'=>'index'));
}
if ($this->IdentifierColumn->delete($id)) {
$this->Session->setFlash(__('Identifier column deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Identifier column was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,130 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class IdentifiersController extends AppController {
var $name = 'Identifiers';
function index() {
$this->Identifier->recursive = 0;
$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) {
if (!$id) {
$this->Session->setFlash(__('Invalid identifier', true));
$this->redirect(array('action' => 'index'));
}
$this->set('identifier', $identifier = $this->Identifier->read(null, $id));
if ($identifier)
$this->set('identifierNeighbours', $this->Identifier->getNeighbours($id));
}
function admin_index() {
$this->Identifier->recursive = 0;
$this->set('identifiers', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid identifier', true));
$this->redirect(array('action' => 'index'));
}
$this->set('identifier', $identifier = $this->Identifier->read(null, $id));
if ($identifier)
$this->set('identifierNeighbours', $this->Identifier->getNeighbours($id));
}
function admin_add() {
if (!empty($this->data)) {
$this->Identifier->create();
if ($this->Identifier->save($this->data)) {
$this->Session->setFlash(__('The identifier has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The identifier could not be saved. Please, try again.', true));
}
}
$languages = $this->Identifier->Language->find('list');
$this->set(compact('languages'));
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid identifier', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Identifier->save($this->data)) {
$this->Session->setFlash(__('The identifier has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The identifier could not be saved. Please, try again.', true));
}
}
$this->set('identifier', $identifier_data = $this->Identifier->read(null, $id));
if (empty($this->data)) {
$this->data = $identifier_data;
}
$languages = $this->Identifier->Language->find('list');
$this->set(compact('languages'));
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for identifier', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Identifier->delete($id)) {
$this->Session->setFlash(__('Identifier deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Identifier was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,97 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class ImportedTranslationFilesController extends AppController {
var $name = 'ImportedTranslationFiles';
function index() {
$this->ImportedTranslationFile->recursive = 0;
$this->set('importedTranslationFiles', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid translation file', true));
$this->redirect(array('action' => 'index'));
}
$this->set('importedTranslationFile', $this->ImportedTranslationFile->read(null, $id));
}
function admin_index() {
$this->ImportedTranslationFile->recursive = 0;
$this->set('importedTranslationFiles', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid translation file', true));
$this->redirect(array('action' => 'index'));
}
$this->set('importedTranslationFile', $this->ImportedTranslationFile->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->ImportedTranslationFile->create();
if ($this->ImportedTranslationFile->save($this->data)) {
$this->Session->setFlash(__('The translation file has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
}
}
$languages = $this->ImportedTranslationFile->Language->find('list');
$this->set(compact('languages'));
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid translation file', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->ImportedTranslationFile->save($this->data)) {
$this->Session->setFlash(__('The translation file has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
}
}
$this->set('importedTranslationFile', $importedTranslationFile_data = $this->ImportedTranslationFile->read(null, $id));
if (empty($this->data)) {
$this->data = $importedTranslationFile_data;
}
$languages = $this->ImportedTranslationFile->Language->find('list');
$this->set(compact('languages'));
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for translation file', true));
$this->redirect(array('action'=>'index'));
}
if ($this->ImportedTranslationFile->delete($id)) {
$this->Session->setFlash(__('Translation file deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Translation file was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,96 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class LanguagesController extends AppController {
var $name = 'Languages';
var $layout="new";
function index() {
App::import("Vendor","functions_render");
$this->Language->recursive = 0;
$this->set('languages', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid language', true));
$this->redirect(array('action' => 'index'));
}
$this->set('language', $this->Language->read(null, $id));
}
function admin_index() {
$this->Language->recursive = 0;
$this->set('languages', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid language', true));
$this->redirect(array('action' => 'index'));
}
$this->set('language', $this->Language->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->Language->create();
if ($this->Language->save($this->data)) {
$this->Session->setFlash(__('The language has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
}
}
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid language', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Language->save($this->data)) {
$this->Session->setFlash(__('The language has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
}
}
$this->set('language', $language_data = $this->Language->read(null, $id));
if (empty($this->data)) {
$this->data = $language_data;
}
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for language', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Language->delete($id)) {
$this->Session->setFlash(__('Language deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Language was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,125 @@
<?php
class LanguagesController extends AppController {
var $name = 'Languages';
function index() {
$this->Language->recursive = 0;
$this->set('languages', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid language', true));
$this->redirect(array('action' => 'index'));
}
$this->set('language', $this->Language->read(null, $id));
/* $options = array('Language.id' => $id, 'recursive' => 1,
"joins" => array(
array('table' => '
),
);
var_dump($this);
$this->set('language', $bumz = $this->Language->find('first', $options));
var_dump($bumz);*/
// $this->set('identifier', $this->Language->TranslationFile->read(null, $id));
}
function add() {
if (!empty($this->data)) {
$this->Language->create();
if ($this->Language->save($this->data)) {
$this->Session->setFlash(__('The language has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
}
}
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid language', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Language->save($this->data)) {
$this->Session->setFlash(__('The language has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Language->read(null, $id);
}
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for language', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Language->delete($id)) {
$this->Session->setFlash(__('Language deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Language was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
$this->Language->recursive = 0;
$this->set('languages', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid language', true));
$this->redirect(array('action' => 'index'));
}
$this->set('language', $this->Language->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->Language->create();
if ($this->Language->save($this->data)) {
$this->Session->setFlash(__('The language has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
}
}
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid language', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Language->save($this->data)) {
$this->Session->setFlash(__('The language has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The language could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Language->read(null, $id);
}
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for language', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Language->delete($id)) {
$this->Session->setFlash(__('Language deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Language was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,119 @@
<?php
/**
* Static content controller.
*
* This file will render views from views/pages/
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Static content controller
*
* Override this controller by placing a copy in controllers directory of an application
*
* @package cake
* @subpackage cake.cake.libs.controller
* @link http://book.cakephp.org/view/958/The-Pages-Controller
*/
class PagesController extends AppController {
/**
* Controller name
*
* @var string
* @access public
*/
var $name = 'Pages';
/**
* Default helper
*
* @var array
* @access public
*/
var $helpers = array('Html', 'Session');
/**
* This controller does not use a model
*
* @var array
* @access public
*/
var $uses = array();
/**
* Displays a view
*
* @param mixed What page to display
* @access public
*/
function display() {
$path = func_get_args();
$count = count($path);
if (!$count) {
$this->redirect('/');
}
$page = $subpage = $title_for_layout = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title_for_layout = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title_for_layout'));
$this->render(implode('/', $path));
}
function admin_display() {
$path = func_get_args();
/* if (isset($this->params['admin']))
array_shift($path);*/
if (!isset($path[0]) || $path[0] != 'admin') {
//This adds admin to the beginning of the path so the pages controller will look in the 'admin' folder in pages directory
$path = array_merge((array)'admin', $path);
}
$count = count($path);
if (!$count) {
$this->redirect('/');
}
$page = $subpage = $title_for_layout = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title_for_layout = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title_for_layout'));
$this->render(implode('/', $path));
}
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow(array('display'));
}
}

View file

@ -0,0 +1,476 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class RawFilesController extends AppController {
var $name = 'RawFiles';
var $helpers = array('Paginator', 'Time', 'Session');
var $components = array('Session');
function admin_index() {
$this->RawFile->recursive = 1;
$conditions['RawFile.dir'] = array("diff","translated");
$this->set('rawFiles', $this->paginate($conditions));
}
function admin_listdir($extension = null) {
$this->RawFile->recursive = 0;
$this->set('rawFiles', $this->paginate(array("RawFile.extension" => $extension)));
$this->rendeR("admin_index");
}
function admin_view($dir = null, $filename = null) {
if (!$filename) {
$this->Session->setFlash(__('Invalid raw file', true));
$this->redirect(array('action' => 'index'));
}
if (!$this->RawFile->open($dir, $filename))
{
$this->Session->setFlash(__('Can\'t open file', true));
$this->redirect(array('action' => 'index'));
return 0;
}
$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 admin_import($dir = null, $filename = null) {
if (!$filename) {
$this->Session->setFlash(__('Invalid file', true));
$this->redirect(array('action' => 'index'));
return 0;
}
if (!$this->RawFile->open($dir, $filename))
{
$this->Session->setFlash(__('Can\'t open file', true));
$this->redirect(array('action' => 'index'));
return 0;
}
$importedTranslationFileModel = $this->RawFile->ImportedTranslationFile;
$translationFileModel = $importedTranslationFileModel->TranslationFile;
$languageModel = $translationFileModel->Language;
$identifierModel = $translationFileModel->Identifier;
$identifierColumnModel = $identifierModel->IdentifierColumn;
$translationModel = $identifierModel->Translation;
$fileIdentifierModel = $importedTranslationFileModel->FileIdentifier;
$importedTranslationFile = $importedTranslationFileModel->find('first', array('conditions' => array('ImportedTranslationFile.filename' => $dir . DS . $filename), "recursive" => -1));
if ($importedTranslationFile)
{
$this->Session->setFlash(__('Translation file already imported', true));
$this->redirect(array('action' => 'index'));
return 0;
}
$languageCode = $this->RawFile->getLanguageCode($filename);
if (!$languageCode)
{
$this->Session->setFlash(__('Can\'t identify language', true));
$this->redirect(array('action' => 'index'));
return 0;
}
$language = $languageModel->find('first', array('conditions' => array('code' => $languageCode), "recursive" => -1));
$language_id = $language['Language']['id'];
if (!$language_id)
{
$this->Session->setFlash(__('Can\'t find language in database', true));
$this->redirect(array('action' => 'index'));
return 0;
}
$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();
if (!$parsedFile)
{
$this->Session->setFlash(__('Error importing file', true));
$this->redirect(array('action' => 'index'));
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;
$importedTranslationFileModel->saveAll($data);
$importedTranslationFile_id = $importedTranslationFileModel->id;
foreach ($parsedFile as $ent)
{
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_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['columns']) && is_array($ent['columns']) && !isset($ent['string']))
{
foreach ($ent['columns'] as $column_no => $value)
{
$ent['string'] .= $value . "\t";
}
$ent['string'] = substr($ent['string'], 0, -1);
}
if (isset($ent['diff']))
{
$i_data['reference_string'] = $ent['string'];
}
unset($identifierModel->id);
$identifier = $identifierModel->find('first',array('conditions' => array('Identifier.identifier' => $ent['identifier'], 'Identifier.translation_file_id' => $translation_file_id), 'contain' => 'IdentifierColumn'));
if ($identifier)
{
$i_data['id']=$identifier['Identifier']['id'];
}
else
{
$identifierModel->create();
$i_data['identifier'] = $ent['identifier'];
if (isset($ent['diff']))
$i_data['translated'] = false;
$newIdentifier = true;
}
$res = $identifierModel->saveAll($tarr = array('Identifier' => $i_data));
$identifier_id = $identifierModel->id;
if (!isset($ent['diff'])) // it is translated file and we add translation
{
unset($translationModel->id);
unset($t_data);
$translationHash = $translationModel->makeHash($ent);
if ($newIdentifier) // ovbiously there's no translation for identifier we just created
$translation = array();
else
{
$this->log('new translation check');
$this->log($translationHash);
$translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_id' => $identifier_id, 'Translation.translation_text' => $ent["string"], 'Translation.translation_hash' => NULL), "recursive" => -1));
$this->log($translation);
if (!$translation)
{
$translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_id' => $identifier_id, 'Translation.translation_hash' => $translationHash), "recursive" => -1));
$this->log($translation);
}
$this->log('new translation check end');
}
if (!$translation)
{
$this->log('new translation');
$t_data['identifier_id'] = $identifier_id;
$t_data['translation_text'] = $ent['string'];
$t_data['user_id'] = $this->Auth->user('id');
$t_data['translation_hash'] = $translationHash;
$translationModel->save(array('Translation' => $t_data));
}
/* else
$t_data['id'] = $translation['Translation']['id'];*/
if ($translation)
$parentTranslation_id = $translation['Translation']['id'];
else
$parentTranslation_id = $translationModel->id;
}
if (isset($ent['columns']) && is_array($ent['columns']))
{
$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];
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;
$res = $identifierColumnModel->save($ic_arr);
$identifierColumn_id = $identifierColumnModel->id;
if (!isset($ent['diff'])) // it is translated file and we add translation
{
unset($translationModel->id);
unset($t_data);
if ($newIdentifier) // ovbiously there's no translation for identifier we just created
$translation = array();
else
$translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_column_id' => $identifierColumn_id, 'Translation.translation_text' => $value, 'Translation.parent_id' => $parentTranslation_id), "recursive" => -1));
if (!$translation)
{
$t_data['identifier_column_id'] = $identifierColumn_id;
$t_data['translation_text'] = $value;
$t_data['user_id'] = $this->Auth->user('id');
$t_data['parent_id'] = $parentTranslation_id;
$translationModel->save(array('Translation' => $t_data));
}
/* else
$t_data['id'] = $translation['Translation']['id'];*/
}
}
}
unset($fileIdentifierModel->id);
$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 (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'];
$fi_data['identifier_id'] = $identifier_id;
$res = $fileIdentifierModel->saveAll($tarr = array('FileIdentifier' => $fi_data));
$fileIdentifier_id = $fileIdentifierModel->id;
}
$processedEntities++;
}
if ($processedEntities == 0)
{
$importedTranslationFileModel->delete($importedTranslationFile_id);
$this->Session->setFlash(__('File was not imported because it seems empty', true));
$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));
return 0;
}
}
function admin_export($dir = null, $filename = null, $importedTranslationFileId = null) {
if (!$filename) {
$this->Session->setFlash(__('Invalid file', true));
$this->redirect($this->referer());
return 0;
}
if (!$this->RawFile->open($dir, $filename, $writable = true))
{
$this->Session->setFlash(__('Can\'t open file for writing', true));
$this->redirect($this->referer());
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
),
)
);
if (!$importedTranslationFile)
{
$this->Session->setFlash(__('No imported translation file found for chosen file', true));
$this->redirect($this->referer());
return 0;
}
$translationFileModel = $importedTranslationFileModel->TranslationFile;
$identifierModel = $translationFileModel->Identifier;
// 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'),
'identifier' => $fileIdentifier['Identifier']['identifier'],
'arguments' => ((isset($fileIdentifier['arguments']) && !empty($fileIdentifier['arguments'])) ? $fileIdentifier['arguments'] : null),
);
if (isset($fileIdentifier['Identifier']['Translation'][0]))
{
$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'][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;
}
ini_set('max_execution_time',0);
$result = $this->RawFile->buildFile($entities);
if (!$result)
{
$this->Session->setFlash(__('Error exporting file', true));
$this->redirect(array('action' => 'index'));
return 0;
}
}
}

View file

@ -0,0 +1,102 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class TranslationFilesController extends AppController {
var $name = 'TranslationFiles';
function index() {
$this->TranslationFile->recursive = 0;
$conditions = null;
if (isset($this->passedArgs['language_id']) && $language_id = $this->passedArgs['language_id'])
$conditions = array('TranslationFile.language_id' => $language_id);
$this->set('translationFiles', $this->paginate($conditions));
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid translation file', true));
$this->redirect(array('action' => 'index'));
}
$this->set('translationFile', $this->TranslationFile->read(null, $id));
}
function admin_index() {
$this->TranslationFile->recursive = 0;
$this->set('translationFiles', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid translation file', true));
$this->redirect(array('action' => 'index'));
}
$this->set('translationFile', $this->TranslationFile->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->TranslationFile->create();
if ($this->TranslationFile->save($this->data)) {
$this->Session->setFlash(__('The translation file has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
}
}
$languages = $this->TranslationFile->Language->find('list');
$this->set(compact('languages'));
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid translation file', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->TranslationFile->save($this->data)) {
$this->Session->setFlash(__('The translation file has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
}
}
$this->set('translationFile', $translationFile_data = $this->TranslationFile->read(null, $id));
if (empty($this->data)) {
$this->data = $translationFile_data;
}
$languages = $this->TranslationFile->Language->find('list');
$this->set(compact('languages'));
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for translation file', true));
$this->redirect(array('action'=>'index'));
}
if ($this->TranslationFile->delete($id)) {
$this->Session->setFlash(__('Translation file deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Translation file was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,212 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class TranslationsController extends AppController {
var $name = 'Translations';
function index() {
$this->Translation->recursive = 0;
$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) {
if (!$id) {
$this->Session->setFlash(__('Invalid translation', true));
$this->redirect(array('action' => 'index'));
}
$this->set('translation', $translation = $this->Translation->read(null, $id));
if (isset($translation['Translation']['identifier_id']))
{
$this->set('identifier', $identifier = $this->Translation->Identifier->read(null, $translation['Translation']['identifier_id']));
$this->set('columnTranslations', $columnTranslations = $this->Translation->find('all', array('conditions' => array('Translation.parent_id' => $translation['Translation']['id']), 'order' => 'Translation.id')));
}
if ($identifier_id = $translation['Translation']['identifier_id'])
$this->set('identifierNeighbours', $this->Translation->Identifier->getNeighbours($identifier_id));
}
function add() {
if (!empty($this->data)) {
$this->Translation->create();
if ($this->data['ChildTranslation'])
{
unset($translationText);
foreach ($this->data['ChildTranslation'] as $num => $childTranslation)
{
$ent['columns'][] = $childTranslation['translation_text'];
$translationText .= $childTranslation['translation_text'] . "\t";
}
$this->data['Translation']['translation_text'] = substr($translationText, 0, -1);
}
else
$ent['string'] = $this->data['Translation']['translation_text'];
sort($ent['columns']);
$this->data['Translation']['translation_hash'] = $this->Translation->makeHash($ent);
$this->data['Identifier']['id'] = $this->data['Translation']['identifier_id'];
$this->data['Identifier']['translated'] = 1;
$res = $this->Translation->saveAll($this->data);
$this->log($this->data);
if ($res) {
$this->Session->setFlash(__('The translation has been saved', true));
if ($this->params['form']['Next'])
{
$identifier_id = $this->data['Translation']['identifier_id'];
$identifier = $this->Translation->Identifier->read(null, $identifier_id);
$identifierNeighbors = $this->Translation->Identifier->find('neighbors', array('field' => 'id', 'value' => $identifier_id, 'conditions' => array('translation_file_id' => $identifier['Identifier']['translation_file_id'])));
if ($nextIdentifier = $identifierNeighbors['next'])
$this->redirect(array('action' => 'add', 'identifier_id' => $nextIdentifier['Identifier']['id']));
else
$this->redirect(array('controller' => 'identifiers', 'action' => 'index', 'translation_file_id' => $identifier['Identifier']['translation_file_id']));
}
else
$this->redirect(array('controller' => 'identifiers', 'action' => 'view', $this->data['Translation']['identifier_id']));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
}
if (empty($this->passedArgs['identifier_id']))
{
$this->Session->setFlash(__('You need to choose identifier for translation', true));
$this->redirect($this->referer());
}
else
{
$identifier_id = $this->passedArgs['identifier_id'];
$this->set('identifier', $identifier = $this->Translation->Identifier->read(null, $identifier_id));
$this->set('identifierNeighbours', $this->Translation->Identifier->getNeighbours($identifier_id));
$this->set('identifierColumns', $identifierColumns = $this->Translation->IdentifierColumn->find('list', array('conditions' => array('identifier_id' => $identifier_id), 'order' => 'IdentifierColumn.id')));
if ($identifierColumns)
$this->set('identifierColumnsDetails', Set::combine($this->Translation->IdentifierColumn->find('all', array('conditions' => array('identifier_id' => $identifier_id), 'order' => 'IdentifierColumn.id')), '{n}.IdentifierColumn.id', '{n}.IdentifierColumn'));
}
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users'));
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid translation', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->data['ChildTranslation'])
{
unset($translationText);
foreach ($this->data['ChildTranslation'] as $num => $childTranslation)
{
$ent['columns'][] = $childTranslation['translation_text'];
$translationText .= $childTranslation['translation_text'] . "\t";
}
$this->data['Translation']['translation_text'] = substr($translationText, 0, -1);
}
else
$ent['string'] = $this->data['Translation']['translation_text'];
$this->data['Translation']['translation_hash'] = $this->Translation->makeHash($ent);
$this->data['Identifier']['id'] = $this->data['Translation']['identifier_id'];
$this->data['Identifier']['translated'] = 1;
if ($this->Translation->saveAll($this->data)) {
$this->Session->setFlash(__('The translation has been saved', true));
$this->redirect(array('controller' => 'identifiers', 'action' => 'view', $this->data['Translation']['identifier_id']));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
}
$this->set('translation', $translation_data = $this->Translation->read(null, $id));
if (empty($this->data)) {
$this->data = $translation_data;
}
$identifier_id= $translation_data['Translation']['identifier_id'];
$this->set('identifierNeighbours', $this->Translation->Identifier->getNeighbours($identifier_id));
$this->set('identifierColumns', $identifierColumns = $this->Translation->IdentifierColumn->find('list', array('conditions' => array('identifier_id' => $identifier_id), 'order' => 'IdentifierColumn.id')));
if ($identifierColumns)
{
$contain = array('Translation' => array(
'conditions' => array('Translation.parent_id' => $translation_data['Translation']['id']),
));
$identifierColumnsAll = $this->Translation->IdentifierColumn->find('all', array('conditions' => array('identifier_id' => $identifier_id), 'order' => 'IdentifierColumn.id', 'contain' => $contain));
foreach ($translation_data['ChildTranslation'] as $childTranslationKey => $childTranslation)
{
$mapChildTranslationsColumns[$childTranslation['identifier_column_id']] = $childTranslationKey;
}
$this->set(compact('mapChildTranslationsColumns'));
$this->set('identifierColumnsDetails', Set::combine($identifierColumnsAll, '{n}.IdentifierColumn.id', '{n}.IdentifierColumn'));
$this->set('identifierColumnTranslations', Set::combine($translation_data['ChildTranslation'], '{n}.identifier_column_id'));//, '{n}.identifier_column_id'));
}
$identifier = $this->Translation->Identifier->read(null, $this->data['Translation']['identifier_id']);
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users', 'identifier'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for translation', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Translation->delete($id)) {
$this->Session->setFlash(__('Translation deleted', true));
$this->redirect($this->referer());
}
$this->Session->setFlash(__('Translation was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
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());
}
function admin_view($id = null) {
return $this->view($id);
}
function admin_add() {
return $this->add();
}
function admin_edit($id = null) {
return $this->edit($id);
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for translation', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Translation->delete($id)) {
$this->Session->setFlash(__('Translation deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Translation was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,171 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class UsersController extends AppController {
var $name = 'Users';
var $components = array('Email');
function index() {
$this->User->recursive = 0;
$this->set('users', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid user', true));
$this->redirect(array('action' => 'index'));
}
$this->set('user', $this->User->read(null, $id));
}
function admin_index() {
$this->User->recursive = 0;
$this->set('users', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid user', true));
$this->redirect(array('action' => 'index'));
}
$this->set('user', $this->User->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->User->create();
if ($this->User->save($this->data)) {
$this->Session->setFlash(__('The user has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
}
}
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid user', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->Session->setFlash(__('The user has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
}
}
$this->set('user', $user_data = $this->User->read(null, $id));
if (empty($this->data)) {
$this->data = $user_data;
}
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for user', true));
$this->redirect(array('action'=>'index'));
}
if ($this->User->delete($id)) {
$this->Session->setFlash(__('User deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('User was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function login() {
if (!empty($this->data))
{
$user = $this->User->find('first', array('conditions' => array('User.username' => $this->data['User']['username'])));
$this->log($user);
if ($user['User']['confirm_hash'])
{
$this->Session->delete('Message.auth');
$this->Session->setFlash('This account is not yet confirmed. Please use confirmation link from email to finalize registration.');
$this->redirect($this->referer());
}
if (!$user['User']['activated'])
{
$this->Session->delete('Message.auth');
$this->Session->setFlash('This account is not yet activated. Please wait until administrator activates your account.');
$this->redirect($this->referer());
}
}
if (!(empty($this->data)) && $this->Auth->user())
{
$this->log('a');
$this->User->id = $this->Auth->user('id');
$this->User->saveField('last_login', date('Y-m-d H:i:s'));
$this->redirect($this->Auth->redirect());
}
$this->log('b');
}
function logout() {
$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();
$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->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';
unset($this->helpers['DebugKit.Toolbar']);
$this->Email->send();
$this->Session->setFlash('Thank you for registrating. Please use confirmation 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 registrating. You will be able to log in after your account is activated by administrator.');
$this->redirect('/');
}
}

View file

@ -0,0 +1,177 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class VotesController extends AppController {
var $name = 'Votes';
function index() {
$this->Vote->recursive = 0;
$conditions = null;
if (isset($this->passedArgs['translation_id']) && $translation_id = $this->passedArgs['translation_id'])
$conditions = array('Vote.translation_id' => $translation_id);
$this->set('votes', $this->paginate($conditions));
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid vote', true));
$this->redirect(array('action' => 'index'));
}
$this->set('vote', $this->Vote->read(null, $id));
}
function add() {
if (!empty($this->data)) {
$this->Vote->create();
if ($this->Vote->save($this->data)) {
$this->Session->setFlash(__('The vote has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The vote could not be saved. Please, try again.', true));
}
}
$translations = $this->Vote->Translation->find('list');
$users = $this->Vote->User->find('list');
$this->set(compact('translations', 'users'));
}
function vote() {
if (empty($this->passedArgs['translation_id']))
{
$this->Session->setFlash(__('You need to choose translation for your vote', true));
$this->redirect(array('controller' => 'translations', 'action' => 'index'));
}
else
{
$translation_id = $this->passedArgs['translation_id'];
$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,
'user_id' => $this->Auth->user('id'),
),
);
$this->Vote->create();
$this->Vote->save($vote);
$this->Session->setFlash(__('Vote added', true));
$this->redirect($this->referer());
}
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid vote', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Vote->save($this->data)) {
$this->Session->setFlash(__('The vote has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The vote could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Vote->read(null, $id);
}
$translations = $this->Vote->Translation->find('list');
$users = $this->Vote->User->find('list');
$this->set(compact('translations', 'users'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for vote', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Vote->delete($id)) {
$this->Session->setFlash(__('Vote deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Vote was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
$this->Vote->recursive = 0;
$this->set('votes', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid vote', true));
$this->redirect(array('action' => 'index'));
}
$this->set('vote', $this->Vote->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->Vote->create();
if ($this->Vote->save($this->data)) {
$this->Session->setFlash(__('The vote has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The vote could not be saved. Please, try again.', true));
}
}
$translations = $this->Vote->Translation->find('list');
$users = $this->Vote->User->find('list');
$this->set(compact('translations', 'users'));
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid vote', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Vote->save($this->data)) {
$this->Session->setFlash(__('The vote has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The vote could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Vote->read(null, $id);
}
$translations = $this->Vote->Translation->find('list');
$users = $this->Vote->User->find('list');
$this->set(compact('translations', 'users'));
}
function admin_delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for vote', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Vote->delete($id)) {
$this->Session->setFlash(__('Vote deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Vote was not deleted', true));
$this->redirect(array('action' => 'index'));
}
}

View file

@ -0,0 +1,18 @@
<?php
/**
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';

View file

@ -0,0 +1,40 @@
<?php
/**
* Application model for Cake.
*
* This file is application-wide model file. You can put all
* application-wide model-related methods here.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.model
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Application model for Cake.
*
* This is a placeholder class.
* Create the same file in app/app_model.php
* Add your application-wide methods to the class, your models will inherit them.
*
* @package cake
* @subpackage cake.cake.libs.model
*/
class AppModel extends Model {
// var $recursive = 0;
var $scaffoldForbiddenActions = null;
var $scaffoldActions = null;
var $scaffoldForbiddenFields = null;
}

View file

@ -0,0 +1,39 @@
<?php
/*
http://bakery.cakephp.org/articles/Jippi/2007/03/25/null-behavior
*/
class NullBehavior extends ModelBehavior {
var $settings = array();
/**
* Enter description here...
*
* @param AppModel $model
* @param unknown_type $config
*/
function setup(&$model, $config = array())
{
$this->settings[$model->name] = $config;
}
/**
* Enter description here...
*
* @param AppModel $model
*/
function beforeSave(&$model)
{
foreach ($this->settings[$model->name] as $field)
{
if(
true === array_key_exists($field,$model->data[$model->name]) &&
true === empty($model->data[$model->name][$field]) &&
0 === strlen($model->data[$model->name][$field]) )
{
$model->data[$model->name][$field] = null;
}
}
return true;
}
}
?>

View file

@ -0,0 +1,50 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class Comment extends AppModel {
var $name = 'Comment';
var $displayField = 'id';
var $scaffoldActions = array("add" => "fk");
var $belongsTo = array(
/* 'Translation' => array(
'className' => 'Translation',
'foreignKey' => 'translation_id',
'conditions' => '',
'fields' => '',
'order' => ''
),*/
'Identifier' => array(
'className' => 'Identifier',
'foreignKey' => 'identifier_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}

View file

@ -0,0 +1,275 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
if (!class_exists('Folder')) {
App::import('Core', 'Folder');
}
if (!class_exists('File')) {
App::import('Core', 'File');
}
/**
* CSVSource Datasource
*
* @package datasources
* @subpackage datasources.models.datasources
*/
class RawFilesSource extends DataSource {
/**
* Description
*
* @var string
*/
public $description = 'Directory Contents Data Source';
/**
* File Handle
*
* @var mixed
*/
public $handle = false;
/**
* Default configuration.
*
* @var array
*/
var $_baseConfig = array(
'datasource' => 'Datasources.RawFilesSource',
'path' => '.',
'extension' => 'txt',
'readonly' => true,
'recursive' => false);
var $_schema = array(
// 'files' => array(
'filename' => array(
'type' => 'string',
'null' => false,
'key' => 'primary',
'length' => 255
),
'size' => array(
'type' => 'string',
'null' => false,
'length' => 40,
),
'modified' => array(
'type' => 'string',
'null' => false,
'length' => 40,
),
// )
);
/**
* Constructor
*
* @param string $config Configuration array
* @param boolean $autoConnect Automatically connect to / open the file
*/
public function __construct($config = null, $autoConnect = true) {
$this->debug = Configure::read('debug') > 0;
$this->fullDebug = Configure::read('debug') > 1;
parent::__construct($config);
if ($autoConnect) {
$this->connect();
}
}
/**
* Connects to the directory using options in the given configuration array.
*
* @return boolean True if the file could be opened.
*/
public function connect() {
$this->connected = false;
if ($this->config['readonly']) {
$create = false;
$mode = 0;
} else {
$create = true;
$mode = 0777;
}
$this->connection =& new Folder($this->config['path'], $create, $mode);
if ($this->connection) {
$this->handle = array();
$this->connected = true;
}
return $this->connected;
}
/**
* List available sources
*
* @return array of available files
*/
public function listSources() {
return array('raw_files');
}
/**
* Returns a Model description (metadata).
*
* @return mixed
*/
public function describe($model) {
return $this->_schema;
}
/**
* Close file handle
*
* @return null
*/
public function close() {
if ($this->connected) {
if ($this->handle) {
foreach($this->handle as $h) {
@fclose($h);
}
$this->handle = false;
}
$this->connected = false;
}
}
/**
* 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 (isset($queryData["conditions"][$model->alias . ".extension"]))
$extension = preg_quote($queryData["conditions"][$model->alias . ".extension"]);
else
$extension = $this->config['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($searchPattern, true);
/* $this->log($list);
echo "list#\n";
var_dump($list);*/
foreach($list as &$item) {
$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($searchPattern, true);
foreach($list as &$item) {
$temp = $item;
$item = array();
$item["full"] = $this->config['path'] . DS .$temp;
$item["short"] = $temp;
}
unset($item);
}
$resultSet = array();
foreach ($list as $item) {
/* 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["short"],
'size' => $file->size(),
'modified' => $file->lastChange(),
),
);
}
if ($model->findQueryType === 'count') {
return array(array(array('count' => count($resultSet))));
}
return $resultSet;
}
/**
* Calculate
*
* @param Model $model
* @param mixed $func
* @param array $params
* @return array with the field name with records count
*/
public function calculate(&$model, $func, $params = array()) {
return array('count');
}
}

View file

@ -0,0 +1,44 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
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");
var $belongsTo = array(
'ImportedTranslationFile' => array(
'className' => 'ImportedTranslationFile',
'foreignKey' => 'imported_translation_file_id',
'conditions' => '',
'fields' => '',
// 'order' => ''
),
'Identifier' => array(
'className' => 'Identifier',
'foreignKey' => 'identifier_id',
'conditions' => '',
'fields' => '',
// 'order' => ''
)
);
}

View file

@ -0,0 +1,144 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class Identifier extends AppModel {
var $name = 'Identifier';
var $displayField = 'identifier';
var $actsAs = array('Containable');
var $validate = array(
'identifier' => array(
'A_Za_z0_9' => array(
'rule' => '/[A-Za-z0-9_@]+/',
'message' => 'Identifier must consist only of the following caracteres: "A-Z", "a-z", "0-9", "@" and "_"',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
);
var $scaffoldForbiddenActions = array("add", "admin_add", "edit", "admin_edit", "delete", "admin_delete");
var $belongsTo = array(
'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' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'FileIdentifier' => array(
'className' => 'FileIdentifier',
'foreignKey' => 'identifier_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'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;
}
function getNeighbours($id)
{
$identifierNeighbours['current'][] = $this->read(null, $id);
if ($identifierNeighbours['current'])
{
$identifierNeighbours['prev'] = $this->find('all', array('order' => 'Identifier.id DESC', 'limit' => 5, 'conditions' => array('Identifier.translation_file_id' => $identifierNeighbours['current'][0]['Identifier']['translation_file_id'], 'Identifier.id <' => $identifierNeighbours['current'][0]['Identifier']['id'])));
$identifierNeighbours['next'] = $this->find('all', array('order' => 'Identifier.id ASC', 'limit' => 5, 'conditions' => array('Identifier.translation_file_id' => $identifierNeighbours['current'][0]['Identifier']['translation_file_id'], 'Identifier.id >' => $identifierNeighbours['current'][0]['Identifier']['id'])));
}
return $identifierNeighbours;
}
}

View file

@ -0,0 +1,53 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class IdentifierColumn extends AppModel {
var $name = 'IdentifierColumn';
var $displayField = 'column_name';
var $actsAs = array('Containable');
var $scaffoldForbiddenActions = array("add", "admin_add", "edit", "admin_edit", "delete", "admin_delete");
var $belongsTo = array(
'Identifier' => array(
'className' => 'Identifier',
'foreignKey' => 'identifier_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
var $hasMany = array(
'Translation' => array(
'className' => 'Translation',
'foreignKey' => 'identifier_column_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
);
}

View file

@ -0,0 +1,66 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class ImportedTranslationFile extends AppModel {
var $name = 'ImportedTranslationFile';
var $displayField = 'filename';
var $scaffoldForbiddenActions = array("index", "add", "admin_add", "edit", "admin_edit", "delete", "admin_delete");
var $actsAs = array('Containable');
var $belongsTo = array(
'TranslationFile' => array(
'className' => 'TranslationFile',
'foreignKey' => 'translation_file_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
);
var $hasMany = array(
'FileIdentifier' => array(
'className' => 'FileIdentifier',
'foreignKey' => 'imported_translation_file_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => 'FileIdentifier.id',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
var $hasOne = array(
'RawFile' => array(
'className' => 'RawFile',
'foreignKey' => 'filename',
'dependand' => false,
'conditions' => '',
'fields' => '',
'order' => '',
),
);
}

View file

@ -0,0 +1,42 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class Language extends AppModel {
var $name = 'Language';
var $displayField = 'name';
var $scaffoldForbiddenActions = array("add", "edit", "delete");
var $hasMany = array(
'TranslationFile' => array(
'className' => 'TranslationFile',
'foreignKey' => 'language_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
);
}

View file

@ -0,0 +1,151 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class RawFile extends AppModel {
var $name = 'RawFile';
var $useDbConfig = 'raw_files';
var $displayField = 'filename';
// var $useTable = false;
var $primaryKey = 'filename';
var $_parser;
var $belongsTo = array(
'ImportedTranslationFile' => array(
'className' => 'ImportedTranslationFile',
'foreignKey' => 'filename',
'conditions' => '',
'fields' => '',
'order' => ''
),
);
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;
$this->_currentFile = $file;
$this->_currentFileLastChange = $file->lastChange();
return $file;
}
public function parseFile()
{
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)
{
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)
{
if (preg_match('|^([a-z]{2})_diff_[A-F0-9]{8}\.uxt$|', $filename, $matches))
return $matches[1];
else if (preg_match('|^([a-z]{2})\.uxt$|', $filename, $matches))
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];
}
}

View file

@ -0,0 +1,135 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class Translation extends AppModel {
var $name = 'Translation';
var $displayField = 'translation_text';
var $scaffoldForbiddenActions = array();
var $scaffoldActions = array("add" => "fk", "index" => "fk");
var $belongsTo = array(
'Identifier' => array(
'className' => 'Identifier',
'foreignKey' => 'identifier_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'IdentifierColumn' => array(
'className' => 'IdentifierColumn',
'foreignKey' => 'identifier_column_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'ParentTranslation' => array(
'className' => 'Translation',
'foreignKey' => 'parent_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
);
var $hasMany = array(
'Vote' => array(
'className' => 'Vote',
'foreignKey' => 'translation_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
/* 'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'translation_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),*/
'ChildTranslation' => array(
'className' => 'Translation',
'foreignKey' => 'parent_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);
return $this->id;
}
function makeHash($ent)
{
if (isset($ent['columns']) && is_array($ent['columns']))
{
sort($ent['columns']);
return md5(serialize($ent['columns']));
}
else if (isset($ent['string']))
return md5($ent['string']);
}
}

View file

@ -0,0 +1,66 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class TranslationFile extends AppModel {
var $name = 'TranslationFile';
var $displayField = 'filename_template';
var $scaffoldForbiddenActions = array("add", "admin_add", "edit", "admin_edit", "delete", "admin_delete");
var $belongsTo = array(
'Language' => array(
'className' => 'Language',
'foreignKey' => 'language_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
var $hasMany = array(
'ImportedTranslationFile' => array(
'className' => 'ImportedTranslationFile',
'foreignKey' => 'translation_file_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Identifier' => array(
'className' => 'Identifier',
'foreignKey' => 'translation_file_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
);
}

View file

@ -0,0 +1,88 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class User extends AppModel {
var $name = 'User';
var $displayField = 'name';
var $actsAs = array('Null' => array('confirm_hash'));
var $recursive = 0;
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");
var $scaffoldForbiddenFields = array("" => array("activated","password","confirm_hash","created","modified"),/* "admin_" => array("password")*/);
var $hasMany = array(
'Translation' => array(
'className' => 'Translation',
'foreignKey' => 'user_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Vote' => array(
'className' => 'Vote',
'foreignKey' => 'user_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'user_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
);
}

View file

@ -0,0 +1,43 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class Vote extends AppModel {
var $name = 'Vote';
var $displayField = 'translation_id';
var $scaffoldForbiddenActions = array("delete");
var $belongsTo = array(
'Translation' => array(
'className' => 'Translation',
'foreignKey' => 'translation_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}

View file

View file

View file

@ -0,0 +1,307 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class PhraseParser
{
var $debug = false;
function removeComments($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
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;
}
function removeBOM($str)
{
if(($bom = substr($str, 0,3)) == pack("CCC",0xef,0xbb,0xbf))
{
$bla = substr($str, 3);
return $bla;
}
else
{
return $str;
}
}
function addBOM($str)
{
if(($bom = substr($str, 0,3)) != pack("CCC",0xef,0xbb,0xbf))
return pack("CCC",0xef,0xbb,0xbf) . $str;
else
return $str;
}
function parseLine($str)
{
$arr = array();
if (mb_substr($str, 0, 2) == "//")
{
if (mb_substr($str, 0, 7) == "// DIFF")
{
$tmp = explode(" ", $str);
$type = 'diff';
$command = mb_strtolower($tmp[2]);
$args = isset($tmp[3]) ? $tmp[3] : null;
if ($command == "add" || $command == "changed")
{
if (isset($args))
$index = intval($args);
else
$index = null;
$command = mb_substr($str, 3);
}
else
unset($type);
}
else if (mb_substr($str, 0, 8) == "// INDEX")
{
list($j, $type, $index) = explode(" ", $str);
$type = "internal_index";
}
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));
debug_print_backtrace();
}
var_dump($type);*/
if (isset($type))
{
$type = mb_strtolower($type);
$arr = compact("type","command","index","hash_value");
}
}
else if (!(mb_substr($str, 0, 2) == "//") && mb_strlen($str))
{
$type = "string";
$string = "";
$identifier = "";
$arguments = "";
$body = "";
if (preg_match('|^([0-9A-Za-z@_]*) \((.*?)\).*$|', $str, $matches))
{
$identifier = $matches[1];
$arguments = $matches[2];
}
else if ($str == "{")
$body = "begin";
else if ($str == "}")
$body = "end";
else
{
$string = $str;
}
$arr = compact("type", "identifier", "arguments", "string", "body");
}
/* echo "<pre>################################\n";
var_dump($str);
var_dump($arr);
echo "</pre>\n";*/
return $arr;
}
function addEnt(&$parsedEnt, &$entities, &$newEnt)
{
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"];
$parsedEnt["type"] = "phrase";
$entities[] = $parsedEnt;
$parsedEnt =array();
$newEnt = false;
}
function parseFile($file)
{
$parsedEnt = array();
$newEnt = false;
$prevStringLine = false;
$entities = array();
$file = $this->removeBOM($file);
// var_dump($file);
$file = $this->removeComments($file);
// var_dump($file);
$lines = explode("\n", $file);
if ($this->debug)
{
echo "<pre>\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, "\r\n");
$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 line start with diff (diff files) or hash_value (translated files) and before was line with translation, then we start new ent
if ($prevStringLine && (
($parsedLine["type"] == "diff" && $parsedEnt) || ($parsedLine["type"] == "hash_value" && $parsedEnt)
))
{
/* echo "%%%% prevStringLine %%%%%\n";
var_dump($parsedEnt);*/
$newEnt = true;
}
if ($newEnt)
{
$this->addEnt($parsedEnt, $entities, $newEnt);
}
if ($parsedLine["type"] == "internal_index")
$parsedEnt["internal_index"] = $parsedLine["index"];
if ($parsedLine["type"] == "string")
{
$prevStringLine = true;
if ($parsedLine["body"] == "begin" || $parsedLine["body"] == "end")
continue;
if ($this->debug)
{
echo "%%%% parsedEnt before %%%%%\n";
var_dump($parsedEnt);
// echo "%%%% parsedLine %%%%%\n";
// var_dump($parsedLine);
}
if (!$parsedLine['identifier'])
{
if ($this->debug) echo "%%%% parsedEnt 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"] = $parsedEnt["command"] = $parsedLine["command"];
$parsedEnt["index"] = $parsedLine["index"];
}
}
if ($parsedEnt)
{
$this->addEnt($parsedEnt, $entities, $newEnt);
}
if ($this->debug)
{
echo "<pre>";
var_dump($entities);
echo "</pre>\n";
}
return $entities;
}
function CRLF($s)
{
$s = str_replace("\r\n", "\n", $s);
$s = str_replace("\n", "\r\n", $s);
return $s;
}
function buildFile($entities)
{
$content = '// DIFF_VERSION 2' . "\n";
foreach ($entities as $ent)
{
if (isset($ent['command']))
$content .= '// ' . $ent['command'] . "\n";
if (isset($ent['hash_value']))
$content .= '// HASH_VALUE ' . $ent['hash_value'];
/* if (isset($ent['command']))
$content .= '// INDEX ' . $ent['internal_index'] . "\n";
else
$content .= '// INDEX ' . $ent['index'] . "\n";*/
$content .= $ent['identifier'] . ' (' . $ent['arguments'] . ')' . "\n" . '{' . "\n" . $ent['string'] . "\n" . '}' . "\n";
$content .= "\n";
}
return $this->addBOM($this->CRLF($content));
}
}
?>

View file

@ -0,0 +1,203 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class SheetParser
{
var $debug = false;
function parseLine($str)
{
$arr = str_getcsv($str, "\t");
return $arr;
}
function parseFile($file)
{
$parsedEnt = array();
$newEnt = false;
$prevStringLine = false;
$entities = array();
$diffFile = false;
$file = mb_convert_encoding($file, 'UTF-8', 'UTF-16');
// $file = $this->removeBOM($file);
// $file = $this->removeComments($file);
$lines = explode("\n", $file);
if ($this->debug)
{
echo "<pre>\n\n";
}
$line_no=1;
/* var_dump(setlocale(LC_ALL,NULL));
var_dump(setlocale(LC_ALL,'pl_PL.UTF-8'));*/
// Need to set UTF-8 locale to get str_getcsv to work with UTF-8 cyryllic
setlocale(LC_ALL,'pl_PL.UTF-8');
foreach ($lines as $line)
{
if ($this->debug)
{
echo "\n\t#################### LINE NUMBER " . $line_no . "\n\n";
}
// var_dump($line);
$line = rtrim($line,"\r\n");
$parsedLine = $this->parseLine($line);
if (!$line || mb_strpos($line, "DIFF NOT") === 0 || mb_strpos($line, "REMOVE THE") === 0)
continue;
if ($line_no == 1)
{
$parsedEnt["type"] = "sheet_description";
if ($parsedLine[0] == "DIFF_CMD")
$diffFile = true;
$parsedEnt["sheet_id_column"] = $parsedLine[2];
}
else
{
if ($diffFile)
{
$parsedEnt["diff"] = $parsedEnt["command"] = rtrim($parsedLine[0]);
$parsedEnt["hash_value"] = $parsedLine[1];
$parsedEnt["identifier"] = $parsedLine[2];
}
else
{
$parsedEnt["hash_value"] = $parsedLine[0];
$parsedEnt["identifier"] = $parsedLine[1];
}
$parsedEnt["type"] = "sheet";
}
if ($diffFile)
$columns = array_slice($parsedLine, 3);
else
$columns = array_slice($parsedLine, 2);
if (!isset($columnsCount))
$columnsCount = count($columns);
$parsedEnt["columns"] = $columns;
if ($this->debug)
{
echo "%%%% parsedEnt %%%%%\n";
var_dump($parsedEnt);
}
/* if ($parsedLine["type"] == "internal_index")
$parsedEnt["internal_index"] = $parsedLine["index"];
if ($parsedLine["type"] == "diff")
{
$parsedEnt["diff"] = $parsedLine["command"];
$parsedEnt["index"] = $parsedLine["index"];
}*/
$newEnt = true;
if ($newEnt)
{
if ($this->debug && 0)
{
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;
}
$line_no++;
}
if ($this->debug && 0)
{
echo "<pre>";
var_dump($entities);
echo "</pre>\n";
}
return $entities;
}
function CRLF($s)
{
$s = str_replace("\r\n", "\n", $s);
$s = str_replace("\n", "\r\n", $s);
return $s;
}
function addBOM($str)
{
if(($bom = substr($str, 0,3)) != pack("CCC",0xef,0xbb,0xbf))
return pack("CCC",0xef,0xbb,0xbf) . $str;
else
return $str;
}
function buildFile($entities)
{
$content = '';
foreach ($entities as $ent)
{
if ($ent['type'] == 'sheet_description')
{
$_columns = $ent['columns'];
$_sheet_id_column = $ent['sheet_id_column'];
if (isset($ent['diff']))
{
$content .= 'DIFF_CMD' . "\t" . '*HASH_VALUE' . "\t" . $_sheet_id_column . "\t";
foreach ($ent['columns'] as $value)
{
$content .= $value . "\t";
}
$content = mb_substr($content, 0, -1);
$content .= "\n";
}
continue;
}
if (isset($ent['command']))
$content .= $ent['command'] . "\t";
if (isset($ent['hash_value']))
$content .= $ent['hash_value'] . "\t";
else
$content .= '_0000000000000000' . "\t";
$content .= $ent['identifier'] . "\t";
foreach ($ent['columns'] as $value)
{
$content .= $value . "\t";
}
$content = mb_substr($content, 0, -1);
$content .= "\n";
}
return mb_convert_encoding($this->addBOM($this->CRLF($content)), 'UTF-16LE', 'UTF-8');
// return mb_convert_encoding($this->CRLF($content), 'UTF-16LE', 'UTF-8');
}
}
?>

View file

@ -0,0 +1,316 @@
<?php
/*
Ryzom Core Web-Based Translation Tool
Copyright (C) 2011 Piotr Kaczmarek <p.kaczmarek@openlink.pl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<?php
class StringParser
{
var $pipeline_directory = "/home/kaczorek/projects/webtt/distfiles/translation/";
var $debug = false;
function removeComments($str)
{
/* while (($cstart = mb_strpos($str, "/*", $offset)) !== false)
{
$cend = mb_strpos();
}*/
// 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
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;
}
function removeBOM($str)
{
// mb_internal_encoding("ISO-8859-2");
// var_dump(substr($str, 0, 3));
if(($bom = substr($str, 0,3)) == pack("CCC",0xef,0xbb,0xbf))
{
// var_dump("jest bom");
$bla = substr($str, 3);
// var_dump($bla);
return $bla;
}
else
{
// var_dump($bom);
return $str;
}
}
function addBOM($str)
{
if(($bom = substr($str, 0,3)) != pack("CCC",0xef,0xbb,0xbf))
return pack("CCC",0xef,0xbb,0xbf) . $str;
else
return $str;
}
function parseLine($str)
{
$arr = array();
// var_dump(mb_internal_encoding());
// mb_internal_encoding("ISO-8859-2");
if (mb_substr($str, 0, 2) == "//")
{
if (mb_substr($str, 0, 7) == "// DIFF")
{
list($j, $type, $command, $args) = explode(" ", $str);
$command = mb_strtolower($command);
if ($command == "add" || $command == "changed")
{
$index = intval($args);
$command = mb_substr($str, 3);
}
else
unset($type);
}
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));
debug_print_backtrace();
}
var_dump($type);*/
if (isset($type))
{
$type = mb_strtolower($type);
$arr = compact("type","command","index","hash_value");
}
}
else if (!(mb_substr($str, 0, 2) == "//") && mb_strlen($str))
{
//list($ident, $j
$type = "string";
$lBracket = mb_strpos($str, "[");
$rBracket = mb_strrpos($str, "]");
$sStart = $lBracket + 1;
$sEnd = $rBracket - ($sStart);
$identifier = trim(mb_substr($str, 0, $lBracket));
if (!$rBracket)
$sEnd = mb_strlen($str);
$string = mb_substr($str, $sStart, $sEnd);
$string = str_replace(
array('\\\\', '\[','\]'),
array('\\', '[',']'), // '
$string
);
$arr = compact("type", "identifier", "string");
}
/* echo "<pre>################################\n";
var_dump($str);
var_dump($arr);
echo "</pre>\n";*/
return $arr;
}
function parseFile($file)
{
$parsedEnt = array();
$newEnt = false;
$prevStringLine = false;
$entities = array();
// $file = file_get_contents($this->pipeline_directory . $file);
// var_dump(mb_substr($file, 0,3));
// var_dump(substr($file, 0,3));
// var_dump($file);
$file = $this->removeBOM($file);
// var_dump($file);
$file = $this->removeComments($file);
// var_dump($file);
$lines = explode("\n", $file);
if ($this->debug)
{
echo "<pre>\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);
// $line = str_replace(array("\r\n","\n","\r"), '', $line);
$line = rtrim($line, "\r\n");
$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 line start with diff (diff files) or hash_value (translated files) and before was line with translation, then we start new ent
if ($prevStringLine && (
($parsedLine["type"] == "diff" && $parsedEnt) || ($parsedLine["type"] == "hash_value" && $parsedEnt)
))
{
/* echo "%%%% prevStringLine %%%%%\n";
var_dump($parsedEnt);*/
$newEnt = true;
}
if ($newEnt)
{
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";
$parsedEnt['string'] .= "\n" . $parsedLine['string'];
}
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"] = $parsedEnt["command"] = $parsedLine["command"];
$parsedEnt["index"] = $parsedLine["index"];
}
}
if ($parsedEnt)
{
if (!isset($parsedEnt["diff"]) && !isset($parsedEnt["index"]))
$parsedEnt["index"] = $parsedEnt["internal_index"];
$entities[] = $parsedEnt;
}
if ($this->debug)
{
echo "<pre>";
var_dump($entities);
echo "</pre>\n";
}
return $entities;
}
function CRLF($s)
{
$s = str_replace("\r\n", "\n", $s);
$s = str_replace("\n", "\r\n", $s);
return $s;
}
function buildFile($entities)
{
$content = '';
foreach ($entities as $ent)
{
if (isset($ent['command']))
$content .= '// ' . $ent['command'] . "\n";
if (isset($ent['hash_value']))
$content .= '// HASH_VALUE ' . $ent['hash_value'];
/* if (isset($ent['command']))
$content .= '// INDEX ' . $ent['internal_index'] . "\n";
else*/
if (!isset($ent['command']))
$content .= '// INDEX ' . $ent['index'] . "\n";
$content .= $ent['identifier'] . "\t" . '[' . $ent['string'] . ']' . "\n";
$content .= "\n";
}
return $this->addBOM($this->CRLF($content));
}
}
?>

View file

@ -0,0 +1,83 @@
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<div class="grid_4">
<div class="box">
<?php //// ACTIONS ?>
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="block" id="admin-actions">
<h5><?php echo $pluralHumanName; ?></h5>
<ul class="menu">
<?php if (strpos($action, 'add') === false): ?>
<li><?php echo "<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \$this->Form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$this->Form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
<?php endif;?>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index'));?>";?></li>
</ul>
<?php
$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
echo "\n\t\t\t<h5>".Inflector::humanize($details['controller'])."</h5>";
echo "\n\t\t\t<ul class=\"menu\">\n";
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
echo "\t\t\t</ul>\n";
}
}
?>
</div>
</div>
</div>
<div class="grid_12">
<h2 id="page-heading"><?php echo "<?php printf(__('" . Inflector::humanize($action) . " %s', true), __('{$singularHumanName}', true)); ?>";?></h2>
<div class="<?php echo $pluralVar;?> form">
<?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?>
<fieldset>
<legend><?php echo "<?php printf(__('{$singularHumanName} Record', true)); ?>";?></legend>
<?php
echo "\t<?php\n";
foreach ($fields as $field) {
if (strpos($action, 'add') !== false && $field == $primaryKey) {
continue;
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
echo "\t\techo \$this->Form->input('{$field}');\n";
}
}
if (!empty($associations['hasAndBelongsToMany'])) {
foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {
echo "\t\techo \$this->Form->input('{$assocName}');\n";
}
}
echo "\t?>\n";
?>
</fieldset>
<?php
echo "<?php echo \$this->Form->end(__('Submit', true));?>\n";
?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,89 @@
<div class="grid_16">
<?php
$output = "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
$output .="
<?php
if (Configure::read() > 0):
Debugger::checkSecurityKeys();
endif;
?>
<p>
<?php
if (is_writable(TMP)):
echo '<span class=\"notice success\">';
__('Your tmp directory is writable.');
echo '</span>';
else:
echo '<span class=\"notice\">';
__('Your tmp directory is NOT writable.');
echo '</span>';
endif;
?>
</p>
<p>
<?php
\$settings = Cache::settings();
if (!empty(\$settings)):
echo '<span class=\"notice success\">';
printf(__('The %s is being used for caching. To change the config edit APP/config/core.php ', true), '<em>'. \$settings['engine'] . 'Engine</em>');
echo '</span>';
else:
echo '<span class=\"notice\">';
__('Your cache is NOT working. Please check the settings in APP/config/core.php');
echo '</span>';
endif;
?>
</p>
<p>
<?php
\$filePresent = null;
if (file_exists(CONFIGS . 'database.php')):
echo '<span class=\"notice success\">';
__('Your database configuration file is present.');
\$filePresent = true;
echo '</span>';
else:
echo '<span class=\"notice\">';
__('Your database configuration file is NOT present.');
echo '<br/>';
__('Rename config/database.php.default to config/database.php');
echo '</span>';
endif;
?>
</p>
<?php
if (!empty(\$filePresent)):
if (!class_exists('ConnectionManager')) {
require LIBS . 'model' . DS . 'connection_manager.php';
}
\$db = ConnectionManager::getInstance();
\$connected = \$db->getDataSource('default');
?>
<p>
<?php
if (\$connected->isConnected()):
echo '<span class=\"notice success\">';
__('Cake is able to connect to the database.');
echo '</span>';
else:
echo '<span class=\"notice\">';
__('Cake is NOT able to connect to the database.');
echo '</span>';
endif;
?>
</p>\n";
$output .= "<?php endif;?>\n";
$output .= "<h3><?php __('Editing this Page') ?></h3>\n";
$output .= "<p>\n";
$output .= "<?php\n";
$output .= "\tprintf(__('To change the content of this page, edit: %s\n";
$output .= "\t\tTo change its layout, edit: %s\n";
$output .= "\t\tYou can also add some CSS styles for your pages at: %s', true),\n";
$output .= "\t\tAPP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n";
$output .= "?>\n";
$output .= "</p>\n";
?>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,126 @@
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<div class="grid_4">
<div class="box">
<?php //// ACTIONS ?>
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="block" id="admin-actions">
<h5><?php echo $pluralHumanName; ?></h5>
<ul class="menu">
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?>";?></li>
</ul>
<?php
$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
echo "\n\t\t\t<h5>".Inflector::humanize($details['controller'])."</h5>";
echo "\n\t\t\t<ul class=\"menu\">\n";
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
echo "\t\t\t</ul>\n";
}
}
?>
</div>
</div>
</div>
<div class="grid_12">
<h2 id="page-heading"><?php echo "<?php __('{$pluralHumanName}');?>";?></h2>
<?php //// TABLE WITH RECORDS ?>
<table cellpadding="0" cellspacing="0">
<?php
//// TABLE HEADERS
echo "<?php \$tableHeaders = \$html->tableHeaders(array(";
foreach($fields as $field) {
echo "\$paginator->sort('{$field}'),";
}
echo "__('Actions', true),";
echo "));\n";
echo "echo '<thead>'.\$tableHeaders.'</thead>'; ?>\n\n";
//// TABLE ROWS
echo "<?php
\$i = 0;
foreach (\${$pluralVar} as \${$singularVar}):
\$class = null;
if (\$i++ % 2 == 0) {
\$class = ' class=\"altrow\"';
}
?>\n";
echo "\t<tr<?php echo \$class;?>>\n";
foreach ($fields as $field) {
$isKey = false;
if (!empty($associations['belongsTo'])) {
foreach ($associations['belongsTo'] as $alias => $details) {
if ($field === $details['foreignKey']) {
$isKey = true;
echo "\t\t<td>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
break;
}
}
}
if ($isKey !== true) {
echo "\t\t<td><?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>&nbsp;</td>\n";
}
}
echo "\t\t<td class=\"actions\">\n";
echo "\t\t\t<?php echo \$this->Html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo ' | ' . \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo ' | ' . \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";
echo "<?php endforeach; ?>\n";
//// TABLE FOOTER
echo "<?php echo '<tfoot class=\'dark\'>'.\$tableHeaders.'</tfoot>'; ?>";
?>
</table>
<?php //// PAGINATION ?>
<p>
<?php echo "<?php
echo \$this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?>";?>
</p>
<div class="paging">
<?php echo "\t<?php echo \$this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
| <?php echo "\t<?php echo \$this->Paginator->numbers();?>\n"?> |
<?php echo "\t<?php echo \$this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>\n";?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,184 @@
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<div class="grid_4">
<div class="box">
<?php //// ACTIONS ?>
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="block" id="admin-actions">
<h5><?php echo $pluralHumanName; ?></h5>
<ul class="menu">
<?php
echo "\t<li><?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n";
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n";
?>
</ul>
<?php
$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
echo "\n\t\t\t<h5>".Inflector::humanize($details['controller'])."</h5>";
echo "\n\t\t\t<ul class=\"menu\">\n";
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
echo "\t\t\t</ul>\n";
}
}
?>
</div>
</div>
</div>
<div class="grid_12">
<div class="box">
<div class="<?php echo $pluralVar;?> view">
<h2><?php echo "<?php __('{$singularHumanName}');?>";?></h2>
<div class="block">
<dl><?php echo "<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?>
<?php
foreach ($fields as $field) {
$isKey = false;
if (!empty($associations['belongsTo'])) {
foreach ($associations['belongsTo'] as $alias => $details) {
if ($field === $details['foreignKey']) {
$isKey = true;
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
break;
}
}
}
if ($isKey !== true) {
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize($field) . "'); ?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
}
}
?>
</dl>
</div>
</div>
</div>
<?php if(
(!empty($associations['hasOne'])) ||
(!empty($associations['hasMany'])) ||
(!empty($associations['hasAndBelongsToMany']))
) { ?>
<div class="box">
<h2>
<a href="#" id="toggle-related-records"><?php echo "<?php echo (__('Related', true)); ?>"; ?></a>
</h2>
<div class="block" id="related-records">
<?php
if (!empty($associations['hasOne'])) :
foreach ($associations['hasOne'] as $alias => $details): ?>
<div class="related">
<h3><?php echo "<?php printf(__('Related %s', true), __('" . Inflector::humanize($details['controller']) . "', true));?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?>
<dl><?php echo "\t<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?>
<?php
foreach ($details['fields'] as $field) {
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize($field) . "');?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t<?php echo \${$singularVar}['{$alias}']['{$field}'];?>\n&nbsp;</dd>\n";
}
?>
</dl>
<?php echo "<?php endif; ?>\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
</ul>
</div>
</div>
<?php
endforeach;
endif;
if (empty($associations['hasMany'])) {
$associations['hasMany'] = array();
}
if (empty($associations['hasAndBelongsToMany'])) {
$associations['hasAndBelongsToMany'] = array();
}
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
$i = 0;
foreach ($relations as $alias => $details):
$otherSingularVar = Inflector::variable($alias);
$otherPluralHumanName = Inflector::humanize($details['controller']);
?>
<div class="related">
<h3><?php echo "<?php printf(__('Related %s', true), __('{$otherPluralHumanName}', true));?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?>
<table cellpadding = "0" cellspacing = "0">
<thead>
<tr>
<?php
foreach ($details['fields'] as $field) {
echo "\t\t<th><?php __('" . Inflector::humanize($field) . "'); ?></th>\n";
}
?>
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
</tr>
</thead>
<?php
echo "\t<?php
\$i = 0;
foreach (\${$singularVar}['{$alias}'] as \${$otherSingularVar}):
\$class = null;
if (\$i++ % 2 == 0) {
\$class = ' class=\"altrow\"';
}
?>\n";
echo "\t\t<tr<?php echo \$class;?>>\n";
foreach ($details['fields'] as $field) {
echo "\t\t\t<td><?php echo \${$otherSingularVar}['{$field}'];?></td>\n";
}
echo "\t\t\t<td class=\"actions\">\n";
echo "\t\t\t\t<?php echo \$this->Html->link(__('View', true), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t\t<?php echo ' | '. \$this->Html->link(__('Edit', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t\t<?php echo ' | '. \$this->Html->link(__('Delete', true), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t</td>\n";
echo "\t\t</tr>\n";
echo "\t<?php endforeach; ?>\n";
?>
</table>
<?php echo "<?php endif; ?>\n\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
</ul>
</div>
</div>
<?php endforeach;?>
</div>
</div>
<?php } ?>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,115 @@
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* WebTT bake template based on 960grid template
* http://bakery.cakephp.org/articles/tom_m/2010/05/26/960-fluid-grid-system-bake-templates
*
*/
?>
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo "<?php echo __('" . $pluralHumanName . "', true); ?>"; ?></h5>
<ul class="menu">
<?php if (strpos($action, 'add') === false): ?><?php
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "delete", $scaffoldForbiddenActions))) {
echo "\t\t\t"; ?><li><?php echo "<?php echo \$this->Html->link(sprintf(__('Delete this %s', true), __('" . Inflector::humanize(Inflector::underscore($modelClass)) . "', true)),array('action' => 'delete', \$this->Form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$this->Form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li><?php
} ?>
<?php endif;?><?php
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "index", $scaffoldForbiddenActions))) {
echo "\t\t\t"; ?><li><?php echo "<?php echo \$this->Html->link(sprintf(__('List all %s', true), __('{$pluralHumanName}', true)), array('action' => 'index'));?>";?></li><?php
} ?>
</ul>
<?php
$done = array();
foreach ($associations as $_type => $_data)
{
foreach ($_data as $alias => $details)
{
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "index", $details['scaffoldForbiddenActions'])))
{
echo "\n\t\t\t<h5>".Inflector::humanize($details['controller'])."</h5>";
echo "\n\t\t\t<ul class=\"menu\">\n";
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
if ($_type == 'hasMany' && strpos($action, 'add') === false)
{
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List related %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index', '{$details['foreignKey']}' => \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "add", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New related %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add', '{$details['foreignKey']}' => \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
}
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "index", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List all %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "add", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
echo "\t\t\t</ul>\n";
}
}
}
?>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php echo "<?php printf(__('" . Inflector::humanize($action) . " %s', true), __('{$singularHumanName}', true)); ?>";?></h2>
<div class="<?php echo $pluralVar;?> form">
<?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?>
<fieldset>
<?php if (strpos($action, 'add') === false): ?>
<legend><?php echo "<?php printf(__('{$singularHumanName} # %s', true), \$this->Form->value('{$modelClass}.{$primaryKey}')); ?>";?></legend>
<?php else:;?>
<legend><?php echo "<?php printf(__('{$singularHumanName}', true)); ?>";?></legend>
<?php endif;?>
<?php
echo "\t<?php\n";
foreach ($fields as $field) {
if (!(empty($scaffoldForbiddenFields) || !isset($scaffoldForbiddenFields[$scaffoldPrefix]) || (!empty($scaffoldForbiddenFields) && isset($scaffoldForbiddenFields[$scaffoldPrefix]) && !in_array($field, $scaffoldForbiddenFields[$scaffoldPrefix]))))
continue;
if (strpos($action, 'add') !== false && $field == $primaryKey) {
continue;
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
echo "\t\techo \$this->Form->input('{$field}');\n";
}
}
if (!empty($associations['hasAndBelongsToMany'])) {
foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {
echo "\t\techo \$this->Form->input('{$assocName}');\n";
}
}
echo "\t?>\n";
?>
</fieldset>
<?php
echo "<div class=\"box\">\n";
echo "<?php echo \$this->Form->end(__('Submit', true));?>\n";
echo "</div>";
?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,112 @@
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* WebTT bake template based on 960grid template
* http://bakery.cakephp.org/articles/tom_m/2010/05/26/960-fluid-grid-system-bake-templates
*
*/
?>
<div class="grid_16">
<?php
$output = "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
$output .="
<?php
if (Configure::read() > 0):
Debugger::checkSecurityKeys();
endif;
?>
<p>
<?php
if (is_writable(TMP)):
echo '<span class=\"notice success\">';
__('Your tmp directory is writable.');
echo '</span>';
else:
echo '<span class=\"notice\">';
__('Your tmp directory is NOT writable.');
echo '</span>';
endif;
?>
</p>
<p>
<?php
\$settings = Cache::settings();
if (!empty(\$settings)):
echo '<span class=\"notice success\">';
printf(__('The %s is being used for caching. To change the config edit APP/config/core.php ', true), '<em>'. \$settings['engine'] . 'Engine</em>');
echo '</span>';
else:
echo '<span class=\"notice\">';
__('Your cache is NOT working. Please check the settings in APP/config/core.php');
echo '</span>';
endif;
?>
</p>
<p>
<?php
\$filePresent = null;
if (file_exists(CONFIGS . 'database.php')):
echo '<span class=\"notice success\">';
__('Your database configuration file is present.');
\$filePresent = true;
echo '</span>';
else:
echo '<span class=\"notice\">';
__('Your database configuration file is NOT present.');
echo '<br/>';
__('Rename config/database.php.default to config/database.php');
echo '</span>';
endif;
?>
</p>
<?php
if (!empty(\$filePresent)):
if (!class_exists('ConnectionManager')) {
require LIBS . 'model' . DS . 'connection_manager.php';
}
\$db = ConnectionManager::getInstance();
\$connected = \$db->getDataSource('default');
?>
<p>
<?php
if (\$connected->isConnected()):
echo '<span class=\"notice success\">';
__('Cake is able to connect to the database.');
echo '</span>';
else:
echo '<span class=\"notice\">';
__('Cake is NOT able to connect to the database.');
echo '</span>';
endif;
?>
</p>\n";
$output .= "<?php endif;?>\n";
$output .= "<h3><?php __('Editing this Page') ?></h3>\n";
$output .= "<p>\n";
$output .= "<?php\n";
$output .= "\tprintf(__('To change the content of this page, edit: %s\n";
$output .= "\t\tTo change its layout, edit: %s\n";
$output .= "\t\tYou can also add some CSS styles for your pages at: %s', true),\n";
$output .= "\t\tAPP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n";
$output .= "?>\n";
$output .= "</p>\n";
?>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,142 @@
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* WebTT bake template based on 960grid template
* http://bakery.cakephp.org/articles/tom_m/2010/05/26/960-fluid-grid-system-bake-templates
*
*/
?>
<div class="grid_3">
<div class="box menubox">
<h2><a href="#" id="toggle-admin-actions">Actions</a></h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo "<?php echo __('" . $pluralHumanName . "', true); ?>"; ?></h5>
<ul class="menu">
<?php
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "index", $scaffoldForbiddenActions)))
echo "\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n";
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "add", $scaffoldForbiddenActions)))
echo "\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n";
?>
</ul><?php echo "\n";
$done = array();
foreach ($associations as $_type => $_data)
{
foreach ($_data as $alias => $details)
{
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "index", $details['scaffoldForbiddenActions'])))
{
echo "\t\t\t\t<h5><?php echo __('" . Inflector::humanize($details['controller']) . "', true); ?></h5>\n";
echo "\t\t\t\t<ul class=\"menu\">\n";
if ($details['controller'] != $this->name && !in_array($details['controller'], $done))
{
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "index", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List all %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "add", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
echo "\t\t\t\t</ul>\n";
}
}
}
?>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php echo "<?php __('{$pluralHumanName}');?>";?></h2>
<table cellpadding="0" cellspacing="0"><?php
//// TABLE HEADERS
echo "\t\t<?php \$tableHeaders = \$html->tableHeaders(array(";
foreach($fields as $field) {
if (!(empty($scaffoldForbiddenFields) || !isset($scaffoldForbiddenFields[$scaffoldPrefix]) || (!empty($scaffoldForbiddenFields) && isset($scaffoldForbiddenFields[$scaffoldPrefix]) && !in_array($field, $scaffoldForbiddenFields[$scaffoldPrefix]))))
continue;
echo "\$paginator->sort('{$field}'),";
}
echo "__('Actions', true),";
echo "));\n";
echo "\t\techo '<thead>'.\$tableHeaders.'</thead>'; ?>\n\n";
//// TABLE ROWS
echo "\t\t<?php
\$i = 0;
foreach (\${$pluralVar} as \${$singularVar}):
\$class = null;
if (\$i++ % 2 == 0) {
\$class = ' class=\"altrow\"';
}
?>\n";
echo "\t<tr<?php echo \$class;?>>\n";
foreach ($fields as $field) {
if (!(empty($scaffoldForbiddenFields) || !isset($scaffoldForbiddenFields[$scaffoldPrefix]) || (!empty($scaffoldForbiddenFields) && isset($scaffoldForbiddenFields[$scaffoldPrefix]) && !in_array($field, $scaffoldForbiddenFields[$scaffoldPrefix]))))
continue;
$isKey = false;
if (!empty($associations['belongsTo'])) {
foreach ($associations['belongsTo'] as $alias => $details) {
if ($field === $details['foreignKey'] && $field !== $primaryKey) {
$isKey = true;
echo "\t\t<td>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
break;
}
}
}
if ($isKey !== true) {
echo "\t\t<td><?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?></td>\n";
}
}
echo "\t\t<td class=\"actions\">\n";
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "view", $scaffoldForbiddenActions)))
echo "\t\t\t<?php echo \$this->Html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "edit", $scaffoldForbiddenActions)))
echo "\t\t\t<?php echo ' | ' . \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "delete", $scaffoldForbiddenActions)))
echo "\t\t\t<?php echo ' | ' . \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";
echo "\t<?php endforeach; ?>\n";
//// TABLE FOOTER
echo "\t<?php echo '<tfoot class=\'dark\'>'.\$tableHeaders.'</tfoot>'; ?>\n";
?>
</table>
<?php //// PAGINATION ?>
<p>
<?php echo "<?php
echo \$this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?>";?>
</p>
<div class="paging">
<?php echo "\t<?php echo \$this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
| <?php echo "<?php echo \$this->Paginator->numbers();?>"?> |
<?php echo "\t<?php echo \$this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>\n";?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,255 @@
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* WebTT bake template based on 960grid template
* http://bakery.cakephp.org/articles/tom_m/2010/05/26/960-fluid-grid-system-bake-templates
*
*/
?>
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo "<?php echo __('" . $pluralHumanName . "', true); ?>"; ?></h5>
<ul class="menu">
<?php
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "edit", $scaffoldForbiddenActions)))
echo "\t<li><?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "delete", $scaffoldForbiddenActions)))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "index", $scaffoldForbiddenActions)))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n";
if (empty($scaffoldForbiddenActions) || (!empty($scaffoldForbiddenActions) && !in_array($scaffoldPrefix . "add", $scaffoldForbiddenActions)))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n";
?>
</ul>
<?php
$done = array();
foreach ($associations as $_type => $_data)
{
foreach ($_data as $alias => $details)
{
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "index", $details['scaffoldForbiddenActions'])))
{
echo "\n\t\t\t<h5>".Inflector::humanize($details['controller'])."</h5>";
echo "\n\t\t\t<ul class=\"menu\">\n";
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
if ($_type == 'hasMany')
{
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List related %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index', '{$details['foreignKey']}' => \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "add", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New related %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add', '{$details['foreignKey']}' => \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
}
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('List all %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "add", $details['scaffoldForbiddenActions'])))
{
echo "\t\t\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
}
$done[] = $details['controller'];
}
echo "\t\t\t</ul>\n";
}
}
}
?>
</div>
</div>
</div>
</div>
<div class="grid_13">
<div class="box">
<div class="<?php echo $pluralVar;?> view">
<h2><?php echo "<?php __('{$singularHumanName}');?>";?></h2>
<div class="block">
<div class="dl">
<?php
echo "<?php \$i = 1; \$class = ' altrow';?>\n";
foreach ($fields as $field) {
if (!(empty($scaffoldForbiddenFields) || !isset($scaffoldForbiddenFields[$scaffoldPrefix]) || (!empty($scaffoldForbiddenFields) && isset($scaffoldForbiddenFields[$scaffoldPrefix]) && !in_array($field, $scaffoldForbiddenFields[$scaffoldPrefix]))))
continue;
$isKey = false;
if (!empty($associations['belongsTo'])) {
foreach ($associations['belongsTo'] as $alias => $details) {
if ($field === $details['foreignKey'] && $field !== $primaryKey) {
$isKey = true;
echo "\t\t\t\t<div class=\"dt<?php if (\$i % 2 == 0) echo \$class;?>\"><?php __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></div>\n";
echo "\t\t\t\t<div class=\"dd<?php if (\$i % 2 == 0) echo \$class;?>\">\n\t\t\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t\t</div>\n";
break;
}
}
}
if ($isKey !== true) {
echo "\t\t\t\t<div class=\"dt<?php if (\$i == 1) echo \" dh\"; else if (\$i % 2 == 0) echo \$class;?>\"><?php __('" . Inflector::humanize($field) . "'); ?></div>\n";
echo "\t\t\t\t<div class=\"dd<?php if (\$i == 1) echo \" dh\"; else if (\$i % 2 == 0) echo \$class;?>\">\n\t\t\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t\t\t</div>\n";
}
echo "\t\t\t\t<?php \$i++; ?>\n";
echo "\t\t\t\t<div style=\"clear: both\"></div>\n\n";
}
?>
</div>
</div>
</div>
</div>
<?php if(
(!empty($associations['hasOne'])) ||
(!empty($associations['hasMany'])) ||
(!empty($associations['hasAndBelongsToMany']))
) {
?>
<div class="box">
<h2>
<a href="#" id="toggle-related-records"><?php echo "<?php echo (__('Related', true)); ?>"; ?></a>
</h2>
<div class="block" id="related-records">
<!-- RELATED --><?php echo "\n";
if (!empty($associations['hasOne'])) :
foreach ($associations['hasOne'] as $alias => $details): ?>
<!-- <?php echo $alias; ?> -->
<div class="related">
<h3><?php echo "<?php printf(__('Related %s (%s)', true), __('" . Inflector::humanize($details['controller']) . "', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true));?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}']['{$details['primaryKey']}'])):?>\n";?>
<div class="dl">
<?php
echo "<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?><?php echo "\n";
foreach ($details['fields'] as $field) {
echo "\t\t\t\t\t<div class=\"dt<?php if (\$i % 2 == 0) echo \$class;?>\"><?php __('" . Inflector::humanize($field) . "');?></div>\n";
echo "\t\t\t\t\t<div class=\"dd<?php if (\$i++ % 2 == 0) echo \$class;?>\">\n";
echo "\t\t\t\t\t\t<?php echo \${$singularVar}['{$alias}']['{$field}'];?>\n\t\t\t\t\t</div>\n";
echo "\t\t\t\t\t<div style=\"clear: both\"></div>\n";
}
?>
</div>
<?php echo "<?php endif; ?>\n";?>
<div class="actions">
<ul>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}']['{$details['primaryKey']}'])):?>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "view", $details['scaffoldForbiddenActions']))) {
?>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('View %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>";
?></li><? echo "\n";
}
?>
<?php echo "<?php endif; ?>\n";?>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}']['{$details['primaryKey']}'])):?>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "add", $details['scaffoldForbiddenActions']))) {
?>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>";
?></li><? echo "\n";
}
?>
<?php echo "<?php endif; ?>\n";?>
</ul>
</div>
</div><?php
echo "\n";
endforeach;
endif;
if (empty($associations['hasMany'])) {
$associations['hasMany'] = array();
}
if (empty($associations['hasAndBelongsToMany'])) {
$associations['hasAndBelongsToMany'] = array();
}
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
$i = 0;
foreach ($relations as $alias => $details):
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "index", $details['scaffoldForbiddenActions']))):
$otherSingularVar = Inflector::variable($alias);
$otherPluralHumanName = Inflector::humanize($details['controller']);
?>
<!-- <?php echo $alias; ?> -->
<div class="related">
<h3><?php echo "<?php printf(__('Related %s', true), __('{$otherPluralHumanName}', true));?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?>
<table cellpadding = "0" cellspacing = "0">
<thead>
<tr><?php echo "\n";
foreach ($details['fields'] as $field) {
echo "\t\t\t\t\t\t<th><?php __('" . Inflector::humanize($field) . "'); ?></th>\n";
}
?>
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
</tr>
</thead>
<?php
echo "<?php
\$i = 0;
foreach (\${$singularVar}['{$alias}'] as \${$otherSingularVar}):
\$class = null;
if (\$i++ % 2 == 0) {
\$class = ' class=\"altrow\"';
}
?>\n";
echo "\t\t\t\t<tr<?php echo \$class;?>>\n";
foreach ($details['fields'] as $field) {
echo "\t\t\t\t\t<td><?php echo \${$otherSingularVar}['{$field}'];?></td>\n";
}
echo "\t\t\t\t\t<td class=\"actions\">\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "view", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t\t\t<?php echo \$this->Html->link(__('View', true), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "edit", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t\t\t<?php echo ' | '. \$this->Html->link(__('Edit', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "delete", $details['scaffoldForbiddenActions'])))
echo "\t\t\t\t\t\t<?php echo ' | '. \$this->Html->link(__('Delete', true), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t\t\t</td>\n";
echo "\t\t\t\t</tr>\n";
echo "\t\t\t\t<?php endforeach; ?>\n";
?>
</table>
<?php echo "<?php endif; ?>\n\n";?>
<div class="actions">
<ul><?php echo "\n";
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "index", $details['scaffoldForbiddenActions']))) { ?>
<li><?php
echo "<?php echo \$this->Html->link(sprintf(__('List related %s', true), __('" . $otherPluralHumanName . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index'";
echo ", '{$details['foreignKey']}' => \${$singularVar}['{$modelClass}']['{$primaryKey}']";
echo "));?>";
?></li><? echo "\n";
}
if (empty($details['scaffoldForbiddenActions']) || (!empty($details['scaffoldForbiddenActions']) && !in_array($scaffoldPrefix . "add", $details['scaffoldForbiddenActions']))) { ?>
<li><?php
echo "<?php echo \$this->Html->link(sprintf(__('New related %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add'";
echo ", '{$details['foreignKey']}' => \${$singularVar}['{$modelClass}']['{$primaryKey}']";
echo "));?>";
?></li><? echo "\n";
}
?>
</ul>
</div>
</div><?php
echo "\n";
endif;
endforeach; ?>
<!-- /RELATED -->
</div>
</div>
<?php } ?>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,117 @@
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('action' => 'index'));?></li> </ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Users</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Users', true)), array('controller' => 'users', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Add %s', true), __('Comment', true)); ?></h2>
<div class="comments form">
<?php echo $this->Form->create('Comment');?>
<fieldset>
<legend><?php printf(__('Comment', true)); ?></legend>
<?php
// echo $this->Form->input('translation_id');
echo $this->Form->hidden('identifier_id', array('default' => $identifier['Identifier']['id']));
echo $this->Form->hidden('user_id', array('value' => $this->Session->read('Auth.User.id')));
echo $this->Form->input('comment');
?>
</fieldset>
<div class="box">
<?php echo $this->Form->end(__('Submit', true));?>
</div> </div>
<div class="box">
<div class="identifiers view">
<h2><?php __('Identifier');?></h2>
<div class="block">
<div class="dl">
<?php $i = 1; $class = ' altrow';?>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Id'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['id']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Language'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($identifier['Language']['name'], array('controller' => 'languages', 'action' => 'view', $identifier['Language']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Translation Index'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['translation_index']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Identifier'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['identifier']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Arguments'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['arguments']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Reference String'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['reference_string']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Translated'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['translated']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Created'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['created']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Modified'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['modified']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,52 @@
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('action' => 'index'));?></li> </ul>
<h5>Translations</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translations', true)), array('controller' => 'translations', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Translation', true)), array('controller' => 'translations', 'action' => 'add')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Users</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Users', true)), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('User', true)), array('controller' => 'users', 'action' => 'add')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Admin Add %s', true), __('Comment', true)); ?></h2>
<div class="comments form">
<?php echo $this->Form->create('Comment');?>
<fieldset>
<legend><?php printf(__('Comment', true)); ?></legend>
<?php
echo $this->Form->input('translation_id');
echo $this->Form->input('identifier_id');
echo $this->Form->input('user_id');
echo $this->Form->input('comment');
?>
</fieldset>
<div class="box">
<?php echo $this->Form->end(__('Submit', true));?>
</div> </div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,53 @@
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Comment.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Comment.id'))); ?></li> <li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('action' => 'index'));?></li> </ul>
<h5>Translations</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translations', true)), array('controller' => 'translations', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Translation', true)), array('controller' => 'translations', 'action' => 'add')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Users</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Users', true)), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('User', true)), array('controller' => 'users', 'action' => 'add')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Admin Edit %s', true), __('Comment', true)); ?></h2>
<div class="comments form">
<?php echo $this->Form->create('Comment');?>
<fieldset>
<legend><?php printf(__('Comment # %s', true), $this->Form->value('Comment.id')); ?></legend>
<?php
echo $this->Form->input('id');
echo $this->Form->input('translation_id');
echo $this->Form->input('identifier_id');
echo $this->Form->input('user_id');
echo $this->Form->input('comment');
?>
</fieldset>
<div class="box">
<?php echo $this->Form->end(__('Submit', true));?>
</div> </div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,81 @@
<div class="grid_3">
<div class="box menubox">
<h2><a href="#" id="toggle-admin-actions">Actions</a></h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('action' => 'add')); ?> </li>
</ul>
<h5><?php echo __('Translations', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translations', true)), array('controller' => 'translations', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Translation', true)), array('controller' => 'translations', 'action' => 'add')); ?> </li>
</ul>
<h5><?php echo __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5><?php echo __('Users', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Users', true)), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('User', true)), array('controller' => 'users', 'action' => 'add')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php __('Comments');?></h2>
<table cellpadding="0" cellspacing="0"> <?php $tableHeaders = $html->tableHeaders(array($paginator->sort('id'),$paginator->sort('translation_id'),$paginator->sort('identifier_id'),$paginator->sort('user_id'),$paginator->sort('comment'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),));
echo '<thead>'.$tableHeaders.'</thead>'; ?>
<?php
$i = 0;
foreach ($comments as $comment):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $comment['Comment']['id']; ?></td>
<td>
<?php echo $this->Html->link($comment['Translation']['translation_text'], array('controller' => 'translations', 'action' => 'view', $comment['Translation']['id'])); ?>
</td>
<td>
<?php echo $this->Html->link($comment['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $comment['Identifier']['id'])); ?>
</td>
<td>
<?php echo $this->Html->link($comment['User']['name'], array('controller' => 'users', 'action' => 'view', $comment['User']['id'])); ?>
</td>
<td><?php echo $comment['Comment']['comment']; ?></td>
<td><?php echo $comment['Comment']['created']; ?></td>
<td><?php echo $comment['Comment']['modified']; ?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('action' => 'view', $comment['Comment']['id'])); ?>
<?php echo ' | ' . $this->Html->link(__('Edit', true), array('action' => 'edit', $comment['Comment']['id'])); ?>
<?php echo ' | ' . $this->Html->link(__('Delete', true), array('action' => 'delete', $comment['Comment']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $comment['Comment']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
<?php echo '<tfoot class=\'dark\'>'.$tableHeaders.'</tfoot>'; ?>
</table>
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?> </p>
<div class="paging">
<?php echo $this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $this->Paginator->numbers();?> |
<?php echo $this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,97 @@
<div class="grid_3">
<div class="box menubox"> <h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('Edit %s', true), __('Comment', true)), array('action' => 'edit', $comment['Comment']['id'])); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('Delete %s', true), __('Comment', true)), array('action' => 'delete', $comment['Comment']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $comment['Comment']['id'])); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('action' => 'add')); ?> </li>
</ul>
<h5>Translations</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translations', true)), array('controller' => 'translations', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Translation', true)), array('controller' => 'translations', 'action' => 'add')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Users</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Users', true)), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('User', true)), array('controller' => 'users', 'action' => 'add')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<div class="box">
<div class="comments view">
<h2><?php __('Comment');?></h2>
<div class="block">
<div class="dl">
<?php $i = 1; $class = ' altrow';?>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Id'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $comment['Comment']['id']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Translation'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($comment['Translation']['translation_text'], array('controller' => 'translations', 'action' => 'view', $comment['Translation']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Identifier'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($comment['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $comment['Identifier']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('User'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($comment['User']['name'], array('controller' => 'users', 'action' => 'view', $comment['User']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Comment'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $comment['Comment']['comment']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Created'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $comment['Comment']['created']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Modified'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $comment['Comment']['modified']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,51 @@
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Comment.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Comment.id'))); ?></li> <li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('action' => 'index'));?></li> </ul>
<h5>Translations</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translations', true)), array('controller' => 'translations', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Users</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Users', true)), array('controller' => 'users', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Edit %s', true), __('Comment', true)); ?></h2>
<div class="comments form">
<?php echo $this->Form->create('Comment');?>
<fieldset>
<legend><?php printf(__('Comment # %s', true), $this->Form->value('Comment.id')); ?></legend>
<?php
echo $this->Form->input('id');
echo $this->Form->input('translation_id');
echo $this->Form->input('identifier_id');
echo $this->Form->input('user_id');
echo $this->Form->input('comment');
?>
</fieldset>
<div class="box">
<?php echo $this->Form->end(__('Submit', true));?>
</div> </div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,72 @@
<div class="grid_3">
<div class="box menubox">
<h2><a href="#" id="toggle-admin-actions">Actions</a></h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('action' => 'add')); ?> </li>
</ul>
<h5><?php echo __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5><?php echo __('Users', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Users', true)), array('controller' => 'users', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php __('Comments');?></h2>
<table cellpadding="0" cellspacing="0"> <?php $tableHeaders = $html->tableHeaders(array($paginator->sort('id'),$paginator->sort('identifier_id'),$paginator->sort('user_id'),$paginator->sort('comment'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),));
echo '<thead>'.$tableHeaders.'</thead>'; ?>
<?php
$i = 0;
foreach ($comments as $comment):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $comment['Comment']['id']; ?></td>
<td>
<?php echo $this->Html->link($comment['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $comment['Identifier']['id'])); ?>
</td>
<td>
<?php echo $this->Html->link($comment['User']['name'], array('controller' => 'users', 'action' => 'view', $comment['User']['id'])); ?>
</td>
<td><?php echo $comment['Comment']['comment']; ?></td>
<td><?php echo $comment['Comment']['created']; ?></td>
<td><?php echo $comment['Comment']['modified']; ?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('action' => 'view', $comment['Comment']['id'])); ?>
<?php echo ' | ' . $this->Html->link(__('Edit', true), array('action' => 'edit', $comment['Comment']['id'])); ?>
<?php echo ' | ' . $this->Html->link(__('Delete', true), array('action' => 'delete', $comment['Comment']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $comment['Comment']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
<?php echo '<tfoot class=\'dark\'>'.$tableHeaders.'</tfoot>'; ?>
</table>
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?> </p>
<div class="paging">
<?php echo $this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $this->Paginator->numbers();?> |
<?php echo $this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,84 @@
<div class="grid_3">
<div class="box menubox"> <h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('Edit %s', true), __('Comment', true)), array('action' => 'edit', $comment['Comment']['id'])); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('Delete %s', true), __('Comment', true)), array('action' => 'delete', $comment['Comment']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $comment['Comment']['id'])); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('action' => 'add')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Users</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Users', true)), array('controller' => 'users', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<div class="box">
<div class="comments view">
<h2><?php __('Comment');?></h2>
<div class="block">
<div class="dl">
<?php $i = 1; $class = ' altrow';?>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Id'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $comment['Comment']['id']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Identifier'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($comment['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $comment['Identifier']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('User'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($comment['User']['name'], array('controller' => 'users', 'action' => 'view', $comment['User']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Comment'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $comment['Comment']['comment']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Created'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $comment['Comment']['created']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Modified'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $comment['Comment']['modified']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,9 @@
Hello <?php echo $user['User']['name']; ?>,
Thank you for registering to WebTT!
Your password is: <?php echo $user['User']['passwd']; echo "\n"; ?>
<?php
$url = $this->Html->url(array('controller' => 'users', 'action' => 'confirm', $user['User']['confirm_hash']));
$completeUrl = 'http://' . $serverName . $url;
?>
Go to this link to confirm you account: <?php echo $this->Html->link(__('Confirm', true), $completeUrl); ?>

View file

@ -0,0 +1,9 @@
Hello <?php echo $user['User']['name']; echo "\n"; ?>,
Thank you for registering to WebTT!
Your password is: <?php echo $user['User']['passwd']; echo "\n"; ?>
<?php
$url = $this->Html->url(array('controller' => 'users', 'action' => 'confirm', $user['User']['confirm_hash']));
$completeUrl = 'http://' . $serverName . $url;
?>
Go to this link to confirm you account: <?php echo $completeUrl; ?>

View file

@ -0,0 +1,19 @@
<?php if (isset($identifierNeighbours)): ?>
<?php //var_dump($identifierNeighbours); ?>
<div class="box menubox">
<h2>
<a href="#" id="toggle-neighbour-actions"><?php echo sprintf(__('Neighbour %s', true), __('Identifiers', true)); ?></a>
</h2>
<div class="inbox">
<div class="block" id="neighbour-actions">
<?php foreach (array('prev', 'current', 'next') as $pos): ?>
<?php foreach ($identifierNeighbours[$pos] as $neighbourIdentifier): ?>
<ul class="list menu">
<li<?php if ($pos == 'current') { echo " class=\"current\""; } ?>><?php echo $this->Html->link($neighbourIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $neighbourIdentifier['Identifier']['id'])); ?> </li>
</ul>
<?php endforeach; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>

View file

@ -0,0 +1,46 @@
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('action' => 'index'));?></li> </ul>
<h5>Imported Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Imported Translation Files', true)), array('controller' => 'imported_translation_files', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Add %s', true), __('File Identifier', true)); ?></h2>
<div class="fileIdentifiers form">
<?php echo $this->Form->create('FileIdentifier');?>
<fieldset>
<legend><?php printf(__('File Identifier', true)); ?></legend>
<?php
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');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,46 @@
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('action' => 'index'));?></li> </ul>
<h5>Imported Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Imported Translation Files', true)), array('controller' => 'imported_translation_files', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Admin Add %s', true), __('File Identifier', true)); ?></h2>
<div class="fileIdentifiers form">
<?php echo $this->Form->create('FileIdentifier');?>
<fieldset>
<legend><?php printf(__('File Identifier', true)); ?></legend>
<?php
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');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,47 @@
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('action' => 'index'));?></li> </ul>
<h5>Imported Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Imported Translation Files', true)), array('controller' => 'imported_translation_files', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Admin Edit %s', true), __('File Identifier', true)); ?></h2>
<div class="fileIdentifiers form">
<?php echo $this->Form->create('FileIdentifier');?>
<fieldset>
<legend><?php printf(__('File Identifier # %s', true), $this->Form->value('FileIdentifier.id')); ?></legend>
<?php
echo $this->Form->input('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');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,70 @@
<div class="grid_3">
<div class="box menubox">
<h2><a href="#" id="toggle-admin-actions">Actions</a></h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu"> <li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('action' => 'index')); ?> </li>
</ul> <h5><?php echo __('Imported Translation Files', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Imported Translation Files', true)), array('controller' => 'imported_translation_files', 'action' => 'index')); ?> </li>
</ul>
<h5><?php echo __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php __('File Identifiers');?></h2>
<table cellpadding="0" cellspacing="0"> <?php $tableHeaders = $html->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 '<thead>'.$tableHeaders.'</thead>'; ?>
<?php
$i = 0;
foreach ($fileIdentifiers as $fileIdentifier):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $fileIdentifier['FileIdentifier']['id']; ?></td>
<td>
<?php echo $this->Html->link($fileIdentifier['ImportedTranslationFile']['filename'], array('controller' => 'imported_translation_files', 'action' => 'view', $fileIdentifier['ImportedTranslationFile']['id'])); ?>
</td>
<td><?php echo $fileIdentifier['FileIdentifier']['command']; ?></td>
<td><?php echo $fileIdentifier['FileIdentifier']['translation_index']; ?></td>
<td>
<?php echo $this->Html->link($fileIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $fileIdentifier['Identifier']['id'])); ?>
</td>
<td><?php echo $fileIdentifier['FileIdentifier']['arguments']; ?></td>
<td><?php echo $fileIdentifier['FileIdentifier']['reference_string']; ?></td>
<td><?php echo $fileIdentifier['FileIdentifier']['created']; ?></td>
<td><?php echo $fileIdentifier['FileIdentifier']['modified']; ?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('action' => 'view', $fileIdentifier['FileIdentifier']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
<?php echo '<tfoot class=\'dark\'>'.$tableHeaders.'</tfoot>'; ?>
</table>
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?> </p>
<div class="paging">
<?php echo $this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $this->Paginator->numbers();?> |
<?php echo $this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,101 @@
<div class="grid_3">
<div class="box menubox"> <h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('action' => 'index')); ?> </li>
</ul>
<h5>Imported Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Imported Translation Files', true)), array('controller' => 'imported_translation_files', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<div class="box">
<div class="fileIdentifiers view">
<h2><?php __('File Identifier');?></h2>
<div class="block">
<div class="dl">
<?php $i = 1; $class = ' altrow';?>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Id'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['id']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Imported Translation File'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($fileIdentifier['ImportedTranslationFile']['filename'], array('controller' => 'imported_translation_files', 'action' => 'view', $fileIdentifier['ImportedTranslationFile']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Command'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['command']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Translation Index'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['translation_index']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Identifier'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($fileIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $fileIdentifier['Identifier']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Arguments'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['arguments']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Reference String'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<textarea rows="10" style="width: 100%" readonly="true"><?php echo $fileIdentifier['FileIdentifier']['reference_string']; ?></textarea>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Created'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['created']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Modified'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['modified']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,47 @@
<div class="grid_3">
<div class="box menubox">
<h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('action' => 'index'));?></li> </ul>
<h5>Imported Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Imported Translation Files', true)), array('controller' => 'imported_translation_files', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Edit %s', true), __('File Identifier', true)); ?></h2>
<div class="fileIdentifiers form">
<?php echo $this->Form->create('FileIdentifier');?>
<fieldset>
<legend><?php printf(__('File Identifier # %s', true), $this->Form->value('FileIdentifier.id')); ?></legend>
<?php
echo $this->Form->input('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');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,70 @@
<div class="grid_3">
<div class="box menubox">
<h2><a href="#" id="toggle-admin-actions">Actions</a></h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu"> <li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('action' => 'index')); ?> </li>
</ul> <h5><?php echo __('Imported Translation Files', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Imported Translation Files', true)), array('controller' => 'imported_translation_files', 'action' => 'index')); ?> </li>
</ul>
<h5><?php echo __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php __('File Identifiers');?></h2>
<table cellpadding="0" cellspacing="0"> <?php $tableHeaders = $html->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 '<thead>'.$tableHeaders.'</thead>'; ?>
<?php
$i = 0;
foreach ($fileIdentifiers as $fileIdentifier):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $fileIdentifier['FileIdentifier']['id']; ?></td>
<td>
<?php echo $this->Html->link($fileIdentifier['ImportedTranslationFile']['filename'], array('controller' => 'imported_translation_files', 'action' => 'view', $fileIdentifier['ImportedTranslationFile']['id'])); ?>
</td>
<td><?php echo $fileIdentifier['FileIdentifier']['command']; ?></td>
<td><?php echo $fileIdentifier['FileIdentifier']['translation_index']; ?></td>
<td>
<?php echo $this->Html->link($fileIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $fileIdentifier['Identifier']['id'])); ?>
</td>
<td><?php echo $fileIdentifier['FileIdentifier']['arguments']; ?></td>
<td><?php echo $fileIdentifier['FileIdentifier']['reference_string']; ?></td>
<td><?php echo $fileIdentifier['FileIdentifier']['created']; ?></td>
<td><?php echo $fileIdentifier['FileIdentifier']['modified']; ?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('action' => 'view', $fileIdentifier['FileIdentifier']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
<?php echo '<tfoot class=\'dark\'>'.$tableHeaders.'</tfoot>'; ?>
</table>
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?> </p>
<div class="paging">
<?php echo $this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $this->Paginator->numbers();?> |
<?php echo $this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,101 @@
<div class="grid_3">
<div class="box menubox"> <h2>
<a href="#" id="toggle-admin-actions">Actions</a>
</h2>
<div class="inbox">
<div class="block" id="admin-actions">
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('action' => 'index')); ?> </li>
</ul>
<h5>Imported Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Imported Translation Files', true)), array('controller' => 'imported_translation_files', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('controller' => 'identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<div class="box">
<div class="fileIdentifiers view">
<h2><?php __('File Identifier');?></h2>
<div class="block">
<div class="dl">
<?php $i = 1; $class = ' altrow';?>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Id'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['id']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Imported Translation File'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($fileIdentifier['ImportedTranslationFile']['filename'], array('controller' => 'imported_translation_files', 'action' => 'view', $fileIdentifier['ImportedTranslationFile']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Command'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['command']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Translation Index'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['translation_index']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Identifier'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($fileIdentifier['Identifier']['identifier'], array('controller' => 'identifiers', 'action' => 'view', $fileIdentifier['Identifier']['id'])); ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Arguments'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['arguments']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Reference String'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<textarea rows="10" style="width: 100%" readonly="true"><?php echo $fileIdentifier['FileIdentifier']['reference_string']; ?></textarea>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Created'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['created']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Modified'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $fileIdentifier['FileIdentifier']['modified']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>

Some files were not shown because too many files have changed in this diff Show more