merge from default

This commit is contained in:
kerozcak 2011-07-14 17:17:29 +02:00
commit fe24308696
1015 changed files with 252734 additions and 0 deletions

View file

@ -206,3 +206,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' => '/home/kaczorek/projects/webtt/distfiles/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,73 @@
<?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', 'Session', 'PathResolver', 'Auth' => array("authorize"=>"controller"));
var $layout = "new";
function beforeFilter() {
parent::beforeFilter();
$this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
if ($this->Auth->user('role') == "admin")
$this->Auth->allow("*");
else if ($this->Auth->user())
{
// $this->Auth->allow('index', 'view', 'add', 'delete', 'edit');
foreach ($this->methods as $method)
if (mb_strpos($method, 'admin_') !== 0)
$this->Auth->allow($method);
}
}
function isAuthorized() {
/* if (isset($this->params['prefix']) && $this->params['prefix'] == "admin" && $this->Auth->user('role') != "admin")
{
return false;
}
return true;*/
$action = $this->params['action'];
$allowedActions = array_map('strtolower', $this->Auth->allowedActions);
$isAllowed = (
$this->Auth->allowedActions == array('*') ||
in_array($action, $allowedActions)
);
// $this->log($isAllowed);
return $isAllowed;
//
}
}

View file

@ -0,0 +1,128 @@
<?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 add() {
if (!empty($this->data)) {
$this->FileIdentifier->create();
if ($this->FileIdentifier->save($this->data)) {
$this->Session->setFlash(__('The file identifier has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
}
}
$importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
$this->set(compact('importedTranslationFiles', 'identifiers'));
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid file identifier', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->FileIdentifier->save($this->data)) {
$this->Session->setFlash(__('The file identifier has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The file identifier could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->FileIdentifier->read(null, $id);
}
$importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
$this->set(compact('importedTranslationFiles', 'identifiers'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for file identifier', true));
$this->redirect(array('action'=>'index'));
}
if ($this->FileIdentifier->delete($id)) {
$this->Session->setFlash(__('File identifier deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('File identifier was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
$this->FileIdentifier->recursive = 0;
$this->set('fileIdentifiers', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid file identifier', true));
$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));
}
}
if (empty($this->data)) {
$this->data = $this->FileIdentifier->read(null, $id);
}
$importedTranslationFiles = $this->FileIdentifier->ImportedTranslationFile->find('list');
$identifiers = $this->FileIdentifier->Identifier->find('list');
$this->set(compact('importedTranslationFiles', 'identifiers'));
}
function 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,156 @@
<?php
class IdentifiersController extends AppController {
var $name = 'Identifiers';
// var $layout = "new";
function index() {
$this->Identifier->recursive = 0;
// Router::connectNamed(array('language'));
$conditions = null;
if (isset($this->passedArgs['language']) && $lang = $this->passedArgs['language'])
$conditions = array('Identifier.language_id' => $lang);
if (isset($this->passedArgs['translation_file_id']) && $translation_file_id = $this->passedArgs['translation_file_id'])
$conditions = array('Identifier.translation_file_id' => $translation_file_id);
$this->set('identifiers', $this->paginate($conditions));
}
function admin_withoutBestTranslation()
{
if (isset($this->passedArgs['imported_translation_file_id']) && $imported_translation_file_id = $this->passedArgs['imported_translation_file_id'])
{
$identifier_ids = $this->Identifier->withoutBestTranslation(array('ImportedTranslationFile.id' => $this->passedArgs['imported_translation_file_id']));
if ($identifier_ids === false)
{
$this->Session->setFlash(__('Error: no conditions specified', true));
}
else
{
$conditions = array('Identifier.id' => $identifier_ids, 'BestTranslation.id' => NULL);
$this->set('identifiers', $this->paginate($conditions));
}
// $this->log($this->Identifier->withoutBestTranslation(array('ImportedTranslationFile.id' => $this->passedArgs['imported_translation_file_id'])));
// TOTHINK: try to achieve that with custom find with pagination
}
else
{
$this->Session->setFlash(__('No imported file specified', true));
$this->redirect($this->referer());
}
$this->render('index');
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid identifier', true));
$this->redirect(array('action' => 'index'));
}
$this->set('identifier', $this->Identifier->read(null, $id));
}
function add() {
if (!empty($this->data)) {
$this->Identifier->create();
if ($this->Identifier->save($this->data)) {
$this->Session->setFlash(__('The identifier has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The identifier could not be saved. Please, try again.', true));
}
}
$languages = $this->Identifier->Language->find('list');
$this->set(compact('languages'));
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid identifier', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Identifier->save($this->data)) {
$this->Session->setFlash(__('The identifier has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The identifier could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Identifier->read(null, $id);
}
$languages = $this->Identifier->Language->find('list');
$this->set(compact('languages'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for identifier', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Identifier->delete($id)) {
$this->Session->setFlash(__('Identifier deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Identifier was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
$this->Identifier->recursive = 0;
$this->set('identifiers', $this->paginate());
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid identifier', true));
$this->redirect(array('action' => 'index'));
}
$this->set('identifier', $this->Identifier->read(null, $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));
}
}
if (empty($this->data)) {
$this->data = $this->Identifier->read(null, $id);
}
$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,210 @@
<?php
class ImportedTranslationFilesController extends AppController {
var $name = 'ImportedTranslationFiles';
// var $layout = "default_debug";
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));
// var_dump($this->ImportedTranslationFile->RawFile);
}
function admin_import($filename = null) {
// $this->view = "index";
App::import("Vendor","UxtParser", array("file" => 'UxtParser.php'));
/* if (!$filename) {
$this->Session->setFlash(__('Invalid file', true));
$this->redirect(array('action' => 'index'));
return 0;
}*/
$filename="diff/pl_diff_4DEC868A.uxt";
$translationFile = $this->ImportedTranslationFile->find('first', array('conditions' => array('ImportedTranslationFile.filename' => $filename)));
if ($translationFile)
{
$this->Session->setFlash(__('Translation file already imported', true));
$this->redirect(array('action' => 'index'));
return 0;
}
// var_dump($file);
$parser = new UxtParser();
$parsedFile = $parser->parseFile($filename);
// var_dump($parsedFile);
$arr = explode("_", basename($filename, ".uxt"));
// var_dump($arr);
$language_id = 1;
$this->ImportedTranslationFile->create();
$data['ImportedTranslationFile']['language_id'] = $language_id;
$data['ImportedTranslationFile']['filename'] = $filename;
//$this->ImportedTranslationFile->save($data);
foreach ($parsedFile as $ent)
{
$fi_data = array();
if ($ent['type'] != "string")
continue;
$i_data['language_id'] = $language_id;
$i_data['translation_index'] = $ent['index'];
$i_data['reference_string'] = $ent['string'];
unset($this->ImportedTranslationFile->Language->Identifier->id);
$identifier = $this->ImportedTranslationFile->Language->Identifier->find('first',array('conditions' => array('Identifier.identifier' => $ent['identifier'], 'Identifier.language_id' => $language_id)));
if ($identifier)
{
// var_dump($identifier);
$i_data['id']=$identifier['Identifier']['id'];
}
else
{
$i_data['identifier'] = $ent['identifier'];
$i_data['translated'] = false;
}
var_dump($i_data);
$this->ImportedTranslationFile->Language->Identifier->save(array('Identifier' => $i_data));
$identifier_id = $this->ImportedTranslationFile->Language->Identifier->id;
var_dump($identifier_id);
unset($this->ImportedTranslationFile->FileIdentifier->id);
//TODO - set FileIdentifier['id'] if we import already imported file (imported imported file temporarly disabled)
// $identifier = $this->ImportedTranslationFile->FileIdentifier->find('first',array('conditions' => array('FileIdentifier.identifier' => $ent['identifier'], 'FileIdentifier.translation_file_id' => $)));
// $data['FileIdentifier']['translation_file_id'] = $this->ImportedTranslationFile->id;
if ($ent['diff'])
$fi_data['command'] = "DIFF " . mb_strtoupper($ent['diff']);
$fi_data['translation_index'] = $ent['index'];
// $data['FileIdentifier']['identifier_id'] = ;
$fi_data['reference_string'] = $ent['string'];
$fi_data['identifier_id'] = $identifier_id;
// $this->ImportedTranslationFile->FileIdentifier->create();
// $this->ImportedTranslationFile->FileIdentifier->save($data);
$data['FileIdentifier'][] = $fi_data;
// $l_data['Language']['id'] = $language_id;
// $l_data['Identifier'][] = $i_data;
// $data['Identifier'][] = $i_data;
}
// var_dump($data);
// $this->ImportedTranslationFile->Language->saveAll($l_data);
$this->ImportedTranslationFile->saveAll($data);
$this->Session->setFlash(__('Translation file imported', true));
$this->redirect(array('action' => 'view', $this->ImportedTranslationFile->id));
$this->ImportedTranslationFile->recursive = 0;
$this->set('importedTranslationFiles', $this->paginate());
// $this->render('index');
}
function add() {
if (!empty($this->data)) {
$this->ImportedTranslationFile->create();
if ($this->ImportedTranslationFile->save($this->data)) {
$this->Session->setFlash(__('The translation file has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
}
}
$languages = $this->ImportedTranslationFile->Language->find('list');
$this->set(compact('languages'));
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid translation file', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->ImportedTranslationFile->save($this->data)) {
$this->Session->setFlash(__('The translation file has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation file could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->ImportedTranslationFile->read(null, $id);
}
$languages = $this->ImportedTranslationFile->Language->find('list');
$this->set(compact('languages'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for translation file', true));
$this->redirect(array('action'=>'index'));
}
if ($this->ImportedTranslationFile->delete($id)) {
$this->Session->setFlash(__('Translation file deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('Translation file was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
$this->ImportedTranslationFile->recursive = 0;
// FireCake::dump("??",$_SERVER);
$this->set('importedTranslationFiles', $this->paginate());
}
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));
}
}
if (empty($this->data)) {
$this->data = $this->ImportedTranslationFile->read(null, $id);
}
$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,122 @@
<?php
class LanguagesController extends AppController {
var $name = 'Languages';
var $layout="new";
function index() {
/* App::import('Vendor', 'DebugKit.FireCake');
FireCake::enable();
firecake('testestestes');
FireCake::dump('test','testsss');*/
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 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,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,559 @@
<?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;
// var_dump($this->RawFile->find('count'));
// $db =& ConnectionManager::getDataSource($this->RawFile->useDbConfig);
// var_dump($db->calculate($this->RawFile, 'count'));
$conditions['RawFile.dir'] = array("diff","translated");
$this->set('rawFiles', $this->paginate($conditions));
// $this->log(Router::parse($this->referer()));
// var_dump($this->paginate());
}
function admin_listdir($extension = null) {
$this->RawFile->recursive = 0;
$this->set('rawFiles', $this->paginate(array("RawFile.extension" => $extension)));
$this->rendeR("admin_index");
// var_dump($this->paginate());
}
function admin_view($dir = null, $filename = null) {
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;
}
// $id = $dir . DS . $filename;
// $this->set('rawFile', $this->RawFile->read(null, $id));
$this->set('rawFile', $rawFile = $this->RawFile->find('first', array(
"conditions" => array(
"RawFile.dir" => $dir,
"RawFile.filename" => $filename,
),
)));
$this->set('fileContent', $this->RawFile->_currentFile->read());
}
/* function import($dir = null, $filename = null) {
$this->admin_import($dir, $filename);
}*/
function admin_import($dir = null, $filename = null) {
// $this->view = "index";
// App::import("Vendor","UxtParser", array("file" => 'UxtParser.php'));
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 = $languageModel->Identifier;
$identifierModel = $translationFileModel->Identifier;
$identifierColumnModel = $identifierModel->IdentifierColumn;
$translationModel = $identifierModel->Translation;
$fileIdentifierModel = $importedTranslationFileModel->FileIdentifier;
// $filename="diff/pl_diff_4DEC868A.uxt";
$importedTranslationFile = $importedTranslationFileModel->find('first', array('conditions' => array('ImportedTranslationFile.filename' => $dir . DS . $filename), "recursive" => -1));
/* var_dump($translationFile);
return 0;*/
if ($importedTranslationFile)
{
$this->Session->setFlash(__('Translation file already imported', true));
$this->redirect(array('action' => 'index'));
return 0;
}
// var_dump($file);
// $parser = new UxtParser();
// $arr = explode("_", basename($filename, ".uxt"));
// var_dump($arr);
// $language_id = 1;
$languageCode = $this->RawFile->getLanguageCode($filename);
if (!$languageCode)
{
$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;
}
else
{
// var_dump($language_id);
}
$filename_template = preg_replace('/_diff/', '', $filename);
$filename_template = preg_replace('/_[A-F0-9]{8}/', '', $filename_template);
// for global identifiers
/* if (preg_match('|^.*_' . $language['Language']['code'] . '.*$|', $filename_template, $matches))
$filename_template = preg_replace('/_' . $language['Language']['code'] . '/', '_LC', $filename_template);
else if (preg_match('|^.*' . $language['Language']['code'] . '.*$|', $filename_template, $matches))
$filename_template = preg_replace('/' . $language['Language']['code'] . '/', 'LC', $filename_template);
else
{
$this->Session->setFlash(__('Can\'t create master translation filename template from current filename', true));
$this->redirect(array('action' => 'index'));
return 0;
}*/
$translationFile = $translationFileModel->find('first', array('conditions' => array('filename_template' => $filename_template), "recursive" => -1));
if (!$translationFile)
{
$tf_data['filename_template'] = $filename_template;
$tf_data['language_id'] = $language_id;
}
else
$tf_data['id'] = $translationFile['TranslationFile']['id'];
$res = $translationFileModel->saveAll(array('TranslationFile' => $tf_data));
$translation_file_id = $translationFileModel->id;
$parsedFile = $this->RawFile->parseFile();
/* var_dump($parsedFile);
$this->render('index');
return 0;*/
// $this->log($parsedFile);
if (!$parsedFile)
{
$this->Session->setFlash(__('Error importing file', true));
$this->redirect(array('action' => 'index'));
return 0;
}
// $this->log($parsedFile);
// return 0;
ini_set('max_execution_time',0);
$processedEntities = 0;
$importedTranslationFileModel->create();
$data['ImportedTranslationFile']['language_id'] = $language_id;
$data['ImportedTranslationFile']['translation_file_id'] = $translation_file_id;
$data['ImportedTranslationFile']['filename'] = $dir . DS . $filename;
$data['ImportedTranslationFile']['file_last_modified_date'] = $this->RawFile->_currentFileLastChange;
// $data['TranslationFile'] = $tf_data;
$importedTranslationFileModel->saveAll($data);
$importedTranslationFile_id = $importedTranslationFileModel->id;
//$this->ImportedTranslationFile->save($data);
foreach ($parsedFile as $ent)
{
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['diff']) && isset($ent['string']))
{
$i_data['reference_string'] = $ent['string'];
}
unset($identifierModel->id);
$identifier = $identifierModel->find('first',array('conditions' => array('Identifier.identifier' => $ent['identifier'], 'Identifier.translation_file_id' => $translation_file_id), 'contain' => 'IdentifierColumn'));
//App::import('Vendor', 'DebugKit.FireCake');
// FireCake::log($ent['identifier'], "Identifier");
// FireCake::dump("identifier",$identifier);
/* $this->log($ent['identifier']);
$this->log($identifier);*/
if ($identifier)
{
// var_dump($identifier);
$i_data['id']=$identifier['Identifier']['id'];
// $this->log("found");
}
else
{
$identifierModel->create();
$i_data['identifier'] = $ent['identifier'];
if (isset($ent['diff']))
$i_data['translated'] = false;
$newIdentifier = true;
// $this->log("not found");
// $this->log("id: # " . $identifierModel->id . " #");
// $this->log($i_data);
}
// var_dump($i_data);
$res = $identifierModel->saveAll($tarr = array('Identifier' => $i_data));
$identifier_id = $identifierModel->id;
/* $this->log('identifier saveAll res');
$this->log($res);
$this->log(var_export($res,true));
$this->log($identifierModel->validationErrors);
$this->log($identifierModel);
$this->log('#identifier id');
$this->log($identifier_id);
$this->log("tarr");
$this->log($tarr);*/
if (isset($ent['columns']) && is_array($ent['columns']))
{
/* $this->log($_columns);
$this->log($ent['columns']);*/
$ic_data = array();
foreach ($ent['columns'] as $column_no => $value)
{
unset($identifierColumnModel->id);
$ic_arr = array();
$ic_arr['identifier_id'] = $identifier_id;
$column_name = $_columns[$column_no];
/* $this->log($identifier);
$this->log($column_name);*/
if (!$newIdentifier)
{
foreach ($identifier['IdentifierColumn'] as $identifierColumn_no => $identifierColumn)
{
if ($identifierColumn['column_name'] == $column_name)
{
$ic_arr['id'] = $identifierColumn['id'];
break;
}
}
}
$ic_arr['column_name'] = $column_name;
if (isset($ent['diff']))
$ic_arr['reference_string'] = $value;
$ic_data[] = $ic_arr;
// $this->log($ic_arr);
$res = $identifierColumnModel->save($ic_arr);
// $this->log($res);
$identifierColumn_id = $identifierColumnModel->id;
/* $this->log($identifierColumnModel->validationErrors);
$this->log(var_export($res,true));*/
if (!isset($ent['diff'])) // it is translated file and we add translation
{
unset($translationModel->id);
if ($newIdentifier) // ovbiously there's no translation for identifier we just created
$translation = array();
else
$translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_column_id' => $identifierColumn_id, 'Translation.translation_text' => $value), "recursive" => -1));
if (!$translation)
{
$t_data['identifier_column_id'] = $identifierColumn_id;
$t_data['translation_text'] = $value;
// TODO: change user_id for authorized user
$t_data['user_id'] = 1;
}
else
$t_data['id'] = $translation['Translation']['id'];
// var_dump($i_data);
$translationModel->save(array('Translation' => $t_data));
}
}
/* $res = $identifierColumnModel->saveAll($tarr = array('IdentifierColumn' => $ic_data));
$this->log($tarr);
$this->log(var_export($res,true));
$this->log($identifierColumnModel->validationErrors);*/
}
else
{
if (!isset($ent['diff'])) // it is translated file and we add translation
{
unset($translationModel->id);
if ($newIdentifier) // ovbiously there's no translation for identifier we just created
$translation = array();
else
$translation = $translationModel->find('first',array('conditions' => array('Translation.identifier_id' => $identifier_id, 'Translation.translation_text' => $ent["string"]), "recursive" => -1));
if (!$translation)
{
$t_data['identifier_id'] = $identifier_id;
if (isset($ent['string'])) // sheets doesn't have string (they have columns)
$t_data['translation_text'] = $ent['string'];
// TODO: change user_id for authorized user
$t_data['user_id'] = 1;
}
else
$t_data['id'] = $translation['Translation']['id'];
// var_dump($i_data);
$translationModel->save(array('Translation' => $t_data));
}
}
unset($fileIdentifierModel->id);
$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'];
// $data['FileIdentifier']['identifier_id'] = ;
$fi_data['identifier_id'] = $identifier_id;
$res = $fileIdentifierModel->saveAll($tarr = array('FileIdentifier' => $fi_data));
// $this->log($res);
/* $this->log("#fi_data");
$this->log($fi_data);*/
$fileIdentifier_id = $fileIdentifierModel->id;
}
// $this->ImportedTranslationFile->FileIdentifier->create();
// $this->ImportedTranslationFile->FileIdentifier->save($data);
// $data['FileIdentifier'][] = $fi_data;
// $l_data['Language']['id'] = $language_id;
// $l_data['Identifier'][] = $i_data;
// $data['Identifier'][] = $i_data;
$processedEntities++;
}
/* $this->render('admin_index');
return 0;*/
// var_dump($data);
// $this->ImportedTranslationFile->Language->saveAll($l_data);
if ($processedEntities == 0)
{
$importedTranslationFileModel->delete($importedTranslationFile_id);
$this->Session->setFlash(__('File was not imported because it seems empty', true));
// $this->redirect(array('action' => 'index'));
$this->redirect($this->referer());
return 0;
}
else
{
$this->Session->setFlash(__('Translation file imported into database successfully. Processed entities: ' . $processedEntities, true));
$this->redirect(array('controller' => 'imported_translation_files', 'action' => 'view', $importedTranslationFileModel->id));
// $this->render('admin_index');
return 0;
}
// $this->ImportedTranslationFile->recursive = 0;
// $this->set('importedTranslationFiles', $this->paginate());
// $this->render('index');
}
function admin_export($dir = null, $filename = null, $importedTranslationFileId = null) {
if (!$filename) {
$this->Session->setFlash(__('Invalid file', true));
$this->redirect($this->referer());
// $this->redirect(array('action' => 'index'));
return 0;
}
if (!$this->RawFile->open($dir, $filename, $writable = true))
{
$this->Session->setFlash(__('Can\'t open file for writing', true));
$this->redirect($this->referer());
// $this->redirect(array('action' => 'index'));
return 0;
}
$importedTranslationFileModel = $this->RawFile->ImportedTranslationFile;
$importedTranslationFileModel->contain(array(
'TranslationFile',
'FileIdentifier' => array('Identifier' => array(
'Translation',
'IdentifierColumn' => 'Translation',
)),
));
$importedTranslationFile = $importedTranslationFileModel->find('first', array(
'conditions' => array(
'ImportedTranslationFile.filename' => $dir . DS . $filename
),
// 'recursive' => 3
// 'order' => 'FileIdentifier.translation_index',
)
);
/* var_dump($translationFile);
return 0;*/
if (!$importedTranslationFile)
{
$this->Session->setFlash(__('No imported translation file found for chosen file', true));
$this->redirect($this->referer());
// $this->redirect(array('controller' => 'imported_translation_files', 'action' => 'index'));
return 0;
}
$translationFileModel = $importedTranslationFileModel->TranslationFile;
$identifierModel = $translationFileModel->Identifier;
// TODO: check if all identifiers have "best" translation
$identifier_ids = $identifierModel->withoutBestTranslation(array('ImportedTranslationFile.id' => $importedTranslationFile['ImportedTranslationFile']['id']));
if ($identifier_ids === false)
{
$this->Session->setFlash(__('Error: no conditions specified', true));
$this->redirect($this->referer());
return 0;
}
else if (count($identifier_ids) > 0)
{
$this->Session->setFlash(__('Best translation is not set for some of the identifiers in this file. Set best translation before export.', true));
$this->redirect(array('controller' => 'identifiers', 'action' => 'withoutBestTranslation', 'imported_translation_file_id' => $importedTranslationFile['ImportedTranslationFile']['id']));
return 0;
}
$translationFile_id = $importedTranslationFile['ImportedTranslationFile']['translation_file_id'];
$i=0;
$sortResult = Set::sort($importedTranslationFile['FileIdentifier'], '{n}.translation_index', 'asc');
if (!$sortResult)
{
$this->Session->setFlash(__('Sorting error', true));
$this->redirect($this->referer());
return 0;
}
foreach ($sortResult as $fileIdentifier)
{
if ($fileIdentifier['Identifier']['IdentifierColumn'] && !isset($entities[0]))
{
foreach ($fileIdentifier['Identifier']['IdentifierColumn'] as $column_no => $identifierColumn)
$_columns[$column_no] = $identifierColumn['column_name'];
$ent['columns'] = $_columns;
$ent['type'] = 'sheet_description';
$ent['sheet_id_column'] = $fileIdentifier['arguments'];
$ent['diff'] = ((isset($fileIdentifier['command']) && !empty($fileIdentifier['command'])) ? true : null);
$entities[] = $ent;
$ent = array();
}
$ent = array(
'diff' => ((isset($fileIdentifier['command']) && !empty($fileIdentifier['command'])) ? $fileIdentifier['command'] : null),
'command' => ((isset($fileIdentifier['command']) && !empty($fileIdentifier['command'])) ? $fileIdentifier['command'] : null),
'index' => ((isset($fileIdentifier['translation_index']) && !empty($fileIdentifier['translation_index'])) ? $fileIdentifier['translation_index'] : null),
'internal_index' => $i++,
'type' => ((count($fileIdentifier['Identifier']['IdentifierColumn']) > 0) ? 'sheet' : 'string'),
// 'type' => ((isset($fileIdentifier['command']) && !empty($fileIdentifier['command'])) ? $fileIdentifier['command'] : null),
'identifier' => $fileIdentifier['Identifier']['identifier'],
'arguments' => ((isset($fileIdentifier['arguments']) && !empty($fileIdentifier['arguments'])) ? $fileIdentifier['arguments'] : null),
// 'string' => '',
);
// $this->log($fileIdentifier['Identifier']['Translation']);
// if (Set::numeric(array_keys($fileIdentifier['Identifier']['Translation'])))
if (isset($fileIdentifier['Identifier']['Translation'][0]))
{
// $this->log('numeric');
$ent['string'] = $fileIdentifier['Identifier']['Translation'][0]['translation_text'];
}
else if (isset($fileIdentifier['Identifier']['Translation']['translation_text']))
$ent['string'] = $fileIdentifier['Identifier']['Translation']['translation_text'];
if (isset($fileIdentifier['Identifier']['BestTranslation']['translation_text']))
$ent['string'] = $fileIdentifier['Identifier']['BestTranslation']['translation_text'];
if (($export_reference_if_empty_translation = true) && !isset($ent['string']))
$ent['string'] = $fileIdentifier['Identifier']['reference_string'];
else if (!isset($ent['string']))
$ent['string'] = '';
foreach ($fileIdentifier['Identifier']['IdentifierColumn'] as $column_no => $identifierColumn)
{
/* if (isset($identifierColumn['Translation']['translation_text']))
$ent['columns'][$column_no] = $identifierColumn['Translation']['translation_text'];*/
if (isset($identifierColumn['Translation'][0]))
$ent['columns'][$column_no] = $identifierColumn['Translation'][0]['translation_text'];
else if (isset($identifierColumn['Translation']['translation_text']))
$ent['columns'][$column_no] = $identifierColumn['Translation']['translation_text'];
if (isset($identifierColumn['BestTranslation']['translation_text']))
$ent['columns'][$column_no] = $identifierColumn['BestTranslation']['translation_text'];
if ($export_reference_if_empty_translation && !isset($ent['columns'][$column_no]))
$ent['columns'][$column_no] = $identifierColumn['reference_string'];
else if (!isset($ent['columns'][$column_no]))
$ent['columns'][$column_no] = '';
}
if ($fileIdentifier['command'])
$ent['command'] = $ent['diff'] = $fileIdentifier['command'];
$entities[] = $ent;
}
/* $sources = ConnectionManager::sourceList();
$sqlLogs = array();
foreach ($sources as $source)
{
$db =& ConnectionManager::getDataSource($source);
if (!$db->isInterfaceSupported('getLog'))
continue;
$sqlLogs[$source] = $db->getLog();
}
$this->log($sqlLogs);*/
// $this->log($importedTranslationFile);
/* $this->log($sortResult);
$this->log($entities);*/
ini_set('max_execution_time',0);
$result = $this->RawFile->buildFile($entities);
// $this->log($result);
// $this->render('admin_index');
// $this->redirect(array('controller' => 'imported_translation_files', 'action' => 'index'));
// return 0;
/* var_dump($parsedFile);
$this->render('index');
return 0;*/
// $this->log($parsedFile);
if (!$result)
{
$this->Session->setFlash(__('Error exporting file', true));
$this->redirect(array('action' => 'index'));
return 0;
}
}
}

View file

@ -0,0 +1,162 @@
<?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->recursive=2;
$this->set('translation', $translation = $this->Translation->read(null, $id));
$this->set('identifier', $identifier = $this->Translation->Identifier->read(null, $translation['Translation']['identifier_id']));
// var_dump($translation);
// var_dump($identifier);
}
function add() {
if (!empty($this->data)) {
$this->Translation->create();
if ($res = $this->Translation->save($this->data)) {
$this->Session->setFlash(__('The translation has been saved', true));
$this->redirect(array('action' => 'index', 'identifier_id' => $res['Translation']['identifier_id']));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
}
if (empty($this->passedArgs['identifier_id']))
{
$this->Session->setFlash(__('You need to choose identifier for translation', true));
$this->redirect(array('controller' => 'identifiers', 'action' => 'index'));
}
else
{
$identifier_id = $this->passedArgs['identifier_id'];
$this->set('identifier', $identifier = $this->Translation->Identifier->read(null, $identifier_id));
// $this->data['Translation.identifier_id'] = $identifier_id;
}
// $identifiers = $this->Translation->Identifier->find('list', array('recursive' => -1));
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users'));
}
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->Translation->save($this->data)) {
$this->Session->setFlash(__('The translation has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Translation->read(null, $id);
}
// var_dump($this->data);
$identifier = $this->Translation->Identifier->read(null, $this->data['Translation']['identifier_id']);
$identifiers = $this->Translation->Identifier->find('list');
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users', 'identifier'));
}
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(array('action'=>'index'));
$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());
// $this->index();
// $this->render('index');
}
function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid translation', true));
$this->redirect(array('action' => 'index'));
}
$this->set('translation', $this->Translation->read(null, $id));
}
function admin_add() {
if (!empty($this->data)) {
$this->Translation->create();
if ($this->Translation->save($this->data)) {
$this->Session->setFlash(__('The translation has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
}
$identifiers = $this->Translation->Identifier->find('list');
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users'));
}
function admin_edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid translation', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Translation->save($this->data)) {
$this->Session->setFlash(__('The translation has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The translation could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Translation->read(null, $id);
}
$identifiers = $this->Translation->Identifier->find('list');
$users = $this->Translation->User->find('list');
$this->set(compact('identifiers', 'users'));
}
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,174 @@
<?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 add() {
if (!empty($this->data)) {
$this->User->create();
if ($this->User->save($this->data)) {
$this->Session->setFlash(__('The user has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
}
}
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid user', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->Session->setFlash(__('The user has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->User->read(null, $id);
}
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for user', true));
$this->redirect(array('action'=>'index'));
}
if ($this->User->delete($id)) {
$this->Session->setFlash(__('User deleted', true));
$this->redirect(array('action'=>'index'));
}
$this->Session->setFlash(__('User was not deleted', true));
$this->redirect(array('action' => 'index'));
}
function admin_index() {
$this->User->recursive = 0;
$this->set('users', $this->paginate());
}
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));
}
}
if (empty($this->data)) {
$this->data = $this->User->read(null, $id);
}
}
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() {
}
function logout() {
$this->redirect($this->Auth->logout());
}
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow(array('register', 'login', 'logout', 'confirm'));
}
function register() {
if(!empty($this->data)) {
$this->User->create();
/* $assigned_password = 'newpass';
$this->data['User']['password'] = $this->Auth->password($assigned_password);*/
$this->data['User']['password'] = $this->Auth->password($this->data['User']['passwd']);
$this->data['User']['confirm_hash'] = $this->Auth->password($this->data['User']['name'] . time());
if($user = $this->User->save($this->data)) {
// send signup email containing password to the user
// $this->Session->setFlash('your password is ' . $assigned_password);
// $this->Session->setFlash('your password is ' . var_export($this->data['User']['password'], true));
// $this->Auth->login($this->data);
// $this->Email->delivery = 'debug';
$this->Email->from = 'webtt-noreply@openlink.pl';
$this->Email->to = $user['User']['email'];
$this->Email->subject = 'WebTT registration';
$this->Email->sendAs = 'text';
$this->Email->template = 'registration';
$this->set('user', $this->data);
$this->set('serverName', $_SERVER['SERVER_NAME']);
$this->params['url']['ext'] = 'no_debug';
// var_dump($this->helpers);
unset($this->helpers['DebugKit.Toolbar']);
$this->Email->send();
$this->Session->setFlash('Thank you for registreation. Please use confirm link from email to finalize registration.');
$this->redirect('/');
}
}
}
function confirm($confirm_hash)
{
$user = $this->User->find('first', array('conditions' => array('User.confirm_hash' => $confirm_hash)));
if (!$user)
{
$this->Session->setFlash('No user found. Please register again.');
$this->redirect('/');
}
$this->User->id = $user['User']['id'];
$this->User->save(array('confirm_hash' => null));
$this->Session->setFlash('Thank you for registreation. You can now log in.');
$this->redirect('/');
}
}

