first commit
This commit is contained in:
357
modules/leoblog/views/js/admin/form.js
Normal file
357
modules/leoblog/views/js/admin/form.js
Normal file
@@ -0,0 +1,357 @@
|
||||
/**
|
||||
* Owl carousel
|
||||
*
|
||||
* @copyright Commercial License By LeoTheme.Com
|
||||
* @email leotheme.com
|
||||
* @visit http://www.leotheme.com
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.fn.PavMegaMenuList = function(opts) {
|
||||
// default configuration
|
||||
var config = $.extend({}, {
|
||||
action:null,
|
||||
addnew : null,
|
||||
confirm_del:'Are you sure delete this?'
|
||||
}, opts);
|
||||
|
||||
function checkInputHanlder(){
|
||||
var _updateMenuType = function(){
|
||||
$(".menu-type-group").parent().parent().hide();
|
||||
$("[for^=content_text_]").parent().hide();
|
||||
|
||||
if( $("#menu_type").val() =='html' ){
|
||||
$("[for^=content_text_]").parent().show();
|
||||
}else {
|
||||
$("#"+$("#menu_type").val()+"_type").parent().parent().show();
|
||||
}
|
||||
};
|
||||
_updateMenuType();
|
||||
$("#menu_type").change( _updateMenuType );
|
||||
|
||||
var _updateSubmenuType = function(){
|
||||
if( $("#type_submenu").val() =='html' ){
|
||||
$("[for^=submenu_content_text_]").parent().show();
|
||||
}else{
|
||||
$("[for^=submenu_content_text_]").parent().hide();
|
||||
}
|
||||
};
|
||||
_updateSubmenuType();
|
||||
$("#type_submenu").change( _updateSubmenuType );
|
||||
|
||||
}
|
||||
|
||||
function manageTreeMenu(){
|
||||
if($('ol').hasClass("sortable")){
|
||||
$('ol.sortable').nestedSortable({
|
||||
forcePlaceholderSize: true,
|
||||
handle: 'div',
|
||||
helper: 'clone',
|
||||
items: 'li',
|
||||
opacity: .6,
|
||||
placeholder: 'placeholder',
|
||||
revert: 250,
|
||||
tabSize: 25,
|
||||
tolerance: 'pointer',
|
||||
toleranceElement: '> div',
|
||||
maxLevels: 4,
|
||||
|
||||
isTree: true,
|
||||
expandOnHover: 700,
|
||||
startCollapsed: true,
|
||||
|
||||
stop: function(){
|
||||
var serialized = $(this).nestedSortable('serialize');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: config.action.replace(/amp;/g, '')+"&doupdatepos=1&rand="+Math.random(),
|
||||
data : serialized+'&updatePosition=1'
|
||||
}).done( function (msg) {
|
||||
showSuccessMessage(msg);
|
||||
} );
|
||||
}
|
||||
});
|
||||
|
||||
// $('#serialize').click(function(){
|
||||
// var serialized = $('ol.sortable').nestedSortable('serialize');
|
||||
// var text = $(this).val();
|
||||
// var $this = $(this);
|
||||
// $(this).val( $(this).data('loading-text') );
|
||||
// $.ajax({
|
||||
// type: 'POST',
|
||||
// url: config.action+"&doupdatepos=1&rand="+Math.random(),
|
||||
// data : serialized+'&updatePosition=1'
|
||||
// }).done( function () {
|
||||
// $this.val( text );
|
||||
// } );
|
||||
// });
|
||||
|
||||
$('#addcategory').click(function(){
|
||||
location.href=config.addnew.replace(/amp;/g, '');
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* initialize every element
|
||||
*/
|
||||
this.each(function() {
|
||||
$(".quickedit",this).click( function(){
|
||||
location.href=config.action.replace(/amp;/g, '')+"&id_leoblogcat="+$(this).attr('rel').replace("id_","");
|
||||
} );
|
||||
|
||||
$(".quickdel",this).click( function(){
|
||||
if( confirm(config.confirm_del) ){
|
||||
location.href=config.action.replace(/amp;/g, '')+"&dodel=1&id_leoblogcat="+$(this).attr('rel').replace("id_","");
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
$(".delete_many_menus",this).click( function(){
|
||||
if (confirm('Delete selected items?'))
|
||||
{
|
||||
var list_menu = '';
|
||||
$('.quickselect:checkbox:checked').each(function () {
|
||||
list_menu += $(this).val() + ",";
|
||||
|
||||
});
|
||||
|
||||
if(list_menu != ''){
|
||||
location.href=config.action.replace(/amp;/g, '')+"&delete_many_menu=1&list="+list_menu;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
manageTreeMenu();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
$(".leo-modal").fancybox({
|
||||
'type':'iframe',
|
||||
'width':980,
|
||||
'height':500,
|
||||
afterLoad:function( ){
|
||||
if( $('body',$('.fancybox-iframe').contents()).find("#main").length ){
|
||||
$('body',$('.fancybox-iframe').contents()).find("#header").hide();
|
||||
$('body',$('.fancybox-iframe').contents()).find("#footer").hide();
|
||||
}else {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#widgetds a.btn").fancybox( {'type':'iframe'} );
|
||||
|
||||
$(".leo-modal-action, #widgets a.btn").fancybox({
|
||||
'type':'iframe',
|
||||
'width':950,
|
||||
'height':500,
|
||||
afterLoad:function( ){
|
||||
if( $('body',$('.fancybox-iframe').contents()).find("#main").length ){
|
||||
$('body',$('.fancybox-iframe').contents()).find("#header").hide();
|
||||
$('body',$('.fancybox-iframe').contents()).find("#footer").hide();
|
||||
}else {
|
||||
|
||||
}
|
||||
},
|
||||
afterClose: function (event, ui) {
|
||||
// location.reload();
|
||||
},
|
||||
});
|
||||
|
||||
//DONGND:: delete image uploaded
|
||||
if ($('#image_link-images-thumbnails').length > 0)
|
||||
{
|
||||
|
||||
leoblog_del_img($('#image_link-images-thumbnails'), 'image');
|
||||
}
|
||||
|
||||
if ($('#thumb_link-images-thumbnails').length > 0)
|
||||
{
|
||||
|
||||
leoblog_del_img($('#thumb_link-images-thumbnails'), 'thumb');
|
||||
}
|
||||
|
||||
$('.leoblog-del-img-bt').click(function(){
|
||||
if( confirm(leoblog_del_img_mess) ){
|
||||
var id_parent = $(this).data('id');
|
||||
$('#'+id_parent).parent().fadeOut(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
var id_element = $(this).data('element');
|
||||
$('#'+id_element).val('');
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
//load data template
|
||||
$('#template').change(function(){
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url_ajax_blog,
|
||||
headers: { "cache-control": "no-cache" },
|
||||
async: true,
|
||||
cache: false,
|
||||
dataType: "json",
|
||||
data: {
|
||||
template: $(this).val(),
|
||||
action: 'loadDataTemplate'
|
||||
},
|
||||
success: function (data_)
|
||||
{
|
||||
var data = JSON.parse(data_.message);
|
||||
|
||||
console.log(data);
|
||||
console.log(data.listing_show_categoryinfo);
|
||||
$("[name = indexation]").removeAttr('checked');
|
||||
$("[name = indexation][value="+data.indexation+"]").attr('checked','checked').click();
|
||||
$('#rss_limit_item').val(data.rss_limit_item);
|
||||
$('#rss_title_item').val(data.rss_title_item);
|
||||
|
||||
$("[name = listing_show_categoryinfo]").removeAttr('checked');
|
||||
$("[name = listing_show_categoryinfo][value="+data.listing_show_categoryinfo+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_subcategories]").removeAttr('checked');
|
||||
$("[name = listing_show_subcategories][value="+data.listing_show_subcategories+"]").attr('checked','checked').click();
|
||||
|
||||
$('#listing_leading_column').val(data.listing_leading_column);
|
||||
$('#listing_leading_limit_items').val(data.listing_leading_limit_items);
|
||||
$('#listing_leading_img_width').val(data.listing_leading_img_width);
|
||||
$('#listing_leading_img_height').val(data.listing_leading_img_height);
|
||||
$('#listing_secondary_column').val(data.listing_secondary_column);
|
||||
$('#listing_secondary_limit_items').val(data.listing_secondary_limit_items);
|
||||
$('#listing_secondary_img_width').val(data.listing_secondary_img_width);
|
||||
$('#listing_secondary_img_height').val(data.listing_secondary_img_height);
|
||||
|
||||
$("[name = listing_show_title]").removeAttr('checked');
|
||||
$("[name = listing_show_title][value="+data.listing_show_title+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_description]").removeAttr('checked');
|
||||
$("[name = listing_show_description][value="+data.listing_show_description+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_readmore]").removeAttr('checked');
|
||||
$("[name = listing_show_readmore][value="+data.listing_show_readmore+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_image]").removeAttr('checked');
|
||||
$("[name = listing_show_image][value="+data.listing_show_image+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_author]").removeAttr('checked');
|
||||
$("[name = listing_show_author][value="+data.listing_show_author+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_category]").removeAttr('checked');
|
||||
$("[name = listing_show_category][value="+data.listing_show_category+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_created]").removeAttr('checked');
|
||||
$("[name = listing_show_created][value="+data.listing_show_created+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_hit]").removeAttr('checked');
|
||||
$("[name = listing_show_hit][value="+data.listing_show_hit+"]").attr('checked','checked').click();
|
||||
$("[name = listing_show_counter]").removeAttr('checked');
|
||||
$("[name = listing_show_counter][value="+data.listing_show_counter+"]").attr('checked','checked').click();
|
||||
$('#item_img_width').val(data.item_img_width);
|
||||
$('#item_img_height').val(data.item_img_height);
|
||||
|
||||
$("[name = item_show_description]").removeAttr('checked');
|
||||
$("[name = item_show_description][value="+data.item_show_description+"]").attr('checked','checked').click();
|
||||
$("[name = item_show_image]").removeAttr('checked');
|
||||
$("[name = item_show_image][value="+data.item_show_image+"]").attr('checked','checked').click();
|
||||
$("[name = item_show_author]").removeAttr('checked');
|
||||
$("[name = item_show_author][value="+data.item_show_author+"]").attr('checked','checked').click();
|
||||
$("[name = item_show_category]").removeAttr('checked');
|
||||
$("[name = item_show_category][value="+data.item_show_category+"]").attr('checked','checked').click();
|
||||
$("[name = item_show_created]").removeAttr('checked');
|
||||
$("[name = item_show_created][value="+data.item_show_created+"]").attr('checked','checked').click();
|
||||
$("[name = item_show_hit]").removeAttr('checked');
|
||||
$("[name = item_show_hit][value="+data.item_show_hit+"]").attr('checked','checked').click();
|
||||
$("[name = item_show_counter]").removeAttr('checked');
|
||||
$("[name = item_show_counter][value="+data.item_show_counter+"]").attr('checked','checked').click();
|
||||
|
||||
$('#social_code').val(data.social_code);
|
||||
$("[name = item_show_listcomment]").removeAttr('checked');
|
||||
$("[name = item_show_listcomment][value="+data.item_show_listcomment+"]").attr('checked','checked').click();
|
||||
$("[name = item_show_formcomment]").removeAttr('checked');
|
||||
$("[name = item_show_formcomment][value="+data.item_show_formcomment+"]").attr('checked','checked').click();
|
||||
$("#item_comment_engine option").removeAttr('selected');
|
||||
$("#item_comment_engine option[value="+data.item_comment_engine+"]").attr('selected','selected');
|
||||
$('#item_limit_comments').val(data.item_limit_comments);
|
||||
$('#item_diquis_account').val(data.item_diquis_account);
|
||||
$('#item_facebook_appid').val(data.item_facebook_appid);
|
||||
$('#item_facebook_width').val(data.item_facebook_width);
|
||||
$("#url_use_id option").removeAttr('selected');
|
||||
$("#url_use_id option[value="+data.url_use_id+"]").attr('selected','selected');
|
||||
data.url_use_id == 0 ? $('.url_use_id_sub').show(500) : $('.url_use_id_sub').hide(300)
|
||||
|
||||
$("[name = show_popular_blog]").removeAttr('checked');
|
||||
$("[name = show_popular_blog][value="+data.show_popular_blog+"]").attr('checked','checked').click();
|
||||
$('#limit_popular_blog').val(data.limit_popular_blog);
|
||||
$("[name = show_recent_blog]").removeAttr('checked');
|
||||
$("[name = show_recent_blog][value="+data.show_recent_blog+"]").attr('checked','checked').click();
|
||||
$('#limit_recent_blog').val(data.limit_recent_blog);
|
||||
$("[name = show_all_tags]").removeAttr('checked');
|
||||
$("[name = show_all_tags][value="+data.show_all_tags+"]").attr('checked','checked').click();
|
||||
for (var id_lang of data_.id_lang) {
|
||||
$('#meta_title_'+id_lang).val(data.meta_title_1);
|
||||
$('#meta_description_').val(data.meta_description_1);
|
||||
$('#meta_keywords_'+id_lang).val(data.meta_keywords_1);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//DONGND;; function delete image uploaded
|
||||
|
||||
function leoblog_del_img(img_id_element, img_name_e)
|
||||
{
|
||||
img_id_element.append('<a class="btn btn-default leoblog-del-img-bt" href="#" data-element="'+img_name_e+'" data-id="'+img_id_element.attr('id')+'"><i class="icon-trash"></i>'+leoblog_del_img_txt+'</a>');
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
// var i = 0;
|
||||
// $("#bloggeneralsetting > form > .panel .form-group").hide();
|
||||
// $("#bloggeneralsetting > form > .panel .panel-footer").hide();
|
||||
|
||||
// $("#bloggeneralsetting > form > .panel").each( function() {
|
||||
// var panel = $(this);
|
||||
// $( "h3, .panel-heading" , this ).click( function(){
|
||||
// $("#bloggeneralsetting > form > .panel .form-group").hide();
|
||||
|
||||
|
||||
// $(".form-group",panel).show();
|
||||
// $(".panel-footer",panel).show();
|
||||
// } );
|
||||
// if(i++==0){
|
||||
// $(".form-group",this).show();
|
||||
// $(".panel-footer",this).show();
|
||||
// }
|
||||
|
||||
// } );
|
||||
|
||||
var id_panel = $("#bloggeneralsetting .leoblog-globalconfig li.active a").attr("href");
|
||||
$(id_panel).addClass('active').show();
|
||||
$('.leoblog-globalconfig li').click(function(){
|
||||
if(!$(this).hasClass('active'))
|
||||
{
|
||||
var default_tab = $(this).find('a').attr("href");
|
||||
$('#LEOBLOG_DASHBOARD_DEFAULTTAB').val(default_tab);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
/*
|
||||
* SHOW HIDE - URL include ID
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
$('.form-action').change(function(){
|
||||
var elementName = $(this).attr('name');
|
||||
$('.'+elementName+'_sub').hide(300);
|
||||
$('.'+elementName+'-'+$(this).val()).show(500);
|
||||
});
|
||||
$('.form-action').trigger("change");
|
||||
|
||||
});
|
||||
36
modules/leoblog/views/js/admin/index.php
Normal file
36
modules/leoblog/views/js/admin/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
424
modules/leoblog/views/js/admin/jquery.nestable.js
Normal file
424
modules/leoblog/views/js/admin/jquery.nestable.js
Normal file
@@ -0,0 +1,424 @@
|
||||
/**
|
||||
* Owl carousel
|
||||
*
|
||||
* @copyright Commercial License By LeoTheme.Com
|
||||
* @email leotheme.com
|
||||
* @visit http://www.leotheme.com
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.widget("mjs.nestedSortable", $.extend({}, $.ui.sortable.prototype, {
|
||||
|
||||
options: {
|
||||
tabSize: 20,
|
||||
disableNesting: 'mjs-nestedSortable-no-nesting',
|
||||
errorClass: 'mjs-nestedSortable-error',
|
||||
doNotClear: false,
|
||||
listType: 'ol',
|
||||
maxLevels: 0,
|
||||
protectRoot: false,
|
||||
rootID: null,
|
||||
rtl: false,
|
||||
isAllowed: function(item, parent) { return true; }
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
this.element.data('sortable', this.element.data('nestedSortable'));
|
||||
|
||||
if (!this.element.is(this.options.listType))
|
||||
throw new Error('nestedSortable: Please check the listType option is set to your actual list type');
|
||||
|
||||
return $.ui.sortable.prototype._create.apply(this, arguments);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.element
|
||||
.removeData("nestedSortable")
|
||||
.unbind(".nestedSortable");
|
||||
return $.ui.sortable.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
_mouseDrag: function(event) {
|
||||
|
||||
//Compute the helpers position
|
||||
this.position = this._generatePosition(event);
|
||||
this.positionAbs = this._convertPositionTo("absolute");
|
||||
|
||||
if (!this.lastPositionAbs) {
|
||||
this.lastPositionAbs = this.positionAbs;
|
||||
}
|
||||
|
||||
var o = this.options;
|
||||
|
||||
//Do scrolling
|
||||
if(this.options.scroll) {
|
||||
var scrolled = false;
|
||||
if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
|
||||
|
||||
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
|
||||
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
|
||||
else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
|
||||
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
|
||||
|
||||
if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
|
||||
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
|
||||
else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
|
||||
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
|
||||
|
||||
} else {
|
||||
|
||||
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
|
||||
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
||||
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
|
||||
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
||||
|
||||
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
|
||||
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
||||
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
|
||||
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
||||
|
||||
}
|
||||
|
||||
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
|
||||
$.ui.ddmanager.prepareOffsets(this, event);
|
||||
}
|
||||
|
||||
//Regenerate the absolute position used for position checks
|
||||
this.positionAbs = this._convertPositionTo("absolute");
|
||||
|
||||
// Find the top offset before rearrangement,
|
||||
var previousTopOffset = this.placeholder.offset().top;
|
||||
|
||||
//Set the helper position
|
||||
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
|
||||
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
|
||||
|
||||
//Rearrange
|
||||
for (var i = this.items.length - 1; i >= 0; i--) {
|
||||
|
||||
//Cache variables and intersection, continue if no intersection
|
||||
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
|
||||
if (!intersection) continue;
|
||||
|
||||
if(itemElement != this.currentItem[0] //cannot intersect with itself
|
||||
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
|
||||
&& !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
|
||||
&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
|
||||
//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
|
||||
) {
|
||||
|
||||
$(itemElement).mouseenter();
|
||||
|
||||
this.direction = intersection == 1 ? "down" : "up";
|
||||
|
||||
if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
|
||||
$(itemElement).mouseleave();
|
||||
this._rearrange(event, item);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
// Clear emtpy ul's/ol's
|
||||
this._clearEmpty(itemElement);
|
||||
|
||||
this._trigger("change", event, this._uiHash());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var parentItem = (this.placeholder[0].parentNode.parentNode &&
|
||||
$(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length)
|
||||
? $(this.placeholder[0].parentNode.parentNode)
|
||||
: null,
|
||||
level = this._getLevel(this.placeholder),
|
||||
childLevels = this._getChildLevels(this.helper);
|
||||
|
||||
// To find the previous sibling in the list, keep backtracking until we hit a valid list item.
|
||||
var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
|
||||
if (previousItem != null) {
|
||||
while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
|
||||
if (previousItem[0].previousSibling) {
|
||||
previousItem = $(previousItem[0].previousSibling);
|
||||
} else {
|
||||
previousItem = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// To find the next sibling in the list, keep stepping forward until we hit a valid list item.
|
||||
var nextItem = this.placeholder[0].nextSibling ? $(this.placeholder[0].nextSibling) : null;
|
||||
if (nextItem != null) {
|
||||
while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
|
||||
if (nextItem[0].nextSibling) {
|
||||
nextItem = $(nextItem[0].nextSibling);
|
||||
} else {
|
||||
nextItem = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var newList = document.createElement(o.listType);
|
||||
|
||||
this.beyondMaxLevels = 0;
|
||||
|
||||
// If the item is moved to the left, send it to its parent's level unless there are siblings below it.
|
||||
if (parentItem != null && nextItem == null &&
|
||||
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) ||
|
||||
!o.rtl && (this.positionAbs.left < parentItem.offset().left))) {
|
||||
parentItem.after(this.placeholder[0]);
|
||||
this._clearEmpty(parentItem[0]);
|
||||
this._trigger("change", event, this._uiHash());
|
||||
}
|
||||
// If the item is below a sibling and is moved to the right, make it a child of that sibling.
|
||||
else if (previousItem != null &&
|
||||
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize) ||
|
||||
!o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))) {
|
||||
this._isAllowed(previousItem, level, level+childLevels+1);
|
||||
if (!previousItem.children(o.listType).length) {
|
||||
previousItem[0].appendChild(newList);
|
||||
}
|
||||
// If this item is being moved from the top, add it to the top of the list.
|
||||
if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) {
|
||||
previousItem.children(o.listType).prepend(this.placeholder);
|
||||
}
|
||||
// Otherwise, add it to the bottom of the list.
|
||||
else {
|
||||
previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
|
||||
}
|
||||
this._trigger("change", event, this._uiHash());
|
||||
}
|
||||
else {
|
||||
this._isAllowed(parentItem, level, level+childLevels);
|
||||
}
|
||||
|
||||
//Post events to containers
|
||||
this._contactContainers(event);
|
||||
|
||||
//Interconnect with droppables
|
||||
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
|
||||
|
||||
//Call callbacks
|
||||
this._trigger('sort', event, this._uiHash());
|
||||
|
||||
this.lastPositionAbs = this.positionAbs;
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
_mouseStop: function(event, noPropagation) {
|
||||
|
||||
// If the item is in a position not allowed, send it back
|
||||
if (this.beyondMaxLevels) {
|
||||
|
||||
this.placeholder.removeClass(this.options.errorClass);
|
||||
|
||||
if (this.domPosition.prev) {
|
||||
$(this.domPosition.prev).after(this.placeholder);
|
||||
} else {
|
||||
$(this.domPosition.parent).prepend(this.placeholder);
|
||||
}
|
||||
|
||||
this._trigger("revert", event, this._uiHash());
|
||||
|
||||
}
|
||||
|
||||
// Clean last empty ul/ol
|
||||
for (var i = this.items.length - 1; i >= 0; i--) {
|
||||
var item = this.items[i].item[0];
|
||||
this._clearEmpty(item);
|
||||
}
|
||||
|
||||
$.ui.sortable.prototype._mouseStop.apply(this, arguments);
|
||||
|
||||
},
|
||||
|
||||
serialize: function(options) {
|
||||
|
||||
var o = $.extend({}, this.options, options),
|
||||
items = this._getItemsAsjQuery(o && o.connected),
|
||||
str = [];
|
||||
|
||||
$(items).each(function() {
|
||||
var res = ($(o.item || this).attr(o.attribute || 'id') || '')
|
||||
.match(o.expression || (/(.+)[-=_](.+)/)),
|
||||
pid = ($(o.item || this).parent(o.listType)
|
||||
.parent(o.items)
|
||||
.attr(o.attribute || 'id') || '')
|
||||
.match(o.expression || (/(.+)[-=_](.+)/));
|
||||
|
||||
if (res) {
|
||||
str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']')
|
||||
+ '='
|
||||
+ (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID));
|
||||
}
|
||||
});
|
||||
|
||||
if(!str.length && o.key) {
|
||||
str.push(o.key + '=');
|
||||
}
|
||||
|
||||
return str.join('&');
|
||||
|
||||
},
|
||||
|
||||
toHierarchy: function(options) {
|
||||
|
||||
var o = $.extend({}, this.options, options),
|
||||
sDepth = o.startDepthCount || 0,
|
||||
ret = [];
|
||||
|
||||
$(this.element).children(o.items).each(function () {
|
||||
var level = _recursiveItems(this);
|
||||
ret.push(level);
|
||||
});
|
||||
|
||||
return ret;
|
||||
|
||||
function _recursiveItems(item) {
|
||||
var id = ($(item).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
|
||||
if (id) {
|
||||
var currentItem = {"id" : id[2]};
|
||||
if ($(item).children(o.listType).children(o.items).length > 0) {
|
||||
currentItem.children = [];
|
||||
$(item).children(o.listType).children(o.items).each(function() {
|
||||
var level = _recursiveItems(this);
|
||||
currentItem.children.push(level);
|
||||
});
|
||||
}
|
||||
return currentItem;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
toArray: function(options) {
|
||||
|
||||
var o = $.extend({}, this.options, options),
|
||||
sDepth = o.startDepthCount || 0,
|
||||
ret = [],
|
||||
left = 2;
|
||||
|
||||
ret.push({
|
||||
"item_id": o.rootID,
|
||||
"parent_id": 'none',
|
||||
"depth": sDepth,
|
||||
"left": '1',
|
||||
"right": ($(o.items, this.element).length + 1) * 2
|
||||
});
|
||||
|
||||
$(this.element).children(o.items).each(function () {
|
||||
left = _recursiveArray(this, sDepth + 1, left);
|
||||
});
|
||||
|
||||
ret = ret.sort(function(a,b){ return (a.left - b.left); });
|
||||
|
||||
return ret;
|
||||
|
||||
function _recursiveArray(item, depth, left) {
|
||||
|
||||
var right = left + 1,
|
||||
id,
|
||||
pid;
|
||||
|
||||
if ($(item).children(o.listType).children(o.items).length > 0) {
|
||||
depth ++;
|
||||
$(item).children(o.listType).children(o.items).each(function () {
|
||||
right = _recursiveArray($(this), depth, right);
|
||||
});
|
||||
depth --;
|
||||
}
|
||||
|
||||
id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
|
||||
|
||||
if (depth === sDepth + 1) {
|
||||
pid = o.rootID;
|
||||
} else {
|
||||
var parentItem = ($(item).parent(o.listType)
|
||||
.parent(o.items)
|
||||
.attr(o.attribute || 'id'))
|
||||
.match(o.expression || (/(.+)[-=_](.+)/));
|
||||
pid = parentItem[2];
|
||||
}
|
||||
|
||||
if (id) {
|
||||
ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right});
|
||||
}
|
||||
|
||||
left = right + 1;
|
||||
return left;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_clearEmpty: function(item) {
|
||||
|
||||
var emptyList = $(item).children(this.options.listType);
|
||||
if (emptyList.length && !emptyList.children().length && !this.options.doNotClear) {
|
||||
emptyList.remove();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_getLevel: function(item) {
|
||||
|
||||
var level = 1;
|
||||
|
||||
if (this.options.listType) {
|
||||
var list = item.closest(this.options.listType);
|
||||
while (list && list.length > 0 &&
|
||||
!list.is('.ui-sortable')) {
|
||||
level++;
|
||||
list = list.parent().closest(this.options.listType);
|
||||
}
|
||||
}
|
||||
|
||||
return level;
|
||||
},
|
||||
|
||||
_getChildLevels: function(parent, depth) {
|
||||
var self = this,
|
||||
o = this.options,
|
||||
result = 0;
|
||||
depth = depth || 0;
|
||||
|
||||
$(parent).children(o.listType).children(o.items).each(function (index, child) {
|
||||
result = Math.max(self._getChildLevels(child, depth + 1), result);
|
||||
});
|
||||
|
||||
return depth ? result + 1 : result;
|
||||
},
|
||||
|
||||
_isAllowed: function(parentItem, level, levels) {
|
||||
var o = this.options,
|
||||
isRoot = $(this.domPosition.parent).hasClass('ui-sortable') ? true : false,
|
||||
maxLevels = this.placeholder.closest('.ui-sortable').nestedSortable('option', 'maxLevels'); // this takes into account the maxLevels set to the recipient list
|
||||
|
||||
// Is the root protected?
|
||||
// Are we trying to nest under a no-nest?
|
||||
// Are we nesting too deep?
|
||||
if (!o.isAllowed(this.currentItem, parentItem) ||
|
||||
parentItem && parentItem.hasClass(o.disableNesting) ||
|
||||
o.protectRoot && (parentItem == null && !isRoot || isRoot && level > 1)) {
|
||||
this.placeholder.addClass(o.errorClass);
|
||||
if (maxLevels < levels && maxLevels != 0) {
|
||||
this.beyondMaxLevels = levels - maxLevels;
|
||||
} else {
|
||||
this.beyondMaxLevels = 1;
|
||||
}
|
||||
} else {
|
||||
if (maxLevels < levels && maxLevels != 0) {
|
||||
this.placeholder.addClass(o.errorClass);
|
||||
this.beyondMaxLevels = levels - maxLevels;
|
||||
} else {
|
||||
this.placeholder.removeClass(o.errorClass);
|
||||
this.beyondMaxLevels = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
$.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options);
|
||||
})(jQuery);
|
||||
36
modules/leoblog/views/js/index.php
Normal file
36
modules/leoblog/views/js/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
119
modules/leoblog/views/js/leoblog.js
Normal file
119
modules/leoblog/views/js/leoblog.js
Normal file
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* Owl carousel
|
||||
*
|
||||
* @copyright Commercial License By LeoTheme.Com
|
||||
* @email leotheme.com
|
||||
* @visit http://www.leotheme.com
|
||||
*/
|
||||
$(document).ready( function(){
|
||||
/* */
|
||||
var src = $('#comment-form img.comment-capcha-image').attr('src');
|
||||
$("#comment-form").submit( function() {
|
||||
var action = $(this).attr('action');
|
||||
var data = $('#comment-form').serialize();
|
||||
|
||||
if( $("#comment-form").parent().find('.comment-message').length<=0 ){
|
||||
var msg = $('<div class="comment-message"></div>');
|
||||
$("#comment-form").before( msg );
|
||||
}else {
|
||||
var msg = $("#comment-form").parent().find(".comment-message");
|
||||
}
|
||||
// $('.btn-submit-comment').addClass('disable');
|
||||
$('.btn-submit-comment').css({'display':'none'});
|
||||
$('.btn-submit-comment-wrapper').addClass('bt-active');
|
||||
$('.leoblog-cssload-container').css({'display':'block'});
|
||||
$.ajax( {
|
||||
url:action,
|
||||
data: data+"&submitcomment="+Math.random(),
|
||||
type:'POST',
|
||||
dataType: 'json',
|
||||
success:function( ct ){
|
||||
if( !ct.error ){
|
||||
$( msg ).html('<div class="alert alert-info">'+ct.message+'</div>');
|
||||
$( 'input[type=text], textarea', '#comment-form' ).each( function(){
|
||||
$(this).val('');
|
||||
var srcn = src.replace('captchaimage','rand='+Math.random()+"&captchaimage");
|
||||
$('#comment-form img.comment-capcha-image').attr( 'src', srcn );
|
||||
} );
|
||||
}else {
|
||||
$( msg ).html('<div class="alert alert-warning">'+ct.message+'</div>');
|
||||
}
|
||||
// $('.btn-submit-comment').removeClass('disable');
|
||||
$('.btn-submit-comment').css({'display':'block'});
|
||||
$('.btn-submit-comment-wrapper').removeClass('bt-active');
|
||||
$('.leoblog-cssload-container').css({'display':'none'});
|
||||
}
|
||||
} );
|
||||
return false;
|
||||
} );
|
||||
|
||||
$('.top-pagination-content a.disabled').click(function(){
|
||||
return false;
|
||||
})
|
||||
|
||||
//DONGND:: update link in language block
|
||||
var current_lang = prestashop.language.iso_code;
|
||||
if (typeof array_list_rewrite != 'undefined')
|
||||
{
|
||||
var current_list_rewrite = array_list_rewrite[current_lang];
|
||||
var current_blog_rewrite = array_blog_rewrite[current_lang];
|
||||
var current_category_rewrite = array_category_rewrite[current_lang];
|
||||
var current_config_blog_rewrite = array_config_blog_rewrite[current_lang];
|
||||
var current_config_category_rewrite = array_config_category_rewrite[current_lang];
|
||||
|
||||
$.each(array_list_rewrite, function(iso_code, list_rewrite){
|
||||
if (iso_code != current_lang)
|
||||
{
|
||||
var url_search = prestashop.urls.base_url + iso_code;
|
||||
// console.log(url_search);
|
||||
//DONGND:: update for module blockgrouptop and default
|
||||
if ($('#leo_block_top').length)
|
||||
{
|
||||
var parent_o = $('#leo_block_top .language-selector');
|
||||
}
|
||||
else
|
||||
{
|
||||
var parent_o = $('.language-selector-wrapper');
|
||||
}
|
||||
|
||||
parent_o.find('li a').each(function(){
|
||||
|
||||
var lang_href = $(this).attr('href');
|
||||
|
||||
if(lang_href.indexOf(url_search) > -1 )
|
||||
{
|
||||
if ($('body#module-leoblog-list').length)
|
||||
{
|
||||
var url_change = lang_href.replace('/'+current_list_rewrite+'.html', '/'+list_rewrite+'.html');
|
||||
}
|
||||
else
|
||||
{
|
||||
var url_change = lang_href.replace('/'+current_list_rewrite+'/', '/'+list_rewrite+'/');
|
||||
}
|
||||
|
||||
if ($('body#module-leoblog-blog').length)
|
||||
{
|
||||
if (config_url_use_id == 0)
|
||||
{
|
||||
url_change = url_change.replace('/'+current_config_blog_rewrite+'/', '/'+array_config_blog_rewrite[iso_code]+'/');
|
||||
}
|
||||
url_change = url_change.replace('/'+current_blog_rewrite, '/'+array_blog_rewrite[iso_code]);
|
||||
}
|
||||
|
||||
if ($('body#module-leoblog-category').length)
|
||||
{
|
||||
if (config_url_use_id == 0)
|
||||
{
|
||||
url_change = url_change.replace('/'+current_config_category_rewrite+'/', '/'+array_config_category_rewrite[iso_code]+'/');
|
||||
}
|
||||
url_change = url_change.replace('/'+current_category_rewrite, '/'+array_category_rewrite[iso_code]);
|
||||
}
|
||||
|
||||
$(this).attr('href', url_change);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
} );
|
||||
Reference in New Issue
Block a user