mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72803 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
55e0a713db
commit
08a5a7c387
@ -25,6 +25,7 @@ Director::addRules(10, array(
|
|||||||
'$Controller//$Action/$ID/$OtherID' => '*',
|
'$Controller//$Action/$ID/$OtherID' => '*',
|
||||||
'images' => 'Image_Uploader',
|
'images' => 'Image_Uploader',
|
||||||
'' => 'RootURLController',
|
'' => 'RootURLController',
|
||||||
|
'api/v1/live' => 'VersionedRestfulServer',
|
||||||
'api/v1' => 'RestfulServer',
|
'api/v1' => 'RestfulServer',
|
||||||
'soap/v1' => 'SOAPModelAccess',
|
'soap/v1' => 'SOAPModelAccess',
|
||||||
'dev' => 'DevelopmentAdmin',
|
'dev' => 'DevelopmentAdmin',
|
||||||
|
@ -457,7 +457,7 @@ class RestfulServer extends Controller {
|
|||||||
*/
|
*/
|
||||||
protected function getObjectQuery($className, $id, $params) {
|
protected function getObjectQuery($className, $id, $params) {
|
||||||
$baseClass = ClassInfo::baseDataClass($className);
|
$baseClass = ClassInfo::baseDataClass($className);
|
||||||
return singleton($className)->buildSQL(
|
return singleton($className)->extendedSQL(
|
||||||
"\"$baseClass\".ID = {$id}"
|
"\"$baseClass\".ID = {$id}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
15
api/VersionedRestfulServer.php
Normal file
15
api/VersionedRestfulServer.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple wrapper to allow access to the live site via REST
|
||||||
|
*/
|
||||||
|
class VersionedRestfulServer extends Controller {
|
||||||
|
function handleRequest($request) {
|
||||||
|
Versioned::reading_stage('Live');
|
||||||
|
$restfulserver = new RestfulServer();
|
||||||
|
$response = $restfulserver->handleRequest($request);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -28,7 +28,7 @@ error_reporting(E_ALL);
|
|||||||
*/
|
*/
|
||||||
$envFiles = array('../_ss_environment.php', '../../_ss_environment.php', '../../../_ss_environment.php');
|
$envFiles = array('../_ss_environment.php', '../../_ss_environment.php', '../../../_ss_environment.php');
|
||||||
foreach($envFiles as $envFile) {
|
foreach($envFiles as $envFile) {
|
||||||
if(file_exists($envFile)) {
|
if(@file_exists($envFile)) {
|
||||||
define('SS_ENVIRONMENT_FILE', $envFile);
|
define('SS_ENVIRONMENT_FILE', $envFile);
|
||||||
include_once($envFile);
|
include_once($envFile);
|
||||||
break;
|
break;
|
||||||
|
@ -192,12 +192,13 @@ class Requirements {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically includes the necessary lang-files from the module.
|
* Add i18n files from the given javascript directory.
|
||||||
|
* @param $langDir The javascript lang directory, relative to the site root, e.g., 'sapphire/javascript/lang'
|
||||||
*
|
*
|
||||||
* See {@link Requirements_Backend::process_i18n_javascript()} for more info.
|
* See {@link Requirements_Backend::add_i18n_javascript()} for more information.
|
||||||
*/
|
*/
|
||||||
protected static function process_i18n_javascript() {
|
public static function add_i18n_javascript($langDir) {
|
||||||
return self::backend()->process_i18n_javascript();
|
return self::backend()->add_i18n_javascript($langDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -548,7 +549,6 @@ class Requirements_Backend {
|
|||||||
$jsRequirements = '';
|
$jsRequirements = '';
|
||||||
|
|
||||||
// Combine files - updates $this->javascript and $this->css
|
// Combine files - updates $this->javascript and $this->css
|
||||||
$this->process_i18n_javascript();
|
|
||||||
$this->process_combined_files();
|
$this->process_combined_files();
|
||||||
|
|
||||||
foreach(array_diff_key($this->javascript,$this->blocked) as $file => $dummy) {
|
foreach(array_diff_key($this->javascript,$this->blocked) as $file => $dummy) {
|
||||||
@ -637,39 +637,26 @@ class Requirements_Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically includes the necessary lang-files from the module
|
* Add i18n files from the given javascript directory. Sapphire expects that the given directory
|
||||||
* according to the locale set in {@link i18n::$current_locale}.
|
* will contain a number of java script files named by language: en_US.js, de_DE.js, etc.
|
||||||
* Assumes that a subfolder /javascript exists relative to the included
|
* @param $langDir The javascript lang directory, relative to the site root, e.g., 'sapphire/javascript/lang'
|
||||||
* javascript file, with a file named after the locale -
|
|
||||||
* so usually <mymodule>/javascript/lang/en_US.js.
|
|
||||||
*/
|
*/
|
||||||
protected function process_i18n_javascript() {
|
public function add_i18n_javascript($langDir) {
|
||||||
// ensure to include the i18n base library
|
if(i18n::get_js_i18n()) {
|
||||||
if(
|
// Include i18n.js even if no languages are found. The fact that
|
||||||
count(array_diff_key($this->javascript,$this->blocked))
|
// add_i18n_javascript() was called indicates that the methods in
|
||||||
&& !isset($this->javascript[SAPPHIRE_DIR . '/javascript/i18n.js'])
|
// here are needed.
|
||||||
) {
|
$this->javascript(SAPPHIRE_DIR . '/javascript/i18n.js');
|
||||||
$this->javascript[THIRDPARTY_DIR . '/prototype.js'] = true;
|
|
||||||
$this->javascript[SAPPHIRE_DIR . '/javascript/i18n.js'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// include the specific locale and the master locale for each module
|
if(substr($langDir,-1) != '/') $langDir .= '/';
|
||||||
foreach(array_diff_key($this->javascript,$this->blocked) as $file => $dummy) {
|
|
||||||
if(preg_match('/^http[s]?/', $file)) continue;
|
|
||||||
|
|
||||||
$absolutePath = Director::baseFolder() . '/' . $file;
|
$this->javascript($langDir . i18n::default_locale() . '.js');
|
||||||
$absoluteLangPath = dirname($absolutePath) . '/lang/' . i18n::get_locale() . '.js';
|
$this->javascript($langDir . i18n::get_locale() . '.js');
|
||||||
$absoluteDefaultLangPath = dirname($absolutePath) . '/lang/' . i18n::default_locale() . '.js';
|
|
||||||
foreach(array($absoluteDefaultLangPath, $absoluteLangPath) as $path) {
|
|
||||||
if(Director::fileExists($path)) {
|
|
||||||
$langFile = Director::makeRelative($path);
|
|
||||||
// Remove rogue leading slashes from Director::makeRelative()
|
|
||||||
$langFile = preg_replace('/^\//', '', $langFile);
|
|
||||||
$this->javascript[$langFile] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Stub i18n implementation for when i18n is disabled.
|
||||||
|
} else {
|
||||||
|
$this->javascript[SAPPHIRE_DIR . '/javascript/i18nx.js'] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +121,12 @@ class SSViewer extends Object {
|
|||||||
|
|
||||||
// flush template manifest cache if requested
|
// flush template manifest cache if requested
|
||||||
if (isset($_GET['flush']) && $_GET['flush'] == 'all') {
|
if (isset($_GET['flush']) && $_GET['flush'] == 'all') {
|
||||||
|
if(Director::isDev() || Permission::check('ADMIN')) {
|
||||||
self::flush_template_cache();
|
self::flush_template_cache();
|
||||||
|
Debug::message('flushed!');
|
||||||
|
} else {
|
||||||
|
Security::permissionFailure(null, 'Please log in as an administrator to flush the template cache.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(substr((string) $templateList,-3) == '.ss') {
|
if(substr((string) $templateList,-3) == '.ss') {
|
||||||
|
@ -397,8 +397,11 @@ class Director {
|
|||||||
if(self::$alternateBaseURL) return self::$alternateBaseURL;
|
if(self::$alternateBaseURL) return self::$alternateBaseURL;
|
||||||
else {
|
else {
|
||||||
$base = dirname(dirname($_SERVER['SCRIPT_NAME']));
|
$base = dirname(dirname($_SERVER['SCRIPT_NAME']));
|
||||||
if($base == '/' || $base == '/.' || $base == '\\') return '/';
|
if($base == '/' || $base == '/.' || $base == '\\') $baseURL = '/';
|
||||||
else return $base . '/';
|
else $baseURL = $base . '/';
|
||||||
|
|
||||||
|
if(defined('BASE_SCRIPT_URL')) return $baseURL . BASE_SCRIPT_URL;
|
||||||
|
else return $baseURL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,14 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
$this->urlParams = $request->allParams();
|
$this->urlParams = $request->allParams();
|
||||||
|
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
|
// If the basic database hasn't been created, then build it.
|
||||||
|
if(!DB::isActive() || !ClassInfo::hasTable('SiteTree')) {
|
||||||
|
$this->response = new HTTPResponse();
|
||||||
|
$this->redirect("dev/build?returnURL=" . urlencode($_GET['url']));
|
||||||
|
return $this->response;
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->getNestedController();
|
$result = $this->getNestedController();
|
||||||
|
|
||||||
if(is_object($result) && $result instanceOf RequestHandler) {
|
if(is_object($result) && $result instanceOf RequestHandler) {
|
||||||
|
@ -30,6 +30,13 @@ class RootURLController extends Controller {
|
|||||||
|
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
|
// If the basic database hasn't been created, then build it.
|
||||||
|
if(!DB::isActive() || !ClassInfo::hasTable('SiteTree')) {
|
||||||
|
$this->response = new HTTPResponse();
|
||||||
|
$this->redirect("dev/build?returnURL=");
|
||||||
|
return $this->response;
|
||||||
|
}
|
||||||
|
|
||||||
$controller = new ModelAsController();
|
$controller = new ModelAsController();
|
||||||
$request = new HTTPRequest("GET", self::get_homepage_urlsegment().'/', $request->getVars(), $request->postVars());
|
$request = new HTTPRequest("GET", self::get_homepage_urlsegment().'/', $request->getVars(), $request->postVars());
|
||||||
$request->match('$URLSegment//$Action', true);
|
$request->match('$URLSegment//$Action', true);
|
||||||
|
@ -60,6 +60,38 @@ class i18n extends Object {
|
|||||||
*/
|
*/
|
||||||
protected static $default_locale = 'en_US';
|
protected static $default_locale = 'en_US';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected static $js_i18n = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use javascript i18n through the ss.i18n class (enabled by default).
|
||||||
|
* If set to TRUE, includes javascript requirements for the base library
|
||||||
|
* (sapphire/javascript/i18n.js) and all necessary lang files (e.g. sapphire/lang/de_DE.js)
|
||||||
|
* plus fallbacks to the default locale (e.g. sapphire/lang/en_US.js).
|
||||||
|
* If set to FALSE, only includes a stub implementation
|
||||||
|
* which is necessary. Mainly disabled to save bandwidth
|
||||||
|
* in a frontend context when website is in single language.
|
||||||
|
*
|
||||||
|
* Caution: This flag gets overwritten in {@link LeftAndMain::init()} to enforce javascript
|
||||||
|
* i18n for the CMS interfaces.
|
||||||
|
*
|
||||||
|
* @see Requirements::process_i18n_javascript()
|
||||||
|
*
|
||||||
|
* @param bool $bool
|
||||||
|
*/
|
||||||
|
public static function set_js_i18n($bool) {
|
||||||
|
self::$js_i18n = $bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function get_js_i18n() {
|
||||||
|
return self::$js_i18n;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An exhaustive list of possible locales (code => language and country)
|
* An exhaustive list of possible locales (code => language and country)
|
||||||
*
|
*
|
||||||
|
@ -809,9 +809,9 @@ class DataObjectSet extends ViewableData implements IteratorAggregate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new DataObjectSet of the sorted array
|
* Sorts the current DataObjectSet instance.
|
||||||
* @param string $fieldname the name of the field on the dataobject that you wish to sort the set by
|
* @param string $fieldname The name of the field on the DataObject that you wish to sort the set by.
|
||||||
* @param string $direction the direction of the sort e.g. Ascending = ASC ( LIKE SQL )
|
* @param string $direction Direction to sort by, either "ASC" or "DESC".
|
||||||
*/
|
*/
|
||||||
public function sort($fieldname, $direction = "ASC") {
|
public function sort($fieldname, $direction = "ASC") {
|
||||||
if($this->items) {
|
if($this->items) {
|
||||||
@ -981,11 +981,10 @@ class DataObjectSet extends ViewableData implements IteratorAggregate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort a 2D array by particular comma separated list of columns.
|
* Sort a 2D array by particular column.
|
||||||
* Prefix column names with - for a descending search.
|
* @param array $data The array to sort.
|
||||||
* @param array $data The array to sort
|
* @param string $column The name of the column you wish to sort by.
|
||||||
* @param string $column Comma separated list of columns
|
* @param string $direction Direction to sort by, either "ASC" or "DESC".
|
||||||
* @param string $direction Direction to sort by, either "ASC" or "DESC"
|
|
||||||
* @param boolean $preserveIndexes Preserve indexes
|
* @param boolean $preserveIndexes Preserve indexes
|
||||||
*/
|
*/
|
||||||
function column_sort(&$data, $column, $direction = "ASC", $preserveIndexes = true) {
|
function column_sort(&$data, $column, $direction = "ASC", $preserveIndexes = true) {
|
||||||
|
@ -78,8 +78,15 @@ class DatabaseAdmin extends Controller {
|
|||||||
ManifestBuilder::create_manifest_file();
|
ManifestBuilder::create_manifest_file();
|
||||||
require(MANIFEST_FILE);
|
require(MANIFEST_FILE);
|
||||||
|
|
||||||
|
if(isset($_GET['returnURL'])) {
|
||||||
|
echo "<p>Setting up the database; you will be returned to your site shortly....</p>";
|
||||||
|
$this->doBuild(true);
|
||||||
|
echo "<p>Done!</p>";
|
||||||
|
Director::redirect($_GET['returnURL']);
|
||||||
|
} else {
|
||||||
$this->doBuild(isset($_REQUEST['quiet']) || isset($_REQUEST['from_installer']), !isset($_REQUEST['dont_populate']));
|
$this->doBuild(isset($_REQUEST['quiet']) || isset($_REQUEST['from_installer']), !isset($_REQUEST['dont_populate']));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if database needs to be built, and build it if it does.
|
* Check if database needs to be built, and build it if it does.
|
||||||
|
@ -1114,6 +1114,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
function getCMSFields() {
|
function getCMSFields() {
|
||||||
require_once("forms/Form.php");
|
require_once("forms/Form.php");
|
||||||
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
|
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
|
||||||
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/UpdateURL.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/UpdateURL.js');
|
||||||
|
|
||||||
// Status / message
|
// Status / message
|
||||||
|
@ -55,8 +55,8 @@
|
|||||||
<b>Template to install:</b>
|
<b>Template to install:</b>
|
||||||
</p>
|
</p>
|
||||||
<ul id="Themes">
|
<ul id="Themes">
|
||||||
<li><input type="radio" name="template" value="blackcandy" id="BlackCandy" checked="checked" /><label for="BlackCandy">BlackCandy, default template ready to use.</label></li>
|
<li><input type="radio" name="template" value="blackcandy" id="BlackCandy" <?php if(!isset($_POST['template']) || $_POST['template'] == 'blackcandy') {?>checked="checked"<?}?> /><label for="BlackCandy">BlackCandy, default template ready to use.</label></li>
|
||||||
<li><input type="radio" name="template" value="tutorial" id="EmptyTemplate" /><label for="EmptyTemplate">Empty template, ready to begin the tutorial.</label></li>
|
<li><input type="radio" name="template" value="tutorial" id="EmptyTemplate" <?php if(isset($_POST['template']) && $_POST['template'] == 'tutorial') {?>checked="checked"<?}?>/><label for="EmptyTemplate">Empty template, ready to begin the tutorial.</label></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>You can change the template or download another from the SilverStripe website after installation.</p>
|
<p>You can change the template or download another from the SilverStripe website after installation.</p>
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ class Folder extends File {
|
|||||||
// A record with a bad class type doesn't deserve to exist. It must be purged!
|
// A record with a bad class type doesn't deserve to exist. It must be purged!
|
||||||
if(isset($hasDbChild[$actualChild])) {
|
if(isset($hasDbChild[$actualChild])) {
|
||||||
$child = $hasDbChild[$actualChild];
|
$child = $hasDbChild[$actualChild];
|
||||||
if( ($child->class != 'Folder' && is_dir($baseDir . $actualChild))
|
if(( !( $child instanceof Folder ) && is_dir($baseDir . $actualChild) )
|
||||||
|| ($child->class == 'Folder' && !is_dir($baseDir . $actualChild)) ) {
|
|| (( $child instanceof Folder ) && !is_dir($baseDir . $actualChild)) ) {
|
||||||
DB::query("DELETE FROM \"File\" WHERE \"ID\" = $child->ID");
|
DB::query("DELETE FROM \"File\" WHERE \"ID\" = $child->ID");
|
||||||
unset($hasDbChild[$actualChild]);
|
unset($hasDbChild[$actualChild]);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ class AjaxUniqueTextField extends TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Field() {
|
function Field() {
|
||||||
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/UniqueFields.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/UniqueFields.js");
|
||||||
|
|
||||||
$this->jsValidation();
|
$this->jsValidation();
|
||||||
|
@ -200,6 +200,7 @@ class ComplexTableField extends TableListField {
|
|||||||
|
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/greybox/AmiJS.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/greybox/AmiJS.js");
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/greybox/greybox.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/greybox/greybox.js");
|
||||||
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/ComplexTableField.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/ComplexTableField.js");
|
||||||
Requirements::css(THIRDPARTY_DIR . "/greybox/greybox.css");
|
Requirements::css(THIRDPARTY_DIR . "/greybox/greybox.css");
|
||||||
@ -1030,6 +1031,7 @@ class ComplexTableField_Popup extends Form {
|
|||||||
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/scriptaculous.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/scriptaculous.js");
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js");
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/layout_helpers.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/layout_helpers.js");
|
||||||
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain.js");
|
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain.js");
|
||||||
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_right.js");
|
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_right.js");
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TableField.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TableField.js");
|
||||||
|
@ -23,7 +23,7 @@ class HasManyComplexTableField extends ComplexTableField {
|
|||||||
function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
|
function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
|
||||||
parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
|
parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
|
||||||
|
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/HasManyFileField.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/HasManyFileField.js");
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/RelationComplexTableField.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/RelationComplexTableField.js');
|
||||||
Requirements::css(SAPPHIRE_DIR . '/css/HasManyFileField.css');
|
Requirements::css(SAPPHIRE_DIR . '/css/HasManyFileField.css');
|
||||||
|
@ -15,6 +15,7 @@ class RestrictedTextField extends TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Field() {
|
function Field() {
|
||||||
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript( SAPPHIRE_DIR . '/javascript/UniqueFields.js' );
|
Requirements::javascript( SAPPHIRE_DIR . '/javascript/UniqueFields.js' );
|
||||||
|
|
||||||
if($this->maxLength){
|
if($this->maxLength){
|
||||||
|
@ -32,6 +32,7 @@ class ScaffoldingComplexTableField_Popup extends Form {
|
|||||||
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/scriptaculous.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/scriptaculous.js");
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js");
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/layout_helpers.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/layout_helpers.js");
|
||||||
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain.js");
|
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain.js");
|
||||||
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_right.js");
|
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_right.js");
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TableField.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TableField.js");
|
||||||
|
@ -114,7 +114,7 @@ class TableField extends TableListField {
|
|||||||
}
|
}
|
||||||
parent::__construct($name, $sourceClass, $fieldList, $sourceFilter, $sourceSort, $sourceJoin);
|
parent::__construct($name, $sourceClass, $fieldList, $sourceFilter, $sourceSort, $sourceJoin);
|
||||||
|
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableField.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableField.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ class TableListField extends FormField {
|
|||||||
Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js');
|
Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js');
|
||||||
Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js');
|
Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js');
|
||||||
Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js');
|
Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js');
|
||||||
Requirements::css(SAPPHIRE_DIR . '/css/TableListField.css');
|
Requirements::css(SAPPHIRE_DIR . '/css/TableListField.css');
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ class TreeDropdownField extends FormField {
|
|||||||
Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css');
|
Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css');
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/tree/tree.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/tree/tree.js");
|
||||||
Requirements::css(THIRDPARTY_DIR . "/tree/tree.css");
|
Requirements::css(THIRDPARTY_DIR . "/tree/tree.css");
|
||||||
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
|
||||||
|
|
||||||
if($this->value) {
|
if($this->value) {
|
||||||
|
@ -29,6 +29,7 @@ class TreeMultiselectField extends TreeDropdownField {
|
|||||||
function Field() {
|
function Field() {
|
||||||
$value = '';
|
$value = '';
|
||||||
$itemList = '';
|
$itemList = '';
|
||||||
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
|
||||||
|
|
||||||
$items = $this->getItems();
|
$items = $this->getItems();
|
||||||
|
@ -13,7 +13,7 @@ class TreeSelectorField extends FormField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Field() {
|
function Field() {
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
|
||||||
|
|
||||||
$fieldName = $this->name;
|
$fieldName = $this->name;
|
||||||
|
@ -24,7 +24,7 @@ class UniqueTextField extends TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Field() {
|
function Field() {
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/UniqueFields.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/UniqueFields.js");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -153,8 +153,7 @@ abstract class Validator extends Object {
|
|||||||
Requirements::javascript(THIRDPARTY_DIR . "/prototype.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/prototype.js");
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js");
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js");
|
||||||
//Requirements::add_i18n_javascript(SAPPHIRE_DIR);
|
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
|
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/Validator.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/javascript/Validator.js");
|
||||||
|
|
||||||
$code = $this->javascript();
|
$code = $this->javascript();
|
||||||
|
@ -84,7 +84,7 @@ HasManyFileFieldUploadButton.prototype = {
|
|||||||
|
|
||||||
uploadFileQueuedCallback: function(file,queueLength) {
|
uploadFileQueuedCallback: function(file,queueLength) {
|
||||||
var message = ss.i18n.sprintf(
|
var message = ss.i18n.sprintf(
|
||||||
ss.i18n._t('HASMANYFILEFIELD.UPLOADING'),
|
ss.i18n._t('HASMANYFILEFIELD.UPLOADING', 'Uploading... %s'),
|
||||||
this.upload.getFilesToUpload()
|
this.upload.getFilesToUpload()
|
||||||
);
|
);
|
||||||
this.parentNode.parentNode.uploadMessage.innerHTML = message;
|
this.parentNode.parentNode.uploadMessage.innerHTML = message;
|
||||||
@ -92,7 +92,7 @@ HasManyFileFieldUploadButton.prototype = {
|
|||||||
|
|
||||||
uploadFileCompleteCallback: function(file,serverData) {
|
uploadFileCompleteCallback: function(file,serverData) {
|
||||||
var message = ss.i18n.sprintf(
|
var message = ss.i18n.sprintf(
|
||||||
ss.i18n._t('HASMANYFILEFIELD.UPLOADING'),
|
ss.i18n._t('HASMANYFILEFIELD.UPLOADING', 'Uploading... %s'),
|
||||||
this.upload.getFilesUploaded() + "/" + this.upload.getFilesToUpload()
|
this.upload.getFilesUploaded() + "/" + this.upload.getFilesToUpload()
|
||||||
);
|
);
|
||||||
this.parentNode.parentNode.uploadMessage.innerHTML = message;
|
this.parentNode.parentNode.uploadMessage.innerHTML = message;
|
||||||
|
@ -75,7 +75,7 @@ TableField.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO ajaxErrorHandler and loading-image are dependent on cms, but formfield is in sapphire
|
// TODO ajaxErrorHandler and loading-image are dependent on cms, but formfield is in sapphire
|
||||||
var confirmed = confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'));
|
var confirmed = confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE', 'Are you sure you want to delete this record?'));
|
||||||
if(confirmed){
|
if(confirmed){
|
||||||
img.setAttribute("src",'cms/images/network-save.gif'); // TODO doesn't work
|
img.setAttribute("src",'cms/images/network-save.gif'); // TODO doesn't work
|
||||||
new Ajax.Request(
|
new Ajax.Request(
|
||||||
|
@ -84,7 +84,7 @@ TableListField.prototype = {
|
|||||||
var row = Event.findElement(e,"tr");
|
var row = Event.findElement(e,"tr");
|
||||||
|
|
||||||
// TODO ajaxErrorHandler and loading-image are dependent on cms, but formfield is in sapphire
|
// TODO ajaxErrorHandler and loading-image are dependent on cms, but formfield is in sapphire
|
||||||
var confirmed = confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'));
|
var confirmed = confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE', 'Are you sure you want to delete this record?'));
|
||||||
if(confirmed)
|
if(confirmed)
|
||||||
{
|
{
|
||||||
img.setAttribute("src",'cms/images/network-save.gif'); // TODO doesn't work
|
img.setAttribute("src",'cms/images/network-save.gif'); // TODO doesn't work
|
||||||
|
@ -67,7 +67,7 @@ TreeDropdownField.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.itemTree.className = 'tree_holder';
|
this.itemTree.className = 'tree_holder';
|
||||||
this.itemTree.innerHTML = ss.i18n._t('LOADING');
|
this.itemTree.innerHTML = ss.i18n._t('LOADING', 'Loading...');
|
||||||
this.appendChild(this.itemTree);
|
this.appendChild(this.itemTree);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -186,7 +186,7 @@ TreeDropdownField.prototype = {
|
|||||||
ajaxExpansion: function() {
|
ajaxExpansion: function() {
|
||||||
this.addNodeClass('loading');
|
this.addNodeClass('loading');
|
||||||
var ul = this.treeNodeHolder();
|
var ul = this.treeNodeHolder();
|
||||||
ul.innerHTML = ss.i18n._t('LOADING');
|
ul.innerHTML = ss.i18n._t('LOADING', 'Loading...');
|
||||||
|
|
||||||
var ajaxURL = this.options.dropdownField.helperURLBase() + 'getsubtree?&SubtreeRootID=' + this.getIdx();
|
var ajaxURL = this.options.dropdownField.helperURLBase() + 'getsubtree?&SubtreeRootID=' + this.getIdx();
|
||||||
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
||||||
|
@ -7,7 +7,7 @@ UniqueFormField.prototype = {
|
|||||||
if( this.restrictedValues[suggested] || suggested == null ) {
|
if( this.restrictedValues[suggested] || suggested == null ) {
|
||||||
suggested = this.suggestNewValue();
|
suggested = this.suggestNewValue();
|
||||||
statusMessage(ss.i18n.sprintf(
|
statusMessage(ss.i18n.sprintf(
|
||||||
ss.i18n._t('UNIQUEFIELD.SUGGESTED'),
|
ss.i18n._t('UNIQUEFIELD.SUGGESTED', "Changed value to '%s' : %s"),
|
||||||
suggested,
|
suggested,
|
||||||
this.restrictedMessage
|
this.restrictedMessage
|
||||||
));
|
));
|
||||||
@ -112,9 +112,9 @@ UniqueRestrictedTextField.prototype = {
|
|||||||
if( suggested == null || suggested.length == 0 || suggestedValue || suggested.match( this.charRegex ) ) {
|
if( suggested == null || suggested.length == 0 || suggestedValue || suggested.match( this.charRegex ) ) {
|
||||||
var message;
|
var message;
|
||||||
if( suggested == null )
|
if( suggested == null )
|
||||||
message = ss.i18n._t('UNIQUEFIELD.ENTERNEWVALUE');
|
message = ss.i18n._t('UNIQUEFIELD.ENTERNEWVALUE', 'You will need to enter a new value for this field');
|
||||||
else if( suggested.length == 0 )
|
else if( suggested.length == 0 )
|
||||||
message = ss.i18n._t('UNIQUEFIELD.CANNOTLEAVEEMPTY');
|
message = ss.i18n._t('UNIQUEFIELD.CANNOTLEAVEEMPTY', 'This field cannot be left empty');
|
||||||
else if( suggestedValue )
|
else if( suggestedValue )
|
||||||
message = this.restrictedMessage;
|
message = this.restrictedMessage;
|
||||||
else
|
else
|
||||||
@ -122,7 +122,7 @@ UniqueRestrictedTextField.prototype = {
|
|||||||
|
|
||||||
suggested = this.suggestNewValue();
|
suggested = this.suggestNewValue();
|
||||||
statusMessage(ss.i18n.sprintf(
|
statusMessage(ss.i18n.sprintf(
|
||||||
ss.i18n._t('UNIQUEFIELD.SUGGESTED'),
|
ss.i18n._t('UNIQUEFIELD.SUGGESTED', "Changed value to '%s' : %s"),
|
||||||
suggested,
|
suggested,
|
||||||
message
|
message
|
||||||
));
|
));
|
||||||
@ -152,7 +152,7 @@ RestrictedTextField.prototype = {
|
|||||||
for( var index = 0; index < this.restrictedChars.length; index++ ) {
|
for( var index = 0; index < this.restrictedChars.length; index++ ) {
|
||||||
if( lastChar == this.restrictedChars.charAt(index) ) {
|
if( lastChar == this.restrictedChars.charAt(index) ) {
|
||||||
alert(ss.i18n.sprintf(
|
alert(ss.i18n.sprintf(
|
||||||
ss.i18n._t('RESTRICTEDTEXTFIELD.CHARCANTBEUSED'),
|
ss.i18n._t('RESTRICTEDTEXTFIELD.CHARCANTBEUSED', "The character '%s' cannot be used in this field"),
|
||||||
lastChar
|
lastChar
|
||||||
));
|
));
|
||||||
this.value = this.value.substring( 0, this.value.length - 1 );
|
this.value = this.value.substring( 0, this.value.length - 1 );
|
||||||
|
@ -11,7 +11,7 @@ Behaviour.register({
|
|||||||
var newSuggestion = urlSegmentField.suggestNewValue( this.value.toLowerCase() );
|
var newSuggestion = urlSegmentField.suggestNewValue( this.value.toLowerCase() );
|
||||||
var isNew = urlSegmentField.value.indexOf("new") == 0;
|
var isNew = urlSegmentField.value.indexOf("new") == 0;
|
||||||
var confirmMessage = ss.i18n.sprintf(
|
var confirmMessage = ss.i18n.sprintf(
|
||||||
ss.i18n._t('UPDATEURL.CONFIRM'),
|
ss.i18n._t('UPDATEURL.CONFIRM', 'Would you like me to change the URL to:\n\n%s/\n\nClick Ok to change the URL, click Cancel to leave it as:\n\n%s'),
|
||||||
newSuggestion,
|
newSuggestion,
|
||||||
urlSegmentField.value
|
urlSegmentField.value
|
||||||
);
|
);
|
||||||
|
@ -147,7 +147,7 @@ function require(fieldName,cachedError) {
|
|||||||
fieldlabel = "this field";
|
fieldlabel = "this field";
|
||||||
}
|
}
|
||||||
|
|
||||||
var errorMessage = ss.i18n.sprintf(ss.i18n._t('VALIDATOR.FIELDREQUIRED'), fieldLabel);
|
var errorMessage = ss.i18n.sprintf(ss.i18n._t('VALIDATOR.FIELDREQUIRED', 'Please fill out "%s", it is required.'), fieldLabel);
|
||||||
if(baseEl.requiredErrorMsg) errorMessage = baseEl.requiredErrorMsg;
|
if(baseEl.requiredErrorMsg) errorMessage = baseEl.requiredErrorMsg;
|
||||||
else if(_CURRENT_FORM.requiredErrorMsg) errorMessage = _CURRENT_FORM.requiredErrorMsg;
|
else if(_CURRENT_FORM.requiredErrorMsg) errorMessage = _CURRENT_FORM.requiredErrorMsg;
|
||||||
|
|
||||||
|
@ -4,10 +4,10 @@ if(typeof(ss) == 'undefined') ss = {};
|
|||||||
* Lightweight clientside i18n implementation.
|
* Lightweight clientside i18n implementation.
|
||||||
* Caution: Only available after DOM loaded because we need to detect the language
|
* Caution: Only available after DOM loaded because we need to detect the language
|
||||||
*
|
*
|
||||||
* Based on jQuery i18n plugin: 1.0.0 Feb-10-2008
|
* For non-i18n stub implementation, see sapphire/javascript/i18nx.js
|
||||||
* @requires jQuery v1.1 or later
|
*
|
||||||
|
* Based on jQuery i18n plugin: 1.0.0 Feb-10-2008
|
||||||
*
|
*
|
||||||
* Examples at: http://recurser.com/articles/2008/02/21/jquery-i18n-translation-plugin/
|
|
||||||
* Dual licensed under the MIT and GPL licenses:
|
* Dual licensed under the MIT and GPL licenses:
|
||||||
* http://www.opensource.org/licenses/mit-license.php
|
* http://www.opensource.org/licenses/mit-license.php
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
@ -51,8 +51,8 @@ ss.i18n = {
|
|||||||
* dictionary and returns the translation if one exists. If a translation
|
* dictionary and returns the translation if one exists. If a translation
|
||||||
* is not found, returns the original word
|
* is not found, returns the original word
|
||||||
*
|
*
|
||||||
* @param string entity
|
* @param string entity A "long" locale format, e.g. "de_DE" (Required)
|
||||||
* @param string fallbackString
|
* @param string fallbackString (Required)
|
||||||
* @param int priority (not used)
|
* @param int priority (not used)
|
||||||
* @param string context Give translators context for the string
|
* @param string context Give translators context for the string
|
||||||
* @return string : Translated word
|
* @return string : Translated word
|
||||||
|
40
javascript/i18nx.js
Normal file
40
javascript/i18nx.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
if(typeof(ss) == 'undefined') ss = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stub implementation for ss.i18n code.
|
||||||
|
* Use instead of sapphire/javascript/i18n.js
|
||||||
|
* if you want to use any SilverStripe javascript
|
||||||
|
* without internationalization support.
|
||||||
|
*/
|
||||||
|
ss.i18n = {
|
||||||
|
currentLocale: 'en_US',
|
||||||
|
|
||||||
|
defaultLocale: 'en_US',
|
||||||
|
|
||||||
|
_t: function (entity, fallbackString, priority, context) {
|
||||||
|
return fallbackString;
|
||||||
|
},
|
||||||
|
|
||||||
|
sprintf: function(S) {
|
||||||
|
if (arguments.length == 1) return S;
|
||||||
|
|
||||||
|
var nS = "";
|
||||||
|
var tS = S.split("%s");
|
||||||
|
|
||||||
|
var args = [];
|
||||||
|
for (var i=1, len = arguments.length; i <len; ++i) {
|
||||||
|
args.push(arguments[i]);
|
||||||
|
};
|
||||||
|
|
||||||
|
for(var i=0; i<args.length; i++) {
|
||||||
|
if (tS[i].lastIndexOf('%') == tS[i].length-1 && i != args.length-1)
|
||||||
|
tS[i] += "s"+tS.splice(i+1,1)[0];
|
||||||
|
nS += tS[i] + args[i];
|
||||||
|
}
|
||||||
|
return nS + tS[tS.length-1];
|
||||||
|
},
|
||||||
|
|
||||||
|
// stub methods
|
||||||
|
addDictionary: function() {},
|
||||||
|
getDictionary: function() {}
|
||||||
|
};
|
@ -108,7 +108,7 @@ class SearchContext extends Object {
|
|||||||
if($existingQuery) {
|
if($existingQuery) {
|
||||||
$query = $existingQuery;
|
$query = $existingQuery;
|
||||||
} else {
|
} else {
|
||||||
$query = $model->buildSQL();
|
$query = $model->extendedSQL();
|
||||||
}
|
}
|
||||||
|
|
||||||
$SQL_limit = Convert::raw2sql($limit);
|
$SQL_limit = Convert::raw2sql($limit);
|
||||||
|
@ -11,6 +11,7 @@ class BasicAuth extends Object {
|
|||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
static protected $enabled = false;
|
static protected $enabled = false;
|
||||||
|
static protected $autologin = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Require basic authentication. Will request a username and password if none is given.
|
* Require basic authentication. Will request a username and password if none is given.
|
||||||
@ -33,6 +34,9 @@ class BasicAuth extends Object {
|
|||||||
|
|
||||||
if($member) {
|
if($member) {
|
||||||
$authenticated = true;
|
$authenticated = true;
|
||||||
|
if(self::$autologin) {
|
||||||
|
$member->logIn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,8 +68,9 @@ class BasicAuth extends Object {
|
|||||||
return $member;
|
return $member;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function enable() {
|
static function enable($auto = false) {
|
||||||
self::$enabled = true;
|
self::$enabled = true;
|
||||||
|
self::$autologin = $auto;
|
||||||
}
|
}
|
||||||
static function disable() {
|
static function disable() {
|
||||||
self::$enabled = false;
|
self::$enabled = false;
|
||||||
|
@ -37,15 +37,6 @@ class MemberLoginForm extends LoginForm {
|
|||||||
Requirements::css($customCSS);
|
Requirements::css($customCSS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus on the email input when the page is loaded
|
|
||||||
Requirements::customScript("
|
|
||||||
(function($){
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#Email input').focus();
|
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
");
|
|
||||||
|
|
||||||
if(isset($_REQUEST['BackURL'])) {
|
if(isset($_REQUEST['BackURL'])) {
|
||||||
$backURL = $_REQUEST['BackURL'];
|
$backURL = $_REQUEST['BackURL'];
|
||||||
} else {
|
} else {
|
||||||
@ -85,6 +76,18 @@ class MemberLoginForm extends LoginForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($controller, $name, $fields, $actions);
|
parent::__construct($controller, $name, $fields, $actions);
|
||||||
|
|
||||||
|
// Focus on the email input when the page is loaded
|
||||||
|
// Only include this if other form JS validation is enabled
|
||||||
|
if($this->getValidator()->getJavascriptValidationHandler() != 'none') {
|
||||||
|
Requirements::customScript(<<<JS
|
||||||
|
(function() {
|
||||||
|
var el = document.getElementById("MemberLoginForm_LoginForm_Email");
|
||||||
|
if(el && el.focus) el.focus();
|
||||||
|
})();
|
||||||
|
JS
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user