View file

@ -0,0 +1,165 @@
<?php
class VotesController extends AppController {
var $name = 'Votes';
function index() {
$this->Vote->recursive = 0;
// var_dump($this->Vote->belongsTo);
// var_dump($this->Vote->getAssociated());
// $model = $this->{$this->modelClass};
// $this->log($tree=$this->PathResolver->getAssociationsTree($model));
// $this->log($this->PathResolver->getAssociationsGraph('User',$tree));
// $this->log($this->PathResolver->printPath($model), 'info');
// $this->log($this->PathResolver->node_path('Language', $tree));
$this->set('votes', $this->paginate());
}
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']))
{
$this->Session->setFlash(__('You need to choose translation for your vote', true));
$this->redirect(array('controller' => 'translations', 'action' => 'index'));
}
else
{
$translation_id = $this->passedArgs['translation'];
$translation = $this->Vote->Translation->read(null, $translation_id);
if (!$translation)
{
$this->Session->setFlash(__("Translation doesn't exist.", true));
$this->redirect(array('controller' => 'translations', 'action' => 'index'));
}
$vote = array("Vote" => array(
'translation_id' => $translation_id,
// TODO: authorized user
'user_id' => 1,
),
);
$this->Vote->create();
$this->Vote->save($vote);
$this->Session->setFlash(__('Vote added', true));
$this->redirect($this->referer(array('controller' => 'translations', 'action' => 'index')));
// $this->redirect(array('controller' => 'translations', 'action' => 'index'));
// $this->data['Translation.identifier_id'] = $identifier_id;
}
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid vote', true));
$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,38 @@
<?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 $useDbConfig = 'raw_files';
var $scaffoldForbiddenActions = null;
var $scaffoldActions = null;
}

