Commit fb06bdb6 authored by tufengqi's avatar tufengqi

add gitignore

parent 0d947153
/data33/index/user_site/zhaobi/assets/
/data33/index/user_site/inner_zhaobi/assets/
/data33/index/inner_site/devops/assets/
/data33/index/inner_site/cms_otc_api/assets/
.DS_Store
.idea
.vscode
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 50 50"><path fill="#444" d="M15.563 40.836a.997.997 0 0 0 1.414 0l15-15a1 1 0 0 0 0-1.414l-15-15a1 1 0 0 0-1.414 1.414L29.856 25.13 15.563 39.42a1 1 0 0 0 0 1.414z"/></svg>
.main-container {
width: auto;
}
span.indent {
color: #ccc;
}
ul.trace {
font-size: 12px;
color: #999;
margin: 2px 0 0 0;
padding: 0;
list-style: none;
white-space: normal;
}
#db-panel-detailed-grid table tbody tr td {
position: relative;
}
.db-explain {
position: absolute;
bottom: 4px;
right: 4px;
font-size: 10px;
}
.db-explain-text {
display: none;
margin: 10px 0 0px 0;
font-size: 13px;
width: 100%;
word-break: break-all;
}
#db-explain-all {
position: absolute;
bottom: 0;
right: 0;
font-size: 12px;
margin-right: 15px;
}
ul.assets {
margin: 2px 0 0 0;
padding: 0;
list-style: none;
white-space: normal;
}
.callout {
margin: 0 0 10px 0;
padding: 5px;
border: solid 1px #eee;
border-radius: 3px;
}
.callout-important {
background-color: rgba(185, 74, 72, 0.2);
border-color: rgba(185, 74, 72, 0.4);
}
.callout-success {
background-color: rgba(70, 136, 71, 0.2);
border-color: rgba(70, 136, 71, 0.4);
}
.callout-info {
background-color: rgba(58, 135, 173, 0.2);
border-color: rgba(58, 135, 173, 0.4);
}
.list-group .glyphicon {
float: right;
}
td, th {
white-space: pre-wrap;
word-wrap: break-word;
}
.request-table td {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
word-break: break-all;
}
.request-table tr > th:first-child {
width: 25%;
}
.config-php-info-table td.v {
word-break: break-all;
}
.not-set {
color: #c55;
font-style: italic;
}
.detail-grid-view th {
white-space: nowrap;
}
/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
padding-left: 5px;
}
a.asc:after {
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
}
.mail-sorter {
margin-top: 7px;
}
.mail-sorter li {
list-style: none;
float: left;
width: 12%;
font-weight: bold;
}
.nowrap {
white-space: nowrap;
}
.table-pointer tbody tr {
cursor: pointer;
}
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 50 50"><path fill="#444" d="M39.642 9.722a1.01 1.01 0 0 0-.382-.077H28.103a1 1 0 0 0 0 2h8.743L21.7 26.79a1 1 0 0 0 1.414 1.415L38.26 13.06v8.743a1 1 0 0 0 2 0V10.646a1.005 1.005 0 0 0-.618-.924z"/><path d="M39.26 27.985a1 1 0 0 0-1 1v10.66h-28v-28h10.683a1 1 0 0 0 0-2H9.26a1 1 0 0 0-1 1v30a1 1 0 0 0 1 1h30a1 1 0 0 0 1-1v-11.66a1 1 0 0 0-1-1z"/></svg>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 50 50" version="1.1"><path d="m41.1 23c-0.6 0-1 0.4-1 1v10.7l-25.6-0.1c0 0 0-2 0-2.8 0-0.8-0.7-1-1-0.6l-3.5 3.5c-0.6 0.6-0.6 1.3 0 2l3.4 3.4c0.4 0.4 1.1 0.2 1-0.6l0-2.9c0 0 20.8 0.1 26.6 0 0.6 0 1-0.4 1-1v-11.7c0-0.6-0.4-1-1-1zM9 26.9 9 26.9 9 26.9 9 26.9"/><path d="m9 26.9c0.6 0 1-0.4 1-1v-10.7l25.6 0.1c0 0 0 2 0 2.8 0 0.8 0.7 1 1 0.6l3.5-3.5c0.6-0.6 0.6-1.3 0-2l-3.4-3.4c-0.4-0.4-1.1-0.2-1 0.6l0 2.9c0 0-20.8-0.1-26.6 0-0.6 0-1 0.4-1 1v11.7c0 0.6 0.4 1 1 1z"/></svg>
\ No newline at end of file
.debug-timeline-panel {
border: 1px solid #ddd;
position: relative;
margin-bottom: 20px;
}
.debug-timeline-panel.inline .debug-timeline-panel__item {
height: 20px;
margin-top: -20px;
border-bottom: 0;
}
.debug-timeline-panel.inline .debug-timeline-panel__item:first-child {
margin: 0;
}
.debug-timeline-panel.inline .debug-timeline-panel__item:not(.empty):hover {
background-color: transparent;
}
.debug-timeline-panel.inline .debug-timeline-panel__items .time {
box-shadow: inset 0px 0 3px -1px rgba(255, 255, 255, 0.7);
}
.debug-timeline-panel.inline .debug-timeline-panel__items .category {
display: none;
}
.debug-timeline-panel.inline .ruler.ruler-start,
.debug-timeline-panel.inline .ruler.ruler-end{
display: none;
}
.debug-timeline-panel:not(.inline) .debug-timeline-panel__item a:focus{
outline: none;
}
.debug-timeline-panel.affix .ruler b {
z-index: 2;
position: fixed;
top: 0;
}
.debug-timeline-panel .category {
opacity: 1;
font-size: 10px;
position: absolute;
line-height: 20px;
padding: 0 10px;
color: #222;
white-space: nowrap;
cursor: pointer;
}
.debug-timeline-panel .category span {
color: #7d7d7d;
}
.debug-timeline-panel .category span.memory[title] {
cursor: help;
border-bottom: 1px dotted #777;
}
.debug-timeline-panel .right > .category {
right: 100%;
}
.debug-timeline-panel .left > .category {
left: 100%;
}
.debug-timeline-panel .ruler {
position: absolute;
content: '';
font-size: 10px;
padding-left: 2px;
top: 0;
height: 100%;
border-left: 1px solid #ddd;
}
.debug-timeline-panel__header .ruler:first-child{
border-left: none;
}
.debug-timeline-panel .ruler.ruler-start {
top: auto;
margin-top: 20px;
}
.debug-timeline-panel .ruler.ruler-end {
left: -1px;
top: auto;
}
.debug-timeline-panel .ruler b {
position: absolute;
z-index: 2;
color: black;
font-weight: bold;
white-space: nowrap;
background-color: rgba(255,255,255,.4);
min-width: 40px;
line-height: 19px;
display: block;
text-align: center;
}
.debug-timeline-panel .time {
position: relative;
min-height: 20px;
display: block;
min-width: 1px;
padding: 0;
background-color: #989898;
}
.debug-timeline-panel .time + .tooltip .tooltip-inner{
max-width: 300px;
max-height: 180px;
overflow: auto;
word-wrap: break-word;
overflow-wrap: break-word;
}
.debug-timeline-panel__header {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.debug-timeline-panel__header,
.debug-timeline-panel__item {
min-height: 20px;
border-bottom: 1px solid #ddd;
overflow: hidden;
}
.debug-timeline-panel__header .control {
position: absolute;
margin-left: -20px;
top:0;
}
.debug-timeline-panel__header .control button {
display: none;
padding: 0;
}
.debug-timeline-panel__header .control button:focus{
outline: none;
}
.debug-timeline-panel__header .control button:hover{
fill: #337ab7;
}
.debug-timeline-panel:not(.inline) .debug-timeline-panel__header .control button.inline,
.debug-timeline-panel.inline .debug-timeline-panel__header .control button.open{
display: block;
}
.debug-timeline-panel.affix .debug-timeline-panel__header .control{
position: fixed;
}
.debug-timeline-panel__item:last-child {
border-bottom: 0;
}
.debug-timeline-panel__item:nth-child(2n) {
background-color: #f9f9f9;
}
.debug-timeline-panel__item:hover {
background-color: rgba(51, 122, 183, 0.16);
}
.debug-timeline-panel__item.empty {
background-color: #f9f9f9;
line-height: 20px;
padding-left: 10px;
}
.debug-timeline-panel__item.empty span {
position: absolute;
background-color: inherit;
}
.debug-timeline-panel__search {
background-color: #f9f9f9;
padding: 10px 10px 0px 10px;
margin-bottom: 10px;
font-size: 16px;
}
.debug-timeline-panel__search > div {
display: inline-block;
margin-bottom: 10px;
}
.debug-timeline-panel__search .duration {
margin-right: 20px;
}
.debug-timeline-panel__search label {
width: 80px;
}
.debug-timeline-panel__search input {
font-size: 16px;
padding: 4px;
}
.debug-timeline-panel__search input#timeline-duration {
width: 55px;
text-align: right;
}
.debug-timeline-panel__search input#timeline-category {
min-width: 185px;
}
.debug-timeline-panel__memory {
position: relative;
margin-top: 18px;
box-sizing: content-box;
border-bottom: 1px solid #ddd;
}
.debug-timeline-panel__memory svg{
width: 100%;
}
.debug-timeline-panel__memory .scale {
font-size: 12px;
line-height: 16px;
position: absolute;
border-bottom: 1px dashed #000;
width: 100%;
padding-left: 6px;
transition: bottom 0.2s ease;
}
@media (max-width:767px) {
.debug-timeline-panel .ruler:nth-child(2n) b{
display: none;
}
}
@media (max-width: 991px) {
.debug-timeline-panel__header .control{
margin-left: -17px;
}
}
(function () {
'use strict';
var Timeline = function (options) {
this.options = options;
var self = this;
this.init = function () {
if (this.options.$focus) {
this.options.$focus.focus();
delete this.options.$focus;
}
self.options.$timeline.find('.debug-timeline-panel__item a')
.on('show.bs.tooltip', function () {
var data = $(this).data('memory');
if (data) {
self.options.$memory.text(data[0]).css({'bottom': data[1]+'%'});
}
})
.tooltip();
return self;
};
this.setFocus = function ($elem) {
this.options.$focus = $elem;
return $elem;
};
this.affixTop = function (refresh) {
if (!this.options.affixTop || refresh) {
this.options.affixTop = self.options.$header.offset().top;
}
return this.options.affixTop;
};
$(document).on('pjax:success', function () {
self.init()
});
$(window).on('resize', function () {
self.affixTop(true);
});
self.options.$header
.on('dblclick', function () {
self.options.$timeline.toggleClass('inline');
})
.on('click', 'button', function () {
self.options.$timeline.toggleClass('inline');
});
self.options.$search.on('change', function () {
self.setFocus($(this)).submit();
});
self.options.$timeline.affix({
offset: {
top: function () {
return self.affixTop()
}
}
});
this.init();
};
(new Timeline({
'$timeline': $('.debug-timeline-panel'),
'$header': $('.debug-timeline-panel__header'),
'$search': $('.debug-timeline-panel__search input'),
'$memory': $('.debug-timeline-panel__memory .scale')
}));
})();
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
(function () {
'use strict';
var sendSetIdentity = function(e) {
var form = $(this);
var formData = form.serialize();
$.ajax({
url: form.attr("action"),
type: form.attr("method"),
data: formData,
success: function (data) {
window.top.location.reload();
},
error: function (data) {
form.yiiActiveForm('updateMessages', data.responseJSON, true);
}
});
};
$('#debug-userswitch__set-identity').on('beforeSubmit', sendSetIdentity)
.on('submit', function(e){
e.preventDefault();
});
$('#debug-userswitch__reset-identity').on('beforeSubmit', sendSetIdentity)
.on('submit', function(e){
e.preventDefault();
});
$('#debug-userswitch__filter').on("click", "tbody tr", function(event) {
$('#debug-userswitch__set-identity #user_id').val($(this).data('key'));
$('#debug-userswitch__set-identity').submit();
event.stopPropagation();
});
})();
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/**
* Yii Captcha widget.
*
* This is the JavaScript widget used by the yii\captcha\Captcha widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiCaptcha = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
return false;
}
};
var defaults = {
refreshUrl: undefined,
hashKey: undefined
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
$e.data('yiiCaptcha', {
settings: settings
});
$e.on('click.yiiCaptcha', function () {
methods.refresh.apply($e);
return false;
});
});
},
refresh: function () {
var $e = this,
settings = this.data('yiiCaptcha').settings;
$.ajax({
url: $e.data('yiiCaptcha').settings.refreshUrl,
dataType: 'json',
cache: false,
success: function (data) {
$e.attr('src', data.url);
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
}
});
},
destroy: function () {
this.off('.yiiCaptcha');
this.removeData('yiiCaptcha');
return this;
},
data: function () {
return this.data('yiiCaptcha');
}
};
})(window.jQuery);
/**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
/**
* Used for storing active event handlers and removing them later.
* The structure of single event handler is:
*
* {
* gridViewId: {
* type: {
* event: '...',
* selector: '...'
* }
* }
* }
*
* Used types:
*
* - filter, used for filtering grid with elements found by filterSelector
* - checkRow, used for checking single row
* - checkAllRows, used for checking all rows with according "Check all" checkbox
*
* event is the name of event, for example: 'change.yiiGridView'
* selector is a jQuery selector for finding elements
*
* @type {{}}
*/
var gridEventHandlers = {};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var filterEvents = 'change.yiiGridView keydown.yiiGridView';
var enterPressed = false;
initEventHandler($e, 'filter', filterEvents, settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this);
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\d*\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
var hashPos = settings.filterUrl.indexOf('#');
if (pos >= 0 && hashPos >= 0) {
url += settings.filterUrl.substring(hashPos);
}
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
var event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
initEventHandler($grid, 'checkAllRows', 'click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
initEventHandler($grid, 'checkRow', 'click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
var events = ['.yiiGridView', gridEvents.beforeFilter, gridEvents.afterFilter].join(' ');
this.off(events);
var id = $(this).attr('id');
$.each(gridEventHandlers[id], function (type, data) {
$(document).off(data.event, data.selector);
});
delete gridData[id];
return this;
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
/**
* Used for attaching event handler and prevent of duplicating them. With each call previously attached handler of
* the same type is removed even selector was changed.
* @param {jQuery} $gridView According jQuery grid view element
* @param {string} type Type of the event which acts like a key
* @param {string} event Event name, for example 'change.yiiGridView'
* @param {string} selector jQuery selector
* @param {function} callback The actual function to be executed with this event
*/
function initEventHandler($gridView, type, event, selector, callback) {
var id = $gridView.attr('id');
var prevHandler = gridEventHandlers[id];
if (prevHandler !== undefined && prevHandler[type] !== undefined) {
var data = prevHandler[type];
$(document).off(data.event, data.selector);
}
if (prevHandler === undefined) {
gridEventHandlers[id] = {};
}
$(document).on(event, selector, callback);
gridEventHandlers[id][type] = {event: event, selector: selector};
}
})(window.jQuery);
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')
\ No newline at end of file
/**
* Yii Captcha widget.
*
* This is the JavaScript widget used by the yii\captcha\Captcha widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiCaptcha = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
return false;
}
};
var defaults = {
refreshUrl: undefined,
hashKey: undefined
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
$e.data('yiiCaptcha', {
settings: settings
});
$e.on('click.yiiCaptcha', function () {
methods.refresh.apply($e);
return false;
});
});
},
refresh: function () {
var $e = this,
settings = this.data('yiiCaptcha').settings;
$.ajax({
url: $e.data('yiiCaptcha').settings.refreshUrl,
dataType: 'json',
cache: false,
success: function (data) {
$e.attr('src', data.url);
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
}
});
},
destroy: function () {
this.off('.yiiCaptcha');
this.removeData('yiiCaptcha');
return this;
},
data: function () {
return this.data('yiiCaptcha');
}
};
})(window.jQuery);
/**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
/**
* Used for storing active event handlers and removing them later.
* The structure of single event handler is:
*
* {
* gridViewId: {
* type: {
* event: '...',
* selector: '...'
* }
* }
* }
*
* Used types:
*
* - filter, used for filtering grid with elements found by filterSelector
* - checkRow, used for checking single row
* - checkAllRows, used for checking all rows with according "Check all" checkbox
*
* event is the name of event, for example: 'change.yiiGridView'
* selector is a jQuery selector for finding elements
*
* @type {{}}
*/
var gridEventHandlers = {};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var filterEvents = 'change.yiiGridView keydown.yiiGridView';
var enterPressed = false;
initEventHandler($e, 'filter', filterEvents, settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this);
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\d*\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
var hashPos = settings.filterUrl.indexOf('#');
if (pos >= 0 && hashPos >= 0) {
url += settings.filterUrl.substring(hashPos);
}
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
var event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
initEventHandler($grid, 'checkAllRows', 'click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
initEventHandler($grid, 'checkRow', 'click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
var events = ['.yiiGridView', gridEvents.beforeFilter, gridEvents.afterFilter].join(' ');
this.off(events);
var id = $(this).attr('id');
$.each(gridEventHandlers[id], function (type, data) {
$(document).off(data.event, data.selector);
});
delete gridData[id];
return this;
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
/**
* Used for attaching event handler and prevent of duplicating them. With each call previously attached handler of
* the same type is removed even selector was changed.
* @param {jQuery} $gridView According jQuery grid view element
* @param {string} type Type of the event which acts like a key
* @param {string} event Event name, for example 'change.yiiGridView'
* @param {string} selector jQuery selector
* @param {function} callback The actual function to be executed with this event
*/
function initEventHandler($gridView, type, event, selector, callback) {
var id = $gridView.attr('id');
var prevHandler = gridEventHandlers[id];
if (prevHandler !== undefined && prevHandler[type] !== undefined) {
var data = prevHandler[type];
$(document).off(data.event, data.selector);
}
if (prevHandler === undefined) {
gridEventHandlers[id] = {};
}
$(document).on(event, selector, callback);
gridEventHandlers[id][type] = {event: event, selector: selector};
}
})(window.jQuery);
This diff is collapsed.
/**
* Yii Captcha widget.
*
* This is the JavaScript widget used by the yii\captcha\Captcha widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiCaptcha = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
return false;
}
};
var defaults = {
refreshUrl: undefined,
hashKey: undefined
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
$e.data('yiiCaptcha', {
settings: settings
});
$e.on('click.yiiCaptcha', function () {
methods.refresh.apply($e);
return false;
});
});
},
refresh: function () {
var $e = this,
settings = this.data('yiiCaptcha').settings;
$.ajax({
url: $e.data('yiiCaptcha').settings.refreshUrl,
dataType: 'json',
cache: false,
success: function (data) {
$e.attr('src', data.url);
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
}
});
},
destroy: function () {
this.off('.yiiCaptcha');
this.removeData('yiiCaptcha');
return this;
},
data: function () {
return this.data('yiiCaptcha');
}
};
})(window.jQuery);
/**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
/**
* Used for storing active event handlers and removing them later.
* The structure of single event handler is:
*
* {
* gridViewId: {
* type: {
* event: '...',
* selector: '...'
* }
* }
* }
*
* Used types:
*
* - filter, used for filtering grid with elements found by filterSelector
* - checkRow, used for checking single row
* - checkAllRows, used for checking all rows with according "Check all" checkbox
*
* event is the name of event, for example: 'change.yiiGridView'
* selector is a jQuery selector for finding elements
*
* @type {{}}
*/
var gridEventHandlers = {};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var filterEvents = 'change.yiiGridView keydown.yiiGridView';
var enterPressed = false;
initEventHandler($e, 'filter', filterEvents, settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this);
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\d*\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
var hashPos = settings.filterUrl.indexOf('#');
if (pos >= 0 && hashPos >= 0) {
url += settings.filterUrl.substring(hashPos);
}
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
var event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
initEventHandler($grid, 'checkAllRows', 'click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
initEventHandler($grid, 'checkRow', 'click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
var events = ['.yiiGridView', gridEvents.beforeFilter, gridEvents.afterFilter].join(' ');
this.off(events);
var id = $(this).attr('id');
$.each(gridEventHandlers[id], function (type, data) {
$(document).off(data.event, data.selector);
});
delete gridData[id];
return this;
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
/**
* Used for attaching event handler and prevent of duplicating them. With each call previously attached handler of
* the same type is removed even selector was changed.
* @param {jQuery} $gridView According jQuery grid view element
* @param {string} type Type of the event which acts like a key
* @param {string} event Event name, for example 'change.yiiGridView'
* @param {string} selector jQuery selector
* @param {function} callback The actual function to be executed with this event
*/
function initEventHandler($gridView, type, event, selector, callback) {
var id = $gridView.attr('id');
var prevHandler = gridEventHandlers[id];
if (prevHandler !== undefined && prevHandler[type] !== undefined) {
var data = prevHandler[type];
$(document).off(data.event, data.selector);
}
if (prevHandler === undefined) {
gridEventHandlers[id] = {};
}
$(document).on(event, selector, callback);
gridEventHandlers[id][type] = {event: event, selector: selector};
}
})(window.jQuery);
This diff is collapsed.
/**
* Yii Captcha widget.
*
* This is the JavaScript widget used by the yii\captcha\Captcha widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiCaptcha = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
return false;
}
};
var defaults = {
refreshUrl: undefined,
hashKey: undefined
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
$e.data('yiiCaptcha', {
settings: settings
});
$e.on('click.yiiCaptcha', function () {
methods.refresh.apply($e);
return false;
});
});
},
refresh: function () {
var $e = this,
settings = this.data('yiiCaptcha').settings;
$.ajax({
url: $e.data('yiiCaptcha').settings.refreshUrl,
dataType: 'json',
cache: false,
success: function (data) {
$e.attr('src', data.url);
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
}
});
},
destroy: function () {
this.off('.yiiCaptcha');
this.removeData('yiiCaptcha');
return this;
},
data: function () {
return this.data('yiiCaptcha');
}
};
})(window.jQuery);
/**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
/**
* Used for storing active event handlers and removing them later.
* The structure of single event handler is:
*
* {
* gridViewId: {
* type: {
* event: '...',
* selector: '...'
* }
* }
* }
*
* Used types:
*
* - filter, used for filtering grid with elements found by filterSelector
* - checkRow, used for checking single row
* - checkAllRows, used for checking all rows with according "Check all" checkbox
*
* event is the name of event, for example: 'change.yiiGridView'
* selector is a jQuery selector for finding elements
*
* @type {{}}
*/
var gridEventHandlers = {};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var filterEvents = 'change.yiiGridView keydown.yiiGridView';
var enterPressed = false;
initEventHandler($e, 'filter', filterEvents, settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this);
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\d*\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
var hashPos = settings.filterUrl.indexOf('#');
if (pos >= 0 && hashPos >= 0) {
url += settings.filterUrl.substring(hashPos);
}
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
var event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
initEventHandler($grid, 'checkAllRows', 'click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
initEventHandler($grid, 'checkRow', 'click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
var events = ['.yiiGridView', gridEvents.beforeFilter, gridEvents.afterFilter].join(' ');
this.off(events);
var id = $(this).attr('id');
$.each(gridEventHandlers[id], function (type, data) {
$(document).off(data.event, data.selector);
});
delete gridData[id];
return this;
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
/**
* Used for attaching event handler and prevent of duplicating them. With each call previously attached handler of
* the same type is removed even selector was changed.
* @param {jQuery} $gridView According jQuery grid view element
* @param {string} type Type of the event which acts like a key
* @param {string} event Event name, for example 'change.yiiGridView'
* @param {string} selector jQuery selector
* @param {function} callback The actual function to be executed with this event
*/
function initEventHandler($gridView, type, event, selector, callback) {
var id = $gridView.attr('id');
var prevHandler = gridEventHandlers[id];
if (prevHandler !== undefined && prevHandler[type] !== undefined) {
var data = prevHandler[type];
$(document).off(data.event, data.selector);
}
if (prevHandler === undefined) {
gridEventHandlers[id] = {};
}
$(document).on(event, selector, callback);
gridEventHandlers[id][type] = {event: event, selector: selector};
}
})(window.jQuery);
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')
\ No newline at end of file
/**
* Yii Captcha widget.
*
* This is the JavaScript widget used by the yii\captcha\Captcha widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiCaptcha = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
return false;
}
};
var defaults = {
refreshUrl: undefined,
hashKey: undefined
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
$e.data('yiiCaptcha', {
settings: settings
});
$e.on('click.yiiCaptcha', function () {
methods.refresh.apply($e);
return false;
});
});
},
refresh: function () {
var $e = this,
settings = this.data('yiiCaptcha').settings;
$.ajax({
url: $e.data('yiiCaptcha').settings.refreshUrl,
dataType: 'json',
cache: false,
success: function (data) {
$e.attr('src', data.url);
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
}
});
},
destroy: function () {
this.off('.yiiCaptcha');
this.removeData('yiiCaptcha');
return this;
},
data: function () {
return this.data('yiiCaptcha');
}
};
})(window.jQuery);
/**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
/**
* Used for storing active event handlers and removing them later.
* The structure of single event handler is:
*
* {
* gridViewId: {
* type: {
* event: '...',
* selector: '...'
* }
* }
* }
*
* Used types:
*
* - filter, used for filtering grid with elements found by filterSelector
* - checkRow, used for checking single row
* - checkAllRows, used for checking all rows with according "Check all" checkbox
*
* event is the name of event, for example: 'change.yiiGridView'
* selector is a jQuery selector for finding elements
*
* @type {{}}
*/
var gridEventHandlers = {};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var filterEvents = 'change.yiiGridView keydown.yiiGridView';
var enterPressed = false;
initEventHandler($e, 'filter', filterEvents, settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this);
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\d*\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
var hashPos = settings.filterUrl.indexOf('#');
if (pos >= 0 && hashPos >= 0) {
url += settings.filterUrl.substring(hashPos);
}
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
var event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
initEventHandler($grid, 'checkAllRows', 'click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
initEventHandler($grid, 'checkRow', 'click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
var events = ['.yiiGridView', gridEvents.beforeFilter, gridEvents.afterFilter].join(' ');
this.off(events);
var id = $(this).attr('id');
$.each(gridEventHandlers[id], function (type, data) {
$(document).off(data.event, data.selector);
});
delete gridData[id];
return this;
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
/**
* Used for attaching event handler and prevent of duplicating them. With each call previously attached handler of
* the same type is removed even selector was changed.
* @param {jQuery} $gridView According jQuery grid view element
* @param {string} type Type of the event which acts like a key
* @param {string} event Event name, for example 'change.yiiGridView'
* @param {string} selector jQuery selector
* @param {function} callback The actual function to be executed with this event
*/
function initEventHandler($gridView, type, event, selector, callback) {
var id = $gridView.attr('id');
var prevHandler = gridEventHandlers[id];
if (prevHandler !== undefined && prevHandler[type] !== undefined) {
var data = prevHandler[type];
$(document).off(data.event, data.selector);
}
if (prevHandler === undefined) {
gridEventHandlers[id] = {};
}
$(document).on(event, selector, callback);
gridEventHandlers[id][type] = {event: event, selector: selector};
}
})(window.jQuery);
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/**
* Yii Captcha widget.
*
* This is the JavaScript widget used by the yii\captcha\Captcha widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiCaptcha = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
return false;
}
};
var defaults = {
refreshUrl: undefined,
hashKey: undefined
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
$e.data('yiiCaptcha', {
settings: settings
});
$e.on('click.yiiCaptcha', function () {
methods.refresh.apply($e);
return false;
});
});
},
refresh: function () {
var $e = this,
settings = this.data('yiiCaptcha').settings;
$.ajax({
url: $e.data('yiiCaptcha').settings.refreshUrl,
dataType: 'json',
cache: false,
success: function (data) {
$e.attr('src', data.url);
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
}
});
},
destroy: function () {
this.off('.yiiCaptcha');
this.removeData('yiiCaptcha');
return this;
},
data: function () {
return this.data('yiiCaptcha');
}
};
})(window.jQuery);
/**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
/**
* Used for storing active event handlers and removing them later.
* The structure of single event handler is:
*
* {
* gridViewId: {
* type: {
* event: '...',
* selector: '...'
* }
* }
* }
*
* Used types:
*
* - filter, used for filtering grid with elements found by filterSelector
* - checkRow, used for checking single row
* - checkAllRows, used for checking all rows with according "Check all" checkbox
*
* event is the name of event, for example: 'change.yiiGridView'
* selector is a jQuery selector for finding elements
*
* @type {{}}
*/
var gridEventHandlers = {};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var filterEvents = 'change.yiiGridView keydown.yiiGridView';
var enterPressed = false;
initEventHandler($e, 'filter', filterEvents, settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this);
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\d*\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
var hashPos = settings.filterUrl.indexOf('#');
if (pos >= 0 && hashPos >= 0) {
url += settings.filterUrl.substring(hashPos);
}
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
var event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
initEventHandler($grid, 'checkAllRows', 'click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
initEventHandler($grid, 'checkRow', 'click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
var events = ['.yiiGridView', gridEvents.beforeFilter, gridEvents.afterFilter].join(' ');
this.off(events);
var id = $(this).attr('id');
$.each(gridEventHandlers[id], function (type, data) {
$(document).off(data.event, data.selector);
});
delete gridData[id];
return this;
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
/**
* Used for attaching event handler and prevent of duplicating them. With each call previously attached handler of
* the same type is removed even selector was changed.
* @param {jQuery} $gridView According jQuery grid view element
* @param {string} type Type of the event which acts like a key
* @param {string} event Event name, for example 'change.yiiGridView'
* @param {string} selector jQuery selector
* @param {function} callback The actual function to be executed with this event
*/
function initEventHandler($gridView, type, event, selector, callback) {
var id = $gridView.attr('id');
var prevHandler = gridEventHandlers[id];
if (prevHandler !== undefined && prevHandler[type] !== undefined) {
var data = prevHandler[type];
$(document).off(data.event, data.selector);
}
if (prevHandler === undefined) {
gridEventHandlers[id] = {};
}
$(document).on(event, selector, callback);
gridEventHandlers[id][type] = {event: event, selector: selector};
}
})(window.jQuery);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* Yii Captcha widget.
*
* This is the JavaScript widget used by the yii\captcha\Captcha widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiCaptcha = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
return false;
}
};
var defaults = {
refreshUrl: undefined,
hashKey: undefined
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
$e.data('yiiCaptcha', {
settings: settings
});
$e.on('click.yiiCaptcha', function () {
methods.refresh.apply($e);
return false;
});
});
},
refresh: function () {
var $e = this,
settings = this.data('yiiCaptcha').settings;
$.ajax({
url: $e.data('yiiCaptcha').settings.refreshUrl,
dataType: 'json',
cache: false,
success: function (data) {
$e.attr('src', data.url);
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
}
});
},
destroy: function () {
this.off('.yiiCaptcha');
this.removeData('yiiCaptcha');
return this;
},
data: function () {
return this.data('yiiCaptcha');
}
};
})(window.jQuery);
/**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
/**
* Used for storing active event handlers and removing them later.
* The structure of single event handler is:
*
* {
* gridViewId: {
* type: {
* event: '...',
* selector: '...'
* }
* }
* }
*
* Used types:
*
* - filter, used for filtering grid with elements found by filterSelector
* - checkRow, used for checking single row
* - checkAllRows, used for checking all rows with according "Check all" checkbox
*
* event is the name of event, for example: 'change.yiiGridView'
* selector is a jQuery selector for finding elements
*
* @type {{}}
*/
var gridEventHandlers = {};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var filterEvents = 'change.yiiGridView keydown.yiiGridView';
var enterPressed = false;
initEventHandler($e, 'filter', filterEvents, settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this);
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\d*\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
var hashPos = settings.filterUrl.indexOf('#');
if (pos >= 0 && hashPos >= 0) {
url += settings.filterUrl.substring(hashPos);
}
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
var event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
initEventHandler($grid, 'checkAllRows', 'click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
initEventHandler($grid, 'checkRow', 'click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
var events = ['.yiiGridView', gridEvents.beforeFilter, gridEvents.afterFilter].join(' ');
this.off(events);
var id = $(this).attr('id');
$.each(gridEventHandlers[id], function (type, data) {
$(document).off(data.event, data.selector);
});
delete gridData[id];
return this;
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
/**
* Used for attaching event handler and prevent of duplicating them. With each call previously attached handler of
* the same type is removed even selector was changed.
* @param {jQuery} $gridView According jQuery grid view element
* @param {string} type Type of the event which acts like a key
* @param {string} event Event name, for example 'change.yiiGridView'
* @param {string} selector jQuery selector
* @param {function} callback The actual function to be executed with this event
*/
function initEventHandler($gridView, type, event, selector, callback) {
var id = $gridView.attr('id');
var prevHandler = gridEventHandlers[id];
if (prevHandler !== undefined && prevHandler[type] !== undefined) {
var data = prevHandler[type];
$(document).off(data.event, data.selector);
}
if (prevHandler === undefined) {
gridEventHandlers[id] = {};
}
$(document).on(event, selector, callback);
gridEventHandlers[id][type] = {event: event, selector: selector};
}
})(window.jQuery);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* Yii Captcha widget.
*
* This is the JavaScript widget used by the yii\captcha\Captcha widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiCaptcha = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
return false;
}
};
var defaults = {
refreshUrl: undefined,
hashKey: undefined
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
$e.data('yiiCaptcha', {
settings: settings
});
$e.on('click.yiiCaptcha', function () {
methods.refresh.apply($e);
return false;
});
});
},
refresh: function () {
var $e = this,
settings = this.data('yiiCaptcha').settings;
$.ajax({
url: $e.data('yiiCaptcha').settings.refreshUrl,
dataType: 'json',
cache: false,
success: function (data) {
$e.attr('src', data.url);
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
}
});
},
destroy: function () {
this.off('.yiiCaptcha');
this.removeData('yiiCaptcha');
return this;
},
data: function () {
return this.data('yiiCaptcha');
}
};
})(window.jQuery);
/**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist in jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
/**
* Used for storing active event handlers and removing them later.
* The structure of single event handler is:
*
* {
* gridViewId: {
* type: {
* event: '...',
* selector: '...'
* }
* }
* }
*
* Used types:
*
* - filter, used for filtering grid with elements found by filterSelector
* - checkRow, used for checking single row
* - checkAllRows, used for checking all rows with according "Check all" checkbox
*
* event is the name of event, for example: 'change.yiiGridView'
* selector is a jQuery selector for finding elements
*
* @type {{}}
*/
var gridEventHandlers = {};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var filterEvents = 'change.yiiGridView keydown.yiiGridView';
var enterPressed = false;
initEventHandler($e, 'filter', filterEvents, settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this);
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\d*\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
var hashPos = settings.filterUrl.indexOf('#');
if (pos >= 0 && hashPos >= 0) {
url += settings.filterUrl.substring(hashPos);
}
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
var event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
initEventHandler($grid, 'checkAllRows', 'click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
initEventHandler($grid, 'checkRow', 'click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
var events = ['.yiiGridView', gridEvents.beforeFilter, gridEvents.afterFilter].join(' ');
this.off(events);
var id = $(this).attr('id');
$.each(gridEventHandlers[id], function (type, data) {
$(document).off(data.event, data.selector);
});
delete gridData[id];
return this;
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
/**
* Used for attaching event handler and prevent of duplicating them. With each call previously attached handler of
* the same type is removed even selector was changed.
* @param {jQuery} $gridView According jQuery grid view element
* @param {string} type Type of the event which acts like a key
* @param {string} event Event name, for example 'change.yiiGridView'
* @param {string} selector jQuery selector
* @param {function} callback The actual function to be executed with this event
*/
function initEventHandler($gridView, type, event, selector, callback) {
var id = $gridView.attr('id');
var prevHandler = gridEventHandlers[id];
if (prevHandler !== undefined && prevHandler[type] !== undefined) {
var data = prevHandler[type];
$(document).off(data.event, data.selector);
}
if (prevHandler === undefined) {
gridEventHandlers[id] = {};
}
$(document).on(event, selector, callback);
gridEventHandlers[id][type] = {event: event, selector: selector};
}
})(window.jQuery);
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment