mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #951 from halkyon/deprecation_cleanup
Deprecation cleanup
This commit is contained in:
commit
49e54c81a2
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage admin
|
||||
* @deprecated 3.0 Use {@link LeftAndMainExtension}
|
||||
*/
|
||||
abstract class LeftAndMainDecorator extends LeftAndMainExtension {
|
||||
|
||||
public function __construct() {
|
||||
Deprecation::notice('3.0', 'Use LeftAndMainExtension instead.', Deprecation::SCOPE_CLASS);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
@ -308,26 +308,6 @@ class Director implements TemplateGlobalProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the urlParam with the given name
|
||||
*
|
||||
* @deprecated 3.0 Use SS_HTTPRequest->param()
|
||||
*/
|
||||
public static function urlParam($name) {
|
||||
Deprecation::notice('3.0', 'Use SS_HTTPRequest->param() instead.');
|
||||
if(isset(Director::$urlParams[$name])) return Director::$urlParams[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of urlParams.
|
||||
*
|
||||
* @deprecated 3.0 Use SS_HTTPRequest->params()
|
||||
*/
|
||||
public static function urlParams() {
|
||||
Deprecation::notice('3.0', 'Use SS_HTTPRequest->params() instead.');
|
||||
return Director::$urlParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set url parameters (should only be called internally by RequestHandler->handleRequest()).
|
||||
@ -420,55 +400,6 @@ class Director implements TemplateGlobalProvider {
|
||||
? 'https://' : 'http://';
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to another page.
|
||||
* @deprecated 2.5 Use Controller->redirect()
|
||||
* - $url can be an absolute URL
|
||||
* - or it can be a URL relative to the "site base"
|
||||
* - if it is just a word without an slashes, then it redirects to another action on the current controller.
|
||||
*/
|
||||
public static function redirect($url, $code=302) {
|
||||
Deprecation::notice('2.5', 'Use Controller->redirect() instead.');
|
||||
Controller::curr()->redirect($url, $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether a redirection has been requested.
|
||||
* @deprecated 2.5 Use Controller->redirectedTo() instead
|
||||
* @return string If redirect() has been called, it will return the URL redirected to. Otherwise, it will
|
||||
* return null;
|
||||
*/
|
||||
public static function redirected_to() {
|
||||
Deprecation::notice('2.5', 'Use Controller->redirectedTo() instead.');
|
||||
return Controller::curr()->redirectedTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP status code
|
||||
* @deprecated 2.5 Use Controller->getResponse()->setStatusCode() instead
|
||||
*/
|
||||
public static function set_status_code($code) {
|
||||
Deprecation::notice('2.5', 'Use Controller->getResponse()->setStatusCode() instead');
|
||||
return Controller::curr()->getResponse()->setStatusCode($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current HTTP status code
|
||||
* @deprecated 2.5 Use Controller->getResponse()->getStatusCode() instead
|
||||
*/
|
||||
public static function get_status_code() {
|
||||
Deprecation::notice('2.5', 'Use Controller->getResponse()->getStatusCode() instead');
|
||||
return Controller::curr()->getResponse()->getStatusCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.5 Use Controller->redirectBack()
|
||||
*/
|
||||
public static function redirectBack() {
|
||||
Deprecation::notice('2.5', 'Use Controller->redirectBack() instead.');
|
||||
Controller::curr()->redirectBack();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the root URL for the site.
|
||||
* It will be automatically calculated unless it is overridden with {@link setBaseURL()}.
|
||||
@ -878,38 +809,6 @@ class Director implements TemplateGlobalProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify HTTP_HOST values that are development environments.
|
||||
* For information about environment types, see {@link Director::set_environment_type()}.
|
||||
*
|
||||
* CAUTION: Domain information can easily be spoofed in HTTP requests,
|
||||
* we recommend to set this mode via {@link Director::set_environment_type()}
|
||||
* or an _ss_environment.php instead.
|
||||
*
|
||||
* @deprecated 3.0 Use Director::set_environment_type() or an _ss_environment.php instead.
|
||||
* @param $servers array An array of HTTP_HOST values that should be treated as development environments.
|
||||
*/
|
||||
public static function set_dev_servers($servers) {
|
||||
Deprecation::notice('3.0', 'Use Director::set_environment_type() or an _ss_environment.php instead.');
|
||||
Director::$dev_servers = $servers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify HTTP_HOST values that are test environments.
|
||||
* For information about environment types, see {@link Director::set_environment_type()}.
|
||||
*
|
||||
* CAUTION: Domain information can easily be spoofed in HTTP requests,
|
||||
* we recommend to set this mode via {@link Director::set_environment_type()}
|
||||
* or an _ss_environment.php instead.
|
||||
*
|
||||
* @deprecated 3.0 Use Director::set_environment_type() or an _ss_environment.php instead.
|
||||
* @param $servers array An array of HTTP_HOST values that should be treated as test environments.
|
||||
*/
|
||||
public static function set_test_servers($servers) {
|
||||
Deprecation::notice('3.0', 'Use Director::set_environment_type() or an _ss_environment.php instead.');
|
||||
Director::$test_servers = $servers;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will return true if the site is in a live environment.
|
||||
* For information about environment types, see {@link Director::set_environment_type()}.
|
||||
|
@ -364,14 +364,6 @@ class RequestHandler extends ViewableData {
|
||||
throw new SS_HTTPResponse_Exception($errorMessage, $errorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use SS_HTTPRequest->isAjax() instead (through Controller->getRequest())
|
||||
*/
|
||||
public function isAjax() {
|
||||
Deprecation::notice('3.0', 'Use SS_HTTPRequest->isAjax() instead (through Controller->getRequest())');
|
||||
return $this->request->isAjax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SS_HTTPRequest object that this controller is using.
|
||||
* Returns a placeholder {@link NullHTTPRequest} object unless
|
||||
|
@ -183,14 +183,6 @@ class ClassInfo {
|
||||
return in_array($className, SS_ClassLoader::instance()->getManifest()->getImplementorsOf($interfaceName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Please use is_subclass_of.
|
||||
*/
|
||||
public static function is_subclass_of($class, $parent) {
|
||||
Deprecation::notice('3.0', 'Use is_subclass_of() instead.');
|
||||
return is_subclass_of($class, $parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all classes contained in a file.
|
||||
* @uses ManifestBuilder
|
||||
|
@ -304,19 +304,6 @@ Debug::loadErrorHandlers();
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// HELPER FUNCTIONS
|
||||
|
||||
function getSysTempDir() {
|
||||
Deprecation::notice(3.0, 'Please use PHP function get_sys_temp_dir() instead.');
|
||||
return sys_get_temp_dir();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Please use {@link SS_ClassManifest::getItemPath()}.
|
||||
*/
|
||||
function getClassFile($className) {
|
||||
Deprecation::notice('3.0', 'Use SS_ClassManifest::getItemPath() instead.');
|
||||
return SS_ClassLoader::instance()->getManifest()->getItemPath($className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a class instance by the "singleton" design pattern.
|
||||
* It will always return the same instance for this class,
|
||||
|
@ -417,29 +417,4 @@ class PaginatedList extends SS_ListDecorator {
|
||||
}
|
||||
}
|
||||
|
||||
// DEPRECATED --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use individual getter methods.
|
||||
*/
|
||||
public function getPageLimits() {
|
||||
Deprecation::notice('3.0', 'Use getPageStart, getPageLength, or getTotalItems instead.');
|
||||
return array(
|
||||
'pageStart' => $this->getPageStart(),
|
||||
'pageLength' => $this->pageLength,
|
||||
'totalSize' => $this->getTotalItems(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use individual setter methods.
|
||||
*/
|
||||
public function setPageLimits($pageStart, $pageLength, $totalSize) {
|
||||
Deprecation::notice('3.0', 'Use setPageStart, setPageLength, or setTotalItems instead.');
|
||||
$this->setPageStart($pageStart);
|
||||
$this->setPageLength($pageLength);
|
||||
$this->setTotalSize($totalSize);
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
typography.css has been removed from framework, why shall we still has this? a dynamic typographp.css should be used by
|
||||
server side call, like Requirements::css();
|
||||
@import url("typography.css");
|
||||
*/
|
||||
html, body { padding: 0; margin: 0; border-style: none; height: 100%; overflow: hidden; }
|
||||
|
||||
form { margin: 0; padding: 0; }
|
||||
|
||||
h2 { margin: 0; font-size: 1.4em; }
|
||||
|
||||
/** Selection Groups */
|
||||
.SelectionGroup { padding: 0; margin: 10px 0 0 0; }
|
||||
|
||||
.SelectionGroup li { list-style-type: none; margin: 0 0 4px; }
|
||||
|
||||
.SelectionGroup li label { font-size: 11px; }
|
||||
|
||||
.SelectionGroup li input.selector { width: 20px; margin-top: 0; }
|
||||
|
||||
.SelectionGroup li div.field { display: none; }
|
||||
|
||||
.SelectionGroup li.selected div.field { display: block; margin-left: 30px; margin-bottom: 1em; margin-top: 4px; }
|
||||
|
||||
.mainblock .SelectionGroup li.selected div.field { margin-left: 27px; margin-bottom: 4px; }
|
||||
|
||||
.SelectionGroup li.selected label.selector { font-weight: bold; }
|
||||
|
||||
/** TreeDropdownField stying */
|
||||
.SelectionGroup div.TreeDropdownField { width: 241px; padding: 0; }
|
||||
|
||||
html > body div.TreeDropdownField { position: relative; }
|
||||
|
||||
.SelectionGroup div.TreeDropdownField span.items { display: block; height: 100%; border: 1px #7f9db9 solid; cursor: pointer; width: 214px; float: left; padding-top: 2px; padding-bottom: 2px; background-color: white; }
|
||||
|
||||
.SelectionGroup div.TreeDropdownField div.tree_holder { clear: left; cursor: default; border: 1px black solid; margin: 0; height: 180px; overflow: auto; background-color: white; /** HACK IE6, see http://www.hedgerwow.com/360/bugs/css-select-free.html */ position: absolute; z-index: 10; width: 238px; /*must have for any value*/ }
|
||||
|
||||
html > body div.TreeDropdownField div.tree_holder { top: 20px; left: 0px; z-index: 1000; }
|
||||
|
||||
/** HACK IE6, see http://www.hedgerwow.com/360/bugs/css-select-free.html */
|
||||
.SelectionGroup div.TreeDropdownField div.tree_holder iframe { display: none; /* IE5*/ display/**/: block; /* IE5*/ position: absolute; top: 0; left: 0; z-index: -1; filter: mask(); width: 180px; /*must have for any big value*/ height: 200px; border: 0; }
|
||||
|
||||
div.TreeDropdownField a.editLink { border-width: 1px 1px 1px 0; background: url(../images/TreeDropdownField_button.gif) left top no-repeat; width: 19px; height: 21px; margin: 0; padding: 0; float: left; clear: right; z-index: 0; overflow: hidden; }
|
||||
|
||||
/* added block/width so tree values don't disappear in ie7 */
|
||||
.SelectionGroup div.TreeDropdownField ul.tree li { display: block; width: 100%; }
|
||||
|
||||
.Actions { text-align: right; margin: 0; position: absolute; right: 5px; bottom: 5px; }
|
||||
|
||||
.mainblock { float: left; border: 1px solid #ccc; padding: 5px; margin-right: 5px; height: 140px; position: relative; }
|
||||
|
||||
.mainblock.editform { width: 275px; }
|
||||
|
||||
.mainblock.attached { position: absolute; left: 270px; width: 100px; }
|
||||
|
||||
.mainblock form fieldset { border: none; }
|
||||
|
||||
.mainblock form div.Actions input { font-size: 11px; }
|
174
dev/Debug.php
174
dev/Debug.php
@ -82,7 +82,17 @@ class Debug {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function caller() {
|
||||
$bt = debug_backtrace();
|
||||
$caller = $bt[2];
|
||||
$caller['line'] = $bt[1]['line'];
|
||||
$caller['file'] = $bt[1]['file'];
|
||||
if(!isset($caller['class'])) $caller['class'] = '';
|
||||
if(!isset($caller['type'])) $caller['type'] = '';
|
||||
return $caller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close out the show dumper
|
||||
*
|
||||
@ -447,168 +457,6 @@ class Debug {
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch an email notification message when an error is triggered.
|
||||
* @deprecated 2.5
|
||||
* To create error logs by email, use this code instead:
|
||||
* <code>
|
||||
* $emailWriter = new SS_LogEmailWriter('my@email.com');
|
||||
* SS_Log::add_writer($emailWriter, SS_Log::ERR);
|
||||
* </code>
|
||||
*
|
||||
* @param string $emailAddress
|
||||
* @param string $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param int $errline
|
||||
* @param string $errcontext
|
||||
* @param string $errorType "warning" or "error"
|
||||
* @return boolean
|
||||
*/
|
||||
public static function emailError($emailAddress, $errno, $errstr, $errfile, $errline, $errcontext,
|
||||
$errorType = "Error") {
|
||||
|
||||
Deprecation::notice('2.5',
|
||||
'Use SS_Log instead. See the class documentation in SS_Log.php for more information.');
|
||||
$priority = ($errorType == 'Error') ? SS_Log::ERR : SS_Log::WARN;
|
||||
$writer = new SS_LogEmailWriter($emailAddress);
|
||||
SS_Log::add_writer($writer, $priority);
|
||||
SS_Log::log(
|
||||
array(
|
||||
'errno' => $errno,
|
||||
'errstr' => $errstr,
|
||||
'errfile' => $errfile,
|
||||
'errline' => $errline,
|
||||
'errcontext' => $errcontext
|
||||
),
|
||||
$priority
|
||||
);
|
||||
SS_Log::remove_writer($writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the given error, if self::$log_errors is set.
|
||||
* Uses the native error_log() funtion in PHP.
|
||||
*
|
||||
* Format: [d-M-Y h:i:s] <type> at <file> line <line>: <errormessage> <url>
|
||||
*
|
||||
* @todo Detect script path for CLI errors
|
||||
* @todo Log detailed errors to full file
|
||||
* @deprecated 2.5 See SS_Log on setting up error file logging
|
||||
*/
|
||||
protected static function log_error_if_necessary($errno, $errstr, $errfile, $errline, $errcontext, $errtype) {
|
||||
Deprecation::notice('2.5',
|
||||
'Use SS_Log instead. See the class documentation in SS_Log.php for more information.');
|
||||
$priority = ($errtype == 'Error') ? SS_Log::ERR : SS_Log::WARN;
|
||||
$writer = new SS_LogFileWriter('../' . self::$log_errors_to);
|
||||
SS_Log::add_writer($writer, $priority);
|
||||
SS_Log::log(
|
||||
array(
|
||||
'errno' => $errno,
|
||||
'errstr' => $errstr,
|
||||
'errfile' => $errfile,
|
||||
'errline' => $errline,
|
||||
'errcontext' => $errcontext
|
||||
),
|
||||
$priority
|
||||
);
|
||||
SS_Log::remove_writer($writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $server IP-Address or domain
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*/
|
||||
public static function set_custom_smtp_server($server) {
|
||||
self::$custom_smtp_server = $server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*/
|
||||
public static function get_custom_smtp_server() {
|
||||
return self::$custom_smtp_server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send errors to the given email address.
|
||||
* Can be used like so:
|
||||
* if(Director::isLive()) Debug::send_errors_to("sam@silverstripe.com");
|
||||
*
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*
|
||||
* @param string $emailAddress The email address to send errors to
|
||||
* @param string $sendWarnings Set to true to send warnings as well as errors (Default: false)
|
||||
*/
|
||||
public static function send_errors_to($emailAddress, $sendWarnings = false) {
|
||||
Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.');
|
||||
self::$send_errors_to = $emailAddress;
|
||||
self::$send_warnings_to = $sendWarnings ? $emailAddress : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*/
|
||||
public static function get_send_errors_to() {
|
||||
Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.');
|
||||
return self::$send_errors_to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $emailAddress
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*/
|
||||
public static function send_warnings_to($emailAddress) {
|
||||
Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.');
|
||||
self::$send_warnings_to = $emailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*/
|
||||
public static function get_send_warnings_to() {
|
||||
Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.');
|
||||
return self::$send_warnings_to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to enable logging of errors.
|
||||
* @deprecated 2.5 See SS_Log on setting up error file logging
|
||||
*/
|
||||
public static function log_errors_to($logFile = ".sserrors") {
|
||||
Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error file logging.');
|
||||
self::$log_errors_to = $logFile;
|
||||
}
|
||||
|
||||
public static function caller() {
|
||||
$bt = debug_backtrace();
|
||||
$caller = $bt[2];
|
||||
$caller['line'] = $bt[1]['line'];
|
||||
$caller['file'] = $bt[1]['file'];
|
||||
if(!isset($caller['class'])) $caller['class'] = '';
|
||||
if(!isset($caller['type'])) $caller['type'] = '';
|
||||
return $caller;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.5 Please use {@link SS_Backtrace::backtrace()}
|
||||
*/
|
||||
public static function backtrace($returnVal = false, $ignoreAjax = false) {
|
||||
Deprecation::notice('2.5', 'Use SS_Backtrace::backtrace instead.');
|
||||
return SS_Backtrace::backtrace($returnVal, $ignoreAjax);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.5 Please use {@link SS_Backtrace::get_rendered_backtrace()}
|
||||
*/
|
||||
public static function get_rendered_backtrace($bt, $plainText = false) {
|
||||
Deprecation::notice('2.5', 'Use SS_Backtrace::get_rendered_backtrace() instead.');
|
||||
return SS_Backtrace::get_rendered_backtrace($bt, $plainText);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user has permissions to run URL debug tools,
|
||||
|
@ -234,14 +234,6 @@ class File extends DataObject {
|
||||
return $this->Filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use getTreeTitle()
|
||||
*/
|
||||
public function TreeTitle() {
|
||||
Deprecation::notice('3.0', 'Use getTreeTitle() instead.');
|
||||
return $this->getTreeTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
@ -221,88 +221,6 @@ class Upload extends Controller {
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get maximum file size for all or specified file extension.
|
||||
*
|
||||
* @deprecated 2.5 Please use Upload_Validator::getAllowedMaxFileSize() instead
|
||||
*
|
||||
* @param string $ext
|
||||
* @return int Filesize in bytes
|
||||
*/
|
||||
public function getAllowedMaxFileSize($ext = null) {
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::getAllowedMaxFileSize() instead.');
|
||||
return $this->validator->getAllowedMaxFileSize($ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set filesize maximums (in bytes).
|
||||
* Automatically converts extensions to lowercase
|
||||
* for easier matching.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* array('*' => 200, 'jpg' => 1000)
|
||||
* </code>
|
||||
*
|
||||
* @deprecated 2.5 Please use Upload_Validator::setAllowedMaxFileSize() instead
|
||||
*
|
||||
* @param array|int $rules
|
||||
*/
|
||||
public function setAllowedMaxFileSize($rules) {
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::setAllowedMaxFileSize() instead.');
|
||||
$this->validator->setAllowedMaxFileSize($rules);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.5 Please use Upload_Validator::getAllowedExtensions() instead
|
||||
* @return array
|
||||
*/
|
||||
public function getAllowedExtensions() {
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::getAllowedExtensions() instead.');
|
||||
return $this->validator->getAllowedExtensions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.5 Please use Upload_Validator::setAllowedExtensions() instead
|
||||
* @param array $rules
|
||||
*/
|
||||
public function setAllowedExtensions($rules) {
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::setAllowedExtensions() instead.');
|
||||
$this->validator->setAllowedExtensions($rules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the bytesize of an uploaded
|
||||
* file is valid - can be defined on an
|
||||
* extension-by-extension basis in {$allowedMaxFileSize}
|
||||
*
|
||||
* @deprecated 2.5 Please use Upload_Validator::isValidExtension() instead
|
||||
*
|
||||
* @param array $tmpFile
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidSize($tmpFile) {
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::isValidSize() instead.');
|
||||
$validator = new Upload_Validator();
|
||||
$validator->setTmpFile($tmpFile);
|
||||
return $validator->isValidSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the temporary file has a valid extension
|
||||
*
|
||||
* @deprecated 2.5 Please use Upload_Validator::isValidExtension() instead
|
||||
*
|
||||
* @param array $tmpFile
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidExtension($tmpFile) {
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::isValidExtension() instead.');
|
||||
$validator = new Upload_Validator();
|
||||
$validator->setTmpFile($tmpFile);
|
||||
return $validator->isValidExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear out all errors (mostly set by {loadUploaded()})
|
||||
*/
|
||||
|
@ -52,7 +52,7 @@ class AjaxUniqueTextField extends TextField {
|
||||
'maxlength' => ($this->maxLength) ? $this->maxLength : null
|
||||
);
|
||||
|
||||
return $this->createTag('input', $attributes);
|
||||
return FormField::create_tag('input', $attributes);
|
||||
}
|
||||
|
||||
public function validate( $validator ) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* - childID Identifier of the database-record (the targeted table is determined by the $sourceClass
|
||||
* parameter)
|
||||
*
|
||||
* @deprecated 3.0 Use GridField with GridFieldConfig_RecordEditor
|
||||
* @deprecated 3.1 Use GridField with GridFieldConfig_RecordEditor
|
||||
*
|
||||
* @todo Control width/height of popup by constructor (hardcoded at the moment)
|
||||
* @package forms
|
||||
@ -453,7 +453,7 @@ JS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0
|
||||
* @deprecated 3.1
|
||||
*/
|
||||
public function setRelationAutoSetting($value) {
|
||||
Deprecation::notice('3.0', 'Manipulate the DataList instead.');
|
||||
|
@ -69,14 +69,6 @@ class CompositeField extends FormField {
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Please use {@link FieldList()}.
|
||||
*/
|
||||
public function FieldSet() {
|
||||
Deprecation::notice('3.0', 'Use FieldList() instead.');
|
||||
return $this->FieldList();
|
||||
}
|
||||
|
||||
public function setID($id) {
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @deprecated 3.0 Please use {@link FieldList}.
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage fields-structural
|
||||
*/
|
||||
class FieldSet extends FieldList {
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use FieldList instead
|
||||
*/
|
||||
public function __construct($items = array()) {
|
||||
Deprecation::notice('3.0', 'Use FieldList instead.');
|
||||
parent::__construct(!is_array($items) || func_num_args() > 1 ? func_get_args(): $items);
|
||||
}
|
||||
}
|
@ -43,30 +43,6 @@
|
||||
*/
|
||||
class FileField extends FormField {
|
||||
|
||||
/**
|
||||
* Restrict filesize for either all filetypes
|
||||
* or a specific extension, with extension-name
|
||||
* as array-key and the size-restriction in bytes as array-value.
|
||||
*
|
||||
* @deprecated 2.5
|
||||
* @var array
|
||||
*/
|
||||
public $allowedMaxFileSize = array();
|
||||
|
||||
/**
|
||||
* @var array Collection of extensions.
|
||||
* Extension-names are treated case-insensitive.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* array("jpg","GIF")
|
||||
* </code>
|
||||
*
|
||||
* @deprecated 2.5
|
||||
* @var array
|
||||
*/
|
||||
public $allowedExtensions = array();
|
||||
|
||||
/**
|
||||
* Flag to automatically determine and save a has_one-relationship
|
||||
* on the saved record (e.g. a "Player" has_one "PlayerImage" would
|
||||
@ -102,14 +78,6 @@ class FileField extends FormField {
|
||||
* @param int $value The value of the field.
|
||||
*/
|
||||
public function __construct($name, $title = null, $value = null) {
|
||||
if(count(func_get_args()) > 3) {
|
||||
Deprecation::notice(
|
||||
'3.0',
|
||||
'Use setRightTitle() and setFolderName() instead of constructor arguments',
|
||||
Deprecation::SCOPE_GLOBAL
|
||||
);
|
||||
}
|
||||
|
||||
$this->upload = new Upload();
|
||||
|
||||
parent::__construct($name, $title, $value);
|
||||
@ -223,4 +191,4 @@ class FileField extends FormField {
|
||||
$this->upload = $upload;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,277 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* A field that allows you to attach a file to a DataObject without submitting the form it is part of, through the use
|
||||
* of an iframe.
|
||||
*
|
||||
* If all you need is a simple file upload, it is reccomended you use {@link FileField}
|
||||
*
|
||||
* @deprecated 3.0 Use UploadField
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage fields-files
|
||||
*/
|
||||
class FileIFrameField extends FileField {
|
||||
|
||||
public static $allowed_actions = array (
|
||||
'iframe',
|
||||
'EditFileForm',
|
||||
'DeleteFileForm'
|
||||
);
|
||||
|
||||
/**
|
||||
* Flag that controls whether or not new files
|
||||
* can be uploaded by the user from their local computer.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $canUploadNewFile = true;
|
||||
|
||||
/**
|
||||
* Sets whether or not files can be uploaded into the CMS from the user's local computer
|
||||
*
|
||||
* @param boolean
|
||||
*/
|
||||
public function setCanUploadNewFile($can) {
|
||||
$this->canUploadNewFile = $can;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCanUploadNewFile() {
|
||||
return $this->canUploadNewFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data class that this field is editing.
|
||||
* @return string Class name
|
||||
*/
|
||||
public function dataClass() {
|
||||
if($this->form && $this->form->getRecord()) {
|
||||
$class = $this->form->getRecord()->has_one($this->getName());
|
||||
return ($class) ? $class : 'File';
|
||||
} else {
|
||||
return 'File';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function Field($properties = array()) {
|
||||
Deprecation::notice('3.0', 'Use UploadField');
|
||||
|
||||
Requirements::css(FRAMEWORK_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
|
||||
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang');
|
||||
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
|
||||
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
|
||||
|
||||
|
||||
if($this->form->getRecord() && $this->form->getRecord()->exists()) {
|
||||
$record = $this->form->getRecord();
|
||||
if(class_exists('Translatable') && SiteTree::has_extension('Translatable') && $record->Locale){
|
||||
$iframe = "iframe?locale=".$record->Locale;
|
||||
}else{
|
||||
$iframe = "iframe";
|
||||
}
|
||||
|
||||
return $this->createTag (
|
||||
'iframe',
|
||||
array (
|
||||
'name' => $this->getName() . '_iframe',
|
||||
'src' => Controller::join_links($this->Link(), $iframe),
|
||||
'style' => 'height: 152px; width: 100%; border: none;'
|
||||
)
|
||||
) . $this->createTag (
|
||||
'input',
|
||||
array (
|
||||
'type' => 'hidden',
|
||||
'id' => $this->ID(),
|
||||
'name' => $this->getName() . 'ID',
|
||||
'value' => $this->attrValue()
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return _t(
|
||||
'FileIFrameField.ATTACHONCESAVED',
|
||||
'{type}s can be attached once you have saved the record for the first time.',
|
||||
array('type' => $this->FileTypeName())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to retreive a File object that has already been attached to this forms data record
|
||||
*
|
||||
* @return File|null
|
||||
*/
|
||||
public function AttachedFile() {
|
||||
return $this->form->getRecord() ? $this->form->getRecord()->{$this->getName()}() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function iframe() {
|
||||
// clear the requirements added by any parent controllers
|
||||
Requirements::clear();
|
||||
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang');
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
|
||||
Requirements::javascript(FRAMEWORK_DIR . '/javascript/FileIFrameField.js');
|
||||
|
||||
Requirements::css(FRAMEWORK_DIR . '/css/FileIFrameField.css');
|
||||
|
||||
return $this->renderWith('FileIframeField_iframe');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Form
|
||||
*/
|
||||
public function EditFileForm() {
|
||||
$uploadFile = _t('FileIFrameField.FROMCOMPUTER', 'From your Computer');
|
||||
$selectFile = _t('FileIFrameField.FROMFILESTORE', 'From the File Store');
|
||||
|
||||
if($this->AttachedFile() && $this->AttachedFile()->ID) {
|
||||
$title = _t('FileIFrameField.REPLACE', 'Replace {type}', array('type' => $this->FileTypeName()));
|
||||
} else {
|
||||
$title = _t('FileIFrameField.ATTACH', 'Attach {type}', array('type' => $this->FileTypeName()));
|
||||
}
|
||||
|
||||
$fileSources = array();
|
||||
|
||||
if(singleton($this->dataClass())->canCreate()) {
|
||||
if($this->canUploadNewFile) {
|
||||
$fileSources["new//$uploadFile"] = new FileField('Upload', '');
|
||||
}
|
||||
}
|
||||
|
||||
$fileSources["existing//$selectFile"] = new TreeDropdownField('ExistingFile', '', 'File');
|
||||
|
||||
$fields = new FieldList (
|
||||
new HeaderField('EditFileHeader', $title),
|
||||
new SelectionGroup('FileSource', $fileSources)
|
||||
);
|
||||
|
||||
// locale needs to be passed through from the iframe source
|
||||
if(isset($_GET['locale'])) {
|
||||
$fields->push(new HiddenField('locale', '', $_GET['locale']));
|
||||
}
|
||||
|
||||
return new Form (
|
||||
$this,
|
||||
'EditFileForm',
|
||||
$fields,
|
||||
new FieldList(
|
||||
new FormAction('save', $title)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function save($data, $form) {
|
||||
// check the user has entered all the required information
|
||||
if (
|
||||
!isset($data['FileSource'])
|
||||
|| ($data['FileSource'] == 'new' && (!isset($_FILES['Upload']) || !$_FILES['Upload']))
|
||||
|| ($data['FileSource'] == 'existing' && (!isset($data['ExistingFile']) || !$data['ExistingFile']))
|
||||
) {
|
||||
$form->sessionMessage(_t('FileIFrameField.NOSOURCE', 'Please select a source file to attach'), 'required');
|
||||
$form->getController()->redirectBack();
|
||||
return;
|
||||
}
|
||||
|
||||
$desiredClass = $this->dataClass();
|
||||
$controller = $this->form->getController();
|
||||
|
||||
// upload a new file
|
||||
if($data['FileSource'] == 'new') {
|
||||
$fileObject = Object::create($desiredClass);
|
||||
|
||||
try {
|
||||
$this->upload->loadIntoFile($_FILES['Upload'], $fileObject, $this->folderName);
|
||||
} catch (Exception $e){
|
||||
$form->sessionMessage(_t('FileIFrameField.DISALLOWEDFILETYPE',
|
||||
'This filetype is not allowed to be uploaded'), 'bad');
|
||||
$controller->redirectBack();
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->upload->isError()) {
|
||||
$controller->redirectBack();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->form->getRecord()->{$this->getName() . 'ID'} = $fileObject->ID;
|
||||
|
||||
$fileObject->write();
|
||||
}
|
||||
|
||||
// attach an existing file from the assets store
|
||||
if($data['FileSource'] == 'existing') {
|
||||
$fileObject = DataObject::get_by_id('File', $data['ExistingFile']);
|
||||
|
||||
// dont allow the user to attach a folder by default
|
||||
if(!$fileObject || ($fileObject instanceof Folder && $desiredClass != 'Folder')) {
|
||||
$controller->redirectBack();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->form->getRecord()->{$this->getName() . 'ID'} = $fileObject->ID;
|
||||
|
||||
if(!$fileObject instanceof $desiredClass) {
|
||||
$fileObject->ClassName = $desiredClass;
|
||||
$fileObject->write();
|
||||
}
|
||||
}
|
||||
|
||||
$this->form->getRecord()->write();
|
||||
$controller->redirectBack();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Form
|
||||
*/
|
||||
public function DeleteFileForm() {
|
||||
$form = new Form (
|
||||
$this,
|
||||
'DeleteFileForm',
|
||||
new FieldList (
|
||||
new HiddenField('DeleteFile', null, false)
|
||||
),
|
||||
new FieldList (
|
||||
$deleteButton = new FormAction (
|
||||
'delete', _t('FileIFrameField.DELETE', 'Delete {type}', array('type' => $this->FileTypeName()))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$deleteButton->addExtraClass('delete');
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function delete($data, $form) {
|
||||
// delete the actual file, or just un-attach it?
|
||||
if(isset($data['DeleteFile']) && $data['DeleteFile']) {
|
||||
$file = DataObject::get_by_id('File', $this->form->getRecord()->{$this->getName() . 'ID'});
|
||||
|
||||
if($file) {
|
||||
$file->delete();
|
||||
}
|
||||
}
|
||||
|
||||
// then un-attach file from this record
|
||||
$this->form->getRecord()->{$this->getName() . 'ID'} = 0;
|
||||
$this->form->getRecord()->write();
|
||||
|
||||
$this->form->getController()->redirectBack();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of file this field is used to attach (e.g. File, Image)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function FileTypeName() {
|
||||
return _t('FileIFrameField.FILE', 'File');
|
||||
}
|
||||
|
||||
}
|
113
forms/Form.php
113
forms/Form.php
@ -575,24 +575,6 @@ class Form extends RequestHandler {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a named field from this form's fields.
|
||||
* It will traverse into composite fields for you, to find the field you want.
|
||||
* It will only return a data field.
|
||||
*
|
||||
* @deprecated 3.0 Use Fields() and FieldList API instead
|
||||
* @return FormField
|
||||
*/
|
||||
public function dataFieldByName($name) {
|
||||
Deprecation::notice('3.0', 'Use Fields() and FieldList API instead');
|
||||
|
||||
foreach($this->getExtraFields() as $field) {
|
||||
if(!$this->fields->dataFieldByName($field->getName())) $this->fields->push($field);
|
||||
}
|
||||
|
||||
return $this->fields->dataFieldByName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the form's action buttons - used by the templates
|
||||
*
|
||||
@ -620,18 +602,6 @@ class Form extends RequestHandler {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the form's action button by its name.
|
||||
*
|
||||
* @deprecated 3.0 Use Actions() and FieldList API instead
|
||||
* @param string $name
|
||||
*/
|
||||
public function unsetActionByName($name) {
|
||||
Deprecation::notice('3.0', 'Use Actions() and FieldList API instead');
|
||||
|
||||
$this->actions->removeByName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param String
|
||||
* @param String
|
||||
@ -667,34 +637,6 @@ class Form extends RequestHandler {
|
||||
return $attrs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the form's dataField by its name
|
||||
*
|
||||
* @deprecated 3.0 Use Fields() and FieldList API instead
|
||||
*/
|
||||
public function unsetDataFieldByName($fieldName){
|
||||
Deprecation::notice('3.0', 'Use Fields() and FieldList API instead');
|
||||
|
||||
foreach($this->Fields()->dataFields() as $child) {
|
||||
if(is_object($child) && ($child->getName() == $fieldName || $child->Title() == $fieldName)) {
|
||||
$child = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a field from the given tab.
|
||||
*
|
||||
* @deprecated 3.0 Use Fields() and FieldList API instead
|
||||
*/
|
||||
public function unsetFieldFromTab($tabName, $fieldName) {
|
||||
Deprecation::notice('3.0', 'Use Fields() and FieldList API instead');
|
||||
|
||||
// Find the tab
|
||||
$tab = $this->Fields()->findOrMakeTab($tabName);
|
||||
$tab->removeByName($fieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the attributes of the form tag - used by the templates.
|
||||
*
|
||||
@ -806,14 +748,6 @@ class Form extends RequestHandler {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Please use {@link getEncType}.
|
||||
*/
|
||||
public function FormEncType() {
|
||||
Deprecation::notice('3.0', 'Please use Form->getEncType() instead.');
|
||||
return $this->getEncType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the real HTTP method for the form:
|
||||
* GET, POST, PUT, DELETE or HEAD.
|
||||
@ -1216,25 +1150,6 @@ class Form extends RequestHandler {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets a specific field to its passed default value.
|
||||
* Does NOT clear out all submitted data in the form.
|
||||
*
|
||||
* @deprecated 3.0 Use Fields() and FieldList API instead
|
||||
* @param string $fieldName
|
||||
* @param mixed $fieldValue
|
||||
*/
|
||||
public function resetField($fieldName, $fieldValue = null) {
|
||||
Deprecation::notice('3.0', 'Use Fields() and FieldList API instead');
|
||||
|
||||
$dataFields = $this->fields->dataFields();
|
||||
if($dataFields) foreach($dataFields as $field) {
|
||||
if($field->getName()==$fieldName) {
|
||||
$field = $field->setValue($fieldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the given method on the given field.
|
||||
* This is used by Ajax-savvy form fields. By putting '&action=callfieldmethod' to the end
|
||||
@ -1380,34 +1295,6 @@ class Form extends RequestHandler {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable security tokens for every form.
|
||||
* Note that this doesn't apply to {@link SecurityToken}
|
||||
* instances outside of the Form class, nor applies
|
||||
* to existing form instances.
|
||||
*
|
||||
* See {@link enable_all_security_tokens()}.
|
||||
*
|
||||
* @deprecated 2.5 Use SecurityToken::disable()
|
||||
*/
|
||||
public static function disable_all_security_tokens() {
|
||||
Deprecation::notice('2.5', 'Use SecurityToken::disable() instead.');
|
||||
SecurityToken::disable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if security is enabled - that is if the security token
|
||||
* should be included and checked on this form.
|
||||
*
|
||||
* @deprecated 2.5 Use Form->getSecurityToken()->isEnabled()
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function securityTokenEnabled() {
|
||||
Deprecation::notice('2.5', 'Use Form->getSecurityToken()->isEnabled() instead.');
|
||||
return $this->securityToken->isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the security token for this form (if any exists).
|
||||
* Doesn't check for {@link securityTokenEnabled()}.
|
||||
|
@ -117,6 +117,23 @@ class FormField extends RequestHandler {
|
||||
return $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct and return HTML tag.
|
||||
*/
|
||||
public static function create_tag($tag, $attributes, $content = null) {
|
||||
$preparedAttributes = '';
|
||||
foreach($attributes as $k => $v) {
|
||||
// Note: as indicated by the $k == value item here; the decisions over what to include in the attributes
|
||||
// can sometimes get finicky
|
||||
if(!empty($v) || $v === '0' || $k == 'value') {
|
||||
$preparedAttributes .= " $k=\"" . Convert::raw2att($v) . "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if($content || $tag != 'input') return "<$tag$preparedAttributes>$content</$tag>";
|
||||
else return "<$tag$preparedAttributes />";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new field.
|
||||
* @param name The internal field name, passed to forms.
|
||||
@ -159,14 +176,6 @@ class FormField extends RequestHandler {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use {@link getName()}.
|
||||
*/
|
||||
public function Name() {
|
||||
Deprecation::notice('3.0', 'Use getName() instead.');
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field message, used by form validation.
|
||||
* Use {@link setError()} to set this property.
|
||||
@ -254,30 +263,6 @@ class FormField extends RequestHandler {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tabindex HTML attribute
|
||||
* (defaults to none).
|
||||
*
|
||||
* @deprecated 3.0 Use setAttribute("tabindex") instead
|
||||
* @param int $index
|
||||
*/
|
||||
public function setTabIndex($index) {
|
||||
Deprecation::notice('3.0', 'Use setAttribute("tabindex") instead');
|
||||
$this->setAttribute($index);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tabindex (if previously set)
|
||||
*
|
||||
* @deprecated 3.0 Use getAttribute("tabindex") instead
|
||||
* @return int
|
||||
*/
|
||||
public function getTabIndex() {
|
||||
Deprecation::notice('3.0', 'Use getAttribute("tabindex") instead');
|
||||
return $this->getAttribute('tabindex');
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles all CSS-classes. Optionally includes a "nolabel"-class
|
||||
* if no title was set on the formfield.
|
||||
@ -771,26 +756,9 @@ class FormField extends RequestHandler {
|
||||
return strtolower(preg_replace('/Field$/', '', $this->class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct and return HTML tag.
|
||||
*
|
||||
* @deprecated 3.0 Please define your own FormField template using {@link setFieldTemplate()}
|
||||
* and/or {@link renderFieldTemplate()}
|
||||
*
|
||||
* @todo Transform to static helper method.
|
||||
*/
|
||||
public function createTag($tag, $attributes, $content = null) {
|
||||
$preparedAttributes = '';
|
||||
foreach($attributes as $k => $v) {
|
||||
// Note: as indicated by the $k == value item here; the decisions over what to include in the attributes
|
||||
// can sometimes get finicky
|
||||
if(!empty($v) || $v === '0' || $k == 'value') {
|
||||
$preparedAttributes .= " $k=\"" . Convert::raw2att($v) . "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if($content || $tag != 'input') return "<$tag$preparedAttributes>$content</$tag>";
|
||||
else return "<$tag$preparedAttributes />";
|
||||
Deprecation::notice('3.1', 'Use FormField::create_tag()');
|
||||
return self::create_tag($tag, $attributes, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -805,15 +773,6 @@ class FormField extends RequestHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use setDescription()
|
||||
*/
|
||||
public function describe($description) {
|
||||
Deprecation::notice('3.0', 'Use setDescription()');
|
||||
$this->setDescription($description);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe this field, provide help text for it.
|
||||
* By default, renders as a "title" attribute on the form field.
|
||||
|
@ -55,7 +55,7 @@ class GroupedDropdownField extends DropdownField {
|
||||
}
|
||||
}
|
||||
|
||||
return $this->createTag('select', $this->getAttributes(), $options);
|
||||
return FormField::create_tag('select', $this->getAttributes(), $options);
|
||||
}
|
||||
|
||||
public function Type() {
|
||||
|
@ -31,7 +31,7 @@
|
||||
*
|
||||
* @see http://doc.silverstripe.org/tutorial/5-dataobject-relationship-management
|
||||
*
|
||||
* @deprecated 3.0 Use GridField with GridFieldConfig_RelationEditor
|
||||
* @deprecated 3.1 Use GridField with GridFieldConfig_RelationEditor
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage fields-relational
|
||||
|
@ -46,11 +46,6 @@ class HtmlEditorField extends TextareaField {
|
||||
* @see TextareaField::__construct()
|
||||
*/
|
||||
public function __construct($name, $title = null, $value = '') {
|
||||
if(count(func_get_args()) > 3) {
|
||||
Deprecation::notice('3.0', 'Use setRows() and setColumns() instead of constructor arguments',
|
||||
Deprecation::SCOPE_GLOBAL);
|
||||
}
|
||||
|
||||
parent::__construct($name, $title, $value);
|
||||
|
||||
self::include_js();
|
||||
@ -81,11 +76,10 @@ class HtmlEditorField extends TextareaField {
|
||||
}
|
||||
}
|
||||
|
||||
return $this->createTag (
|
||||
'textarea',
|
||||
$this->getAttributes(),
|
||||
htmlentities($value->getContent(), ENT_COMPAT, 'UTF-8')
|
||||
);
|
||||
$properties['Value'] = htmlentities($value->getContent(), ENT_COMPAT, 'UTF-8');
|
||||
$obj = $this->customise($properties);
|
||||
|
||||
return $obj->renderWith($this->getTemplates());
|
||||
}
|
||||
|
||||
public function getAttributes() {
|
||||
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* A field that allows you to attach an image to a record from within a iframe - designed for use in AJAX forms where it
|
||||
* is not possible to use {@link SimpleImageField}.
|
||||
*
|
||||
* <b>Usage</b>
|
||||
*
|
||||
* If you want to upload all assets from this field to a given folder you can define the folder in 2 ways. Either in
|
||||
* the constructor or as a method on the field
|
||||
*
|
||||
* <code>
|
||||
* $myField = new ImageField("myName", "Upload image below", null, null, null, "myFolder");
|
||||
* </code>
|
||||
*
|
||||
* Will upload images into the assets/myFolder folder. If that folder does not exist it will create it for you. You can
|
||||
* also define it as a method
|
||||
*
|
||||
* <code>
|
||||
* $myField = new ImageField("myName");
|
||||
* $myField->setFolderName('myFolder');
|
||||
* </code>
|
||||
*
|
||||
* @deprecated 3.0 Use UploadField with $myField->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage fields-files
|
||||
*/
|
||||
class ImageField extends FileIFrameField {
|
||||
|
||||
/**
|
||||
* @return SimpleImageField_Disabled
|
||||
*/
|
||||
public function performReadonlyTransformation() {
|
||||
return new SimpleImageField_Disabled($this->name, $this->title, $this->value, $this->form);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function FileTypeName() {
|
||||
return _t('ImageField.IMAGE', 'Image');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the filter, so the dropdown displays only images and folders.
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
public function EditFileForm() {
|
||||
Deprecation::notice('3.0', 'Use UploadField', Deprecation::SCOPE_CLASS);
|
||||
|
||||
$filter = create_function('$item', 'return (in_array("Folder", ClassInfo::ancestry($item->ClassName)) ||'
|
||||
. ' in_array("Image", ClassInfo::ancestry($item->ClassName)));');
|
||||
|
||||
$form = parent::EditFileForm();
|
||||
$form->Fields()->dataFieldByName('ExistingFile')->setFilterFunction($filter);
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Action that uses an image instead of a button.
|
||||
*
|
||||
* @deprecated 3.0 Use FormAction with setAttribute('src', 'myimage.png') and custom JavaScript to achieve hover effect
|
||||
* @package forms
|
||||
* @subpackage actions
|
||||
*/
|
||||
class ImageFormAction extends FormAction {
|
||||
protected $image, $hoverImage, $className;
|
||||
|
||||
/**
|
||||
* Create a new action button.
|
||||
* @param action The method to call when the button is clicked
|
||||
* @param title The label on the button
|
||||
* @param image The default image to display
|
||||
* @param hoverImage The image to display on hover
|
||||
* @param form The parent form, auto-set when the field is placed inside a form
|
||||
*/
|
||||
public function __construct($action, $title = "", $image = "", $hoverImage = null, $className = null,
|
||||
$form = null) {
|
||||
|
||||
Deprecation::notice('3.0',
|
||||
"Use FormAction with setAttribute('src', 'myimage.png') and custom JavaScript to achieve hover effect",
|
||||
Deprecation::SCOPE_CLASS);
|
||||
|
||||
$this->image = $image;
|
||||
$this->hoverImage = $hoverImage;
|
||||
$this->className = $className;
|
||||
parent::__construct($action, $title, $form);
|
||||
}
|
||||
|
||||
public function Field($properties = array()) {
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
|
||||
Requirements::javascript(FRAMEWORK_DIR . '/javascript/ImageFormAction.js');
|
||||
|
||||
$classClause = '';
|
||||
if($this->className) $classClause = $this->className . ' ';
|
||||
if($this->hoverImage) $classClause .= 'rollover ';
|
||||
return "<input class=\"{$classClause}action\" id=\"" . $this->id() . "\" type=\"image\" name=\"{$this->name}\""
|
||||
. " src=\"{$this->image}\" title=\"{$this->title}\" alt=\"{$this->title}\" />";
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@
|
||||
* );
|
||||
* </code>
|
||||
*
|
||||
* @deprecated 3.0 Use GridField with GridFieldConfig_RelationEditor
|
||||
* @deprecated 3.1 Use GridField with GridFieldConfig_RelationEditor
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage fields-relational
|
||||
|
@ -1,173 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* SimpleImageField provides an easy way of uploading images to {@link Image} has_one relationships.
|
||||
* These relationships are auto-detected if you name the field accordingly.
|
||||
* Unlike {@link ImageField}, it doesn't use an iframe.
|
||||
*
|
||||
* Restricts the upload size to 2MB by default, and only allows upload
|
||||
* of files with the extension 'jpg', 'gif' or 'png'.
|
||||
*
|
||||
* <b>Usage</b>
|
||||
*
|
||||
* <code>
|
||||
* class Article extends DataObject {
|
||||
* static $has_one = array('MyImage' => 'Image');
|
||||
* }
|
||||
* // use in your form constructor etc.
|
||||
* $myField = new SimpleImageField('MyImage');
|
||||
* </code>
|
||||
*
|
||||
* <b>Usage within a controller</b>
|
||||
*
|
||||
* First add your $has_one relationship:
|
||||
*
|
||||
* <code>
|
||||
* static $has_one = array(
|
||||
* 'FileName' => 'FileType'
|
||||
* );
|
||||
* </code>
|
||||
* (i.e. Image for a FileType)
|
||||
*
|
||||
* Then add your Field into your form:
|
||||
*
|
||||
* <code>
|
||||
* function Form() {
|
||||
* return new Form($this, "Form", new FieldList(
|
||||
* new SimpleImageField (
|
||||
* $name = "FileTypeID",
|
||||
* $title = "Upload your FileType"
|
||||
* )
|
||||
* ), new FieldList(
|
||||
*
|
||||
* // List the action buttons here - doform executes the function 'doform' below
|
||||
* new FormAction("doform", "Submit")
|
||||
*
|
||||
* // List the required fields here
|
||||
* ), new RequiredFields(
|
||||
* "FileTypeID"
|
||||
* ));
|
||||
* }
|
||||
* // Then make sure that the file is saved into the assets area:
|
||||
* function doform($data, $form) {
|
||||
* $file = new File();
|
||||
* $file->loadUploaded($_FILES['FileTypeID']);
|
||||
*
|
||||
* // Redirect to a page thanking people for registering
|
||||
* $this->redirect('thanks-for-your-submission/');
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* Your file should be now in the uploads directory
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage fields-files
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use UploadField with $myField->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
|
||||
*/
|
||||
class SimpleImageField extends FileField {
|
||||
|
||||
public function __construct($name, $title = null, $value = null) {
|
||||
Deprecation::notice('3.0',
|
||||
"SimpleImageField is deprecated. Use UploadField with "
|
||||
. "\$myField->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'))",
|
||||
Deprecation::SCOPE_CLASS);
|
||||
|
||||
if(count(func_get_args()) > 3) {
|
||||
Deprecation::notice('3.0', 'Use setRightTitle() and setFolderName() instead of constructor arguments',
|
||||
Deprecation::SCOPE_GLOBAL);
|
||||
}
|
||||
|
||||
parent::__construct($name, $title, $value);
|
||||
|
||||
$this->getValidator()->setAllowedExtensions(array('jpg','gif','png'));
|
||||
}
|
||||
|
||||
public function Field($properties = array()) {
|
||||
if($this->form) $record = $this->form->getRecord();
|
||||
$fieldName = $this->name;
|
||||
if(isset($record)&&$record) {
|
||||
$imageField = $record->$fieldName();
|
||||
} else {
|
||||
$imageField = "";
|
||||
}
|
||||
|
||||
$html = "<div class=\"simpleimage\">";
|
||||
if($imageField && $imageField->exists()) {
|
||||
$html .= '<div class="thumbnail">';
|
||||
if($imageField->hasMethod('Thumbnail') && $imageField->Thumbnail()) {
|
||||
$html .= "<img src=\"".$imageField->Thumbnail()->getURL()."\" />";
|
||||
} else if($imageField->CMSThumbnail()) {
|
||||
$html .= "<img src=\"".$imageField->CMSThumbnail()->getURL()."\" />";
|
||||
}
|
||||
$html .= '</div>';
|
||||
}
|
||||
$html .= $this->createTag("input",
|
||||
array(
|
||||
"type" => "file",
|
||||
"name" => $this->name,
|
||||
"id" => $this->id(),
|
||||
"tabindex" => $this->getAttribute('tabindex'),
|
||||
'disabled' => $this->disabled
|
||||
)
|
||||
);
|
||||
$html .= $this->createTag("input",
|
||||
array(
|
||||
"type" => "hidden",
|
||||
"name" => "MAX_FILE_SIZE",
|
||||
"value" => $this->getValidator()->getAllowedMaxFileSize(),
|
||||
"tabindex" => $this->getAttribute('tabindex'),
|
||||
)
|
||||
);
|
||||
$html .= "</div>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a readonly version of this field
|
||||
*/
|
||||
public function performReadonlyTransformation() {
|
||||
$field = new SimpleImageField_Disabled($this->name, $this->title, $this->value);
|
||||
$field->setForm($this->form);
|
||||
$field->setReadonly(true);
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabled version of {@link SimpleImageField}.
|
||||
* @package forms
|
||||
* @subpackage fields-files
|
||||
*/
|
||||
class SimpleImageField_Disabled extends FormField {
|
||||
|
||||
protected $disabled = true;
|
||||
|
||||
protected $readonly = true;
|
||||
|
||||
public function Field($properties = array()) {
|
||||
$record = $this->form->getRecord();
|
||||
$fieldName = $this->name;
|
||||
|
||||
$field = "<div class=\"simpleimage\">";
|
||||
if($this->value) {
|
||||
// Only the case for DataDifferencer
|
||||
$field .= $this->value;
|
||||
} else {
|
||||
if($record) $imageField = $record->$fieldName();
|
||||
if($imageField && $imageField->exists()) {
|
||||
if($imageField->hasMethod('Thumbnail')) $field .= "<img src=\"".$imageField->Thumbnail()->URL."\" />";
|
||||
elseif($imageField->CMSThumbnail()) $field .= "<img src=\"".$imageField->CMSThumbnail()->URL."\" />";
|
||||
else {} // This shouldn't be called but it sometimes is for some reason, so we don't do anything
|
||||
}else{
|
||||
$field .= "<label>" . _t('SimpleImageField.NOUPLOAD', 'No Image Uploaded') . "</label>";
|
||||
}
|
||||
}
|
||||
$field .= "</div>";
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
* All get variables are namespaced in the format ctf[MyFieldName][MyParameter] to avoid collisions
|
||||
* when multiple TableListFields are present in a form.
|
||||
*
|
||||
* @deprecated 3.0 Use GridField with GridFieldConfig_RecordEditor
|
||||
* @deprecated 3.1 Use GridField with GridFieldConfig_RecordEditor
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage fields-relational
|
||||
|
@ -32,21 +32,6 @@ class TextareaField extends FormField {
|
||||
*/
|
||||
protected $cols = 20;
|
||||
|
||||
/**
|
||||
* Create a new textarea field.
|
||||
*
|
||||
* @param $name Field name
|
||||
* @param $title Field title
|
||||
* @param $value The current value
|
||||
*/
|
||||
public function __construct($name, $title = null, $value = '') {
|
||||
if(count(func_get_args()) > 3) {
|
||||
Deprecation::notice('3.0', 'Use setRows() and setColumns() instead of constructor arguments');
|
||||
}
|
||||
|
||||
parent::__construct($name, $title, $value);
|
||||
}
|
||||
|
||||
public function getAttributes() {
|
||||
return array_merge(
|
||||
parent::getAttributes(),
|
||||
|
@ -84,13 +84,5 @@ class ToggleCompositeField extends CompositeField {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
public function startClosed($bool) {
|
||||
Deprecation::notice('3.0', 'Please use ToggleCompositeField->setStartClosed()');
|
||||
$this->setStartClosed($bool);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ class TreeMultiselectField extends TreeDropdownField {
|
||||
$title = _t('DropdownField.CHOOSE', '(Choose)', 'start value of a dropdown');
|
||||
}
|
||||
|
||||
return $this->createTag (
|
||||
return FormField::create_tag(
|
||||
'div',
|
||||
array (
|
||||
'id' => "TreeDropdownField_{$this->id()}",
|
||||
@ -125,7 +125,7 @@ class TreeMultiselectField extends TreeDropdownField {
|
||||
'data-title' => $title,
|
||||
'title' => $this->getDescription()
|
||||
),
|
||||
$this->createTag (
|
||||
FormField::create_tag(
|
||||
'input',
|
||||
array (
|
||||
'id' => $this->id(),
|
||||
|
@ -22,37 +22,6 @@ abstract class Validator extends Object {
|
||||
*/
|
||||
protected $errors;
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use custom javascript validation instead
|
||||
*/
|
||||
public static function set_javascript_validation_handler($handler) {
|
||||
Deprecation::notice('3.0', 'Use custom javascript validation instead.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use custom javascript validation instead
|
||||
*/
|
||||
public static function get_javascript_validator_handler() {
|
||||
Deprecation::notice('3.0', 'Use custom javascript validation instead.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use custom javascript validation instead
|
||||
*/
|
||||
public function setJavascriptValidationHandler($handler) {
|
||||
Deprecation::notice('3.0', 'Use custom javascript validation instead.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current javascript validation handler for this form.
|
||||
* If not set, falls back to the global static {@link self::$javascript_validation_handler}.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getJavascriptValidationHandler() {
|
||||
Deprecation::notice('3.0', 'Use custom javascript validation instead.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Form $form
|
||||
*/
|
||||
|
@ -339,13 +339,13 @@ class GridField extends FormField {
|
||||
// A return value of null means this columns should be skipped altogether.
|
||||
if($colContent === null) continue;
|
||||
$colAttributes = $this->getColumnAttributes($record, $column);
|
||||
$rowContent .= $this->createTag('td', $colAttributes, $colContent);
|
||||
$rowContent .= FormField::create_tag('td', $colAttributes, $colContent);
|
||||
}
|
||||
$classes = array('ss-gridfield-item');
|
||||
if ($idx == 0) $classes[] = 'first';
|
||||
if ($idx == $total-1) $classes[] = 'last';
|
||||
$classes[] = ($idx % 2) ? 'even' : 'odd';
|
||||
$row = $this->createTag(
|
||||
$row = FormField::create_tag(
|
||||
'tr',
|
||||
array(
|
||||
"class" => implode(' ', $classes),
|
||||
@ -361,26 +361,27 @@ class GridField extends FormField {
|
||||
}
|
||||
|
||||
// Display a message when the grid field is empty
|
||||
if(!(isset($content['body']) && $content['body'])) {
|
||||
$content['body'] = $this->createTag(
|
||||
if(!(isset($content['body']) && $content['body'])) {
|
||||
$content['body'] = FormField::create_tag(
|
||||
'tr',
|
||||
array("class" => 'ss-gridfield-item ss-gridfield-no-items'),
|
||||
$this->createTag(
|
||||
FormField::create_tag(
|
||||
'td',
|
||||
array('colspan' => count($columns)),
|
||||
_t('GridField.NoItemsFound', 'No items found'))
|
||||
_t('GridField.NoItemsFound', 'No items found')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Turn into the relevant parts of a table
|
||||
$head = $content['header']
|
||||
? $this->createTag('thead', array(), $content['header'])
|
||||
? FormField::create_tag('thead', array(), $content['header'])
|
||||
: '';
|
||||
$body = $content['body']
|
||||
? $this->createTag('tbody', array('class' => 'ss-gridfield-items'), $content['body'])
|
||||
? FormField::create_tag('tbody', array('class' => 'ss-gridfield-items'), $content['body'])
|
||||
: '';
|
||||
$foot = $content['footer']
|
||||
? $this->createTag('tfoot', array(), $content['footer'])
|
||||
? FormField::create_tag('tfoot', array(), $content['footer'])
|
||||
: '';
|
||||
|
||||
$this->addExtraClass('ss-gridfield field');
|
||||
@ -398,9 +399,9 @@ class GridField extends FormField {
|
||||
|
||||
|
||||
return
|
||||
$this->createTag('fieldset', $attrs,
|
||||
FormField::create_tag('fieldset', $attrs,
|
||||
$content['before'] .
|
||||
$this->createTag('table', $tableAttrs, $head."\n".$foot."\n".$body) .
|
||||
FormField::create_tag('table', $tableAttrs, $head."\n".$foot."\n".$body) .
|
||||
$content['after']
|
||||
);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
|
||||
}
|
||||
|
||||
/**
|
||||
* Return any special attributes that will be used for FormField::createTag()
|
||||
* Return any special attributes that will be used for FormField::create_tag()
|
||||
*
|
||||
* @param GridField $gridField
|
||||
* @param DataObject $record
|
||||
|
@ -20,7 +20,7 @@ class GridFieldEditButton implements GridField_ColumnProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return any special attributes that will be used for FormField::createTag()
|
||||
* Return any special attributes that will be used for FormField::create_tag()
|
||||
*
|
||||
* @param GridField $gridField
|
||||
* @param DataObject $record
|
||||
|
@ -1925,20 +1925,6 @@ class i18n extends Object implements TemplateGlobalProvider {
|
||||
public static function set_default_locale($locale) {
|
||||
self::$default_locale = $locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Include a locale file determined by module name and locale
|
||||
*
|
||||
* @deprecated 3.0 Use Zend_Translate instead
|
||||
*
|
||||
* @param string $module Module that contains the locale file
|
||||
* @param string $locale Locale to be loaded
|
||||
*/
|
||||
public static function include_locale_file($module, $locale) {
|
||||
Deprecation::notice('3.0', 'Use Zend_Translate instead.');
|
||||
|
||||
if (file_exists($file = Director::getAbsFile("$module/lang/$locale.php"))) include_once($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Includes all available language files for a certain defined locale.
|
||||
|
@ -1,47 +0,0 @@
|
||||
(function($) {
|
||||
|
||||
$('#Form_DeleteFileForm_action_delete').click(function(e) {
|
||||
var deleteMessage = ss.i18n._t('FILEIFRAMEFIELD.CONFIRMDELETE', 'Are you sure you want to delete this file?');
|
||||
|
||||
if(typeof(parent.jQuery.fn.dialog) != 'undefined') {
|
||||
var buttons = {};
|
||||
var $dialog = undefined;
|
||||
var $deleteForm = $('#Form_DeleteFileForm');
|
||||
var $deleteFile = $('#Form_DeleteFileForm_DeleteFile');
|
||||
|
||||
buttons[ss.i18n._t('FILEIFRAMEFIELD.DELETEFILE', 'Delete File')] = function() {
|
||||
$deleteFile.attr('value', 'true');
|
||||
$deleteForm.submit();
|
||||
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
buttons[ss.i18n._t('FILEIFRAMEFIELD.UNATTACHFILE', 'Un-Attach File')] = function() {
|
||||
$deleteForm.submit();
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
buttons[ss.i18n._t('CANCEL', 'Cancel')] = function() {
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog = parent.jQuery('<p><span class="ui-icon ui-icon-alert" style="float:left;margin-right:5px;"></span>' + deleteMessage + '</p>').dialog({
|
||||
bgiframe: true,
|
||||
resizable: false,
|
||||
modal: true,
|
||||
height: 140,
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.5
|
||||
},
|
||||
title: ss.i18n._t('FILEIFRAMEFIELD.DELETEIMAGE', 'Delete Image'),
|
||||
buttons: buttons
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
} else if(!confirm(deleteMessage)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -1,18 +0,0 @@
|
||||
(function($) {
|
||||
$(document).ready(function() {
|
||||
$("input.rollover").live('mouseover', function(){
|
||||
if(!this.overSrc) {
|
||||
var srcParts = $(this).attr('src').match( /(.*)\.([a-zA-Z]+)$/ );
|
||||
var fileName = srcParts[1];
|
||||
var extension = srcParts[2];
|
||||
this.overSrc = fileName + '_over.' + extension;
|
||||
this.outSrc = $(this).attr('src');
|
||||
}
|
||||
$(this).attr('src', this.overSrc);
|
||||
});
|
||||
|
||||
$("input.rollover").live('mouseout', function(){
|
||||
$(this).attr('src', this.outSrc);
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @deprecated 3.0 Use ManyManyList or HasManyList
|
||||
*/
|
||||
class ComponentSet extends DataObjectSet {
|
||||
public function setComponentInfo($type, $ownerObj, $ownerClass, $tableName, $childClass, $joinField = null) {
|
||||
Deprecation::notice('3.0', 'ComponentSet is deprecated. Use ManyManyList or HasManyList instead.',
|
||||
Deprecation::SCOPE_CLASS);
|
||||
}
|
||||
}
|
@ -233,20 +233,6 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new DataList instance with a join clause added to this list's query.
|
||||
*
|
||||
* @param type $join Escaped SQL statement
|
||||
* @return DataList
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
public function join($join) {
|
||||
Deprecation::notice('3.0', 'Use innerJoin() or leftJoin() instead.');
|
||||
return $this->alterDataQuery_30(function($query) use ($join){
|
||||
$query->join($join);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new DataList instance with the records returned in this query restricted by a limit clause
|
||||
*
|
||||
@ -257,10 +243,6 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
||||
if(!$limit && !$offset) {
|
||||
return $this;
|
||||
}
|
||||
if($limit && !is_numeric($limit)) {
|
||||
Deprecation::notice('3.0', 'Please pass limits as 2 arguments, rather than an array or SQL fragment.',
|
||||
Deprecation::SCOPE_GLOBAL);
|
||||
}
|
||||
return $this->alterDataQuery_30(function($query) use ($limit, $offset){
|
||||
$query->limit($limit, $offset);
|
||||
});
|
||||
|
@ -1454,20 +1454,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
return 'ParentID';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the component of a relationship.
|
||||
* This should only need to be called internally,
|
||||
* and is mainly due to the caching logic in {@link getComponents()}
|
||||
* and {@link getManyManyComponents()}.
|
||||
*
|
||||
* @param string $componentName Name of the component
|
||||
* @param DataObject|HasManyList|ManyManyList $componentValue Value of the component
|
||||
* @deprecated 3.0 Not used internally anymore.
|
||||
*/
|
||||
public function setComponent($componentName, $componentValue) {
|
||||
Deprecation::notice('3.0', 'Not used internally anymore.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a many-to-many component, as a ManyManyList.
|
||||
* @param string $componentName Name of the many-many component
|
||||
@ -2030,17 +2016,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
return isset($this->record[$field]) ? $this->record[$field] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of all the fields for this record
|
||||
* @deprecated 2.4 Use toMap()
|
||||
*
|
||||
* @return array A map of field names to field values.
|
||||
*/
|
||||
public function getAllFields() {
|
||||
Deprecation::notice('3.0', 'Use toMap() instead.');
|
||||
return $this->toMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all the stub fields that an initial lazy load didn't load fully.
|
||||
*
|
||||
@ -2657,23 +2632,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||
*/
|
||||
public function buildSQL($filter = "", $sort = "", $limit = "", $join = "", $restrictClasses = true, $having="") {
|
||||
Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.');
|
||||
return $this->extendedSQL($filter, $sort, $limit, $join, $having);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||
*/
|
||||
public function extendedSQL($filter = "", $sort = "", $limit = "", $join = ""){
|
||||
Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.');
|
||||
$dataList = DataObject::get($this->class, $filter, $sort, $join, $limit);
|
||||
return $dataList->dataQuery()->query();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all objects matching the filter
|
||||
* sub-classes are automatically selected and included
|
||||
@ -2708,13 +2666,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Todo: Determine if we can deprecate for 3.0.0 and use DI or something instead
|
||||
// Todo: Make the $containerClass method redundant
|
||||
if($containerClass != 'DataList') {
|
||||
Deprecation::notice('3.0', 'DataObject::get() - $containerClass argument is deprecated.',
|
||||
Deprecation::SCOPE_GLOBAL);
|
||||
}
|
||||
|
||||
$result = DataList::create($callerClass)->where($filter)->sort($sort);
|
||||
|
||||
if($limit && strpos($limit, ',') !== false) {
|
||||
@ -2731,10 +2682,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||
* @deprecated 3.1 Use DataList::create and DataList to do your querying
|
||||
*/
|
||||
public function Aggregate($class = null) {
|
||||
Deprecation::notice('3.0', 'Call aggregate methods on a DataList directly instead. In templates'
|
||||
Deprecation::notice('3.1', 'Call aggregate methods on a DataList directly instead. In templates'
|
||||
. ' an example of the new syntax is <% cached List(Member).max(LastEdited) %> instead'
|
||||
. ' (check partial-caching.md documentation for more details.)');
|
||||
|
||||
@ -2752,70 +2703,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||
* @deprecated 3.1 Use DataList::create and DataList to do your querying
|
||||
*/
|
||||
public function RelationshipAggregate($relationship) {
|
||||
Deprecation::notice('3.0', 'Call aggregate methods on a relationship directly instead.');
|
||||
Deprecation::notice('3.1', 'Call aggregate methods on a relationship directly instead.');
|
||||
|
||||
return $this->$relationship();
|
||||
}
|
||||
|
||||
/**
|
||||
* DataList::create("Table")->where("filter") is the same as singleton("Table")->instance_get("filter")
|
||||
*
|
||||
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||
*
|
||||
* @param string $filter A filter to be inserted into the WHERE clause.
|
||||
* @param string $sort A sort expression to be inserted into the ORDER BY clause. If omitted, self::$default_sort
|
||||
* will be used.
|
||||
* @param string $join A single join clause. This can be used for filtering, only 1 instance of each DataObject
|
||||
* will be returned.
|
||||
* @param string $limit A limit expression to be inserted into the LIMIT clause.
|
||||
* @param string $containerClass The container class to return the results in.
|
||||
*
|
||||
* @return mixed The objects matching the filter, in the class specified by $containerClass
|
||||
*/
|
||||
public function instance_get($filter = "", $sort = "", $join = "", $limit="", $containerClass = "DataObjectSet") {
|
||||
Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.');
|
||||
return self::get($this->class, $filter, $sort, $join, $limit, $containerClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a database {@link SS_Query} and instanciate an object for each record.
|
||||
*
|
||||
* @deprecated 3.0 Replaced by DataList
|
||||
*
|
||||
* @param SS_Query|array $records The database records, a {@link SS_Query} object or an array of maps.
|
||||
* @param string $containerClass The class to place all of the objects into.
|
||||
*
|
||||
* @return mixed The new objects in an object of type $containerClass
|
||||
*/
|
||||
public function buildDataObjectSet($records, $containerClass = "DataObjectSet", $query = null, $baseClass = null) {
|
||||
Deprecation::notice('3.0', 'Use DataList instead.');
|
||||
|
||||
foreach($records as $record) {
|
||||
if(empty($record['RecordClassName'])) {
|
||||
$record['RecordClassName'] = $record['ClassName'];
|
||||
}
|
||||
if(class_exists($record['RecordClassName'])) {
|
||||
$results[] = new $record['RecordClassName']($record);
|
||||
} else {
|
||||
if(!$baseClass) {
|
||||
user_error("Bad RecordClassName '{$record['RecordClassName']}' and "
|
||||
. "\$baseClass not set", E_USER_ERROR);
|
||||
} else if(!is_string($baseClass) || !class_exists($baseClass)) {
|
||||
user_error("Bad RecordClassName '{$record['RecordClassName']}' and bad "
|
||||
. "\$baseClass '$baseClass not set", E_USER_ERROR);
|
||||
}
|
||||
$results[] = new $baseClass($record);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($results)) {
|
||||
return new $containerClass($results);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first item matching the given query.
|
||||
* All calls to get_one() are cached.
|
||||
@ -2909,23 +2804,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
DataObject::$_cache_field_labels = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the hard work for get_one()
|
||||
*
|
||||
* @deprecated 3.0 Use DataList::create($this->class)->where($filter)->sort($orderby)->First() instead
|
||||
*
|
||||
* @uses DataExtension->augmentSQL()
|
||||
*
|
||||
* @param string $filter A filter to be inserted into the WHERE clause
|
||||
* @param string $orderby A sort expression to be inserted into the ORDER BY clause.
|
||||
* @return DataObject The first item matching the query
|
||||
*/
|
||||
public function instance_get_one($filter, $orderby = null) {
|
||||
Deprecation::notice('3.0',
|
||||
'Use DataList::create($this->class)->where($filter)->sort($orderby)->First() instead.');
|
||||
return DataObject::get_one($this->class, $filter, true, $orderby);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the given element, searching by ID
|
||||
*
|
||||
@ -3066,24 +2944,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
$this->extend('requireDefaultRecords', $dummy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use DataObject::database_fields() instead
|
||||
* @see DataObject::database_fields()
|
||||
*/
|
||||
public function databaseFields() {
|
||||
Deprecation::notice('3.0', 'Use DataObject::database_fields() instead.');
|
||||
return self::database_fields($this->class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use DataObject::custom_database_fields() instead
|
||||
* @see DataObject::custom_database_fields()
|
||||
*/
|
||||
public function customDatabaseFields() {
|
||||
Deprecation::notice('3.0', 'Use DataObject::custom_database_fields() instead.');
|
||||
return self::custom_database_fields($this->class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns fields bu traversing the class heirachy in a bottom-up direction.
|
||||
*
|
||||
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage model
|
||||
* @deprecated 3.0 Use {@link DataExtension}.
|
||||
*/
|
||||
abstract class DataObjectDecorator extends DataExtension {
|
||||
|
||||
public function __construct() {
|
||||
Deprecation::notice('3.0', 'DataObjectDecorator is deprecated. Use DataExtension instead.',
|
||||
Deprecation::SCOPE_CLASS);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
@ -14,26 +14,6 @@ interface DataObjectInterface {
|
||||
*/
|
||||
public function __construct();
|
||||
|
||||
/**
|
||||
* Perform a search query on this data source
|
||||
*
|
||||
* @param $filter A filter expression of some kind, in SQL format.
|
||||
* @param $sort A sort expression, in SQL format.
|
||||
* @param $join A join expression. May or may not be relevant.
|
||||
* @param $limit A limit expression, either "(count)", or "(start), (count)"
|
||||
*/
|
||||
public function instance_get($filter = "", $sort = "", $join = "", $limit = "", $containerClass = "DataObjectSet");
|
||||
|
||||
/**
|
||||
* Retrieve a single record from this data source
|
||||
*
|
||||
* @param $filter A filter expression of some kind, in SQL format.
|
||||
* @param $sort A sort expression, in SQL format.
|
||||
* @param $join A join expression. May or may not be relevant.
|
||||
* @param $limit A limit expression, either "(count)", or "(start), (count)"
|
||||
*/
|
||||
public function instance_get_one($filter, $sort = "");
|
||||
|
||||
/**
|
||||
* Write the current object back to the database. It should know whether this is a new object, in which case this
|
||||
* would be an insert command, or if this is an existing object queried from the database, in which case thes would
|
||||
|
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @deprecated Please use {@link DataList} or {@link ArrayList} instead.
|
||||
* @package framework
|
||||
* @subpackage model
|
||||
*/
|
||||
class DataObjectSet extends ArrayList {
|
||||
|
||||
/**
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
public function __construct($items = array()) {
|
||||
Deprecation::notice('3.0', 'DataObjectSet is deprecated. Use DataList or ArrayList instead',
|
||||
Deprecation::SCOPE_CLASS);
|
||||
|
||||
if ($items) {
|
||||
if (!is_array($items) || func_num_args() > 1) {
|
||||
$items = func_get_args();
|
||||
}
|
||||
|
||||
foreach ($items as $i => $item) {
|
||||
if ($item instanceof ViewableData) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_object($item) || ArrayLib::is_associative($item)) {
|
||||
$items[$i] = new ArrayData($item);
|
||||
} else {
|
||||
user_error(
|
||||
"DataObjectSet::__construct: Passed item #{$i} is not an"
|
||||
. ' and object or associative array, can\'t be properly'
|
||||
. ' iterated on in templates', E_USER_WARNING
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct($items);
|
||||
}
|
||||
|
||||
}
|
@ -530,24 +530,6 @@ class DataQuery {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a join clause to this query
|
||||
* @deprecated 3.0 Use innerJoin() or leftJoin() instead.
|
||||
*/
|
||||
public function join($join) {
|
||||
Deprecation::notice('3.0', 'Use innerJoin() or leftJoin() instead.');
|
||||
if($join) {
|
||||
$this->query->addFrom($join);
|
||||
// TODO: This needs to be resolved for all databases
|
||||
|
||||
if(DB::getConn() instanceof MySQLDatabase) {
|
||||
$from = $this->query->getFrom();
|
||||
$this->query->setGroupBy(reset($from) . ".\"ID\"");
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an INNER JOIN clause to this query.
|
||||
*
|
||||
|
@ -11,8 +11,6 @@ abstract class StringField extends DBField {
|
||||
|
||||
static $casting = array(
|
||||
"LimitCharacters" => "Text",
|
||||
"Lower" => "Text",
|
||||
"Upper" => "Text",
|
||||
"LowerCase" => "Text",
|
||||
"UpperCase" => "Text",
|
||||
);
|
||||
@ -114,15 +112,6 @@ abstract class StringField extends DBField {
|
||||
public function LowerCase() {
|
||||
return mb_strtolower($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return another DBField object with this value in lowercase.
|
||||
* @deprecated 3.0 Use LowerCase() instead.
|
||||
*/
|
||||
public function Lower() {
|
||||
Deprecation::notice('3.0', 'Use LowerCase() instead.');
|
||||
return $this->LowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the current value for this Enum DBField to uppercase.
|
||||
@ -132,13 +121,4 @@ abstract class StringField extends DBField {
|
||||
return mb_strtoupper($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return another DBField object with this value in uppercase.
|
||||
* @deprecated 3.0 Use UpperCase() instead.
|
||||
*/
|
||||
public function Upper() {
|
||||
Deprecation::notice('3.0', 'Use UpperCase() instead.');
|
||||
return $this->UpperCase();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -78,17 +78,7 @@ class Text extends StringField {
|
||||
public function NoHTML() {
|
||||
return strip_tags($this->value);
|
||||
}
|
||||
/**
|
||||
* Return the value of the field with XML tags escaped.
|
||||
*
|
||||
* @deprecated 3.0 Use DBField->XML() instead.
|
||||
* @return string
|
||||
*/
|
||||
public function EscapeXML() {
|
||||
Deprecation::notice('3.0', 'Use DBField->XML() instead.');
|
||||
return str_replace(array('&','<','>','"'), array('&','<','>','"'), $this->value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of the field with relative links converted to absolute urls.
|
||||
* @return string
|
||||
|
@ -1,175 +0,0 @@
|
||||
/*
|
||||
typography.css has been removed from framework, why shall we still has this? a dynamic typographp.css should be used by
|
||||
server side call, like Requirements::css();
|
||||
@import url("typography.css");
|
||||
*/
|
||||
|
||||
html,body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border-style: none;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 0; padding: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
font-size: 1.4em;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selection Groups
|
||||
*/
|
||||
.SelectionGroup {
|
||||
padding: 0;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
.SelectionGroup li {
|
||||
list-style-type: none;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
.SelectionGroup li label {
|
||||
font-size: 11px;
|
||||
}
|
||||
.SelectionGroup li input.selector {
|
||||
width: 20px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
.SelectionGroup li div.field {
|
||||
display: none;
|
||||
}
|
||||
.SelectionGroup li.selected div.field {
|
||||
display: block;
|
||||
margin-left: 30px;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.mainblock .SelectionGroup li.selected div.field {
|
||||
margin-left: 27px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.SelectionGroup li.selected label.selector {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TreeDropdownField stying
|
||||
*/
|
||||
.SelectionGroup div.TreeDropdownField {
|
||||
width: 241px;
|
||||
padding: 0;
|
||||
}
|
||||
html>body div.TreeDropdownField {
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.SelectionGroup div.TreeDropdownField span.items {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border: 1px #7f9db9 solid;
|
||||
cursor: pointer;
|
||||
width: 214px;
|
||||
float: left;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.SelectionGroup div.TreeDropdownField div.tree_holder {
|
||||
clear: left;
|
||||
cursor: default;
|
||||
border: 1px black solid;
|
||||
margin: 0;
|
||||
height: 180px;
|
||||
overflow: auto;
|
||||
background-color: white;
|
||||
/**
|
||||
* HACK IE6, see http://www.hedgerwow.com/360/bugs/css-select-free.html
|
||||
*/
|
||||
position:absolute;
|
||||
z-index:10;
|
||||
width:238px;/*must have for any value*/
|
||||
}
|
||||
|
||||
html>body div.TreeDropdownField div.tree_holder {
|
||||
top: 20px;
|
||||
left: 0px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* HACK IE6, see http://www.hedgerwow.com/360/bugs/css-select-free.html
|
||||
*/
|
||||
.SelectionGroup div.TreeDropdownField div.tree_holder iframe {
|
||||
display:none;/* IE5*/
|
||||
display/**/:block;/* IE5*/
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
z-index:-1;
|
||||
filter:mask();
|
||||
width:180px; /*must have for any big value*/
|
||||
height:200px/*must have for any big value*/;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
div.TreeDropdownField a.editLink {
|
||||
border-width: 1px 1px 1px 0;
|
||||
background: url(../images/TreeDropdownField_button.gif) left top no-repeat;
|
||||
width: 19px;
|
||||
height: 21px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
float: left;
|
||||
clear: right;
|
||||
z-index: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* added block/width so tree values don't disappear in ie7 */
|
||||
.SelectionGroup div.TreeDropdownField ul.tree li {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.Actions {
|
||||
text-align: right;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
bottom: 5px;
|
||||
}
|
||||
|
||||
.mainblock {
|
||||
float: left;
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
margin-right: 5px;
|
||||
height: 140px;
|
||||
position: relative;
|
||||
}
|
||||
.mainblock.editform {
|
||||
width: 275px;
|
||||
}
|
||||
.mainblock.attached {
|
||||
position: absolute;
|
||||
left: 270px;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.mainblock form fieldset {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.mainblock form div.Actions input {
|
||||
font-size: 11px;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage search
|
||||
*/
|
||||
|
||||
/**
|
||||
* Uses a substring match against content in column rows.
|
||||
* @deprecated 3.0 Use PartialMatchFilter instead
|
||||
*
|
||||
* @package framework
|
||||
* @subpackage search
|
||||
*/
|
||||
class SubstringFilter extends PartialMatchFilter {
|
||||
public function __construct($fullName, $value = false, array $modifiers = array()) {
|
||||
Deprecation::notice('3.0', 'PartialMatchFilter instead.');
|
||||
parent::__construct($fullName, $value, $modifiers);
|
||||
}
|
||||
|
||||
public function apply(DataQuery $query) {
|
||||
$values = $this->getValue();
|
||||
$filter = new PartialMatchFilter($this->getFullName(), $values, $this->getModifiers());
|
||||
return $filter->apply($query);
|
||||
}
|
||||
|
||||
protected function applyOne(DataQuery $query) {
|
||||
/* NO OP */
|
||||
}
|
||||
|
||||
public function exclude(DataQuery $query) {
|
||||
$values = $this->getValue();
|
||||
$filter = new PartialMatchFilter($this->getFullName(), $values, $this->getModifiers());
|
||||
return $filter->exclude($query);
|
||||
}
|
||||
|
||||
protected function excludeOne(DataQuery $query) {
|
||||
/* NO OP */
|
||||
}
|
||||
|
||||
public function isEmpty() {
|
||||
return $this->getValue() === array() || $this->getValue() === null || $this->getValue() === '';
|
||||
}
|
||||
}
|
||||
|
@ -216,15 +216,6 @@ class Group extends DataObject {
|
||||
return $labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.5
|
||||
*/
|
||||
public static function addToGroupByName($member, $groupcode) {
|
||||
Deprecation::notice('2.5', 'Use $member->addToGroupByCode($groupcode) instead.');
|
||||
|
||||
return $member->addToGroupByCode($groupcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get many-many relation to {@link Member},
|
||||
* including all members which are "inherited" from children groups of this record.
|
||||
@ -323,14 +314,6 @@ class Group extends DataObject {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use getTreeTitle()
|
||||
*/
|
||||
public function TreeTitle() {
|
||||
Deprecation::notice('3.0', 'Use getTreeTitle() instead.');
|
||||
return $this->getTreeTitle();
|
||||
}
|
||||
|
||||
public function getTreeTitle() {
|
||||
if($this->hasMethod('alternateTreeTitle')) return $this->alternateTreeTitle();
|
||||
else return htmlspecialchars($this->Title, ENT_QUOTES);
|
||||
|
@ -102,22 +102,6 @@ abstract class PasswordEncryptor {
|
||||
return substr($generator->generateHash('sha1'), 0, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* This usually just returns a strict string comparison,
|
||||
* but is necessary for {@link PasswordEncryptor_LegacyPHPHash}.
|
||||
*
|
||||
* @param String $hash1
|
||||
* @param String $hash2
|
||||
* @return boolean
|
||||
*
|
||||
* @deprecated 3.0 - Use PasswordEncryptor::check() instead.
|
||||
*/
|
||||
public function compare($hash1, $hash2) {
|
||||
Deprecation::notice('3.0.0',
|
||||
'PasswordEncryptor::compare() is deprecated, replaced by PasswordEncryptor::check().');
|
||||
return ($hash1 === $hash2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This usually just returns a strict string comparison,
|
||||
* but is necessary for retain compatibility with password hashed
|
||||
@ -355,15 +339,6 @@ class PasswordEncryptor_LegacyPHPHash extends PasswordEncryptor_PHPHash {
|
||||
// letters.
|
||||
return substr(base_convert($password, 16, 36), 0, 64);
|
||||
}
|
||||
|
||||
public function compare($hash1, $hash2) {
|
||||
Deprecation::notice('3.0.0',
|
||||
'PasswordEncryptor::compare() is deprecated, replaced by PasswordEncryptor::check().');
|
||||
|
||||
// Due to flawed base_convert() floating poing precision,
|
||||
// only the first 10 characters are consistently useful for comparisons.
|
||||
return (substr($hash1, 0, 10) === substr($hash2, 0, 10));
|
||||
}
|
||||
|
||||
public function check($hash, $password, $salt = null, $member = null) {
|
||||
// Due to flawed base_convert() floating poing precision,
|
||||
|
@ -1,26 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<% base_tag %>
|
||||
|
||||
<title><% _t('FileIFrameField_iframe.ss.TITLE', 'Image Uploading Iframe') %></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="mainblock editform">
|
||||
$EditFileForm
|
||||
</div>
|
||||
|
||||
<% if AttachedFile %>
|
||||
<div class="mainblock">
|
||||
$AttachedFile.CMSThumbnail
|
||||
|
||||
<% if DeleteFileForm %>
|
||||
$DeleteFileForm
|
||||
<% end_if %>
|
||||
</div>
|
||||
<% end_if %>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -191,40 +191,6 @@ class DirectorTest extends SapphireTest {
|
||||
}
|
||||
}
|
||||
|
||||
public function testURLParam() {
|
||||
// 2.4 only
|
||||
$originalDeprecation = Deprecation::dump_settings();
|
||||
Deprecation::notification_version('2.4');
|
||||
|
||||
Director::test('DirectorTestRule/myaction/myid/myotherid');
|
||||
// TODO Works on the assumption that urlParam() is not unset after a test run, which is dodgy
|
||||
$this->assertEquals(Director::urlParam('Action'), 'myaction');
|
||||
$this->assertEquals(Director::urlParam('ID'), 'myid');
|
||||
$this->assertEquals(Director::urlParam('OtherID'), 'myotherid');
|
||||
|
||||
Deprecation::restore_settings($originalDeprecation);
|
||||
}
|
||||
|
||||
public function testURLParams() {
|
||||
// 2.4 only
|
||||
$originalDeprecation = Deprecation::dump_settings();
|
||||
Deprecation::notification_version('2.4');
|
||||
|
||||
Director::test('DirectorTestRule/myaction/myid/myotherid');
|
||||
// TODO Works on the assumption that urlParam() is not unset after a test run, which is dodgy
|
||||
$this->assertEquals(
|
||||
Director::urlParams(),
|
||||
array(
|
||||
'Controller' => 'DirectorTestRequest_Controller',
|
||||
'Action' => 'myaction',
|
||||
'ID' => 'myid',
|
||||
'OtherID' => 'myotherid'
|
||||
)
|
||||
);
|
||||
|
||||
Deprecation::restore_settings($originalDeprecation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that additional parameters specified in the routing table are
|
||||
* saved in the request
|
||||
|
@ -116,24 +116,6 @@ class DataObjectTest extends SapphireTest {
|
||||
$this->assertEquals(3, $comments->Count());
|
||||
$this->assertEquals('Phil', $comments->First()->Name);
|
||||
|
||||
// Test join - 2.4 only
|
||||
$originalDeprecation = Deprecation::dump_settings();
|
||||
Deprecation::notification_version('2.4');
|
||||
|
||||
$comments = DataObject::get(
|
||||
'DataObjectTest_TeamComment',
|
||||
"\"DataObjectTest_Team\".\"Title\" = 'Team 1'",
|
||||
"\"Name\" ASC",
|
||||
"INNER JOIN \"DataObjectTest_Team\""
|
||||
. " ON \"DataObjectTest_TeamComment\".\"TeamID\" = \"DataObjectTest_Team\".\"ID\""
|
||||
);
|
||||
|
||||
$this->assertEquals(2, $comments->Count());
|
||||
$this->assertEquals('Bob', $comments->First()->Name);
|
||||
$this->assertEquals('Joe', $comments->Last()->Name);
|
||||
|
||||
Deprecation::restore_settings($originalDeprecation);
|
||||
|
||||
// Test limit
|
||||
$comments = DataObject::get('DataObjectTest_TeamComment', '', "\"Name\" ASC", '', '1,2');
|
||||
$this->assertEquals(2, $comments->Count());
|
||||
|
@ -100,13 +100,5 @@ class ArrayData extends ViewableData {
|
||||
if ($arr) foreach($arr as $name => $value) $obj->$name = $value;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0 Use {@link ArrayData::toMap()}.
|
||||
*/
|
||||
public function getArray() {
|
||||
Deprecation::notice('3.0', 'Use ArrayData::toMap() instead.');
|
||||
return $this->toMap();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user