diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..cd25228 --- /dev/null +++ b/LICENSE @@ -0,0 +1,89 @@ +Creative Commons Attribution-NonCommercial 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + +Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. +Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. +Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. +Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. +Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. +Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. +Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. +Licensor means the individual(s) or entity(ies) granting rights under this Public License. +NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. +Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. +Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. +You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. +Section 2 – Scope. + +License grant. +Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: +reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and +produce, reproduce, and Share Adapted Material for NonCommercial purposes only. +Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. +Term. The term of this Public License is specified in Section 6(a). +Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. +Downstream recipients. +Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. +No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. +No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). +Other rights. + +Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. +Patent and trademark rights are not licensed under this Public License. +To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + +Attribution. + +If You Share the Licensed Material (including in modified form), You must: + +retain the following if it is supplied by the Licensor with the Licensed Material: +identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); +a copyright notice; +a notice that refers to this Public License; +a notice that refers to the disclaimer of warranties; +a URI or hyperlink to the Licensed Material to the extent reasonably practicable; +indicate if You modified the Licensed Material and retain an indication of any previous modifications; and +indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. +You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. +If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. +If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + +for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; +if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and +You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. +Section 5 – Disclaimer of Warranties and Limitation of Liability. + +Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. +To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. +The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. +Section 6 – Term and Termination. + +This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. +Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + +automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or +upon express reinstatement by the Licensor. +For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. +For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. +Sections 1, 5, 6, 7, and 8 survive termination of this Public License. +Section 7 – Other Terms and Conditions. + +The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. +Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. +Section 8 – Interpretation. + +For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. +To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. +No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. +Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. +Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 33b5353..1b18aa0 --- a/README.md +++ b/README.md @@ -7,4 +7,4 @@ News for Monstra CMS @license http://creativecommons.org/licenses/by-nc-sa/4.0/deed.ru -Creative Commons Attribution-NonCommercial 4.0 +Creative Commons Attribution-NonCommercial 4.0 \ No newline at end of file diff --git a/dev/css/bootstrap-fileupload.min.css b/dev/css/bootstrap-fileupload.min.css deleted file mode 100644 index df49673..0000000 --- a/dev/css/bootstrap-fileupload.min.css +++ /dev/null @@ -1,31 +0,0 @@ -/*! - * Bootstrap v2.3.0-j5 - * - * Copyright 2012 Twitter, Inc - * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Designed and built with all the love in the world by @mdo and @fat, extended by @ArnoldDaniels. - */ -.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0;} -.clearfix:after{clear:both;} -.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;} -.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} -.btn-file{overflow:hidden;position:relative;vertical-align:middle;}.btn-file>input{position:absolute;top:0;right:0;margin:0;opacity:0;filter:alpha(opacity=0);transform:translate(-300px, 0) scale(4);font-size:23px;direction:ltr;cursor:pointer;} -.fileupload{margin-bottom:9px;}.fileupload .uneditable-input{display:inline-block;margin-bottom:0px;vertical-align:middle;cursor:text;} -.fileupload .thumbnail{overflow:hidden;display:inline-block;margin-bottom:5px;vertical-align:middle;text-align:center;}.fileupload .thumbnail>img{display:inline-block;vertical-align:middle;max-height:100%;} -.fileupload .btn{vertical-align:middle;} -.fileupload-exists .fileupload-new,.fileupload-new .fileupload-exists{display:none;} -.fileupload-inline .fileupload-controls{display:inline;} -.fileupload-new .input-append .btn-file{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;} -.thumbnail-borderless .thumbnail{border:none;padding:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} -.fileupload-new.thumbnail-borderless .thumbnail{border:1px solid #ddd;} -.control-group.warning .fileupload .uneditable-input{color:#a47e3c;border-color:#a47e3c;} -.control-group.warning .fileupload .fileupload-preview{color:#a47e3c;} -.control-group.warning .fileupload .thumbnail{border-color:#a47e3c;} -.control-group.error .fileupload .uneditable-input{color:#b94a48;border-color:#b94a48;} -.control-group.error .fileupload .fileupload-preview{color:#b94a48;} -.control-group.error .fileupload .thumbnail{border-color:#b94a48;} -.control-group.success .fileupload .uneditable-input{color:#468847;border-color:#468847;} -.control-group.success .fileupload .fileupload-preview{color:#468847;} -.control-group.success .fileupload .thumbnail{border-color:#468847;} diff --git a/dev/css/jquery.fancybox.css b/dev/css/jquery.fancybox.css old mode 100644 new mode 100755 index fb08fe1..4f13de0 --- a/dev/css/jquery.fancybox.css +++ b/dev/css/jquery.fancybox.css @@ -1,249 +1,249 @@ -/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ -.fancybox-wrap, -.fancybox-skin, -.fancybox-outer, -.fancybox-inner, -.fancybox-image, -.fancybox-wrap iframe, -.fancybox-wrap object, -.fancybox-nav, -.fancybox-nav span, -.fancybox-tmp -{ - padding: 0; - margin: 0; - border: 0; - outline: none; - vertical-align: top; -} - -.fancybox-wrap { - position: absolute; - top: 0; - left: 0; - z-index: 8020; -} - -.fancybox-skin { - position: relative; - background: #f9f9f9; - color: #444; - text-shadow: none; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.fancybox-opened { - z-index: 8030; -} - -.fancybox-opened .fancybox-skin { - -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); - box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); -} - -.fancybox-outer, .fancybox-inner { - position: relative; -} - -.fancybox-inner { - overflow: hidden; -} - -.fancybox-type-iframe .fancybox-inner { - -webkit-overflow-scrolling: touch; -} - -.fancybox-error { - color: #444; - font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - margin: 0; - padding: 15px; - white-space: nowrap; -} - -.fancybox-image, .fancybox-iframe { - display: block; - width: 100%; - height: 100%; -} - -.fancybox-image { - max-width: 100%; - max-height: 100%; -} - -#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { - background-image: url('@site_urlplugins/news/dev/img/fancybox_sprite.png'); -} - -#fancybox-loading { - position: fixed; - top: 50%; - left: 50%; - margin-top: -22px; - margin-left: -22px; - background-position: 0 -108px; - opacity: 0.8; - cursor: pointer; - z-index: 8060; -} - -#fancybox-loading div { - width: 44px; - height: 44px; - background: url('@site_urlplugins/news/dev/img/fancybox_loading.gif') center center no-repeat; -} - -.fancybox-close { - position: absolute; - top: -18px; - right: -18px; - width: 36px; - height: 36px; - cursor: pointer; - z-index: 8040; -} - -.fancybox-nav { - position: absolute; - top: 0; - width: 40%; - height: 100%; - cursor: pointer; - text-decoration: none; - background: transparent url('@site_urlplugins/news/dev/img/blank.gif'); /* helps IE */ - -webkit-tap-highlight-color: rgba(0,0,0,0); - z-index: 8040; -} - -.fancybox-prev { - left: 0; -} - -.fancybox-next { - right: 0; -} - -.fancybox-nav span { - position: absolute; - top: 50%; - width: 36px; - height: 34px; - margin-top: -18px; - cursor: pointer; - z-index: 8040; - visibility: hidden; -} - -.fancybox-prev span { - left: 10px; - background-position: 0 -36px; -} - -.fancybox-next span { - right: 10px; - background-position: 0 -72px; -} - -.fancybox-nav:hover span { - visibility: visible; -} - -.fancybox-tmp { - position: absolute; - top: -99999px; - left: -99999px; - visibility: hidden; - max-width: 99999px; - max-height: 99999px; - overflow: visible !important; -} - -/* Overlay helper */ - -.fancybox-lock { - overflow: hidden; -} - -.fancybox-overlay { - position: absolute; - top: 0; - left: 0; - overflow: hidden; - display: none; - z-index: 8010; - background: url('@site_urlplugins/news/dev/img/fancybox_overlay.png'); -} - -.fancybox-overlay-fixed { - position: fixed; - bottom: 0; - right: 0; -} - -.fancybox-lock .fancybox-overlay { - overflow: auto; - overflow-y: scroll; -} - -/* Title helper */ - -.fancybox-title { - visibility: hidden; - font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - position: relative; - text-shadow: none; - z-index: 8050; -} - -.fancybox-opened .fancybox-title { - visibility: visible; -} - -.fancybox-title-float-wrap { - position: absolute; - bottom: 0; - right: 50%; - margin-bottom: -35px; - z-index: 8050; - text-align: center; -} - -.fancybox-title-float-wrap .child { - display: inline-block; - margin-right: -100%; - padding: 2px 20px; - background: transparent; /* Fallback for web browsers that doesn't support RGBa */ - background: rgba(0, 0, 0, 0.8); - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - text-shadow: 0 1px 2px #222; - color: #FFF; - font-weight: bold; - line-height: 24px; - white-space: nowrap; -} - -.fancybox-title-outside-wrap { - position: relative; - margin-top: 10px; - color: #fff; -} - -.fancybox-title-inside-wrap { - padding-top: 10px; -} - -.fancybox-title-over-wrap { - position: absolute; - bottom: 0; - left: 0; - color: #fff; - padding: 10px; - background: #000; - background: rgba(0, 0, 0, .8); +/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ +.fancybox-wrap, +.fancybox-skin, +.fancybox-outer, +.fancybox-inner, +.fancybox-image, +.fancybox-wrap iframe, +.fancybox-wrap object, +.fancybox-nav, +.fancybox-nav span, +.fancybox-tmp +{ + padding: 0; + margin: 0; + border: 0; + outline: none; + vertical-align: top; +} + +.fancybox-wrap { + position: absolute; + top: 0; + left: 0; + z-index: 8020; +} + +.fancybox-skin { + position: relative; + background: #f9f9f9; + color: #444; + text-shadow: none; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.fancybox-opened { + z-index: 8030; +} + +.fancybox-opened .fancybox-skin { + -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); + -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); + box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); +} + +.fancybox-outer, .fancybox-inner { + position: relative; +} + +.fancybox-inner { + overflow: hidden; +} + +.fancybox-type-iframe .fancybox-inner { + -webkit-overflow-scrolling: touch; +} + +.fancybox-error { + color: #444; + font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; + margin: 0; + padding: 15px; + white-space: nowrap; +} + +.fancybox-image, .fancybox-iframe { + display: block; + width: 100%; + height: 100%; +} + +.fancybox-image { + max-width: 100%; + max-height: 100%; +} + +#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { + background-image: url('@site_urlplugins/news/dev/img/fancybox_sprite.png'); +} + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + margin-top: -22px; + margin-left: -22px; + background-position: 0 -108px; + opacity: 0.8; + cursor: pointer; + z-index: 8060; +} + +#fancybox-loading div { + width: 44px; + height: 44px; + background: url('@site_urlplugins/news/dev/img/fancybox_loading.gif') center center no-repeat; +} + +.fancybox-close { + position: absolute; + top: -18px; + right: -18px; + width: 36px; + height: 36px; + cursor: pointer; + z-index: 8040; +} + +.fancybox-nav { + position: absolute; + top: 0; + width: 40%; + height: 100%; + cursor: pointer; + text-decoration: none; + background: transparent url('@site_urlplugins/news/dev/img/blank.gif'); /* helps IE */ + -webkit-tap-highlight-color: rgba(0,0,0,0); + z-index: 8040; +} + +.fancybox-prev { + left: 0; +} + +.fancybox-next { + right: 0; +} + +.fancybox-nav span { + position: absolute; + top: 50%; + width: 36px; + height: 34px; + margin-top: -18px; + cursor: pointer; + z-index: 8040; + visibility: hidden; +} + +.fancybox-prev span { + left: 10px; + background-position: 0 -36px; +} + +.fancybox-next span { + right: 10px; + background-position: 0 -72px; +} + +.fancybox-nav:hover span { + visibility: visible; +} + +.fancybox-tmp { + position: absolute; + top: -99999px; + left: -99999px; + visibility: hidden; + max-width: 99999px; + max-height: 99999px; + overflow: visible !important; +} + +/* Overlay helper */ + +.fancybox-lock { + overflow: hidden; +} + +.fancybox-overlay { + position: absolute; + top: 0; + left: 0; + overflow: hidden; + display: none; + z-index: 8010; + background: url('@site_urlplugins/news/dev/img/fancybox_overlay.png'); +} + +.fancybox-overlay-fixed { + position: fixed; + bottom: 0; + right: 0; +} + +.fancybox-lock .fancybox-overlay { + overflow: auto; + overflow-y: scroll; +} + +/* Title helper */ + +.fancybox-title { + visibility: hidden; + font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; + position: relative; + text-shadow: none; + z-index: 8050; +} + +.fancybox-opened .fancybox-title { + visibility: visible; +} + +.fancybox-title-float-wrap { + position: absolute; + bottom: 0; + right: 50%; + margin-bottom: -35px; + z-index: 8050; + text-align: center; +} + +.fancybox-title-float-wrap .child { + display: inline-block; + margin-right: -100%; + padding: 2px 20px; + background: transparent; /* Fallback for web browsers that doesn't support RGBa */ + background: rgba(0, 0, 0, 0.8); + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; + text-shadow: 0 1px 2px #222; + color: #FFF; + font-weight: bold; + line-height: 24px; + white-space: nowrap; +} + +.fancybox-title-outside-wrap { + position: relative; + margin-top: 10px; + color: #fff; +} + +.fancybox-title-inside-wrap { + padding-top: 10px; +} + +.fancybox-title-over-wrap { + position: absolute; + bottom: 0; + left: 0; + color: #fff; + padding: 10px; + background: #000; + background: rgba(0, 0, 0, .8); } \ No newline at end of file diff --git a/dev/img/.htaccess b/dev/img/.htaccess old mode 100644 new mode 100755 index b9f48ac..a705288 --- a/dev/img/.htaccess +++ b/dev/img/.htaccess @@ -1,2 +1,2 @@ -Options -Indexes +Options -Indexes Allow from all \ No newline at end of file diff --git a/dev/img/blank.gif b/dev/img/blank.gif old mode 100644 new mode 100755 diff --git a/dev/img/fancybox_loading.gif b/dev/img/fancybox_loading.gif old mode 100644 new mode 100755 diff --git a/dev/img/fancybox_overlay.png b/dev/img/fancybox_overlay.png old mode 100644 new mode 100755 diff --git a/dev/img/fancybox_sprite.png b/dev/img/fancybox_sprite.png old mode 100644 new mode 100755 diff --git a/dev/img/loading.gif b/dev/img/loading.gif old mode 100644 new mode 100755 diff --git a/dev/img/progressbar.gif b/dev/img/progressbar.gif old mode 100644 new mode 100755 diff --git a/dev/js/bootstrap-fileupload-setting.js b/dev/js/bootstrap-fileupload-setting.js old mode 100644 new mode 100755 index 8b3b836..f5013fd --- a/dev/js/bootstrap-fileupload-setting.js +++ b/dev/js/bootstrap-fileupload-setting.js @@ -1,9 +1,9 @@ -/** - * Created 13.07.13 22:43. - * User: KANekT - */ -$(function() { - $(".fileupload-preview > a").each(function() { - $('.fileupload').addClass('fileupload-exists').removeClass('fileupload-new'); - }); +/** + * Created 13.07.13 22:43. + * User: KANekT + */ +$(function() { + $(".fileupload-preview > a").each(function() { + $('.fileupload').addClass('fileupload-exists').removeClass('fileupload-new'); + }); }); \ No newline at end of file diff --git a/dev/js/bootstrap-fileupload.min.js b/dev/js/bootstrap-fileupload.min.js deleted file mode 100644 index 262e514..0000000 --- a/dev/js/bootstrap-fileupload.min.js +++ /dev/null @@ -1,169 +0,0 @@ -/* =========================================================== - * bootstrap-fileupload.js j2 - * http://jasny.github.com/bootstrap/javascript.html#fileupload - * =========================================================== - * Copyright 2012 Jasny BV, Netherlands. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================== */ - -!function ($) { - - "use strict"; // jshint ;_ - - /* FILEUPLOAD PUBLIC CLASS DEFINITION - * ================================= */ - - var FileupBootstrap = function (element, options) { - this.$element = $(element) - this.type = this.$element.data('uploadtype') || (this.$element.find('.thumbnail').length > 0 ? "image" : "file") - - this.$input = this.$element.find(':file') - if (this.$input.length === 0) return - - this.name = this.$input.attr('name') || options.name - - this.$hidden = this.$element.find('input[type=hidden][name="'+this.name+'"]') - if (this.$hidden.length === 0) { - this.$hidden = $('') - this.$element.prepend(this.$hidden) - } - - this.$preview = this.$element.find('.fileupload-preview') - var height = this.$preview.css('height') - if (this.$preview.css('display') != 'inline' && height != '0px' && height != 'none') this.$preview.css('line-height', height) - - this.original = { - 'exists': this.$element.hasClass('fileupload-exists'), - 'preview': this.$preview.html(), - 'hiddenVal': this.$hidden.val() - } - - this.$remove = this.$element.find('[data-dismiss="fileupload"]') - - this.$element.find('[data-trigger="fileupload"]').on('click.fileupload', $.proxy(this.trigger, this)) - - this.listen() - } - - FileupBootstrap.prototype = { - - listen: function() { - this.$input.on('change.fileupload', $.proxy(this.change, this)) - $(this.$input[0].form).on('reset.fileupload', $.proxy(this.reset, this)) - if (this.$remove) this.$remove.on('click.fileupload', $.proxy(this.clear, this)) - }, - - change: function(e, invoked) { - if (invoked === 'clear') return - - var file = e.target.files !== undefined ? e.target.files[0] : (e.target.value ? { name: e.target.value.replace(/^.+\\/, '') } : null) - - if (!file) { - this.clear() - return - } - - this.$hidden.val('') - this.$hidden.attr('name', '') - this.$input.attr('name', this.name) - - if (this.type === "image" && this.$preview.length > 0 && (typeof file.type !== "undefined" ? file.type.match('image.*') : file.name.match('\\.(gif|png|jpe?g)$')) && typeof FileReader !== "undefined") { - var reader = new FileReader() - var preview = this.$preview - var element = this.$element - - reader.onload = function(e) { - preview.html('') - element.addClass('fileupload-exists').removeClass('fileupload-new') - } - - reader.readAsDataURL(file) - } else { - this.$preview.text(file.name) - this.$element.addClass('fileupload-exists').removeClass('fileupload-new') - } - }, - - clear: function(e) { - this.$hidden.val('') - this.$hidden.attr('name', this.name) - this.$input.attr('name', '') - - //ie8+ doesn't support changing the value of input with type=file so clone instead - if (navigator.userAgent.match(/msie/i)){ - var inputClone = this.$input.clone(true); - this.$input.after(inputClone); - this.$input.remove(); - this.$input = inputClone; - }else{ - this.$input.val('') - } - - this.$preview.html('') - this.$element.addClass('fileupload-new').removeClass('fileupload-exists') - - if (e) { - this.$input.trigger('change', [ 'clear' ]) - e.preventDefault() - } - }, - - reset: function(e) { - this.clear() - - this.$hidden.val(this.original.hiddenVal) - this.$preview.html(this.original.preview) - - if (this.original.exists) this.$element.addClass('fileupload-exists').removeClass('fileupload-new') - else this.$element.addClass('fileupload-new').removeClass('fileupload-exists') - }, - - trigger: function(e) { - this.$input.trigger('click') - e.preventDefault() - } - } - - - /* FILEUPLOAD PLUGIN DEFINITION - * =========================== */ - - $.fn.fileupBootstrap = function (options) { - return this.each(function () { - var $this = $(this) - , data = $this.data('fileupload') - if (!data) $this.data('fileupload', (data = new FileupBootstrap(this, options))) - if (typeof options == 'string') data[options]() - }) - } - - $.fn.fileupBootstrap.Constructor = FileupBootstrap - - - /* FILEUPLOAD DATA-API - * ================== */ - - $(document).on('click.fileupload.data-api', '[data-provides="fileupload"]', function (e) { - var $this = $(this) - if ($this.data('fileupload')) return - $this.fileupBootstrap($this.data()) - - var $target = $(e.target).closest('[data-dismiss="fileupload"],[data-trigger="fileupload"]'); - if ($target.length > 0) { - $target.trigger('click.fileupload') - e.preventDefault() - } - }) - -}(window.jQuery); diff --git a/dev/js/jquery.fancybox-media.js b/dev/js/jquery.fancybox-media.js old mode 100644 new mode 100755 index 4b5e783..02af5b1 --- a/dev/js/jquery.fancybox-media.js +++ b/dev/js/jquery.fancybox-media.js @@ -1,196 +1,196 @@ -/*! - * Media helper for fancyBox - * version: 1.0.5 (Tue, 23 Oct 2012) - * @requires fancyBox v2.0 or later - * - * Usage: - * $(".fancybox").fancybox({ - * helpers : { - * media: true - * } - * }); - * - * Set custom URL parameters: - * $(".fancybox").fancybox({ - * helpers : { - * media: { - * youtube : { - * params : { - * autoplay : 0 - * } - * } - * } - * } - * }); - * - * Or: - * $(".fancybox").fancybox({, - * helpers : { - * media: true - * }, - * youtube : { - * autoplay: 0 - * } - * }); - * - * Supports: - * - * Youtube - * http://www.youtube.com/watch?v=opj24KnzrWo - * http://www.youtube.com/embed/opj24KnzrWo - * http://youtu.be/opj24KnzrWo - * Vimeo - * http://vimeo.com/40648169 - * http://vimeo.com/channels/staffpicks/38843628 - * http://vimeo.com/groups/surrealism/videos/36516384 - * http://player.vimeo.com/video/45074303 - * Metacafe - * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ - * http://www.metacafe.com/watch/7635964/ - * Dailymotion - * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people - * Twitvid - * http://twitvid.com/QY7MD - * Twitpic - * http://twitpic.com/7p93st - * Instagram - * http://instagr.am/p/IejkuUGxQn/ - * http://instagram.com/p/IejkuUGxQn/ - * Google maps - * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 - * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 - * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 - */ -(function ($) { - "use strict"; - - //Shortcut for fancyBox object - var F = $.fancybox, - format = function( url, rez, params ) { - params = params || ''; - - if ( $.type( params ) === "object" ) { - params = $.param(params, true); - } - - $.each(rez, function(key, value) { - url = url.replace( '$' + key, value || '' ); - }); - - if (params.length) { - url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; - } - - return url; - }; - - //Add helper object - F.helpers.media = { - defaults : { - youtube : { - matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, - params : { - autoplay : 1, - autohide : 1, - fs : 1, - rel : 0, - hd : 1, - wmode : 'opaque', - enablejsapi : 1 - }, - type : 'iframe', - url : '//www.youtube.com/embed/$3' - }, - vimeo : { - matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, - params : { - autoplay : 1, - hd : 1, - show_title : 1, - show_byline : 1, - show_portrait : 0, - fullscreen : 1 - }, - type : 'iframe', - url : '//player.vimeo.com/video/$1' - }, - metacafe : { - matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, - params : { - autoPlay : 'yes' - }, - type : 'swf', - url : function( rez, params, obj ) { - obj.swf.flashVars = 'playerVars=' + $.param( params, true ); - - return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; - } - }, - dailymotion : { - matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, - params : { - additionalInfos : 0, - autoStart : 1 - }, - type : 'swf', - url : '//www.dailymotion.com/swf/video/$1' - }, - twitvid : { - matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, - params : { - autoplay : 0 - }, - type : 'iframe', - url : '//www.twitvid.com/embed.php?guid=$1' - }, - twitpic : { - matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, - type : 'image', - url : '//twitpic.com/show/full/$1/' - }, - instagram : { - matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, - type : 'image', - url : '//$1/p/$2/media/' - }, - google_maps : { - matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, - type : 'iframe', - url : function( rez ) { - return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); - } - } - }, - - beforeLoad : function(opts, obj) { - var url = obj.href || '', - type = false, - what, - item, - rez, - params; - - for (what in opts) { - item = opts[ what ]; - rez = url.match( item.matcher ); - - if (rez) { - type = item.type; - params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); - - url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); - - break; - } - } - - if (type) { - obj.href = url; - obj.type = type; - - obj.autoHeight = false; - } - } - }; - +/*! + * Media helper for fancyBox + * version: 1.0.5 (Tue, 23 Oct 2012) + * @requires fancyBox v2.0 or later + * + * Usage: + * $(".fancybox").fancybox({ + * helpers : { + * media: true + * } + * }); + * + * Set custom URL parameters: + * $(".fancybox").fancybox({ + * helpers : { + * media: { + * youtube : { + * params : { + * autoplay : 0 + * } + * } + * } + * } + * }); + * + * Or: + * $(".fancybox").fancybox({, + * helpers : { + * media: true + * }, + * youtube : { + * autoplay: 0 + * } + * }); + * + * Supports: + * + * Youtube + * http://www.youtube.com/watch?v=opj24KnzrWo + * http://www.youtube.com/embed/opj24KnzrWo + * http://youtu.be/opj24KnzrWo + * Vimeo + * http://vimeo.com/40648169 + * http://vimeo.com/channels/staffpicks/38843628 + * http://vimeo.com/groups/surrealism/videos/36516384 + * http://player.vimeo.com/video/45074303 + * Metacafe + * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ + * http://www.metacafe.com/watch/7635964/ + * Dailymotion + * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people + * Twitvid + * http://twitvid.com/QY7MD + * Twitpic + * http://twitpic.com/7p93st + * Instagram + * http://instagr.am/p/IejkuUGxQn/ + * http://instagram.com/p/IejkuUGxQn/ + * Google maps + * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 + * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 + * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 + */ +(function ($) { + "use strict"; + + //Shortcut for fancyBox object + var F = $.fancybox, + format = function( url, rez, params ) { + params = params || ''; + + if ( $.type( params ) === "object" ) { + params = $.param(params, true); + } + + $.each(rez, function(key, value) { + url = url.replace( '$' + key, value || '' ); + }); + + if (params.length) { + url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; + } + + return url; + }; + + //Add helper object + F.helpers.media = { + defaults : { + youtube : { + matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, + params : { + autoplay : 1, + autohide : 1, + fs : 1, + rel : 0, + hd : 1, + wmode : 'opaque', + enablejsapi : 1 + }, + type : 'iframe', + url : '//www.youtube.com/embed/$3' + }, + vimeo : { + matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, + params : { + autoplay : 1, + hd : 1, + show_title : 1, + show_byline : 1, + show_portrait : 0, + fullscreen : 1 + }, + type : 'iframe', + url : '//player.vimeo.com/video/$1' + }, + metacafe : { + matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, + params : { + autoPlay : 'yes' + }, + type : 'swf', + url : function( rez, params, obj ) { + obj.swf.flashVars = 'playerVars=' + $.param( params, true ); + + return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; + } + }, + dailymotion : { + matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, + params : { + additionalInfos : 0, + autoStart : 1 + }, + type : 'swf', + url : '//www.dailymotion.com/swf/video/$1' + }, + twitvid : { + matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, + params : { + autoplay : 0 + }, + type : 'iframe', + url : '//www.twitvid.com/embed.php?guid=$1' + }, + twitpic : { + matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, + type : 'image', + url : '//twitpic.com/show/full/$1/' + }, + instagram : { + matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, + type : 'image', + url : '//$1/p/$2/media/' + }, + google_maps : { + matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, + type : 'iframe', + url : function( rez ) { + return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); + } + } + }, + + beforeLoad : function(opts, obj) { + var url = obj.href || '', + type = false, + what, + item, + rez, + params; + + for (what in opts) { + item = opts[ what ]; + rez = url.match( item.matcher ); + + if (rez) { + type = item.type; + params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); + + url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); + + break; + } + } + + if (type) { + obj.href = url; + obj.type = type; + + obj.autoHeight = false; + } + } + }; + }(jQuery)); \ No newline at end of file diff --git a/dev/js/jquery.fancybox.pack.js b/dev/js/jquery.fancybox.pack.js old mode 100644 new mode 100755 index 9f6a628..6c7d34d --- a/dev/js/jquery.fancybox.pack.js +++ b/dev/js/jquery.fancybox.pack.js @@ -1,45 +1,45 @@ -/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ -(function(C,z,f,r){var q=f(C),n=f(z),b=f.fancybox=function(){b.open.apply(this,arguments)},H=navigator.userAgent.match(/msie/),w=null,s=z.createTouch!==r,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},F=function(a){return p(a)&&0
',image:'',iframe:'",error:'

The requested content cannot be loaded.
Please try again later.

',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, -openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, -isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, -c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& -k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| -b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= -setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({}, -e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), -b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| -!1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k= -e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, -e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& -(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive= -!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady"); -if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= -this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g, -(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= -b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); -e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", -!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); -a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth, -v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x", -"hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),cA||p>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&jA||p>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
').appendTo("body"); -this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()}, -close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0, -!0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed|| -this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
'+e+"
");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"), -H&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+ -'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('
').appendTo("body"),b=a.children(), +/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ +(function(C,z,f,r){var q=f(C),n=f(z),b=f.fancybox=function(){b.open.apply(this,arguments)},H=navigator.userAgent.match(/msie/),w=null,s=z.createTouch!==r,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},F=function(a){return p(a)&&0
',image:'',iframe:'",error:'

The requested content cannot be loaded.
Please try again later.

',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, +openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, +isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, +c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& +k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| +b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= +setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({}, +e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), +b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| +!1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k= +e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, +e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& +(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive= +!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady"); +if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= +this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g, +(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= +b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); +e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", +!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); +a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth, +v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x", +"hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),cA||p>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&jA||p>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
').appendTo("body"); +this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()}, +close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0, +!0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed|| +this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
'+e+"
");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"), +H&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+ +'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('
').appendTo("body"),b=a.children(), b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===r){var a=f.support,d=f('
').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery); \ No newline at end of file diff --git a/dev/js/script.js b/dev/js/script.js old mode 100644 new mode 100755 index 8c0325e..7ee9de8 --- a/dev/js/script.js +++ b/dev/js/script.js @@ -1,7 +1,7 @@ -$(document).ready(function() { - $(".cImg").fancybox({ - helpers : { - media : {} - } - }); +$(document).ready(function() { + $(".cImg").fancybox({ + helpers : { + media : {} + } + }); }); \ No newline at end of file diff --git a/dev/js/validate.js b/dev/js/validate.js old mode 100644 new mode 100755 index c9ac5f0..0f5f143 --- a/dev/js/validate.js +++ b/dev/js/validate.js @@ -1,1247 +1,1247 @@ -/** - * jQuery Validation Plugin 1.11.0pre - * - * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ - * http://docs.jquery.com/Plugins/Validation - * - * Copyright (c) 2012 Jorn Zaefferer - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - */ - -(function($) { - -$.extend($.fn, { - // http://docs.jquery.com/Plugins/Validation/validate - validate: function( options ) { - - // if nothing is selected, return nothing; can't chain anyway - if (!this.length) { - if (options && options.debug && window.console) { - console.warn( "nothing selected, can't validate, returning nothing" ); - } - return; - } - - // check if a validator for this form was already created - var validator = $.data(this[0], 'validator'); - if ( validator ) { - return validator; - } - - // Add novalidate tag if HTML5. - this.attr('novalidate', 'novalidate'); - - validator = new $.validator( options, this[0] ); - $.data(this[0], 'validator', validator); - - if ( validator.settings.onsubmit ) { - - this.validateDelegate( ":submit", "click", function(ev) { - if ( validator.settings.submitHandler ) { - validator.submitButton = ev.target; - } - // allow suppressing validation by adding a cancel class to the submit button - if ( $(ev.target).hasClass('cancel') ) { - validator.cancelSubmit = true; - } - }); - - // validate the form on submit - this.submit( function( event ) { - if ( validator.settings.debug ) { - // prevent form submit to be able to see console output - event.preventDefault(); - } - function handle() { - var hidden; - if ( validator.settings.submitHandler ) { - if (validator.submitButton) { - // insert a hidden input as a replacement for the missing submit button - hidden = $("").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); - } - validator.settings.submitHandler.call( validator, validator.currentForm, event ); - if (validator.submitButton) { - // and clean up afterwards; thanks to no-block-scope, hidden can be referenced - hidden.remove(); - } - return false; - } - return true; - } - - // prevent submit for invalid forms or custom submit handlers - if ( validator.cancelSubmit ) { - validator.cancelSubmit = false; - return handle(); - } - if ( validator.form() ) { - if ( validator.pendingRequest ) { - validator.formSubmitted = true; - return false; - } - return handle(); - } else { - validator.focusInvalid(); - return false; - } - }); - } - - return validator; - }, - // http://docs.jquery.com/Plugins/Validation/valid - valid: function() { - if ( $(this[0]).is('form')) { - return this.validate().form(); - } else { - var valid = true; - var validator = $(this[0].form).validate(); - this.each(function() { - valid &= validator.element(this); - }); - return valid; - } - }, - // attributes: space seperated list of attributes to retrieve and remove - removeAttrs: function(attributes) { - var result = {}, - $element = this; - $.each(attributes.split(/\s/), function(index, value) { - result[value] = $element.attr(value); - $element.removeAttr(value); - }); - return result; - }, - // http://docs.jquery.com/Plugins/Validation/rules - rules: function(command, argument) { - var element = this[0]; - - if (command) { - var settings = $.data(element.form, 'validator').settings; - var staticRules = settings.rules; - var existingRules = $.validator.staticRules(element); - switch(command) { - case "add": - $.extend(existingRules, $.validator.normalizeRule(argument)); - staticRules[element.name] = existingRules; - if (argument.messages) { - settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); - } - break; - case "remove": - if (!argument) { - delete staticRules[element.name]; - return existingRules; - } - var filtered = {}; - $.each(argument.split(/\s/), function(index, method) { - filtered[method] = existingRules[method]; - delete existingRules[method]; - }); - return filtered; - } - } - - var data = $.validator.normalizeRules( - $.extend( - {}, - $.validator.classRules(element), - $.validator.attributeRules(element), - $.validator.dataRules(element), - $.validator.staticRules(element) - ), element); - - // make sure required is at front - if (data.required) { - var param = data.required; - delete data.required; - data = $.extend({required: param}, data); - } - - return data; - } -}); - -// Custom selectors -$.extend($.expr[":"], { - // http://docs.jquery.com/Plugins/Validation/blank - blank: function(a) {return !$.trim("" + a.value);}, - // http://docs.jquery.com/Plugins/Validation/filled - filled: function(a) {return !!$.trim("" + a.value);}, - // http://docs.jquery.com/Plugins/Validation/unchecked - unchecked: function(a) {return !a.checked;} -}); - -// constructor for validator -$.validator = function( options, form ) { - this.settings = $.extend( true, {}, $.validator.defaults, options ); - this.currentForm = form; - this.init(); -}; - -$.validator.format = function(source, params) { - if ( arguments.length === 1 ) { - return function() { - var args = $.makeArray(arguments); - args.unshift(source); - return $.validator.format.apply( this, args ); - }; - } - if ( arguments.length > 2 && params.constructor !== Array ) { - params = $.makeArray(arguments).slice(1); - } - if ( params.constructor !== Array ) { - params = [ params ]; - } - $.each(params, function(i, n) { - source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n); - }); - return source; -}; - -$.extend($.validator, { - - defaults: { - messages: {}, - groups: {}, - rules: {}, - errorClass: "error", - validClass: "valid", - errorElement: "label", - focusInvalid: true, - errorContainer: $( [] ), - errorLabelContainer: $( [] ), - onsubmit: true, - ignore: ":hidden", - ignoreTitle: false, - onfocusin: function(element, event) { - this.lastActive = element; - - // hide error label and remove error class on focus if enabled - if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { - if ( this.settings.unhighlight ) { - this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); - } - this.addWrapper(this.errorsFor(element)).hide(); - } - }, - onfocusout: function(element, event) { - if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { - this.element(element); - } - }, - onkeyup: function(element, event) { - if ( event.which === 9 && this.elementValue(element) === '' ) { - return; - } else if ( element.name in this.submitted || element === this.lastElement ) { - this.element(element); - } - }, - onclick: function(element, event) { - // click on selects, radiobuttons and checkboxes - if ( element.name in this.submitted ) { - this.element(element); - } - // or option elements, check parent select in that case - else if (element.parentNode.name in this.submitted) { - this.element(element.parentNode); - } - }, - highlight: function(element, errorClass, validClass) { - if (element.type === 'radio') { - this.findByName(element.name).addClass(errorClass).removeClass(validClass); - } else { - $(element).addClass(errorClass).removeClass(validClass); - } - }, - unhighlight: function(element, errorClass, validClass) { - if (element.type === 'radio') { - this.findByName(element.name).removeClass(errorClass).addClass(validClass); - } else { - $(element).removeClass(errorClass).addClass(validClass); - } - } - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults - setDefaults: function(settings) { - $.extend( $.validator.defaults, settings ); - }, - - messages: { - required: "This field is required.", - remote: "Please fix this field.", - email: "Please enter a valid email address.", - url: "Please enter a valid URL.", - date: "Please enter a valid date.", - dateISO: "Please enter a valid date (ISO).", - number: "Please enter a valid number.", - digits: "Please enter only digits.", - creditcard: "Please enter a valid credit card number.", - equalTo: "Please enter the same value again.", - maxlength: $.validator.format("Please enter no more than {0} characters."), - minlength: $.validator.format("Please enter at least {0} characters."), - rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), - range: $.validator.format("Please enter a value between {0} and {1}."), - max: $.validator.format("Please enter a value less than or equal to {0}."), - min: $.validator.format("Please enter a value greater than or equal to {0}.") - }, - - autoCreateRanges: false, - - prototype: { - - init: function() { - this.labelContainer = $(this.settings.errorLabelContainer); - this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); - this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); - this.submitted = {}; - this.valueCache = {}; - this.pendingRequest = 0; - this.pending = {}; - this.invalid = {}; - this.reset(); - - var groups = (this.groups = {}); - $.each(this.settings.groups, function(key, value) { - if (typeof value === "string") { - value = value.split(/\s/); - } - $.each(value, function(index, name) { - groups[name] = key; - }); - }); - var rules = this.settings.rules; - $.each(rules, function(key, value) { - rules[key] = $.validator.normalizeRule(value); - }); - - function delegate(event) { - var validator = $.data(this[0].form, "validator"), - eventType = "on" + event.type.replace(/^validate/, ""); - if (validator.settings[eventType]) { - validator.settings[eventType].call(validator, this[0], event); - } - } - $(this.currentForm) - .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + - "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + - "[type='email'], [type='datetime'], [type='date'], [type='month'], " + - "[type='week'], [type='time'], [type='datetime-local'], " + - "[type='range'], [type='color'] ", - "focusin focusout keyup", delegate) - .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); - - if (this.settings.invalidHandler) { - $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); - } - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/form - form: function() { - this.checkForm(); - $.extend(this.submitted, this.errorMap); - this.invalid = $.extend({}, this.errorMap); - if (!this.valid()) { - $(this.currentForm).triggerHandler("invalid-form", [this]); - } - this.showErrors(); - return this.valid(); - }, - - checkForm: function() { - this.prepareForm(); - for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { - this.check( elements[i] ); - } - return this.valid(); - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/element - element: function( element ) { - element = this.validationTargetFor( this.clean( element ) ); - this.lastElement = element; - this.prepareElement( element ); - this.currentElements = $(element); - var result = this.check( element ) !== false; - if (result) { - delete this.invalid[element.name]; - } else { - this.invalid[element.name] = true; - } - if ( !this.numberOfInvalids() ) { - // Hide error containers on last error - this.toHide = this.toHide.add( this.containers ); - } - this.showErrors(); - return result; - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/showErrors - showErrors: function(errors) { - if(errors) { - // add items to error list and map - $.extend( this.errorMap, errors ); - this.errorList = []; - for ( var name in errors ) { - this.errorList.push({ - message: errors[name], - element: this.findByName(name)[0] - }); - } - // remove items from success list - this.successList = $.grep( this.successList, function(element) { - return !(element.name in errors); - }); - } - if (this.settings.showErrors) { - this.settings.showErrors.call( this, this.errorMap, this.errorList ); - } else { - this.defaultShowErrors(); - } - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/resetForm - resetForm: function() { - if ( $.fn.resetForm ) { - $( this.currentForm ).resetForm(); - } - this.submitted = {}; - this.lastElement = null; - this.prepareForm(); - this.hideErrors(); - this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" ); - }, - - numberOfInvalids: function() { - return this.objectLength(this.invalid); - }, - - objectLength: function( obj ) { - var count = 0; - for ( var i in obj ) { - count++; - } - return count; - }, - - hideErrors: function() { - this.addWrapper( this.toHide ).hide(); - }, - - valid: function() { - return this.size() === 0; - }, - - size: function() { - return this.errorList.length; - }, - - focusInvalid: function() { - if( this.settings.focusInvalid ) { - try { - $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) - .filter(":visible") - .focus() - // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find - .trigger("focusin"); - } catch(e) { - // ignore IE throwing errors when focusing hidden elements - } - } - }, - - findLastActive: function() { - var lastActive = this.lastActive; - return lastActive && $.grep(this.errorList, function(n) { - return n.element.name === lastActive.name; - }).length === 1 && lastActive; - }, - - elements: function() { - var validator = this, - rulesCache = {}; - - // select all valid inputs inside the form (no submit or reset buttons) - return $(this.currentForm) - .find("input, select, textarea") - .not(":submit, :reset, :image, [disabled]") - .not( this.settings.ignore ) - .filter(function() { - if ( !this.name && validator.settings.debug && window.console ) { - console.error( "%o has no name assigned", this); - } - - // select only the first element for each name, and only those with rules specified - if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) { - return false; - } - - rulesCache[this.name] = true; - return true; - }); - }, - - clean: function( selector ) { - return $( selector )[0]; - }, - - errors: function() { - var errorClass = this.settings.errorClass.replace(' ', '.'); - return $( this.settings.errorElement + "." + errorClass, this.errorContext ); - }, - - reset: function() { - this.successList = []; - this.errorList = []; - this.errorMap = {}; - this.toShow = $([]); - this.toHide = $([]); - this.currentElements = $([]); - }, - - prepareForm: function() { - this.reset(); - this.toHide = this.errors().add( this.containers ); - }, - - prepareElement: function( element ) { - this.reset(); - this.toHide = this.errorsFor(element); - }, - - elementValue: function( element ) { - var type = $(element).attr('type'), - val = $(element).val(); - - if ( type === 'radio' || type === 'checkbox' ) { - return $('input[name="' + $(element).attr('name') + '"]:checked').val(); - } - - if ( typeof val === 'string' ) { - return val.replace(/\r/g, ""); - } - return val; - }, - - check: function( element ) { - element = this.validationTargetFor( this.clean( element ) ); - - var rules = $(element).rules(); - var dependencyMismatch = false; - var val = this.elementValue(element); - var result; - - for (var method in rules ) { - var rule = { method: method, parameters: rules[method] }; - try { - - result = $.validator.methods[method].call( this, val, element, rule.parameters ); - - // if a method indicates that the field is optional and therefore valid, - // don't mark it as valid when there are no other rules - if ( result === "dependency-mismatch" ) { - dependencyMismatch = true; - continue; - } - dependencyMismatch = false; - - if ( result === "pending" ) { - this.toHide = this.toHide.not( this.errorsFor(element) ); - return; - } - - if( !result ) { - this.formatAndAdd( element, rule ); - return false; - } - } catch(e) { - if ( this.settings.debug && window.console ) { - console.log("exception occured when checking element " + element.id + ", check the '" + rule.method + "' method", e); - } - throw e; - } - } - if (dependencyMismatch) { - return; - } - if ( this.objectLength(rules) ) { - this.successList.push(element); - } - return true; - }, - - // return the custom message for the given element and validation method - // specified in the element's HTML5 data attribute - customDataMessage: function(element, method) { - return $(element).data('msg-' + method.toLowerCase()) || (element.attributes && $(element).attr('data-msg-' + method.toLowerCase())); - }, - - // return the custom message for the given element name and validation method - customMessage: function( name, method ) { - var m = this.settings.messages[name]; - return m && (m.constructor === String ? m : m[method]); - }, - - // return the first defined argument, allowing empty strings - findDefined: function() { - for(var i = 0; i < arguments.length; i++) { - if (arguments[i] !== undefined) { - return arguments[i]; - } - } - return undefined; - }, - - defaultMessage: function( element, method) { - return this.findDefined( - this.customMessage( element.name, method ), - this.customDataMessage( element, method ), - // title is never undefined, so handle empty string as undefined - !this.settings.ignoreTitle && element.title || undefined, - $.validator.messages[method], - "Warning: No message defined for " + element.name + "" - ); - }, - - formatAndAdd: function( element, rule ) { - var message = this.defaultMessage( element, rule.method ), - theregex = /\$?\{(\d+)\}/g; - if ( typeof message === "function" ) { - message = message.call(this, rule.parameters, element); - } else if (theregex.test(message)) { - message = $.validator.format(message.replace(theregex, '{$1}'), rule.parameters); - } - this.errorList.push({ - message: message, - element: element - }); - - this.errorMap[element.name] = message; - this.submitted[element.name] = message; - }, - - addWrapper: function(toToggle) { - if ( this.settings.wrapper ) { - toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); - } - return toToggle; - }, - - defaultShowErrors: function() { - var i, elements; - for ( i = 0; this.errorList[i]; i++ ) { - var error = this.errorList[i]; - if ( this.settings.highlight ) { - this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); - } - this.showLabel( error.element, error.message ); - } - if( this.errorList.length ) { - this.toShow = this.toShow.add( this.containers ); - } - if (this.settings.success) { - for ( i = 0; this.successList[i]; i++ ) { - this.showLabel( this.successList[i] ); - } - } - if (this.settings.unhighlight) { - for ( i = 0, elements = this.validElements(); elements[i]; i++ ) { - this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); - } - } - this.toHide = this.toHide.not( this.toShow ); - this.hideErrors(); - this.addWrapper( this.toShow ).show(); - }, - - validElements: function() { - return this.currentElements.not(this.invalidElements()); - }, - - invalidElements: function() { - return $(this.errorList).map(function() { - return this.element; - }); - }, - - showLabel: function(element, message) { - var label = this.errorsFor( element ); - if ( label.length ) { - // refresh error/success class - label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); - - // check if we have a generated label, replace the message then - if ( label.attr("generated") ) { - label.html(message); - } - } else { - // create label - label = $("<" + this.settings.errorElement + "/>") - .attr({"for": this.idOrName(element), generated: true}) - .addClass(this.settings.errorClass) - .html(message || ""); - if ( this.settings.wrapper ) { - // make sure the element is visible, even in IE - // actually showing the wrapped element is handled elsewhere - label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); - } - if ( !this.labelContainer.append(label).length ) { - if ( this.settings.errorPlacement ) { - this.settings.errorPlacement(label, $(element) ); - } else { - label.insertAfter(element); - } - } - } - if ( !message && this.settings.success ) { - label.text(""); - if ( typeof this.settings.success === "string" ) { - label.addClass( this.settings.success ); - } else { - this.settings.success( label, element ); - } - } - this.toShow = this.toShow.add(label); - }, - - errorsFor: function(element) { - var name = this.idOrName(element); - return this.errors().filter(function() { - return $(this).attr('for') === name; - }); - }, - - idOrName: function(element) { - return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); - }, - - validationTargetFor: function(element) { - // if radio/checkbox, validate first element in group instead - if (this.checkable(element)) { - element = this.findByName( element.name ).not(this.settings.ignore)[0]; - } - return element; - }, - - checkable: function( element ) { - return (/radio|checkbox/i).test(element.type); - }, - - findByName: function( name ) { - return $(this.currentForm).find('[name="' + name + '"]'); - }, - - getLength: function(value, element) { - switch( element.nodeName.toLowerCase() ) { - case 'select': - return $("option:selected", element).length; - case 'input': - if( this.checkable( element) ) { - return this.findByName(element.name).filter(':checked').length; - } - } - return value.length; - }, - - depend: function(param, element) { - return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true; - }, - - dependTypes: { - "boolean": function(param, element) { - return param; - }, - "string": function(param, element) { - return !!$(param, element.form).length; - }, - "function": function(param, element) { - return param(element); - } - }, - - optional: function(element) { - var val = this.elementValue(element); - return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch"; - }, - - startRequest: function(element) { - if (!this.pending[element.name]) { - this.pendingRequest++; - this.pending[element.name] = true; - } - }, - - stopRequest: function(element, valid) { - this.pendingRequest--; - // sometimes synchronization fails, make sure pendingRequest is never < 0 - if (this.pendingRequest < 0) { - this.pendingRequest = 0; - } - delete this.pending[element.name]; - if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { - $(this.currentForm).submit(); - this.formSubmitted = false; - } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) { - $(this.currentForm).triggerHandler("invalid-form", [this]); - this.formSubmitted = false; - } - }, - - previousValue: function(element) { - return $.data(element, "previousValue") || $.data(element, "previousValue", { - old: null, - valid: true, - message: this.defaultMessage( element, "remote" ) - }); - } - - }, - - classRuleSettings: { - required: {required: true}, - email: {email: true}, - url: {url: true}, - date: {date: true}, - dateISO: {dateISO: true}, - number: {number: true}, - digits: {digits: true}, - creditcard: {creditcard: true} - }, - - addClassRules: function(className, rules) { - if ( className.constructor === String ) { - this.classRuleSettings[className] = rules; - } else { - $.extend(this.classRuleSettings, className); - } - }, - - classRules: function(element) { - var rules = {}; - var classes = $(element).attr('class'); - if ( classes ) { - $.each(classes.split(' '), function() { - if (this in $.validator.classRuleSettings) { - $.extend(rules, $.validator.classRuleSettings[this]); - } - }); - } - return rules; - }, - - attributeRules: function(element) { - var rules = {}; - var $element = $(element); - - for (var method in $.validator.methods) { - var value; - - // support for in both html5 and older browsers - if (method === 'required') { - value = $element.get(0).getAttribute(method); - // Some browsers return an empty string for the required attribute - // and non-HTML5 browsers might have required="" markup - if (value === "") { - value = true; - } - // force non-HTML5 browsers to return bool - value = !!value; - } else { - value = $element.attr(method); - } - - if (value) { - rules[method] = value; - } else if ($element[0].getAttribute("type") === method) { - rules[method] = true; - } - } - - // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs - if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) { - delete rules.maxlength; - } - - return rules; - }, - - dataRules: function(element) { - var method, value, - rules = {}, $element = $(element); - for (method in $.validator.methods) { - value = $element.data('rule-' + method.toLowerCase()); - if (value !== undefined) { - rules[method] = value; - } - } - return rules; - }, - - staticRules: function(element) { - var rules = {}; - var validator = $.data(element.form, 'validator'); - if (validator.settings.rules) { - rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; - } - return rules; - }, - - normalizeRules: function(rules, element) { - // handle dependency check - $.each(rules, function(prop, val) { - // ignore rule when param is explicitly false, eg. required:false - if (val === false) { - delete rules[prop]; - return; - } - if (val.param || val.depends) { - var keepRule = true; - switch (typeof val.depends) { - case "string": - keepRule = !!$(val.depends, element.form).length; - break; - case "function": - keepRule = val.depends.call(element, element); - break; - } - if (keepRule) { - rules[prop] = val.param !== undefined ? val.param : true; - } else { - delete rules[prop]; - } - } - }); - - // evaluate parameters - $.each(rules, function(rule, parameter) { - rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; - }); - - // clean number parameters - $.each(['minlength', 'maxlength', 'min', 'max'], function() { - if (rules[this]) { - rules[this] = Number(rules[this]); - } - }); - $.each(['rangelength', 'range'], function() { - var parts; - if (rules[this]) { - if ($.isArray(rules[this])) { - rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; - } else if (typeof rules[this] === 'string') { - parts = rules[this].split(/[\s,]+/); - rules[this] = [Number(parts[0]), Number(parts[1])]; - } - } - }); - - if ($.validator.autoCreateRanges) { - // auto-create ranges - if (rules.min && rules.max) { - rules.range = [rules.min, rules.max]; - delete rules.min; - delete rules.max; - } - if (rules.minlength && rules.maxlength) { - rules.rangelength = [rules.minlength, rules.maxlength]; - delete rules.minlength; - delete rules.maxlength; - } - } - - return rules; - }, - - // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} - normalizeRule: function(data) { - if( typeof data === "string" ) { - var transformed = {}; - $.each(data.split(/\s/), function() { - transformed[this] = true; - }); - data = transformed; - } - return data; - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/addMethod - addMethod: function(name, method, message) { - $.validator.methods[name] = method; - $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name]; - if (method.length < 3) { - $.validator.addClassRules(name, $.validator.normalizeRule(name)); - } - }, - - methods: { - - // http://docs.jquery.com/Plugins/Validation/Methods/required - required: function(value, element, param) { - // check if dependency is met - if ( !this.depend(param, element) ) { - return "dependency-mismatch"; - } - if ( element.nodeName.toLowerCase() === "select" ) { - // could be an array for select-multiple or a string, both are fine this way - var val = $(element).val(); - return val && val.length > 0; - } - if ( this.checkable(element) ) { - return this.getLength(value, element) > 0; - } - return $.trim(value).length > 0; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/remote - remote: function(value, element, param) { - if ( this.optional(element) ) { - return "dependency-mismatch"; - } - - var previous = this.previousValue(element); - if (!this.settings.messages[element.name] ) { - this.settings.messages[element.name] = {}; - } - previous.originalMessage = this.settings.messages[element.name].remote; - this.settings.messages[element.name].remote = previous.message; - - param = typeof param === "string" && {url:param} || param; - - if ( previous.old === value ) { - return previous.valid; - } - - previous.old = value; - var validator = this; - this.startRequest(element); - var data = {}; - data[element.name] = value; - $.ajax($.extend(true, { - url: param, - mode: "abort", - port: "validate" + element.name, - dataType: "json", - data: data, - success: function(response) { - validator.settings.messages[element.name].remote = previous.originalMessage; - var valid = response === true || response === "true"; - if ( valid ) { - var submitted = validator.formSubmitted; - validator.prepareElement(element); - validator.formSubmitted = submitted; - validator.successList.push(element); - delete validator.invalid[element.name]; - validator.showErrors(); - } else { - var errors = {}; - var message = response || validator.defaultMessage( element, "remote" ); - errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; - validator.invalid[element.name] = true; - validator.showErrors(errors); - } - previous.valid = valid; - validator.stopRequest(element, valid); - } - }, param)); - return "pending"; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/minlength - minlength: function(value, element, param) { - var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); - return this.optional(element) || length >= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/maxlength - maxlength: function(value, element, param) { - var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); - return this.optional(element) || length <= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/rangelength - rangelength: function(value, element, param) { - var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); - return this.optional(element) || ( length >= param[0] && length <= param[1] ); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/min - min: function( value, element, param ) { - return this.optional(element) || value >= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/max - max: function( value, element, param ) { - return this.optional(element) || value <= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/range - range: function( value, element, param ) { - return this.optional(element) || ( value >= param[0] && value <= param[1] ); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/email - email: function(value, element) { - // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ - return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/url - url: function(value, element) { - // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ - return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/date - date: function(value, element) { - return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString()); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/dateISO - dateISO: function(value, element) { - return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/number - number: function(value, element) { - return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/digits - digits: function(value, element) { - return this.optional(element) || /^\d+$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/creditcard - // based on http://en.wikipedia.org/wiki/Luhn - creditcard: function(value, element) { - if ( this.optional(element) ) { - return "dependency-mismatch"; - } - // accept only spaces, digits and dashes - if (/[^0-9 \-]+/.test(value)) { - return false; - } - var nCheck = 0, - nDigit = 0, - bEven = false; - - value = value.replace(/\D/g, ""); - - for (var n = value.length - 1; n >= 0; n--) { - var cDigit = value.charAt(n); - nDigit = parseInt(cDigit, 10); - if (bEven) { - if ((nDigit *= 2) > 9) { - nDigit -= 9; - } - } - nCheck += nDigit; - bEven = !bEven; - } - - return (nCheck % 10) === 0; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/equalTo - equalTo: function(value, element, param) { - // bind to the blur event of the target in order to revalidate whenever the target field is updated - // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead - var target = $(param); - if (this.settings.onfocusout) { - target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { - $(element).valid(); - }); - } - return value === target.val(); - } - - } - -}); - -// deprecated, use $.validator.format instead -$.format = $.validator.format; - -}(jQuery)); - -// ajax mode: abort -// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); -// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() -(function($) { - var pendingRequests = {}; - // Use a prefilter if available (1.5+) - if ( $.ajaxPrefilter ) { - $.ajaxPrefilter(function(settings, _, xhr) { - var port = settings.port; - if (settings.mode === "abort") { - if ( pendingRequests[port] ) { - pendingRequests[port].abort(); - } - pendingRequests[port] = xhr; - } - }); - } else { - // Proxy ajax - var ajax = $.ajax; - $.ajax = function(settings) { - var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, - port = ( "port" in settings ? settings : $.ajaxSettings ).port; - if (mode === "abort") { - if ( pendingRequests[port] ) { - pendingRequests[port].abort(); - } - return (pendingRequests[port] = ajax.apply(this, arguments)); - } - return ajax.apply(this, arguments); - }; - } -}(jQuery)); - -// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation -// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target -(function($) { - $.extend($.fn, { - validateDelegate: function(delegate, type, handler) { - return this.bind(type, function(event) { - var target = $(event.target); - if (target.is(delegate)) { - return handler.apply(target, arguments); - } - }); - } - }); -}(jQuery)); -/* - * Translated default messages for the jQuery validation plugin. - * Locale: RU (Russian; русский язык) - */ -(function ($) { - $.extend($.validator.messages, { - required: "Это поле необходимо заполнить.", - remote: "Пожалуйста, введите правильное значение.", - email: "Пожалуйста, введите корректный адрес электронной почты.", - url: "Пожалуйста, введите корректный URL.", - date: "Пожалуйста, введите корректную дату.", - dateISO: "Пожалуйста, введите корректную дату в формате ISO.", - number: "Пожалуйста, введите число.", - digits: "Пожалуйста, вводите только цифры.", - creditcard: "Пожалуйста, введите правильный номер кредитной карты.", - equalTo: "Пожалуйста, введите такое же значение ещё раз.", - accept: "Пожалуйста, выберите файл с правильным расширением.", - maxlength: $.validator.format("Пожалуйста, введите не больше {0} символов."), - minlength: $.validator.format("Пожалуйста, введите не меньше {0} символов."), - rangelength: $.validator.format("Пожалуйста, введите значение длиной от {0} до {1} символов."), - range: $.validator.format("Пожалуйста, введите число от {0} до {1}."), - max: $.validator.format("Пожалуйста, введите число, меньшее или равное {0}."), - min: $.validator.format("Пожалуйста, введите число, большее или равное {0}.") - }); -}(jQuery)); - -$(document).ready(function(){ - $.validator.setDefaults({ ignore: 'file' }); - $('.form_validate').validate(); +/** + * jQuery Validation Plugin 1.11.0pre + * + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ + * http://docs.jquery.com/Plugins/Validation + * + * Copyright (c) 2012 Jorn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +(function($) { + +$.extend($.fn, { + // http://docs.jquery.com/Plugins/Validation/validate + validate: function( options ) { + + // if nothing is selected, return nothing; can't chain anyway + if (!this.length) { + if (options && options.debug && window.console) { + console.warn( "nothing selected, can't validate, returning nothing" ); + } + return; + } + + // check if a validator for this form was already created + var validator = $.data(this[0], 'validator'); + if ( validator ) { + return validator; + } + + // Add novalidate tag if HTML5. + this.attr('novalidate', 'novalidate'); + + validator = new $.validator( options, this[0] ); + $.data(this[0], 'validator', validator); + + if ( validator.settings.onsubmit ) { + + this.validateDelegate( ":submit", "click", function(ev) { + if ( validator.settings.submitHandler ) { + validator.submitButton = ev.target; + } + // allow suppressing validation by adding a cancel class to the submit button + if ( $(ev.target).hasClass('cancel') ) { + validator.cancelSubmit = true; + } + }); + + // validate the form on submit + this.submit( function( event ) { + if ( validator.settings.debug ) { + // prevent form submit to be able to see console output + event.preventDefault(); + } + function handle() { + var hidden; + if ( validator.settings.submitHandler ) { + if (validator.submitButton) { + // insert a hidden input as a replacement for the missing submit button + hidden = $("").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); + } + validator.settings.submitHandler.call( validator, validator.currentForm, event ); + if (validator.submitButton) { + // and clean up afterwards; thanks to no-block-scope, hidden can be referenced + hidden.remove(); + } + return false; + } + return true; + } + + // prevent submit for invalid forms or custom submit handlers + if ( validator.cancelSubmit ) { + validator.cancelSubmit = false; + return handle(); + } + if ( validator.form() ) { + if ( validator.pendingRequest ) { + validator.formSubmitted = true; + return false; + } + return handle(); + } else { + validator.focusInvalid(); + return false; + } + }); + } + + return validator; + }, + // http://docs.jquery.com/Plugins/Validation/valid + valid: function() { + if ( $(this[0]).is('form')) { + return this.validate().form(); + } else { + var valid = true; + var validator = $(this[0].form).validate(); + this.each(function() { + valid &= validator.element(this); + }); + return valid; + } + }, + // attributes: space seperated list of attributes to retrieve and remove + removeAttrs: function(attributes) { + var result = {}, + $element = this; + $.each(attributes.split(/\s/), function(index, value) { + result[value] = $element.attr(value); + $element.removeAttr(value); + }); + return result; + }, + // http://docs.jquery.com/Plugins/Validation/rules + rules: function(command, argument) { + var element = this[0]; + + if (command) { + var settings = $.data(element.form, 'validator').settings; + var staticRules = settings.rules; + var existingRules = $.validator.staticRules(element); + switch(command) { + case "add": + $.extend(existingRules, $.validator.normalizeRule(argument)); + staticRules[element.name] = existingRules; + if (argument.messages) { + settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); + } + break; + case "remove": + if (!argument) { + delete staticRules[element.name]; + return existingRules; + } + var filtered = {}; + $.each(argument.split(/\s/), function(index, method) { + filtered[method] = existingRules[method]; + delete existingRules[method]; + }); + return filtered; + } + } + + var data = $.validator.normalizeRules( + $.extend( + {}, + $.validator.classRules(element), + $.validator.attributeRules(element), + $.validator.dataRules(element), + $.validator.staticRules(element) + ), element); + + // make sure required is at front + if (data.required) { + var param = data.required; + delete data.required; + data = $.extend({required: param}, data); + } + + return data; + } +}); + +// Custom selectors +$.extend($.expr[":"], { + // http://docs.jquery.com/Plugins/Validation/blank + blank: function(a) {return !$.trim("" + a.value);}, + // http://docs.jquery.com/Plugins/Validation/filled + filled: function(a) {return !!$.trim("" + a.value);}, + // http://docs.jquery.com/Plugins/Validation/unchecked + unchecked: function(a) {return !a.checked;} +}); + +// constructor for validator +$.validator = function( options, form ) { + this.settings = $.extend( true, {}, $.validator.defaults, options ); + this.currentForm = form; + this.init(); +}; + +$.validator.format = function(source, params) { + if ( arguments.length === 1 ) { + return function() { + var args = $.makeArray(arguments); + args.unshift(source); + return $.validator.format.apply( this, args ); + }; + } + if ( arguments.length > 2 && params.constructor !== Array ) { + params = $.makeArray(arguments).slice(1); + } + if ( params.constructor !== Array ) { + params = [ params ]; + } + $.each(params, function(i, n) { + source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n); + }); + return source; +}; + +$.extend($.validator, { + + defaults: { + messages: {}, + groups: {}, + rules: {}, + errorClass: "error", + validClass: "valid", + errorElement: "label", + focusInvalid: true, + errorContainer: $( [] ), + errorLabelContainer: $( [] ), + onsubmit: true, + ignore: ":hidden", + ignoreTitle: false, + onfocusin: function(element, event) { + this.lastActive = element; + + // hide error label and remove error class on focus if enabled + if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { + if ( this.settings.unhighlight ) { + this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); + } + this.addWrapper(this.errorsFor(element)).hide(); + } + }, + onfocusout: function(element, event) { + if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { + this.element(element); + } + }, + onkeyup: function(element, event) { + if ( event.which === 9 && this.elementValue(element) === '' ) { + return; + } else if ( element.name in this.submitted || element === this.lastElement ) { + this.element(element); + } + }, + onclick: function(element, event) { + // click on selects, radiobuttons and checkboxes + if ( element.name in this.submitted ) { + this.element(element); + } + // or option elements, check parent select in that case + else if (element.parentNode.name in this.submitted) { + this.element(element.parentNode); + } + }, + highlight: function(element, errorClass, validClass) { + if (element.type === 'radio') { + this.findByName(element.name).addClass(errorClass).removeClass(validClass); + } else { + $(element).addClass(errorClass).removeClass(validClass); + } + }, + unhighlight: function(element, errorClass, validClass) { + if (element.type === 'radio') { + this.findByName(element.name).removeClass(errorClass).addClass(validClass); + } else { + $(element).removeClass(errorClass).addClass(validClass); + } + } + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults + setDefaults: function(settings) { + $.extend( $.validator.defaults, settings ); + }, + + messages: { + required: "This field is required.", + remote: "Please fix this field.", + email: "Please enter a valid email address.", + url: "Please enter a valid URL.", + date: "Please enter a valid date.", + dateISO: "Please enter a valid date (ISO).", + number: "Please enter a valid number.", + digits: "Please enter only digits.", + creditcard: "Please enter a valid credit card number.", + equalTo: "Please enter the same value again.", + maxlength: $.validator.format("Please enter no more than {0} characters."), + minlength: $.validator.format("Please enter at least {0} characters."), + rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), + range: $.validator.format("Please enter a value between {0} and {1}."), + max: $.validator.format("Please enter a value less than or equal to {0}."), + min: $.validator.format("Please enter a value greater than or equal to {0}.") + }, + + autoCreateRanges: false, + + prototype: { + + init: function() { + this.labelContainer = $(this.settings.errorLabelContainer); + this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); + this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); + this.submitted = {}; + this.valueCache = {}; + this.pendingRequest = 0; + this.pending = {}; + this.invalid = {}; + this.reset(); + + var groups = (this.groups = {}); + $.each(this.settings.groups, function(key, value) { + if (typeof value === "string") { + value = value.split(/\s/); + } + $.each(value, function(index, name) { + groups[name] = key; + }); + }); + var rules = this.settings.rules; + $.each(rules, function(key, value) { + rules[key] = $.validator.normalizeRule(value); + }); + + function delegate(event) { + var validator = $.data(this[0].form, "validator"), + eventType = "on" + event.type.replace(/^validate/, ""); + if (validator.settings[eventType]) { + validator.settings[eventType].call(validator, this[0], event); + } + } + $(this.currentForm) + .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + + "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + + "[type='email'], [type='datetime'], [type='date'], [type='month'], " + + "[type='week'], [type='time'], [type='datetime-local'], " + + "[type='range'], [type='color'] ", + "focusin focusout keyup", delegate) + .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); + + if (this.settings.invalidHandler) { + $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); + } + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/form + form: function() { + this.checkForm(); + $.extend(this.submitted, this.errorMap); + this.invalid = $.extend({}, this.errorMap); + if (!this.valid()) { + $(this.currentForm).triggerHandler("invalid-form", [this]); + } + this.showErrors(); + return this.valid(); + }, + + checkForm: function() { + this.prepareForm(); + for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { + this.check( elements[i] ); + } + return this.valid(); + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/element + element: function( element ) { + element = this.validationTargetFor( this.clean( element ) ); + this.lastElement = element; + this.prepareElement( element ); + this.currentElements = $(element); + var result = this.check( element ) !== false; + if (result) { + delete this.invalid[element.name]; + } else { + this.invalid[element.name] = true; + } + if ( !this.numberOfInvalids() ) { + // Hide error containers on last error + this.toHide = this.toHide.add( this.containers ); + } + this.showErrors(); + return result; + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/showErrors + showErrors: function(errors) { + if(errors) { + // add items to error list and map + $.extend( this.errorMap, errors ); + this.errorList = []; + for ( var name in errors ) { + this.errorList.push({ + message: errors[name], + element: this.findByName(name)[0] + }); + } + // remove items from success list + this.successList = $.grep( this.successList, function(element) { + return !(element.name in errors); + }); + } + if (this.settings.showErrors) { + this.settings.showErrors.call( this, this.errorMap, this.errorList ); + } else { + this.defaultShowErrors(); + } + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/resetForm + resetForm: function() { + if ( $.fn.resetForm ) { + $( this.currentForm ).resetForm(); + } + this.submitted = {}; + this.lastElement = null; + this.prepareForm(); + this.hideErrors(); + this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" ); + }, + + numberOfInvalids: function() { + return this.objectLength(this.invalid); + }, + + objectLength: function( obj ) { + var count = 0; + for ( var i in obj ) { + count++; + } + return count; + }, + + hideErrors: function() { + this.addWrapper( this.toHide ).hide(); + }, + + valid: function() { + return this.size() === 0; + }, + + size: function() { + return this.errorList.length; + }, + + focusInvalid: function() { + if( this.settings.focusInvalid ) { + try { + $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) + .filter(":visible") + .focus() + // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find + .trigger("focusin"); + } catch(e) { + // ignore IE throwing errors when focusing hidden elements + } + } + }, + + findLastActive: function() { + var lastActive = this.lastActive; + return lastActive && $.grep(this.errorList, function(n) { + return n.element.name === lastActive.name; + }).length === 1 && lastActive; + }, + + elements: function() { + var validator = this, + rulesCache = {}; + + // select all valid inputs inside the form (no submit or reset buttons) + return $(this.currentForm) + .find("input, select, textarea") + .not(":submit, :reset, :image, [disabled]") + .not( this.settings.ignore ) + .filter(function() { + if ( !this.name && validator.settings.debug && window.console ) { + console.error( "%o has no name assigned", this); + } + + // select only the first element for each name, and only those with rules specified + if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) { + return false; + } + + rulesCache[this.name] = true; + return true; + }); + }, + + clean: function( selector ) { + return $( selector )[0]; + }, + + errors: function() { + var errorClass = this.settings.errorClass.replace(' ', '.'); + return $( this.settings.errorElement + "." + errorClass, this.errorContext ); + }, + + reset: function() { + this.successList = []; + this.errorList = []; + this.errorMap = {}; + this.toShow = $([]); + this.toHide = $([]); + this.currentElements = $([]); + }, + + prepareForm: function() { + this.reset(); + this.toHide = this.errors().add( this.containers ); + }, + + prepareElement: function( element ) { + this.reset(); + this.toHide = this.errorsFor(element); + }, + + elementValue: function( element ) { + var type = $(element).attr('type'), + val = $(element).val(); + + if ( type === 'radio' || type === 'checkbox' ) { + return $('input[name="' + $(element).attr('name') + '"]:checked').val(); + } + + if ( typeof val === 'string' ) { + return val.replace(/\r/g, ""); + } + return val; + }, + + check: function( element ) { + element = this.validationTargetFor( this.clean( element ) ); + + var rules = $(element).rules(); + var dependencyMismatch = false; + var val = this.elementValue(element); + var result; + + for (var method in rules ) { + var rule = { method: method, parameters: rules[method] }; + try { + + result = $.validator.methods[method].call( this, val, element, rule.parameters ); + + // if a method indicates that the field is optional and therefore valid, + // don't mark it as valid when there are no other rules + if ( result === "dependency-mismatch" ) { + dependencyMismatch = true; + continue; + } + dependencyMismatch = false; + + if ( result === "pending" ) { + this.toHide = this.toHide.not( this.errorsFor(element) ); + return; + } + + if( !result ) { + this.formatAndAdd( element, rule ); + return false; + } + } catch(e) { + if ( this.settings.debug && window.console ) { + console.log("exception occured when checking element " + element.id + ", check the '" + rule.method + "' method", e); + } + throw e; + } + } + if (dependencyMismatch) { + return; + } + if ( this.objectLength(rules) ) { + this.successList.push(element); + } + return true; + }, + + // return the custom message for the given element and validation method + // specified in the element's HTML5 data attribute + customDataMessage: function(element, method) { + return $(element).data('msg-' + method.toLowerCase()) || (element.attributes && $(element).attr('data-msg-' + method.toLowerCase())); + }, + + // return the custom message for the given element name and validation method + customMessage: function( name, method ) { + var m = this.settings.messages[name]; + return m && (m.constructor === String ? m : m[method]); + }, + + // return the first defined argument, allowing empty strings + findDefined: function() { + for(var i = 0; i < arguments.length; i++) { + if (arguments[i] !== undefined) { + return arguments[i]; + } + } + return undefined; + }, + + defaultMessage: function( element, method) { + return this.findDefined( + this.customMessage( element.name, method ), + this.customDataMessage( element, method ), + // title is never undefined, so handle empty string as undefined + !this.settings.ignoreTitle && element.title || undefined, + $.validator.messages[method], + "Warning: No message defined for " + element.name + "" + ); + }, + + formatAndAdd: function( element, rule ) { + var message = this.defaultMessage( element, rule.method ), + theregex = /\$?\{(\d+)\}/g; + if ( typeof message === "function" ) { + message = message.call(this, rule.parameters, element); + } else if (theregex.test(message)) { + message = $.validator.format(message.replace(theregex, '{$1}'), rule.parameters); + } + this.errorList.push({ + message: message, + element: element + }); + + this.errorMap[element.name] = message; + this.submitted[element.name] = message; + }, + + addWrapper: function(toToggle) { + if ( this.settings.wrapper ) { + toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); + } + return toToggle; + }, + + defaultShowErrors: function() { + var i, elements; + for ( i = 0; this.errorList[i]; i++ ) { + var error = this.errorList[i]; + if ( this.settings.highlight ) { + this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); + } + this.showLabel( error.element, error.message ); + } + if( this.errorList.length ) { + this.toShow = this.toShow.add( this.containers ); + } + if (this.settings.success) { + for ( i = 0; this.successList[i]; i++ ) { + this.showLabel( this.successList[i] ); + } + } + if (this.settings.unhighlight) { + for ( i = 0, elements = this.validElements(); elements[i]; i++ ) { + this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); + } + } + this.toHide = this.toHide.not( this.toShow ); + this.hideErrors(); + this.addWrapper( this.toShow ).show(); + }, + + validElements: function() { + return this.currentElements.not(this.invalidElements()); + }, + + invalidElements: function() { + return $(this.errorList).map(function() { + return this.element; + }); + }, + + showLabel: function(element, message) { + var label = this.errorsFor( element ); + if ( label.length ) { + // refresh error/success class + label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); + + // check if we have a generated label, replace the message then + if ( label.attr("generated") ) { + label.html(message); + } + } else { + // create label + label = $("<" + this.settings.errorElement + "/>") + .attr({"for": this.idOrName(element), generated: true}) + .addClass(this.settings.errorClass) + .html(message || ""); + if ( this.settings.wrapper ) { + // make sure the element is visible, even in IE + // actually showing the wrapped element is handled elsewhere + label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); + } + if ( !this.labelContainer.append(label).length ) { + if ( this.settings.errorPlacement ) { + this.settings.errorPlacement(label, $(element) ); + } else { + label.insertAfter(element); + } + } + } + if ( !message && this.settings.success ) { + label.text(""); + if ( typeof this.settings.success === "string" ) { + label.addClass( this.settings.success ); + } else { + this.settings.success( label, element ); + } + } + this.toShow = this.toShow.add(label); + }, + + errorsFor: function(element) { + var name = this.idOrName(element); + return this.errors().filter(function() { + return $(this).attr('for') === name; + }); + }, + + idOrName: function(element) { + return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); + }, + + validationTargetFor: function(element) { + // if radio/checkbox, validate first element in group instead + if (this.checkable(element)) { + element = this.findByName( element.name ).not(this.settings.ignore)[0]; + } + return element; + }, + + checkable: function( element ) { + return (/radio|checkbox/i).test(element.type); + }, + + findByName: function( name ) { + return $(this.currentForm).find('[name="' + name + '"]'); + }, + + getLength: function(value, element) { + switch( element.nodeName.toLowerCase() ) { + case 'select': + return $("option:selected", element).length; + case 'input': + if( this.checkable( element) ) { + return this.findByName(element.name).filter(':checked').length; + } + } + return value.length; + }, + + depend: function(param, element) { + return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true; + }, + + dependTypes: { + "boolean": function(param, element) { + return param; + }, + "string": function(param, element) { + return !!$(param, element.form).length; + }, + "function": function(param, element) { + return param(element); + } + }, + + optional: function(element) { + var val = this.elementValue(element); + return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch"; + }, + + startRequest: function(element) { + if (!this.pending[element.name]) { + this.pendingRequest++; + this.pending[element.name] = true; + } + }, + + stopRequest: function(element, valid) { + this.pendingRequest--; + // sometimes synchronization fails, make sure pendingRequest is never < 0 + if (this.pendingRequest < 0) { + this.pendingRequest = 0; + } + delete this.pending[element.name]; + if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { + $(this.currentForm).submit(); + this.formSubmitted = false; + } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) { + $(this.currentForm).triggerHandler("invalid-form", [this]); + this.formSubmitted = false; + } + }, + + previousValue: function(element) { + return $.data(element, "previousValue") || $.data(element, "previousValue", { + old: null, + valid: true, + message: this.defaultMessage( element, "remote" ) + }); + } + + }, + + classRuleSettings: { + required: {required: true}, + email: {email: true}, + url: {url: true}, + date: {date: true}, + dateISO: {dateISO: true}, + number: {number: true}, + digits: {digits: true}, + creditcard: {creditcard: true} + }, + + addClassRules: function(className, rules) { + if ( className.constructor === String ) { + this.classRuleSettings[className] = rules; + } else { + $.extend(this.classRuleSettings, className); + } + }, + + classRules: function(element) { + var rules = {}; + var classes = $(element).attr('class'); + if ( classes ) { + $.each(classes.split(' '), function() { + if (this in $.validator.classRuleSettings) { + $.extend(rules, $.validator.classRuleSettings[this]); + } + }); + } + return rules; + }, + + attributeRules: function(element) { + var rules = {}; + var $element = $(element); + + for (var method in $.validator.methods) { + var value; + + // support for in both html5 and older browsers + if (method === 'required') { + value = $element.get(0).getAttribute(method); + // Some browsers return an empty string for the required attribute + // and non-HTML5 browsers might have required="" markup + if (value === "") { + value = true; + } + // force non-HTML5 browsers to return bool + value = !!value; + } else { + value = $element.attr(method); + } + + if (value) { + rules[method] = value; + } else if ($element[0].getAttribute("type") === method) { + rules[method] = true; + } + } + + // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs + if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) { + delete rules.maxlength; + } + + return rules; + }, + + dataRules: function(element) { + var method, value, + rules = {}, $element = $(element); + for (method in $.validator.methods) { + value = $element.data('rule-' + method.toLowerCase()); + if (value !== undefined) { + rules[method] = value; + } + } + return rules; + }, + + staticRules: function(element) { + var rules = {}; + var validator = $.data(element.form, 'validator'); + if (validator.settings.rules) { + rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; + } + return rules; + }, + + normalizeRules: function(rules, element) { + // handle dependency check + $.each(rules, function(prop, val) { + // ignore rule when param is explicitly false, eg. required:false + if (val === false) { + delete rules[prop]; + return; + } + if (val.param || val.depends) { + var keepRule = true; + switch (typeof val.depends) { + case "string": + keepRule = !!$(val.depends, element.form).length; + break; + case "function": + keepRule = val.depends.call(element, element); + break; + } + if (keepRule) { + rules[prop] = val.param !== undefined ? val.param : true; + } else { + delete rules[prop]; + } + } + }); + + // evaluate parameters + $.each(rules, function(rule, parameter) { + rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; + }); + + // clean number parameters + $.each(['minlength', 'maxlength', 'min', 'max'], function() { + if (rules[this]) { + rules[this] = Number(rules[this]); + } + }); + $.each(['rangelength', 'range'], function() { + var parts; + if (rules[this]) { + if ($.isArray(rules[this])) { + rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; + } else if (typeof rules[this] === 'string') { + parts = rules[this].split(/[\s,]+/); + rules[this] = [Number(parts[0]), Number(parts[1])]; + } + } + }); + + if ($.validator.autoCreateRanges) { + // auto-create ranges + if (rules.min && rules.max) { + rules.range = [rules.min, rules.max]; + delete rules.min; + delete rules.max; + } + if (rules.minlength && rules.maxlength) { + rules.rangelength = [rules.minlength, rules.maxlength]; + delete rules.minlength; + delete rules.maxlength; + } + } + + return rules; + }, + + // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} + normalizeRule: function(data) { + if( typeof data === "string" ) { + var transformed = {}; + $.each(data.split(/\s/), function() { + transformed[this] = true; + }); + data = transformed; + } + return data; + }, + + // http://docs.jquery.com/Plugins/Validation/Validator/addMethod + addMethod: function(name, method, message) { + $.validator.methods[name] = method; + $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name]; + if (method.length < 3) { + $.validator.addClassRules(name, $.validator.normalizeRule(name)); + } + }, + + methods: { + + // http://docs.jquery.com/Plugins/Validation/Methods/required + required: function(value, element, param) { + // check if dependency is met + if ( !this.depend(param, element) ) { + return "dependency-mismatch"; + } + if ( element.nodeName.toLowerCase() === "select" ) { + // could be an array for select-multiple or a string, both are fine this way + var val = $(element).val(); + return val && val.length > 0; + } + if ( this.checkable(element) ) { + return this.getLength(value, element) > 0; + } + return $.trim(value).length > 0; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/remote + remote: function(value, element, param) { + if ( this.optional(element) ) { + return "dependency-mismatch"; + } + + var previous = this.previousValue(element); + if (!this.settings.messages[element.name] ) { + this.settings.messages[element.name] = {}; + } + previous.originalMessage = this.settings.messages[element.name].remote; + this.settings.messages[element.name].remote = previous.message; + + param = typeof param === "string" && {url:param} || param; + + if ( previous.old === value ) { + return previous.valid; + } + + previous.old = value; + var validator = this; + this.startRequest(element); + var data = {}; + data[element.name] = value; + $.ajax($.extend(true, { + url: param, + mode: "abort", + port: "validate" + element.name, + dataType: "json", + data: data, + success: function(response) { + validator.settings.messages[element.name].remote = previous.originalMessage; + var valid = response === true || response === "true"; + if ( valid ) { + var submitted = validator.formSubmitted; + validator.prepareElement(element); + validator.formSubmitted = submitted; + validator.successList.push(element); + delete validator.invalid[element.name]; + validator.showErrors(); + } else { + var errors = {}; + var message = response || validator.defaultMessage( element, "remote" ); + errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; + validator.invalid[element.name] = true; + validator.showErrors(errors); + } + previous.valid = valid; + validator.stopRequest(element, valid); + } + }, param)); + return "pending"; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/minlength + minlength: function(value, element, param) { + var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); + return this.optional(element) || length >= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/maxlength + maxlength: function(value, element, param) { + var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); + return this.optional(element) || length <= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/rangelength + rangelength: function(value, element, param) { + var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); + return this.optional(element) || ( length >= param[0] && length <= param[1] ); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/min + min: function( value, element, param ) { + return this.optional(element) || value >= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/max + max: function( value, element, param ) { + return this.optional(element) || value <= param; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/range + range: function( value, element, param ) { + return this.optional(element) || ( value >= param[0] && value <= param[1] ); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/email + email: function(value, element) { + // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ + return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/url + url: function(value, element) { + // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ + return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/date + date: function(value, element) { + return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString()); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/dateISO + dateISO: function(value, element) { + return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/number + number: function(value, element) { + return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/digits + digits: function(value, element) { + return this.optional(element) || /^\d+$/.test(value); + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/creditcard + // based on http://en.wikipedia.org/wiki/Luhn + creditcard: function(value, element) { + if ( this.optional(element) ) { + return "dependency-mismatch"; + } + // accept only spaces, digits and dashes + if (/[^0-9 \-]+/.test(value)) { + return false; + } + var nCheck = 0, + nDigit = 0, + bEven = false; + + value = value.replace(/\D/g, ""); + + for (var n = value.length - 1; n >= 0; n--) { + var cDigit = value.charAt(n); + nDigit = parseInt(cDigit, 10); + if (bEven) { + if ((nDigit *= 2) > 9) { + nDigit -= 9; + } + } + nCheck += nDigit; + bEven = !bEven; + } + + return (nCheck % 10) === 0; + }, + + // http://docs.jquery.com/Plugins/Validation/Methods/equalTo + equalTo: function(value, element, param) { + // bind to the blur event of the target in order to revalidate whenever the target field is updated + // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead + var target = $(param); + if (this.settings.onfocusout) { + target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { + $(element).valid(); + }); + } + return value === target.val(); + } + + } + +}); + +// deprecated, use $.validator.format instead +$.format = $.validator.format; + +}(jQuery)); + +// ajax mode: abort +// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); +// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() +(function($) { + var pendingRequests = {}; + // Use a prefilter if available (1.5+) + if ( $.ajaxPrefilter ) { + $.ajaxPrefilter(function(settings, _, xhr) { + var port = settings.port; + if (settings.mode === "abort") { + if ( pendingRequests[port] ) { + pendingRequests[port].abort(); + } + pendingRequests[port] = xhr; + } + }); + } else { + // Proxy ajax + var ajax = $.ajax; + $.ajax = function(settings) { + var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, + port = ( "port" in settings ? settings : $.ajaxSettings ).port; + if (mode === "abort") { + if ( pendingRequests[port] ) { + pendingRequests[port].abort(); + } + return (pendingRequests[port] = ajax.apply(this, arguments)); + } + return ajax.apply(this, arguments); + }; + } +}(jQuery)); + +// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation +// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target +(function($) { + $.extend($.fn, { + validateDelegate: function(delegate, type, handler) { + return this.bind(type, function(event) { + var target = $(event.target); + if (target.is(delegate)) { + return handler.apply(target, arguments); + } + }); + } + }); +}(jQuery)); +/* + * Translated default messages for the jQuery validation plugin. + * Locale: RU (Russian; русский язык) + */ +(function ($) { + $.extend($.validator.messages, { + required: "Это поле необходимо заполнить.", + remote: "Пожалуйста, введите правильное значение.", + email: "Пожалуйста, введите корректный адрес электронной почты.", + url: "Пожалуйста, введите корректный URL.", + date: "Пожалуйста, введите корректную дату.", + dateISO: "Пожалуйста, введите корректную дату в формате ISO.", + number: "Пожалуйста, введите число.", + digits: "Пожалуйста, вводите только цифры.", + creditcard: "Пожалуйста, введите правильный номер кредитной карты.", + equalTo: "Пожалуйста, введите такое же значение ещё раз.", + accept: "Пожалуйста, выберите файл с правильным расширением.", + maxlength: $.validator.format("Пожалуйста, введите не больше {0} символов."), + minlength: $.validator.format("Пожалуйста, введите не меньше {0} символов."), + rangelength: $.validator.format("Пожалуйста, введите значение длиной от {0} до {1} символов."), + range: $.validator.format("Пожалуйста, введите число от {0} до {1}."), + max: $.validator.format("Пожалуйста, введите число, меньшее или равное {0}."), + min: $.validator.format("Пожалуйста, введите число, большее или равное {0}.") + }); +}(jQuery)); + +$(document).ready(function(){ + $.validator.setDefaults({ ignore: 'file' }); + $('.form_validate').validate(); }); \ No newline at end of file diff --git a/img/ajax-loader.gif b/img/ajax-loader.gif old mode 100644 new mode 100755 diff --git a/img/noimage.jpg b/img/noimage.jpg old mode 100644 new mode 100755 diff --git a/install/news.install.php b/install/news.install.php old mode 100644 new mode 100755 index d6782fa..4b8cb33 --- a/install/news.install.php +++ b/install/news.install.php @@ -1,26 +1,26 @@ - - - plugins/news/news.plugin.php - active - 15 - News - News plugin for Monstra - 2.0.5 - KANekT - http://kanekt.ru + + + plugins/news/news.plugin.php + active + 15 + News + News plugin for Monstra + 2.1.0 + KANekT + http://kanekt.ru \ No newline at end of file diff --git a/install/news.uninstall.php b/install/news.uninstall.php old mode 100644 new mode 100755 index 99ff99d..c964684 --- a/install/news.uninstall.php +++ b/install/news.uninstall.php @@ -1,25 +1,25 @@ - 0) { - $.ajax({ - url: 'index.php?id=news&delete=item&t=' + $.now(), - type: "POST", - data: {csrf: csrf, items: items}, - success: function (text) { - window.location = 'index.php?id=news'; - }, - error: function (jqXhr, textStatus, errorThrown) { - alert("Error '" + jqXhr.status + "' (textStatus: '" + textStatus + "', errorThrown: '" + errorThrown + "')"); - } - }); - } - } - return false; - }); - - $("input[data-action=checked]").click(function() { - if($(this).prop('checked')){ - $('input[name="key"]').prop('checked',true); - } else { - $('input[name="key"]').prop('checked',false); - } - }); - - $('input[name="key"]').click(function() { - var rel = $(this).parents("tr").find("td:eq(0) a").attr('rel'); - if (rel != undefined) - { - if ($(this).prop('checked')) { - $('tr[rel="children_'+rel+'"] input[name="key"]').prop('checked',true); - } else { - $('tr[rel="children_'+rel+'"] input[name="key"]').prop('checked',false); - } - } - }); - +/** + * Created 13.07.13 18:57. + * User: KANekT + */ +$(function() { + $("span[data-action=aai]").click(function() { + $.get('index.php?id=news&image=true&csrf=' + $("#csrf").val(), function(data) { + $(data).appendTo('.img-upload'); + }); + }); + + $("a[data-action=delImg]").click(function() { + var key = $(this).attr("data-key"); + var dir = $(this).attr("data-dir"); + var csrf = $("#csrf").val(); + $.post('index.php?id=news&delete=image', {id: key, dir: dir, csrf: csrf}, function(data) { + }); + }); + + $("a[data-action=deleteNews]").click(function() { + var text = $(this).attr('data-confirm'); + if (confirm(text)) + { + var csrf = $('#csrf').val(); + var items = new Array(); + $('input[name="key"]:checked').each(function() {items.push($(this).val());}); + + if (items.length > 0) { + $.ajax({ + url: 'index.php?id=news&delete=item&t=' + $.now(), + type: "POST", + data: {csrf: csrf, items: items}, + success: function (text) { + window.location = 'index.php?id=news'; + }, + error: function (jqXhr, textStatus, errorThrown) { + alert("Error '" + jqXhr.status + "' (textStatus: '" + textStatus + "', errorThrown: '" + errorThrown + "')"); + } + }); + } + } + return false; + }); + + $('input[data-action=checked]').on('ifChanged', function(){ + if($(this).prop('checked')){ + $('input[name="key"]').iCheck('check'); + } else { + $('input[name="key"]').iCheck('uncheck'); + } + }); + + $('input[name="key"]').click(function() { + var rel = $(this).parents("tr").find("td:eq(0) a").attr('rel'); + if (rel != undefined) + { + if ($(this).prop('checked')) { + $('tr[rel="children_'+rel+'"] input[name="key"]').prop('checked',true); + } else { + $('tr[rel="children_'+rel+'"] input[name="key"]').prop('checked',false); + } + } + }); + }); \ No newline at end of file diff --git a/languages/en.lang.php b/languages/en.lang.php old mode 100644 new mode 100755 index 99d8813..05d686f --- a/languages/en.lang.php +++ b/languages/en.lang.php @@ -1,106 +1,106 @@ - array( - //Index - 'News' => 'News', - 'News plugin for Monstra' => 'News plugin for Monstra', - - //Admin - 'News template' => 'News template', - 'Published' => 'Published', - 'Draft' => 'Draft', - 'Registered' => 'Registered', - 'Public' => 'Public', - 'Your changes have been saved' => 'Your changes have been saved', - 'Slug is exits' => 'Slug is exits', - - //View - 'Save' => 'Save', - 'Edit' => 'Edit', - 'Clone' => 'Clone', - 'Delete' => 'Delete', - 'Save and exit' => 'Save and exit', - 'Cancel' => 'Cancel', - - 'New news' => 'New news', - 'Edit news' => 'Edit news', - - //Add - 'Item' => 'News', - 'Metadata' => 'Metadata', - 'Settings' => 'Settings', - 'Image' => 'Image', - 'Return to Index' => 'Return to Index', - 'Name' => 'Name', - 'Name (slug)' => 'Name (slug)', - 'Keywords' => 'Keywords', - 'Title' => 'Title', - 'Tags' => 'Tags', - 'Description' => 'Description', - 'Search Engines Robots' => 'Search Engines Robots', - 'Parent' => 'Parent News', - 'Template' => 'Template', - 'Status' => 'Status', - 'Access' => 'Access', - 'Select image' => 'Select image', - 'Change' => 'Change', - 'Remove' => 'Remove', - 'Add another image' => 'Add another image', - 'News Short' => 'News Short', - 'Author' => 'Author', - - //Index - 'Create' => 'Create', - 'Create news' => 'Create news', - 'Create new news' => 'Create new news', - 'Example Code' => 'Example Code', - 'Actions' => 'Actions', - 'Date' => 'Date', - 'Delete all checked' => 'Delete all checked', - - 'Are you sure you want to delete all the news' => 'Confirm delete!', - 'Delete news: :news' => 'Delete news: :news', - 'Your news :news have been added.' => 'Your news :news have been added.', - 'Your changes to the news :news have been saved.' => 'Your changes to the news :news have been saved.', - 'News :news deleted' => 'News :news deleted', - - //Settings - 'Settings news' => 'Settings news', - 'Respect to the width' => 'Respect to the width', - 'Respect to the height' => 'Respect to the height', - 'Similarly, cutting unnecessary' => 'Similarly, cutting unnecessary', - 'Similarly with the expansion' => 'Similarly with the expansion', - 'News per page (website)' => 'News per page (website)', - 'Width thumbnails (px)' => 'Width thumbnails (px)', - 'Height thumbnails (px)' => 'Height thumbnails (px)', - 'Resize' => 'Resize', - 'News per page (admin)' => 'News per page (admin)', - 'Original width (px, max)' => 'Original width (px, max)', - 'Original height (px, max)' => 'Original height (px, max)', - - //Modal - 'Code Last News' => 'Last News', - 'Code Top View' => 'Top News View', - 'Code Block' => 'Block News', - 'Code Content By Id' => 'News Content By Id', - 'Code Children' => 'News Children', - 'Code Tags' => 'News Tags', - 'Code Related' => 'News Related', - - //Sort - 'Sorting' => 'Sorting', - 'by date' => 'date', - 'by number' => 'number', - 'by views' => 'views', - 'by status' => 'status', - 'ASC' => 'ASC', - 'DESC' => 'DESC', - - //Front End - 'Read more' => 'Read more', - 'Children news' => 'Children news', - 'Hits count' => 'Hits count ', - 'Related' => 'Related news', - ) + array( + //Index + 'News' => 'News', + 'News plugin for Monstra' => 'News plugin for Monstra', + + //Admin + 'News template' => 'News template', + 'Published' => 'Published', + 'Draft' => 'Draft', + 'Registered' => 'Registered', + 'Public' => 'Public', + 'Your changes have been saved' => 'Your changes have been saved', + 'Slug is exits' => 'Slug is exits', + + //View + 'Save' => 'Save', + 'Edit' => 'Edit', + 'Clone' => 'Clone', + 'Delete' => 'Delete', + 'Save and exit' => 'Save and exit', + 'Cancel' => 'Cancel', + + 'New news' => 'New news', + 'Edit news' => 'Edit news', + + //Add + 'Item' => 'News', + 'Metadata' => 'Metadata', + 'Settings' => 'Settings', + 'Image' => 'Image', + 'Return to Index' => 'Return to Index', + 'Name' => 'Name', + 'Name (slug)' => 'Name (slug)', + 'Keywords' => 'Keywords', + 'Title' => 'Title', + 'Tags' => 'Tags', + 'Description' => 'Description', + 'Search Engines Robots' => 'Search Engines Robots', + 'Parent' => 'Parent News', + 'Template' => 'Template', + 'Status' => 'Status', + 'Access' => 'Access', + 'Select image' => 'Select image', + 'Change' => 'Change', + 'Remove' => 'Remove', + 'Add another image' => 'Add another image', + 'News Short' => 'News Short', + 'Author' => 'Author', + + //Index + 'Create' => 'Create', + 'Create news' => 'Create news', + 'Create new news' => 'Create new news', + 'Example Code' => 'Example Code', + 'Actions' => 'Actions', + 'Date' => 'Date', + 'Delete all checked' => 'Delete all checked', + + 'Are you sure you want to delete all the news' => 'Confirm delete!', + 'Delete news: :news' => 'Delete news: :news', + 'Your news :news have been added.' => 'Your news :news have been added.', + 'Your changes to the news :news have been saved.' => 'Your changes to the news :news have been saved.', + 'News :news deleted' => 'News :news deleted', + + //Settings + 'Settings news' => 'Settings news', + 'Respect to the width' => 'Respect to the width', + 'Respect to the height' => 'Respect to the height', + 'Similarly, cutting unnecessary' => 'Similarly, cutting unnecessary', + 'Similarly with the expansion' => 'Similarly with the expansion', + 'News per page (website)' => 'News per page (website)', + 'Width thumbnails (px)' => 'Width thumbnails (px)', + 'Height thumbnails (px)' => 'Height thumbnails (px)', + 'Resize' => 'Resize', + 'News per page (admin)' => 'News per page (admin)', + 'Original width (px, max)' => 'Original width (px, max)', + 'Original height (px, max)' => 'Original height (px, max)', + + //Modal + 'Code Last News' => 'Last News', + 'Code Top View' => 'Top News View', + 'Code Block' => 'Block News', + 'Code Content By Id' => 'News Content By Id', + 'Code Children' => 'News Children', + 'Code Tags' => 'News Tags', + 'Code Related' => 'News Related', + + //Sort + 'Sorting' => 'Sorting', + 'by date' => 'date', + 'by number' => 'number', + 'by views' => 'views', + 'by status' => 'status', + 'ASC' => 'ASC', + 'DESC' => 'DESC', + + //Front End + 'Read more' => 'Read more', + 'Children news' => 'Children news', + 'Hits count' => 'Hits count ', + 'Related' => 'Related news', + ) ); \ No newline at end of file diff --git a/languages/ru.lang.php b/languages/ru.lang.php old mode 100644 new mode 100755 index 92aca93..76982c2 --- a/languages/ru.lang.php +++ b/languages/ru.lang.php @@ -1,106 +1,106 @@ - array( - //Index - 'News' => 'Новости', - 'News plugin for Monstra' => 'Плагин новостей для Monstra', - - //Admin - 'News template' => 'Шаблон новостей', - 'Published' => 'Опубликовано', - 'Draft' => 'Черновик', - 'Registered' => 'Зарегистрированно', - 'Public' => 'Публичный', - 'Your changes have been saved' => 'Ваши изменения были сохранены', - 'Slug is exits' => 'Такой Slug уже существует', - - //View - 'Save' => 'Сохранить', - 'Edit' => 'Редактировать', - 'Clone' => 'Клонировать', - 'Delete' => 'Удалить', - 'Save and exit' => 'Сохранить и выйти', - 'Cancel' => 'Отменить', - - 'New news' => 'Новая новость', - 'Edit news' => 'Редактирование новости', - - //Add - 'Item' => 'Новость', - 'Metadata' => 'Мета данные', - 'Settings' => 'Настройки', - 'Image' => 'Изображение', - 'Return to Index' => 'Вернуться назад', - 'Name' => 'Название', - 'Name (slug)' => 'Название (slug)', - 'Keywords' => 'Ключевые слова', - 'Title' => 'Заголовок', - 'Tags' => 'Теги', - 'Description' => 'Описание', - 'Search Engines Robots' => 'Поисковые роботы', - 'Parent' => 'Родитель', - 'Template' => 'Шаблон', - 'Status' => 'Статус', - 'Access' => 'Доступ', - 'Select image' => 'Выбрать изображение', - 'Change' => 'Изменить', - 'Remove' => 'Удалить', - 'Add another image' => 'Добавить еще одно изображение', - 'News Short' => 'Краткая новость', - 'Author' => 'Автор', - - //Index - 'Create' => 'Добавить', - 'Create news' => 'Добавить новость', - 'Create new news' => 'Добавить новую новость', - 'Example Code' => 'Примеры шорткодов', - 'Actions' => 'Действия', - 'Date' => 'Дата', - 'Delete all checked' => 'Удалить выбранные', - - 'Are you sure you want to delete all the news?' => 'Вы уверены что хотите удалить все выбранные новости?', - 'Delete news: :news' => 'Удалить новость: :news', - 'Your news :news have been added.' => 'Новость :news добавлена', - 'Your changes to the news :news have been saved.' => 'Ваши изменения к новости :news были сохранены.', - 'News :news deleted' => 'Новость :news удалена', - - //Settings - 'Settings news' => 'Настройки новостей', - 'Respect to the width' => 'Относительно ширины', - 'Respect to the height' => 'Относительно высоты', - 'Similarly, cutting unnecessary' => 'Точно, обрезая лишнее', - 'Similarly with the expansion' => 'Точно, растягивая изображение', - 'News per page (website)' => 'Количество новостей на странице (сайт)', - 'Width thumbnails (px)' => 'Ширина миниатюр (px)', - 'Height thumbnails (px)' => 'Высота миниатюр (px)', - 'Resize' => 'Способ уменьшения изображения', - 'News per page (admin)' => 'Количество новостей на странице (админка)', - 'Original width (px, max)' => 'Ширина оригинала (px, максимум)', - 'Original height (px, max)' => 'Высота оригинала (px, максимум)', - - //Modal - 'Code Last News' => 'Последние новости', - 'Code Top View' => 'Самые просматриваемые новости', - 'Code Block' => 'Новости', - 'Code Content By Id' => 'Получение новости по id', - 'Code Children' => 'Новости 2 уровень', - 'Code Tags' => 'Теги новостей', - 'Code Related' => 'Похожие новости', - - //Sort - 'Sorting' => 'Сортировка', - 'by date' => 'по дате', - 'by number' => 'по номеру', - 'by views' => 'по просмотрам', - 'by status' => 'по статусу', - 'ASC' => 'по возрастанию', - 'DESC' => 'по убыванию', - - //Front End - 'Read more' => 'Читать дальше', - 'Children news' => 'Связанные новости', - 'Hits count' => 'Количество просмотров ', - 'Related' => 'Новости по теме', - ) + array( + //Index + 'News' => 'Новости', + 'News plugin for Monstra' => 'Плагин новостей для Monstra', + + //Admin + 'News template' => 'Шаблон новостей', + 'Published' => 'Опубликовано', + 'Draft' => 'Черновик', + 'Registered' => 'Зарегистрированно', + 'Public' => 'Публичный', + 'Your changes have been saved' => 'Ваши изменения были сохранены', + 'Slug is exits' => 'Такой Slug уже существует', + + //View + 'Save' => 'Сохранить', + 'Edit' => 'Редактировать', + 'Clone' => 'Клонировать', + 'Delete' => 'Удалить', + 'Save and exit' => 'Сохранить и выйти', + 'Cancel' => 'Отменить', + + 'New news' => 'Новая новость', + 'Edit news' => 'Редактирование новости', + + //Add + 'Item' => 'Новость', + 'Metadata' => 'Мета данные', + 'Settings' => 'Настройки', + 'Image' => 'Изображение', + 'Return to Index' => 'Вернуться назад', + 'Name' => 'Название', + 'Name (slug)' => 'Название (slug)', + 'Keywords' => 'Ключевые слова', + 'Title' => 'Заголовок', + 'Tags' => 'Теги', + 'Description' => 'Описание', + 'Search Engines Robots' => 'Поисковые роботы', + 'Parent' => 'Родитель', + 'Template' => 'Шаблон', + 'Status' => 'Статус', + 'Access' => 'Доступ', + 'Select image' => 'Выбрать изображение', + 'Change' => 'Изменить', + 'Remove' => 'Удалить', + 'Add another image' => 'Добавить еще одно изображение', + 'News Short' => 'Краткая новость', + 'Author' => 'Автор', + + //Index + 'Create' => 'Добавить', + 'Create news' => 'Добавить новость', + 'Create new news' => 'Добавить новую новость', + 'Example Code' => 'Примеры шорткодов', + 'Actions' => 'Действия', + 'Date' => 'Дата', + 'Delete all checked' => 'Удалить выбранные', + + 'Are you sure you want to delete all the news?' => 'Вы уверены что хотите удалить все выбранные новости?', + 'Delete news: :news' => 'Удалить новость: :news', + 'Your news :news have been added.' => 'Новость :news добавлена', + 'Your changes to the news :news have been saved.' => 'Ваши изменения к новости :news были сохранены.', + 'News :news deleted' => 'Новость :news удалена', + + //Settings + 'Settings news' => 'Настройки новостей', + 'Respect to the width' => 'Относительно ширины', + 'Respect to the height' => 'Относительно высоты', + 'Similarly, cutting unnecessary' => 'Точно, обрезая лишнее', + 'Similarly with the expansion' => 'Точно, растягивая изображение', + 'News per page (website)' => 'Количество новостей на странице (сайт)', + 'Width thumbnails (px)' => 'Ширина миниатюр (px)', + 'Height thumbnails (px)' => 'Высота миниатюр (px)', + 'Resize' => 'Способ уменьшения изображения', + 'News per page (admin)' => 'Количество новостей на странице (админка)', + 'Original width (px, max)' => 'Ширина оригинала (px, максимум)', + 'Original height (px, max)' => 'Высота оригинала (px, максимум)', + + //Modal + 'Code Last News' => 'Последние новости', + 'Code Top View' => 'Самые просматриваемые новости', + 'Code Block' => 'Новости', + 'Code Content By Id' => 'Получение новости по id', + 'Code Children' => 'Новости 2 уровень', + 'Code Tags' => 'Теги новостей', + 'Code Related' => 'Похожие новости', + + //Sort + 'Sorting' => 'Сортировка', + 'by date' => 'по дате', + 'by number' => 'по номеру', + 'by views' => 'по просмотрам', + 'by status' => 'по статусу', + 'ASC' => 'по возрастанию', + 'DESC' => 'по убыванию', + + //Front End + 'Read more' => 'Читать дальше', + 'Children news' => 'Связанные новости', + 'Hits count' => 'Количество просмотров ', + 'Related' => 'Новости по теме', + ) ); \ No newline at end of file diff --git a/news.admin.php b/news.admin.php old mode 100644 new mode 100755 index 4547796..383401a --- a/news.admin.php +++ b/news.admin.php @@ -1,766 +1,766 @@ -select('[id='.Session::get('user_id').']', null); - - $user['firstname'] = Html::toText($user['firstname']); - $user['lastname'] = Html::toText($user['lastname']); - - // Page author - if ( ! empty($user['firstname'])) { - $opt['author'] = (empty($user['lastname'])) ? $user['firstname'] : $user['firstname'].' '.$user['lastname']; - } else { - $opt['author'] = Session::get('user_login'); - } - - // Status array - $opt['status'] = array('published' => __('Published', 'news'), 'draft' => __('Draft', 'news')); - - // Access array - $opt['access'] = array('public' => __('Public', 'news'), 'registered' => __('Registered', 'news')); - - $opt['url'] = $opt['site_url'] . 'public/uploads/news/'; - $opt['dir'] = ROOT . DS . 'public' . DS . 'uploads' . DS . 'news' . DS; - - - // Check for get actions - // --------------------------------------------- - if (Request::get('action')) { - - // Switch actions - // ----------------------------------------- - switch (Request::get('action')) { - - // Settings - // ------------------------------------- - case "settings": - - if (Request::post('news_submit_settings_cancel')) { - Request::redirect('index.php?id=news'); - } - - if (Request::post('news_submit_settings')) { - if (Security::check(Request::post('csrf'))) { - Option::update(array( - 'news_limit' => (int)Request::post('limit'), - 'news_limit_admin' => (int)Request::post('limit_admin'), - 'news_w' => (int)Request::post('width_thumb'), - 'news_h' => (int)Request::post('height_thumb'), - 'news_wmax' => (int)Request::post('width_orig'), - 'news_hmax' => (int)Request::post('height_orig'), - 'news_resize' => (string)Request::post('resize') - )); - - Notification::set('success', __('Your changes have been saved', 'news')); - - Action::run('admin_news_settings'); - - Request::redirect('index.php?id=news'); - } else { die('csrf detected!'); } - } - - View::factory('news/views/backend/settings')->display(); - - break; - - // Clone news - // ------------------------------------- - case "clone_news": - - if (Security::check(Request::get('token'))) { - - // Generate rand news name - $rand_news_name = Request::get('uid').'_clone_'.date("Ymd_His"); - - // Get original news - $orig_news = $news->select('[id="'.Request::get('uid').'"]', null); - - // Generate rand news title - $news_name = $orig_news['name'].' [copy]'; - $safeName = Security::safeName($rand_news_name, '-', true); - - // Clone news - if ($news->insert(array( - 'slug' => $safeName, - 'name' => $news_name, - 'parent' => $orig_news['parent'], - 'robots_index' => $orig_news['robots_index'], - 'robots_follow'=> $orig_news['robots_follow'], - 'status' => $orig_news['status'], - 'template' => $orig_news['template'], - 'access' => (isset($orig_news['access'])) ? $orig_news['access'] : 'public', - 'title' => $orig_news['title'], - 'description' => $orig_news['description'], - 'keywords' => $orig_news['keywords'], - 'tags' => $orig_news['tags'], - 'date' => time(), - 'author' => $orig_news['author'] - ))) { - - // Get cloned news ID - $last_id = $news->lastId(); - - // Save cloned news content - File::setContent(STORAGE . DS . 'news' . DS . $last_id . '.news.txt', - File::getContent(STORAGE . DS . 'news' . DS . $orig_news['id'] . '.news.txt')); - - // Save cloned news content - File::setContent(STORAGE . DS . 'news' . DS . $last_id . '.short.news.txt', - File::getContent(STORAGE . DS . 'news' . DS . $orig_news['id'] . '.short.news.txt')); - - Dir::create($opt['dir']. $orig_news['parent'] . DS . $safeName . DS); - Dir::create($opt['dir']. $orig_news['parent'] . DS . $safeName . DS . 'thumbnail' . DS); - // Send notification - Notification::set('success', __('The news :news cloned.', 'news', array(':news' => Security::safeName(Request::get('slug'), '-', true)))); - } - - // Run add extra actions - Action::run('admin_news_action_clone'); - - // Redirect - Request::redirect('index.php?id=news'); - - } else { die('csrf detected!'); } - - break; - - // Add news - // ------------------------------------- - case "add_news": - - // Add news - if (Request::post('add_news') || Request::post('add_news_and_exit')) { - - if (Security::check(Request::post('csrf'))) { - - // Get parent news - if (Request::post('news_parent') == '0') { - $parent = ''; - } else { - $parent = Request::post('news_parent'); - } - - // Prepare date - if (Valid::date(Request::post('news_date'))) { - $date = strtotime(Request::post('news_date')); - } else { - $date = time(); - } - - if (Request::post('news_robots_index')) $robots_index = 'noindex'; else $robots_index = 'index'; - if (Request::post('news_robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow'; - $slug = (Request::post('news_slug') == "") ? Request::post('news_name') : Request::post('news_slug'); - - $slugs = $news->select("[slug='".$slug."']"); - - if ($slugs !== null && count($slugs) > 0) { - $errors[] = __('Slug is exits', 'news'); - Notification::set('error', __('Slug is exits', 'news')); - } - - // If no errors then try to save - if (count($errors) == 0) { - - $last_id = 0; - $safeName = Security::safeName($slug, '-', true); - // Insert new news - if ($news->insert(array( - 'slug' => $safeName, - 'name' => Request::post('news_name'), - 'parent' => $parent, - 'status' => Request::post('news_status'), - 'template' => Request::post('news_template'), - 'access' => Request::post('news_access'), - 'robots_index' => $robots_index, - 'robots_follow'=> $robots_follow, - 'title' => Request::post('news_title'), - 'description' => Request::post('news_description'), - 'tags' => Request::post('news_tags'), - 'keywords' => Request::post('news_keywords'), - 'date' => $date, - 'author' => Request::post('news_author'), - 'hits' => '0') - )) { - // Get inserted news ID - $last_id = $news->lastId(); - - // Save content - File::setContent(STORAGE . DS . 'news' . DS . $last_id . '.news.txt', XML::safe(Request::post('editor'))); - File::setContent(STORAGE . DS . 'news' . DS . $last_id . '.short.news.txt', XML::safe(Request::post('news_short'))); - if ($parent != "") - $parent = $parent . DS; - Dir::create($opt['dir']. $parent . $safeName . DS); - Dir::create($opt['dir']. $parent . $safeName . DS . 'thumbnail' . DS); - $imgName = Security::safeName(Text::translitIt(trim(Request::post('news_name')), '-', true)); - NewsAdmin::UploadImage($imgName, $opt['dir']. $parent . $safeName . DS, $_FILES); - - // Send notification - Notification::set('success', __('Your news :news have been added.', 'news', array(':news' => Security::safeName(Request::post('news_title'), '-', true)))); - } - - // Run add extra actions - Action::run('admin_news_action_add'); - - // Redirect - if (Request::post('add_news_and_exit')) { - Request::redirect('index.php?id=news'); - } else { - Request::redirect('index.php?id=news&action=edit_news&uid='.$last_id); - } - } - - } else { die('csrf detected!'); } - - } - - // Get all news - $news_list = $news->select('[parent=""]'); - $opt['list'][""] = '-none-'; - if (is_array($news_list)) - { - foreach ($news_list as $item) { - $opt['list'][$item['slug']] = $item['name']; - } - } - - // Save fields - if (Request::post('news_slug')) $news_item['slug'] = Request::post('news_slug'); else $news_item['slug'] = ''; - if (Request::post('news_name')) $news_item['name'] = Request::post('news_name'); else $news_item['name'] = ''; - if (Request::post('news_title')) $news_item['title'] = Request::post('news_title'); else $news_item['title'] = ''; - if (Request::post('news_keywords')) $news_item['keywords'] = Request::post('news_keywords'); else $news_item['keywords'] = ''; - if (Request::post('news_tags')) $news_item['tags'] = Request::post('news_tags'); else $news_item['tags'] = ''; - if (Request::post('news_description')) $news_item['description'] = Request::post('news_description'); else $news_item['description'] = ''; - if (Request::post('editor')) $news_item['content'] = Request::post('editor'); else $news_item['content'] = ''; - if (Request::post('news_templates')) $news_item['template'] = Request::post('news_templates'); else $news_item['template'] = Option::get('news_template'); - if (Request::post('news_short')) $news_item['short'] = Request::post('news_short'); else $news_item['short'] = ''; - if (Request::post('news_status')) $news_item['status'] = Request::post('news_status'); else $news_item['status'] = 'published'; - if (Request::post('news_access')) $news_item['access'] = Request::post('news_access'); else $news_item['access'] = 'public'; - if (Request::post('news_parent')) $news_item['parent'] = Request::post('news_parent'); else if(Request::get('parent')) $news_item['parent'] = Request::get('parent'); else $news_item['parent'] = ''; - if (Request::post('news_robots_index')) $news_item['robots_index'] = true; else $news_item['robots_index'] = false; - if (Request::post('news_robots_follow')) $news_item['robots_follow'] = true; else $news_item['robots_follow'] = false; - //-------------- - - // Generate date - $news_item['date'] = Date::format(time(), 'Y-m-d H:i:s'); - - // Set Tabs State - news - Notification::setNow('news', 'news'); - - // Display view - View::factory('news/views/backend/add') - ->assign('item', $news_item) - ->assign('opt', $opt) - ->assign('errors', $errors) - ->display(); - - break; - - // Edit news - // ------------------------------------- - case "edit_news": - - if (Request::post('edit_news') || Request::post('edit_news_and_exit')) { - - if (Security::check(Request::post('csrf'))) { - - // Get news parent - if (Request::post('news_parent') == '0') { - $parent = ''; - } else { - $parent = Request::post('news_parent'); - } - - $id = (int)Request::post('news_id'); - - // Prepare date - if (Valid::date(Request::post('news_date'))) { - $date = strtotime(Request::post('news_date')); - } else { - $date = time(); - } - - if (Request::post('news_robots_index')) $robots_index = 'noindex'; else $robots_index = 'index'; - if (Request::post('news_robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow'; - $slug = (Request::post('news_slug') == "") ? Request::post('news_title') : Request::post('news_slug'); - - if ($slug != Request::post('old_slug')) - { - $slugs = $news->select("[slug='".$slug."']"); - - if ($slugs !== null && count($slugs) > 0) { - $errors[] = __('Slug is exits', 'news'); - Notification::set('error', __('Slug is exits', 'news')); - } - } - - if (count($errors) == 0) { - $safeName = Security::safeName($slug, '-', true); - $safeOldName = Security::safeName(Request::post('old_slug'), '-', true); - $parent_old = Request::post('old_parent'); - - $data = array( - 'slug' => $safeName, - 'parent' => $parent, - 'name' => Request::post('news_name'), - 'title' => Request::post('news_title'), - 'description' => Request::post('news_description'), - 'tags' => Request::post('news_tags'), - 'keywords' => Request::post('news_keywords'), - 'robots_index' => $robots_index, - 'robots_follow'=> $robots_follow, - 'status' => Request::post('news_status'), - 'template' => Request::post('news_template'), - 'access' => Request::post('news_access'), - 'date' => $date, - 'author' => Request::post('news_author') - ); - - if ($parent != "") - $parent = $parent . DS; - if ($parent_old != "") - $parent_old = $parent_old . DS; - - $no_rename = true; - if ($parent != $parent_old) - { - rename($opt['dir']. $parent_old . $safeOldName, $opt['dir']. $parent . $safeName); - $no_rename = false; - } - - // Update parents in all childrens - if ($safeName !== $safeOldName) { - - if (Request::post('old_parent') == '') - { - $_news = $news->select('[parent="'.$safeOldName.'"]'); - if ( ! empty($_news)) { - foreach($_news as $news_item) { - $news->updateWhere('[slug="'.$news_item['slug'].'"]', array('parent' => $safeName)); - } - } - } - - if ($no_rename) - rename($opt['dir'] . $parent_old . $safeOldName, $opt['dir'] . $parent . $safeName); - } - - if ($news->updateWhere('[id="'.$id.'"]', $data)) { - $imgName = Security::safeName(Text::translitIt(trim(Request::post('news_name')), '-', true)); - NewsAdmin::UploadImage($imgName, $opt['dir']. $parent . $safeName . DS, $_FILES); - File::setContent(STORAGE . DS . 'news' . DS . $id . '.news.txt', XML::safe(Request::post('editor'))); - File::setContent(STORAGE . DS . 'news' . DS . $id . '.short.news.txt', XML::safe(Request::post('news_short'))); - Notification::set('success', __('Your changes to the news :news have been saved.', 'news', array(':news' => Security::safeName(Request::post('news_title'), '-', true)))); - } - - // Run edit extra actions - Action::run('admin_news_action_edit'); - - // Redirect - if (Request::post('edit_news_and_exit')) { - Request::redirect('index.php?id=news'); - } else { - Request::redirect('index.php?id=news&action=edit_news&uid='.$id); - } - } - - } else { die('csrf detected!'); } - } - - $item = $news->select('[id="'.Request::get('uid').'"]', null); - - // Get all news - $news_list = $news->select(); - $opt['list'][""] = '-none-'; - // Foreach news find news whithout parent - foreach ($news_list as $item_list) { - if (isset($item_list['parent'])) { - $c_p = $item_list['parent']; - } else { - $c_p = ''; - } - if ($c_p == '') { - if ($item_list['slug'] !== $item['slug']) { - $opt['list'][$item_list['slug']] = $item_list['name']; - } - } - } - - if ($item) { - - $item['content'] = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $item['id'] . '.news.txt')); - $item['short'] = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $item['id'] . '.short.news.txt')); - $item['robots_index'] = ($item['robots_index'] == 'noindex') ? true : false; - $item['robots_follow'] = ($item['robots_follow'] == 'nofollow') ? true : false; - - if (Request::post('parent')) { - // Get news parent - if (Request::post('parent') == '-none-') { - $item['parent'] = ''; - } else { - $item['parent'] = Request::post('parent'); - } - } - - // date - $item['date'] = Date::format($item['date'], 'Y-m-d H:i:s'); - // Set Tabs State - news - Notification::setNow('news', 'news'); - // Display view - View::factory('news/views/backend/edit') - ->assign('item', $item) - ->assign('opt', $opt) - ->assign('errors', $errors) - ->display(); - } - - break; - - // Delete news - // ------------------------------------- - case "delete_news": - - if (Security::check(Request::get('token'))) { - - NewsAdmin::deleteNews(Request::get('uid')); - - // Run delete extra actions - Action::run('admin_news_action_delete'); - - // Redirect - Request::redirect('index.php?id=news'); - - } else { die('csrf detected!'); } - - break; - - // Update page access - // ------------------------------------- - case "update_access": - - if (Security::check(Request::get('token'))) { - - $news->updateWhere('[id="'.Request::get('uid').'"]', array('access' => Request::get('access'))); - - // Run delete extra actions - Action::run('admin_news_action_update_access'); - - // Send notification - Notification::set('success', __('Your changes to the news :page have been saved.', 'pages', array(':page' => Request::get('slug')))); - - // Redirect - Request::redirect('index.php?id=news'); - - } else { die('csrf detected!'); } - - break; - - // Update page status - // ------------------------------------- - case "update_status": - - if (Security::check(Request::get('token'))) { - - $news->updateWhere('[id="'.Request::get('uid').'"]', array('status' => Request::get('status'))); - - // Run delete extra actions - Action::run('admin_news_action_update_status'); - - // Send notification - Notification::set('success', __('Your changes to the news :page have been saved.', 'pages', array(':page' => Request::get('slug')))); - - // Redirect - Request::redirect('index.php?id=news'); - - } else { die('csrf detected!'); } - - break; - } - - // Its mean that you can add your own actions for this plugin - Action::run('admin_news_extra_actions'); - - } else { - - // Index action - // ------------------------------------- - - // Init vars - $count = 0; - $items = array(); - $limit = Option::get('news_limit_admin'); - $records_all = $news->select('[parent=""]', array('slug', 'title', 'status', 'date', 'author', 'expand', 'access', 'parent')); - $count_news = count($records_all); - $opt['pages'] = ceil($count_news/$limit); - - $opt['page'] = (Request::get('page')) ? (int)Request::get('page') : 1; - $opt['sort'] = (Request::get('sort')) ? (string)Request::get('sort') : 'date'; - $opt['order'] = (Request::get('order') and Request::get('order')=='ASC') ? 'ASC' : 'DESC'; - - if ($opt['page'] < 1) { $opt['page'] = 1; } - elseif ($opt['page'] > $opt['pages']) { $opt['page'] = $opt['pages']; } - - $start = ($opt['page']-1)*$limit; - - $records_sort = Arr::subvalSort($records_all, $opt['sort'], $opt['order']); - if($count_news>0) $records = array_slice($records_sort, $start, $limit); - else $records = array(); - - // Loop - foreach ($records as $item) { - - $items[$count]['name'] = $item['name']; - $items[$count]['parent'] = $item['parent']; - $items[$count]['_status'] = $opt['status'][$item['status']]; - $items[$count]['_access'] = $opt['access'][$item['access']]; - $items[$count]['status'] = $item['status']; - $items[$count]['access'] = $item['access']; - $items[$count]['date'] = $item['date']; - $items[$count]['author'] = $item['author']; - $items[$count]['expand'] = 0; - $items[$count]['slug'] = $item['slug']; - $items[$count]['id'] = $item['id']; - - $_news = Arr::subvalSort($news->select('[parent="'.$item['slug'].'"]', 'all'), 'date', 'DESC'); - - if ( ! empty($_news)) { - foreach($_news as $news_item) { - $items = NewsAdmin::childrenIndex($news_item, $items, $opt, $count); - $count++; - } - } - $count++; - } - - // Display view - View::factory('news/views/backend/index') - ->assign('items', $items) - ->assign('opt', $opt) - ->display(); - } - - } - - /** - * Add child to parent - */ - public static function childrenIndex($item, $items, $opt, $count) - { - $count++; - $items[$count]['name'] = $item['name']; - $items[$count]['parent'] = $item['parent']; - $items[$count]['_status'] = $opt['status'][$item['status']]; - $items[$count]['_access'] = $opt['access'][$item['access']]; - $items[$count]['status'] = $item['status']; - $items[$count]['access'] = $item['access']; - $items[$count]['date'] = $item['date']; - $items[$count]['author'] = $item['author']; - $items[$count]['slug'] = $item['slug']; - $items[$count]['id'] = $item['id']; - - return $items; - } - - /** - * Form Component Save - */ - public static function formComponentSave() { - if (Request::post('news_component_save')) { - if (Security::check(Request::post('csrf'))) { - Option::update('news_template', Request::post('news_form_template')); - Request::redirect('index.php?id=themes'); - } - } - } - - - /** - * Form Component - */ - public static function formComponent() { - - $_templates = Themes::getTemplates(); - foreach($_templates as $template) { - $templates[basename($template, '.template.php')] = basename($template, '.template.php'); - } - - echo ( - Form::open(). - Form::hidden('csrf', Security::token()). - Form::label('news_form_template', __('News template', 'news')). - Form::select('news_form_template', $templates, Option::get('news_template')). - Html::br(). - Form::submit('news_component_save', __('Save', 'news'), array('class' => 'btn')). - Form::close() - ); - } - - private static function UploadImage($uid, $folder, $_FILES) - { - foreach($_FILES as $item) - { - if ($item) { - if($item['type'] == 'image/jpeg' || - $item['type'] == 'image/png' || - $item['type'] == 'image/gif') { - - switch($item['type']) - { - case "image/jpeg" : - $ext = ".jpg"; - break; - case "image/png" : - $ext = ".png"; - break; - case "image/gif" : - $ext = ".gif"; - break; - default: - $ext = ".jpg"; - break; - } - - $img = Image::factory($item['tmp_name']); - $file['wmax'] = (int)Option::get('news_wmax'); - $file['hmax'] = (int)Option::get('news_hmax'); - $file['w'] = (int)Option::get('news_w'); - $file['h'] = (int)Option::get('news_h'); - $file['resize'] = Option::get('news_resize'); - - NewsAdmin::ReSize($img, $folder, $uid.'_'.time().$ext, $file); - } - } - } - - } - - private static function deleteNews($uid) - { - $news = NewsAdmin::$news; - // Get specific news - $item = $news->select('[id="'.$uid.'"]', null); - - $opt['dir'] = ROOT . DS . 'public' . DS . 'uploads' . DS . 'news' . DS; - // Delete news and update fields - if ($news->deleteWhere('[slug="'.$item['slug'].'" ]')) { - - $_news = $news->select('[parent="'.$item['slug'].'"]'); - - if ( ! empty($_news)) { - foreach($_news as $news_item) { - $news->updateWhere('[slug="'.$news_item['slug'].'"]', array('parent' => '')); - rename($opt['dir'] . $item['slug'] . DS . $news_item['slug'], $opt['dir']. $news_item['slug']); - } - } - - if ($item['parent'] != "") - $item['parent'] = $item['parent'] . DS; - - Dir::delete($opt['dir'] . $item['parent'] . $item['slug']); - File::delete(STORAGE . DS . 'news' . DS . $item['id'] . '.news.txt'); - File::delete(STORAGE . DS . 'news' . DS . $item['id'] . '.short.news.txt'); - Notification::set('success', __('News :news deleted', 'news', array(':news' => Html::toText($item['title'])))); - } - } - - /** - * _requestAjax - */ - public static function _requestAjax() - { - if (Security::check(Request::get('csrf')) && Request::get('id') == 'news') { - if (Request::get('image') == true) { - View::factory('news/views/backend/addImg')->display(); - die(); - } - } - if (Security::check(Request::post('csrf')) && Request::get('id') == 'news') { - if (Request::get('delete') == "image") { - File::delete(Request::post('dir') . Request::post('id')); - File::delete(Request::post('dir') . 'thumbnail' . DS . Request::post('id')); - die(); - } - if (Request::get('delete') == "item") - { - if (is_array(Request::post('items'))) { - NewsAdmin::$news = new Table('news'); - foreach(Request::post('items') as $row) - { - NewsAdmin::deleteNews($row); - } - die ('deleted'); - } - die('delete item'); - } - } - //exit('no action'); - } - - private static function ReSize($img, $folder, $name, $opt) - { - $wmax = (int)$opt['wmax']; - $hmax = (int)$opt['hmax']; - $width = (int)$opt['w']; - $height = (int)$opt['h']; - $resize = $opt['resize']; - $ratio = $width/$height; - - if ($img->width > $wmax or $img->height > $hmax) { - if ($img->height > $img->width) { - $img->resize($wmax, $hmax, Image::HEIGHT); - } else { - $img->resize($wmax, $hmax, Image::WIDTH); - } - } - $img->save($folder.$name); - - switch ($resize) { - case 'width' : $img->resize($width, $height, Image::WIDTH); break; - case 'height' : $img->resize($width, $height, Image::HEIGHT); break; - case 'stretch' : $img->resize($width, $height); break; - default : - // crop - if (($img->width/$img->height) > $ratio) { - //$img->resize($width, $height, Image::HEIGHT)->crop($width, $height, round(($img->width-$width)/2),0); - $img->resize($width, $height, Image::HEIGHT); - } else { - //$img->resize($width, $height, Image::WIDTH)->crop($width, $height, 0, 0); - $img->resize($width, $height, Image::WIDTH); - } - break; - } - $img->save($folder.'thumbnail'.DS.$name); - } +select('[id='.Session::get('user_id').']', null); + + $user['firstname'] = Html::toText($user['firstname']); + $user['lastname'] = Html::toText($user['lastname']); + + // Page author + if ( ! empty($user['firstname'])) { + $opt['author'] = (empty($user['lastname'])) ? $user['firstname'] : $user['firstname'].' '.$user['lastname']; + } else { + $opt['author'] = Session::get('user_login'); + } + + // Status array + $opt['status'] = array('published' => __('Published', 'news'), 'draft' => __('Draft', 'news')); + + // Access array + $opt['access'] = array('public' => __('Public', 'news'), 'registered' => __('Registered', 'news')); + + $opt['url'] = $opt['site_url'] . 'public/uploads/news/'; + $opt['dir'] = ROOT . DS . 'public' . DS . 'uploads' . DS . 'news' . DS; + + + // Check for get actions + // --------------------------------------------- + if (Request::get('action')) { + + // Switch actions + // ----------------------------------------- + switch (Request::get('action')) { + + // Settings + // ------------------------------------- + case "settings": + + if (Request::post('news_submit_settings_cancel')) { + Request::redirect('index.php?id=news'); + } + + if (Request::post('news_submit_settings')) { + if (Security::check(Request::post('csrf'))) { + Option::update(array( + 'news_limit' => (int)Request::post('limit'), + 'news_limit_admin' => (int)Request::post('limit_admin'), + 'news_w' => (int)Request::post('width_thumb'), + 'news_h' => (int)Request::post('height_thumb'), + 'news_wmax' => (int)Request::post('width_orig'), + 'news_hmax' => (int)Request::post('height_orig'), + 'news_resize' => (string)Request::post('resize') + )); + + Notification::set('success', __('Your changes have been saved', 'news')); + + Action::run('admin_news_settings'); + + Request::redirect('index.php?id=news'); + } else { die('csrf detected!'); } + } + + View::factory('news/views/backend/settings')->display(); + + break; + + // Clone news + // ------------------------------------- + case "clone_news": + + if (Security::check(Request::get('token'))) { + + // Generate rand news name + $rand_news_name = Request::get('uid').'_clone_'.date("Ymd_His"); + + // Get original news + $orig_news = $news->select('[id="'.Request::get('uid').'"]', null); + + // Generate rand news title + $news_name = $orig_news['name'].' [copy]'; + $safeName = Security::safeName($rand_news_name, '-', true); + + // Clone news + if ($news->insert(array( + 'slug' => $safeName, + 'name' => $news_name, + 'parent' => $orig_news['parent'], + 'robots_index' => $orig_news['robots_index'], + 'robots_follow'=> $orig_news['robots_follow'], + 'status' => $orig_news['status'], + 'template' => $orig_news['template'], + 'access' => (isset($orig_news['access'])) ? $orig_news['access'] : 'public', + 'title' => $orig_news['title'], + 'description' => $orig_news['description'], + 'keywords' => $orig_news['keywords'], + 'tags' => $orig_news['tags'], + 'date' => time(), + 'author' => $orig_news['author'] + ))) { + + // Get cloned news ID + $last_id = $news->lastId(); + + // Save cloned news content + File::setContent(STORAGE . DS . 'news' . DS . $last_id . '.news.txt', + File::getContent(STORAGE . DS . 'news' . DS . $orig_news['id'] . '.news.txt')); + + // Save cloned news content + File::setContent(STORAGE . DS . 'news' . DS . $last_id . '.short.news.txt', + File::getContent(STORAGE . DS . 'news' . DS . $orig_news['id'] . '.short.news.txt')); + + Dir::create($opt['dir']. $orig_news['parent'] . DS . $safeName . DS); + Dir::create($opt['dir']. $orig_news['parent'] . DS . $safeName . DS . 'thumbnail' . DS); + // Send notification + Notification::set('success', __('The news :news cloned.', 'news', array(':news' => Security::safeName(Request::get('slug'), '-', true)))); + } + + // Run add extra actions + Action::run('admin_news_action_clone'); + + // Redirect + Request::redirect('index.php?id=news'); + + } else { die('csrf detected!'); } + + break; + + // Add news + // ------------------------------------- + case "add_news": + + // Add news + if (Request::post('add_news') || Request::post('add_news_and_exit')) { + + if (Security::check(Request::post('csrf'))) { + + // Get parent news + if (Request::post('news_parent') == '0') { + $parent = ''; + } else { + $parent = Request::post('news_parent'); + } + + // Prepare date + if (Valid::date(Request::post('news_date'))) { + $date = strtotime(Request::post('news_date')); + } else { + $date = time(); + } + + if (Request::post('news_robots_index')) $robots_index = 'noindex'; else $robots_index = 'index'; + if (Request::post('news_robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow'; + $slug = (Request::post('news_slug') == "") ? Request::post('news_name') : Request::post('news_slug'); + + $slugs = $news->select("[slug='".$slug."']"); + + if ($slugs !== null && count($slugs) > 0) { + $errors[] = __('Slug is exits', 'news'); + Notification::set('error', __('Slug is exits', 'news')); + } + + // If no errors then try to save + if (count($errors) == 0) { + + $last_id = 0; + $safeName = Security::safeName($slug, '-', true); + // Insert new news + if ($news->insert(array( + 'slug' => $safeName, + 'name' => Request::post('news_name'), + 'parent' => $parent, + 'status' => Request::post('news_status'), + 'template' => Request::post('news_template'), + 'access' => Request::post('news_access'), + 'robots_index' => $robots_index, + 'robots_follow'=> $robots_follow, + 'title' => Request::post('news_title'), + 'description' => Request::post('news_description'), + 'tags' => Request::post('news_tags'), + 'keywords' => Request::post('news_keywords'), + 'date' => $date, + 'author' => Request::post('news_author'), + 'hits' => '0') + )) { + // Get inserted news ID + $last_id = $news->lastId(); + + // Save content + File::setContent(STORAGE . DS . 'news' . DS . $last_id . '.news.txt', XML::safe(Request::post('editor'))); + File::setContent(STORAGE . DS . 'news' . DS . $last_id . '.short.news.txt', XML::safe(Request::post('news_short'))); + if ($parent != "") + $parent = $parent . DS; + Dir::create($opt['dir']. $parent . $safeName . DS); + Dir::create($opt['dir']. $parent . $safeName . DS . 'thumbnail' . DS); + $imgName = Security::safeName(Text::translitIt(trim(Request::post('news_name')), '-', true)); + NewsAdmin::UploadImage($imgName, $opt['dir']. $parent . $safeName . DS, $_FILES); + + // Send notification + Notification::set('success', __('Your news :news have been added.', 'news', array(':news' => Security::safeName(Request::post('news_title'), '-', true)))); + } + + // Run add extra actions + Action::run('admin_news_action_add'); + + // Redirect + if (Request::post('add_news_and_exit')) { + Request::redirect('index.php?id=news'); + } else { + Request::redirect('index.php?id=news&action=edit_news&uid='.$last_id); + } + } + + } else { die('csrf detected!'); } + + } + + // Get all news + $news_list = $news->select('[parent=""]'); + $opt['list'][""] = '-none-'; + if (is_array($news_list)) + { + foreach ($news_list as $item) { + $opt['list'][$item['slug']] = $item['name']; + } + } + + // Save fields + if (Request::post('news_slug')) $news_item['slug'] = Request::post('news_slug'); else $news_item['slug'] = ''; + if (Request::post('news_name')) $news_item['name'] = Request::post('news_name'); else $news_item['name'] = ''; + if (Request::post('news_title')) $news_item['title'] = Request::post('news_title'); else $news_item['title'] = ''; + if (Request::post('news_keywords')) $news_item['keywords'] = Request::post('news_keywords'); else $news_item['keywords'] = ''; + if (Request::post('news_tags')) $news_item['tags'] = Request::post('news_tags'); else $news_item['tags'] = ''; + if (Request::post('news_description')) $news_item['description'] = Request::post('news_description'); else $news_item['description'] = ''; + if (Request::post('editor')) $news_item['content'] = Request::post('editor'); else $news_item['content'] = ''; + if (Request::post('news_templates')) $news_item['template'] = Request::post('news_templates'); else $news_item['template'] = Option::get('news_template'); + if (Request::post('news_short')) $news_item['short'] = Request::post('news_short'); else $news_item['short'] = ''; + if (Request::post('news_status')) $news_item['status'] = Request::post('news_status'); else $news_item['status'] = 'published'; + if (Request::post('news_access')) $news_item['access'] = Request::post('news_access'); else $news_item['access'] = 'public'; + if (Request::post('news_parent')) $news_item['parent'] = Request::post('news_parent'); else if(Request::get('parent')) $news_item['parent'] = Request::get('parent'); else $news_item['parent'] = ''; + if (Request::post('news_robots_index')) $news_item['robots_index'] = true; else $news_item['robots_index'] = false; + if (Request::post('news_robots_follow')) $news_item['robots_follow'] = true; else $news_item['robots_follow'] = false; + //-------------- + + // Generate date + $news_item['date'] = Date::format(time(), 'Y-m-d H:i:s'); + + // Set Tabs State - news + Notification::setNow('news', 'news'); + + // Display view + View::factory('news/views/backend/add') + ->assign('item', $news_item) + ->assign('opt', $opt) + ->assign('errors', $errors) + ->display(); + + break; + + // Edit news + // ------------------------------------- + case "edit_news": + + if (Request::post('edit_news') || Request::post('edit_news_and_exit')) { + + if (Security::check(Request::post('csrf'))) { + + // Get news parent + if (Request::post('news_parent') == '0') { + $parent = ''; + } else { + $parent = Request::post('news_parent'); + } + + $id = (int)Request::post('news_id'); + + // Prepare date + if (Valid::date(Request::post('news_date'))) { + $date = strtotime(Request::post('news_date')); + } else { + $date = time(); + } + + if (Request::post('news_robots_index')) $robots_index = 'noindex'; else $robots_index = 'index'; + if (Request::post('news_robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow'; + $slug = (Request::post('news_slug') == "") ? Request::post('news_title') : Request::post('news_slug'); + + if ($slug != Request::post('old_slug')) + { + $slugs = $news->select("[slug='".$slug."']"); + + if ($slugs !== null && count($slugs) > 0) { + $errors[] = __('Slug is exits', 'news'); + Notification::set('error', __('Slug is exits', 'news')); + } + } + + if (count($errors) == 0) { + $safeName = Security::safeName($slug, '-', true); + $safeOldName = Security::safeName(Request::post('old_slug'), '-', true); + $parent_old = Request::post('old_parent'); + + $data = array( + 'slug' => $safeName, + 'parent' => $parent, + 'name' => Request::post('news_name'), + 'title' => Request::post('news_title'), + 'description' => Request::post('news_description'), + 'tags' => Request::post('news_tags'), + 'keywords' => Request::post('news_keywords'), + 'robots_index' => $robots_index, + 'robots_follow'=> $robots_follow, + 'status' => Request::post('news_status'), + 'template' => Request::post('news_template'), + 'access' => Request::post('news_access'), + 'date' => $date, + 'author' => Request::post('news_author') + ); + + if ($parent != "") + $parent = $parent . DS; + if ($parent_old != "") + $parent_old = $parent_old . DS; + + $no_rename = true; + if ($parent != $parent_old) + { + rename($opt['dir']. $parent_old . $safeOldName, $opt['dir']. $parent . $safeName); + $no_rename = false; + } + + // Update parents in all childrens + if ($safeName !== $safeOldName) { + + if (Request::post('old_parent') == '') + { + $_news = $news->select('[parent="'.$safeOldName.'"]'); + if ( ! empty($_news)) { + foreach($_news as $news_item) { + $news->updateWhere('[slug="'.$news_item['slug'].'"]', array('parent' => $safeName)); + } + } + } + + if ($no_rename) + rename($opt['dir'] . $parent_old . $safeOldName, $opt['dir'] . $parent . $safeName); + } + + if ($news->updateWhere('[id="'.$id.'"]', $data)) { + $imgName = Security::safeName(Text::translitIt(trim(Request::post('news_name')), '-', true)); + NewsAdmin::UploadImage($imgName, $opt['dir']. $parent . $safeName . DS, $_FILES); + File::setContent(STORAGE . DS . 'news' . DS . $id . '.news.txt', XML::safe(Request::post('editor'))); + File::setContent(STORAGE . DS . 'news' . DS . $id . '.short.news.txt', XML::safe(Request::post('news_short'))); + Notification::set('success', __('Your changes to the news :news have been saved.', 'news', array(':news' => Security::safeName(Request::post('news_title'), '-', true)))); + } + + // Run edit extra actions + Action::run('admin_news_action_edit'); + + // Redirect + if (Request::post('edit_news_and_exit')) { + Request::redirect('index.php?id=news'); + } else { + Request::redirect('index.php?id=news&action=edit_news&uid='.$id); + } + } + + } else { die('csrf detected!'); } + } + + $item = $news->select('[id="'.Request::get('uid').'"]', null); + + // Get all news + $news_list = $news->select(); + $opt['list'][""] = '-none-'; + // Foreach news find news whithout parent + foreach ($news_list as $item_list) { + if (isset($item_list['parent'])) { + $c_p = $item_list['parent']; + } else { + $c_p = ''; + } + if ($c_p == '') { + if ($item_list['slug'] !== $item['slug']) { + $opt['list'][$item_list['slug']] = $item_list['name']; + } + } + } + + if ($item) { + + $item['content'] = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $item['id'] . '.news.txt')); + $item['short'] = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $item['id'] . '.short.news.txt')); + $item['robots_index'] = ($item['robots_index'] == 'noindex') ? true : false; + $item['robots_follow'] = ($item['robots_follow'] == 'nofollow') ? true : false; + + if (Request::post('parent')) { + // Get news parent + if (Request::post('parent') == '-none-') { + $item['parent'] = ''; + } else { + $item['parent'] = Request::post('parent'); + } + } + + // date + $item['date'] = Date::format($item['date'], 'Y-m-d H:i:s'); + // Set Tabs State - news + Notification::setNow('news', 'news'); + // Display view + View::factory('news/views/backend/edit') + ->assign('item', $item) + ->assign('opt', $opt) + ->assign('errors', $errors) + ->display(); + } + + break; + + // Delete news + // ------------------------------------- + case "delete_news": + + if (Security::check(Request::get('token'))) { + + NewsAdmin::deleteNews(Request::get('uid')); + + // Run delete extra actions + Action::run('admin_news_action_delete'); + + // Redirect + Request::redirect('index.php?id=news'); + + } else { die('csrf detected!'); } + + break; + + // Update page access + // ------------------------------------- + case "update_access": + + if (Security::check(Request::get('token'))) { + + $news->updateWhere('[id="'.Request::get('uid').'"]', array('access' => Request::get('access'))); + + // Run delete extra actions + Action::run('admin_news_action_update_access'); + + // Send notification + Notification::set('success', __('Your changes to the news :page have been saved.', 'pages', array(':page' => Request::get('slug')))); + + // Redirect + Request::redirect('index.php?id=news'); + + } else { die('csrf detected!'); } + + break; + + // Update page status + // ------------------------------------- + case "update_status": + + if (Security::check(Request::get('token'))) { + + $news->updateWhere('[id="'.Request::get('uid').'"]', array('status' => Request::get('status'))); + + // Run delete extra actions + Action::run('admin_news_action_update_status'); + + // Send notification + Notification::set('success', __('Your changes to the news :page have been saved.', 'pages', array(':page' => Request::get('slug')))); + + // Redirect + Request::redirect('index.php?id=news'); + + } else { die('csrf detected!'); } + + break; + } + + // Its mean that you can add your own actions for this plugin + Action::run('admin_news_extra_actions'); + + } else { + + // Index action + // ------------------------------------- + + // Init vars + $count = 0; + $items = array(); + $limit = Option::get('news_limit_admin'); + $records_all = $news->select('[parent=""]', array('slug', 'title', 'status', 'date', 'author', 'expand', 'access', 'parent')); + $count_news = count($records_all); + $opt['pages'] = ceil($count_news/$limit); + + $opt['page'] = (Request::get('page')) ? (int)Request::get('page') : 1; + $opt['sort'] = (Request::get('sort')) ? (string)Request::get('sort') : 'date'; + $opt['order'] = (Request::get('order') and Request::get('order')=='ASC') ? 'ASC' : 'DESC'; + + if ($opt['page'] < 1) { $opt['page'] = 1; } + elseif ($opt['page'] > $opt['pages']) { $opt['page'] = $opt['pages']; } + + $start = ($opt['page']-1)*$limit; + + $records_sort = Arr::subvalSort($records_all, $opt['sort'], $opt['order']); + if($count_news>0) $records = array_slice($records_sort, $start, $limit); + else $records = array(); + + // Loop + foreach ($records as $item) { + + $items[$count]['name'] = $item['name']; + $items[$count]['parent'] = $item['parent']; + $items[$count]['_status'] = $opt['status'][$item['status']]; + $items[$count]['_access'] = $opt['access'][$item['access']]; + $items[$count]['status'] = $item['status']; + $items[$count]['access'] = $item['access']; + $items[$count]['date'] = $item['date']; + $items[$count]['author'] = $item['author']; + $items[$count]['expand'] = 0; + $items[$count]['slug'] = $item['slug']; + $items[$count]['id'] = $item['id']; + + $_news = Arr::subvalSort($news->select('[parent="'.$item['slug'].'"]', 'all'), 'date', 'DESC'); + + if ( ! empty($_news)) { + foreach($_news as $news_item) { + $items = NewsAdmin::childrenIndex($news_item, $items, $opt, $count); + $count++; + } + } + $count++; + } + + // Display view + View::factory('news/views/backend/index') + ->assign('items', $items) + ->assign('opt', $opt) + ->display(); + } + + } + + /** + * Add child to parent + */ + public static function childrenIndex($item, $items, $opt, $count) + { + $count++; + $items[$count]['name'] = $item['name']; + $items[$count]['parent'] = $item['parent']; + $items[$count]['_status'] = $opt['status'][$item['status']]; + $items[$count]['_access'] = $opt['access'][$item['access']]; + $items[$count]['status'] = $item['status']; + $items[$count]['access'] = $item['access']; + $items[$count]['date'] = $item['date']; + $items[$count]['author'] = $item['author']; + $items[$count]['slug'] = $item['slug']; + $items[$count]['id'] = $item['id']; + + return $items; + } + + /** + * Form Component Save + */ + public static function formComponentSave() { + if (Request::post('news_component_save')) { + if (Security::check(Request::post('csrf'))) { + Option::update('news_template', Request::post('news_form_template')); + Request::redirect('index.php?id=themes'); + } + } + } + + + /** + * Form Component + */ + public static function formComponent() { + + $_templates = Themes::getTemplates(); + foreach($_templates as $template) { + $templates[basename($template, '.template.php')] = basename($template, '.template.php'); + } + + echo ( + Form::open(). + Form::hidden('csrf', Security::token()). + Form::label('news_form_template', __('News template', 'news')). + Form::select('news_form_template', $templates, Option::get('news_template')). + Html::br(). + Form::submit('news_component_save', __('Save', 'news'), array('class' => 'btn')). + Form::close() + ); + } + + private static function UploadImage($uid, $folder, $_files) + { + foreach($_files as $item) + { + if ($item) { + if($item['type'] == 'image/jpeg' || + $item['type'] == 'image/png' || + $item['type'] == 'image/gif') { + + switch($item['type']) + { + case "image/jpeg" : + $ext = ".jpg"; + break; + case "image/png" : + $ext = ".png"; + break; + case "image/gif" : + $ext = ".gif"; + break; + default: + $ext = ".jpg"; + break; + } + + $img = Image::factory($item['tmp_name']); + $file['wmax'] = (int)Option::get('news_wmax'); + $file['hmax'] = (int)Option::get('news_hmax'); + $file['w'] = (int)Option::get('news_w'); + $file['h'] = (int)Option::get('news_h'); + $file['resize'] = Option::get('news_resize'); + + NewsAdmin::ReSize($img, $folder, $uid.'_'.time().$ext, $file); + } + } + } + + } + + private static function deleteNews($uid) + { + $news = NewsAdmin::$news; + // Get specific news + $item = $news->select('[id="'.$uid.'"]', null); + + $opt['dir'] = ROOT . DS . 'public' . DS . 'uploads' . DS . 'news' . DS; + // Delete news and update fields + if ($news->deleteWhere('[slug="'.$item['slug'].'" ]')) { + + $_news = $news->select('[parent="'.$item['slug'].'"]'); + + if ( ! empty($_news)) { + foreach($_news as $news_item) { + $news->updateWhere('[slug="'.$news_item['slug'].'"]', array('parent' => '')); + rename($opt['dir'] . $item['slug'] . DS . $news_item['slug'], $opt['dir']. $news_item['slug']); + } + } + + if ($item['parent'] != "") + $item['parent'] = $item['parent'] . DS; + + Dir::delete($opt['dir'] . $item['parent'] . $item['slug']); + File::delete(STORAGE . DS . 'news' . DS . $item['id'] . '.news.txt'); + File::delete(STORAGE . DS . 'news' . DS . $item['id'] . '.short.news.txt'); + Notification::set('success', __('News :news deleted', 'news', array(':news' => Html::toText($item['title'])))); + } + } + + /** + * _requestAjax + */ + public static function _requestAjax() + { + if (Security::check(Request::get('csrf')) && Request::get('id') == 'news') { + if (Request::get('image') == true) { + View::factory('news/views/backend/addImg')->display(); + die(); + } + } + if (Security::check(Request::post('csrf')) && Request::get('id') == 'news') { + if (Request::get('delete') == "image") { + File::delete(Request::post('dir') . Request::post('id')); + File::delete(Request::post('dir') . 'thumbnail' . DS . Request::post('id')); + die(); + } + if (Request::get('delete') == "item") + { + if (is_array(Request::post('items'))) { + NewsAdmin::$news = new Table('news'); + foreach(Request::post('items') as $row) + { + NewsAdmin::deleteNews($row); + } + die ('deleted'); + } + die('delete item'); + } + } + //exit('no action'); + } + + private static function ReSize($img, $folder, $name, $opt) + { + $wmax = (int)$opt['wmax']; + $hmax = (int)$opt['hmax']; + $width = (int)$opt['w']; + $height = (int)$opt['h']; + $resize = $opt['resize']; + $ratio = $width/$height; + + if ($img->width > $wmax or $img->height > $hmax) { + if ($img->height > $img->width) { + $img->resize($wmax, $hmax, Image::HEIGHT); + } else { + $img->resize($wmax, $hmax, Image::WIDTH); + } + } + $img->save($folder.$name); + + switch ($resize) { + case 'width' : $img->resize($width, $height, Image::WIDTH); break; + case 'height' : $img->resize($width, $height, Image::HEIGHT); break; + case 'stretch' : $img->resize($width, $height); break; + default : + // crop + if (($img->width/$img->height) > $ratio) { + //$img->resize($width, $height, Image::HEIGHT)->crop($width, $height, round(($img->width-$width)/2),0); + $img->resize($width, $height, Image::HEIGHT); + } else { + //$img->resize($width, $height, Image::WIDTH)->crop($width, $height, 0, 0); + $img->resize($width, $height, Image::WIDTH); + } + break; + } + $img->save($folder.'thumbnail'.DS.$name); + } } \ No newline at end of file diff --git a/news.plugin.php b/news.plugin.php old mode 100644 new mode 100755 index 8acda43..53ddec4 --- a/news.plugin.php +++ b/news.plugin.php @@ -1,543 +1,541 @@ -select($query, 'all', null, array('id', 'slug', 'name', 'hits', 'date', 'parent')); - - $count_news = count($records_all); - - $opt['pages'] = ceil($count_news/$limit); - - $opt['page'] = (isset($uri[1]) and isset($uri[2]) and $uri[1] == 'page') ? (int)$uri[2] : 1; - - if($opt['page'] < 1 or $opt['page'] > $opt['pages']) { - News::error404(); - } else { - - $start = ($opt['page']-1)*$limit; - - $records_sort = Arr::subvalSort($records_all, 'date', 'DESC'); - - if($count_news > 0) $records = array_slice($records_sort, $start, $limit); - else $records = array(); - - News::$template = View::factory('news/views/frontend/index') - ->assign('records', $records) - ->assign('opt', $opt) - ->render(); - } - } - - /** - * Last news - *
- */ - public static function Last($count=3, $parent = '') { - return News::getNewsList($count, 'last', $parent); - } - - /** - * Best views - *
- */ - public static function TopViews($count=3, $parent = '') { - return News::getNewsList($count, 'views', $parent); - } - - /** - * News views - *
- */ - public static function Block($count=3, $parent = '') { - return News::getNewsList($count, 'block', $parent); - } - - /** - * Shortcode news - *
    {news list="last" count=3}
- *
    {news list="views" count=3}
- *
    {news list="block" count=3}
- */ - public static function _shortcode($attributes) { - extract($attributes); - - $count = (isset($count)) ? (int)$count : 3; - $parent = (isset($parent)) ? (string)$parent : ''; - if (isset($list)) { - return News::getNewsList($count, $list, $parent, false); - } - } - - /** - * List news - */ - private static function getNewsList($count, $action, $parent='', $display=true){ - $opt['site_url'] = Option::get('siteurl'); - News::$news = new Table('news'); - - $sort = ($action == 'views') ? 'hits' : 'date'; - - $records_all = News::$news->select('[status="published" and parent="'.$parent.'"]', 'all', null, array('id', 'slug', 'name', 'hits', 'date')); - $records_sort = Arr::subvalSort($records_all, $sort, 'DESC'); - - if(count($records_sort)>0) { - $records = array_slice($records_sort, 0, $count); - - switch($action) - { - case 'block': - $output = View::factory('news/views/frontend/block') - ->assign('records', $records) - ->assign('opt', $opt) - ->render(); - break; - case 'views': - $output = View::factory('news/views/frontend/views') - ->assign('records', $records) - ->assign('opt', $opt) - ->render(); - break; - default: - $output = View::factory('news/views/frontend/last') - ->assign('records', $records) - ->assign('opt', $opt) - ->render(); - break; - - } - - if($display) echo $output; else return $output; - } - } - - /** - * get Current news - */ - private static function getNewsBySlug($uri){ - if (isset($uri[2])) - { - $slug = $uri[2]; - $parent_name = News::$news->select('[slug="'.$uri[1].'"]', null); - } - else - $slug = $uri[1]; - $opt['site_url'] = Option::get('siteurl'); - $opt['url'] = $opt['site_url'] . 'public/uploads/news/'; - $opt['dir'] = ROOT . DS . 'public' . DS . 'uploads' . DS . 'news' . DS; - $record = News::$news->select('[slug="'.$slug.'"]', null); - News::$slug = $slug; - - if($record) { - News::$_news = $record; - - if(empty($record['title'])) $record['title'] = $record['name']; - - News::$meta['title'] = $record['title']; - News::$meta['keywords'] = $record['keywords']; - News::$meta['description'] = $record['description']; - - $record['hits'] = News::hits($record['id'], $record['hits']); - - News::$template = View::factory('news/views/frontend/item') - ->assign('item', $record) - ->assign('opt', $opt) - ->render(); - } else { - News::error404(); - } - } - - /** - * Get news breadcrumbs - * @author Pronin Andrey / KANekT - * - * - * echo News::Breadcrumbs(); - * - * - */ - public static function Breadcrumbs($item, $opt) - { - if ($item['parent'] != "") - { - $news = News::$news->select('[slug="'.$item['parent'].'"]', null); - $item['parent_name'] = $news['name']; - } - - // Display view - return View::factory('news/views/frontend/breadcrumbs') - ->assign('item', $item) - ->assign('opt', $opt) - ->render(); - } - - /** - * Get News content by id - * @author Pronin Andrey / KANekT - * - * - * echo News::ContentById(1, true); - * - * - * @return string - */ - public static function ContentById($id, $short=false) { - return News::getContentById($id, $short); - } - - private static function getContentById($id, $short=false) { - if($short) { - $content = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $id . '.short.news.txt')); - } else { - $content = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $id . '.news.txt')); - } - - return $content; - } - - /** - * Get tags - * @author Romanenko Sergey / Awilum - * - * - * echo News::Tags(); - * - * - * @return string - */ - public static function Tags($slug = null) { - - // Display view - return View::factory('news/views/frontend/tags') - ->assign('tags', News::getTagsArray($slug)) - ->render(); - - } - - /** - * Get tags array - * @author Romanenko Sergey / Awilum - * - * @return array - */ - private static function getTagsArray($slug = null) { - - // Init vars - $tags = array(); - $tags_string = ''; - - if ($slug == null) { - $posts = News::$news->select('[status="published"]', 'all'); - } else { - $posts = News::$news->select('[status="published" and slug="'.$slug.'"]', 'all'); - } - - foreach($posts as $post) { - $tags_string .= $post['tags'].','; - } - - $tags_string = substr($tags_string, 0, strlen($tags_string)-1); - - // Explode tags in tags array - $tags = explode(',', $tags_string); - - // Remove empty array elementss - foreach ($tags as $key => $value) { - if ($tags[$key] == '') { - unset($tags[$key]); - } - } - - // Trim tags - array_walk($tags, create_function('&$val', '$val = trim($val);')); - - // Get unique tags - $tags = array_unique($tags); - - // Return tags - return $tags; - } - - /** - * Get related news - * - * - * echo News::Related(); - * - * - * @return string - */ - public static function Related($limit = null) { - News::$news = new Table('news'); - - $uri = Uri::segments(); - if($uri[0] == 'news') { - if (isset($uri[2])) - { - News::$slug = $uri[2]; - } - if (isset($uri[1])) - { - News::$slug = $uri[1]; - } - } - return News::getRelated($limit); - } - - /** - * Get related posts - * @author Romanenko Sergey / Awilum - * - * @return string - */ - private static function getRelated($limit = null) { - - $related_posts = array(); - $tags = News::getTagsArray(News::$slug); - - foreach($tags as $tag) { - - $query = '[status="published" and contains(keywords, "'.$tag.'") and slug!="'.News::$slug.'"]'; - - if ($result = Arr::subvalSort(News::$news->select($query, ($limit == null) ? 'all' : (int)$limit), 'date', 'DESC')) { - $related_posts = $result; - } - } - - // Display view - return View::factory('news/views/frontend/related') - ->assign('related_posts', $related_posts) - ->render(); - - } - - - /** - * Get Children News - * - * @return string - */ - public static function Children($slug) - { - $child = Arr::subvalSort(News::$news->select('[parent="'.$slug.'"]', 'all'), 'date', 'DESC'); - - if ($child != null) - { - return View::factory('news/views/frontend/children') - ->assign('items', $child) - ->render(); - } - - return ''; - } - - public static function title(){ - return News::$meta['title']; - } - - public static function keywords(){ - return News::$meta['keywords']; - } - - public static function description(){ - return News::$meta['description']; - } - - public static function content(){ - $content = Filter::apply('content', News::$template); - return $content; - } - - public static function template() { - if (News::$_news['template'] == '') return Option::get('news_template'); else return News::$_news['template']; - } - - private static function error404() { - if (BACKEND == false) { - News::$template = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . '1.page.txt')); - News::$meta['title'] = 'error404'; - Response::status(404); - } - } - - private static function hits($id, $hits) { - if (Session::exists('hits'.$id) == false) { - $hits++; - if(News::$news->updateWhere('[id='.$id.']', array('hits' => $hits))) { - Session::set('hits'.$id, 1); - } - } - - return $hits; - } - - /** - * current page - * pages all - * site_url - * limit pages - */ - public static function paginator($current, $pages, $urls, $sections = 1, $limit_pages=10) { - - $content = ''; - if (is_array($urls)) - { - $url = $urls[0]; - $req = $urls[1]; - } - else{ - $url = $urls; - $req = ''; - } - if ($pages > 1) { - - // pages count > limit pages - if ($pages > $limit_pages) { - $start = ($current <= 6) ? 1 : $current-3; - $finish = (($pages-$limit_pages) > $current) ? ($start + $limit_pages - 1) : $pages; - } else { - $start = 1; - $finish = $pages; - } - - // pages list - $content .= ''; - } - return $content; - } - +select($query, 'all', null, array('id', 'slug', 'name', 'hits', 'date', 'parent')); + + $count_news = count($records_all); + + $opt['pages'] = ceil($count_news/$limit); + + $opt['page'] = (isset($uri[1]) and isset($uri[2]) and $uri[1] == 'page') ? (int)$uri[2] : 1; + + if($opt['page'] < 1 or $opt['page'] > $opt['pages']) { + News::error404(); + } else { + + $start = ($opt['page']-1)*$limit; + + $records_sort = Arr::subvalSort($records_all, 'date', 'DESC'); + + if($count_news > 0) $records = array_slice($records_sort, $start, $limit); + else $records = array(); + + News::$template = View::factory('news/views/frontend/index') + ->assign('records', $records) + ->assign('opt', $opt) + ->render(); + } + } + + /** + * Last news + *
+ */ + public static function Last($count=3, $parent = '') { + return News::getNewsList($count, 'last', $parent); + } + + /** + * Best views + *
+ */ + public static function TopViews($count=3, $parent = '') { + return News::getNewsList($count, 'views', $parent); + } + + /** + * News views + *
+ */ + public static function Block($count=3, $parent = '') { + return News::getNewsList($count, 'block', $parent); + } + + /** + * Shortcode news + *
    {news list="last" count=3}
+ *
    {news list="views" count=3}
+ *
    {news list="block" count=3}
+ */ + public static function _shortcode($attributes) { + extract($attributes); + + $count = (isset($count)) ? (int)$count : 3; + $parent = (isset($parent)) ? (string)$parent : ''; + if (isset($list)) { + return News::getNewsList($count, $list, $parent, false); + } + } + + /** + * List news + */ + private static function getNewsList($count, $action, $parent='', $display=true){ + $opt['site_url'] = Option::get('siteurl'); + News::$news = new Table('news'); + + $sort = ($action == 'views') ? 'hits' : 'date'; + + $records_all = News::$news->select('[status="published" and parent="'.$parent.'"]', 'all', null, array('id', 'slug', 'name', 'hits', 'date')); + $records_sort = Arr::subvalSort($records_all, $sort, 'DESC'); + + if(count($records_sort)>0) { + $records = array_slice($records_sort, 0, $count); + + switch($action) + { + case 'block': + $output = View::factory('news/views/frontend/block') + ->assign('records', $records) + ->assign('opt', $opt) + ->render(); + break; + case 'views': + $output = View::factory('news/views/frontend/views') + ->assign('records', $records) + ->assign('opt', $opt) + ->render(); + break; + default: + $output = View::factory('news/views/frontend/last') + ->assign('records', $records) + ->assign('opt', $opt) + ->render(); + break; + + } + + if($display) echo $output; else return $output; + } + } + + /** + * get Current news + */ + private static function getNewsBySlug($uri){ + if (isset($uri[2])) + { + $slug = $uri[2]; + $parent_name = News::$news->select('[slug="'.$uri[1].'"]', null); + } + else + $slug = $uri[1]; + $opt['site_url'] = Option::get('siteurl'); + $opt['url'] = $opt['site_url'] . 'public/uploads/news/'; + $opt['dir'] = ROOT . DS . 'public' . DS . 'uploads' . DS . 'news' . DS; + $record = News::$news->select('[slug="'.$slug.'"]', null); + News::$slug = $slug; + + if($record) { + News::$_news = $record; + + if(empty($record['title'])) $record['title'] = $record['name']; + + News::$meta['title'] = $record['title']; + News::$meta['keywords'] = $record['keywords']; + News::$meta['description'] = $record['description']; + + $record['hits'] = News::hits($record['id'], $record['hits']); + + News::$template = View::factory('news/views/frontend/item') + ->assign('item', $record) + ->assign('opt', $opt) + ->render(); + } else { + News::error404(); + } + } + + /** + * Get news breadcrumbs + * @author Pronin Andrey / KANekT + * + * + * echo News::Breadcrumbs(); + * + * + */ + public static function Breadcrumbs($item, $opt) + { + if ($item['parent'] != "") + { + $news = News::$news->select('[slug="'.$item['parent'].'"]', null); + $item['parent_name'] = $news['name']; + } + + // Display view + return View::factory('news/views/frontend/breadcrumbs') + ->assign('item', $item) + ->assign('opt', $opt) + ->render(); + } + + /** + * Get News content by id + * @author Pronin Andrey / KANekT + * + * + * echo News::ContentById(1, true); + * + * + * @return string + */ + public static function ContentById($id, $short=false) { + return News::getContentById($id, $short); + } + + private static function getContentById($id, $short=false) { + if($short) { + $content = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $id . '.short.news.txt')); + } else { + $content = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $id . '.news.txt')); + } + + return $content; + } + + /** + * Get tags + * @author Romanenko Sergey / Awilum + * + * + * echo News::Tags(); + * + * + * @return string + */ + public static function Tags($slug = null) { + + // Display view + return View::factory('news/views/frontend/tags') + ->assign('tags', News::getTagsArray($slug)) + ->render(); + + } + + /** + * Get tags array + * @author Romanenko Sergey / Awilum + * + * @return array + */ + private static function getTagsArray($slug = null) { + + // Init vars + $tags = array(); + $tags_string = ''; + + if ($slug == null) { + $posts = News::$news->select('[status="published"]', 'all'); + } else { + $posts = News::$news->select('[status="published" and slug="'.$slug.'"]', 'all'); + } + + foreach($posts as $post) { + $tags_string .= $post['tags'].','; + } + + $tags_string = substr($tags_string, 0, strlen($tags_string)-1); + + // Explode tags in tags array + $tags = explode(',', $tags_string); + + // Remove empty array elementss + foreach ($tags as $key => $value) { + if ($tags[$key] == '') { + unset($tags[$key]); + } + } + + // Trim tags + array_walk($tags, create_function('&$val', '$val = trim($val);')); + + // Get unique tags + $tags = array_unique($tags); + + // Return tags + return $tags; + } + + /** + * Get related news + * + * + * echo News::Related(); + * + * + * @return string + */ + public static function Related($limit = null) { + News::$news = new Table('news'); + + $uri = Uri::segments(); + if($uri[0] == 'news') { + if (isset($uri[2])) + { + News::$slug = $uri[2]; + } + if (isset($uri[1])) + { + News::$slug = $uri[1]; + } + } + return News::getRelated($limit); + } + + /** + * Get related posts + * @author Romanenko Sergey / Awilum + * + * @return string + */ + private static function getRelated($limit = null) { + + $related_posts = array(); + $tags = News::getTagsArray(News::$slug); + + foreach($tags as $tag) { + + $query = '[status="published" and contains(keywords, "'.$tag.'") and slug!="'.News::$slug.'"]'; + + if ($result = Arr::subvalSort(News::$news->select($query, ($limit == null) ? 'all' : (int)$limit), 'date', 'DESC')) { + $related_posts = $result; + } + } + + // Display view + return View::factory('news/views/frontend/related') + ->assign('related_posts', $related_posts) + ->render(); + + } + + + /** + * Get Children News + * + * @return string + */ + public static function Children($slug) + { + $child = Arr::subvalSort(News::$news->select('[parent="'.$slug.'"]', 'all'), 'date', 'DESC'); + + if ($child != null) + { + return View::factory('news/views/frontend/children') + ->assign('items', $child) + ->render(); + } + + return ''; + } + + public static function title(){ + return News::$meta['title']; + } + + public static function keywords(){ + return News::$meta['keywords']; + } + + public static function description(){ + return News::$meta['description']; + } + + public static function content(){ + $content = Filter::apply('content', News::$template); + return $content; + } + + public static function template() { + if (News::$_news['template'] == '') return Option::get('news_template'); else return News::$_news['template']; + } + + private static function error404() { + if (BACKEND == false) { + News::$template = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . '1.page.txt')); + News::$meta['title'] = 'error404'; + Response::status(404); + } + } + + private static function hits($id, $hits) { + if (Session::exists('hits'.$id) == false) { + $hits++; + if(News::$news->updateWhere('[id='.$id.']', array('hits' => $hits))) { + Session::set('hits'.$id, 1); + } + } + + return $hits; + } + + /** + * current page + * pages all + * site_url + * limit pages + */ + public static function paginator($current, $pages, $urls, $sections = 1, $limit_pages=10) { + + $content = ''; + if (is_array($urls)) + { + $url = $urls[0]; + $req = $urls[1]; + } + else{ + $url = $urls; + $req = ''; + } + if ($pages > 1) { + + // pages count > limit pages + if ($pages > $limit_pages) { + $start = ($current <= 6) ? 1 : $current-3; + $finish = (($pages-$limit_pages) > $current) ? ($start + $limit_pages - 1) : $pages; + } else { + $start = 1; + $finish = $pages; + } + + // pages list + $content .= ''; + } + return $content; + } + } \ No newline at end of file diff --git a/views/backend/add.view.php b/views/backend/add.view.php old mode 100644 new mode 100755 index ad60c62..341b541 --- a/views/backend/add.view.php +++ b/views/backend/add.view.php @@ -1,140 +1,186 @@ -
-
- -

-
- - 'form_validate','enctype' => 'multipart/form-data')). - Form::hidden('csrf', Security::token()) - ); - ?> - - - -
-
- 'required span6')). - - Form::label('news_slug', __('Name (slug)', 'news')). - Form::input('news_slug', $item['slug'], array('class' => 'span6')) - ); - ?> -
-
- 'span8')). - Form::label('news_title', __('Title', 'news')). - Form::input('news_title', $item['title'], array('class' => 'span6')). - Form::label('news_tags', __('Tags', 'news')). - Form::input('news_tags', $item['tags'], array('class' => 'span8')). - Form::label('news_description', __('Description', 'news')). - Form::textarea('news_description', $item['description'], array('class' => 'span8')) - ); - echo ( - Html::br(2). - Form::label('news_robots', __('Search Engines Robots', 'news')). - 'no Index'.Html::nbsp().Form::checkbox('news_robots_index', 'index', $item['robots_index']).Html::nbsp(2). - 'no Follow'.Html::nbsp().Form::checkbox('news_robots_follow', 'follow', $item['robots_follow']) - ); - ?> -
-
-
-
- -
-
- -
-
- -
-
- -
-
-
-
-
    -
  • -
    -
    -
    - - - - - - -
    -
    -
  • -
-
-
- -
-
-
-
-
- 'required', 'style' => 'width: 100%; height: 100px;')); ?> - - -
- -
-
- 'btn')).Html::nbsp(2). - Form::submit('add_news', __('Save', 'news'), array('class' => 'btn')) - ); - ?> -
-
-
- : 'input-large')); ?> - : 'input-large')); ?> -
- -
-
-
+

+
+ + 'form_validate','enctype' => 'multipart/form-data')). + Form::hidden('csrf', Security::token()) +); +?> + + + +
+
+
+ 'required form-control')) + ); + ?> +
+
+ 'form-control')) + ); + ?> +
+
+
+
+ 'form-control')) + ); + ?> +
+
+ 'form-control')) + ); + ?> +
+
+ 'form-control')) + ); + ?> +
+
+ +
+
+
+
+
+ 'form-control')) + ); + ?> +
+
+ 'form-control')) + ); + ?> +
+
+ 'form-control')) + ); + ?> +
+
+ 'form-control')) + ); + ?> +
+
+
+
+
    +
  • +
    +
    +
    + + + + + + +
    +
    +
  • +
+
+
+ +
+
+
+
+
+ 'required form-control', 'style' => 'width: 100%; height: 100px;')) + ) + ?> +
+
+
+ +
+
+
+
+
+
+ 'form-control')) + ); + ?> + + + +
+
+
+
+
+
+ 'btn btn-primary')).Html::nbsp(2). + Form::submit('add_news', __('Save', 'news'), array('class' => 'btn btn-primary')).Html::nbsp(2). + Html::anchor(__('Cancel', 'news'), 'index.php?id=news', array('title' => __('Cancel', 'news'), 'class' => 'btn btn-default')) + ); + ?> +
+
+
+
+ 'form-control')); ?> + 'form-control')); ?> + + + +
+
+ +
\ No newline at end of file diff --git a/views/backend/addImg.view.php b/views/backend/addImg.view.php old mode 100644 new mode 100755 index e31be8f..7c6d969 --- a/views/backend/addImg.view.php +++ b/views/backend/addImg.view.php @@ -1,13 +1,13 @@ -
  • -
    -
    -
    - - - - - - -
    -
    +
  • +
    +
    +
    + + + + + + +
    +
  • \ No newline at end of file diff --git a/views/backend/edit.view.php b/views/backend/edit.view.php old mode 100644 new mode 100755 index 709ee63..5bf6157 --- a/views/backend/edit.view.php +++ b/views/backend/edit.view.php @@ -1,167 +1,213 @@ -
    -
    - -

    -
    - - 'form_validate','enctype' => 'multipart/form-data')). - Form::hidden('csrf', Security::token()). - Form::hidden('old_parent', $item['parent']). - Form::hidden('old_slug', $item['slug']). - Form::hidden('news_id', $item['id']) - ); - ?> - - - -
    -
    - 'required span6')). - - Form::label('news_slug', __('Name (slug)', 'news')). - Form::input('news_slug', $item['slug'], array('class' => 'span6')) - ); - ?> -
    -
    - 'span8')). - Form::label('news_title', __('Title', 'news')). - Form::input('news_title', $item['title'], array('class' => 'span6')). - Form::label('news_tags', __('Tags', 'news')). - Form::input('news_tags', $item['tags'], array('class' => 'span8')). - Form::label('news_description', __('Description', 'news')). - Form::textarea('news_description', $item['description'], array('class' => 'span8')) - ); - echo ( - Html::br(2). - Form::label('news_robots', __('Search Engines Robots', 'news')). - 'no Index'.Html::nbsp().Form::checkbox('news_robots_index', 'index', $item['robots_index']).Html::nbsp(2). - 'no Follow'.Html::nbsp().Form::checkbox('news_robots_follow', 'follow', $item['robots_follow']) - ); - ?> -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
      - -
    • -
      -
      - - - -
      -
      - - - - - - -
      -
      -
    • - -
    -
    -
    - -
    -
    -
    -
    -
    - 'required', 'style' => 'width: 100%; height: 100px;')); ?> - - -
    - -
    -
    - 'btn')).Html::nbsp(2). - Form::submit('edit_news', __('Save', 'news'), array('class' => 'btn')) - ); - ?> -
    -
    -
    - : 'input-large')); ?> - : 'input-large')); ?> -
    - -
    -
    -
    +

    +
    + + 'form_validate','enctype' => 'multipart/form-data')). + Form::hidden('csrf', Security::token()). + Form::hidden('old_parent', $item['parent']). + Form::hidden('old_slug', $item['slug']). + Form::hidden('news_id', $item['id']) +); +?> + + + +
    +
    +
    + 'required form-control')) + ); + ?> +
    +
    + 'form-control')) + ); + ?> +
    +
    +
    +
    + 'form-control')) + ); + ?> +
    +
    + 'form-control')) + ); + ?> +
    +
    + 'form-control')) + ); + ?> +
    +
    + +
    +
    +
    +
    +
    + 'form-control')) + ); + ?> +
    +
    + 'form-control')) + ); + ?> +
    +
    + 'form-control')) + ); + ?> +
    +
    + 'form-control')) + ); + ?> +
    +
    +
    +
    +
      + +
    • +
      +
      + + + +
      +
      + + + + + + +
      +
      +
    • + +
    +
    +
    + +
    +
    +
    +
    +
    + 'required form-control', 'style' => 'width: 100%; height: 100px;')) + ) + ?> +
    +
    +
    + +
    +
    +
    +
    +
    +
    + 'form-control')) + ); + ?> + + + +
    +
    +
    +
    +
    +
    + 'btn btn-primary')).Html::nbsp(2). + Form::submit('edit_news', __('Save', 'news'), array('class' => 'btn btn-primary')).Html::nbsp(2). + Html::anchor(__('Cancel', 'news'), 'index.php?id=news', array('title' => __('Cancel', 'news'), 'class' => 'btn btn-default')) + ); + ?> +
    +
    +
    +
    + 'form-control')); ?> + 'form-control')); ?> + + + +
    +
    + +
    \ No newline at end of file diff --git a/views/backend/index.view.php b/views/backend/index.view.php old mode 100644 new mode 100755 index 76eb997..df0e730 --- a/views/backend/index.view.php +++ b/views/backend/index.view.php @@ -1,146 +1,142 @@ - - -
    -
    - -

    -
    - __('Create new news', 'news'), 'class' => 'btn btn-small')) ?> - - -
    -
    - - - -
    -

    -
    - - - - - - - - - - - - - - - - - - rel="children_" > - - - - - - - - - - -
    -
    - - - -
    -
    - -'; - } else { - $dash = Html::arrow('right').'  '; - } - ?> - - '_blank', 'rel' => 'children_'.$item['parent'])); - ?> - - - - - - - - - -
    - 'btn btn-small')); ?> - - - -
    -
    - -
    -
    + + +
    +
    +

    +
    + __('Create new news', 'news'), 'class' => 'btn btn-primary')) ?> +
    +
    + __('Settings', 'news'), 'class' => 'btn btn-default')) ?> + 'button', 'data-toggle' => 'modal', 'class' => 'btn btn-default'));?> +
    +
    + + + +
    +

    +
    + + + + + + + + + + + + + + + + + + rel="children_" > + + + + + + + + + + +
    +
    + + + +
    +
    + -'; + } else { + $dash = Html::arrow('right').'  '; + } + ?> + + '_blank', 'rel' => 'children_'.$item['parent'])); + ?> + + + + + + + + + +
    + 'btn btn-small')); ?> + + + +
    +
    + +
    +
    render();?> \ No newline at end of file diff --git a/views/backend/modal.view.php b/views/backend/modal.view.php old mode 100644 new mode 100755 index 6b5eecc..ed40c24 --- a/views/backend/modal.view.php +++ b/views/backend/modal.view.php @@ -1,48 +1,50 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/views/backend/settings.view.php b/views/backend/settings.view.php old mode 100644 new mode 100755 index 5d69378..02201ea --- a/views/backend/settings.view.php +++ b/views/backend/settings.view.php @@ -1,37 +1,45 @@ -

    - - __('Respect to the width', 'news'), - 'height' => __('Respect to the height', 'news'), - 'crop' => __('Similarly, cutting unnecessary', 'news'), - 'stretch' => __('Similarly with the expansion', 'news'), -); -echo ( - Form::open(). - '
    '. - '
    '. - Form::label('limit', __('News per page (website)', 'news')). - Form::input('limit', Option::get('news_limit')). - Form::label('width_thumb', __('Width thumbnails (px)', 'news')). - Form::input('width_thumb', Option::get('news_w')). - Form::label('height_thumb', __('Height thumbnails (px)', 'news')). - Form::input('height_thumb', Option::get('news_h')). - Form::label('resize', __('Resize', 'news')). - Form::select('resize', $resize, Option::get('news_resize')).Html::Br(). - Form::submit('news_submit_settings', __('Save', 'news'), array('class' => 'btn')).Html::Nbsp(2). - Form::submit('news_submit_settings_cancel', __('Cancel', 'news'), array('class' => 'btn')). - '
    '. - '
    '. - Form::label('limit_admin', __('News per page (admin)', 'news')). - Form::input('limit_admin', Option::get('news_limit_admin')). - Form::label('width_orig', __('Original width (px, max)', 'news')). - Form::input('width_orig', Option::get('news_wmax')). - Form::label('height_orig', __('Original height (px, max)', 'news')). - Form::input('height_orig', Option::get('news_hmax')). - Form::hidden('csrf', Security::token()).Html::Br(3). - '
    '. - '
    '. - Form::close() -); +

    + + __('Respect to the width', 'news'), + 'height' => __('Respect to the height', 'news'), + 'crop' => __('Similarly, cutting unnecessary', 'news'), + 'stretch' => __('Similarly with the expansion', 'news'), +); +echo ( + Form::open(). + '
    '. + '
    '.'
    '. + Form::label('limit', __('News per page (website)', 'news')). + Form::input('limit', Option::get('news_limit'), array('class' => 'form-control')). + '
    '.'
    '. + Form::label('width_thumb', __('Width thumbnails (px)', 'news')). + Form::input('width_thumb', Option::get('news_w'), array('class' => 'form-control')). + '
    '.'
    '. + Form::label('height_thumb', __('Height thumbnails (px)', 'news')). + Form::input('height_thumb', Option::get('news_h'), array('class' => 'form-control')). + '
    '.'
    '. + Form::label('resize', __('Resize', 'news')). + Form::select('resize', $resize, Option::get('news_resize'), array('class' => 'form-control')).Html::Br(). + '
    '.'
    '. + Form::submit('news_submit_settings', __('Save', 'news'), array('class' => 'btn')).Html::Nbsp(2). + Form::submit('news_submit_settings_cancel', __('Cancel', 'news'), array('class' => 'btn')). + '
    '.'
    '. + '
    '. + '
    '. + Form::label('limit_admin', __('News per page (admin)', 'news')). + Form::input('limit_admin', Option::get('news_limit_admin'), array('class' => 'form-control')). + '
    '.'
    '. + Form::label('width_orig', __('Original width (px, max)', 'news')). + Form::input('width_orig', Option::get('news_wmax'), array('class' => 'form-control')). + '
    '.'
    '. + Form::label('height_orig', __('Original height (px, max)', 'news')). + Form::input('height_orig', Option::get('news_hmax'), array('class' => 'form-control')). + '
    '. + Form::hidden('csrf', Security::token()).Html::Br(3). + '
    '. + '
    '. + Form::close() +); ?> \ No newline at end of file diff --git a/views/frontend/block.view.php b/views/frontend/block.view.php old mode 100644 new mode 100755 index a13cad0..0d63ef9 --- a/views/frontend/block.view.php +++ b/views/frontend/block.view.php @@ -1,7 +1,7 @@ - -
  • -

    - -

    -
  • + +
  • +

    + +

    +
  • \ No newline at end of file diff --git a/views/frontend/breadcrumbs.view.php b/views/frontend/breadcrumbs.view.php old mode 100644 new mode 100755 index ca5d1dd..a463779 --- a/views/frontend/breadcrumbs.view.php +++ b/views/frontend/breadcrumbs.view.php @@ -1,7 +1,7 @@ -