869 lines
22 KiB
JavaScript
869 lines
22 KiB
JavaScript
var activeTreeNode;
|
|
|
|
function bold(element) {
|
|
if (activeTreeNode) {
|
|
$(activeTreeNode).setStyle({
|
|
fontWeight: 'normal',
|
|
backgroundColor: '',
|
|
color: ''
|
|
|
|
});
|
|
}
|
|
|
|
$(element).setStyle({
|
|
fontWeight: 'bold',
|
|
backgroundColor: '#333c8e',
|
|
color: '#ffffff'
|
|
});
|
|
|
|
activeTreeNode = element;
|
|
}
|
|
|
|
function load(url) {
|
|
try {
|
|
var contentNode = $("mainFrame");
|
|
var treeElementNode = $("node{$objElementSub->GetId()}");
|
|
if (typeof url == 'object') {
|
|
url = url.href;
|
|
}
|
|
Dosia.DisplayLoader(true);
|
|
|
|
var myAjax = new Ajax.Request(
|
|
url,
|
|
{
|
|
method: 'post',
|
|
parameters: this.parameters,
|
|
onComplete: function (response) {
|
|
Dosia.DisplayLoader(false);
|
|
Dosia.executeJS(response.responseText);
|
|
contentNode.innerHTML = response.responseText;
|
|
|
|
|
|
}
|
|
}
|
|
);
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
return false;
|
|
|
|
}
|
|
|
|
function loadTree() {
|
|
try {
|
|
var contentNode = $("TreeFrame");
|
|
|
|
if (typeof url == 'object') {
|
|
url = url.href;
|
|
}
|
|
|
|
|
|
url = 'structure,shared.frmx';
|
|
|
|
Dosia.DisplayLoader(true);
|
|
|
|
var myAjax = new Ajax.Request(
|
|
url,
|
|
{
|
|
method: 'post',
|
|
parameters: this.parameters,
|
|
onComplete: function (response) {
|
|
Dosia.DisplayLoader(false);
|
|
Dosia.executeJS(response.responseText);
|
|
//alert(response.responseText);
|
|
contentNode.innerHTML = response.responseText;
|
|
initTree();
|
|
}
|
|
}
|
|
);
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function DelteElement(url) {
|
|
|
|
if (confirm('Czy napewno usunąć ten element?')) {
|
|
try {
|
|
|
|
var contentNode = $("mainFrame");
|
|
|
|
if (typeof url == 'object') {
|
|
url = url.href;
|
|
}
|
|
|
|
Dosia.DisplayLoader(true);
|
|
|
|
|
|
|
|
var myAjax = new Ajax.Request(
|
|
url,
|
|
{
|
|
method: 'post',
|
|
parameters: this.parameters,
|
|
onComplete: function (response) {
|
|
Dosia.DisplayLoader(false);
|
|
Dosia.executeJS(response.responseText);
|
|
contentNode.innerHTML = response.responseText;
|
|
loadTree();
|
|
}
|
|
}
|
|
);
|
|
|
|
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
function GetForm(form) {
|
|
try {
|
|
var contentNode = $("mainFrame");
|
|
|
|
if (typeof form == 'string') {
|
|
form = $(form);
|
|
}
|
|
|
|
Dosia.DisplayLoader(true);
|
|
|
|
form.request({
|
|
onComplete: function (response) {
|
|
Dosia.DisplayLoader(false);
|
|
$('stucturePopover').hide();
|
|
Dosia.executeJS(response.responseText);
|
|
contentNode.innerHTML = response.responseText;
|
|
}
|
|
});
|
|
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
//function GetModuleCategorys(value, url) {
|
|
// try {
|
|
// var contentNode = $("categoryOptions");
|
|
// //Dosia.DisplayLoader(true);
|
|
//
|
|
// new Ajax.Request(url,
|
|
// {
|
|
// method:'post',
|
|
// parameters: {id: value},
|
|
// onComplete: function(response) {
|
|
// //Dosia.DisplayLoader(false);
|
|
// Dosia.executeJS(response.responseText);
|
|
// contentNode.innerHTML = response.responseText;
|
|
// },
|
|
// onFailure: function(){ alert('Something went wrong...') }
|
|
// });
|
|
// } catch (err) {
|
|
// return false;
|
|
// }
|
|
//
|
|
// return false;
|
|
//}
|
|
|
|
//jQuery
|
|
function GetModuleCategory(value, url) {
|
|
|
|
////$.prettyLoader.show();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({id: value}),
|
|
success: function (html) {
|
|
//$("#longer").show();
|
|
//alert(html);
|
|
$("#categoryOptions").html(html);
|
|
////$.prettyLoader.hide();
|
|
}
|
|
});
|
|
//$('#datePast').val($('#calendar').val());
|
|
}
|
|
|
|
function AddModule(url, containerName, idModule, moduleCategoryId, editModule) {
|
|
|
|
////$.prettyLoader.show();
|
|
|
|
// alert(idModule);
|
|
// alert(idCategory);
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({id: idModule, moduleCategoryId: moduleCategoryId, editModule: editModule}),
|
|
success: function (html) {
|
|
//$("#longer").show();
|
|
//alert(html);
|
|
$(containerName).html(html);
|
|
$(containerName).append('<input type="hidden" name="module[]" value="' + idModule + '" />');
|
|
$('.addModule').show();
|
|
$('#AddModule').hide();
|
|
////$.prettyLoader.hide();
|
|
$(containerName).addClass('addModuleContainer' + idModule);
|
|
$(containerName + idModule).removeClass('addModuleContainer');
|
|
$(containerName + idModule).after('<div class="addModuleContainer"></div>');
|
|
}
|
|
});
|
|
//$('#datePast').val($('#calendar').val());
|
|
}
|
|
|
|
function SortModule(containerName, direction) {
|
|
|
|
var containerNameId = '#' + containerName;
|
|
var nextIdName = $(containerNameId).next().attr('id');
|
|
|
|
if (direction === 'up') {
|
|
var prevIdName = $(containerNameId).prev().attr('id');
|
|
//--up-----
|
|
if (prevIdName === 'addedModuleTop') {
|
|
console.log($(containerNameId).prev().attr('id'));
|
|
console.log('To jest już top');
|
|
//$("#dialog-message").attr('title').val('Uwaga');
|
|
$("#dialog-message").html('<p>Nie można przeniść modułu wyżej<p/>');
|
|
$("#dialog-message").dialog({
|
|
modal: true,
|
|
buttons: {
|
|
Ok: function () {
|
|
$(this).dialog("close");
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
console.log('idę wyżej');
|
|
$(containerNameId).prev().insertAfter(containerNameId);
|
|
}
|
|
} else {
|
|
var nextIdName = $(containerNameId).next().attr('id');
|
|
|
|
console.log("nextIdName Var: " + nextIdName);
|
|
|
|
//---Down---
|
|
console.log('nextIdName == addedModuleBottom =');
|
|
console.log(nextIdName === 'addedModuleBottom');
|
|
|
|
if (nextIdName === 'addedModuleBottom') {
|
|
console.log('nie można zmienić pozycji');
|
|
//$("#dialog-message").attr('title').val('Uwaga');
|
|
$("#dialog-message").html('<p>Nie można przeniść modułu niżej<p/>');
|
|
$("#dialog-message").dialog({
|
|
modal: true,
|
|
buttons: {
|
|
Ok: function () {
|
|
$(this).dialog("close");
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
console.log('idę na dół');
|
|
console.log($(containerNameId).next().attr('id'));
|
|
$(containerNameId).next().insertBefore(containerNameId);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
function ConfirmAction(message, url, title = 'Info') {
|
|
$("#dialog-confirm").html('<p>'+message+'<p/>');
|
|
$("#dialog-confirm").dialog({
|
|
modal: true,
|
|
title: title,
|
|
buttons: {
|
|
'Ok': function () {
|
|
$(this).dialog("close");
|
|
window.location.href = url;
|
|
},
|
|
'Anuluj': function () {
|
|
$(this).dialog("close");
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function DeleteModuleAction(message, idModule, title = 'Info') {
|
|
$("#dialog-confirm").html('<p>'+message+'<p/>');
|
|
$("#dialog-confirm").dialog({
|
|
modal: true,
|
|
title: title,
|
|
buttons: {
|
|
'Ok': function () {
|
|
$(this).dialog("close");
|
|
$('#'+idModule).hide();
|
|
//alert(idModule);
|
|
//alert($('#to_delete_'+idModule).val());
|
|
$('#to_delete_'+idModule).val(1);
|
|
//alert($('#to_delete_'+idModule).val());
|
|
},
|
|
'Anuluj': function () {
|
|
$(this).dialog("close");
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function PublishItem(url, idItem, idElement, title = 'Info') {
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({idItem: idItem}),
|
|
success: function (data) {
|
|
console.log( data );
|
|
if (data != "1") {
|
|
$('#'+idElement).removeClass('iconPublishOn');
|
|
$('#'+idElement).addClass('iconPublishOff');
|
|
$('#'+idElement).attr('title', 'Publikuj');
|
|
} else {
|
|
$('#'+idElement).removeClass('iconPublishOff');
|
|
$('#'+idElement).addClass('iconPublishOn');
|
|
$('#'+idElement).attr('title', 'Niepublikuj');
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
|
|
function PublishModule(idModule, title = 'Info') {
|
|
|
|
if ($('#publication_'+idModule).val() == 1) {
|
|
$('#publication_'+idModule).val(0);
|
|
$('#publicationIcon_'+idModule).removeClass('iconPublishOn');
|
|
$('#publicationIcon_'+idModule).addClass('iconPublishOff');
|
|
$('#publicationIcon_'+idModule).attr('title', 'Publikuj');
|
|
|
|
} else {
|
|
$('#publication_'+idModule).val(1);
|
|
$('#publicationIcon_'+idModule).removeClass('iconPublishOff');
|
|
$('#publicationIcon_'+idModule).addClass('iconPublishOn');
|
|
$('#publicationIcon_'+idModule).attr('title', 'Niepublikuj');
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
function InfoAction(message, title = 'Info', width = 'auto') {
|
|
$("#dialog-message").html('<p>'+message+'<p/>');
|
|
$("#dialog-message").dialog({
|
|
height: 'auto',
|
|
width: width,
|
|
modal: true,
|
|
title: title,
|
|
buttons: {
|
|
'Ok': function () {
|
|
$(this).dialog("close");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function PostRequest(target, post) {
|
|
|
|
|
|
////$.prettyLoader.show();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: target,
|
|
cache: false,
|
|
data: ('data=' + post),
|
|
success: function (html) {
|
|
//$("#longer").show();
|
|
//$("#categoryOptions").html(html);
|
|
////$.prettyLoader.hide();
|
|
return html;
|
|
|
|
}
|
|
});
|
|
|
|
// var url = target;
|
|
// new Ajax.Request(url, {
|
|
// method: 'post', parameters: 'data='+post,
|
|
// onSuccess: function(transport) {
|
|
// Dosia.DisplayLoader(false);
|
|
// Dosia.Run(transport.responseText);
|
|
// return transport.responseText;
|
|
// }
|
|
// });
|
|
|
|
}
|
|
|
|
|
|
function GetList(url) {
|
|
try {
|
|
var contentNode = $("ListBox");
|
|
Dosia.DisplayLoader(true);
|
|
|
|
if (typeof url == 'object') {
|
|
url = url.href;
|
|
}
|
|
new Ajax.Request(url,
|
|
{
|
|
method: 'post',
|
|
onComplete: function (response) {
|
|
Dosia.DisplayLoader(false);
|
|
Dosia.executeJS(response.responseText);
|
|
contentNode.innerHTML = response.responseText;
|
|
},
|
|
onFailure: function () {
|
|
alert('Something went wrong...')
|
|
}
|
|
});
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
//
|
|
//function Special(id, value, url) {
|
|
// try {
|
|
// var contentNode = $('special_info_'+id);
|
|
// Dosia.DisplayLoader(true);
|
|
//
|
|
// //alert(value);
|
|
// if (value == '1') {
|
|
// //alert('add'+' id'+id);
|
|
// document.getElementById('special_'+id).value = '0';
|
|
// var special = '0';
|
|
// } else {
|
|
// //alert('delete'+' id'+id);
|
|
// document.getElementById('special_'+id).value = '1';
|
|
// var special = '1';
|
|
// }
|
|
//
|
|
//
|
|
// new Ajax.Request(url,
|
|
// {
|
|
// method:'post',
|
|
// parameters: {id: id, value: special},
|
|
// onComplete: function(response) {
|
|
// Dosia.DisplayLoader(false);
|
|
// Dosia.executeJS(response.responseText);
|
|
// contentNode.innerHTML = response.responseText;
|
|
// },
|
|
// onFailure: function(){ alert('Something went wrong...') }
|
|
// });
|
|
// } catch (err) {
|
|
// return false;
|
|
// }
|
|
//
|
|
// return false;
|
|
//}
|
|
|
|
|
|
//function LinkList(id) {
|
|
// if (document.getElementById(id).style.display == '') {
|
|
// $(id+'Top').hide();
|
|
// $(id).hide();
|
|
// $(id+'Bottom').hide();
|
|
//
|
|
// } else {
|
|
// $(id+'Top').show();
|
|
// $(id).show();
|
|
// $(id+'Bottom').show();
|
|
// }
|
|
//
|
|
//}
|
|
|
|
//function ChangeLang(lang, url) {
|
|
// try {
|
|
// var contentNode = $("mainFrame");
|
|
// Dosia.DisplayLoader(true);
|
|
//
|
|
// new Ajax.Request(url,
|
|
// {
|
|
// method:'post',
|
|
// parameters: {lang: lang},
|
|
// onComplete: function(response) {
|
|
// Dosia.DisplayLoader(false);
|
|
// Dosia.executeJS(response.responseText);
|
|
// contentNode.innerHTML = response.responseText;
|
|
// },
|
|
// onFailure: function(){ alert('Something went wrong...') }
|
|
// });
|
|
// } catch (err) {
|
|
// return false;
|
|
// }
|
|
//
|
|
// return false;
|
|
//}
|
|
|
|
function ConfirmChange(field, value) {
|
|
|
|
var fieldAlert = document.getElementById(field + 'Alert').value;
|
|
if (fieldAlert != 'true') {
|
|
if (confirm('Zmiana tego pola nastąpi dla wszystkich kopii tego elementu, czy chcesz kontynuować?')) {
|
|
document.getElementById(field + 'Alert').value = true;
|
|
return true;
|
|
} else {
|
|
document.getElementById(field).value = value;
|
|
return false;
|
|
}
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
//jQuery
|
|
function GetParentTree(url, value, destination) {
|
|
|
|
|
|
//////$.prettyLoader.show();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({id: value}),
|
|
success: function (html) {
|
|
$(destination).html(html);
|
|
//////$.prettyLoader.hide();
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//funkcja sprawdza czy to IE od razu zwracając wersję w postaci integer
|
|
function czyIE() {
|
|
var IE = v = false, n;
|
|
try {
|
|
n = navigator.appVersion;
|
|
IE = (n.indexOf('MSIE') != -1)
|
|
} catch (e) {
|
|
}
|
|
if (IE)
|
|
v = n.substr(n.indexOf('MSIE') + 5, 1);
|
|
return parseInt(v);
|
|
}
|
|
|
|
|
|
|
|
|
|
//$(document).ready(function(){
|
|
//
|
|
//
|
|
// //przyklad użycia
|
|
// //if(czyIE()){
|
|
// // alert('Wersja IE: '+czyIE());
|
|
// //}
|
|
// //inny przykład
|
|
// // if(czyIE()){
|
|
// // alert('Wersja Internet Explorera jest nie aktualna. Niektóre funkcje serwisu moga działac nie prawidłowo. Zaleca się zainstalowanie nowszej wersji minimum 8');
|
|
// // }
|
|
//
|
|
//
|
|
//
|
|
//
|
|
// $("a[rel^='prettyPhoto']").prettyPhoto();
|
|
//
|
|
// //////$.prettyLoader({
|
|
// animation_speed: 'slow', /* fast/normal/slow/integer */
|
|
// bind_to_ajax: false, /* true/false */
|
|
// delay: false, /* false OR time in milliseconds (ms) */
|
|
// loader: 'http://produkty.mediaflex.pl/cyfrowemuzeum/site/Static/images/prettyLoader/ajax-loader.gif', /* Path to your loader gif */
|
|
// offset_top: 13, /* integer */
|
|
// offset_left: 10 /* integer */
|
|
// });
|
|
//
|
|
//
|
|
// // $(function() {
|
|
// // $("#sortable").sortable({ opacity: 0.6, cursor: 'move', update: function() {
|
|
// // var order = $('#sortable').sortable("toArray");
|
|
// // //var result = $('#sortable').sortable('toArray');
|
|
// // alert(order[0]);
|
|
// // var sortUrl = $('#sortUrl').val();
|
|
// //
|
|
// // //////$.prettyLoader.show();
|
|
// //
|
|
// // $.ajax({
|
|
// // type: "POST",
|
|
// // url: sortUrl,
|
|
// // cache: false,
|
|
// // data: ({order: order}),
|
|
// // success: function(text){
|
|
// // //$("#sortTest").html(theResponse);
|
|
// //
|
|
// // //////$.prettyLoader.hide();
|
|
// // }
|
|
// // });
|
|
// //
|
|
// //
|
|
// //
|
|
// // }
|
|
// // });
|
|
// // $( "#sortable" ).disableSelection();
|
|
// // });
|
|
//
|
|
//
|
|
//});
|
|
|
|
|
|
|
|
|
|
function GetTableContent(url, tableContent, search, linked, sortVal) {
|
|
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({search: search, linked: linked, sortVal: sortVal}),
|
|
success: function (html) {
|
|
$(tableContent).html(html);
|
|
//loading.busyBox('close');
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function LinkFileClient(url, element, destination, source, idDest, idSource) {
|
|
action = 'delete';
|
|
if ($(element).is(':checked')) {
|
|
action = 'add';
|
|
}
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({action: action, idDest: idDest, idSource: idSource, destination: destination, source: source}),
|
|
success: function (html) {
|
|
//$(container).remove();
|
|
//loading.busyBox('close');
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
function StatusConfigArchive(url, id, status) {
|
|
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({id: id, status: status}),
|
|
success: function (html) {
|
|
$('#statusInfo').html('Zapisono');
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
function LinkContent(url, destination, idDestination, source, idSource, description, idCategory, container) {
|
|
|
|
//////$.prettyLoader.show();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({destination: destination, idDestination: idDestination, source: source, idSource: idSource, idCategory: idCategory, description: description}),
|
|
success: function (html) {
|
|
window.parent.$(container).append(html);
|
|
window.parent.$.prettyPhoto.close();
|
|
//////$.prettyLoader.hide();
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
function UnlinkContent(url, destination, idDestination, source, idSource, idCategory, container) {
|
|
|
|
//////$.prettyLoader.show();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({destination: destination, idDestination: idDestination, source: source, idSource: idSource, idCategory: idCategory}),
|
|
success: function (html) {
|
|
$(container).remove();
|
|
//////$.prettyLoader.hide();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function PersonSaved(val, text) {
|
|
|
|
//////$.prettyLoader.show();
|
|
window.parent.$('#author').append(
|
|
$('<option></option>').val(val).html(text).attr("selected", "selected")
|
|
);
|
|
window.parent.$("#authorStr").val(text);
|
|
//////$.prettyLoader.hide();
|
|
window.parent.$.prettyPhoto.close();
|
|
|
|
}
|
|
|
|
|
|
function CategorySaved(url, id) {
|
|
|
|
var action = 'delete';
|
|
|
|
//////$.prettyLoader.show();
|
|
if ($(id).is(':checked')) {
|
|
action = 'add';
|
|
}
|
|
var idCategory = $(id).val();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({idCategory: idCategory, action: action}),
|
|
success: function (html) {
|
|
////$.prettyLoader.hide();
|
|
}
|
|
});
|
|
}
|
|
function AjaxCheckExt(url, file, container) {
|
|
|
|
////$.prettyLoader.show();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({file: file}),
|
|
success: function (text) {
|
|
if (text != 'ok') {
|
|
$('#filename').val('');
|
|
$(container).html('Dostępne rozszerzenie to: flv, swf');
|
|
|
|
} else {
|
|
$(container).html('');
|
|
}
|
|
|
|
////$.prettyLoader.hide();
|
|
}
|
|
});
|
|
}
|
|
|
|
//$(function() {
|
|
// $( "#sortable" ).sortable();
|
|
//
|
|
//});
|
|
//
|
|
//$(function() {
|
|
// $("#sortable").sortable({ opacity: 0.6, cursor: 'move', update: function() {
|
|
// var order = $(this).sortable("serialize");
|
|
// var result = $('#sortable').sortable('toArray');
|
|
// alert(result);
|
|
// // $.post("updateDB.php", order, function(theResponse){
|
|
// // $("#contentRight").html(theResponse);
|
|
// // });
|
|
// }
|
|
// });
|
|
// $( "#sortable" ).disableSelection();
|
|
//});
|
|
|
|
function AjaxSaveSortImage() {
|
|
|
|
////$.prettyLoader.show();
|
|
|
|
// $.ajax({
|
|
// type: "POST",
|
|
// url: url,
|
|
// cache: false,
|
|
// data: ({file: file}),
|
|
// success: function(text){
|
|
// if (text != 'ok') {
|
|
// $('#filename').val('');
|
|
// $(container).html('Dostępne rozszerzenie to: flv, swf');
|
|
//
|
|
// } else {
|
|
// $(container).html('');
|
|
// }
|
|
var result = $('#sortable').sortable('toArray');
|
|
alert(result);
|
|
////$.prettyLoader.hide();
|
|
// }
|
|
// });
|
|
}
|
|
|
|
|
|
|
|
//=product=======================================================
|
|
//AddLinkAttr is not defined
|
|
|
|
function AddLinkAttr(value, id) {
|
|
//alert($(value).html());
|
|
|
|
htmlAttr = $(value).html().replace('attr_' + id, 'linked_attr_' + id);
|
|
//htmlAttrVal = htmlAttr.replace('<td><a href="#" onclick="AddLinkAttr(\'#attr_'+id+'\', \''+id+'\')" class="add">Powiąż</a></td>','<td><a href="#" onclick="DeleteLinkAttr(\'#linked_attr_'+id+'\', \''+id+'\')" class="add">Usuń</a><input type="text" name="attr[]" value="'+id+'" /></td>');
|
|
htmlAttrVal = htmlAttr.replace('AddLinkAttr', 'DeleteLinkAttr');
|
|
htmlAttrVal = htmlAttrVal.replace('class="add">Powiąż</a>', 'class="delete">Usuń</a><input type="hidden" name="attr[]" value="' + id + '" />');
|
|
//alert(htmlAttrVal);
|
|
$("#AddLink").append('<tr id="linked_attr_' + id + '">' + htmlAttrVal + '<tr>');
|
|
$(value).remove();
|
|
$('#emptyAttr').remove();
|
|
|
|
}
|
|
|
|
function DeleteLinkAttr(value, id) {
|
|
|
|
htmlAttr = $(value).html().replace('linked_attr_' + id, 'attr_' + id);
|
|
//htmlAttrVal = htmlAttr.replace('<td><a href="#" onclick="AddLinkAttr(\'#attr_'+id+'\', \''+id+'\')" class="add">Powiąż</a></td>','<td><a href="#" onclick="DeleteLinkAttr(\'#linked_attr_'+id+'\', \''+id+'\')" class="add">Usuń</a><input type="text" name="attr[]" value="'+id+'" /></td>');
|
|
htmlAttrVal = htmlAttr.replace('DeleteLinkAttr', 'AddLinkAttr');
|
|
htmlAttrVal = htmlAttrVal.replace('class="delete">Usuń', 'class="add">Powiąż');
|
|
htmlAttrVal = htmlAttrVal.replace('<input name="attr[]" value="' + id + '" type="hidden">', '');
|
|
//alert(htmlAttrVal);
|
|
$("#DeleteLink").append('<tr id="attr_' + id + '">' + htmlAttrVal + '<tr>');
|
|
$(value).remove();
|
|
$('#emptyUnlinkedAttr').remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkLang(value, url, urlDelete) {
|
|
|
|
//////$.prettyLoader.show();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
cache: false,
|
|
data: ({id: value}),
|
|
success: function (script) {
|
|
if (script) {
|
|
if (confirm('Element posiada innę wersję jezykową!\n Czy napewno usunęć ten element w tym języku?')) {
|
|
document.location.href = urlDelete;
|
|
} else {
|
|
return false;
|
|
}
|
|
} else {
|
|
if (confirm('Czy napewno usunęć ten element?')) {
|
|
document.location.href = urlDelete;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
//$("#categoryOptions").html(html);
|
|
//////$.prettyLoader.hide();
|
|
}
|
|
});
|
|
//$('#datePast').val($('#calendar').val());
|
|
}
|
|
|