Revert "Merge branch 'ryerson-history'"
This reverts commita554c6f72c
, reversing changes made to2a0c9769aa
.
This commit is contained in:
parent
a554c6f72c
commit
c8b73850b9
200 changed files with 5491 additions and 41784 deletions
|
@ -1,211 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_EditHistory extends Zend_Form
|
||||
{
|
||||
const VALIDATE_DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
|
||||
//this is used by the javascript widget, unfortunately h/H is opposite from Zend.
|
||||
const TIMEPICKER_DATETIME_FORMAT = 'yyyy-MM-dd hh:mm:ss';
|
||||
|
||||
const VALIDATE_DATE_FORMAT = 'yyyy-MM-dd';
|
||||
const VALIDATE_TIME_FORMAT = 'HH:mm:ss';
|
||||
|
||||
const ITEM_TYPE = "type";
|
||||
const ITEM_CLASS = "class";
|
||||
const ITEM_OPTIONS = "options";
|
||||
const ITEM_ID_SUFFIX = "name";
|
||||
|
||||
const TEXT_INPUT_CLASS = "input_text";
|
||||
|
||||
private $formElTypes = array(
|
||||
TEMPLATE_DATE => array(
|
||||
"class" => "Zend_Form_Element_Text",
|
||||
"attrs" => array(
|
||||
"class" => self::TEXT_INPUT_CLASS
|
||||
),
|
||||
"validators" => array(
|
||||
array(
|
||||
"class" => "Zend_Validate_Date",
|
||||
"params" => array(
|
||||
"format" => self::VALIDATE_DATE_FORMAT
|
||||
)
|
||||
)
|
||||
),
|
||||
"filters" => array(
|
||||
"StringTrim"
|
||||
)
|
||||
),
|
||||
TEMPLATE_TIME => array(
|
||||
"class" => "Zend_Form_Element_Text",
|
||||
"attrs" => array(
|
||||
"class" => self::TEXT_INPUT_CLASS
|
||||
),
|
||||
"validators" => array(
|
||||
array(
|
||||
"class" => "Zend_Validate_Date",
|
||||
"params" => array(
|
||||
"format" => self::VALIDATE_TIME_FORMAT
|
||||
)
|
||||
)
|
||||
),
|
||||
"filters" => array(
|
||||
"StringTrim"
|
||||
)
|
||||
),
|
||||
TEMPLATE_DATETIME => array(
|
||||
"class" => "Zend_Form_Element_Text",
|
||||
"attrs" => array(
|
||||
"class" => self::TEXT_INPUT_CLASS
|
||||
),
|
||||
"validators" => array(
|
||||
array(
|
||||
"class" => "Zend_Validate_Date",
|
||||
"params" => array(
|
||||
"format" => self::VALIDATE_DATETIME_FORMAT
|
||||
)
|
||||
)
|
||||
),
|
||||
"filters" => array(
|
||||
"StringTrim"
|
||||
)
|
||||
),
|
||||
TEMPLATE_STRING => array(
|
||||
"class" => "Zend_Form_Element_Text",
|
||||
"attrs" => array(
|
||||
"class" => self::TEXT_INPUT_CLASS
|
||||
),
|
||||
"filters" => array(
|
||||
"StringTrim"
|
||||
)
|
||||
),
|
||||
TEMPLATE_BOOLEAN => array(
|
||||
"class" => "Zend_Form_Element_Checkbox",
|
||||
"validators" => array(
|
||||
array(
|
||||
"class" => "Zend_Validate_InArray",
|
||||
"options" => array(
|
||||
"haystack" => array(0,1)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
TEMPLATE_INT => array(
|
||||
"class" => "Zend_Form_Element_Text",
|
||||
"validators" => array(
|
||||
array(
|
||||
"class" => "Zend_Validate_Int",
|
||||
)
|
||||
),
|
||||
"attrs" => array(
|
||||
"class" => self::TEXT_INPUT_CLASS
|
||||
)
|
||||
),
|
||||
TEMPLATE_FLOAT => array(
|
||||
"class" => "Zend_Form_Element_Text",
|
||||
"attrs" => array(
|
||||
"class" => self::TEXT_INPUT_CLASS
|
||||
),
|
||||
"validators" => array(
|
||||
array(
|
||||
"class" => "Zend_Validate_Float",
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
public function init() {
|
||||
|
||||
$history_id = new Zend_Form_Element_Hidden($this::ID_PREFIX.'id');
|
||||
$history_id->setValidators(array(
|
||||
new Zend_Validate_Int()
|
||||
));
|
||||
$history_id->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($history_id);
|
||||
|
||||
$dynamic_attrs = new Zend_Form_SubForm();
|
||||
$this->addSubForm($dynamic_attrs, $this::ID_PREFIX.'template');
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('button', $this::ID_PREFIX.'save', array(
|
||||
'ignore' => true,
|
||||
'class' => 'btn '.$this::ID_PREFIX.'save',
|
||||
'label' => _('Save'),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Add the cancel button
|
||||
$this->addElement('button', $this::ID_PREFIX.'cancel', array(
|
||||
'ignore' => true,
|
||||
'class' => 'btn '.$this::ID_PREFIX.'cancel',
|
||||
'label' => _('Cancel'),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public function createFromTemplate($template, $required) {
|
||||
|
||||
$templateSubForm = $this->getSubForm($this::ID_PREFIX.'template');
|
||||
|
||||
for ($i = 0, $len = count($template); $i < $len; $i++) {
|
||||
|
||||
$item = $template[$i];
|
||||
//don't dynamically add this as it should be included in the
|
||||
//init() function already if it should show up in the UI..
|
||||
if (in_array($item["name"], $required)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$formElType = $this->formElTypes[$item[self::ITEM_TYPE]];
|
||||
|
||||
$label = $item[self::ITEM_ID_SUFFIX];
|
||||
$id = $this::ID_PREFIX.$label;
|
||||
$el = new $formElType[self::ITEM_CLASS]($id);
|
||||
$el->setLabel($item["label"]);
|
||||
|
||||
if (isset($formElType["attrs"])) {
|
||||
|
||||
$attrs = $formElType["attrs"];
|
||||
|
||||
foreach ($attrs as $key => $value) {
|
||||
$el->setAttrib($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($formElType["filters"])) {
|
||||
|
||||
$filters = $formElType["filters"];
|
||||
|
||||
foreach ($filters as $filter) {
|
||||
$el->addFilter($filter);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($formElType["validators"])) {
|
||||
|
||||
$validators = $formElType["validators"];
|
||||
|
||||
foreach ($validators as $index => $arr) {
|
||||
$options = isset($arr[self::ITEM_OPTIONS]) ? $arr[self::ITEM_OPTIONS] : null;
|
||||
$validator = new $arr[self::ITEM_CLASS]($options);
|
||||
|
||||
//extra validator info
|
||||
if (isset($arr["params"])) {
|
||||
|
||||
foreach ($arr["params"] as $key => $value) {
|
||||
$method = "set".ucfirst($key);
|
||||
$validator->$method($value);
|
||||
}
|
||||
}
|
||||
|
||||
$el->addValidator($validator);
|
||||
}
|
||||
}
|
||||
|
||||
$el->setDecorators(array('ViewHelper'));
|
||||
$templateSubForm->addElement($el);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_EditHistoryFile extends Application_Form_EditHistory
|
||||
{
|
||||
const ID_PREFIX = "his_file_";
|
||||
|
||||
public function init() {
|
||||
|
||||
parent::init();
|
||||
|
||||
$this->setDecorators(
|
||||
array(
|
||||
array('ViewScript', array('viewScript' => 'form/edit-history-file.phtml'))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function createFromTemplate($template, $required) {
|
||||
|
||||
parent::createFromTemplate($template, $required);
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_EditHistoryItem extends Application_Form_EditHistory
|
||||
{
|
||||
const ID_PREFIX = "his_item_";
|
||||
|
||||
public function init() {
|
||||
|
||||
parent::init();
|
||||
|
||||
$this->setDecorators(array(
|
||||
'PrepareElements',
|
||||
array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml'))
|
||||
));
|
||||
|
||||
/*
|
||||
$instance = new Zend_Form_Element_Select("instance_id");
|
||||
$instance->setLabel(_("Choose Show Instance"));
|
||||
$instance->setMultiOptions(array("0" => "-----------"));
|
||||
$instance->setValue(0);
|
||||
$instance->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($instance);
|
||||
*/
|
||||
|
||||
$starts = new Zend_Form_Element_Text(self::ID_PREFIX.'starts');
|
||||
$starts->setValidators(array(
|
||||
new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)
|
||||
));
|
||||
$starts->setAttrib('class', self::TEXT_INPUT_CLASS." datepicker");
|
||||
$starts->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT);
|
||||
$starts->addFilter('StringTrim');
|
||||
$starts->setLabel(_('Start Time'));
|
||||
$starts->setDecorators(array('ViewHelper'));
|
||||
$starts->setRequired(true);
|
||||
$this->addElement($starts);
|
||||
|
||||
$ends = new Zend_Form_Element_Text(self::ID_PREFIX.'ends');
|
||||
$ends->setValidators(array(
|
||||
new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)
|
||||
));
|
||||
$ends->setAttrib('class', self::TEXT_INPUT_CLASS." datepicker");
|
||||
$ends->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT);
|
||||
$ends->addFilter('StringTrim');
|
||||
$ends->setLabel(_('End Time'));
|
||||
$ends->setDecorators(array('ViewHelper'));
|
||||
$ends->setRequired(true);
|
||||
$this->addElement($ends);
|
||||
}
|
||||
|
||||
public function createFromTemplate($template, $required) {
|
||||
|
||||
parent::createFromTemplate($template, $required);
|
||||
}
|
||||
|
||||
public function populateShowInstances($possibleInstances, $default) {
|
||||
|
||||
$possibleInstances["0"] = _("No Show");
|
||||
|
||||
$instance = new Zend_Form_Element_Select("his_instance_select");
|
||||
//$instance->setLabel(_("Choose Show Instance"));
|
||||
$instance->setMultiOptions($possibleInstances);
|
||||
$instance->setValue($default);
|
||||
$instance->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($instance);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
private $stringCriteriaOptions;
|
||||
private $numericCriteriaOptions;
|
||||
private $limitOptions;
|
||||
|
||||
|
||||
/* We need to know if the criteria value will be a string
|
||||
* or numeric value in order to populate the modifier
|
||||
* select list
|
||||
|
@ -40,7 +40,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
"info_url" => "s",
|
||||
"year" => "n"
|
||||
);
|
||||
|
||||
|
||||
private function getCriteriaOptions($option = null)
|
||||
{
|
||||
if (!isset($this->criteriaOptions)) {
|
||||
|
@ -75,7 +75,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
"year" => _("Year")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (is_null($option)) return $this->criteriaOptions;
|
||||
else return $this->criteriaOptions[$option];
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
}
|
||||
return $this->limitOptions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function init()
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
$repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false);
|
||||
}
|
||||
$this->addElement($repeatTracks);
|
||||
|
||||
|
||||
$limit = new Zend_Form_Element_Select('sp_limit_options');
|
||||
$limit->setAttrib('class', 'sp_input_select')
|
||||
->setDecorators(array('viewHelper'))
|
||||
|
@ -268,7 +268,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
$limit->setValue($storedCrit["limit"]["modifier"]);
|
||||
}
|
||||
$this->addElement($limit);
|
||||
|
||||
|
||||
$limitValue = new Zend_Form_Element_Text('sp_limit_value');
|
||||
$limitValue->setAttrib('class', 'sp_input_text_limit')
|
||||
->setLabel(_('Limit to'))
|
||||
|
@ -541,7 +541,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
$isValid = false;
|
||||
}
|
||||
// length check
|
||||
if ($d['sp_criteria_value'] >= pow(2,31)) {
|
||||
if (intval($d['sp_criteria_value']) >= pow(2,31)) {
|
||||
$element->addError(_("The value should be less then 2147483648"));
|
||||
$isValid = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue