From 2b10dc213179ab4ee251343e2a27de29504df5be Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 8 Sep 2009 22:02:14 +0000 Subject: [PATCH] - Add an example for how to use a draggable sortable list to the prize tag. - Add jquery-ui to the scripts, it has support for drag and drop, as well as windows, will convert the popup window to the jquery-ui version next, so we don't have to maintain our own. --- admin/award_awards.php | 48 ++++++++++++++++++++++++++++++++++++------ common.inc.php | 1 + 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/admin/award_awards.php b/admin/award_awards.php index da6efcc..ee6f262 100644 --- a/admin/award_awards.php +++ b/admin/award_awards.php @@ -72,11 +72,6 @@ case 'saveawardinfo': print_r($_POST); - $in=fopen("/tmp/p.txt", "wt"); - fwrite($in, "post".print_r($_POST, true)); - fwrite($in, "get".print_r($_GET, true)); - fclose($in); - /* $r=mysql_fetch_object($q); $award_awards_id=$r->id; @@ -111,6 +106,13 @@ } echo json_encode($ret); exit; + + case 'orderprizes': + foreach ($_GET['listItem'] as $position => $item) { + $sql[] = "UPDATE `table` SET `position` = $position WHERE `id` = $item"; + } + print_r($sql); + exit; } if($_GET['action']=="edit" || $_GET['action']=="add") { @@ -224,6 +226,18 @@ function update_eligibility() $("[name=eligibledivisions]").val(json.divisions); }); } + +// When the document is ready set up our sortable with it's inherant function(s) +$(document).ready(function() { + $("#test-list").sortable({ + handle : '.handle', + update : function () { + var order = $('#test-list').sortable('serialize'); + $("#info").load("?action=orderprizes&order="+order); + } + }); +}); + '; +?> +
 
+    
Waiting for update
+
+ + +