/*********************************************************************** * MyLittleJavaScript * ************************************************************************ * Created by Michael Loesler * * * * This script is part of my little forum * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***********************************************************************/ /*********************************************************************** * NOTICE: In order to reduce bandwidth usage, a minimized version of * * this script is used by default (admin.min.js). Changes in this file * * do not have any effect unless it is loaded by the template * * (themes/[THEME FOLDER]/main.tpl). * * The minimized version was created with the YUI Compressor * * . * ***********************************************************************/ /** * Kleiner Feature im Adminbereich werden * von diesem Objekt realisiert. * Hauptsaechlich handelt es sich um Sicherheitsabfragen */ function MyLittleAdmin() { /** * Initialisiert in den globalen Einstellungen * den CSS-Klassenwechsel bei RADIO und CHECKBOX */ var initGlobalSettings = function() { var f = document.getElementById("settings"); if (!f) return; var changeClassName = function(id, active) { if (id && document.getElementById(id+"_label")) document.getElementById(id+"_label").className = active?"active":"inactive"; }; var changeCollectionClassName = function(col) { for (var i=0; i1?decodeURIComponent(v[1]):""; } }; var saveNewOrder = function() { if (!isChanged) return; var page = getLocationQueryByParameter("action"); var order = getRowOrder(); if (!page || !order) return; var querys = [ new Query("mode", "admin"), new Query("action", "reorder"), new Query(page, order) ]; new Request("index.php", "POST", querys); }; var updateClasses = function() { for (var i=0; i 3) order += rows[i].id.substring(3) + ","; return order.substr(0, order.length-1); }; var ondrag = function(row) { if (!row) return; }; var ondrop = function(row) { if (!row) return; updateClasses(); saveNewOrder(); }; var start = function() { window.document.onmousemove = function(e) { if (typeof oldOnMouseMoveFunc == "function") oldOnMouseMoveFunc(e); if (!dragObject) return; var mPos = document.getMousePos(e); var currentTop = mPos.top - dragObject.handlePos.top + dragObject.elementPos.top; var currentRow = findDropTargetRow( currentTop ); if (tableTop != currentTop && currentRow && dragObject != currentRow) { var movingDown = currentTop > tableTop; tableTop = currentTop; if (movingDown) currentRow = currentRow.nextSibling; dragObject.parentNode.insertBefore(dragObject, currentRow); isChanged = true; ondrag(dragObject); } if(e && e.preventDefault) e.preventDefault(); return false; }; window.document.onmouseup = function (e) { window.document.onmouseup = window.document.onmousemove = null; if (typeof oldOnMouseUpFunc == "function") oldOnMouseUpFunc(e); if (typeof oldOnMouseMoveFunc == "function") window.document.onmousemove = oldOnMouseMoveFunc; ondrop(dragObject); dragObject = null; isChanged = false; return false; }; }; var findDropTargetRow = function(top) { for (var i=0; i= (rowPoSi.top - h)) && (top < (rowPoSi.top + h))) { return rows[i]; } } return null; }; var add = function(row) { row.style.cursor = "move"; row.title = lang["drag_and_drop_title"]; row.onmousedown = function(e){ isChanged = false; var obj = document.getTarget(e); if (obj && obj.className.search(/control/) != -1) return false; this.className = "drag"; this.elementPos = document.getElementPoSi(this); this.handlePos = document.getMousePos(e); dragObject = this; start(); return false; }; var links = row.cells[row.cells.length-1].getElementsByTagName("a"); if (links && links.length > 0) { for (var i=0; i