View file

@ -0,0 +1,286 @@
<?php
/**
* Comma Separated Values Datasource
*
* 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 datasources
* @subpackage datasources.models.datasources
* @since CakePHP Datasources v 0.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* A CakePHP datasource for interacting with files using comma separated value storage.
*
* Create a datasource in your config/database.php
* public $csvfile = array(
* 'datasource' => 'Datasources.CsvSource',
* 'path' => '/path/to/file', // Path
* 'extension' => 'csv', // File extension
* 'readonly' => true, // Mark for read only access
* 'recursive' => false // Only false is supported at the moment
* );
*/
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,26 @@
<?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");
//The Associations below have been created with all possible keys, those that are not needed can be removed
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,133 @@
<?php
class Identifier extends AppModel {
var $name = 'Identifier';
var $displayField = 'identifier';
var $actsAs = array('Containable');
var $validate = array(
/* 'translation_index' => array(
'numeric' => array(
'rule' => array('numeric'),
'message' => 'Your custom message here',
'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),*/
'identifier' => array(
'A_Za_z0_9' => array(
'rule' => '/[A-Za-z0-9_@]+/',
'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");
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
/* 'Language' => array(
'className' => 'Language',
'foreignKey' => 'language_id',
'conditions' => '',
'fields' => '',
'order' => ''
),*/
'TranslationFile' => array(
'className' => 'TranslationFile',
'foreignKey' => 'translation_file_id',
'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;
}
}

View file

@ -0,0 +1,56 @@
<?php
class ImportedTranslationFile extends AppModel {
var $name = 'ImportedTranslationFile';
var $displayField = 'filename';
var $scaffoldForbiddenActions = array("index", "add", "admin_add", "edit", "admin_edit", "delete", "admin_delete");
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $actsAs = array('Containable');
var $belongsTo = array(
'Language' => array(
'className' => 'Language',
'foreignKey' => 'language_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'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,51 @@
<?php
class Language extends AppModel {
var $name = 'Language';
var $displayField = 'name';
var $scaffoldForbiddenActions = array("add", "edit", "delete");
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $hasMany = array(
'TranslationFile' => array(
'className' => 'TranslationFile',
'foreignKey' => 'language_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'ImportedTranslationFile' => array(
'className' => 'ImportedTranslationFile',
'foreignKey' => 'language_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Identifier' => array(
'className' => 'Identifier',
'foreignKey' => 'language_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
);
}

View file

@ -0,0 +1,152 @@
<?php
class RawFile extends AppModel {
var $name = 'RawFile';
var $useDbConfig = 'raw_files';
var $displayField = 'filename';
// var $useTable = false;
var $primaryKey = 'filename';
var $_parser;
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'ImportedTranslationFile' => array(
'className' => 'ImportedTranslationFile',
'foreignKey' => 'filename',
'conditions' => '',
'fields' => '',
'order' => ''
),
);
/* var $hasOne = array(
'FileIdentifier' => array(
'className' => 'FileIdentifier',
'foreignKey' => 'translation_file_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);*/
public function open($dir, $filename, $write = false)
{
$this->_currentFile = null;
$this->_currentFileLastModified = null;
$ds = $this->getDataSource();
$file = new File($filepath = $ds->config['path'] . DS . $dir . DS . $filename, false);
if (!$file)
return false;
if (!$file->readable())
return false;
if ($write && !$file->writable())
return false;
// var_dump($filename);
$this->_currentFile = $file;
$this->_currentFileLastChange = $file->lastChange();
return $file;
}
public function parseFile()
{
// var_dump($this->_currentFile);
if (!$this->_currentFile)
return false;
// TODO: file types array with filenames regex
if (
preg_match('|^([a-z]{2})_diff_[A-F0-9]{8}\.uxt$|', $this->_currentFile->name, $matches)
|| preg_match('|^([a-z]{2})\.uxt$|', $this->_currentFile->name, $matches)
|| preg_match('|^r2_([a-z]{2})\.uxt$|', $this->_currentFile->name, $matches)
)
{
App::import("Vendor","StringParser", array("file" => 'StringParser.php'));
$parser = $this->_parser = new StringParser();
}
else if (
preg_match('|^phrase_([a-z]{2})_diff_[A-F0-9]{8}\.txt$|', $this->_currentFile->name, $matches)
|| preg_match('|^phrase_([a-z]{2})\.txt$|', $this->_currentFile->name, $matches)
)
{
App::import("Vendor","PhraseParser", array("file" => 'PhraseParser.php'));
$parser = $this->_parser = new PhraseParser();
}
else if (preg_match('|^.*_words_([a-z]{2})_diff_[A-F0-9]{8}\..*$|', $this->_currentFile->name, $matches)
|| preg_match('|^.*_words_([a-z]{2})\..*$|', $this->_currentFile->name, $matches))
{
App::import("Vendor","SheetParser", array("file" => 'SheetParser.php'));
$parser = $this->_parser = new SheetParser();
}
else
{
return false;
}
$entities = $parser->parseFile($this->_currentFile->read());
return $entities;
}
public function buildFile($entities)
{
// var_dump($this->_currentFile);
if (!$this->_currentFile)
return false;
// TODO: file types array with filenames regex
if (
preg_match('|^([a-z]{2})_diff_[A-F0-9]{8}\.uxt$|', $this->_currentFile->name, $matches)
|| preg_match('|^([a-z]{2})\.uxt$|', $this->_currentFile->name, $matches)
|| preg_match('|^r2_([a-z]{2})\.uxt$|', $this->_currentFile->name, $matches)
)
{
App::import("Vendor","StringParser", array("file" => 'StringParser.php'));
$parser = $this->_parser = new StringParser();
}
else if (
preg_match('|^phrase_([a-z]{2})_diff_[A-F0-9]{8}\.txt$|', $this->_currentFile->name, $matches)
|| preg_match('|^phrase_([a-z]{2})\.txt$|', $this->_currentFile->name, $matches)
)
{
App::import("Vendor","PhraseParser", array("file" => 'PhraseParser.php'));
$parser = $this->_parser = new PhraseParser();
}
else if (preg_match('|^.*_words_([a-z]{2})_diff_[A-F0-9]{8}\..*$|', $this->_currentFile->name, $matches)
|| preg_match('|^.*_words_([a-z]{2})\..*$|', $this->_currentFile->name, $matches))
{
App::import("Vendor","SheetParser", array("file" => 'SheetParser.php'));
$parser = $this->_parser = new SheetParser();
}
else
{
return false;
}
$content = $parser->buildFile($entities);
$ret = $this->_currentFile->write($content);
return $ret;
}
public function getLanguageCode($filename)
{
// var_dump($filename);
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,87 @@
<?php
class Translation extends AppModel {
var $name = 'Translation';
var $displayField = 'translation_text';
var $scaffoldForbiddenActions = array();
var $scaffoldActions = array("add" => "fk", "index" => "fk");
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'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' => ''
)
);
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' => ''
),*/
);
function setBest()
{
if (!$this->id)
return false;
$this->read();
if (!isset($this->data['Translation']['identifier_id']))
return false;
// set best on chosen translation
$ret = $this->save(array('best' => 1));
$best_id = $this->id;
// reset best on other translations
$ret = $this->updateAll(array('Translation.best' => 0), array(
'AND' => array(
'Translation.identifier_id' => $ret['Translation']['identifier_id'],
'Translation.id !=' => $best_id,
),
));
$this->log($ret);
// TODO: test!
return $this->id;
}
}

View file

@ -0,0 +1,53 @@
<?php
class User extends AppModel {
var $name = 'User';
var $displayField = 'name';
var $validate = array(
'username' => array(
'alphaNumeric',
/* 'uniqueCheck' => array(
'rule' => 'isUnique',
'message' => 'That username has already been taken.',
),*/
),
'email' => array('rule' => 'email', 'message' => 'Wrong format'),
'name' => array('rule' => 'notEmpty'),
// 'password' => array('rule' => 'notEmpty'),
'passwd' => array('rule' => 'notEmpty'),
);
var $scaffoldForbiddenActions = array("add", "edit", "delete");
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $hasMany = array(
'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' => ''
)
);
}

View file

@ -0,0 +1,25 @@
<?php
class Vote extends AppModel {
var $name = 'Vote';
var $displayField = 'translation_id';
var $scaffoldForbiddenActions = array("delete");
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'Translation' => array(
'className' => 'Translation',
'foreignKey' => 'translation_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}

View file

@ -0,0 +1,66 @@
<?php
/* FileIdentifiers Test cases generated on: 2011-05-31 16:08:10 : 1306850890*/
App::import('Controller', 'FileIdentifiers');
class TestFileIdentifiersController extends FileIdentifiersController {
var $autoRender = false;
function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
}
}
class FileIdentifiersControllerTestCase extends CakeTestCase {
var $fixtures = array('app.file_identifier', 'app.translation_file', 'app.language', 'app.identifier', 'app.translation', 'app.user', 'app.vote');
function startTest() {
$this->FileIdentifiers =& new TestFileIdentifiersController();
$this->FileIdentifiers->constructClasses();
}
function endTest() {
unset($this->FileIdentifiers);
ClassRegistry::flush();
}
function testIndex() {
}
function testView() {
}
function testAdd() {
}
function testEdit() {
}
function testDelete() {
}
function testAdminIndex() {
}
function testAdminView() {
}
function testAdminAdd() {
}
function testAdminEdit() {
}
function testAdminDelete() {
}
}

View file

@ -0,0 +1,66 @@
<?php
/* Identifiers Test cases generated on: 2011-05-31 16:28:53 : 1306852133*/
App::import('Controller', 'Identifiers');
class TestIdentifiersController extends IdentifiersController {
var $autoRender = false;
function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
}
}
class IdentifiersControllerTestCase extends CakeTestCase {
var $fixtures = array('app.identifier', 'app.language', 'app.translation_file', 'app.file_identifier', 'app.translation', 'app.user', 'app.vote');
function startTest() {
$this->Identifiers =& new TestIdentifiersController();
$this->Identifiers->constructClasses();
}
function endTest() {
unset($this->Identifiers);
ClassRegistry::flush();
}
function testIndex() {
}
function testView() {
}
function testAdd() {
}
function testEdit() {
}
function testDelete() {
}
function testAdminIndex() {
}
function testAdminView() {
}
function testAdminAdd() {
}
function testAdminEdit() {
}
function testAdminDelete() {
}
}

View file

@ -0,0 +1,66 @@
<?php
/* Languages Test cases generated on: 2011-05-31 15:48:55 : 1306849735*/
App::import('Controller', 'Languages');
class TestLanguagesController extends LanguagesController {
var $autoRender = false;
function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
}
}
class LanguagesControllerTestCase extends CakeTestCase {
var $fixtures = array('app.language', 'app.identifier', 'app.translation', 'app.user', 'app.vote', 'app.translation_file');
function startTest() {
$this->Languages =& new TestLanguagesController();
$this->Languages->constructClasses();
}
function endTest() {
unset($this->Languages);
ClassRegistry::flush();
}
function testIndex() {
}
function testView() {
}
function testAdd() {
}
function testEdit() {
}
function testDelete() {
}
function testAdminIndex() {
}
function testAdminView() {
}
function testAdminAdd() {
}
function testAdminEdit() {
}
function testAdminDelete() {
}
}

View file

@ -0,0 +1,66 @@
<?php
/* TranslationFiles Test cases generated on: 2011-07-04 15:19:54 : 1309785594*/
App::import('Controller', 'TranslationFiles');
class TestTranslationFilesController extends TranslationFilesController {
var $autoRender = false;
function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
}
}
class TranslationFilesControllerTestCase extends CakeTestCase {
var $fixtures = array('app.translation_file', 'app.language', 'app.identifier', 'app.translation', 'app.user', 'app.vote', 'app.comment', 'app.file_identifier', 'app.imported_translation_file', 'app.raw_file');
function startTest() {
$this->TranslationFiles =& new TestTranslationFilesController();
$this->TranslationFiles->constructClasses();
}
function endTest() {
unset($this->TranslationFiles);
ClassRegistry::flush();
}
function testIndex() {
}
function testView() {
}
function testAdd() {
}
function testEdit() {
}
function testDelete() {
}
function testAdminIndex() {
}
function testAdminView() {
}
function testAdminAdd() {
}
function testAdminEdit() {
}
function testAdminDelete() {
}
}

View file

@ -0,0 +1,66 @@
<?php
/* Translations Test cases generated on: 2011-05-29 21:10:36 : 1306696236*/
App::import('Controller', 'Translations');
class TestTranslationsController extends TranslationsController {
var $autoRender = false;
function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
}
}
class TranslationsControllerTestCase extends CakeTestCase {
var $fixtures = array('app.translation', 'app.identifier', 'app.translation_file', 'app.language', 'app.user', 'app.vote');
function startTest() {
$this->Translations =& new TestTranslationsController();
$this->Translations->constructClasses();
}
function endTest() {
unset($this->Translations);
ClassRegistry::flush();
}
function testIndex() {
}
function testView() {
}
function testAdd() {
}
function testEdit() {
}
function testDelete() {
}
function testAdminIndex() {
}
function testAdminView() {
}
function testAdminAdd() {
}
function testAdminEdit() {
}
function testAdminDelete() {
}
}

View file

@ -0,0 +1,66 @@
<?php
/* Users Test cases generated on: 2011-05-29 21:10:58 : 1306696258*/
App::import('Controller', 'Users');
class TestUsersController extends UsersController {
var $autoRender = false;
function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
}
}
class UsersControllerTestCase extends CakeTestCase {
var $fixtures = array('app.user', 'app.translation', 'app.identifier', 'app.translation_file', 'app.language', 'app.vote');
function startTest() {
$this->Users =& new TestUsersController();
$this->Users->constructClasses();
}
function endTest() {
unset($this->Users);
ClassRegistry::flush();
}
function testIndex() {
}
function testView() {
}
function testAdd() {
}
function testEdit() {
}
function testDelete() {
}
function testAdminIndex() {
}
function testAdminView() {
}
function testAdminAdd() {
}
function testAdminEdit() {
}
function testAdminDelete() {
}
}

