Commit 83131e64 authored by Виталий Мурашко's avatar Виталий Мурашко

Merge branch 'master' of http://git.task-on.com/ktask/task-on.com

parents 9eb9e4e8 f11c87da
...@@ -16,15 +16,16 @@ return [ ...@@ -16,15 +16,16 @@ return [
'modules' => [ 'modules' => [
'languages' => ['class' => 'common\modules\languages\Module'], 'languages' => ['class' => 'common\modules\languages\Module'],
'content' => ['class' => 'common\modules\content\Module'], 'content' => ['class' => 'common\modules\content\Module'],
'bids' => ['class' => 'common\modules\bids\Module'],
'faq' => ['class' => 'common\modules\faq\Module'], 'faq' => ['class' => 'common\modules\faq\Module'],
'reviews' => ['class' => 'common\modules\reviews\Module'], 'reviews' => ['class' => 'common\modules\reviews\Module'],
'users' => ['class' => 'common\modules\users\users'], 'users' => ['class' => 'common\modules\users\users'],
'testings' => ['class' => 'common\modules\testings\Module'], 'testings' => ['class' => 'common\modules\testings\Module'],
'main' => ['class' => 'common\modules\main\main'], 'main' => ['class' => 'common\modules\main\main'],
'rbac' => ['class' => 'common\modules\rbac\rbac'],
'utility' => ['class' => 'c006\utility\migration\Module'], 'utility' => ['class' => 'c006\utility\migration\Module'],
'triggers' => ['class' => 'common\modules\triggers\Module'], 'triggers' => ['class' => 'common\modules\triggers\Module'],
'school' => ['class' => 'common\modules\school\Module'], 'school' => ['class' => 'common\modules\school\Module'],
'rbac' => ['class' => 'common\modules\rbac\rbac'],
], ],
'components' => [ 'components' => [
'session' => [ 'session' => [
......
...@@ -27,9 +27,9 @@ $base_url = ...@@ -27,9 +27,9 @@ $base_url =
// Get domain portion // Get domain portion
$_SERVER['HTTP_HOST']; // DON'T TOUCH (base url (only domain) of site (without final /)). $_SERVER['HTTP_HOST']; // DON'T TOUCH (base url (only domain) of site (without final /)).
$upload_dir = '/source/'; // path from base_url to base of upload folder (with start and final /) $upload_dir = '/source/'; // path from base_url to base of upload folder (with start and final /)
$current_path = '../source/'; // relative path from filemanager folder to upload folder (with final /) $current_path = '../../../frontend/web/uploads/source/'; // relative path from filemanager folder to upload folder (with final /)
//thumbs folder can't put inside upload folder //thumbs folder can't put inside upload folder
$thumbs_base_path = '../thumbs/'; // relative path from filemanager folder to thumbs folder (with final /) $thumbs_base_path = '../../../frontend/web/uploads/thumbs/'; // relative path from filemanager folder to thumbs folder (with final /)
// OPTIONAL SECURITY // OPTIONAL SECURITY
// if set to true only those will access RF whose url contains the access key(akey) like: // if set to true only those will access RF whose url contains the access key(akey) like:
......
<?php
namespace common\modules\bids;
/**
* bids module definition class
*/
class Module extends \common\components\WebModule
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'common\modules\bids\controllers';
public static $active = true;
public $menu_icons = 'fa fa-inbox';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
public static function name()
{
return 'Управление заявками';
}
public static function description()
{
return 'Управление заявками';
}
public static function version()
{
return '1.0';
}
public static function adminMenu()
{
return array(
'Список заявок' => '/bids/bid-admin/manage',
);
}
}
<?php
namespace common\modules\bids\controllers;
use Yii;
use common\modules\bids\models\Bid;
use common\modules\bids\models\SearchBid;
use common\components\AdminController;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* BidAdminController implements the CRUD actions for Bid model.
*/
class BidAdminController extends AdminController
{
public static function actionsTitles(){
return [
'Manage' => 'Управление заявками',
'Create' => 'Добавление заявки',
'Update' => 'Редактирование заявки',
'Delete' => 'Удаление заявки',
'View' => 'Просмотр заявки',
];
}
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Bid models.
* @return mixed
*/
public function actionManage()
{
$searchModel = new SearchBid();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('manage', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Bid model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Bid model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Bid();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Bid model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Bid model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Bid model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Bid the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Bid::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
<?php
namespace common\modules\bids\controllers;
use Yii;
use yii\helpers\Json;
use yii\web\NotFoundHttpException;
use yii\widgets\ActiveForm;
use yii\web\Response;
use yii\web\UploadedFile;
use common\modules\bids\models\Bid;
/**
* BidAdminController implements the CRUD actions for Bid model.
*/
class BidController extends \common\components\BaseController
{
public static function actionsTitles()
{
return [
'Add' => 'Добавление заявки',
];
}
/**
* Lists all Bid models.
* @return mixed
*/
public function actionAdd()
{
$model = new Bid;
$model->scenario = Yii::$app->request->post('scenario');
if(Yii::$app->request->isAjax)
{
$model->load(Yii::$app->request->post());
$model->file = UploadedFile::getInstance($model, 'file');
Yii::$app->response->format = Response::FORMAT_JSON;
if($model->validate())
{
if($model->file)
{
$model->upload();
$model->file = null;
}
$model->save();
$model->send();
return ['success' => true];
}
else
{
return ActiveForm::validate($model);
}
}
else
{
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
<?php
namespace common\modules\bids\models;
use Yii;
/**
* This is the model class for table "bids".
*
* @property integer $id
* @property string $name
* @property string $phone
* @property string $file
* @property string $text
*/
class Bid extends \common\components\ActiveRecordModel
{
const SCENARIO_PROJECT = 'project';
const SCENARIO_CALLBACK = 'callback';
const FILE_FOLDER = '/uploads/bids/';
public $file;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'bids';
}
/**
* @inheritdoc
*/
public function name()
{
return 'Заявки';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'phone', 'email'], 'required', 'on' => self::SCENARIO_PROJECT],
[['email'], 'email', 'on' => self::SCENARIO_PROJECT],
[['name', 'phone'], 'required', 'on' => self::SCENARIO_CALLBACK],
[['file'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif, xls, xlsx, doc, docx, pdf'],
[['text'], 'string'],
[['name'], 'string', 'max' => 100],
[['phone'], 'string', 'max' => 30],
[['email'], 'string', 'max' => 70],
[['filename'], 'string', 'max' => 50],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => '#',
'name' => 'Имя',
'phone' => 'Телефон',
'email' => 'Email',
'filename' => 'Прикрепленный файл',
'file' => 'Прикрепленный файл',
'text' => 'Сообщение',
'created_at' => 'Дата добавления',
'updated_at' => 'Дата обновления',
];
}
public function getUrl()
{
return Yii::$app->params['frontUrl'] . self::FILE_FOLDER . $this->filename;
}
private function getPath()
{
return Yii::getAlias('@frontend/web') . self::FILE_FOLDER;
}
public function upload()
{
if(!file_exists($this->getPath()))
{
mkdir($this->getPath(), 0777, true);
}
$this->filename = date('dmYHis-') . uniqid() . '.' . $this->file->extension;
$this->file->saveAs($this->getPath() . $this->filename);
}
public function send()
{
}
}
<?php
namespace common\modules\bids\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\modules\bids\models\Bid;
/**
* SearchBid represents the model behind the search form about `common\modules\bids\models\Bid`.
*/
class SearchBid extends Bid
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id'], 'integer'],
[['name', 'phone', 'email', 'filename', 'text', 'created_at'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Bid::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'created_at' => ($this->created_at?strtotime($this->created_at):$this->created_at),
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'phone', $this->phone])
->andFilterWhere(['like', 'email', $this->email])
->andFilterWhere(['like', 'filename', $this->filename])
->andFilterWhere(['like', 'text', $this->text]);
return $dataProvider;
}
}
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\modules\bids\models\Bid */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="bid-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'file')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'text')->textarea(['rows' => 6]) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\modules\bids\models\SearchBid */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="bid-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'phone') ?>
<?= $form->field($model, 'file') ?>
<?= $form->field($model, 'text') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\modules\bids\models\Bid */
$this->title = 'Create Bid';
$this->params['breadcrumbs'][] = ['label' => 'Bids', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="bid-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use common\modules\bids\models\Bid;
/* @var $this yii\web\View */
/* @var $searchModel common\modules\bids\models\SearchBid */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Bids';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="bid-index">
<p>
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= \common\components\zii\AdminGrid::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
'id',
'name',
'phone',
'email:email',
[
'attribute' => 'filename',
'format' => 'html',
'value' => function($model)
{
return ($model->filename?Html::a($model->filename, $model->getUrl()):null);
}
],
'text:ntext',
[
'attribute' => 'created_at',
'format' => ['date', 'php:d.m.Y H:i:s']
],
[
'class' => 'common\components\ColorActionColumn',
'template' => '{view} {update}',
]
],
]); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\modules\bids\models\Bid */
$this->title = 'Update Bid: ' . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Bids', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="bid-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\modules\bids\models\Bid */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Bids', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="bid-view">
<p>
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'phone',
'email:email',
'file',
'text:ntext',
[
'attribute' => 'created_at',
'format' => ['date', 'php:d.m.Y H:i:s']
],
[
'attribute' => 'updated_at',
'format' => ['date', 'php:d.m.Y H:i:s']
],
],
]) ?>
</div>
...@@ -20,10 +20,10 @@ class BlockAdminController extends AdminController ...@@ -20,10 +20,10 @@ class BlockAdminController extends AdminController
public static function actionsTitles(){ public static function actionsTitles(){
return [ return [
'Manage' => 'Управление блоками', 'Manage' => 'Управление блоками',
'Create' => 'Добавление контента', 'Create' => 'Добавление блока',
'Update' => 'Редактирование контента', 'Update' => 'Редактирование блока',
'Delete' => 'Удаление контента', 'Delete' => 'Удаление блока',
'View' => 'Просмотр контента', 'View' => 'Просмотр блока',
]; ];
} }
......
<?php <?php
use yii\helpers\Html; use yii\helpers\Html;
use yii\grid\GridView;
use \yii\helpers\ArrayHelper; use \yii\helpers\ArrayHelper;
use \common\modules\content\models\CoCategory; use \common\modules\content\models\CoCategory;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
......
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160204_090228_create_bids extends Migration
{
public function up()
{
$this->createTable('bids', [
'id' => Schema::TYPE_PK,
'name' => Schema::TYPE_STRING . '(100) DEFAULT NULL',
'phone' => Schema::TYPE_STRING . '(30) DEFAULT NULL',
'email' => Schema::TYPE_STRING . '(70) DEFAULT NULL',
'filename' => Schema::TYPE_STRING . '(50) DEFAULT NULL',
'text' => Schema::TYPE_TEXT . ' DEFAULT NULL',
'created_at' => Schema::TYPE_INTEGER . '(11) NOT NULL',
'updated_at' => Schema::TYPE_INTEGER . '(11) NOT NULL',
]);
}
public function down()
{
$this->dropTable('bids');
}
}
...@@ -20,6 +20,7 @@ return [ ...@@ -20,6 +20,7 @@ return [
'faq' => ['class' => 'common\modules\faq\Module'], 'faq' => ['class' => 'common\modules\faq\Module'],
'main' => ['class' => 'common\modules\main\main'], 'main' => ['class' => 'common\modules\main\main'],
'school' => ['class' => 'common\modules\school\Module',], 'school' => ['class' => 'common\modules\school\Module',],
'bids' => ['class' => 'common\modules\bids\Module'],
'testings' => ['class' => 'common\modules\testings\Module',], 'testings' => ['class' => 'common\modules\testings\Module',],
'sitemap' => [ 'sitemap' => [
'class' => 'himiklab\sitemap\Sitemap', 'class' => 'himiklab\sitemap\Sitemap',
......
...@@ -17,4 +17,9 @@ ...@@ -17,4 +17,9 @@
<?php $this->registerJsFile('/js/jquery-validate.min.js', ['position' => yii\web\View::POS_END ]);?> <?php $this->registerJsFile('/js/jquery-validate.min.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/jquery.mb.YTPlayer.min.js', ['position' => yii\web\View::POS_END ]);?> <?php $this->registerJsFile('/js/jquery.mb.YTPlayer.min.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/jquery.PageScroll2id.min.js', ['position' => yii\web\View::POS_END ]);?> <?php $this->registerJsFile('/js/jquery.PageScroll2id.min.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/inputmask.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/jquery.inputmask.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/inputmask.phone.extensions.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/common.js', ['position' => yii\web\View::POS_END ]);?> <?php $this->registerJsFile('/js/common.js', ['position' => yii\web\View::POS_END ]);?>
\ No newline at end of file
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Url;
use common\modules\bids\models\Bid;
?>
<style type="text/css">
.footer_form input,
.footer_form textarea {
margin-bottom: 9px;
}
.field-bid-file {
margin: 0;
}
</style>
<?php
$js = <<<JS
$('#bid-phone').inputmask("phone", {
url: "js/phone-codes/phone-codes.js",
});
$('form#form_foot').on('beforeSubmit', function(e) {
var form = $(this), xhr = new XMLHttpRequest, filebool = false, file, data = new FormData();
form.find('input, textarea').each(function(){
data.append($(this).attr('name'), $(this).val());
});
if(form.find('input[type=file]').length) {
file = form.find('input[type=file]')[0].files[0];
filebool = !filebool;
data.append("Bid[file]", file);
}
xhr.open("POST", '/bids/bid/add', true);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.send(data);
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4){
try
{
var response = JSON.parse(xhr.responseText);
}
catch(e)
{
var response = xhr.responseText;
}
if(response.success)
{
form.find('input[name!="scenario"], textarea').val('');
}
}
}
}).on('submit', function(e){
return false;
});
JS;
$this->registerJs($js);
?>
<footer> <footer>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
...@@ -5,16 +74,48 @@ ...@@ -5,16 +74,48 @@
<div class="calk_form"> <div class="calk_form">
<span class="calk_form__title">Рассчитать проект</span> <span class="calk_form__title">Рассчитать проект</span>
<span class="calk_form_subtitle">Готовы обсудить любой проект. Есть идея или готовое ТЗ по проекту - отправьте его нам</span> <span class="calk_form_subtitle">Готовы обсудить любой проект. Есть идея или готовое ТЗ по проекту - отправьте его нам</span>
<form class="footer_form" id="form_foot">
<input type="text" placeholder="Ваше имя*" name="name" class="footer_form__input field-input required alphanumeric">
<input type="tel" placeholder="Телефон*" name="phone" class="footer_form__input field-input required alphanumeric"> <?php
<input type="email" placeholder="E-mail*" class="footer_form__input field-input required email"> $model = new Bid;
<textarea placeholder="Опишите в двух словах ваш проект" class="footer_form__textarea"></textarea> $model->scenario = Bid::SCENARIO_PROJECT;
$form = ActiveForm::begin([
'id' => 'form_foot',
'action' => '/',
'options' => [
'class' => 'footer_form',
'enctype' => 'multipart/form-data'
],
]); ?>
<?php echo Html::hiddenInput('scenario', $model->scenario); ?>
<?php echo $form->field($model, 'name')->textInput([
'placeholder' => 'Ваше имя*',
'class' => 'footer_form__input'
])->label(false); ?>
<?php echo $form->field($model, 'phone')->textInput([
'placeholder' => 'Телефон*',
'class' => 'footer_form__input'
])->label(false); ?>
<?php echo $form->field($model, 'email')->textInput([
'placeholder' => 'E-mail*',
'class' => 'footer_form__input'
])->label(false); ?>
<?php echo $form->field($model, 'text')->textArea([
'placeholder' => 'Опишите в двух словах ваш проект',
'class' => 'footer_form__textarea'
])->label(false); ?>
<div class="file-upload_block"> <div class="file-upload_block">
<div class="file_upload_bt"> <div class="file_upload_bt">
<div class="file-upload"> <div class="file-upload">
<label> <label>
<input type="file" name="file"> <?php echo $form->field($model, 'file')->fileInput()->label(false); ?>
<span>Выбрать файл</span> <span>Выбрать файл</span>
</label> </label>
</div> </div>
...@@ -22,8 +123,10 @@ ...@@ -22,8 +123,10 @@
<div class="file_drop">Перетащите файл в данную область<br/> или выберите файл с компьютера</div> <div class="file_drop">Перетащите файл в данную область<br/> или выберите файл с компьютера</div>
</div> </div>
</div> </div>
<button class="btn-default save-button">Рассчитать проект</button>
</form> <?php echo Html::submitButton('Рассчитать проект', ['class' => 'btn-default save-button']); ?>
<?php ActiveForm::end(); ?>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
/index-test.php /index-test.php
/assets /assets
/uploads/* /uploads/*
/source/*
\ No newline at end of file
...@@ -347,36 +347,36 @@ $(document).ready(function() { ...@@ -347,36 +347,36 @@ $(document).ready(function() {
} }
}); });
}); });
$(function () { // $(function () {
window.validation.init({ // window.validation.init({
container: '.valid_form', // container: '.valid_form',
}); // });
}); // });
$(function () { // $(function () {
window.validation.init({ // window.validation.init({
container: '.footer_form', // container: '.footer_form',
}); // });
}); // });
$(function () { // $(function () {
window.validation.init({ // window.validation.init({
container: '.sect_cont_form', // container: '.sect_cont_form',
}); // });
}); // });
$(function () { // $(function () {
window.validation.init({ // window.validation.init({
container: '.validreg_form', // container: '.validreg_form',
}); // });
}); // });
$(function () { // $(function () {
window.validation.init({ // window.validation.init({
container: '.sh_reg_form', // container: '.sh_reg_form',
}); // });
}); // });
$(function () { // $(function () {
window.validation.init({ // window.validation.init({
container: '.keys_mail_form', // container: '.keys_mail_form',
}); // });
}); // });
$(".toggle-mnu").click(function () { $(".toggle-mnu").click(function () {
$(".menu").toggleClass("menu_active"); $(".menu").toggleClass("menu_active");
}); });
......
This diff is collapsed.
(function(factory) {
if (typeof define === "function" && define.amd) {
define(["jquery"], factory);
} else if (typeof exports === "object") {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
}
}
(function($) {
window.dependencyLib = $;
return $;
}));
/*
Input Mask plugin extensions
http://github.com/RobinHerbots/jquery.inputmask
Copyright (c) 2010 - Robin Herbots
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
Version: 0.0.0-dev
Optional extensions on the jquery.inputmask base
*/
(function(factory) {
if (typeof define === "function" && define.amd) {
define(["inputmask.dependencyLib", "inputmask"], factory);
} else if (typeof exports === "object") {
module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask"));
} else {
factory(window.dependencyLib || jQuery, window.Inputmask);
}
}
(function($, Inputmask) {
//extra definitions
Inputmask.extendDefinitions({
"A": {
validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
cardinality: 1,
casing: "upper" //auto uppercasing
},
"&": { //alfanumeric uppercasing
validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
cardinality: 1,
casing: "upper"
},
"#": { //hexadecimal
validator: "[0-9A-Fa-f]",
cardinality: 1,
casing: "upper"
}
});
Inputmask.extendAliases({
"url": {
definitions: {
"i": {
validator: ".",
cardinality: 1
}
},
mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",
insertMode: false,
autoUnmask: false
},
"ip": { //ip-address mask
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
definitions: {
"i": {
validator: function(chrs, maskset, pos, strict, opts) {
if (pos - 1 > -1 && maskset.buffer[pos - 1] !== ".") {
chrs = maskset.buffer[pos - 1] + chrs;
if (pos - 2 > -1 && maskset.buffer[pos - 2] !== ".") {
chrs = maskset.buffer[pos - 2] + chrs;
} else chrs = "0" + chrs;
} else chrs = "00" + chrs;
return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
},
cardinality: 1
}
},
onUnMask: function(maskedValue, unmaskedValue, opts) {
return maskedValue;
}
},
"email": {
mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
greedy: false,
onBeforePaste: function(pastedValue, opts) {
pastedValue = pastedValue.toLowerCase();
return pastedValue.replace("mailto:", "");
},
definitions: {
"*": {
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
cardinality: 1,
casing: "lower"
}
},
onUnMask: function(maskedValue, unmaskedValue, opts) {
return maskedValue;
}
},
"mac": {
mask: "##:##:##:##:##:##"
}
});
return Inputmask;
}));
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/*
Input Mask plugin extensions
http://github.com/RobinHerbots/jquery.inputmask
Copyright (c) 2010 - Robin Herbots
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
Version: 0.0.0-dev
Phone extension.
When using this extension make sure you specify the correct url to get the masks
$(selector).inputmask("phone", {
url: "Scripts/jquery.inputmask/phone-codes/phone-codes.json",
onKeyValidation: function () { //show some metadata in the console
console.log($(this).inputmask("getmetadata")["cd"]);
}
});
*/
(function(factory) {
if (typeof define === "function" && define.amd) {
define(["jquery", "inputmask"], factory);
} else if (typeof exports === "object") {
module.exports = factory(require("jquery"), require("./inputmask"));
} else {
factory(window.dependencyLib || jQuery, window.Inputmask);
}
}
(function($, Inputmask) {
Inputmask.extendAliases({
"phone": {
url: "phone-codes/phone-codes.js",
countrycode: "",
phoneCodeCache: {},
mask: function(opts) {
if (opts.phoneCodeCache[opts.url] === undefined) {
var maskList = [];
opts.definitions["#"] = opts.definitions["9"];
$.ajax({
url: opts.url,
async: false,
type: "get",
dataType: "json",
success: function(response) {
maskList = response;
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + " - " + opts.url);
}
});
opts.phoneCodeCache[opts.url] = maskList.sort(function(a, b) {
return (a.mask || a) < (b.mask || b) ? -1 : 1;
});
}
return opts.phoneCodeCache[opts.url];
},
keepStatic: false,
nojumps: true,
nojumpsThreshold: 1,
onBeforeMask: function(value, opts) {
var processedValue = value.replace(/^0{1,2}/, "").replace(/[\s]/g, "");
if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) === -1) {
processedValue = "+" + opts.countrycode + processedValue;
}
return processedValue;
}
},
"phonebe": {
alias: "phone",
url: "phone-codes/phone-be.js",
countrycode: "32",
nojumpsThreshold: 4
}
});
return Inputmask;
}));
/*
Input Mask plugin extensions
http://github.com/RobinHerbots/jquery.inputmask
Copyright (c) 2010 - Robin Herbots
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
Version: 0.0.0-dev
Regex extensions on the jquery.inputmask base
Allows for using regular expressions as a mask
*/
(function(factory) {
if (typeof define === "function" && define.amd) {
define(["inputmask.dependencyLib", "inputmask"], factory);
} else if (typeof exports === "object") {
module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask"));
} else {
factory(window.dependencyLib || jQuery, window.Inputmask);
}
}
(function($, Inputmask) {
Inputmask.extendAliases({ // $(selector).inputmask("Regex", { regex: "[0-9]*"}
"Regex": {
mask: "r",
greedy: false,
repeat: "*",
regex: null,
regexTokens: null,
//Thx to https://github.com/slevithan/regex-colorizer for the tokenizer regex
tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
quantifierFilter: /[0-9]+[^,]/,
isComplete: function(buffer, opts) {
return new RegExp(opts.regex).test(buffer.join(""));
},
definitions: {
"r": {
validator: function(chrs, maskset, pos, strict, opts) {
var cbuffer = maskset.buffer.slice(),
bufferStr,
regexPart = "",
isValid = false,
openGroupCount = 0,
groupToken;
function RegexToken(isGroup, isQuantifier) {
this.matches = [];
this.isGroup = isGroup || false;
this.isQuantifier = isQuantifier || false;
this.quantifier = {
min: 1,
max: 1
};
this.repeaterPart = undefined;
}
function analyseRegex() {
var currentToken = new RegexToken(),
match, m, opengroups = [];
opts.regexTokens = [];
// The tokenizer regex does most of the tokenization grunt work
while (match = opts.tokenizer.exec(opts.regex)) {
m = match[0];
switch (m.charAt(0)) {
case "(": // Group opening
opengroups.push(new RegexToken(true));
break;
case ")": // Group closing
groupToken = opengroups.pop();
if (opengroups.length > 0) {
opengroups[opengroups.length - 1].matches.push(groupToken);
} else {
currentToken.matches.push(groupToken);
}
break;
case "{":
case "+":
case "*": //Quantifier
var quantifierToken = new RegexToken(false, true);
m = m.replace(/[{}]/g, "");
var mq = m.split(","),
mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]),
mq1 = mq.length === 1 ? mq0 : (isNaN(mq[1]) ? mq[1] : parseInt(mq[1]));
quantifierToken.quantifier = {
min: mq0,
max: mq1
};
if (opengroups.length > 0) {
var matches = opengroups[opengroups.length - 1].matches;
match = matches.pop();
if (!match.isGroup) {
groupToken = new RegexToken(true);
groupToken.matches.push(match);
match = groupToken;
}
matches.push(match);
matches.push(quantifierToken);
} else {
match = currentToken.matches.pop();
if (!match.isGroup) {
groupToken = new RegexToken(true);
groupToken.matches.push(match);
match = groupToken;
}
currentToken.matches.push(match);
currentToken.matches.push(quantifierToken);
}
break;
default:
if (opengroups.length > 0) {
opengroups[opengroups.length - 1].matches.push(m);
} else {
currentToken.matches.push(m);
}
break;
}
}
if (currentToken.matches.length > 0) {
opts.regexTokens.push(currentToken);
}
}
function validateRegexToken(token, fromGroup) {
var isvalid = false;
if (fromGroup) {
regexPart += "(";
openGroupCount++;
}
for (var mndx = 0; mndx < token.matches.length; mndx++) {
var matchToken = token.matches[mndx];
if (matchToken.isGroup === true) {
isvalid = validateRegexToken(matchToken, true);
} else if (matchToken.isQuantifier === true) {
var crrntndx = $.inArray(matchToken, token.matches),
matchGroup = token.matches[crrntndx - 1];
var regexPartBak = regexPart;
if (isNaN(matchToken.quantifier.max)) {
while (matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length) {
isvalid = validateRegexToken(matchGroup, true);
if (isvalid) break;
}
isvalid = isvalid || validateRegexToken(matchGroup, true);
if (isvalid) matchToken.repeaterPart = regexPart;
regexPart = regexPartBak + matchToken.quantifier.max;
} else {
for (var i = 0, qm = matchToken.quantifier.max - 1; i < qm; i++) {
isvalid = validateRegexToken(matchGroup, true);
if (isvalid) break;
}
regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
}
} else if (matchToken.matches !== undefined) {
for (var k = 0; k < matchToken.length; k++) {
isvalid = validateRegexToken(matchToken[k], fromGroup);
if (isvalid) break;
}
} else {
var testExp;
if (matchToken.charAt(0) == "[") {
testExp = regexPart;
testExp += matchToken;
for (var j = 0; j < openGroupCount; j++) {
testExp += ")";
}
var exp = new RegExp("^(" + testExp + ")$");
isvalid = exp.test(bufferStr);
} else {
for (var l = 0, tl = matchToken.length; l < tl; l++) {
if (matchToken.charAt(l) === "\\") continue;
testExp = regexPart;
testExp += matchToken.substr(0, l + 1);
testExp = testExp.replace(/\|$/, "");
for (var j = 0; j < openGroupCount; j++) {
testExp += ")";
}
var exp = new RegExp("^(" + testExp + ")$");
isvalid = exp.test(bufferStr);
if (isvalid) break;
}
}
regexPart += matchToken;
}
if (isvalid) break;
}
if (fromGroup) {
regexPart += ")";
openGroupCount--;
}
return isvalid;
}
if (opts.regexTokens === null) {
analyseRegex();
}
cbuffer.splice(pos, 0, chrs);
bufferStr = cbuffer.join("");
for (var i = 0; i < opts.regexTokens.length; i++) {
var regexToken = opts.regexTokens[i];
isValid = validateRegexToken(regexToken, regexToken.isGroup);
if (isValid) break;
}
return isValid;
},
cardinality: 1
}
}
}
});
return Inputmask;
}));
/*
* Input Mask plugin for jquery
* http://github.com/RobinHerbots/jquery.inputmask
* Copyright (c) 2010 - Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 0.0.0-dev
*/
(function(factory) {
if (typeof define === "function" && define.amd) {
define(["jquery", "inputmask"], factory);
} else if (typeof exports === "object") {
module.exports = factory(require("jquery"), require("./inputmask"));
} else {
factory(jQuery, window.Inputmask);
}
}
(function($, Inputmask) {
if ($.fn.inputmask === undefined) {
//jquery plugin
$.fn.inputmask = function(fn, options) {
var nptmask, input = this[0];
options = options || {};
if (typeof fn === "string") {
switch (fn) {
case "unmaskedvalue":
return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
case "remove":
return this.each(function() {
if (this.inputmask) this.inputmask.remove();
});
case "getemptymask":
return input && input.inputmask ? input.inputmask.getemptymask() : "";
case "hasMaskedValue": //check wheter the returned value is masked or not; currently only works reliable when using jquery.val fn to retrieve the value
return input && input.inputmask ? input.inputmask.hasMaskedValue() : false;
case "isComplete":
return input && input.inputmask ? input.inputmask.isComplete() : true;
case "getmetadata": //return mask metadata if exists
return input && input.inputmask ? input.inputmask.getmetadata() : undefined;
case "setvalue":
$(input).val(options);
if (input && input.inputmask !== undefined) {
$(input).triggerHandler("setvalue");
}
break;
case "option":
if (typeof options === "string") {
if (input && input.inputmask !== undefined) {
return input.inputmask.option(options);
}
} else {
return this.each(function() {
if (this.inputmask !== undefined) {
return this.inputmask.option(options);
}
});
}
break;
default:
options.alias = fn;
nptmask = new Inputmask(options);
return this.each(function() {
nptmask.mask(this);
});
}
} else if (typeof fn == "object") {
nptmask = new Inputmask(fn);
if (fn.mask === undefined && fn.alias === undefined) {
return this.each(function() {
if (this.inputmask !== undefined) {
return this.inputmask.option(fn);
} else nptmask.mask(this);
});
} else {
return this.each(function() {
nptmask.mask(this);
});
}
} else if (fn === undefined) {
//look for data-inputmask atributes
return this.each(function() {
nptmask = new Inputmask(options);
nptmask.mask(this);
});
}
};
}
return $.fn.inputmask;
}));
[
{ "mask": "+32(53)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Aalst (Alost)" },
{ "mask": "+32(3)###-##-##", "cc": "BE", "cd": "Belgium", "city": "Antwerpen (Anvers)" },
{ "mask": "+32(63)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Arlon" },
{ "mask": "+32(67)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Ath" },
{ "mask": "+32(50)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Brugge (Bruges)" },
{ "mask": "+32(2)###-##-##", "cc": "BE", "cd": "Belgium", "city": "Brussel/Bruxelles (Brussels)" },
{ "mask": "+32(71)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Charleroi" },
{ "mask": "+32(60)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Chimay" },
{ "mask": "+32(83)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Ciney" },
{ "mask": "+32(52)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Dendermonde" },
{ "mask": "+32(13)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Diest" },
{ "mask": "+32(82)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Dinant" },
{ "mask": "+32(86)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Durbuy" },
{ "mask": "+32(89)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Genk" },
{ "mask": "+32(9)###-##-##", "cc": "BE", "cd": "Belgium", "city": "Gent (Gand)" },
{ "mask": "+32(11)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Hasselt" },
{ "mask": "+32(14)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Herentals" },
{ "mask": "+32(85)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Huy (Hoei)" },
{ "mask": "+32(64)##-##-##", "cc": "BE", "cd": "Belgium", "city": "La Louvière" },
{ "mask": "+32(16)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Leuven (Louvain)" },
{ "mask": "+32(61)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Libramont" },
{ "mask": "+32(4)###-##-##", "cc": "BE", "cd": "Belgium", "city": "Liège (Luik)" },
{ "mask": "+32(15)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mechelen (Malines)" },
{ "mask": "+32(46#)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mobile Phones" },
{ "mask": "+32(47#)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mobile Phones" },
{ "mask": "+32(48#)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mobile Phones" },
{ "mask": "+32(49#)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mobile Phones" },
{ "mask": "+32(461)8#-##-##", "cc": "BE", "cd": "Belgium", "city": "GSM-R (NMBS)" },
{ "mask": "+32(65)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mons (Bergen)" },
{ "mask": "+32(81)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Namur (Namen)" },
{ "mask": "+32(58)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Nieuwpoort (Nieuport)" },
{ "mask": "+32(54)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Ninove" },
{ "mask": "+32(67)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Nivelles (Nijvel)" },
{ "mask": "+32(59)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Oostende (Ostende)" },
{ "mask": "+32(51)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Roeselare (Roulers)" },
{ "mask": "+32(55)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Ronse" },
{ "mask": "+32(80)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Stavelot" },
{ "mask": "+32(12)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Tongeren (Tongres)" },
{ "mask": "+32(69)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Tounai" },
{ "mask": "+32(14)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Turnhout" },
{ "mask": "+32(87)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Verviers" },
{ "mask": "+32(58)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Veurne" },
{ "mask": "+32(19)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Wareme" },
{ "mask": "+32(10)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Wavre (Waver)" },
{ "mask": "+32(50)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Zeebrugge" }
]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment