Commit eaf6988b09d67e45ed8af7a243b1c84752506d37
1 parent
60167da5
big commti
Showing
13 changed files
with
261 additions
and
953 deletions
Show diff stats
backend/config/main.php
@@ -61,6 +61,11 @@ return [ | @@ -61,6 +61,11 @@ return [ | ||
61 | 'actions' => ['index'], | 61 | 'actions' => ['index'], |
62 | 'allow' => true, | 62 | 'allow' => true, |
63 | 'roles' => ['@'], | 63 | 'roles' => ['@'], |
64 | + ], | ||
65 | + [ | ||
66 | + 'actions' => ['images'], | ||
67 | + 'allow' => true, | ||
68 | + 'roles' => ['@'], | ||
64 | ] | 69 | ] |
65 | 70 | ||
66 | ], | 71 | ], |
backend/controllers/SiteController.php
1 | <?php | 1 | <?php |
2 | namespace backend\controllers; | 2 | namespace backend\controllers; |
3 | +use common\modules\product\models\ProductImage; | ||
3 | use developeruz\db_rbac\behaviors\AccessBehavior; | 4 | use developeruz\db_rbac\behaviors\AccessBehavior; |
4 | use common\modules\product\models\Brand; | 5 | use common\modules\product\models\Brand; |
5 | use common\modules\product\models\Category; | 6 | use common\modules\product\models\Category; |
@@ -46,6 +47,27 @@ class SiteController extends Controller | @@ -46,6 +47,27 @@ class SiteController extends Controller | ||
46 | ]; | 47 | ]; |
47 | } | 48 | } |
48 | 49 | ||
50 | + | ||
51 | + public function actionImages(){ | ||
52 | + $files = ProductImage::find()->all(); | ||
53 | + foreach($files as $file_object){ | ||
54 | + $file = $file_object->image; | ||
55 | + $file_array = explode('/',$file); | ||
56 | + if(is_array($file_array) && count($file_array) >3){ | ||
57 | + $count = count($file_array); | ||
58 | + $file_name = $file_array[$count-2]."_".$file_array[$count-1]; | ||
59 | + print_r($file_name); | ||
60 | + $save_image = Yii::getAlias('@productsDir') . "/" . $file_name; | ||
61 | + copy($file, $save_image); | ||
62 | + $file_object->image = $file_name; | ||
63 | + $file_object->save(); | ||
64 | + } | ||
65 | + | ||
66 | + } | ||
67 | + | ||
68 | + | ||
69 | + } | ||
70 | + | ||
49 | public function actionIndex() | 71 | public function actionIndex() |
50 | { | 72 | { |
51 | $blog = new Blog(); | 73 | $blog = new Blog(); |
common/models/Customer.php
@@ -252,6 +252,16 @@ class Customer extends User implements \yii\web\IdentityInterface | @@ -252,6 +252,16 @@ class Customer extends User implements \yii\web\IdentityInterface | ||
252 | $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); | 252 | $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); |
253 | } | 253 | } |
254 | 254 | ||
255 | + public static function findByEmail($email) | ||
256 | + { | ||
257 | + return static::findOne(['email' => $email, 'status' => self::STATUS_ACTIVE]); | ||
258 | + } | ||
259 | + | ||
260 | + public function getName(){ | ||
261 | + return $this->username. ' '.$this->surname; | ||
262 | + } | ||
263 | + | ||
264 | + | ||
255 | /** | 265 | /** |
256 | * Removes password reset token | 266 | * Removes password reset token |
257 | */ | 267 | */ |
1 | <?php | 1 | <?php |
2 | - | ||
3 | namespace common\models; | 2 | namespace common\models; |
4 | 3 | ||
5 | use Yii; | 4 | use Yii; |
6 | use yii\base\Model; | 5 | use yii\base\Model; |
7 | 6 | ||
8 | /** | 7 | /** |
9 | - * LoginForm is the model behind the login form. | 8 | + * Login form |
10 | */ | 9 | */ |
11 | class LoginForm extends Model | 10 | class LoginForm extends Model |
12 | { | 11 | { |
13 | - public $username; | ||
14 | public $password; | 12 | public $password; |
15 | - public $rememberMe; | 13 | + public $rememberMe = true; |
14 | + public $email; | ||
16 | 15 | ||
17 | - private $_user = false; | 16 | + private $_user; |
18 | 17 | ||
19 | 18 | ||
20 | /** | 19 | /** |
21 | - * @return array the validation rules. | 20 | + * @inheritdoc |
22 | */ | 21 | */ |
23 | public function rules() | 22 | public function rules() |
24 | { | 23 | { |
25 | return [ | 24 | return [ |
26 | // username and password are both required | 25 | // username and password are both required |
27 | - [['username', 'password'], 'required'], | 26 | + [['email', 'password'], 'required'], |
28 | // rememberMe must be a boolean value | 27 | // rememberMe must be a boolean value |
29 | ['rememberMe', 'boolean'], | 28 | ['rememberMe', 'boolean'], |
30 | // password is validated by validatePassword() | 29 | // password is validated by validatePassword() |
@@ -32,15 +31,6 @@ class LoginForm extends Model | @@ -32,15 +31,6 @@ class LoginForm extends Model | ||
32 | ]; | 31 | ]; |
33 | } | 32 | } |
34 | 33 | ||
35 | - public function attributeLabels() | ||
36 | - { | ||
37 | - return [ | ||
38 | - 'username'=>'Логин', | ||
39 | - 'password'=>'Пароль', | ||
40 | - 'rememberMe'=>'Запомнить', | ||
41 | - ]; | ||
42 | - } | ||
43 | - | ||
44 | /** | 34 | /** |
45 | * Validates the password. | 35 | * Validates the password. |
46 | * This method serves as the inline validation for password. | 36 | * This method serves as the inline validation for password. |
@@ -52,7 +42,6 @@ class LoginForm extends Model | @@ -52,7 +42,6 @@ class LoginForm extends Model | ||
52 | { | 42 | { |
53 | if (!$this->hasErrors()) { | 43 | if (!$this->hasErrors()) { |
54 | $user = $this->getUser(); | 44 | $user = $this->getUser(); |
55 | - | ||
56 | if (!$user || !$user->validatePassword($this->password)) { | 45 | if (!$user || !$user->validatePassword($this->password)) { |
57 | $this->addError($attribute, 'Incorrect username or password.'); | 46 | $this->addError($attribute, 'Incorrect username or password.'); |
58 | } | 47 | } |
@@ -61,12 +50,13 @@ class LoginForm extends Model | @@ -61,12 +50,13 @@ class LoginForm extends Model | ||
61 | 50 | ||
62 | /** | 51 | /** |
63 | * Logs in a user using the provided username and password. | 52 | * Logs in a user using the provided username and password. |
53 | + * | ||
64 | * @return boolean whether the user is logged in successfully | 54 | * @return boolean whether the user is logged in successfully |
65 | */ | 55 | */ |
66 | public function login() | 56 | public function login() |
67 | { | 57 | { |
68 | if ($this->validate()) { | 58 | if ($this->validate()) { |
69 | - return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); | 59 | + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); |
70 | } else { | 60 | } else { |
71 | return false; | 61 | return false; |
72 | } | 62 | } |
@@ -77,12 +67,24 @@ class LoginForm extends Model | @@ -77,12 +67,24 @@ class LoginForm extends Model | ||
77 | * | 67 | * |
78 | * @return User|null | 68 | * @return User|null |
79 | */ | 69 | */ |
80 | - public function getUser() | 70 | + protected function getUser() |
81 | { | 71 | { |
82 | - if ($this->_user === false) { | ||
83 | - $this->_user = User::findByUsername($this->username); | 72 | + if ($this->_user === null) { |
73 | + $this->_user = Customer::findByEmail($this->email); | ||
84 | } | 74 | } |
85 | 75 | ||
86 | return $this->_user; | 76 | return $this->_user; |
87 | } | 77 | } |
78 | + | ||
79 | + | ||
80 | + | ||
81 | + /** | ||
82 | + * @inheritdoc | ||
83 | + */ | ||
84 | + public function attributeLabels() | ||
85 | + { | ||
86 | + return [ | ||
87 | + 'rememberMe' => Yii::t('app', 'rememberMe'), | ||
88 | + ]; | ||
89 | + } | ||
88 | } | 90 | } |
common/modules/product/models/Import.php
@@ -376,8 +376,6 @@ class Import extends Model { | @@ -376,8 +376,6 @@ class Import extends Model { | ||
376 | { | 376 | { |
377 | if (! empty ($data[$i])) | 377 | if (! empty ($data[$i])) |
378 | { | 378 | { |
379 | - print_r($data); | ||
380 | - die(); | ||
381 | $mod_arr = explode ('=', $data[$i]); | 379 | $mod_arr = explode ('=', $data[$i]); |
382 | $mod_art = $mod_arr[0]; | 380 | $mod_art = $mod_arr[0]; |
383 | $variant_filters = explode ('*', $mod_arr[1]); | 381 | $variant_filters = explode ('*', $mod_arr[1]); |
@@ -435,17 +433,17 @@ class Import extends Model { | @@ -435,17 +433,17 @@ class Import extends Model { | ||
435 | 433 | ||
436 | if ($mod_image) { | 434 | if ($mod_image) { |
437 | 435 | ||
438 | -// $source_image = Yii::getAlias('@uploadDir') . '/product_images/'. urlencode($mod_image); | ||
439 | -// if (file_exists($source_image)) { | 436 | + $source_image = Yii::getAlias('@uploadDir') . '/product_images/'. urlencode($mod_image); |
437 | + if (file_exists($source_image)) { | ||
440 | if (($variantImage = ProductImage::find()->andFilterWhere(['ilike', 'image', $mod_image])->andFilterWhere(['product_variant_id' => $_productVariant->product_variant_id])->one()) === null) { | 438 | if (($variantImage = ProductImage::find()->andFilterWhere(['ilike', 'image', $mod_image])->andFilterWhere(['product_variant_id' => $_productVariant->product_variant_id])->one()) === null) { |
441 | - // copy($source_image, Yii::getAlias('@productsDir') . "/" . $mod_image); | 439 | + copy($source_image, Yii::getAlias('@productsDir') . "/" . $mod_image); |
442 | $variantImage = new ProductImage(); | 440 | $variantImage = new ProductImage(); |
443 | $variantImage->product_id = $_product->product_id; | 441 | $variantImage->product_id = $_product->product_id; |
444 | $variantImage->product_variant_id = $_productVariant->product_variant_id; | 442 | $variantImage->product_variant_id = $_productVariant->product_variant_id; |
445 | $variantImage->image = $mod_image; | 443 | $variantImage->image = $mod_image; |
446 | $variantImage->save(); | 444 | $variantImage->save(); |
447 | } | 445 | } |
448 | - //} | 446 | + } |
449 | } | 447 | } |
450 | } | 448 | } |
451 | } | 449 | } |
frontend/assets/AppAsset.php
frontend/views/layouts/main.php
@@ -43,37 +43,6 @@ AppAsset::register($this); | @@ -43,37 +43,6 @@ AppAsset::register($this); | ||
43 | ga('send', 'pageview'); | 43 | ga('send', 'pageview'); |
44 | 44 | ||
45 | </script> | 45 | </script> |
46 | - <!--endgoogle--> | ||
47 | - | ||
48 | - | ||
49 | - <!-- Yandex.Metrika counter --> | ||
50 | - <script type="text/javascript"> | ||
51 | - (function (d, w, c) { | ||
52 | - (w[c] = w[c] || []).push(function() { | ||
53 | - try { | ||
54 | - w.yaCounter27356501 = new Ya.Metrika({id:27356501, | ||
55 | - webvisor:true, | ||
56 | - clickmap:true, | ||
57 | - trackLinks:true, | ||
58 | - accurateTrackBounce:true}); | ||
59 | - } catch(e) { } | ||
60 | - }); | ||
61 | - | ||
62 | - var n = d.getElementsByTagName("script")[0], | ||
63 | - s = d.createElement("script"), | ||
64 | - f = function () { n.parentNode.insertBefore(s, n); }; | ||
65 | - s.type = "text/javascript"; | ||
66 | - s.async = true; | ||
67 | - s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js"; | ||
68 | - | ||
69 | - if (w.opera == "[object Opera]") { | ||
70 | - d.addEventListener("DOMContentLoaded", f, false); | ||
71 | - } else { f(); } | ||
72 | - })(document, window, "yandex_metrika_callbacks"); | ||
73 | - </script> | ||
74 | - <noscript><div><img src="//mc.yandex.ru/watch/27356501" style="position:absolute; left:-9999px;" alt="" /></div></noscript> | ||
75 | - <!-- /Yandex.Metrika counter --> | ||
76 | - | ||
77 | 46 | ||
78 | 47 | ||
79 | </head> | 48 | </head> |
@@ -153,7 +122,13 @@ AppAsset::register($this); | @@ -153,7 +122,13 @@ AppAsset::register($this); | ||
153 | <li><a href="http://www.linija-svitla.ua/payment.htm">Оплата</a></li> | 122 | <li><a href="http://www.linija-svitla.ua/payment.htm">Оплата</a></li> |
154 | <li><a href="http://www.linija-svitla.ua/delivery.htm">Доставка</a></li> | 123 | <li><a href="http://www.linija-svitla.ua/delivery.htm">Доставка</a></li> |
155 | <li><a href="http://www.linija-svitla.ua/contacts.htm">Контакты</a></li> | 124 | <li><a href="http://www.linija-svitla.ua/contacts.htm">Контакты</a></li> |
156 | - <li><a href="#" data-toggle="modal" data-target="#myAccount">Личный кабинет</a></li> | 125 | + <?php |
126 | + if (Yii::$app->user->isGuest) { ?> | ||
127 | + <li><a href="#" data-toggle="modal" data-target="#myAccount">Личный кабинет</a></li> | ||
128 | + <?php } else { ?> | ||
129 | + <li><?= Html::a( Yii::$app->user->identity->username , Url::toRoute(['cabinet/index'])); ?></li> | ||
130 | + <?php } ?> | ||
131 | + | ||
157 | </ul> | 132 | </ul> |
158 | <div id="top-cart" class="pull-right"> | 133 | <div id="top-cart" class="pull-right"> |
159 | <button class="btn btn-cart ">Корзина <i></i></button> | 134 | <button class="btn btn-cart ">Корзина <i></i></button> |
@@ -549,71 +524,17 @@ AppAsset::register($this); | @@ -549,71 +524,17 @@ AppAsset::register($this); | ||
549 | 524 | ||
550 | 525 | ||
551 | <!-- Modal's --> | 526 | <!-- Modal's --> |
552 | - <div class="modal fade" id="myAccount" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
553 | - <div class="modal-dialog auth" role="document"> | ||
554 | - <div class="modal-content"> | ||
555 | 527 | ||
556 | - <div class="modal-header"> | ||
557 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
558 | - <h4 class="modal-title" id="myModalLabel">Вход в личный кабинет</h4> | ||
559 | - </div> | ||
560 | 528 | ||
561 | - <div class="modal-body"> | ||
562 | 529 | ||
563 | - <form action="index.php?p=login" method="post" name="enter_form_modal"> | ||
564 | - <div class="form-group"> | ||
565 | - <label for="InputEmail1">Email</label> | ||
566 | - <input type="email" name="login" class="form-control" id="InputEmail1" placeholder="Email" required> | ||
567 | - </div> | ||
568 | - <div class="form-group"> | ||
569 | - <label for="InputPassword1">Пароль</label> | ||
570 | - <input type="password" name="pwd" class="form-control" id="InputPassword1" placeholder="Пароль" required> | ||
571 | - </div> | ||
572 | - <button type="submit" class="btn btn-default">Войти</button> | ||
573 | - <ul class="ul links"> | ||
574 | - <li><a href="#" data-dismiss="modal" data-toggle="modal" data-target="#forgotPass">Напомнить пароль</a></li> | ||
575 | - <li><a href="#" data-dismiss="modal" data-toggle="modal" data-target="#regMe">Создать новый профиль</a></li> | ||
576 | - </ul> | ||
577 | - </form> | ||
578 | - <br /> | 530 | +<!-- login window --> |
531 | +<?= $this->render('/modal/login_window_model_window') ?> | ||
579 | 532 | ||
580 | - </div> | ||
581 | - | ||
582 | - <div class="modal-footer"> | ||
583 | - </div> | ||
584 | - | ||
585 | - </div> | ||
586 | - </div> | ||
587 | - </div> | ||
588 | - | ||
589 | - <div class="modal fade" id="forgotPass" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2"> | ||
590 | - <div class="modal-dialog auth" role="document"> | ||
591 | - <div class="modal-content"> | ||
592 | - | ||
593 | - <div class="modal-header"> | ||
594 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
595 | - <h4 class="modal-title" id="myModalLabel2">Напомнить пароль</h4> | ||
596 | - </div> | ||
597 | - | ||
598 | - <div class="modal-body"> | ||
599 | - | ||
600 | - <form> | ||
601 | - <div class="form-group"> | ||
602 | - <label for="InputEmail1">Email</label> | ||
603 | - <input type="email" class="form-control" id="InputEmail1" placeholder="Email"> | ||
604 | - </div> | ||
605 | - <p>Введите адрес почты, который вы указали при регистрации. На этот адрес отправим пароль.</p> | ||
606 | - <p><a class="popup" href="#" data-dismiss="modal" data-toggle="modal" data-target="#myAccount">← Я вспомнил пароль</a></p> | ||
607 | - <button type="submit" class="btn btn-large btn-default">Напомнить пароль</button> | ||
608 | - </form> | ||
609 | - <br /> | ||
610 | - <div class="clearfix"></div> | ||
611 | - </div> | ||
612 | - | ||
613 | - </div> | ||
614 | - </div> | ||
615 | - </div> | 533 | +<!-- registration window --> |
534 | +<?= $this->render('/modal/registration_window_model_window')?> | ||
616 | 535 | ||
536 | +<!-- forgot password form --> | ||
537 | +<?= $this->render('/modal/forgot_password_form_model_window') ?> | ||
617 | <div class="modal fade" id="price_drop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3"> | 538 | <div class="modal fade" id="price_drop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3"> |
618 | <div class="modal-dialog auth" role="document"> | 539 | <div class="modal-dialog auth" role="document"> |
619 | <div class="modal-content"> | 540 | <div class="modal-content"> |
@@ -700,67 +621,7 @@ AppAsset::register($this); | @@ -700,67 +621,7 @@ AppAsset::register($this); | ||
700 | </div> | 621 | </div> |
701 | </div> | 622 | </div> |
702 | 623 | ||
703 | - <div class="modal fade" id="regMe" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2"> | ||
704 | - <div class="modal-dialog auth" role="document"> | ||
705 | - <div class="modal-content"> | ||
706 | 624 | ||
707 | - <div class="modal-header"> | ||
708 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
709 | - <h4 class="modal-title" id="myModalLabel2">Создание профиля</h4> | ||
710 | - </div> | ||
711 | - | ||
712 | - <div class="modal-body"> | ||
713 | - <div class="notification success" style="display:none"> | ||
714 | - <h4>Спасибо за регистрацию!</h4> | ||
715 | - <span class="firstName"><!--Юрий тест, --></span> | ||
716 | - Вы были успешно зарегистрированы на ресурсе! <br> | ||
717 | - На Ваш почтовый ящик выслано письмо с инструкцией по активации Вашего логина | ||
718 | - </div> | ||
719 | - <div class="notification error" style="display:none"> | ||
720 | - <span class="strong">Произошла ошибка корректности ввода или данный логин уже занят. </span><br> | ||
721 | - Попробуйте проверить введенные данные и повторить запрос. | ||
722 | - </div> | ||
723 | - | ||
724 | - <form name="RegistrationForm" id="RegistrationFormModal" action="register_user.htm" method="post" > | ||
725 | - <div class="form-group"> | ||
726 | - <label for="InputName3">Имя:</label> | ||
727 | - <input name="firstName" class="form-control" id="InputName3" placeholder="" required> | ||
728 | - </div> | ||
729 | - <div class="form-group"> | ||
730 | - <label for="phone2">Телефон:</label> | ||
731 | - <input name="phone" class="form-control phone" id="phone2" placeholder="" required> | ||
732 | - </div> | ||
733 | - | ||
734 | - <div class="form-group"> | ||
735 | - <label for="InputEmail3">Email:</label> | ||
736 | - <input type="email" name="email" class="form-control" id="InputEmail3" placeholder="" required> | ||
737 | - </div> | ||
738 | - <div class="form-group"> | ||
739 | - | ||
740 | - <div class="block-50" style="padding-right: 10px;"> | ||
741 | - <label for="InputPassword3">Пароль:</label> | ||
742 | - <input type="password" name="pwd" class="form-control" id="InputPassword3" placeholder="" required> | ||
743 | - </div> | ||
744 | - <div class="block-50"> | ||
745 | - <label for="InputRemPassword3">Пароль еще раз:</label> | ||
746 | - <input type="password" name="pwd_a" class="form-control" id="InputRemPassword3" placeholder="" required> | ||
747 | - </div> | ||
748 | - <div class="clearfix"></div> | ||
749 | - </div> | ||
750 | - <input type="hidden" name="verification_keystring" value="[modal]"> | ||
751 | - | ||
752 | - <button type="submit" class="btn btn-default btn-large">Создать новый профиль</button> | ||
753 | - <div class="clearfix"></div> | ||
754 | - <p>На ваш email будет отправлено письмо для подтверждения данных.</p> | ||
755 | - </form> | ||
756 | - </div> | ||
757 | - | ||
758 | - <div class="modal-footer"> | ||
759 | - </div> | ||
760 | - | ||
761 | - </div> | ||
762 | - </div> | ||
763 | - </div> | ||
764 | 625 | ||
765 | <div class="modal fade" id="where_buy" tabindex="-1" role="dialog" aria-labelledby="myModalLabel44"> | 626 | <div class="modal fade" id="where_buy" tabindex="-1" role="dialog" aria-labelledby="myModalLabel44"> |
766 | <div class="modal-dialog text-dialog" role="document"> | 627 | <div class="modal-dialog text-dialog" role="document"> |
@@ -805,41 +666,8 @@ AppAsset::register($this); | @@ -805,41 +666,8 @@ AppAsset::register($this); | ||
805 | </div> | 666 | </div> |
806 | </div> | 667 | </div> |
807 | 668 | ||
808 | - <div class="modal fade" id="myCallback" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
809 | - <div class="modal-dialog auth" role="document"> | ||
810 | - <div class="modal-content"> | ||
811 | - | ||
812 | - <div class="modal-header"> | ||
813 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
814 | - <h4 class="modal-title" id="myModalLabel">Заказ обратного звонка</h4> | ||
815 | - </div> | ||
816 | - | ||
817 | - <div class="modal-body"> | ||
818 | - | ||
819 | - <form> | ||
820 | - <p>Оставьте номер вашего телефона и наш оператор перезвонит вам в течении часа.</p> | ||
821 | - <div class="form-group"> | ||
822 | - <label for="СallbackName1">Ваше имя</label> | ||
823 | - <input type="text" class="form-control" id="СallbackName1" placeholder=""> | ||
824 | - </div> | ||
825 | - | ||
826 | - <div class="form-group"> | ||
827 | - <label for="СallbackPhone1">Телефон</label> | ||
828 | - <input type="text" class="form-control" id="СallbackPhone1" placeholder=""> | ||
829 | - </div> | ||
830 | - <div class="example">примеры: +38 (044) 33-992-33 </div> | ||
831 | - | ||
832 | - | ||
833 | - <button type="submit" class="btn btn-default">Жду звонка</button> | ||
834 | - <div class="clearfix"></div> | ||
835 | - </form> | ||
836 | - <br /> | ||
837 | - | ||
838 | - </div> | ||
839 | - | ||
840 | - </div> | ||
841 | - </div> | ||
842 | - </div> | 669 | + <!-- consultation_modal --> |
670 | + <?= $this->render('/modal/my_callback_modal_window') ?> | ||
843 | 671 | ||
844 | <div class="modal fade" id="myWishlist" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | 672 | <div class="modal fade" id="myWishlist" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
845 | <div class="modal-dialog wishlist" role="document"> | 673 | <div class="modal-dialog wishlist" role="document"> |
frontend/views/modal/forgot_password_form_model_window.php
0 → 100644
1 | +<div class="modal fade" id="forgotPass" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2"> | ||
2 | + <div class="modal-dialog auth" role="document"> | ||
3 | + <div class="modal-content"> | ||
4 | + | ||
5 | + <div class="modal-header"> | ||
6 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
7 | + <h4 class="modal-title" id="myModalLabel2">Напомнить пароль</h4> | ||
8 | + </div> | ||
9 | + | ||
10 | + <div class="modal-body"> | ||
11 | + | ||
12 | + <form> | ||
13 | + <div class="form-group"> | ||
14 | + <label for="InputEmail1">Email</label> | ||
15 | + <input type="email" class="form-control" id="InputEmail1" placeholder="Email"> | ||
16 | + </div> | ||
17 | + <p>Введите адрес почты, который вы указали при регистрации. На этот адрес отправим пароль.</p> | ||
18 | + <p><a class="popup" href="#" data-dismiss="modal" data-toggle="modal" data-target="#myAccount">← Я вспомнил пароль</a></p> | ||
19 | + <button type="submit" class="btn btn-large btn-default">Напомнить пароль</button> | ||
20 | + </form> | ||
21 | + <br /> | ||
22 | + <div class="clearfix"></div> | ||
23 | + </div> | ||
24 | + | ||
25 | + </div> | ||
26 | + </div> | ||
27 | +</div> | ||
0 | \ No newline at end of file | 28 | \ No newline at end of file |
1 | +<?php | ||
2 | + | ||
3 | +use common\models\LoginForm; | ||
4 | +use yii\helpers\Html; | ||
5 | +use yii\helpers\Url; | ||
6 | +use yii\widgets\ActiveForm; | ||
7 | + | ||
8 | + | ||
9 | +?> | ||
10 | +<div class="modal fade" id="myAccount" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
11 | + <div class="modal-dialog auth" role="document"> | ||
12 | + <div class="modal-content"> | ||
13 | + | ||
14 | + <div class="modal-header"> | ||
15 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
16 | + <h4 class="modal-title" id="myModalLabel">Вход в личный кабинет</h4> | ||
17 | + </div> | ||
18 | + | ||
19 | + <div class="modal-body"> | ||
20 | + <?php | ||
21 | + | ||
22 | + $form = ActiveForm::begin([ | ||
23 | + 'action'=>Url::toRoute('site/login'), | ||
24 | + ]); ?> | ||
25 | + | ||
26 | + <?= $form->field(new LoginForm(), 'email' )->textInput(['autofocus' => true]) ?> | ||
27 | + | ||
28 | + <?= $form->field(new LoginForm(), 'password')->passwordInput() ?> | ||
29 | + | ||
30 | + | ||
31 | + <div class="pass_links"> | ||
32 | + <?= $form->field(new LoginForm(), 'rememberMe')->checkbox() ?> | ||
33 | + | ||
34 | + | ||
35 | + <?= Html::a(Yii::t('app', 'forgot_password'), ['site/request-password-reset'],['class'=>'forgot_pass_link']) ?> | ||
36 | + </div> | ||
37 | + | ||
38 | + <div class="for_btn_position"> | ||
39 | + <?= Html::submitButton(Yii::t('app','enter'), ['class' => 'my_cust_btn', 'name' => 'login-button']) ?> | ||
40 | + </div> | ||
41 | + | ||
42 | + <ul class="ul links"> | ||
43 | + <li><a href="#" data-dismiss="modal" data-toggle="modal" data-target="#forgotPass">Напомнить пароль</a></li> | ||
44 | + <li><a href="#" data-dismiss="modal" data-toggle="modal" data-target="#regMe">Создать новый профиль</a></li> | ||
45 | + </ul> | ||
46 | + <?php ActiveForm::end(); ?> | ||
47 | + | ||
48 | + | ||
49 | + </div> | ||
50 | + | ||
51 | + <div class="modal-footer"> | ||
52 | + </div> | ||
53 | + | ||
54 | + </div> | ||
55 | + </div> | ||
56 | +</div> | ||
0 | \ No newline at end of file | 57 | \ No newline at end of file |
1 | +<div class="modal fade" id="myCallback" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
2 | + <div class="modal-dialog auth" role="document"> | ||
3 | + <div class="modal-content"> | ||
4 | + | ||
5 | + <div class="modal-header"> | ||
6 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
7 | + <h4 class="modal-title" id="myModalLabel">Заказ обратного звонка</h4> | ||
8 | + </div> | ||
9 | + | ||
10 | + <div class="modal-body"> | ||
11 | + | ||
12 | + <form> | ||
13 | + <p>Оставьте номер вашего телефона и наш оператор перезвонит вам в течении часа.</p> | ||
14 | + <div class="form-group"> | ||
15 | + <label for="СallbackName1">Ваше имя</label> | ||
16 | + <input type="text" class="form-control" id="СallbackName1" placeholder=""> | ||
17 | + </div> | ||
18 | + | ||
19 | + <div class="form-group"> | ||
20 | + <label for="СallbackPhone1">Телефон</label> | ||
21 | + <input type="text" class="form-control" id="СallbackPhone1" placeholder=""> | ||
22 | + </div> | ||
23 | + <div class="example">примеры: +38 (044) 33-992-33 </div> | ||
24 | + | ||
25 | + | ||
26 | + <button type="submit" class="btn btn-default">Жду звонка</button> | ||
27 | + <div class="clearfix"></div> | ||
28 | + </form> | ||
29 | + <br /> | ||
30 | + | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> | ||
0 | \ No newline at end of file | 36 | \ No newline at end of file |
frontend/views/modal/registration_window_model_window.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +use common\models\LoginForm; | ||
4 | +use yii\helpers\Html; | ||
5 | +use yii\helpers\Url; | ||
6 | +use yii\widgets\ActiveForm; | ||
7 | + | ||
8 | +?> | ||
9 | +<div class="modal fade" id="regMe" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2"> | ||
10 | + <div class="modal-dialog auth" role="document"> | ||
11 | + <div class="modal-content"> | ||
12 | + | ||
13 | + <div class="modal-header"> | ||
14 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
15 | + <h4 class="modal-title" id="myModalLabel2">Создание профиля</h4> | ||
16 | + </div> | ||
17 | + | ||
18 | + <div class="modal-body"> | ||
19 | + | ||
20 | + | ||
21 | + <form name="RegistrationForm" id="RegistrationFormModal" action="register_user.htm" method="post" > | ||
22 | + <div class="form-group"> | ||
23 | + <label for="InputName3">Имя:</label> | ||
24 | + <input name="firstName" class="form-control" id="InputName3" placeholder="" required> | ||
25 | + </div> | ||
26 | + <div class="form-group"> | ||
27 | + <label for="phone2">Телефон:</label> | ||
28 | + <input name="phone" class="form-control phone" id="phone2" placeholder="" required> | ||
29 | + </div> | ||
30 | + | ||
31 | + <div class="form-group"> | ||
32 | + <label for="InputEmail3">Email:</label> | ||
33 | + <input type="email" name="email" class="form-control" id="InputEmail3" placeholder="" required> | ||
34 | + </div> | ||
35 | + <div class="form-group"> | ||
36 | + | ||
37 | + <div class="block-50" style="padding-right: 10px;"> | ||
38 | + <label for="InputPassword3">Пароль:</label> | ||
39 | + <input type="password" name="pwd" class="form-control" id="InputPassword3" placeholder="" required> | ||
40 | + </div> | ||
41 | + <div class="block-50"> | ||
42 | + <label for="InputRemPassword3">Пароль еще раз:</label> | ||
43 | + <input type="password" name="pwd_a" class="form-control" id="InputRemPassword3" placeholder="" required> | ||
44 | + </div> | ||
45 | + <div class="clearfix"></div> | ||
46 | + </div> | ||
47 | + <input type="hidden" name="verification_keystring" value="[modal]"> | ||
48 | + | ||
49 | + <button type="submit" class="btn btn-default btn-large">Создать новый профиль</button> | ||
50 | + <div class="clearfix"></div> | ||
51 | + <p>На ваш email будет отправлено письмо для подтверждения данных.</p> | ||
52 | + </form> | ||
53 | + </div> | ||
54 | + | ||
55 | + <div class="modal-footer"> | ||
56 | + </div> | ||
57 | + | ||
58 | + </div> | ||
59 | + </div> | ||
60 | +</div> | ||
0 | \ No newline at end of file | 61 | \ No newline at end of file |
frontend/web/css/comments.css
1 | -@import "https://fonts.googleapis.com/css?family=Roboto:400,700,500&subset=cyrillic-ext,latin,cyrillic,latin-ext";.input_bl,.area_bl,.form-comm-wr,.user_name,.user_txt,.comment-panel,.answer-form,.comments-start input,.comments-start textarea,.submit_btn button,.input_bl label{box-sizing:border-box}.comments-border{width:100%;margin-top:25px;margin-bottom:27px;height:1px;background:#d2d2d2}.comments-start{width:730px;margin:0 auto;font-family:'Roboto',sans-serif;font-weight:400;color:#333}.form-comm-wr{width:100%;background:#f5f5f5;padding:20px;float:left}.input_bl{margin-top:15px;float:left}.area_bl,.input_bl{position:relative}.input_bl input,.input_bl textarea,.answer-form textarea{width:258px;height:30px;border:1px solid #d2d2d2;background:#fff;outline:none!important;border-radius:4px;padding-left:10px}.area_bl textarea,.answer-form textarea{resize:none!important;height:140px;width:585px;padding-top:7px}.input_bl input:focus,.input_bl textarea:focus,.answer-form textarea:focus{box-shadow:1px 2px 2px 0 rgba(215,215,215,0.75) inset;transition:.1s}.input_bl label{font-size:12px;color:#7d7d7d;font-weight:400;text-transform:uppercase;position:relative;width:105px;float:left;text-align:right;padding-right:10px;margin-top:9px}.input_bl:nth-child(2) label{width:69px}.submit_btn{float:right;margin-top:27px}.submit_btn button,.answer-form button{padding:0 17px;height:32px;font-weight:500;font-size:15px;color:#fff;border-top:0;border-left:0;border-right:0;border-bottom:2px solid #799920;background:#95ba2f;border-radius:4px;cursor:pointer;outline:none!important}.submit_btn button:hover,.answer-form button:hover{border-bottom:2px solid #95ba2f}.submit_btn button:active,.answer-form button:active{border-bottom:2px solid #799920;background:#799920}.answer-form button{float:right;margin-top:27px}.comments-wr,.comment-answer{min-height:64px;position:relative;float:left;width:100%}.answer-form{float:left;width:100%}.user-ico{width:80px;height:80px;float:left;overflow:hidden;border-radius:50%;position:absolute;top:0;left:0}.user-ico img{width:100%;height:100%}.user_data{margin-top:-2px;font-size:12px;color:#636363}.user_name{margin-top:6px;font-weight:700;font-size:15px}.user_name,.user_txt,.comment-panel,.answer-form,.user_data{width:100%;float:left;padding-left:100px}.user_txt{margin-top:8px;font-size:13px;line-height:18px}.comment-panel{width:100%;float:left;margin-top:11px}.comment-panel a:first-child{margin-left:0}.btn-comm-answer,.btn-comm-delete{font-size:13px;color:#799920;border-bottom:1px dotted #799920}.btn-comm-answer,.btn-comm-delete,.btn-comm-like,.btn-comm-dislike{float:left;margin-left:10px;text-decoration:none}.btn-comm-answer,.btn-comm-delete{height:16px;line-height:16px}.btn-comm-answer:hover,.btn-comm-delete:hover{text-decoration:none;border-bottom:0}.btn-comm-like,.btn-comm-dislike{width:14px;height:16px;background-image:url(../images/like_dislike.png);background-repeat:no-repeat}.btn-comm-like{background-position:0 0}.btn-comm-like:hover{background-position:0 -16px}.btn-comm-dislike:hover{background-position:-14px -16px}.btn-comm-dislike{background-position:-14px 0}.btn-comm-like:active,.btn-comm-dislike:active{opacity:.7}.comment-answer{margin-top:40px}.comment-answer .user-ico{left:100px}.comment-answer .user_name,.comment-answer .user_txt,.comment-answer .comment-panel,.comment-answer .answer-form,.comment-answer .user_data{padding-left:200px}.comments-wr{margin-top:40px}.answer-form{margin-top:20px}.answer-form textarea{width:100%;height:90px}.input_bl.has-error input,.input_bl.has-error textarea,.answer-form .has-error textarea{box-shadow:1px 2px 2px 0 rgba(212,0,0,0.2) inset}.required label{color:#d40000}.input_bl .help-block,.answer-form .help-block{display:none}.required label:before{display:block;content:"*";color:#d40000;position:absolute;top:0;right:-7px}.comments-start ul.pagination{list-style:none;text-align:center;margin-top:40px;width:100%;float:left}.comments-start ul.pagination li{display:inline}.comments-start ul.pagination li.prev.disabled span{display:none}.comments-start ul.pagination li a{padding:3px;color:#82a02f;font-size:15px;margin:0;text-decoration:none}.comments-start ul.pagination li.active a{color:#333} | ||
2 | \ No newline at end of file | 1 | \ No newline at end of file |
2 | +@import "https://fonts.googleapis.com/css?family=Roboto:400,700,500&subset=cyrillic-ext,latin,cyrillic,latin-ext";.input_bl,.area_bl,.form-comm-wr,.user_name,.user_txt,.comment-panel,.answer-form,.comments-start input,.comments-start textarea,.submit_btn button,.input_bl label{box-sizing:border-box}.comments-border{width:100%;margin-top:25px;margin-bottom:27px;height:1px;background:#d2d2d2}.comments-start{width:730px;margin:0 auto;font-family:'Roboto',sans-serif;font-weight:400;color:#333}.form-comm-wr{width:100%;background:#f5f5f5;padding:20px;float:left}.input_bl{margin-top:15px;float:left}.area_bl,.input_bl{position:relative}.input_bl input,.input_bl textarea,.answer-form textarea{width:258px;height:30px;border:1px solid #d2d2d2;background:#fff;outline:none!important;border-radius:4px;padding-left:10px}.area_bl textarea,.answer-form textarea{resize:none!important;height:140px;width:585px;padding-top:7px}.input_bl input:focus,.input_bl textarea:focus,.answer-form textarea:focus{box-shadow:1px 2px 2px 0 rgba(215,215,215,0.75) inset;transition:.1s}.input_bl label{font-size:12px;color:#7d7d7d;font-weight:400;text-transform:uppercase;position:relative;width:105px;float:left;text-align:right;padding-right:10px;margin-top:9px}.input_bl:nth-child(2) label{width:69px}.submit_btn{float:right;margin-top:27px}.submit_btn button,.answer-form button{padding:0 17px;height:32px;font-weight:500;font-size:15px;color:#fff;border-top:0;border-left:0;border-right:0;border-bottom:2px solid #799920;background:#95ba2f;border-radius:4px;cursor:pointer;outline:none!important}.submit_btn button:hover,.answer-form button:hover{border-bottom:2px solid #95ba2f}.submit_btn button:active,.answer-form button:active{border-bottom:2px solid #799920;background:#799920}.answer-form button{float:right;margin-top:27px}.comments-wr,.comment-answer{min-height:64px;position:relative;float:left;width:100%}.answer-form{float:left;width:100%}.user-ico{width:80px;height:80px;float:left;overflow:hidden;border-radius:50%;position:absolute;top:0;left:0}.user-ico img{width:100%;height:100%}.user_data{margin-top:-2px;font-size:12px;color:#636363}.user_name{margin-top:6px;font-weight:700;font-size:15px}.user_name,.user_txt,.comment-panel,.answer-form,.user_data{width:100%;float:left;padding-left:100px}.user_txt{margin-top:8px;font-size:13px;line-height:18px}.comment-panel{width:100%;float:left;margin-top:11px}.comment-panel a:first-child{margin-left:0}.btn-comm-answer,.btn-comm-delete{font-size:13px;color:#799920;border-bottom:1px dotted #799920}.btn-comm-answer,.btn-comm-delete,.btn-comm-like,.btn-comm-dislike{float:left;margin-left:10px;text-decoration:none}.btn-comm-answer,.btn-comm-delete{height:16px;line-height:16px}.btn-comm-answer:hover,.btn-comm-delete:hover{text-decoration:none;border-bottom:0}.btn-comm-like,.btn-comm-dislike{width:14px;height:16px;background-image:url(../images/like_dislike.png);background-repeat:no-repeat}.btn-comm-like{background-position:0 0}.btn-comm-like:hover{background-position:0 -16px}.btn-comm-dislike:hover{background-position:-14px -16px}.btn-comm-dislike{background-position:-14px 0}.btn-comm-like:active,.btn-comm-dislike:active{opacity:.7}.comment-answer{margin-top:40px}.comment-answer .user-ico{left:100px}.comment-answer .user_name,.comment-answer .user_txt,.comment-answer .comment-panel,.comment-answer .answer-form,.comment-answer .user_data{padding-left:200px}.comments-wr{margin-top:40px}.answer-form{margin-top:20px}.answer-form textarea{width:100%;height:90px}.input_bl.has-error input,.input_bl.has-error textarea,.answer-form .has-error textarea{box-shadow:1px 2px 2px 0 rgba(212,0,0,0.2) inset}.input_bl .help-block,.answer-form .help-block{display:none}.required label:before{display:block;content:"*";position:absolute;top:0;right:-7px}.comments-start ul.pagination{list-style:none;text-align:center;margin-top:40px;width:100%;float:left}.comments-start ul.pagination li{display:inline}.comments-start ul.pagination li.prev.disabled span{display:none}.comments-start ul.pagination li a{padding:3px;color:#82a02f;font-size:15px;margin:0;text-decoration:none}.comments-start ul.pagination li.active a{color:#333} | ||
3 | \ No newline at end of file | 3 | \ No newline at end of file |
@@ -1478,132 +1478,7 @@ function IsContain(needle, s) { | @@ -1478,132 +1478,7 @@ function IsContain(needle, s) { | ||
1478 | var base_url = $("base").attr("href"); | 1478 | var base_url = $("base").attr("href"); |
1479 | tmp = $("link[rel=stylesheet]").attr("href"); | 1479 | tmp = $("link[rel=stylesheet]").attr("href"); |
1480 | if (!empty(tmp)) var domain_url = tmp.substr(0, tmp.indexOf("res/")); | 1480 | if (!empty(tmp)) var domain_url = tmp.substr(0, tmp.indexOf("res/")); |
1481 | -$(document).ready(function() { | ||
1482 | - function searchValid(searchStr, len) { | ||
1483 | - regex = /^[a-zA-Z\u0430-\u044f\u0410-\u042f\u0451\u04010-9 ]+$/; | ||
1484 | - regexlen = /^[a-zA-Z\u0430-\u044f\u0410-\u042f\u0451\u04010-9 ]{3,}$/; | ||
1485 | - if (len) isValid = regexlen.test(searchStr) && (searchStr != ' \u041f\u043e\u0438\u0441\u043a'); | ||
1486 | - else isValid = regex.test(searchStr) && (searchStr != ' \u041f\u043e\u0438\u0441\u043a'); | ||
1487 | - if (!isValid) $('#searchMsg').fadeIn().click(function() { | ||
1488 | - $('#searchMsg').fadeOut(); | ||
1489 | - return false; | ||
1490 | - }); | ||
1491 | - else $('#searchMsg').fadeOut(); | ||
1492 | - return isValid; | ||
1493 | - } | ||
1494 | - $('form.search').submit(function() { | ||
1495 | - return searchValid($('#searchField').val(), true); | ||
1496 | - }).after('<div id="searchMsg"></div>'); | ||
1497 | - position = $('form.search').offset(); | ||
1498 | - $('#searchField').focus(function() { | ||
1499 | - if ($(this).val() == ' \u041f\u043e\u0438\u0441\u043a') $(this).val('') | ||
1500 | - }).keyup(function() { | ||
1501 | - searchValid($('#searchField').val(), false); | ||
1502 | - }); | ||
1503 | - $(".menu_line a, .menu_line .h2 span.no_link").each(function() { | ||
1504 | - var td_el = $("table td", $(this)); | ||
1505 | - var src_el = $(this); | ||
1506 | - $(td_el).click(function() { | ||
1507 | - var href = $(src_el).attr("href"); | ||
1508 | - if (empty(href)) href = $(src_el).attr("lang"); | ||
1509 | - location.href = href; | ||
1510 | - }); | ||
1511 | - }); | ||
1512 | - $(".search_panel input").each(function() { | ||
1513 | - var val = $(this).val(); | ||
1514 | - if (val == "") $(this).val($(this).attr("title")); | ||
1515 | - $(this).attr("lang", $(this).attr("name")); | ||
1516 | - }).bind("focus", function() { | ||
1517 | - var val = $(this).val(); | ||
1518 | - if (!empty(val) && val.toLowerCase() == $(this).attr("title")) $(this).val(''); | ||
1519 | - }).bind("blur", function() { | ||
1520 | - var val = $(this).val(); | ||
1521 | - if (empty(val) || val == "") $(this).val($(this).attr("title")); | ||
1522 | - }); | ||
1523 | - $(".search_panel_wide button[type='submit']").bind("click", function() { | ||
1524 | - var el_feeder = $('.search_panel_wide #model'); | ||
1525 | - if ($(el_feeder).val() == $(el_feeder).attr('title')) { | ||
1526 | - $(el_feeder).focus(); | ||
1527 | - return false; | ||
1528 | - } | ||
1529 | - }); | ||
1530 | - if (typeof(am) != 'undefined' && am) | ||
1531 | - $('div.photo').each(function() { | ||
1532 | - var title = $(this).attr("lang"); | ||
1533 | - if (!empty(title)) $(this).attr("title", title); | ||
1534 | - }); | ||
1535 | - if (location.href) var href_curr = location.href; | ||
1536 | - if (!empty(href_curr)) { | ||
1537 | - if (href_curr.indexOf("#accessories") > 0) {} else $("#acsr").hide(); | ||
1538 | - } | ||
1539 | - $('.acessories a').click(function() { | ||
1540 | - $("#acsr").show(); | ||
1541 | - }); | ||
1542 | - $('.instant_suggest').each(function() { | ||
1543 | - var dt = $(this).attr("lang"); | ||
1544 | - if (!empty(dt)) | ||
1545 | - $(this).instant_suggest('hr_gate.php?test=500&r=' + Math.random(), { | ||
1546 | - disableHighlight: true, | ||
1547 | - dataType: dt, | ||
1548 | - sendConnected: true, | ||
1549 | - minchars: 1, | ||
1550 | - onSelect: function() { | ||
1551 | - return false; | ||
1552 | - } | ||
1553 | - }); | ||
1554 | - $(this).focus(function() {}); | ||
1555 | - }); | ||
1556 | - $('.suggest').each(function() { | ||
1557 | - var dt = $(this).attr("lang"); | ||
1558 | - if (!empty(dt)) | ||
1559 | - $(this).suggest('hr_gate.php?test=500&r=' + Math.random(), { | ||
1560 | - disableHighlight: true, | ||
1561 | - dataType: dt, | ||
1562 | - minchars: 1, | ||
1563 | - onSelect: function() { | ||
1564 | - $("#qs_sel").val($(this).attr('lang')); | ||
1565 | - return false; | ||
1566 | - } | ||
1567 | - }); | ||
1568 | - $(this).focus(function() { | ||
1569 | - setTimeout(function() { | ||
1570 | - $(".ac_results").hide(); | ||
1571 | - }, 500); | ||
1572 | - }); | ||
1573 | - }); | ||
1574 | - $(".search_panel #price_from, .search_panel #price_to").bind("keyup", function() { | ||
1575 | - var val = parseFloat($(this).val()); | ||
1576 | - if (isNaN(val)) val = ''; | ||
1577 | - $(this).val(val); | ||
1578 | - }); | ||
1579 | - $(".search_panel button[type=reset]").bind("click", function() { | ||
1580 | - $(".search_panel input").each(function() { | ||
1581 | - $(this).val($(this).attr("title")); | ||
1582 | - }); | ||
1583 | - return false; | ||
1584 | - }); | ||
1585 | - $(".set_homepage").bind("click", function() { | ||
1586 | - var url = location.href; | ||
1587 | - if (!empty(url)) { | ||
1588 | - $.setHomepage(url); | ||
1589 | - } | ||
1590 | - return false; | ||
1591 | - }); | ||
1592 | - $('.toolbar-style').change(function(event) { | ||
1593 | - style = $(this).val(); | ||
1594 | - if (style == 'list') { | ||
1595 | - $('#centrit .prodBox').addClass('list'); | ||
1596 | - style = 1; | ||
1597 | - } else { | ||
1598 | - $('#centrit .prodBox').removeClass('list'); | ||
1599 | - style = 2; | ||
1600 | - } | ||
1601 | - JsHttpRequest.query('hr_gate.php?test=500&r=' + Math.random(), { | ||
1602 | - 'sp': "prod_list_style", | ||
1603 | - 'style': style | ||
1604 | - }, function(result, errors) {}, true); | ||
1605 | - }); | ||
1606 | -}); | 1481 | + |
1607 | jQuery.extend({ | 1482 | jQuery.extend({ |
1608 | setHomepage: function(url) { | 1483 | setHomepage: function(url) { |
1609 | if (document.all) { | 1484 | if (document.all) { |
@@ -2702,618 +2577,7 @@ $(document).ready(function() { | @@ -2702,618 +2577,7 @@ $(document).ready(function() { | ||
2702 | }); | 2577 | }); |
2703 | });; | 2578 | });; |
2704 | 2579 | ||
2705 | -function JsHttpRequest() { | ||
2706 | - var t = this; | ||
2707 | - t.onreadystatechange = null; | ||
2708 | - t.readyState = 0; | ||
2709 | - t.responseText = null; | ||
2710 | - t.responseXML = null; | ||
2711 | - t.status = 200; | ||
2712 | - t.statusText = "OK"; | ||
2713 | - t.responseJS = null; | ||
2714 | - t.caching = false; | ||
2715 | - t.loader = null; | ||
2716 | - t.session_name = "PHPSESSID"; | ||
2717 | - t._ldObj = null; | ||
2718 | - t._reqHeaders = []; | ||
2719 | - t._openArgs = null; | ||
2720 | - t._errors = { | ||
2721 | - inv_form_el: "Invalid FORM element detected: name=%, tag=%", | ||
2722 | - must_be_single_el: "If used, <form> must be a single HTML element in the list.", | ||
2723 | - js_invalid: "JavaScript code generated by backend is invalid!\n%", | ||
2724 | - url_too_long: "Cannot use so long query with GET request (URL is larger than % bytes)", | ||
2725 | - unk_loader: "Unknown loader: %", | ||
2726 | - no_loaders: "No loaders registered at all, please check JsHttpRequest.LOADERS array", | ||
2727 | - no_loader_matched: "Cannot find a loader which may process the request. Notices are:\n%" | ||
2728 | - }; | ||
2729 | - t.abort = function() { | ||
2730 | - with(this) { | ||
2731 | - if (_ldObj && _ldObj.abort) { | ||
2732 | - _ldObj.abort(); | ||
2733 | - } | ||
2734 | - _cleanup(); | ||
2735 | - if (readyState == 0) { | ||
2736 | - return; | ||
2737 | - } | ||
2738 | - if (readyState == 1 && !_ldObj) { | ||
2739 | - readyState = 0; | ||
2740 | - return; | ||
2741 | - } | ||
2742 | - _changeReadyState(4, true); | ||
2743 | - } | ||
2744 | - }; | ||
2745 | - t.open = function(_2, _3, _4, _5, _6) { | ||
2746 | - with(this) { | ||
2747 | - if (_3.match(/^((\w+)\.)?(GET|POST)\s+(.*)/i)) { | ||
2748 | - this.loader = RegExp.$2 ? RegExp.$2 : null; | ||
2749 | - _2 = RegExp.$3; | ||
2750 | - _3 = RegExp.$4; | ||
2751 | - } | ||
2752 | - try { | ||
2753 | - if (document.location.search.match(new RegExp("[&?]" + session_name + "=([^&?]*)")) || document.cookie.match(new RegExp("(?:;|^)\\s*" + session_name + "=([^;]*)"))) { | ||
2754 | - _3 += (_3.indexOf("?") >= 0 ? "&" : "?") + session_name + "=" + this.escape(RegExp.$1); | ||
2755 | - } | ||
2756 | - } catch (e) {} | ||
2757 | - _openArgs = { | ||
2758 | - method: (_2 || "").toUpperCase(), | ||
2759 | - url: _3, | ||
2760 | - asyncFlag: _4, | ||
2761 | - username: _5 != null ? _5 : "", | ||
2762 | - password: _6 != null ? _6 : "" | ||
2763 | - }; | ||
2764 | - _ldObj = null; | ||
2765 | - _changeReadyState(1, true); | ||
2766 | - return true; | ||
2767 | - } | ||
2768 | - }; | ||
2769 | - t.send = function(_7) { | ||
2770 | - if (!this.readyState) { | ||
2771 | - return; | ||
2772 | - } | ||
2773 | - this._changeReadyState(1, true); | ||
2774 | - this._ldObj = null; | ||
2775 | - var _8 = []; | ||
2776 | - var _9 = []; | ||
2777 | - if (!this._hash2query(_7, null, _8, _9)) { | ||
2778 | - return; | ||
2779 | - } | ||
2780 | - var _a = null; | ||
2781 | - if (this.caching && !_9.length) { | ||
2782 | - _a = this._openArgs.username + ":" + this._openArgs.password + "@" + this._openArgs.url + "|" + _8 + "#" + this._openArgs.method; | ||
2783 | - var _b = JsHttpRequest.CACHE[_a]; | ||
2784 | - if (_b) { | ||
2785 | - this._dataReady(_b[0], _b[1]); | ||
2786 | - return false; | ||
2787 | - } | ||
2788 | - } | ||
2789 | - var _c = (this.loader || "").toLowerCase(); | ||
2790 | - if (_c && !JsHttpRequest.LOADERS[_c]) { | ||
2791 | - return this._error("unk_loader", _c); | ||
2792 | - } | ||
2793 | - var _d = []; | ||
2794 | - var _e = JsHttpRequest.LOADERS; | ||
2795 | - for (var _f in _e) { | ||
2796 | - var ldr = _e[_f].loader; | ||
2797 | - if (!ldr) { | ||
2798 | - continue; | ||
2799 | - } | ||
2800 | - if (_c && _f != _c) { | ||
2801 | - continue; | ||
2802 | - } | ||
2803 | - var _11 = new ldr(this); | ||
2804 | - JsHttpRequest.extend(_11, this._openArgs); | ||
2805 | - JsHttpRequest.extend(_11, { | ||
2806 | - queryText: _8.join("&"), | ||
2807 | - queryElem: _9, | ||
2808 | - id: (new Date().getTime()) + "" + JsHttpRequest.COUNT++, | ||
2809 | - hash: _a, | ||
2810 | - span: null | ||
2811 | - }); | ||
2812 | - var _12 = _11.load(); | ||
2813 | - if (!_12) { | ||
2814 | - this._ldObj = _11; | ||
2815 | - JsHttpRequest.PENDING[_11.id] = this; | ||
2816 | - return true; | ||
2817 | - } | ||
2818 | - if (!_c) { | ||
2819 | - _d[_d.length] = "- " + _f.toUpperCase() + ": " + this._l(_12); | ||
2820 | - } else { | ||
2821 | - return this._error(_12); | ||
2822 | - } | ||
2823 | - } | ||
2824 | - return _f ? this._error("no_loader_matched", _d.join("\n")) : this._error("no_loaders"); | ||
2825 | - }; | ||
2826 | - t.getAllResponseHeaders = function() { | ||
2827 | - with(this) { | ||
2828 | - return _ldObj && _ldObj.getAllResponseHeaders ? _ldObj.getAllResponseHeaders() : []; | ||
2829 | - } | ||
2830 | - }; | ||
2831 | - t.getResponseHeader = function(_13) { | ||
2832 | - with(this) { | ||
2833 | - return _ldObj && _ldObj.getResponseHeader ? _ldObj.getResponseHeader(_13) : null; | ||
2834 | - } | ||
2835 | - }; | ||
2836 | - t.setRequestHeader = function(_14, _15) { | ||
2837 | - with(this) { | ||
2838 | - _reqHeaders[_reqHeaders.length] = [_14, _15]; | ||
2839 | - } | ||
2840 | - }; | ||
2841 | - t._dataReady = function(_16, js) { | ||
2842 | - with(this) { | ||
2843 | - if (caching && _ldObj) { | ||
2844 | - JsHttpRequest.CACHE[_ldObj.hash] = [_16, js]; | ||
2845 | - } | ||
2846 | - responseText = responseXML = _16; | ||
2847 | - responseJS = js; | ||
2848 | - if (js !== null) { | ||
2849 | - status = 200; | ||
2850 | - statusText = "OK"; | ||
2851 | - } else { | ||
2852 | - status = 500; | ||
2853 | - statusText = "Internal Server Error"; | ||
2854 | - } | ||
2855 | - _changeReadyState(2); | ||
2856 | - _changeReadyState(3); | ||
2857 | - _changeReadyState(4); | ||
2858 | - _cleanup(); | ||
2859 | - } | ||
2860 | - }; | ||
2861 | - t._l = function(_18) { | ||
2862 | - var i = 0, | ||
2863 | - p = 0, | ||
2864 | - msg = this._errors[_18[0]]; | ||
2865 | - while ((p = msg.indexOf("%", p)) >= 0) { | ||
2866 | - var a = _18[++i] + ""; | ||
2867 | - msg = msg.substring(0, p) + a + msg.substring(p + 1, msg.length); | ||
2868 | - p += 1 + a.length; | ||
2869 | - } | ||
2870 | - return msg; | ||
2871 | - }; | ||
2872 | - t._error = function(msg) { | ||
2873 | - msg = this._l(typeof(msg) == "string" ? arguments : msg); | ||
2874 | - msg = "JsHttpRequest: " + msg; | ||
2875 | - if (!window.Error) { | ||
2876 | - throw msg; | ||
2877 | - } else { | ||
2878 | - if ((new Error(1, "test")).description == "test") { | ||
2879 | - throw new Error(1, msg); | ||
2880 | - } else { | ||
2881 | - throw new Error(msg); | ||
2882 | - } | ||
2883 | - } | ||
2884 | - }; | ||
2885 | - t._hash2query = function(_1e, _1f, _20, _21) { | ||
2886 | - if (_1f == null) { | ||
2887 | - _1f = ""; | ||
2888 | - } | ||
2889 | - if (("" + typeof(_1e)).toLowerCase() == "object") { | ||
2890 | - var _22 = false; | ||
2891 | - if (_1e && _1e.parentNode && _1e.parentNode.appendChild && _1e.tagName && _1e.tagName.toUpperCase() == "FORM") { | ||
2892 | - _1e = { | ||
2893 | - form: _1e | ||
2894 | - }; | ||
2895 | - } | ||
2896 | - for (var k in _1e) { | ||
2897 | - var v = _1e[k]; | ||
2898 | - if (v instanceof Function) { | ||
2899 | - continue; | ||
2900 | - } | ||
2901 | - var _25 = _1f ? _1f + "[" + this.escape(k) + "]" : this.escape(k); | ||
2902 | - var _26 = v && v.parentNode && v.parentNode.appendChild && v.tagName; | ||
2903 | - if (_26) { | ||
2904 | - var tn = v.tagName.toUpperCase(); | ||
2905 | - if (tn == "FORM") { | ||
2906 | - _22 = true; | ||
2907 | - } else { | ||
2908 | - if (tn == "INPUT" || tn == "TEXTAREA" || tn == "SELECT") {} else { | ||
2909 | - return this._error("inv_form_el", (v.name || ""), v.tagName); | ||
2910 | - } | ||
2911 | - } | ||
2912 | - _21[_21.length] = { | ||
2913 | - name: _25, | ||
2914 | - e: v | ||
2915 | - }; | ||
2916 | - } else { | ||
2917 | - if (v instanceof Object) { | ||
2918 | - this._hash2query(v, _25, _20, _21); | ||
2919 | - } else { | ||
2920 | - if (v === null) { | ||
2921 | - continue; | ||
2922 | - } | ||
2923 | - if (v === true) { | ||
2924 | - v = 1; | ||
2925 | - } | ||
2926 | - if (v === false) { | ||
2927 | - v = ""; | ||
2928 | - } | ||
2929 | - _20[_20.length] = _25 + "=" + this.escape("" + v); | ||
2930 | - } | ||
2931 | - } | ||
2932 | - if (_22 && _21.length > 1) { | ||
2933 | - return this._error("must_be_single_el"); | ||
2934 | - } | ||
2935 | - } | ||
2936 | - } else { | ||
2937 | - _20[_20.length] = _1e; | ||
2938 | - } | ||
2939 | - return true; | ||
2940 | - }; | ||
2941 | - t._cleanup = function() { | ||
2942 | - var _28 = this._ldObj; | ||
2943 | - if (!_28) { | ||
2944 | - return; | ||
2945 | - } | ||
2946 | - JsHttpRequest.PENDING[_28.id] = false; | ||
2947 | - var _29 = _28.span; | ||
2948 | - if (!_29) { | ||
2949 | - return; | ||
2950 | - } | ||
2951 | - _28.span = null; | ||
2952 | - var _2a = function() { | ||
2953 | - _29.parentNode.removeChild(_29); | ||
2954 | - }; | ||
2955 | - JsHttpRequest.setTimeout(_2a, 50); | ||
2956 | - }; | ||
2957 | - t._changeReadyState = function(s, _2c) { | ||
2958 | - with(this) { | ||
2959 | - if (_2c) { | ||
2960 | - status = statusText = responseJS = null; | ||
2961 | - responseText = ""; | ||
2962 | - } | ||
2963 | - readyState = s; | ||
2964 | - if (onreadystatechange) { | ||
2965 | - onreadystatechange(); | ||
2966 | - } | ||
2967 | - } | ||
2968 | - }; | ||
2969 | - t.escape = function(s) { | ||
2970 | - return escape(s).replace(new RegExp("\\+", "g"), "%2B"); | ||
2971 | - }; | ||
2972 | -} | ||
2973 | -JsHttpRequest.COUNT = 0; | ||
2974 | -JsHttpRequest.MAX_URL_LEN = 2000; | ||
2975 | -JsHttpRequest.CACHE = {}; | ||
2976 | -JsHttpRequest.PENDING = {}; | ||
2977 | -JsHttpRequest.LOADERS = {}; | ||
2978 | -JsHttpRequest._dummy = function() {}; | ||
2979 | -JsHttpRequest.TIMEOUTS = { | ||
2980 | - s: window.setTimeout, | ||
2981 | - c: window.clearTimeout | ||
2982 | -}; | ||
2983 | -JsHttpRequest.setTimeout = function(_2e, dt) { | ||
2984 | - window.JsHttpRequest_tmp = JsHttpRequest.TIMEOUTS.s; | ||
2985 | - if (typeof(_2e) == "string") { | ||
2986 | - id = window.JsHttpRequest_tmp(_2e, dt); | ||
2987 | - } else { | ||
2988 | - var id = null; | ||
2989 | - var _31 = function() { | ||
2990 | - _2e(); | ||
2991 | - delete JsHttpRequest.TIMEOUTS[id]; | ||
2992 | - }; | ||
2993 | - id = window.JsHttpRequest_tmp(_31, dt); | ||
2994 | - JsHttpRequest.TIMEOUTS[id] = _31; | ||
2995 | - } | ||
2996 | - window.JsHttpRequest_tmp = null; | ||
2997 | - return id; | ||
2998 | -}; | ||
2999 | -JsHttpRequest.clearTimeout = function(id) { | ||
3000 | - window.JsHttpRequest_tmp = JsHttpRequest.TIMEOUTS.c; | ||
3001 | - delete JsHttpRequest.TIMEOUTS[id]; | ||
3002 | - var r = window.JsHttpRequest_tmp(id); | ||
3003 | - window.JsHttpRequest_tmp = null; | ||
3004 | - return r; | ||
3005 | -}; | ||
3006 | -JsHttpRequest.query = function(url, _35, _36, _37) { | ||
3007 | - var req = new this(); | ||
3008 | - req.caching = !_37; | ||
3009 | - req.onreadystatechange = function() { | ||
3010 | - if (req.readyState == 4) { | ||
3011 | - _36(req.responseJS, req.responseText); | ||
3012 | - } | ||
3013 | - }; | ||
3014 | - req.open(null, url, true); | ||
3015 | - req.send(_35); | ||
3016 | -}; | ||
3017 | -JsHttpRequest.dataReady = function(d) { | ||
3018 | - var th = this.PENDING[d.id]; | ||
3019 | - delete this.PENDING[d.id]; | ||
3020 | - if (th) { | ||
3021 | - th._dataReady(d.text, d.js); | ||
3022 | - } else { | ||
3023 | - if (th !== false) { | ||
3024 | - throw "dataReady(): unknown pending id: " + d.id; | ||
3025 | - } | ||
3026 | - } | ||
3027 | -}; | ||
3028 | -JsHttpRequest.extend = function(_3b, src) { | ||
3029 | - for (var k in src) { | ||
3030 | - _3b[k] = src[k]; | ||
3031 | - } | ||
3032 | -}; | ||
3033 | -JsHttpRequest.LOADERS.xml = { | ||
3034 | - loader: function(req) { | ||
3035 | - JsHttpRequest.extend(req._errors, { | ||
3036 | - xml_no: "Cannot use XMLHttpRequest or ActiveX loader: not supported", | ||
3037 | - xml_no_diffdom: "Cannot use XMLHttpRequest to load data from different domain %", | ||
3038 | - xml_no_headers: "Cannot use XMLHttpRequest loader or ActiveX loader, POST method: headers setting is not supported, needed to work with encodings correctly", | ||
3039 | - xml_no_form_upl: "Cannot use XMLHttpRequest loader: direct form elements using and uploading are not implemented" | ||
3040 | - }); | ||
3041 | - this.load = function() { | ||
3042 | - if (this.queryElem.length) { | ||
3043 | - return ["xml_no_form_upl"]; | ||
3044 | - } | ||
3045 | - if (this.url.match(new RegExp("^([a-z]+://[^\\/]+)(.*)", "i"))) { | ||
3046 | - if (RegExp.$1.toLowerCase() != document.location.protocol + "//" + document.location.hostname.toLowerCase()) { | ||
3047 | - return ["xml_no_diffdom", RegExp.$1]; | ||
3048 | - } | ||
3049 | - } | ||
3050 | - var xr = null; | ||
3051 | - if (window.XMLHttpRequest) { | ||
3052 | - try { | ||
3053 | - xr = new XMLHttpRequest(); | ||
3054 | - } catch (e) {} | ||
3055 | - } else { | ||
3056 | - if (window.ActiveXObject) { | ||
3057 | - try { | ||
3058 | - xr = new ActiveXObject("Microsoft.XMLHTTP"); | ||
3059 | - } catch (e) {} | ||
3060 | - if (!xr) { | ||
3061 | - try { | ||
3062 | - xr = new ActiveXObject("Msxml2.XMLHTTP"); | ||
3063 | - } catch (e) {} | ||
3064 | - } | ||
3065 | - } | ||
3066 | - } | ||
3067 | - if (!xr) { | ||
3068 | - return ["xml_no"]; | ||
3069 | - } | ||
3070 | - var _40 = window.ActiveXObject || xr.setRequestHeader; | ||
3071 | - if (!this.method) { | ||
3072 | - this.method = _40 && this.queryText.length ? "POST" : "GET"; | ||
3073 | - } | ||
3074 | - if (this.method == "GET") { | ||
3075 | - if (this.queryText) { | ||
3076 | - this.url += (this.url.indexOf("?") >= 0 ? "&" : "?") + this.queryText; | ||
3077 | - } | ||
3078 | - this.queryText = ""; | ||
3079 | - if (this.url.length > JsHttpRequest.MAX_URL_LEN) { | ||
3080 | - return ["url_too_long", JsHttpRequest.MAX_URL_LEN]; | ||
3081 | - } | ||
3082 | - } else { | ||
3083 | - if (this.method == "POST" && !_40) { | ||
3084 | - return ["xml_no_headers"]; | ||
3085 | - } | ||
3086 | - } | ||
3087 | - this.url += (this.url.indexOf("?") >= 0 ? "&" : "?") + "JsHttpRequest=" + (req.caching ? "0" : this.id) + "-xml"; | ||
3088 | - var id = this.id; | ||
3089 | - xr.onreadystatechange = function() { | ||
3090 | - if (xr.readyState != 4) { | ||
3091 | - return; | ||
3092 | - } | ||
3093 | - xr.onreadystatechange = JsHttpRequest._dummy; | ||
3094 | - req.status = null; | ||
3095 | - try { | ||
3096 | - req.status = xr.status; | ||
3097 | - req.responseText = xr.responseText; | ||
3098 | - } catch (e) {} | ||
3099 | - if (!req.status) { | ||
3100 | - return; | ||
3101 | - } | ||
3102 | - try { | ||
3103 | - var _42 = req.responseText || "{ js: null, text: null }"; | ||
3104 | - eval("JsHttpRequest._tmp = function(id) { var d = " + _42 + "; d.id = id; JsHttpRequest.dataReady(d); }"); | ||
3105 | - } catch (e) { | ||
3106 | - return req._error("js_invalid", req.responseText); | ||
3107 | - } | ||
3108 | - JsHttpRequest._tmp(id); | ||
3109 | - JsHttpRequest._tmp = null; | ||
3110 | - }; | ||
3111 | - xr.open(this.method, this.url, true, this.username, this.password); | ||
3112 | - if (_40) { | ||
3113 | - for (var i = 0; i < req._reqHeaders.length; i++) { | ||
3114 | - xr.setRequestHeader(req._reqHeaders[i][0], req._reqHeaders[i][1]); | ||
3115 | - } | ||
3116 | - xr.setRequestHeader("Content-Type", "application/octet-stream"); | ||
3117 | - } | ||
3118 | - xr.send(this.queryText); | ||
3119 | - this.span = null; | ||
3120 | - this.xr = xr; | ||
3121 | - return null; | ||
3122 | - }; | ||
3123 | - this.getAllResponseHeaders = function() { | ||
3124 | - return this.xr.getAllResponseHeaders(); | ||
3125 | - }; | ||
3126 | - this.getResponseHeader = function(_44) { | ||
3127 | - return this.xr.getResponseHeader(_44); | ||
3128 | - }; | ||
3129 | - this.abort = function() { | ||
3130 | - this.xr.abort(); | ||
3131 | - this.xr = null; | ||
3132 | - }; | ||
3133 | - } | ||
3134 | -}; | ||
3135 | -JsHttpRequest.LOADERS.script = { | ||
3136 | - loader: function(req) { | ||
3137 | - JsHttpRequest.extend(req._errors, { | ||
3138 | - script_only_get: "Cannot use SCRIPT loader: it supports only GET method", | ||
3139 | - script_no_form: "Cannot use SCRIPT loader: direct form elements using and uploading are not implemented" | ||
3140 | - }); | ||
3141 | - this.load = function() { | ||
3142 | - if (this.queryText) { | ||
3143 | - this.url += (this.url.indexOf("?") >= 0 ? "&" : "?") + this.queryText; | ||
3144 | - } | ||
3145 | - this.url += (this.url.indexOf("?") >= 0 ? "&" : "?") + "JsHttpRequest=" + this.id + "-" + "script"; | ||
3146 | - this.queryText = ""; | ||
3147 | - if (!this.method) { | ||
3148 | - this.method = "GET"; | ||
3149 | - } | ||
3150 | - if (this.method !== "GET") { | ||
3151 | - return ["script_only_get"]; | ||
3152 | - } | ||
3153 | - if (this.queryElem.length) { | ||
3154 | - return ["script_no_form"]; | ||
3155 | - } | ||
3156 | - if (this.url.length > JsHttpRequest.MAX_URL_LEN) { | ||
3157 | - return ["url_too_long", JsHttpRequest.MAX_URL_LEN]; | ||
3158 | - } | ||
3159 | - var th = this, | ||
3160 | - d = document, | ||
3161 | - s = null, | ||
3162 | - b = d.body; | ||
3163 | - if (!window.opera) { | ||
3164 | - this.span = s = d.createElement("SCRIPT"); | ||
3165 | - var _4a = function() { | ||
3166 | - s.language = "JavaScript"; | ||
3167 | - if (s.setAttribute) { | ||
3168 | - s.setAttribute("src", th.url); | ||
3169 | - } else { | ||
3170 | - s.src = th.url; | ||
3171 | - } | ||
3172 | - b.insertBefore(s, b.lastChild); | ||
3173 | - }; | ||
3174 | - } else { | ||
3175 | - this.span = s = d.createElement("SPAN"); | ||
3176 | - s.style.display = "none"; | ||
3177 | - b.insertBefore(s, b.lastChild); | ||
3178 | - s.innerHTML = "Workaround for IE.<s" + "cript></" + "script>"; | ||
3179 | - var _4a = function() { | ||
3180 | - s = s.getElementsByTagName("SCRIPT")[0]; | ||
3181 | - s.language = "JavaScript"; | ||
3182 | - if (s.setAttribute) { | ||
3183 | - s.setAttribute("src", th.url); | ||
3184 | - } else { | ||
3185 | - s.src = th.url; | ||
3186 | - } | ||
3187 | - }; | ||
3188 | - } | ||
3189 | - JsHttpRequest.setTimeout(_4a, 10); | ||
3190 | - return null; | ||
3191 | - }; | ||
3192 | - } | ||
3193 | -}; | ||
3194 | -JsHttpRequest.LOADERS.form = { | ||
3195 | - loader: function(req) { | ||
3196 | - JsHttpRequest.extend(req._errors, { | ||
3197 | - form_el_not_belong: "Element \"%\" does not belong to any form!", | ||
3198 | - form_el_belong_diff: "Element \"%\" belongs to a different form. All elements must belong to the same form!", | ||
3199 | - form_el_inv_enctype: "Attribute \"enctype\" of the form must be \"%\" (for IE), \"%\" given." | ||
3200 | - }); | ||
3201 | - this.load = function() { | ||
3202 | - var th = this; | ||
3203 | - if (!th.method) { | ||
3204 | - th.method = "POST"; | ||
3205 | - } | ||
3206 | - th.url += (th.url.indexOf("?") >= 0 ? "&" : "?") + "JsHttpRequest=" + th.id + "-" + "form"; | ||
3207 | - if (th.method == "GET") { | ||
3208 | - if (th.queryText) { | ||
3209 | - th.url += (th.url.indexOf("?") >= 0 ? "&" : "?") + th.queryText; | ||
3210 | - } | ||
3211 | - if (th.url.length > JsHttpRequest.MAX_URL_LEN) { | ||
3212 | - return ["url_too_long", JsHttpRequest.MAX_URL_LEN]; | ||
3213 | - } | ||
3214 | - var p = th.url.split("?", 2); | ||
3215 | - th.url = p[0]; | ||
3216 | - th.queryText = p[1] || ""; | ||
3217 | - } | ||
3218 | - var _4e = null; | ||
3219 | - var _4f = false; | ||
3220 | - if (th.queryElem.length) { | ||
3221 | - if (th.queryElem[0].e.tagName.toUpperCase() == "FORM") { | ||
3222 | - _4e = th.queryElem[0].e; | ||
3223 | - _4f = true; | ||
3224 | - th.queryElem = []; | ||
3225 | - } else { | ||
3226 | - _4e = th.queryElem[0].e.form; | ||
3227 | - for (var i = 0; i < th.queryElem.length; i++) { | ||
3228 | - var e = th.queryElem[i].e; | ||
3229 | - if (!e.form) { | ||
3230 | - return ["form_el_not_belong", e.name]; | ||
3231 | - } | ||
3232 | - if (e.form != _4e) { | ||
3233 | - return ["form_el_belong_diff", e.name]; | ||
3234 | - } | ||
3235 | - } | ||
3236 | - } | ||
3237 | - if (th.method == "POST") { | ||
3238 | - var _52 = "multipart/form-data"; | ||
3239 | - var _53 = (_4e.attributes.encType && _4e.attributes.encType.nodeValue) || (_4e.attributes.enctype && _4e.attributes.enctype.value) || _4e.enctype; | ||
3240 | - if (_53 != _52) { | ||
3241 | - return ["form_el_inv_enctype", _52, _53]; | ||
3242 | - } | ||
3243 | - } | ||
3244 | - } | ||
3245 | - var d = _4e && (_4e.ownerDocument || _4e.document) || document; | ||
3246 | - var _55 = "jshr_i_" + th.id; | ||
3247 | - var s = th.span = d.createElement("DIV"); | ||
3248 | - s.style.position = "absolute"; | ||
3249 | - s.style.display = "none"; | ||
3250 | - s.style.visibility = "hidden"; | ||
3251 | - s.innerHTML = (_4e ? "" : "<form" + (th.method == "POST" ? " enctype=\"multipart/form-data\" method=\"post\"" : "") + "></form>") + "<iframe name=\"" + _55 + "\" id=\"" + _55 + "\" style=\"width:0px; height:0px; overflow:hidden; border:none\"></iframe>"; | ||
3252 | - if (!_4e) { | ||
3253 | - _4e = th.span.firstChild; | ||
3254 | - } | ||
3255 | - d.body.insertBefore(s, d.body.lastChild); | ||
3256 | - var _57 = function(e, _59) { | ||
3257 | - var sv = []; | ||
3258 | - var _5b = e; | ||
3259 | - if (e.mergeAttributes) { | ||
3260 | - var _5b = d.createElement("form"); | ||
3261 | - _5b.mergeAttributes(e, false); | ||
3262 | - } | ||
3263 | - for (var i = 0; i < _59.length; i++) { | ||
3264 | - var k = _59[i][0], | ||
3265 | - v = _59[i][1]; | ||
3266 | - sv[sv.length] = [k, _5b.getAttribute(k)]; | ||
3267 | - _5b.setAttribute(k, v); | ||
3268 | - } | ||
3269 | - if (e.mergeAttributes) { | ||
3270 | - e.mergeAttributes(_5b, false); | ||
3271 | - } | ||
3272 | - return sv; | ||
3273 | - }; | ||
3274 | - var _5f = function() { | ||
3275 | - top.JsHttpRequestGlobal = JsHttpRequest; | ||
3276 | - var _60 = []; | ||
3277 | - if (!_4f) { | ||
3278 | - for (var i = 0, n = _4e.elements.length; i < n; i++) { | ||
3279 | - _60[i] = _4e.elements[i].name; | ||
3280 | - _4e.elements[i].name = ""; | ||
3281 | - } | ||
3282 | - } | ||
3283 | - var qt = th.queryText.split("&"); | ||
3284 | - for (var i = qt.length - 1; i >= 0; i--) { | ||
3285 | - var _64 = qt[i].split("=", 2); | ||
3286 | - var e = d.createElement("INPUT"); | ||
3287 | - e.type = "hidden"; | ||
3288 | - e.name = unescape(_64[0]); | ||
3289 | - e.value = _64[1] != null ? unescape(_64[1]) : ""; | ||
3290 | - _4e.appendChild(e); | ||
3291 | - } | ||
3292 | - for (var i = 0; i < th.queryElem.length; i++) { | ||
3293 | - th.queryElem[i].e.name = th.queryElem[i].name; | ||
3294 | - } | ||
3295 | - var sv = _57(_4e, [ | ||
3296 | - ["action", th.url], | ||
3297 | - ["method", th.method], | ||
3298 | - ["onsubmit", null], | ||
3299 | - ["target", _55] | ||
3300 | - ]); | ||
3301 | - _4e.submit(); | ||
3302 | - _57(_4e, sv); | ||
3303 | - for (var i = 0; i < qt.length; i++) { | ||
3304 | - _4e.lastChild.parentNode.removeChild(_4e.lastChild); | ||
3305 | - } | ||
3306 | - if (!_4f) { | ||
3307 | - for (var i = 0, n = _4e.elements.length; i < n; i++) { | ||
3308 | - _4e.elements[i].name = _60[i]; | ||
3309 | - } | ||
3310 | - } | ||
3311 | - }; | ||
3312 | - JsHttpRequest.setTimeout(_5f, 100); | ||
3313 | - return null; | ||
3314 | - }; | ||
3315 | - } | ||
3316 | -};; | 2580 | + |
3317 | ! function(a) { | 2581 | ! function(a) { |
3318 | "function" == typeof define && define.amd ? define(["jquery"], a) : a("object" == typeof exports ? require("jquery") : jQuery) | 2582 | "function" == typeof define && define.amd ? define(["jquery"], a) : a("object" == typeof exports ? require("jquery") : jQuery) |
3319 | } | 2583 | } |