View file

@ -0,0 +1,66 @@
<?php
/* Votes Test cases generated on: 2011-05-29 21:12:06 : 1306696326*/
App::import('Controller', 'Votes');
class TestVotesController extends VotesController {
var $autoRender = false;
function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
}
}
class VotesControllerTestCase extends CakeTestCase {
var $fixtures = array('app.vote', 'app.translation', 'app.identifier', 'app.translation_file', 'app.language', 'app.user');
function startTest() {
$this->Votes =& new TestVotesController();
$this->Votes->constructClasses();
}
function endTest() {
unset($this->Votes);
ClassRegistry::flush();
}
function testIndex() {
}
function testView() {
}
function testAdd() {
}
function testEdit() {
}
function testDelete() {
}
function testAdminIndex() {
}
function testAdminView() {
}
function testAdminAdd() {
}
function testAdminEdit() {
}
function testAdminDelete() {
}
}

View file

@ -0,0 +1,17 @@
<?php
/* FileIdentifier Test cases generated on: 2011-05-31 16:07:59 : 1306850879*/
App::import('Model', 'FileIdentifier');
class FileIdentifierTestCase extends CakeTestCase {
var $fixtures = array('app.file_identifier', 'app.translation_file', 'app.language', 'app.identifier', 'app.translation', 'app.user', 'app.vote');
function startTest() {
$this->FileIdentifier =& ClassRegistry::init('FileIdentifier');
}
function endTest() {
unset($this->FileIdentifier);
ClassRegistry::flush();
}
}

View file

@ -0,0 +1,17 @@
<?php
/* Identifier Test cases generated on: 2011-05-29 19:17:37 : 1306689457*/
App::import('Model', 'Identifier');
class IdentifierTestCase extends CakeTestCase {
var $fixtures = array('app.identifier', 'app.translation_file', 'app.language', 'app.translation');
function startTest() {
$this->Identifier =& ClassRegistry::init('Identifier');
}
function endTest() {
unset($this->Identifier);
ClassRegistry::flush();
}
}

View file

@ -0,0 +1,17 @@
<?php
/* Language Test cases generated on: 2011-05-31 15:48:43 : 1306849723*/
App::import('Model', 'Language');
class LanguageTestCase extends CakeTestCase {
var $fixtures = array('app.language', 'app.identifier', 'app.translation', 'app.user', 'app.vote', 'app.translation_file');
function startTest() {
$this->Language =& ClassRegistry::init('Language');
}
function endTest() {
unset($this->Language);
ClassRegistry::flush();
}
}

View file

@ -0,0 +1,17 @@
<?php
/* Translation Test cases generated on: 2011-05-29 19:19:42 : 1306689582*/
App::import('Model', 'Translation');
class TranslationTestCase extends CakeTestCase {
var $fixtures = array('app.translation', 'app.identifier', 'app.translation_file', 'app.language', 'app.user', 'app.vote');
function startTest() {
$this->Translation =& ClassRegistry::init('Translation');
}
function endTest() {
unset($this->Translation);
ClassRegistry::flush();
}
}

