Vergleich jscripts/inline_moderation.js - 1.6.3 - 1.6.17

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
var inlineModeration = {
init: function()
{

var inlineModeration = {
init: function()
{

		inlineModeration.inlineCount = 0;

 
		if(!inlineType || !inlineId)
{
return false;
}


		if(!inlineType || !inlineId)
{
return false;
}


		inlineModeration.cookieName = "inlinemod_"+inlineType+inlineId;
inputs = document.getElementsByTagName("input");

		inlineModeration.cookieName = 'inlinemod_'+inlineType+inlineId;
var inputs = document.getElementsByTagName('input');


if(!inputs)
{
return false;
}



if(!inputs)
{
return false;
}


		inlineCookie = Cookie.get(inlineModeration.cookieName);



		var inlineIds = inlineModeration.getCookie(inlineModeration.cookieName);
var removedIds = inlineModeration.getCookie(inlineModeration.cookieName+'_removed');
var allChecked = true;





		if(inlineCookie)
{
inlineIds = inlineCookie.split("|");
}


 
		for(var i=0; i < inputs.length; i++)
{
var element = inputs[i];

		for(var i=0; i < inputs.length; i++)
{
var element = inputs[i];

			if((element.name != "allbox") && (element.type == "checkbox") && (element.id.split("_")[0] == "inlinemod"))

			if((element.name != 'allbox') && (element.type == 'checkbox') && (element.id.split('_')[0] == 'inlinemod'))

			{

			{

				Event.observe(element, "click", inlineModeration.checkItem);

				Event.observe(element, 'click', inlineModeration.checkItem);

			}


			}


			if(inlineCookie)
{
inlineCheck = element.id.split("_");
id = inlineCheck[1];

			var inlineCheck = element.id.split('_');
var id = inlineCheck[1];







				if(inlineIds.indexOf(id) != -1)



			if(inlineCheck[0] == 'inlinemod')
{
if(inlineIds.indexOf(id) != -1 || (inlineIds.indexOf('ALL') != -1 && removedIds.indexOf(id) == -1))

				{
element.checked = true;
var tr = element.up('tr');
var fieldset = element.up('fieldset');

				{
element.checked = true;
var tr = element.up('tr');
var fieldset = element.up('fieldset');

					



					if(tr)
{
tr.addClassName('trow_selected');
}

					if(tr)
{
tr.addClassName('trow_selected');
}

					



					if(fieldset)
{

					if(fieldset)
{

						fieldset.addClassName('inline_selected');	

						fieldset.addClassName('inline_selected');

					}
}
else

					}
}
else

Zeile 59Zeile 55
					{
tr.removeClassName('trow_selected');
}

					{
tr.removeClassName('trow_selected');
}

 
					allChecked = false;

				}
}
}

				}
}
}

		
if(inlineCookie)












inlineModeration.updateCookies(inlineIds, removedIds);

if(inlineIds.indexOf('ALL') != -1 && removedIds.length == 0)
{
var allSelectedRow = document.getElementById('allSelectedrow');
if(allSelectedRow)
{
allSelectedRow.style.display = 'table-row';
}
}
else if(inlineIds.indexOf('ALL') == -1 && allChecked == true)

		{

		{

			goButton = $("inline_go");
if(inlineIds)

			var selectRow = document.getElementById('selectAllrow');
if(selectRow)

			{

			{

				var inlineCount = 0;
inlineIds.each(function(item) {
if(item != '') inlineCount++;
});
inlineModeration.inlineCount = inlineCount;

				selectRow.style.display = 'table-row';





			}

			}

			goButton.value = go_text+" ("+(inlineModeration.inlineCount)+")";

 
		}
return true;
},

checkItem: function(e)
{

		}
return true;
},

checkItem: function(e)
{

		element = Event.element(e);

		var element = Event.element(e);


if(!element)


if(!element)

		{
return false;
}

inlineCheck = element.id.split("_");
id = inlineCheck[1];


		{
return false;
}

var inlineCheck = element.id.split('_');
var id = inlineCheck[1];


		if(!id)
{
return false;
}


		if(!id)
{
return false;
}


		var newIds = new Array();
inlineCookie = Cookie.get(inlineModeration.cookieName);

if(inlineCookie)

		var inlineIds = inlineModeration.getCookie(inlineModeration.cookieName);
var removedIds = inlineModeration.getCookie(inlineModeration.cookieName+'_removed');

if(element.checked == true)

		{

		{

			inlineIds = inlineCookie.split("|");
inlineIds.each(function(item) {
if(item != "" && item != null)






			if(inlineIds.indexOf('ALL') == -1)
{
inlineIds = inlineModeration.addId(inlineIds, id);
}
else
{
removedIds = inlineModeration.removeId(removedIds, id);
if(removedIds.length == 0)

				{

				{

					if(item != id)


					var allSelectedRow = document.getElementById('allSelectedrow');
if(allSelectedRow)

					{

					{

						newIds[newIds.length] = item;

						allSelectedRow.style.display = 'table-row';

					}
}

					}
}

			});
}

if(element.checked == true)
{
inlineModeration.inlineCount++;
newIds[newIds.length] = id;

			}







			var tr = element.up('tr');
if(tr)
{
tr.addClassName('trow_selected');

			var tr = element.up('tr');
if(tr)
{
tr.addClassName('trow_selected');

			}
}

			}
}

		else

		else

		{
inlineModeration.inlineCount--;


















		{
if(inlineIds.indexOf('ALL') == -1)
{
inlineIds = inlineModeration.removeId(inlineIds, id);
var selectRow = document.getElementById('selectAllrow');
if(selectRow)
{
selectRow.style.display = 'none';
}
}
else
{
removedIds = inlineModeration.addId(removedIds, id);
var allSelectedRow = document.getElementById('allSelectedrow');
if(allSelectedRow)
{
allSelectedRow.style.display = 'none';
}
}

			var tr = element.up('tr');
if(tr)
{
tr.removeClassName('trow_selected');
}

			var tr = element.up('tr');
if(tr)
{
tr.removeClassName('trow_selected');
}

		}

inlineData = "|"+newIds.join("|")+"|";
goButton = $("inline_go");

if(inlineModeration.inlineCount < 0)
{
inlineModeration.inlineCount = 0;
}

		}













		goButton.value = go_text+" ("+inlineModeration.inlineCount+")";
Cookie.set(inlineModeration.cookieName, inlineData, 3600000);

		inlineModeration.updateCookies(inlineIds, removedIds);



return true;
},

clearChecked: function()


return true;
},

