forked from science-ation/science-ation
- 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.
This commit is contained in:
parent
daf3314c03
commit
2b10dc2131
@ -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("<?=$_SERVER['PHP_SELF']?>?action=orderprizes&order="+order);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<?
|
||||
|
||||
@ -319,7 +333,29 @@ htabs_tab_begin('eligibility');
|
||||
htabs_tab_end();
|
||||
|
||||
htabs_tab_begin('prizes');
|
||||
echo 'Prize info!<br>';
|
||||
?>
|
||||
<pre>
|
||||
<div id="info">Waiting for update</div>
|
||||
</pre>
|
||||
<ul id="test-list">
|
||||
<li id="listItem_1">
|
||||
<img src="arrow.png" alt="move" width="16" height="16" class="handle" />
|
||||
<strong>Item 1 </strong>with a link to <a href="http://www.google.co.uk/" rel="nofollow">Google</a>
|
||||
</li>
|
||||
<li id="listItem_2">
|
||||
<img src="arrow.png" alt="move" width="16" height="16" class="handle" />
|
||||
<strong>Item 2</strong>
|
||||
</li>
|
||||
<li id="listItem_3">
|
||||
<img src="arrow.png" alt="move" width="16" height="16" class="handle" />
|
||||
<strong>Item 3</strong>
|
||||
</li>
|
||||
<li id="listItem_4">
|
||||
<img src="arrow.png" alt="move" width="16" height="16" class="handle" />
|
||||
<strong>Item 4</strong>
|
||||
</li>
|
||||
</ul>
|
||||
<?
|
||||
htabs_tab_end();
|
||||
|
||||
htabs_end();
|
||||
|
@ -384,6 +384,7 @@ function send_header($title="", $nav=null, $icon=null, $titletranslated=false)
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/sfiab.js"></script>
|
||||
|
||||
<?
|
||||
|
Loading…
Reference in New Issue
Block a user