diff --git a/docs/guide-ar/README.md b/docs/guide-ar/README.md new file mode 100644 index 0000000000..dd6c63ecef --- /dev/null +++ b/docs/guide-ar/README.md @@ -0,0 +1,205 @@ + Yii 2.0 الدليل التقني الخاص ببيئة العمل +=============================== + +تم تحرير هذا الملف اعتمادا على [الشروط الخاصة بتوثيف ال Yii](http://www.yiiframework.com/doc/terms/). + +جميع الحقوق محفوظة + +2014 (c) Yii Software LLC. + + +المقدمة +------------ + +* [عن بيئة العمل Yii](intro-yii.md) +* [التحديث من الإصدار 1.1](../guide/intro-upgrade-from-v1.md) + + +البداية من هنا +--------------- + +* [ماذا يجب أن تعرف عن بيئة العمل](start-prerequisites.md) +* [تنصيب ال Yii](../guide/start-installation.md) +* [تشغيل وتطبيق بيئة العمل](../guide/start-workflow.md) +* [قل مرحبا - المشروع الأول](../guide/start-hello.md) +* [العمل مع ال forms](../guide/start-forms.md) +* [العمل مع قواعد البيانات](../guide/start-databases.md) +* [إنشاء الشيفرة البرمجية من خلال ال gii](../guide/start-gii.md) +* [ماذا الآن - الخطوة القادمة](../guide/start-looking-ahead.md) + + +الهيكلية الخاصة بالتطبيق (Application Structure) +--------------------- + +* [نظرة عامة عن الهيكلية الخاصة بالتطبيق](../guide/structure-overview.md) +* [Entry Scripts](../guide/structure-entry-scripts.md) +* [التطبيقات](../guide/structure-applications.md) +* [مكونات التطبيقات](../guide/structure-application-components.md) +* [Controllers](../guide/structure-controllers.md) +* [Models](../guide/structure-models.md) +* [Views](../guide/structure-views.md) +* [Modules](../guide/structure-modules.md) +* [Filters](../guide/structure-filters.md) +* [Widgets](../guide/structure-widgets.md) +* [Assets](../guide/structure-assets.md) +* [Extensions](../guide/structure-extensions.md) + + +التعامل مع ال requests +----------------- + +* [نظرة عامة عن التعامل مع ال requests](../guide/runtime-overview.md) +* [Bootstrapping](../guide/runtime-bootstrapping.md) +* [Routing and URL Creation](../guide/runtime-routing.md) +* [Requests](../guide/runtime-requests.md) +* [Responses](../guide/runtime-responses.md) +* [Sessions and Cookies](../guide/runtime-sessions-cookies.md) +* [Handling Errors - التحكم بالأخطاء](../guide/runtime-handling-errors.md) +* [Logging - تسجيل الحركات](../guide/runtime-logging.md) + + +المفاهيم الرئيسية (Key Concepts) +------------ + +* [Components](../guide/concept-components.md) +* [Properties](../guide/concept-properties.md) +* [Events](../guide/concept-events.md) +* [Behaviors](../guide/concept-behaviors.md) +* [Configurations](../guide/concept-configurations.md) +* [Aliases](../guide/concept-aliases.md) +* [Class Autoloading](../guide/concept-autoloading.md) +* [Service Locator](../guide/concept-service-locator.md) +* [Dependency Injection Container](../guide/concept-di-container.md) + + +التعامل مع قواعد البيانات +---------------------- + +* [Database Access Objects](../guide/db-dao.md): Connecting to a database, basic queries, transactions, and schema manipulation +* [Query Builder](../guide/db-query-builder.md): Querying the database using a simple abstraction layer +* [Active Record](../guide/db-active-record.md): The Active Record ORM, retrieving and manipulating records, and defining relations +* [Migrations](../guide/db-migrations.md): Apply version control to your databases in a team development environment +* [Sphinx](https://www.yiiframework.com/extension/yiisoft/yii2-sphinx/doc/guide) +* [Redis](https://www.yiiframework.com/extension/yiisoft/yii2-redis/doc/guide) +* [MongoDB](https://www.yiiframework.com/extension/yiisoft/yii2-mongodb/doc/guide) +* [ElasticSearch](https://www.yiiframework.com/extension/yiisoft/yii2-elasticsearch/doc/guide) + + +الحصول على البيانات من خلال المستخدمين +----------------------- + +* [Creating Forms](../guide/input-forms.md) +* [Validating Input](../guide/input-validation.md) +* [Uploading Files](../guide/input-file-upload.md) +* [Collecting Tabular Input](../guide/input-tabular-input.md) +* [Getting Data for Multiple Models](../guide/input-multiple-models.md) +* [Extending ActiveForm on the Client Side](../guide/input-form-javascript.md) + + +عرض البيانات +--------------- + +* [Data Formatting](../guide/output-formatting.md) +* [Pagination](../guide/output-pagination.md) +* [Sorting](../guide/output-sorting.md) +* [Data Providers](../guide/output-data-providers.md) +* [Data Widgets](../guide/output-data-widgets.md) +* [Working with Client Scripts](../guide/output-client-scripts.md) +* [Theming](../guide/output-theming.md) + + +الامان والحماية +-------- + +* [Security Overview](../guide/security-overview.md) +* [Authentication](../guide/security-authentication.md) +* [Authorization](../guide/security-authorization.md) +* [Working with Passwords](../guide/security-passwords.md) +* [Cryptography](../guide/security-cryptography.md) +* [Auth Clients](https://www.yiiframework.com/extension/yiisoft/yii2-authclient/doc/guide) +* [Best Practices](../guide/security-best-practices.md) + + +Caching التخزين المؤقت +------- + +* [Caching Overview](../guide/caching-overview.md) +* [Data Caching](../guide/caching-data.md) +* [Fragment Caching](../guide/caching-fragment.md) +* [Page Caching](../guide/caching-page.md) +* [HTTP Caching](../guide/caching-http.md) + + +RESTful Web Services +-------------------- + +* [Quick Start](../guide/rest-quick-start.md) +* [Resources](../guide/rest-resources.md) +* [Controllers](../guide/rest-controllers.md) +* [Routing](../guide/rest-routing.md) +* [Response Formatting](../guide/rest-response-formatting.md) +* [Authentication](../guide/rest-authentication.md) +* [Rate Limiting](../guide/rest-rate-limiting.md) +* [Versioning](../guide/rest-versioning.md) +* [Error Handling](../guide/rest-error-handling.md) + + +الأدوات المساعدة أثناء تطوير التطبيقات +----------------- + +* [Debug Toolbar and Debugger](https://www.yiiframework.com/extension/yiisoft/yii2-debug/doc/guide) +* [Generating Code using Gii](https://www.yiiframework.com/extension/yiisoft/yii2-gii/doc/guide) +* [Generating API Documentation](https://www.yiiframework.com/extension/yiisoft/yii2-apidoc) + + +فحص واختبار التطبيقات +------- + +* [Testing Overview](../guide/test-overview.md) +* [Testing environment setup](../guide/test-environment-setup.md) +* [Unit Tests](../guide/test-unit.md) +* [Functional Tests](../guide/test-functional.md) +* [Acceptance Tests](../guide/test-acceptance.md) +* [Fixtures](../guide/test-fixtures.md) + + +مواضيع وعناوين مميزة +-------------- + +* [Advanced Project Template](https://www.yiiframework.com/extension/yiisoft/yii2-app-advanced/doc/guide) +* [Building Application from Scratch](../guide/tutorial-start-from-scratch.md) +* [Console Commands](../guide/tutorial-console.md) +* [Core Validators](../guide/tutorial-core-validators.md) +* [Docker](../guide/tutorial-docker.md) +* [Internationalization](../guide/tutorial-i18n.md) +* [Mailing](../guide/tutorial-mailing.md) +* [Performance Tuning](../guide/tutorial-performance-tuning.md) +* [Shared Hosting Environment](../guide/tutorial-shared-hosting.md) +* [Template Engines](../guide/tutorial-template-engines.md) +* [Working with Third-Party Code](../guide/tutorial-yii-integration.md) +* [Using Yii as a micro framework](../guide/tutorial-yii-as-micro-framework.md) + + +Widgets +------- + +* [GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html) +* [ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html) +* [DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html) +* [ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform) +* [Pjax](https://www.yiiframework.com/doc-2.0/yii-widgets-pjax.html) +* [Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html) +* [LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html) +* [LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html) +* [Bootstrap Widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide) +* [jQuery UI Widgets](https://www.yiiframework.com/extension/yiisoft/yii2-jui/doc/guide) + + +Helpers +------- + +* [Helpers Overview](../guide/helper-overview.md) +* [ArrayHelper](../guide/helper-array.md) +* [Html](../guide/helper-html.md) +* [Url](../guide/helper-url.md) + diff --git a/docs/guide-ar/intro-yii.md b/docs/guide-ar/intro-yii.md new file mode 100644 index 0000000000..7177d094b8 --- /dev/null +++ b/docs/guide-ar/intro-yii.md @@ -0,0 +1,57 @@ +#
Yii هو إطار PHP عالي الأداء يعتمد على المكونات لتطوير تطبيقات الويب الحديثة بسرعة. +إن الاسم "Yii" (يُنطق بـ "يي" أو "[جي:]" يعني "بسيطًا وتطوريًا" باللغة الصينية. ومن الممكن ايضا + اعتباره اختصارًا لـ Yes It Is!
+ + +#+Yii هو إطار عام لبرمجة الويب ، مما يعني أنه يمكن استخدامه لتطوير كافة أنواع +تطبيقات الويب باستخدام PHP. وذلك بسبب البنية القائمة على البنية التركيبة لبيئة العمل وترابطها مع المكونات والتخزين المؤقت، وهو مناسب بشكل خاص لتطوير portals, forums, content management systems (CMS), e-commerce projects, RESTful Web services. وما إلى ذلك. +
+ + +#+ إذا كنت بالفعل على دراية بإطار العمل الأخرى ، فيمكنك معرفة كيف تتم مقارنة ال Yii: + +
+ال Yii إطار عمل صمم من قبل فريق برمجي متكامل، فهو ليس مجرد عمل فردي ، بل يتكون من فريق تطوير أساسي وقوي(http://www.yiiframework.com/team/) ، بالإضافة إلى منتدى كبير +من المهنيين الذين يساهمون باستمرار في تطوير هذا الإطار. فريق المطورين الخاص بال Yii +يراقب عن كثب أحدث اتجاهات تطوير الويب وأفضل الممارسات والمميزات التي +وجدت في الأطر والمشاريع الأخرى. وتدرج بانتظام بإضافة أفضل الممارسات والميزات الى ال Yii عبر واجهات بسيطة وأنيقة. +
+ + + +#+ يتوفر لدى Yii حاليًا إصداران رئيسيان: 1.1 و 2.0. الإصدار 1.1 هو الجيل القديم وهو الآن في وضع الصيانة. الإصدار 2.0 هو إعادة كتابة وهيكلة كاملة لل Yii، تم اعتماد أحدث التقنيات والبروتوكولات فيها مثل including Composer, PSR, namespaces, traits والكثير من الأمور الأخرى، وفي هذه الإرشادات، سيكون الكلام كله موجها الى الإصدار الثاني من بيئة العمل ال Yii. +
+ +#+
+ ملاحظة: يمكن التحقق من توافق المتطلبات الخاصة بك مع ال yii من خلال الدخول الى الصفحة requirement الموجودة بال yii +
diff --git a/docs/guide-ar/start-prerequisites.md b/docs/guide-ar/start-prerequisites.md new file mode 100644 index 0000000000..bbafc6e461 --- /dev/null +++ b/docs/guide-ar/start-prerequisites.md @@ -0,0 +1,25 @@ +#+ منحنى التعلم الخاص بال Yii ليس حادًا مثل أطر PHP الأخرى، ولكن لا يزال هناك بعض الأشياء التي يجب أن تتعلمها قبل البدء بـال Yii. +
+ +##+ ال Yii هو إطار عمل PHP، لذا تأكد من قراءة وفهم المرجع الرسمي الخاص باللغة (http://php.net/manual/en/langref.php). عند البدء بتطوير المشاريع أو التطبيقات باستخدام ال Yii ، ستكتب التعليمات البرمجية بطريقة كائنية التوجه OOP، لذا تأكد من أنك على دراية بـمفاهيم ال OOP (https://secure.php.net/manual/en/language.oop5.basic.php) وكذلك ال namespaces (https://secure.php.net/manual/en/language.namespaces.php). +
+ +##
+ كمبرمج أو مطور يرغب بالعمل على ال Yii، يجب عليك أن تمتلك المعرفة الأساسية للبرمجة كائنية التوجه OOP. إذا لم تكن على دراية بها ، فيمكنك تعلم ذلك من خلال واحدة من هذه الدورات المنتشرة مثل (https://code.tutsplus.com/tutorials/object-oriented-php-for-beginners--net-12762).
+ملاحظة: كلما زاد تعقيد التطبيق أو المشروع الذي تعمل عليه، كلما احتجت الى مستوى أعلى وإحترافي أكثر من مفاهيم ال OOP لحل وإدارة التعقديات التي ستترب على مثل هذه المشاريع.
+
تستخدم ال Yii بشكل كبير de-facto standard PHP package manager، ال Composer (https://getcomposer.org/)، لذلك تأكد من قرائتك وفهمك لهذا الموضوع قبل أن تبدء. بالإضافة الى ذلك إذا لم تكن على دراية باستخدام سطر الأوامر (command line) ، فقد حان الوقت لبدء المحاولة. بمجرد تعلم الأساسيات ، لن ترغب في العمل بدون إستخدام سطر الأوامر.
+ال composer: ويترجم حرفيا الى كلمة "الملحن"، وهي عبارة عن أداة لإدارة المشاريع البرمجية والتي تسمح لك بتحديث وتنزيل المكتبات البرمجية المطلوبة للمشروع الخاص بك.
+
tags+ + If this content grows too big, use sub views + + For e.g. + + render('viewfile'); // Note: here render() method is of class \yii\base\View as this part of code is within view file and not in Widget class file ?> ``` -Sometimes, a widget may need to render a big chunk of content. While you can embed the content within the `run()` -method, a better approach is to put it in a [view](structure-views.md) and call [[yii\base\Widget::render()]] to -render it. For example, - -```php -public function run() -{ - return $this->render('hello'); -} -``` - By default, views for a widget should be stored in files in the `WidgetPath/views` directory, where `WidgetPath` stands for the directory containing the widget class file. Therefore, the above example will render the view file `@app/components/views/hello.php`, assuming the widget class is located under `@app/components`. You may override @@ -205,3 +219,4 @@ which can be utilized to solve the problem. When a widget contains view code only, it is very similar to a [view](structure-views.md). In fact, in this case, their only difference is that a widget is a redistributable class, while a view is just a plain PHP script that you would prefer to keep within your application. + diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index d5577302f2..cf4d641447 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,9 @@ Yii Framework 2 Change Log 2.0.16 under development ------------------------ +- Bug #13932: Fix number validator attributes comparison (uaoleg, s1lver) +- Bug #14039, #16636: Fixed validation for disabled inputs (s1lver, omzy83) +- Bug #16425: Check for additional values for disabled confirm dialog (Alex-Code, s1lver) - Enh #14367: In `yii\db\mysql\QueryBuilder` added support fractional seconds for time types for MySQL >= 5.6.4 (konstantin-vl) - Bug #16766: `yii\filters\ContentNegotiator` was not setting `Vary` header to inform cache recipients (koteq, cebe, samdark) - Bug #11960: Fixed `checked` option ignore in `yii\helpers\BaseHtml::checkbox()` (misantron) diff --git a/framework/assets/yii.activeForm.js b/framework/assets/yii.activeForm.js index ec0be1e84e..fbcece46f4 100644 --- a/framework/assets/yii.activeForm.js +++ b/framework/assets/yii.activeForm.js @@ -325,7 +325,7 @@ // client-side validation $.each(data.attributes, function () { this.$form = $form; - if (!$(this.input).is(":disabled")) { + if (!findInput($form, this).is(":disabled")) { this.cancelled = false; // perform validation only if the form is being submitted or if an attribute is pending validation if (data.submitting || this.status === 2 || this.status === 3) { @@ -489,7 +489,6 @@ updateInput($(this), attribute, msg); } } - }; var watchAttribute = function ($form, attribute) { @@ -625,8 +624,9 @@ if (submitting) { var errorAttributes = []; + var $input = findInput($form, this); $.each(data.attributes, function () { - if (!$(this.input).is(":disabled") && !this.cancelled && updateInput($form, this, messages)) { + if (!$input.is(":disabled") && !this.cancelled && updateInput($form, this, messages)) { errorAttributes.push(this); } }); diff --git a/framework/assets/yii.js b/framework/assets/yii.js index fd38b02dce..766877d85d 100644 --- a/framework/assets/yii.js +++ b/framework/assets/yii.js @@ -483,7 +483,7 @@ window.yii = (function ($) { return true; } - if (message !== undefined) { + if (message !== undefined && message !== false && message !== '') { $.proxy(pub.confirm, this)(message, function () { pub.handleAction($this, event); }); diff --git a/framework/assets/yii.validation.js b/framework/assets/yii.validation.js index 16a74f03ca..81cf69c222 100644 --- a/framework/assets/yii.validation.js +++ b/framework/assets/yii.validation.js @@ -282,12 +282,12 @@ yii.validation = (function ($) { if (!$target.length) { $target = $form.find('[name="' + options.compareAttributeName + '"]'); } - compareValue = $target.val(); + compareValue = $target.val(); } if (options.type === 'number') { - value = parseFloat(value); - compareValue = parseFloat(compareValue); + value = value ? parseFloat(value) : 0; + compareValue = compareValue ? parseFloat(compareValue) : 0; } switch (options.operator) { case '==': diff --git a/framework/db/QueryTrait.php b/framework/db/QueryTrait.php index e9dc68e82d..4f2789dc99 100644 --- a/framework/db/QueryTrait.php +++ b/framework/db/QueryTrait.php @@ -85,7 +85,7 @@ trait QueryTrait * * See [[QueryInterface::where()]] for detailed documentation. * - * @param array $condition the conditions that should be put in the WHERE part. + * @param string|array $condition the conditions that should be put in the WHERE part. * @return $this the query object itself * @see andWhere() * @see orWhere() diff --git a/framework/helpers/BaseArrayHelper.php b/framework/helpers/BaseArrayHelper.php index 054bda5b66..e070db5599 100644 --- a/framework/helpers/BaseArrayHelper.php +++ b/framework/helpers/BaseArrayHelper.php @@ -509,7 +509,7 @@ class BaseArrayHelper * ``` * * @param array $array - * @param string|\Closure $name + * @param int|string|\Closure $name * @param bool $keepKeys whether to maintain the array keys. If false, the resulting array * will be re-indexed with integers. * @return array the list of column values diff --git a/tests/js/data/yii.activeForm.html b/tests/js/data/yii.activeForm.html index 912c549a18..928b25371e 100644 --- a/tests/js/data/yii.activeForm.html +++ b/tests/js/data/yii.activeForm.html @@ -1,3 +1,37 @@ + + \ No newline at end of file diff --git a/tests/js/tests/yii.activeForm.test.js b/tests/js/tests/yii.activeForm.test.js index 65a564941a..23733a5366 100644 --- a/tests/js/tests/yii.activeForm.test.js +++ b/tests/js/tests/yii.activeForm.test.js @@ -78,6 +78,32 @@ describe('yii.activeForm', function () { assert.isTrue(afterValidateSpy.calledOnce); }); }); + + describe('with disabled fields', function () { + var inputTypes = { + test_radio: 'radioList', + test_checkbox: 'checkboxList', + test_text: 'text input' + }; + + for (var key in inputTypes) { + if (inputTypes.hasOwnProperty(key)) { + (function () { + var inputId = key; + it(inputTypes[key] + ' disabled field', function () { + $activeForm = $('#w1'); + $activeForm.yiiActiveForm({ + id: inputId, + input: '#' + inputId + }); + $activeForm.yiiActiveForm('validate'); + + assert.isFalse($activeForm.data('yiiActiveForm').validated); + }); + })(); + } + } + }); }); describe('resetForm method', function () { diff --git a/tests/js/tests/yii.test.js b/tests/js/tests/yii.test.js index 60d3059a50..f135edb18f 100644 --- a/tests/js/tests/yii.test.js +++ b/tests/js/tests/yii.test.js @@ -1359,6 +1359,33 @@ describe('yii', function () { }); }); + describe('disabled confirm dialog', function () { + it('confirm data param = false', function () { + var element = $('#data-methods-no-data'); + element.attr('data-confirm', false); + element.trigger($.Event('click')); + + assert.isFalse(yiiConfirmSpy.called); + assert.isTrue(yiiHandleActionStub.called); + }); + it('confirm data param = empty', function () { + var element = $('#data-methods-no-data'); + element.attr('data-confirm', ''); + element.trigger($.Event('click')); + + assert.isFalse(yiiConfirmSpy.called); + assert.isTrue(yiiHandleActionStub.called); + }); + it('confirm data param = undefined', function () { + var element = $('#data-methods-no-data'); + element.attr('data-confirm', undefined); + element.trigger($.Event('click')); + + assert.isFalse(yiiConfirmSpy.called); + assert.isTrue(yiiHandleActionStub.called); + }); + }); + describe('with clickableSelector with data-confirm', function () { it('should call confirm and handleAction methods', function () { var event = $.Event('click'); diff --git a/tests/js/tests/yii.validation.test.js b/tests/js/tests/yii.validation.test.js index ea8ffb3651..e5196d309b 100644 --- a/tests/js/tests/yii.validation.test.js +++ b/tests/js/tests/yii.validation.test.js @@ -1518,6 +1518,41 @@ describe('yii.validation', function () { {operator: '<', compareValue: '2', type: 'number'}, false ], + 'number type, ">=" operator, 2nd is lower': [ + 10, + {operator: '>=', compareValue: 2, type: 'number'}, + true + ], + 'number type, "<=" operator, 2nd is lower': [ + 10, + {operator: '<=', compareValue: 2, type: 'number'}, + false + ], + 'number type, ">" operator, 2nd is lower': [ + 10, + {operator: '>', compareValue: 2, type: 'number'}, + true + ], + 'number type, ">" operator, compare value undefined': [ + undefined, + {operator: '>', compareValue: 2, type: 'number'}, + false + ], + 'number type, "<" operator, compare value undefined': [ + undefined, + {operator: '<', compareValue: 2, type: 'number'}, + true + ], + 'number type, ">=" operator, compare value undefined': [ + undefined, + {operator: '>=', compareValue: 2, type: 'number'}, + false + ], + 'number type, "<=" operator, compare value undefined': [ + undefined, + {operator: '<=', compareValue: 2, type: 'number'}, + true + ], // default compare value 'default compare value, "===" operator, against undefined': [undefined, {operator: '==='}, true] }, function (value, options, expectValid) { diff --git a/tests/mssql/docker-compose.yml b/tests/mssql/docker-compose.yml index a68eb35982..69bc2f4d34 100644 --- a/tests/mssql/docker-compose.yml +++ b/tests/mssql/docker-compose.yml @@ -12,6 +12,8 @@ services: # Enable for debugging, Note: File-cache tests may be VERY slow or fail #volumes: # - ../../..:/project + volumes: + - ../../tests/data/config-docker.php:/project/tests/data/config.php depends_on: - mssql # Enable for debugging