clearChecked: function()

	{
var selectRow = document.getElementById("selectAllrow");
if(selectRow)
{
selectRow.style.display = "none";
}

var allSelectedRow = document.getElementById("allSelectedrow");
if(allSelectedRow)
{
allSelectedRow.style.display = "none";
}

inputs = document.getElementsByTagName("input");

	{
var selectRow = document.getElementById('selectAllrow');
if(selectRow)
{
selectRow.style.display = 'none';
}

var allSelectedRow = document.getElementById('allSelectedrow');
if(allSelectedRow)
{
allSelectedRow.style.display = 'none';
}

var inputs = document.getElementsByTagName('input');


if(!inputs)
{


if(!inputs)
{

Zeile 171Zeile 181
		$H(inputs).each(function(element) {
var element = element.value;
if(!element.value) return;

		$H(inputs).each(function(element) {
var element = element.value;
if(!element.value) return;

			if((element.name != "allbox") && (element.type == "checkbox") && (element.id.split("_")[0] == "inlinemod"))

			if(element.type == 'checkbox' && (element.id.split('_')[0] == 'inlinemod' || element.name == 'allbox'))

			{
element.checked = false;
}

			{
element.checked = false;
}

		});

		});


$$('tr.trow_selected').each(function(element) {
element.removeClassName('trow_selected');


$$('tr.trow_selected').each(function(element) {
element.removeClassName('trow_selected');

		});

		});


$$('fieldset.inline_selected').each(function(element) {
element.removeClassName('inline_selected');
});



$$('fieldset.inline_selected').each(function(element) {
element.removeClassName('inline_selected');
});


		inlineModeration.inlineCount = 0;
goButton = $("inline_go");
goButton.value = go_text+" (0)";

		goButton = $('inline_go');
goButton.value = go_text+' (0)';


		Cookie.unset(inlineModeration.cookieName);

		Cookie.unset(inlineModeration.cookieName);

 
		Cookie.unset(inlineModeration.cookieName + '_removed');


return true;


return true;

	},


	},


	checkAll: function(master)
{

	checkAll: function(master)
{

		inputs = document.getElementsByTagName("input");


		var inputs = document.getElementsByTagName('input');


		if(!inputs)

		if(!inputs)

		{

		{

			return false;

			return false;

		}

inlineCookie = Cookie.get(inlineModeration.cookieName);

		}







		if(inlineCookie)
{
inlineIds = inlineCookie.split("|");
}

		var inlineIds = inlineModeration.getCookie(inlineModeration.cookieName);
var removedIds = inlineModeration.getCookie(inlineModeration.cookieName+'_removed');




var newIds = new Array();
$H(inputs).each(function(element) {
var element = element.value;
if(!element.value) return;


var newIds = new Array();
$H(inputs).each(function(element) {
var element = element.value;
if(!element.value) return;

			inlineCheck = element.id.split("_");
if((element.name != "allbox") && (element.type == "checkbox") && (inlineCheck[0] == "inlinemod"))

			inlineCheck = element.id.split('_');
if((element.name != 'allbox') && (element.type == 'checkbox') && (inlineCheck[0] == 'inlinemod'))

			{

			{

				id = inlineCheck[1];

				var id = inlineCheck[1];

				var changed = (element.checked != master.checked);
element.checked = master.checked;


				var changed = (element.checked != master.checked);
element.checked = master.checked;


Zeile 230Zeile 236
				{
tr.removeClassName('trow_selected');
}

				{
tr.removeClassName('trow_selected');
}

				
if(typeof(fieldset) != "undefined")


if(typeof(fieldset) != 'undefined')

				{
if(master.checked == true)

				{
if(master.checked == true)

					{

					{

						fieldset.addClassName('inline_selected');

						fieldset.addClassName('inline_selected');

					}

					}

					else
{
fieldset.removeClassName('inline_selected');
}
}

					else
{
fieldset.removeClassName('inline_selected');
}
}

				



				if(changed)
{
if(master.checked == true)
{

				if(changed)
{
if(master.checked == true)
{

						inlineModeration.inlineCount++;
newIds[newIds.length] = id;







						if(inlineIds.indexOf('ALL') == -1)
{
inlineIds = inlineModeration.addId(inlineIds, id);
}
else
{
removedIds = inlineModeration.removeId(removedIds, id);
}

					}
else
{

					}
else
{

						inlineModeration.inlineCount--;








						if(inlineIds.indexOf('ALL') == -1)
{
inlineIds = inlineModeration.removeId(inlineIds, id);
}
else
{
removedIds = inlineModeration.addId(removedIds, id);
}

					}
}
}
});


					}
}
}
});


		inlineData = "|"+newIds.join("|")+"|";
goButton = $("inline_go");

		var count = inlineModeration.updateCookies(inlineIds, removedIds);






		if(inlineModeration.inlineCount < 0)

		if(count < all_text)

		{

		{

			inlineModeration.inlineCount = 0;
}

if(inlineModeration.inlineCount < all_text)
{
var selectRow = document.getElementById("selectAllrow");

			var selectRow = document.getElementById('selectAllrow');






			if(selectRow)
{
if(master.checked == true)
{

			if(selectRow)
{
if(master.checked == true)
{

					selectRow.style.display = "table-row";

					selectRow.style.display = 'table-row';

				}
else

				}
else

				{
selectRow.style.display = "none";
}
}


















				{
selectRow.style.display = 'none';
}
}
}

if(inlineIds.indexOf('ALL') == -1 || removedIds.length != 0)
{
var allSelectedRow = document.getElementById('allSelectedrow');
if(allSelectedRow)
{
allSelectedRow.style.display = 'none';
}
}
else if(inlineIds.indexOf('ALL') != -1 && removedIds.length == 0)
{
var allSelectedRow = document.getElementById('allSelectedrow');
if(allSelectedRow)
{
allSelectedRow.style.display = 'table-row';
}

		}

		}

		
goButton.value = go_text+" ("+inlineModeration.inlineCount+")";
Cookie.set(inlineModeration.cookieName, inlineData, 3600000);

 
	},

	},

		



	selectAll: function()

	selectAll: function()

	{
goButton.value = go_text+" ("+all_text+")";
Cookie.set(inlineModeration.cookieName, "|ALL|", 3600000);

var selectRow = document.getElementById("selectAllrow");

	{
inlineModeration.updateCookies(new Array('ALL'), new Array());

var selectRow = document.getElementById('selectAllrow');


		if(selectRow)
{

		if(selectRow)
{

			selectRow.style.display = "none";









































































			selectRow.style.display = 'none';
}

var allSelectedRow = document.getElementById('allSelectedrow');
if(allSelectedRow)
{
allSelectedRow.style.display = 'table-row';
}
},

getCookie: function(name)
{
var inlineCookie = Cookie.get(name);

var ids = new Array();
if(inlineCookie)
{
var inlineIds = inlineCookie.split('|');
inlineIds.each(function(item) {
if(item != '' && item != null)
{
ids.push(item);
}
});
}
return ids;
},

setCookie: function(name, array)
{
if(array.length != 0)
{
var data = '|'+array.join('|')+'|';
Cookie.set(name, data, 3600000);
}
else
{
Cookie.unset(name);
}
},

updateCookies: function(inlineIds, removedIds)
{
if(inlineIds.indexOf('ALL') != -1)
{
var count = all_text - removedIds.length;
}
else
{
var count = inlineIds.length;
}
if(count < 0)
{
count = 0;
}
$('inline_go').value = go_text+' ('+count+')';
if(count == 0)
{
inlineModeration.clearChecked();
}
else
{
inlineModeration.setCookie(inlineModeration.cookieName, inlineIds);
inlineModeration.setCookie(inlineModeration.cookieName+'_removed', removedIds);
}
return count;
},

addId: function(array, id)
{
if(array.indexOf(id) == -1)
{
array.push(id);

		}

		}

		
var allSelectedRow = document.getElementById("allSelectedrow");
if(allSelectedRow)





		return array;
},

removeId: function(array, id)
{
var position = array.indexOf(id);
if(position != -1)

		{

		{

			allSelectedRow.style.display = "table-row";

			array.splice(position, 1);

		}

		}

 
		return array;

	}
};

	}
};

Event.observe(document, "dom:loaded", inlineModeration.init);

Event.observe(document, 'dom:loaded', inlineModeration.init);