<?php

include_once '../includes/nocache.php';
include_once '../includes/config.php';
include_once '../includes/sanitize.php';
include_once '../includes/helpers.php';
include 'includes/valida-login.php';
include 'includes/meta.php';
require_once 'sllists/SLLists.class.php';
$sortableLists = new SLLists('scriptaculous');
$sortableLists->addList('imageFloatContainer', 'imageFloatOrder', 'div', "overlap:'vertical',constraint:false");
$sortableLists->debug = false;
$id_seccion = 'PUBLICIDAD_GARAGE_VERT';
if (isset($_POST['sortableListsSubmitted'])) {
    $orderArray = SLLists::getOrderArray($_POST['imageFloatOrder'], 'imageFloatContainer');
    include_once '../includes/config.php';
    foreach ($orderArray as $item) {
        $campos = array('orden' => $item['order']);
        $db->update('publicidad', $campos, 'id=' . $item['element']);
    }
    redirige_pagina("publicidad_garage.php?err=2&opc=ordenar");
}
?>
<link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,700' rel='stylesheet' type='text/css'>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<?
$sortableLists->printTopJS();
?>
</head>
<body class="bcolor">
	<div id="fondo">
示例#2
0
) TYPE=MyISAM AUTO_INCREMENT=9 ;

sample data:

INSERT INTO categories VALUES (1, 'Galleries', 5);
INSERT INTO categories VALUES (2, 'Art', 2);
INSERT INTO categories VALUES (3, 'Roadtrip', 6);
INSERT INTO categories VALUES (4, 'Yosemite', 8);
INSERT INTO categories VALUES (5, 'Animals', 1);
INSERT INTO categories VALUES (6, 'Australia', 3);
INSERT INTO categories VALUES (7, 'Wesleyan', 7);
INSERT INTO categories VALUES (8, 'California', 4);
*/

require('SLLists.class.php');
$sortableLists = new SLLists('scriptaculous');	// points to path of scriptaculous JS files
$conn = mysql_connect('localhost', 'dbuser', 'dbpass');
mysql_select_db('dbname');

// information about the database fields and table
$dbTable = 'categories';		// the database table
$idField = 'catid';				// the numeric primary key
$displayField = 'category';		// the field whose text will be shown
$orderField = 'orderid';		// the field that will hold the sort order for the row


// formatting for the list - using a ul as a container and li tags for list items
$sortableTag = 'li';			// the type of tag that should be sortable
$listFormat = '<ul id="sortableList">%s</ul>';	// argument is the contents of the list
$listItemFormat = '<li id="item_%s">%s</li>';  // two arguments are the idField and the displayField
示例#3
0
function reorder_process($get)
{
    $userid = get_userid();
    $objResponse = new xajaxResponse();
    if (check_permission($userid, 'Manage All Content')) {
        global $gCms;
        $config =& $gCms->GetConfig();
        $db =& $gCms->GetDb();
        $contentops =& $gCms->GetContentOperations();
        $hm = $contentops->GetAllContentAsHierarchy(false);
        $hierarchy =& $hm->getRootNode();
        require cms_join_path(dirname(dirname(__FILE__)), 'lib', 'sllists', 'SLLists.class.php');
        $sortableLists = new SLLists($config["root_url"] . '/lib/scriptaculous');
        $listArray = array();
        $output = '';
        $sortableLists->addList('parent0', 'parent0ListOrder');
        $listArray[0] = 'parent0ListOrder';
        $output .= '<ul id="parent0" class="sortableList">' . "\n";
        foreach ($hierarchy->getChildren(false, true) as $child) {
            show_h($child, $sortableLists, $listArray, $output);
        }
        $output .= '</ul>';
        $order_changed = FALSE;
        foreach ($listArray as $parent_id => $order) {
            $orderArray = SLLists::getOrderArray($get[$order], 'parent' . $parent_id);
            foreach ($orderArray as $item) {
                $node =& $hm->sureGetNodeById($item['element']);
                if ($node != NULL) {
                    $one =& $node->getContent();
                    // Only update if order has changed.
                    if ($one->ItemOrder() != $item['order']) {
                        $order_changed = TRUE;
                        $query = 'UPDATE ' . cms_db_prefix() . 'content SET item_order = ? WHERE content_id = ?';
                        $db->Execute($query, array($item['order'], $item['element']));
                    }
                }
            }
        }
        if (TRUE == $order_changed) {
            global $gCms;
            $contentops =& $gCms->GetContentOperations();
            $contentops->SetAllHierarchyPositions();
            $contentops->ClearCache();
        }
    }
    $objResponse->assign("contentlist", "innerHTML", display_content_list());
    return $objResponse;
}
示例#4
0
<?
require_once('SLLists.class.php');
$sortableLists = new SLLists('scriptaculous');
$sortableLists->addList('categories','categoriesListOrder');
$sortableLists->addList('divContainer','divOrder','div');
$sortableLists->addList('imageContainer','imageOrder','img');
$sortableLists->addList('imageFloatContainer','imageFloatOrder','img',"overlap:'horizontal',constraint:false");
$sortableLists->debug = true;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Scriptaculous Lists with PHP</title>
<link rel="stylesheet" type="text/css" href="css/lists.css"/>
<?
$sortableLists->printTopJS();
?>

</head>
<body>
<a href="http://www.gregphoto.net">Back to Graphics by Greg</a>

<h1>Scriptaculous Lists with PHP</h1>
by Greg Neustaetter
<h2>Scriptaculous Sortables</h2>

<p><a href="http://script.aculo.us">Scriptaculous</a> is one of many great new JavaScript libraries created to answer the call for well
written 'Web 2.0' JavaScript libraries.  Written by Thomas Fuchs, scriptaculous has many features that can be used in AJAX-ified applications,
drag-and-drop effects, and a whole slew of visual effects.  The drag-and-drop effects, most notably the sortables, caught my eye because
the look great, they are so easy to implement, and they're just so much nicer than the standard listbox with up/down arrows that we see in
most of today's applications and administration tools.</p>