View file

@ -0,0 +1,17 @@
<?php
/* TranslationFile Test cases generated on: 2011-07-04 13:04:17 : 1309777457*/
App::import('Model', 'TranslationFile');
class TranslationFileTestCase extends CakeTestCase {
var $fixtures = array('app.translation_file', 'app.language', 'app.identifier', 'app.translation', 'app.user', 'app.vote', 'app.comment', 'app.file_identifier', 'app.imported_translation_file', 'app.raw_file');
function startTest() {
$this->TranslationFile =& ClassRegistry::init('TranslationFile');
}
function endTest() {
unset($this->TranslationFile);
ClassRegistry::flush();
}
}

View file

@ -0,0 +1,17 @@
<?php
/* User Test cases generated on: 2011-05-29 19:20:07 : 1306689607*/
App::import('Model', 'User');
class UserTestCase extends CakeTestCase {
var $fixtures = array('app.user', 'app.translation', 'app.identifier', 'app.translation_file', 'app.language', 'app.vote');
function startTest() {
$this->User =& ClassRegistry::init('User');
}
function endTest() {
unset($this->User);
ClassRegistry::flush();
}
}

View file

@ -0,0 +1,17 @@
<?php
/* Vote Test cases generated on: 2011-05-29 21:11:49 : 1306696309*/
App::import('Model', 'Vote');
class VoteTestCase extends CakeTestCase {
var $fixtures = array('app.vote', 'app.translation', 'app.identifier', 'app.translation_file', 'app.language', 'app.user');
function startTest() {
$this->Vote =& ClassRegistry::init('Vote');
}
function endTest() {
unset($this->Vote);
ClassRegistry::flush();
}
}

View file

@ -0,0 +1,31 @@
<?php
/* FileIdentifier Fixture generated on: 2011-05-31 16:07:59 : 1306850879 */
class FileIdentifierFixture extends CakeTestFixture {
var $name = 'FileIdentifier';
var $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'translation_file_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'command' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 50, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'translation_index' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'identifier_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'reference_string' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $records = array(
array(
'id' => 1,
'translation_file_id' => 1,
'command' => 'Lorem ipsum dolor sit amet',
'translation_index' => 1,
'identifier_id' => 1,
'reference_string' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
'created' => '2011-05-31 16:07:59',
'modified' => '2011-05-31 16:07:59'
),
);
}

View file

@ -0,0 +1,31 @@
<?php
/* Identifier Fixture generated on: 2011-05-29 19:17:37 : 1306689457 */
class IdentifierFixture extends CakeTestFixture {
var $name = 'Identifier';
var $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'translation_file_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'translation_index' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'identifier' => array('type' => 'string', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'reference_string' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'translated' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $records = array(
array(
'id' => 1,
'translation_file_id' => 1,
'translation_index' => 1,
'identifier' => 'Lorem ipsum dolor sit amet',
'reference_string' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
'translated' => 1,
'created' => '2011-05-29 19:17:37',
'modified' => '2011-05-29 19:17:37'
),
);
}

View file

@ -0,0 +1,25 @@
<?php
/* Language Fixture generated on: 2011-05-31 15:48:42 : 1306849722 */
class LanguageFixture extends CakeTestFixture {
var $name = 'Language';
var $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 50, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'code' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 10, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $records = array(
array(
'id' => 1,
'name' => 'Lorem ipsum dolor sit amet',
'code' => 'Lorem ip',
'created' => '2011-05-31 15:48:42',
'modified' => '2011-05-31 15:48:42'
),
);
}

View file

@ -0,0 +1,25 @@
<?php
/* TranslationFile Fixture generated on: 2011-07-04 13:04:11 : 1309777451 */
class TranslationFileFixture extends CakeTestFixture {
var $name = 'TranslationFile';
var $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'language_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'filename_template' => array('type' => 'string', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $records = array(
array(
'id' => 1,
'language_id' => 1,
'filename_template' => 'Lorem ipsum dolor sit amet',
'created' => '2011-07-04 13:04:11',
'modified' => '2011-07-04 13:04:11'
),
);
}

View file

