//<script language="JavaScript">
///////////////////////////////////////////////////////////////////////////
// Function to detect a change in the template dropdown box
// in the content manager.
function onChangeTemplate()
{
var index = document.template.template.selectedIndex;
var template = document.template.template[index].value;
var index = document.template.language.selectedIndex;
var language = document.template.language[index].value;
var location = 'index.php?admin§ion=content&action=Select&template='
+template;
if (language) location += '&language='+language;
window.location = location;
}
///////////////////////////////////////////////////////////////////////////
// Function to move a menu item down.
function moveDown(index)
{
// Exchange this item with the one below it.
editMenu = document.getElementById("editMenu");
var template1 = editMenu["template"+index].value;
var item1 = editMenu["item"+index].value;
var template2 = editMenu["template"+(index+1)].value;
var item2 = editMenu["item"+(index+1)].value;
editMenu["template"+index].value = template2;
editMenu["item"+index].value = item2;
editMenu["template"+(index+1)].value = template1;
editMenu["item"+(index+1)].value = item1;
}
///////////////////////////////////////////////////////////////////////////
// Function to move a menu item up.
function moveUp(index)
{
// Exchange this item with the one above it.
editMenu = document.getElementById("editMenu");
var template1 = editMenu["template"+index].value;
var item1 = editMenu["item"+index].value;
var template2 = editMenu["template"+(index-1)].value;
var item2 = editMenu["item"+(index-1)].value;
editMenu["template"+index].value = template2;
editMenu["item"+index].value = item2;
editMenu["template"+(index-1)].value = template1;
editMenu["item"+(index-1)].value = item1;
}
///////////////////////////////////////////////////////////////////////////
// View a template's contents.
function viewTemplateContent(id)
{
name=document.getElementById("name"+id).value;
note=document.getElementById("note"+id).value;
window.location = 'index.php?admin§ion=content&action=Select'
+'&template='+id;
}
///////////////////////////////////////////////////////////////////////////
// Save a template.
function saveTemplate(id)
{
name=document.getElementById("name"+id).value;
note=document.getElementById("note"+id).value;
window.location = 'index.php?admin§ion=template&action=save&id='+id
+'&name='+name+'¬e='+note;
}
///////////////////////////////////////////////////////////////////////////
// Delete a template parent-child entry.
function deleteChild(parent, child)
{
if (confirm("Do you want to delete this child?"))
{
window.location = 'index.php?admin§ion=template&action=delChild&id='
+parent+'&child='+child;
}
}
///////////////////////////////////////////////////////////////////////////
// Save a language.
function saveLanguage(id)
{
code=document.getElementById("name"+id).value;
note=document.getElementById("note"+id).value;
window.location = 'index.php?admin§ion=language&action=save&id='+id
+'&code='+code+'¬e='+note;
}
///////////////////////////////////////////////////////////////////////////
// Delete an item.
function deleteItem(section, id)
{
if (confirm("Do you want to delete this "+section+"?"))
{
window.location = 'index.php?admin§ion='+section
+'&action=delete&id='+id;
}
}
///////////////////////////////////////////////////////////////////////////
// Delete a menu item.
function deleteMenuItem(index)
{
if (confirm("Do you want to delete this menu item?"))
{
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "toDelete");
input.setAttribute("value", index);
document.getElementById("editMenu").appendChild(input);
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "action");
input.setAttribute("value", "Save menu");
document.getElementById("editMenu").appendChild(input);
document.forms["editMenu"].submit();
}
}
//</script>
|