dynamic form rendering for template
bootstrap datetime widget. jquery update is needed, testing with hosted jquery first.
This commit is contained in:
parent
c7b5592fa9
commit
46ecdf393d
|
@ -86,8 +86,13 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
$view->headScript()->appendFile($baseUrl.'js/libs/jquery-1.7.2.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
//$view->headScript()->appendFile($baseUrl.'js/libs/jquery-1.7.2.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile('http://code.jquery.com/jquery-1.10.1.min.js','text/javascript');
|
||||||
|
$view->headScript()->appendFile('http://code.jquery.com/jquery-migrate-1.2.1.min.js','text/javascript');
|
||||||
|
|
||||||
|
//$view->headScript()->appendFile($baseUrl.'js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
$view->headScript()->appendFile('http://code.jquery.com/ui/1.10.3/jquery-ui.js','text/javascript');
|
||||||
|
|
||||||
$view->headScript()->appendFile($baseUrl.'js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
|
|
|
@ -56,6 +56,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'js/bootstrap-datetime/bootstrap-datetimepicker.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
|
||||||
$offset = date("Z") * -1;
|
$offset = date("Z") * -1;
|
||||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
|
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
|
||||||
|
@ -67,6 +68,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/bootstrap-datetimepicker.min.css?'.$CC_CONFIG['airtime_version']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function aggregateHistoryFeedAction()
|
public function aggregateHistoryFeedAction()
|
||||||
|
@ -121,7 +123,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
$form = $historyService->makeHistoryFileForm($file_id);
|
$form = $historyService->makeHistoryFileForm($file_id);
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->dialog = $this->view->render('form/edit-history-file.phtml');
|
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
||||||
|
|
||||||
unset($this->view->form);
|
unset($this->view->form);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +146,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
$form = $historyService->makeHistoryItemForm($history_id);
|
$form = $historyService->makeHistoryItemForm($history_id);
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->dialog = $this->view->render('form/edit-history-item.phtml');
|
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
||||||
|
|
||||||
unset($this->view->form);
|
unset($this->view->form);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
class Application_Form_EditHistoryItem extends Zend_Form
|
class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
{
|
{
|
||||||
const VALIDATE_DATETIME_FORMAT = 'yyyy-MM-dd HH-mm-ss';
|
const VALIDATE_DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
|
||||||
const VALIDATE_DATE_FORMAT = 'yyyy-MM-dd';
|
const VALIDATE_DATE_FORMAT = 'yyyy-MM-dd';
|
||||||
const VALIDATE_TIME_FORMAT = 'HH-mm-ss';
|
const VALIDATE_TIME_FORMAT = 'HH:mm:ss';
|
||||||
|
|
||||||
const ID_PREFIX = "his_item_";
|
const ID_PREFIX = "his_item_";
|
||||||
|
|
||||||
|
@ -12,11 +12,13 @@ class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
const ITEM_CLASS = "class";
|
const ITEM_CLASS = "class";
|
||||||
const ITEM_ID_SUFFIX = "name";
|
const ITEM_ID_SUFFIX = "name";
|
||||||
|
|
||||||
|
const TEXT_INPUT_CLASS = "input_text";
|
||||||
|
|
||||||
private $formElTypes = array(
|
private $formElTypes = array(
|
||||||
TEMPLATE_DATE => array(
|
TEMPLATE_DATE => array(
|
||||||
"class" => "Zend_Form_Element_Text",
|
"class" => "Zend_Form_Element_Text",
|
||||||
"attrs" => array(
|
"attrs" => array(
|
||||||
"class" => "input_text"
|
"class" => self::TEXT_INPUT_CLASS
|
||||||
),
|
),
|
||||||
"validators" => array(
|
"validators" => array(
|
||||||
array(
|
array(
|
||||||
|
@ -33,7 +35,7 @@ class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
TEMPLATE_TIME => array(
|
TEMPLATE_TIME => array(
|
||||||
"class" => "Zend_Form_Element_Text",
|
"class" => "Zend_Form_Element_Text",
|
||||||
"attrs" => array(
|
"attrs" => array(
|
||||||
"class" => "input_text"
|
"class" => self::TEXT_INPUT_CLASS
|
||||||
),
|
),
|
||||||
"validators" => array(
|
"validators" => array(
|
||||||
array(
|
array(
|
||||||
|
@ -50,7 +52,7 @@ class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
TEMPLATE_DATETIME => array(
|
TEMPLATE_DATETIME => array(
|
||||||
"class" => "Zend_Form_Element_Text",
|
"class" => "Zend_Form_Element_Text",
|
||||||
"attrs" => array(
|
"attrs" => array(
|
||||||
"class" => "input_text"
|
"class" => self::TEXT_INPUT_CLASS
|
||||||
),
|
),
|
||||||
"validators" => array(
|
"validators" => array(
|
||||||
array(
|
array(
|
||||||
|
@ -67,7 +69,7 @@ class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
TEMPLATE_STRING => array(
|
TEMPLATE_STRING => array(
|
||||||
"class" => "Zend_Form_Element_Text",
|
"class" => "Zend_Form_Element_Text",
|
||||||
"attrs" => array(
|
"attrs" => array(
|
||||||
"class" => "input_text"
|
"class" => self::TEXT_INPUT_CLASS
|
||||||
),
|
),
|
||||||
"filters" => array(
|
"filters" => array(
|
||||||
"StringTrim"
|
"StringTrim"
|
||||||
|
@ -87,7 +89,7 @@ class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
"attrs" => array(
|
"attrs" => array(
|
||||||
"class" => "input_text"
|
"class" => self::TEXT_INPUT_CLASS
|
||||||
),
|
),
|
||||||
"filters" => array(
|
"filters" => array(
|
||||||
"Int"
|
"Int"
|
||||||
|
@ -96,7 +98,7 @@ class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
TEMPLATE_FLOAT => array(
|
TEMPLATE_FLOAT => array(
|
||||||
"class" => "Zend_Form_Element_Text",
|
"class" => "Zend_Form_Element_Text",
|
||||||
"attrs" => array(
|
"attrs" => array(
|
||||||
"class" => "input_text"
|
"class" => self::TEXT_INPUT_CLASS
|
||||||
),
|
),
|
||||||
"validators" => array(
|
"validators" => array(
|
||||||
array(
|
array(
|
||||||
|
@ -107,16 +109,69 @@ class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
);
|
);
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
|
|
||||||
|
$this->setDecorators(array(
|
||||||
|
'PrepareElements',
|
||||||
|
array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml'))
|
||||||
|
));
|
||||||
|
|
||||||
$history_id = new Zend_Form_Element_Hidden(self::ID_PREFIX.'id');
|
$history_id = new Zend_Form_Element_Hidden(self::ID_PREFIX.'id');
|
||||||
$history_id->setValidators(array(
|
$history_id->setValidators(array(
|
||||||
new Zend_Validate_Int()
|
new Zend_Validate_Int()
|
||||||
));
|
));
|
||||||
|
$history_id->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($history_id);
|
$this->addElement($history_id);
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$starts->setAttrib('data-format', self::VALIDATE_DATETIME_FORMAT);
|
||||||
|
$starts->addFilter('StringTrim');
|
||||||
|
$starts->setLabel(_('Start Time'));
|
||||||
|
$starts->setDecorators(array('ViewHelper'));
|
||||||
|
$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);
|
||||||
|
$ends->setAttrib('data-format', self::VALIDATE_DATETIME_FORMAT);
|
||||||
|
$ends->addFilter('StringTrim');
|
||||||
|
$ends->setLabel(_('End Time'));
|
||||||
|
$ends->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($ends);
|
||||||
|
|
||||||
|
$dynamic_attrs = new Zend_Form_SubForm();
|
||||||
|
$this->addSubForm($dynamic_attrs, self::ID_PREFIX.'template');
|
||||||
|
|
||||||
|
// Add the submit button
|
||||||
|
$this->addElement('button', 'his_item_save', array(
|
||||||
|
'ignore' => true,
|
||||||
|
'class' => 'btn his_item_save',
|
||||||
|
'label' => _('Save'),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add the cancel button
|
||||||
|
$this->addElement('button', 'his_item_cancel', array(
|
||||||
|
'ignore' => true,
|
||||||
|
'class' => 'btn his_item_cancel',
|
||||||
|
'label' => _('Cancel'),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createFromTemplate($template) {
|
public function createFromTemplate($template) {
|
||||||
|
|
||||||
|
$templateSubForm = $this->getSubForm(self::ID_PREFIX.'template');
|
||||||
|
|
||||||
for ($i = 0, $len = count($template); $i < $len; $i++) {
|
for ($i = 0, $len = count($template); $i < $len; $i++) {
|
||||||
|
|
||||||
$item = $template[$i];
|
$item = $template[$i];
|
||||||
|
@ -170,41 +225,8 @@ class Application_Form_EditHistoryItem extends Zend_Form
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addElement($el);
|
$el->setDecorators(array('ViewHelper'));
|
||||||
}
|
$templateSubForm->addElement($el);
|
||||||
|
}
|
||||||
// Add the submit button
|
|
||||||
$this->addElement('button', 'his_item_save', array(
|
|
||||||
'ignore' => true,
|
|
||||||
'class' => 'btn his_item_save',
|
|
||||||
'label' => _('Save'),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add the cancel button
|
|
||||||
$this->addElement('button', 'his_item_cancel', array(
|
|
||||||
'ignore' => true,
|
|
||||||
'class' => 'btn his_item_cancel',
|
|
||||||
'label' => _('Cancel'),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->addDisplayGroup(
|
|
||||||
array(
|
|
||||||
'his_item_save',
|
|
||||||
'his_item_cancel'
|
|
||||||
),
|
|
||||||
'submitButtons',
|
|
||||||
array(
|
|
||||||
'decorators' => array(
|
|
||||||
'FormElements',
|
|
||||||
'DtDdWrapper'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -211,21 +211,30 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
public function populateTemplateItem($values) {
|
public function populateTemplateItem($values) {
|
||||||
|
|
||||||
$template = $this->getItemTemplate();
|
$this->con->beginTransaction();
|
||||||
$historyRecord = new CcPlayoutHistory();
|
|
||||||
|
try {
|
||||||
$timezoneUTC = new DateTimeZone("UTC");
|
$template = $this->getItemTemplate();
|
||||||
$timezoneLocal = new DateTimeZone($this->timezone);
|
$historyRecord = new CcPlayoutHistory();
|
||||||
|
|
||||||
$dateTime = new DateTime($values["starts"], $timezoneLocal);
|
$timezoneUTC = new DateTimeZone("UTC");
|
||||||
$dateTime->setTimezone($timezoneLocal);
|
$timezoneLocal = new DateTimeZone($this->timezone);
|
||||||
$historyRecord->setDbStarts($dateTime->format("Y-m-d H:i:s"));
|
|
||||||
|
$dateTime = new DateTime($values["starts"], $timezoneLocal);
|
||||||
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
$dateTime->setTimezone($timezoneLocal);
|
||||||
$dateTime->setTimezone($timezoneUTC);
|
$historyRecord->setDbStarts($dateTime->format("Y-m-d H:i:s"));
|
||||||
$historyRecord->setDbEnds($dateTime->format("Y-m-d H:i:s"));
|
|
||||||
|
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
||||||
|
$dateTime->setTimezone($timezoneUTC);
|
||||||
|
$historyRecord->setDbEnds($dateTime->format("Y-m-d H:i:s"));
|
||||||
|
|
||||||
|
$this->con->commit();
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
$this->con->rollback();
|
||||||
|
Logging::info($e);
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,8 +356,8 @@ class Application_Service_HistoryService
|
||||||
$fields = array();
|
$fields = array();
|
||||||
|
|
||||||
//array index is the position of the item in the history template table.
|
//array index is the position of the item in the history template table.
|
||||||
$fields[] = array("name" => "starts", "type" => TEMPLATE_DATETIME, "isFileMd" => false);
|
//$fields[] = array("name" => "starts", "type" => TEMPLATE_DATETIME, "isFileMd" => false);
|
||||||
$fields[] = array("name" => "ends", "type" => TEMPLATE_DATETIME, "isFileMd" => false);
|
//$fields[] = array("name" => "ends", "type" => TEMPLATE_DATETIME, "isFileMd" => false);
|
||||||
$fields[] = array("name" => MDATA_KEY_TITLE, "type" => TEMPLATE_STRING, "isFileMd" => true); //these fields can be populated from an associated file.
|
$fields[] = array("name" => MDATA_KEY_TITLE, "type" => TEMPLATE_STRING, "isFileMd" => true); //these fields can be populated from an associated file.
|
||||||
$fields[] = array("name" => MDATA_KEY_CREATOR, "type" => TEMPLATE_STRING, "isFileMd" => true);
|
$fields[] = array("name" => MDATA_KEY_CREATOR, "type" => TEMPLATE_STRING, "isFileMd" => true);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,60 @@
|
||||||
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong" id="edit-history-file">
|
<form>
|
||||||
<?php echo $this->form; ?>
|
<?php $form = $this->element ?>
|
||||||
</div>
|
|
||||||
|
<dl class="zend_form">
|
||||||
|
|
||||||
|
<?php $name = "his_item_id"; ?>
|
||||||
|
<dd id="<?php echo $name;?>-element">
|
||||||
|
<?php echo $form->getElement($name); ?>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<?php foreach (array("his_item_starts", "his_item_ends") as $name): ?>
|
||||||
|
<dt id="<?php echo $name;?>-label">
|
||||||
|
<label for="<?php echo $name;?>"><?php echo $form->getElement($name)->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="<?php echo $name;?>-element">
|
||||||
|
<div class="well">
|
||||||
|
<div id="<?php echo $name;?>_datetimepicker" class="input-append date">
|
||||||
|
<?php echo $form->getElement($name) ?>
|
||||||
|
<span class="add-on">
|
||||||
|
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php if ($form->getElement($name)->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach ($form->getElement($name)->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<?php endforeach;?>
|
||||||
|
|
||||||
|
<?php foreach ($form->getSubForm('his_item_template') as $index=>$el): ?>
|
||||||
|
<?php $name = $el->getName(); ?>
|
||||||
|
|
||||||
|
<dt id="<?php echo $name;?>-label">
|
||||||
|
<label for="<?php echo $name;?>"><?php echo $el->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="<?php echo $name;?>-element">
|
||||||
|
<?php echo $el ?>
|
||||||
|
<?php if ($el->hasErrors()): ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($el->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
<dd id="submitButtons-element">
|
||||||
|
<?php foreach (array("his_item_save", "his_item_cancel") as $name): ?>
|
||||||
|
<?php echo $form->getElement($name); ?>
|
||||||
|
<?php endforeach;?>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<?php echo $this->form; ?>
|
File diff suppressed because one or more lines are too long
|
@ -201,10 +201,13 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
function makeHistoryDialog(html) {
|
function makeHistoryDialog(html) {
|
||||||
$hisDialogEl = $(html);
|
$hisDialogEl = $(html);
|
||||||
|
|
||||||
$hisDialogEl.dialog({
|
$hisDialogEl.dialog({
|
||||||
title: $.i18n._("Edit History Record"),
|
title: $.i18n._("Edit History Record"),
|
||||||
modal: true,
|
modal: true,
|
||||||
|
open: function( event, ui ) {
|
||||||
|
$hisDialogEl.find('.date').datetimepicker();
|
||||||
|
},
|
||||||
close: function() {
|
close: function() {
|
||||||
removeHistoryDialog();
|
removeHistoryDialog();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,521 @@
|
||||||
|
/*!
|
||||||
|
* jQuery Migrate - v1.2.1 - 2013-05-08
|
||||||
|
* https://github.com/jquery/jquery-migrate
|
||||||
|
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
|
||||||
|
*/
|
||||||
|
(function( jQuery, window, undefined ) {
|
||||||
|
// See http://bugs.jquery.com/ticket/13335
|
||||||
|
// "use strict";
|
||||||
|
|
||||||
|
|
||||||
|
var warnedAbout = {};
|
||||||
|
|
||||||
|
// List of warnings already given; public read only
|
||||||
|
jQuery.migrateWarnings = [];
|
||||||
|
|
||||||
|
// Set to true to prevent console output; migrateWarnings still maintained
|
||||||
|
// jQuery.migrateMute = false;
|
||||||
|
|
||||||
|
// Show a message on the console so devs know we're active
|
||||||
|
if ( !jQuery.migrateMute && window.console && window.console.log ) {
|
||||||
|
window.console.log("JQMIGRATE: Logging is active");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set to false to disable traces that appear with warnings
|
||||||
|
if ( jQuery.migrateTrace === undefined ) {
|
||||||
|
jQuery.migrateTrace = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forget any warnings we've already given; public
|
||||||
|
jQuery.migrateReset = function() {
|
||||||
|
warnedAbout = {};
|
||||||
|
jQuery.migrateWarnings.length = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
function migrateWarn( msg) {
|
||||||
|
var console = window.console;
|
||||||
|
if ( !warnedAbout[ msg ] ) {
|
||||||
|
warnedAbout[ msg ] = true;
|
||||||
|
jQuery.migrateWarnings.push( msg );
|
||||||
|
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||||
|
console.warn( "JQMIGRATE: " + msg );
|
||||||
|
if ( jQuery.migrateTrace && console.trace ) {
|
||||||
|
console.trace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function migrateWarnProp( obj, prop, value, msg ) {
|
||||||
|
if ( Object.defineProperty ) {
|
||||||
|
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
||||||
|
// allow property to be overwritten in case some other plugin wants it
|
||||||
|
try {
|
||||||
|
Object.defineProperty( obj, prop, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: function() {
|
||||||
|
migrateWarn( msg );
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
set: function( newValue ) {
|
||||||
|
migrateWarn( msg );
|
||||||
|
value = newValue;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} catch( err ) {
|
||||||
|
// IE8 is a dope about Object.defineProperty, can't warn there
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Non-ES5 (or broken) browser; just set the property
|
||||||
|
jQuery._definePropertyBroken = true;
|
||||||
|
obj[ prop ] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( document.compatMode === "BackCompat" ) {
|
||||||
|
// jQuery has never supported or tested Quirks Mode
|
||||||
|
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
|
||||||
|
oldAttr = jQuery.attr,
|
||||||
|
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
||||||
|
function() { return null; },
|
||||||
|
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
||||||
|
function() { return undefined; },
|
||||||
|
rnoType = /^(?:input|button)$/i,
|
||||||
|
rnoAttrNodeType = /^[238]$/,
|
||||||
|
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
||||||
|
ruseDefault = /^(?:checked|selected)$/i;
|
||||||
|
|
||||||
|
// jQuery.attrFn
|
||||||
|
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
|
||||||
|
|
||||||
|
jQuery.attr = function( elem, name, value, pass ) {
|
||||||
|
var lowerName = name.toLowerCase(),
|
||||||
|
nType = elem && elem.nodeType;
|
||||||
|
|
||||||
|
if ( pass ) {
|
||||||
|
// Since pass is used internally, we only warn for new jQuery
|
||||||
|
// versions where there isn't a pass arg in the formal params
|
||||||
|
if ( oldAttr.length < 4 ) {
|
||||||
|
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
||||||
|
}
|
||||||
|
if ( elem && !rnoAttrNodeType.test( nType ) &&
|
||||||
|
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
|
||||||
|
return jQuery( elem )[ name ]( value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
||||||
|
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
||||||
|
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
||||||
|
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore boolHook for boolean property/attribute synchronization
|
||||||
|
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
||||||
|
jQuery.attrHooks[ lowerName ] = {
|
||||||
|
get: function( elem, name ) {
|
||||||
|
// Align boolean attributes with corresponding properties
|
||||||
|
// Fall back to attribute presence where some booleans are not supported
|
||||||
|
var attrNode,
|
||||||
|
property = jQuery.prop( elem, name );
|
||||||
|
return property === true || typeof property !== "boolean" &&
|
||||||
|
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
||||||
|
|
||||||
|
name.toLowerCase() :
|
||||||
|
undefined;
|
||||||
|
},
|
||||||
|
set: function( elem, value, name ) {
|
||||||
|
var propName;
|
||||||
|
if ( value === false ) {
|
||||||
|
// Remove boolean attributes when set to false
|
||||||
|
jQuery.removeAttr( elem, name );
|
||||||
|
} else {
|
||||||
|
// value is true since we know at this point it's type boolean and not false
|
||||||
|
// Set boolean attributes to the same name and set the DOM property
|
||||||
|
propName = jQuery.propFix[ name ] || name;
|
||||||
|
if ( propName in elem ) {
|
||||||
|
// Only set the IDL specifically if it already exists on the element
|
||||||
|
elem[ propName ] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
elem.setAttribute( name, name.toLowerCase() );
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Warn only for attributes that can remain distinct from their properties post-1.9
|
||||||
|
if ( ruseDefault.test( lowerName ) ) {
|
||||||
|
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return oldAttr.call( jQuery, elem, name, value );
|
||||||
|
};
|
||||||
|
|
||||||
|
// attrHooks: value
|
||||||
|
jQuery.attrHooks.value = {
|
||||||
|
get: function( elem, name ) {
|
||||||
|
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||||
|
if ( nodeName === "button" ) {
|
||||||
|
return valueAttrGet.apply( this, arguments );
|
||||||
|
}
|
||||||
|
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||||
|
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
||||||
|
}
|
||||||
|
return name in elem ?
|
||||||
|
elem.value :
|
||||||
|
null;
|
||||||
|
},
|
||||||
|
set: function( elem, value ) {
|
||||||
|
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||||
|
if ( nodeName === "button" ) {
|
||||||
|
return valueAttrSet.apply( this, arguments );
|
||||||
|
}
|
||||||
|
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||||
|
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
||||||
|
}
|
||||||
|
// Does not return so that setAttribute is also used
|
||||||
|
elem.value = value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var matched, browser,
|
||||||
|
oldInit = jQuery.fn.init,
|
||||||
|
oldParseJSON = jQuery.parseJSON,
|
||||||
|
// Note: XSS check is done below after string is trimmed
|
||||||
|
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
|
||||||
|
|
||||||
|
// $(html) "looks like html" rule change
|
||||||
|
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
||||||
|
var match;
|
||||||
|
|
||||||
|
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
||||||
|
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
|
||||||
|
// This is an HTML string according to the "old" rules; is it still?
|
||||||
|
if ( selector.charAt( 0 ) !== "<" ) {
|
||||||
|
migrateWarn("$(html) HTML strings must start with '<' character");
|
||||||
|
}
|
||||||
|
if ( match[ 3 ] ) {
|
||||||
|
migrateWarn("$(html) HTML text after last tag is ignored");
|
||||||
|
}
|
||||||
|
// Consistently reject any HTML-like string starting with a hash (#9521)
|
||||||
|
// Note that this may break jQuery 1.6.x code that otherwise would work.
|
||||||
|
if ( match[ 0 ].charAt( 0 ) === "#" ) {
|
||||||
|
migrateWarn("HTML string cannot start with a '#' character");
|
||||||
|
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
|
||||||
|
}
|
||||||
|
// Now process using loose rules; let pre-1.8 play too
|
||||||
|
if ( context && context.context ) {
|
||||||
|
// jQuery object as context; parseHTML expects a DOM object
|
||||||
|
context = context.context;
|
||||||
|
}
|
||||||
|
if ( jQuery.parseHTML ) {
|
||||||
|
return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),
|
||||||
|
context, rootjQuery );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return oldInit.apply( this, arguments );
|
||||||
|
};
|
||||||
|
jQuery.fn.init.prototype = jQuery.fn;
|
||||||
|
|
||||||
|
// Let $.parseJSON(falsy_value) return null
|
||||||
|
jQuery.parseJSON = function( json ) {
|
||||||
|
if ( !json && json !== null ) {
|
||||||
|
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return oldParseJSON.apply( this, arguments );
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.uaMatch = function( ua ) {
|
||||||
|
ua = ua.toLowerCase();
|
||||||
|
|
||||||
|
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||||
|
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||||
|
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||||
|
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||||
|
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||||
|
[];
|
||||||
|
|
||||||
|
return {
|
||||||
|
browser: match[ 1 ] || "",
|
||||||
|
version: match[ 2 ] || "0"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Don't clobber any existing jQuery.browser in case it's different
|
||||||
|
if ( !jQuery.browser ) {
|
||||||
|
matched = jQuery.uaMatch( navigator.userAgent );
|
||||||
|
browser = {};
|
||||||
|
|
||||||
|
if ( matched.browser ) {
|
||||||
|
browser[ matched.browser ] = true;
|
||||||
|
browser.version = matched.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chrome is Webkit, but Webkit is also Safari.
|
||||||
|
if ( browser.chrome ) {
|
||||||
|
browser.webkit = true;
|
||||||
|
} else if ( browser.webkit ) {
|
||||||
|
browser.safari = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery.browser = browser;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warn if the code tries to get jQuery.browser
|
||||||
|
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
|
||||||
|
|
||||||
|
jQuery.sub = function() {
|
||||||
|
function jQuerySub( selector, context ) {
|
||||||
|
return new jQuerySub.fn.init( selector, context );
|
||||||
|
}
|
||||||
|
jQuery.extend( true, jQuerySub, this );
|
||||||
|
jQuerySub.superclass = this;
|
||||||
|
jQuerySub.fn = jQuerySub.prototype = this();
|
||||||
|
jQuerySub.fn.constructor = jQuerySub;
|
||||||
|
jQuerySub.sub = this.sub;
|
||||||
|
jQuerySub.fn.init = function init( selector, context ) {
|
||||||
|
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
||||||
|
context = jQuerySub( context );
|
||||||
|
}
|
||||||
|
|
||||||
|
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||||||
|
};
|
||||||
|
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||||||
|
var rootjQuerySub = jQuerySub(document);
|
||||||
|
migrateWarn( "jQuery.sub() is deprecated" );
|
||||||
|
return jQuerySub;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Ensure that $.ajax gets the new parseJSON defined in core.js
|
||||||
|
jQuery.ajaxSetup({
|
||||||
|
converters: {
|
||||||
|
"text json": jQuery.parseJSON
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var oldFnData = jQuery.fn.data;
|
||||||
|
|
||||||
|
jQuery.fn.data = function( name ) {
|
||||||
|
var ret, evt,
|
||||||
|
elem = this[0];
|
||||||
|
|
||||||
|
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
||||||
|
if ( elem && name === "events" && arguments.length === 1 ) {
|
||||||
|
ret = jQuery.data( elem, name );
|
||||||
|
evt = jQuery._data( elem, name );
|
||||||
|
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
||||||
|
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
||||||
|
return evt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return oldFnData.apply( this, arguments );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var rscriptType = /\/(java|ecma)script/i,
|
||||||
|
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
||||||
|
|
||||||
|
jQuery.fn.andSelf = function() {
|
||||||
|
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
||||||
|
return oldSelf.apply( this, arguments );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
||||||
|
if ( !jQuery.clean ) {
|
||||||
|
jQuery.clean = function( elems, context, fragment, scripts ) {
|
||||||
|
// Set context per 1.8 logic
|
||||||
|
context = context || document;
|
||||||
|
context = !context.nodeType && context[0] || context;
|
||||||
|
context = context.ownerDocument || context;
|
||||||
|
|
||||||
|
migrateWarn("jQuery.clean() is deprecated");
|
||||||
|
|
||||||
|
var i, elem, handleScript, jsTags,
|
||||||
|
ret = [];
|
||||||
|
|
||||||
|
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
||||||
|
|
||||||
|
// Complex logic lifted directly from jQuery 1.8
|
||||||
|
if ( fragment ) {
|
||||||
|
// Special handling of each script element
|
||||||
|
handleScript = function( elem ) {
|
||||||
|
// Check if we consider it executable
|
||||||
|
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
||||||
|
// Detach the script and store it in the scripts array (if provided) or the fragment
|
||||||
|
// Return truthy to indicate that it has been handled
|
||||||
|
return scripts ?
|
||||||
|
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
||||||
|
fragment.appendChild( elem );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
||||||
|
// Check if we're done after handling an executable script
|
||||||
|
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
||||||
|
// Append to fragment and handle embedded scripts
|
||||||
|
fragment.appendChild( elem );
|
||||||
|
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
||||||
|
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
||||||
|
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
||||||
|
|
||||||
|
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
||||||
|
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
||||||
|
i += jsTags.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var eventAdd = jQuery.event.add,
|
||||||
|
eventRemove = jQuery.event.remove,
|
||||||
|
eventTrigger = jQuery.event.trigger,
|
||||||
|
oldToggle = jQuery.fn.toggle,
|
||||||
|
oldLive = jQuery.fn.live,
|
||||||
|
oldDie = jQuery.fn.die,
|
||||||
|
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
||||||
|
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
||||||
|
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
||||||
|
hoverHack = function( events ) {
|
||||||
|
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
if ( rhoverHack.test( events ) ) {
|
||||||
|
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
||||||
|
}
|
||||||
|
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
||||||
|
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
||||||
|
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
||||||
|
if ( jQuery.event.dispatch ) {
|
||||||
|
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Support for 'hover' pseudo-event and ajax event warnings
|
||||||
|
jQuery.event.add = function( elem, types, handler, data, selector ){
|
||||||
|
if ( elem !== document && rajaxEvent.test( types ) ) {
|
||||||
|
migrateWarn( "AJAX events should be attached to document: " + types );
|
||||||
|
}
|
||||||
|
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
||||||
|
};
|
||||||
|
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
||||||
|
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.fn.error = function() {
|
||||||
|
var args = Array.prototype.slice.call( arguments, 0);
|
||||||
|
migrateWarn("jQuery.fn.error() is deprecated");
|
||||||
|
args.splice( 0, 0, "error" );
|
||||||
|
if ( arguments.length ) {
|
||||||
|
return this.bind.apply( this, args );
|
||||||
|
}
|
||||||
|
// error event should not bubble to window, although it does pre-1.7
|
||||||
|
this.triggerHandler.apply( this, args );
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.fn.toggle = function( fn, fn2 ) {
|
||||||
|
|
||||||
|
// Don't mess with animation or css toggles
|
||||||
|
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
||||||
|
return oldToggle.apply( this, arguments );
|
||||||
|
}
|
||||||
|
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
||||||
|
|
||||||
|
// Save reference to arguments for access in closure
|
||||||
|
var args = arguments,
|
||||||
|
guid = fn.guid || jQuery.guid++,
|
||||||
|
i = 0,
|
||||||
|
toggler = function( event ) {
|
||||||
|
// Figure out which function to execute
|
||||||
|
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
||||||
|
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
||||||
|
|
||||||
|
// Make sure that clicks stop
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// and execute the function
|
||||||
|
return args[ lastToggle ].apply( this, arguments ) || false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// link all the functions, so any of them can unbind this click handler
|
||||||
|
toggler.guid = guid;
|
||||||
|
while ( i < args.length ) {
|
||||||
|
args[ i++ ].guid = guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.click( toggler );
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.fn.live = function( types, data, fn ) {
|
||||||
|
migrateWarn("jQuery.fn.live() is deprecated");
|
||||||
|
if ( oldLive ) {
|
||||||
|
return oldLive.apply( this, arguments );
|
||||||
|
}
|
||||||
|
jQuery( this.context ).on( types, this.selector, data, fn );
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.fn.die = function( types, fn ) {
|
||||||
|
migrateWarn("jQuery.fn.die() is deprecated");
|
||||||
|
if ( oldDie ) {
|
||||||
|
return oldDie.apply( this, arguments );
|
||||||
|
}
|
||||||
|
jQuery( this.context ).off( types, this.selector || "**", fn );
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Turn global events into document-triggered events
|
||||||
|
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
||||||
|
if ( !elem && !rajaxEvent.test( event ) ) {
|
||||||
|
migrateWarn( "Global events are undocumented and deprecated" );
|
||||||
|
}
|
||||||
|
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
||||||
|
};
|
||||||
|
jQuery.each( ajaxEvents.split("|"),
|
||||||
|
function( _, name ) {
|
||||||
|
jQuery.event.special[ name ] = {
|
||||||
|
setup: function() {
|
||||||
|
var elem = this;
|
||||||
|
|
||||||
|
// The document needs no shimming; must be !== for oldIE
|
||||||
|
if ( elem !== document ) {
|
||||||
|
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
||||||
|
jQuery.event.trigger( name, null, elem, true );
|
||||||
|
});
|
||||||
|
jQuery._data( this, name, jQuery.guid++ );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
teardown: function() {
|
||||||
|
if ( this !== document ) {
|
||||||
|
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
})( jQuery, window );
|
Loading…
Reference in New Issue