@ -0,0 +1,27 @@
<?php
/* Translation Fixture generated on: 2011-05-29 19:19:41 : 1306689581 */
class TranslationFixture extends CakeTestFixture {
var $name = 'Translation';
var $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'identifier_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'translation_text' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'user_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $records = array(
array(
'id' => 1,
'identifier_id' => 1,
'translation_text' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
'user_id' => 1,
'created' => '2011-05-29 19:19:41',
'modified' => '2011-05-29 19:19:41'
),
);
}

View file

@ -0,0 +1,23 @@
<?php
/* User Fixture generated on: 2011-05-29 19:20:07 : 1306689607 */
class UserFixture extends CakeTestFixture {
var $name = 'User';
var $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $records = array(
array(
'id' => 1,
'name' => 'Lorem ipsum dolor sit amet',
'created' => '2011-05-29 19:20:07',
'modified' => '2011-05-29 19:20:07'
),
);
}

View file

@ -0,0 +1,25 @@
<?php
/* Vote Fixture generated on: 2011-05-29 21:11:49 : 1306696309 */
class VoteFixture extends CakeTestFixture {
var $name = 'Vote';
var $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'translation_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'user_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $records = array(
array(
'id' => 1,
'translation_id' => 1,
'user_id' => 1,
'created' => '2011-05-29 21:11:49',
'modified' => '2011-05-29 21:11:49'
),
);
}

View file

View file

@ -0,0 +1,255 @@
<?php
class UxtParser
{
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 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);
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);
$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";
}
else
{
if ($this->debug) echo "DODANIE \n";
$parsedEnt += $parsedLine;
$parsedEnt['string'] .= "\n";
}
if ($this->debug)
{
echo "%%%% parsedEnt after %%%%%\n";
var_dump($parsedEnt);
}
}
else
$prevStringLine = false;
if ($parsedLine["type"] == "diff")
{
$parsedEnt["diff"] = $parsedLine["command"];
$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;
}
}
?>

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,28 @@
<h2>
<a href="#" id="toggle-admin-left-menu">Admin Menu</a>
</h2>
<div class="block" id="admin-left-menu">
<ul class="section menu">
<li>
<?php
if(($this->params['controller'] == 'dashboards') && ($this->params['action'] == 'admin_index')) {
echo $this->Html->link(__('Dashboard', true), array('controller' => 'dashboards', 'action' => 'index', 'admin' => true), array('class' => 'menuitem current'));
} else {
echo $this->Html->link(__('Dashboard', true), array('controller' => 'dashboards', 'action' => 'index', 'admin' => true), array('class' => 'menuitem'));
}
?>
</li>
<li>
<?php
if($this->params['controller'] == 'users') {
echo $this->Html->link(__('User Management', true), array('controller' => 'users', 'action' => 'index', 'admin' => true), array('class' => 'menuitem current'));
} else {
echo $this->Html->link(__('User Management', true), array('controller' => 'users', 'action' => 'index', 'admin' => true), array('class' => 'menuitem'));
}
?>
</li>
<li>
<a class="menuitem" href="/admin/users/logout">Logout</a>
</li>
</ul>
</div>

View file

