Filter:   InfoImg
download layout.js
Language: JavaScript
Copyright: (C) 2000-2001 Mike Krus
LOC: 89
Project Info
HPE
Server: SourceForge
Type: cvs
[Show Code]






[Show Code]
...ceForge\h\hpe\hpe\hpe1\HPE\
   .cvsignore
   clickerr.inc
   config.inc
   Config_File.class.php
   database.inc
   database.mysql.inc
   database.pear.inc
   FormChek.js
   HPE.inc
   HPEbase.inc
   HPEUsers.default.xml
   HPEUsers.guest.xml
   layout.js
   local.inc
   modules.inc
   ...andlers.addChannel.ftsc
   navcond.js
   newsaccess.inc
   newssource.inc
   newstools.js
   overlib.js
   overlib_mini.js
   pagemaker.inc
   pages.inc
   PHPClientSniffer.inc
   phpodp.inc
   publisher.inc
   services.inc
   sitelister.inc
   Smarty.addons.php
   Smarty.class.php
   Smarty_Compiler.class.php
   sourcetools.js
   thememaker.inc
   toparser.inc
   user.edit.inc
   user.inc
   xmlrpc.inc
   xmlrpcs.inc
   xmltree.inc

/*

HPE - News Portal Engine
Copyright (C) 2000-2001 Mike Krus

READ LICENSE.TXT IN THE BASE DIRECTORY FOR INFORMATION ABOUT REDISTRIBUTING THIS SOURCE CODE

-----

Orinigal code from http://www.geekboys.org/

*/

var docObjName = (document.all) ? "document.all." : "document.";

var lastCols = 2;
var curCol = -1;

function setCol(colNum) {
	curCol = colNum;
//	alert(curCol);
}

function moveLeft()  {
	if(curCol == -1) {
		alert(strNoSelect);
		return;
	}

    if (curCol==0) { moveCol(curCol,lastCols); }
    else { moveCol(curCol,curCol-1); }
}

function moveRight() {
	if(curCol == -1) {
		alert(strNoSelect);
		return;
	}

    if (curCol==lastCols) { moveCol(curCol,0); }
    else { moveCol(curCol,curCol+1); }
}

function moveUp()   { 
	if(curCol == -1) {
		alert(strNoSelect);
		return;
	}

	moveRow(curCol, true); 
}

function moveDown() {
	if(curCol == -1) {
		alert(strNoSelect);
		return;
	}

	moveRow(curCol, false); 
}

function moveRow(colNum, up) {
    var colObj = eval(docObjName + "form.col" + colNum);
    var colOptObj = colObj.options;
    var colOptLen = colOptObj.length;
    var selectedIndex = colObj.selectedIndex;

    var fromIndex = selectedIndex;
    var toIndex = -1;

    if (up==true) {
        if (selectedIndex == 0) { toIndex = colOptLen-1; }
        else { toIndex = fromIndex - 1; }
    }
    else {
        if (selectedIndex == (colOptLen-1)) { toIndex = 0; }
        else { toIndex = fromIndex + 1; }
    }

    var fromSelectedValue = colOptObj[fromIndex].value;
    var fromSelectedText  = colOptObj[fromIndex].text;

    var toSelectedValue = colOptObj[toIndex].value;
    var toSelectedText  = colOptObj[toIndex].text;

    if (selectedIndex != -1) {
        colOptObj[toIndex].value = fromSelectedValue;
        colOptObj[toIndex].text = fromSelectedText;

        colOptObj[fromIndex].value = toSelectedValue;
        colOptObj[fromIndex].text = toSelectedText;
    }

    colObj.selectedIndex = toIndex;
}

function moveCol(fromColNum, toColNum) {
    var fromCol = "col" + fromColNum;
    var toCol   = "col" + toColNum;

    var formName   = "form";

    var fromColObj = eval(docObjName + formName + "." + fromCol);
    var fromColOptObj = fromColObj.options;

    var toColObj   = eval(docObjName + formName + "." + toCol);
    var toColOptObj = toColObj.options;

    var fromColLen  = fromColOptObj.length;
    var toColLen    = toColOptObj.length;

/*
    if (fromColLen <= 1) {
        alert('Cannot remove all items.');
        return;
    }
*/

    var selectedIndex = fromColObj.selectedIndex;
    var selectedValue;
    var selectedText;

    if (selectedIndex != -1) {
        selectedValue=fromColOptObj[selectedIndex].value;
        if (selectedValue=='-')    { return; }
        selectedText=fromColOptObj[selectedIndex].text;

        fromColOptObj[selectedIndex] = null;


        toColOptObj.length += 1;
        toColOptObj[toColLen].value=selectedValue;
        toColOptObj[toColLen].text=selectedText;

        toColObj.selectedIndex = toColOptObj.length-1;
        fromColObj.selectedIndex = -1;

		curCol = toColNum;
    }

}