1(function ($, kendo) { 2 //required binding 3 kendo.data.binders.required = kendo.data.Binder.extend({ 4 refresh: function () { 5 var value = this.bindings["required"].get(); 6 7 if (value) { 8 $(this.element).attr("required", "required"); 9 } else { 10 $(this.element).removeAttr("required"); 11 } 12 } 13 }); 14 kendo.data.binders.widget.required = kendo.data.Binder.extend({ 15 init: function (widget, bindings, options) { 16 // Call the base constructor. 17 kendo.data.Binder.fn.init.call(this, widget.element[0], bindings, options); 18 }, 19 refresh: function () { 20 var value = this.bindings["required"].get(); 21 22 if (value) { 23 $(this.element).attr("required", "required"); 24 } else { 25 $(this.element).removeAttr("required"); 26 } 27 } 28 }); 29 30 //json value binding 31 kendo.data.binders.jsonValue = kendo.data.Binder.extend({ 32 init: function (element, bindings, options) { 33 //call the base constructor 34 kendo.data.Binder.fn.init.call(this, element, bindings, options); 35 36 var that = this; 37 //listen for the change event of the element 38 $(that.element).on("change", function () { 39 that.change(); //call the change function 40 }); 41 }, 42 refresh: function () { 43 var that = this, 44 value = that.bindings["jsonValue"].get(); //get the value from the View-Model 45 $(that.element).val(JSON.stringify(value, null, 2)); //update the HTML input element 46 }, 47 change: function () { 48 var value = this.element.value; 49 var parsed; 50 try{ 51 parsed = JSON.parse(value); 52 }catch (e) { 53 abp.notify.error(e); 54 throw e; 55 } 56 this.bindings["jsonValue"].set(parsed); 57 } 58 }); 59 60 //combobox text binding 61 kendo.data.binders.widget.comboboxText = kendo.data.Binder.extend({ 62 init: function (widget, bindings, options) { 63 //call the base constructor 64 kendo.data.Binder.fn.init.call(this, widget.element[0], bindings, options); 65 66 this.widget = widget; 67 this._change = $.proxy(this.change, this); 68 //this._refresh = $.proxy(this.refresh, this); 69 this.widget.bind("change", this._change); 70 //this.widget.bind("dataBound", this._refresh); 71 }, 72 change: function () { 73 this.bindings.comboboxText.set(this.widget.text()); 74 }, 75 refresh: function () { 76 this.widget.text(this.bindings.comboboxText.get()); 77 }, 78 destroy: function () { 79 this.widget.unbind("change", this._change); 80 } 81 }); 82 83 //password rules 84 if (kendo.ui.validator) { 85 kendo.ui.validator.rules = 86 $.extend(true, kendo.ui.validator.rules, { 87 passwordmatch: function (input) { 88 if (input.is("[data-passwordmatch-msg]") && input.val() !== "") { 89 var otherPassword = $("[name='" + input.attr("data-passwordmatch-field") + "']").val(); 90 return input.val() === otherPassword; 91 } 92 return true; 93 }, 94 securepassword: function (input) { 95 if (input.is("[data-securepassword-msg]") && input.val() !== "") { 96 var password = input.val(); 97 return password.length >= 6 98 && /[A-z]/.test(password) //alfanumerik içermeli 99 && /\d/.test(password); //sayı içermeli 100 } 101 return true; 102 }, 103 104 validmask: function (input) { 105 if (input.is("[data-validmask-msg]") && input.val() !== "") { 106 var maskedtextbox = input.data("kendoMaskedTextBox");
107 return maskedtextbox.value().indexOf(maskedtextbox.options.promptChar) === -1; 108 } 109 return true; 110 } 111 }); 112 113 $(function () { 114 //multiselect select-all 115 setTimeout(function () { 116 initSelectAll($("input[type='checkbox'].multiselect-select-all")); 117 }); 118 119 //grid persistent selection select all 120 $(".k-grid .persistent-select-all").on("click", function (e) { 121 e.preventDefault(); 122 var grid = $(e.currentTarget).closest(".k-grid").data("kendoGrid"); 123 var idProp = grid.dataSource.options.schema.model.id; 124 125 var data = grid.dataSource.data(); 126 var query = new kendo.data.Query(data); 127 var filteredData = query.filter(grid.dataSource.filter()).data; 128 129 $.each(filteredData.map(function (d) { 130 return d[idProp] 131 }), 132 function (i, d) { 133 grid._selectedIds[d] = true 134 }); 135 grid.refresh(); 136 }); 137 $(".k-grid .persistent-deselect-all").on("click", function (e) { 138 e.preventDefault(); 139 var grid = $(e.currentTarget).closest(".k-grid").data("kendoGrid"); 140 grid._selectedIds = {}; 141 grid.refresh(); 142 }); 143 144 }); 145 } 146})(jQuery, kendo); 147 148function initSelectAll($elem) { 149 if ($elem.attr("data-select-all-bound")) return; 150 $elem.on("change", function (e) { 151 var widgetId = $(e.currentTarget).closest(".k-list-container").attr("id").replace("-list", ""); 152 var multiselect = $("#" + widgetId).data("kendoMultiSelect"); 153 var checkbox = $(e.currentTarget)[0]; 154 var isAutoTagMode = multiselect.element.hasClass("auto-tag-mode"); 155 if (checkbox.checked) { 156 var all = $.map(multiselect.dataSource.data(), 157 function (dataItem) { 158 return dataItem.Id || dataItem.value; 159 }); 160 161 if (isAutoTagMode) { 162 multiselect.value([]); 163 multiselect.setOptions({ 164 tagMode: "single", 165 tagTemplate: localizeNc("ItemsSelected", "#:values.length#") 166 }); 167 var $newElem = multiselect.popup.element.find(".multiselect-select-all"); 168 $newElem.prop("checked", true); 169 initSelectAll($newElem); 170 } 171 172 multiselect.value(all); 173 multiselect.trigger("change"); 174 } else { 175 multiselect.value([]); 176 177 if (isAutoTagMode) { 178 multiselect.setOptions({ 179 tagMode: "multiple", 180 tagTemplate: null 181 }); 182 initSelectAll(multiselect.popup.element.find(".multiselect-select-all")); 183 } 184 185 multiselect.trigger("change"); 186 } 187 }); 188 $elem.attr("data-select-all-bound", "true"); 189}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.