Example #1
0
function buildTreeView($action, $stock_group_id = 0, $stock_group_parent_id = -1, $depth = 0, $parent_last = 0)
{
    $sql = "select * from stock_group where stock_group_parent_id=" . $stock_group_parent_id . " order by stock_group_name";
    if ($rs = mysql_query($sql)) {
        $depth++;
        $i = 1;
        while ($parent = mysql_fetch_array($rs)) {
            echo "<tr valign=top>";
            echo "<td nowrap>";
            if ($parent["stock_group_parent_id"] != -1) {
                drawBlanksIntersecs($parent["stock_group_id"]);
            }
            $sql2 = "select * from stock_group where stock_group_parent_id=" . $parent["stock_group_id"] . " order by stock_group_name";
            $rs2 = mysql_query($sql2);
            if (mysql_num_rows($rs2) != 0) {
                if ($action == "expand" && openFolder($stock_group_id, $parent["stock_group_id"])) {
                    echo "<a href=treeview.php?action=expand&stock_group_id=" . $parent["stock_group_parent_id"] . ">";
                    if (mysql_num_rows($rs) == $i) {
                        echo "<img src=" . $dir . "images/trv_intersecminus_end.gif height=18 width=18 border=0 vspace=0 hspace=0 align=left>";
                    } else {
                        echo "<img src=" . $dir . "images/trv_intersecminus.gif height=18 width=18 border=0 vspace=0 hspace=0 align=left>";
                    }
                } else {
                    echo "<a href=treeview.php?action=expand&stock_group_id=" . $parent["stock_group_id"] . ">";
                    if (mysql_num_rows($rs) == $i) {
                        echo "<img src=" . $dir . "images/trv_intersecplus_end.gif height=18 width=18 border=0 vspace=0 hspace=0 align=left>";
                    } else {
                        echo "<img src=" . $dir . "images/trv_intersecplus.gif height=18 width=18 border=0 vspace=0 hspace=0 align=left>";
                    }
                }
            } else {
                if (mysql_num_rows($rs) == $i) {
                    echo "<img src=images/trv_end.gif height=18 width=18 border=0 vspace=0 hspace=0 align=left>";
                } else {
                    echo "<img src=images/trv_intersec.gif height=18 width=18 border=0 vspace=0 hspace=0 align=left>";
                }
            }
            if ($action == "expand" && openFolder($stock_group_id, $parent["stock_group_id"])) {
                echo "<img src=images/trv_openfolder.gif height=18 width=18 border=0 vspace=0 hspace=0 align=left>";
            } else {
                echo "<img src=images/trv_closedfolder.gif height=18 width=18 border=0 vspace=0 hspace=0 align=left>";
            }
            echo "</a>";
            //Here you can change where the link of the folder points too.
            //You really should to edit it...
            echo "<a href=main.php?stock_group_id=" . $parent["stock_group_id"] . " target=treeview_main>";
            echo "&nbsp;&nbsp;" . $parent["stock_group_name"];
            echo "</td>";
            echo "</tr>";
            if ($action == "expand" && openFolder($stock_group_id, $parent["stock_group_id"])) {
                buildTreeView($action, $stock_group_id, $parent["stock_group_id"], $depth, $parent_last);
            }
            $i++;
        }
    }
}
Example #2
0
function processActions()
{
    $ftpAction = '';
    if (isset($_POST["ftpAction"]) && !empty($_POST["ftpAction"])) {
        $ftpAction = $_POST["ftpAction"];
    } elseif (isset($_GET["ftpAction"]) && !empty($_GET["ftpAction"])) {
        $ftpAction = $_GET["ftpAction"];
    } else {
        $ftpAction = 'error';
    }
    // Open folder (always called)
    if (openFolder() == 1) {
        // New file
        if ($ftpAction == "newFile") {
            newFile();
        }
        // New folder
        if ($ftpAction == "newFolder") {
            newFolder();
        }
        // Upload file
        if ($ftpAction == "upload") {
            uploadFile();
        }
        // Cut
        if ($ftpAction == "cut") {
            cutFilesPre();
        }
        // Copy
        if ($ftpAction == "copy") {
            copyFilesPre();
        }
        // Paste
        if ($ftpAction == "paste") {
            pasteFiles();
        }
        // Delete
        if ($ftpAction == "delete") {
            deleteFiles();
        }
        // Rename
        if ($ftpAction == "rename") {
            renameFiles();
        }
        // Chmod
        if ($ftpAction == "chmod") {
            chmodFiles();
        }
        // Drag & Drop
        if ($ftpAction == "dragDrop") {
            dragDropFiles();
        }
        // Edit
        if ($ftpAction == "edit") {
            editFile();
        }
    }
}