@ -0,0 +1,22 @@
<ul class="nav main">
<li>
<a href="/admin">Admin</a>
<ul>
<li>
<a href="/">Link 1</a>
</li>
<li>
<a href="/">Link 2</a>
</li>
</ul>
</li>
<li>
<a href="/admin">Admin</a>
</li>
<li>
<a href="/admin">Admin 2</a>
</li>
<li>
<a href="/admin">Admin 3</a>
</li>
</ul>

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>

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 __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('action' => 'index'));?></li> </ul>
<h5>Languages</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Languages', true)), array('controller' => 'languages', '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>File Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('controller' => 'file_identifiers', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Add %s', true), __('Identifier', true)); ?></h2>
<div class="identifiers form">
<?php echo $this->Form->create('Identifier');?>
<fieldset>
<legend><?php printf(__('Identifier', true)); ?></legend>
<?php
echo $this->Form->input('language_id');
echo $this->Form->input('translation_index');
echo $this->Form->input('identifier');
echo $this->Form->input('arguments');
echo $this->Form->input('reference_string');
echo $this->Form->input('translated');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,69 @@
<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 __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('action' => 'index'));?></li> </ul>
<h5>Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translation Files', true)), array('controller' => 'translation_files', '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), __('Best Translation', true)), array('controller' => 'translations', 'action' => 'add')); ?> </li>
</ul>
<h5>Translations</h5>
<ul class="menu">
</ul>
<h5>Comments</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('controller' => 'comments', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('controller' => 'comments', 'action' => 'add')); ?> </li>
</ul>
<h5>File Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('controller' => 'file_identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifier Columns</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifier Columns', true)), array('controller' => 'identifier_columns', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Admin Add %s', true), __('Identifier', true)); ?></h2>
<div class="identifiers form">
<?php echo $this->Form->create('Identifier');?>
<fieldset>
<legend><?php printf(__('Identifier', true)); ?></legend>
<?php
echo $this->Form->input('language_id');
echo $this->Form->input('translation_file_id');
echo $this->Form->input('translation_index');
echo $this->Form->input('identifier');
echo $this->Form->input('arguments');
echo $this->Form->input('reference_string');
echo $this->Form->input('translated');
?>
</fieldset>
<div class="box">
<?php echo $this->Form->end(__('Submit', true));?>
</div> </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 __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('action' => 'index'));?></li> </ul>
<h5>Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translation Files', true)), array('controller' => 'translation_files', '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), __('Best Translation', true)), array('controller' => 'translations', 'action' => 'add')); ?> </li>
</ul>
<h5>Translations</h5>
<ul class="menu">
</ul>
<h5>Comments</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('controller' => 'comments', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('controller' => 'comments', 'action' => 'add')); ?> </li>
</ul>
<h5>File Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('controller' => 'file_identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifier Columns</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifier Columns', true)), array('controller' => 'identifier_columns', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php printf(__('Admin Edit %s', true), __('Identifier', true)); ?></h2>
<div class="identifiers form">
<?php echo $this->Form->create('Identifier');?>
<fieldset>
<legend><?php printf(__('Identifier # %s', true), $this->Form->value('Identifier.id')); ?></legend>
<?php
echo $this->Form->input('id');
echo $this->Form->input('language_id');
echo $this->Form->input('translation_file_id');
echo $this->Form->input('translation_index');
echo $this->Form->input('identifier');
echo $this->Form->input('arguments');
echo $this->Form->input('reference_string');
echo $this->Form->input('translated');
?>
</fieldset>
<div class="box">
<?php echo $this->Form->end(__('Submit', true));?>
</div> </div>
</div>
<div class="clear"></div>

View file

@ -0,0 +1,88 @@
<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 __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('action' => 'index')); ?> </li>
</ul>
<h5><?php echo __('Translation Files', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translation Files', true)), array('controller' => 'translation_files', 'action' => 'index')); ?> </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), __('Best Translation', true)), array('controller' => 'translations', 'action' => 'add')); ?> </li>
</ul>
<h5><?php echo __('Translations', true); ?></h5>
<ul class="menu">
</ul>
<h5><?php echo __('Comments', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('controller' => 'comments', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('controller' => 'comments', 'action' => 'add')); ?> </li>
</ul>
<h5><?php echo __('File Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('controller' => 'file_identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5><?php echo __('Identifier Columns', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifier Columns', true)), array('controller' => 'identifier_columns', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<h2 id="page-heading"><?php __('Identifiers');?></h2>
<table cellpadding="0" cellspacing="0"> <?php $tableHeaders = $html->tableHeaders(array($paginator->sort('id'),$paginator->sort('language_id'),$paginator->sort('translation_file_id'),$paginator->sort('translation_index'),$paginator->sort('identifier'),$paginator->sort('arguments'),$paginator->sort('reference_string'),$paginator->sort('translated'),$paginator->sort('created'),$paginator->sort('modified'),__('Actions', true),));
echo '<thead>'.$tableHeaders.'</thead>'; ?>
<?php
$i = 0;
foreach ($identifiers as $identifier):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $identifier['Identifier']['id']; ?></td>
<td><?php echo $identifier['Identifier']['language_id']; ?></td>
<td>
<?php echo $this->Html->link($identifier['TranslationFile']['filename_template'], array('controller' => 'translation_files', 'action' => 'view', $identifier['TranslationFile']['id'])); ?>
</td>
<td><?php echo $identifier['Identifier']['translation_index']; ?></td>
<td><?php echo $identifier['Identifier']['identifier']; ?></td>
<td><?php echo $identifier['Identifier']['arguments']; ?></td>
<td><?php echo $identifier['Identifier']['reference_string']; ?></td>
<td><?php echo $identifier['Identifier']['translated']; ?></td>
<td><?php echo $identifier['Identifier']['created']; ?></td>
<td><?php echo $identifier['Identifier']['modified']; ?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('action' => 'view', $identifier['Identifier']['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,394 @@
<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 __('Identifiers', true); ?></h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifiers', true)), array('action' => 'index')); ?> </li>
</ul>
<h5>Translation Files</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Translation Files', true)), array('controller' => 'translation_files', '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), __('Best Translation', true)), array('controller' => 'translations', 'action' => 'add')); ?> </li>
</ul>
<h5>Translations</h5>
<ul class="menu">
</ul>
<h5>Comments</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Comments', true)), array('controller' => 'comments', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('controller' => 'comments', 'action' => 'add')); ?> </li>
</ul>
<h5>File Identifiers</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('File Identifiers', true)), array('controller' => 'file_identifiers', 'action' => 'index')); ?> </li>
</ul>
<h5>Identifier Columns</h5>
<ul class="menu">
<li><?php echo $this->Html->link(sprintf(__('List %s', true), __('Identifier Columns', true)), array('controller' => 'identifier_columns', 'action' => 'index')); ?> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="grid_13">
<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 == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>"><?php __('Language Id'); ?></div>
<div class="dd<?php if ($i == 1) echo " dh"; else if ($i % 2 == 0) echo $class;?>">
<?php echo $identifier['Identifier']['language_id']; ?>
</div>
<?php $i++; ?>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Translation File'); ?></div>
<div class="dd<?php if ($i % 2 == 0) echo $class;?>">
<?php echo $this->Html->link($identifier['TranslationFile']['filename_template'], array('controller' => 'translation_files', 'action' => 'view', $identifier['TranslationFile']['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 class="box">
<h2>
<a href="#" id="toggle-related-records"><?php echo (__('Related', true)); ?></a>
</h2>
<div class="block" id="related-records">
<!-- RELATED -->
<!-- BestTranslation -->
<div class="related">
<h3><?php printf(__('Related %s (%s)', true), __('Translations', true), __('Best Translation', true));?></h3>
<?php if (!empty($identifier['BestTranslation']['id'])):?>
<div class="dl">
<?php $i = 0; $class = ' class="altrow"';?>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Id');?></div>
<div class="dd<?php if ($i++ % 2 == 0) echo $class;?>">
<?php echo $identifier['BestTranslation']['id'];?>
</div>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Identifier Id');?></div>
<div class="dd<?php if ($i++ % 2 == 0) echo $class;?>">
<?php echo $identifier['BestTranslation']['identifier_id'];?>
</div>
<div style="clear: both"></div>
<!-- <div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Identifier Column Id');?></div>
<div class="dd<?php if ($i++ % 2 == 0) echo $class;?>">
<?php echo $identifier['BestTranslation']['identifier_column_id'];?>
</div>
<div style="clear: both"></div>-->
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Translation Text');?></div>
<div class="dd<?php if ($i++ % 2 == 0) echo $class;?>">
<?php echo $identifier['BestTranslation']['translation_text'];?>
</div>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('User Id');?></div>
<div class="dd<?php if ($i++ % 2 == 0) echo $class;?>">
<?php echo $identifier['BestTranslation']['user_id'];?>
</div>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Best');?></div>
<div class="dd<?php if ($i++ % 2 == 0) echo $class;?>">
<?php echo $identifier['BestTranslation']['best'];?>
</div>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Created');?></div>
<div class="dd<?php if ($i++ % 2 == 0) echo $class;?>">
<?php echo $identifier['BestTranslation']['created'];?>
</div>
<div style="clear: both"></div>
<div class="dt<?php if ($i % 2 == 0) echo $class;?>"><?php __('Modified');?></div>
<div class="dd<?php if ($i++ % 2 == 0) echo $class;?>">
<?php echo $identifier['BestTranslation']['modified'];?>
</div>
<div style="clear: both"></div>
</div>
<?php endif; ?>
<div class="actions">
<ul>
<?php if (!empty($identifier['BestTranslation']['id'])):?>
<li><?php echo $this->Html->link(sprintf(__('Edit %s', true), __('Best Translation', true)), array('controller' => 'translations', 'action' => 'edit', $identifier['BestTranslation']['id'])); ?></li>
<?php endif; ?>
</ul>
</div>
</div>
<!-- Translation -->
<div class="related">
<h3><?php printf(__('Related %s', true), __('Translations', true));?></h3>
<?php if (!empty($identifier['Translation'])):?>
<table cellpadding = "0" cellspacing = "0">
<thead>
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('Identifier Id'); ?></th>
<th><?php __('Identifier Column Id'); ?></th>
<th><?php __('Translation Text'); ?></th>
<th><?php __('User Id'); ?></th>
<th><?php __('Best'); ?></th>
<th><?php __('Created'); ?></th>
<th><?php __('Modified'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
</thead>
<?php
$i = 0;
foreach ($identifier['Translation'] as $translation):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $translation['id'];?></td>
<td><?php echo $translation['identifier_id'];?></td>
<td><?php echo $translation['identifier_column_id'];?></td>
<td><?php echo $translation['translation_text'];?></td>
<td><?php echo $translation['user_id'];?></td>
<td><?php echo $translation['best'];?></td>
<td><?php echo $translation['created'];?></td>
<td><?php echo $translation['modified'];?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('controller' => 'translations', 'action' => 'view', $translation['id'])); ?>
<?php echo ' | '. $this->Html->link(__('Edit', true), array('controller' => 'translations', 'action' => 'edit', $translation['id'])); ?>
<?php echo ' | '. $this->Html->link(__('Delete', true), array('controller' => 'translations', 'action' => 'delete', $translation['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $translation['id'])); ?>
<?php echo ' | '. $this->Html->link(sprintf(__('Set as %s', true), __('Best Translation', true)), array('controller' => 'translations', 'action' => 'setBest', $translation['id']));?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Translation', true)), array('controller' => 'translations', 'action' => 'add'));?></li>
</ul>
</div>
</div>
<!-- Comment -->
<div class="related">
<h3><?php printf(__('Related %s', true), __('Comments', true));?></h3>
<?php if (!empty($identifier['Comment'])):?>
<table cellpadding = "0" cellspacing = "0">
<thead>
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('Translation Id'); ?></th>
<th><?php __('Identifier Id'); ?></th>
<th><?php __('User Id'); ?></th>
<th><?php __('Comment'); ?></th>
<th><?php __('Created'); ?></th>
<th><?php __('Modified'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
</thead>
<?php
$i = 0;
foreach ($identifier['Comment'] as $comment):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $comment['id'];?></td>
<td><?php echo $comment['translation_id'];?></td>
<td><?php echo $comment['identifier_id'];?></td>
<td><?php echo $comment['user_id'];?></td>
<td><?php echo $comment['comment'];?></td>
<td><?php echo $comment['created'];?></td>
<td><?php echo $comment['modified'];?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('controller' => 'comments', 'action' => 'view', $comment['id'])); ?>
<?php echo ' | '. $this->Html->link(__('Edit', true), array('controller' => 'comments', 'action' => 'edit', $comment['id'])); ?>
<?php echo ' | '. $this->Html->link(__('Delete', true), array('controller' => 'comments', 'action' => 'delete', $comment['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $comment['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Comment', true)), array('controller' => 'comments', 'action' => 'add'));?></li>
</ul>
</div>
</div>
<!-- FileIdentifier -->
<div class="related">
<h3><?php printf(__('Related %s', true), __('File Identifiers', true));?></h3>
<?php if (!empty($identifier['FileIdentifier'])):?>
<table cellpadding = "0" cellspacing = "0">
<thead>
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('Imported Translation File Id'); ?></th>
<th><?php __('Command'); ?></th>
<th><?php __('Translation Index'); ?></th>
<th><?php __('Identifier Id'); ?></th>
<th><?php __('Arguments'); ?></th>
<th><?php __('Reference String'); ?></th>
<th><?php __('Created'); ?></th>
<th><?php __('Modified'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
</thead>
<?php
$i = 0;
foreach ($identifier['FileIdentifier'] as $fileIdentifier):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $fileIdentifier['id'];?></td>
<td><?php echo $fileIdentifier['imported_translation_file_id'];?></td>
<td><?php echo $fileIdentifier['command'];?></td>
<td><?php echo $fileIdentifier['translation_index'];?></td>
<td><?php echo $fileIdentifier['identifier_id'];?></td>
<td><?php echo $fileIdentifier['arguments'];?></td>
<td><?php echo $fileIdentifier['reference_string'];?></td>
<td><?php echo $fileIdentifier['created'];?></td>
<td><?php echo $fileIdentifier['modified'];?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('controller' => 'file_identifiers', 'action' => 'view', $fileIdentifier['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
</ul>
</div>
</div>
<!-- IdentifierColumn -->
<div class="related">
<h3><?php printf(__('Related %s', true), __('Identifier Columns', true));?></h3>
<?php if (!empty($identifier['IdentifierColumn'])):?>
<table cellpadding = "0" cellspacing = "0">
<thead>
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('Identifier Id'); ?></th>
<th><?php __('Column Name'); ?></th>
<th><?php __('Reference String'); ?></th>
<th><?php __('Created'); ?></th>
<th><?php __('Modified'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
</thead>
<?php
$i = 0;
foreach ($identifier['IdentifierColumn'] as $identifierColumn):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $identifierColumn['id'];?></td>
<td><?php echo $identifierColumn['identifier_id'];?></td>
<td><?php echo $identifierColumn['column_name'];?></td>
<td><?php echo $identifierColumn['reference_string'];?></td>
<td><?php echo $identifierColumn['created'];?></td>
<td><?php echo $identifierColumn['modified'];?></td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('controller' => 'identifier_columns', 'action' => 'view', $identifierColumn['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
</ul>
</div>
</div>
<!-- /RELATED -->
</div>
</div>
</div>
<div class="clear"></div>

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