Skip to content

Commit

Permalink
API CHANGE Removed 'showdropdown' option from TimeField, use custom l…
Browse files Browse the repository at this point in the history
…ibraries instead
  • Loading branch information
chillu committed Oct 7, 2011
1 parent aa60201 commit 585a8bc
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 180 deletions.
43 changes: 0 additions & 43 deletions css/TimeField_dropdown.css

This file was deleted.

35 changes: 1 addition & 34 deletions forms/TimeField.php
Expand Up @@ -2,9 +2,7 @@
require_once 'Zend/Date.php'; require_once 'Zend/Date.php';


/** /**
* Form field to display editable time values in an <input type="text"> * Form field to display editable time values in an <input type="text"> field.
* field. Can optionally display a dropdown with predefined time ranges
* through `setConfig('showdropdown', true)`.
* *
* # Configuration * # Configuration
* *
Expand All @@ -13,23 +11,19 @@
* through {@link Zend_Locale_Format::getTimeFormat()}. * through {@link Zend_Locale_Format::getTimeFormat()}.
* - 'use_strtotime' (boolean): Accept values in PHP's built-in strtotime() notation, in addition * - 'use_strtotime' (boolean): Accept values in PHP's built-in strtotime() notation, in addition
* to the format specified in `timeformat`. Example inputs: 'now', '11pm', '23:59:59'. * to the format specified in `timeformat`. Example inputs: 'now', '11pm', '23:59:59'.
* - 'showdropdown': Show a dropdown with suggested date values.
* CAUTION: The dropdown does not support localization.
* *
* # Localization * # Localization
* *
* See {@link DateField} * See {@link DateField}
* *
* @todo Timezone support * @todo Timezone support
* @todo 'showdropdown' localization
* *
* @package forms * @package forms
* @subpackage fields-datetime * @subpackage fields-datetime
*/ */
class TimeField extends TextField { class TimeField extends TextField {


protected $config = array( protected $config = array(
'showdropdown' => false,
'timeformat' => 'HH:mm:ss', 'timeformat' => 'HH:mm:ss',
'use_strtotime' => true, 'use_strtotime' => true,
'datavalueformat' => 'HH:mm:ss' 'datavalueformat' => 'HH:mm:ss'
Expand Down Expand Up @@ -59,33 +53,6 @@ function __construct($name, $title = null, $value = ""){
parent::__construct($name,$title,$value); parent::__construct($name,$title,$value);
} }


function Field() {
$html = parent::Field();

$html = $this->FieldDriver($html);

return $html;
}

/**
* Internal volatile API.
*
* @see DateField->FieldDriver()
*/
protected function FieldDriver($html) {
if($this->getConfig('showdropdown')) {
Requirements::javascript(THIRDPARTY_DIR . '/behaviour/behaviour.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TimeField_dropdown.js');
Requirements::css(SAPPHIRE_DIR . '/css/TimeField_dropdown.css');

$html .= sprintf('<img class="timeIcon" src="sapphire/images/clock-icon.gif" id="%s-icon"/>', $this->id());
$html .= sprintf('<div class="dropdownpopup" id="%s-dropdowntime"></div>', $this->id());
$html = '<div class="dropdowntime">' . $html . '</div>';
}

return $html;
}

/** /**
* Sets the internal value to ISO date format. * Sets the internal value to ISO date format.
* *
Expand Down
103 changes: 0 additions & 103 deletions javascript/TimeField_dropdown.js

This file was deleted.

0 comments on commit 585a8bc

Please sign in to comment.