Файл: adultscript-2.0.3-pro/files/templates/defboot/video_edit.tpl.php
Строк: 190
<?php defined('_VALID') or die('Restricted Access!'); ?>
<link href="<?php echo TPL_REL; ?>/css/bootstrap-tagsinput.css" rel="stylesheet">
<script src="<?php echo TPL_REL; ?>/js/bootstrap-tagsinput.min.js" type="text/javascript" ></script>
<script type="text/javascript">
$(document).ready(function() {
$("textarea#tags").tagsinput();
$("div[id^='thumb-']").click(function() {
var thumb = $(this).attr('id').match(/thumb-(.*)/)[1];
$("input[id='thumb']").val(thumb);
$("div[id^='thumb-']").removeClass('img-selected');
$(this).addClass('img-selected');
});
$("button[id='submit_edit_video']").click(function() {
var error = false;
var title = $("input[name='title']").val();
if (title == '') {
$("#title-group").removeClass('has-success').addClass('has-error');
$("#title-error").html('<?php echo __('title-empty'); ?>');
error = true;
} else if (title.length < <?php echo VCfg::get('video.title_min_length'); ?>) {
$("#title-group").removeClass('has-success').addClass('has-error');
$("#title-error").html('<?php echo __('title-length'); ?>');
error = true;
} else if (title.length > <?php echo VCfg::get('video.title_max_length'); ?>) {
$("#title-group").removeClass('has-success').addClass('has-error');
$("#title-error").html('<?php echo __('title-length'); ?>');
error = true;
} else {
$("#title-group").removeClass('has-error').addClass('has-success');
$("#title-error").html('');
}
var checked = $(":checkbox:checked").length;
if (checked == 0 || checked > <?php echo VCfg::get('video.max_categories'); ?>) {
$("#categories-group").removeClass('has-success').addClass('has-error');
$("#categories-error").html('<?php echo __('category-empty', array(VCfg::get('video.max_categories'))); ?>');
error = true;
} else {
$("#categories-group").removeClass('has-error').addClass('has-success');
$("#categories-error").html('');
}
var tags = $("textarea[name='tags']").val();
if (tags == '') {
$("#tags-group").removeClass('has-success').addClass('has-error');
$("#tags-error").html('<?php echo __('tags-empty'); ?>');
error = true;
} else if (tags.length < <?php echo VCfg::get('video.tags_min_length'); ?>) {
$("#tags-group").removeClass('has-success').addClass('has-error');
$("#tags-error").html('<?php echo __('tags-length', array(VCfg::get('video.tags_min_length'), VCfg::get('video.tags_max_length'))); ?>');
error = true;
} else if (tags.length > <?php echo VCfg::get('video.tags_max_length'); ?>) {
$("#tags-group").removeClass('has-success').addClass('has-error');
$("#tags-error").html('<?php echo __('tags-length', array(VCfg::get('video.tags_min_length'), VCfg::get('video.tags_max_length'))); ?>');
error = true;
} else {
$("#tags-error").html('');
var tag_max_length_error = '<?php echo __('tag-length', array('#TAG#', VCfg::get('video.tag_max_length'))); ?>';
var tag_max_words_error = '<?php echo __('tag-words', array('#TAG#', VCfg::get('video.tag_max_words'))); ?>';
var tags_error = false;
var arr = tags.split(',');
jQuery.each(arr, function() {
if (this.length > <?php echo VCfg::get('video.tag_max_length'); ?>) {
$("#tags-group").removeClass('has-success').addClass('has-error');
$("#tags-error").append(tag_max_length_error.replace('#TAG#', '"' + this + '"') + '<br>');
error = true;
tags_error = true;
} else if (this.split(' ').length > <?php echo VCfg::get('video.tag_max_words'); ?>) {
$("#tags-group").removeClass('has-success').addClass('has-error');
$("#tags-error").append(tag_max_words_error.replace('#TAG#', '"' + this + '"') + '<br>');
error = true;
tags_error = true;
}
});
if (!tags_error) {
$("#tags-group").removeClass('has-error').addClass('has-success');
$("#tags-error").html('');
}
}
if (error) {
return;
}
$("#edit-form").submit();
});
});
</script>
<div id="content" class="row">
<div class="col-xs-12 col-sm-12 col-md-10">
<div class="well well-small">
<h1><?= __('edit-title',': ',e($this->video['title'])); ?></h1>
<form id="edit-form" class="form-horizontal" role="form" method="post" action="<?= REL_URL,'/edit/',$this->video['video_id']; ?>/">
<input name="submit_edit_video" type="hidden" value="1">
<div id="title-group" class="form-group">
<label for="title" class="col-sm-2 control-label"><?php echo __('title'); ?></label>
<div class="col-sm-10">
<input name="title" type="text" class="form-control" id="title" value="<?php echo e($this->video['title']); ?>">
<span id="title-error" class="help-block text-danger"></span>
</div>
</div>
<div id="description-group" class="form-group">
<label for="description" class="col-sm-2 control-label"><?php echo __('description'); ?></label>
<div class="col-sm-10">
<textarea name="description" class="form-control" id="description"><?php echo e($this->video['description']); ?></textarea>
</div>
</div>
<div id="categories-group" class="form-group">
<label for="categories" class="col-sm-2 control-label"><?php echo __('categories'); ?></label>
<div class="col-sm-10">
<?php $categories = explode(',', $this->video['category']); foreach ($this->categories as $category): ?>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
<input id="category-<?php echo $category['cat_id']; ?>" name="category[]" type="checkbox" value="<?php echo $category['cat_id']; ?>"<?php if (in_array($category['cat_id'], $categories)): echo ' checked="checked"'; endif; echo '> ',e($category['name']); ?>
</div>
<?php endforeach; ?>
<div class="clearfix"></div>
<span id="categories-error" class="help-block text-danger"></span>
</div>
</div>
<div id="tags-group" class="form-group">
<label for="tags" class="col-sm-2 control-label"><?php echo __('tags'); ?></label>
<div class="col-sm-10">
<textarea name="tags" class="form-control" id="tags" data-role="tagsinput"><?php echo e($this->video['tags']); ?></textarea>
<span id="tags-error" class="help-block text-danger"></span>
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label"><?php echo __('type'); ?></label>
<label class="radio-inline"><input type="radio" name="type" id="type" value="public"<?php if ($this->video['type'] == 'public'): echo ' checked="checked"'; endif; ?>> <?php echo __('public'); ?></label>
<label class="radio-inline"><input type="radio" name="type" id="type-off" value="private"<?php if ($this->video['type'] == 'private'): echo ' checked="checked"'; endif; ?>> <?php echo __('private'); ?></label>
</div>
<div class="form-group">
<label for="allow_embed" class="col-sm-2 control-label"><?php echo __('allow-embed'); ?></label>
<label class="radio-inline"><input type="radio" name="allow_embed" id="allow_embed" value="public"<?php if ($this->video['allow_embed'] == '1'): echo ' checked="checked"'; endif; ?>> <?php echo __('yes'); ?></label>
<label class="radio-inline"><input type="radio" name="allow_embed" id="allow_embed-off" value="private"<?php if ($this->video['allow_embed'] == '0'): echo ' checked="checked"'; endif; ?>> <?php echo __('no'); ?></label>
</div>
<div class="form-group">
<label for="allow_rating" class="col-sm-2 control-label"><?php echo __('allow-rating'); ?></label>
<label class="radio-inline"><input type="radio" name="allow_rating" id="allow_rating" value="public"<?php if ($this->video['allow_rating'] == '1'): echo ' checked="checked"'; endif; ?>> <?php echo __('yes'); ?></label>
<label class="radio-inline"><input type="radio" name="allow_rating" id="allow_rating-off" value="private"<?php if ($this->video['allow_rating'] == '0'): echo ' checked="checked"'; endif; ?>> <?php echo __('no'); ?></label>
</div>
<div class="form-group">
<label for="allow_comment" class="col-sm-2 control-label"><?php echo __('allow-comment'); ?></label>
<label class="radio-inline"><input type="radio" name="allow_comment" id="allow_comment" value="public"<?php if ($this->video['allow_comment'] == '1'): echo ' checked="checked"'; endif; ?>> <?php echo __('yes'); ?></label>
<label class="radio-inline"><input type="radio" name="allow_comment" id="allow_comment-off" value="private"<?php if ($this->video['allow_comment'] == '0'): echo ' checked="checked"'; endif; ?>> <?php echo __('no'); ?></label>
</div>
<?php if ($this->video['embed_code'] != ''): ?>
<div class="form-group">
<label for="allow_download" class="col-sm-2 control-label"><?php echo __('allow-download'); ?></label>
<label class="radio-inline"><input type="radio" name="allow_download" id="allow_download" value="public"<?php if ($this->video['allow_download'] == '1'): echo ' checked="checked"'; endif; ?>> <?php echo __('yes'); ?></label>
<label class="radio-inline"><input type="radio" name="allow_download" id="allow_download-off" value="private"<?php if ($this->video['allow_download'] == '0'): echo ' checked="checked"'; endif; ?>> <?php echo __('no'); ?></label>
</div>
<?php endif; ?>
<div class="form-group">
<input name="thumb" type="hidden" value="<?php echo $this->video['thumb']; ?>">
<label for="thumbs" class="col-sm-2 control-label"><?php echo __('thumbs'); ?></label>
<div class="col-sm-10 row">
<?php for ($i=1; $i<=$this->video['thumbs']; $i++): ?>
<div id="thumb-<?php echo $i; ?>" class="col-xs-12 col-sm-6 col-md-2 col-lg-2 thumbnail<?php if ($this->video['thumb'] == $i): echo ' img-selected'; endif; ?>">
<img src="<?php echo THUMB_URL,'/',path($this->video['video_id']),'/',$i,'.jpg'; ?>" alt="" class="img-rounded img-thumb">
</div>
<?php endfor; ?>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" id="submit_edit_video" class="btn btn-default btn-lg"><?php echo __('update-video'); ?></button>
</div>
</div>
</form>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-2 pull-right">
<div class="well well-small">
</div>
</div>
</div>