Posted By

onefastsnail on 05/24/12


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

mister
hurcy


Snippet


 / Published in: JavaScript
 

  1. <?php
  2. $path = "../../";
  3.  
  4. require($path."includes/header.inc.php");
  5.  
  6. if($_POST['action'] == "order"){
  7.  
  8. foreach ($_POST['rarray'] as $order => $record) {
  9.  
  10. $db = new sql;
  11. $query = "";
  12.  
  13. switch ($_POST['who']) {
  14. case "eitem":
  15. $query = "UPDATE `emails_ezines_items` SET `order` = ".clean_db($order)." WHERE id = ".clean_db($record);
  16. break;
  17. default:
  18. //do nothing
  19. }
  20.  
  21. if($query<>""){
  22. $db->query($query);
  23. }
  24. }
  25. };
  26. ?>
  27.  
  28. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
  29. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
  30.  
  31. <script type="text/javascript">
  32.  
  33. $(function() {
  34.  
  35. $(".manage-items tbody.content").sortable({ opacity: 0.6, cursor: 'move', update: function() {
  36. var order = $(this).sortable("serialize") + '&action=order&who=eitem&eid=<?=$_REQUEST["eid"];?>';
  37. $.post("order.php", order, function(theResponse){
  38. $("#res").html(theResponse);
  39. });
  40. }
  41. });
  42. });
  43.  
  44. </script>
  45.  
  46. <table width="100%" cellpadding="5" class="manage-items">
  47. <tbody><tr class="row_heading nodrag"><th>ID</th><th>Order</th><th>Name</th><th>Delete</th><th>Visibility</th></tr>
  48. </tbody><tbody class="content ui-sortable">
  49.  
  50.  
  51. <tr id="sitem_4" style="opacity: 1;" class=""><td width="15" align="center">4</td><td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=4&amp;reorder_direction=up"><img border="0" src="/images/up_arrow.jpg"></a><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=4&amp;reorder_direction=down"><img border="0" src="/images/down_arrow.jpg"></a></td><td width="575"><a href="/admin/create_email/generate.php?eid=35&amp;sid=4">mark images</a></td><td width="15" align="center"><a onclick="return confirm('Are you sure you want to delete the section?');" title="Do you want to delete this section?" class="delete" href="/admin/create_email/index.php?eid=35&amp;d=4"><img src="/admin/images/no.png" alt="Delete"></a></td>
  52. <td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;sid=4&amp;v=1"><img src="/admin/images/accept.png" alt="Delete"></a></td>
  53. </tr><tr id="sitem_6"><td width="15" align="center">6</td><td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=6&amp;reorder_direction=up"><img border="0" src="/images/up_arrow.jpg"></a><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=6&amp;reorder_direction=down"><img border="0" src="/images/down_arrow.jpg"></a></td><td width="575"><a href="/admin/create_email/generate.php?eid=35&amp;sid=6">text with link</a></td><td width="15" align="center"><a onclick="return confirm('Are you sure you want to delete the section?');" title="Do you want to delete this section?" class="delete" href="/admin/create_email/index.php?eid=35&amp;d=6"><img src="/admin/images/no.png" alt="Delete"></a></td>
  54. <td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;sid=6&amp;v=1"><img src="/admin/images/accept.png" alt="Delete"></a></td>
  55. </tr>
  56. <tr id="sitem_7"><td width="15" align="center">7</td><td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=7&amp;reorder_direction=up"><img border="0" src="/images/up_arrow.jpg"></a><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=7&amp;reorder_direction=down"><img border="0" src="/images/down_arrow.jpg"></a></td><td width="575"><a href="/admin/create_email/generate.php?eid=35&amp;sid=7">line</a></td><td width="15" align="center"><a onclick="return confirm('Are you sure you want to delete the section?');" title="Do you want to delete this section?" class="delete" href="/admin/create_email/index.php?eid=35&amp;d=7"><img src="/admin/images/no.png" alt="Delete"></a></td>
  57. <td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;sid=7&amp;v=1"><img src="/admin/images/accept.png" alt="Delete"></a></td>
  58. </tr>
  59. <tr id="sitem_3"><td width="15" align="center">3</td><td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=3&amp;reorder_direction=up"><img border="0" src="/images/up_arrow.jpg"></a><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=3&amp;reorder_direction=down"><img border="0" src="/images/down_arrow.jpg"></a></td><td width="575"><a href="/admin/create_email/generate.php?eid=35&amp;sid=3">back image</a></td><td width="15" align="center"><a onclick="return confirm('Are you sure you want to delete the section?');" title="Do you want to delete this section?" class="delete" href="/admin/create_email/index.php?eid=35&amp;d=3"><img src="/admin/images/no.png" alt="Delete"></a></td>
  60. <td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;sid=3&amp;v=1"><img src="/admin/images/accept.png" alt="Delete"></a></td>
  61. </tr>
  62. <tr id="sitem_5"><td width="15" align="center">5</td><td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=5&amp;reorder_direction=up"><img border="0" src="/images/up_arrow.jpg"></a><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=5&amp;reorder_direction=down"><img border="0" src="/images/down_arrow.jpg"></a></td><td width="575"><a href="/admin/create_email/generate.php?eid=35&amp;sid=5">artist with logo</a></td><td width="15" align="center"><a onclick="return confirm('Are you sure you want to delete the section?');" title="Do you want to delete this section?" class="delete" href="/admin/create_email/index.php?eid=35&amp;d=5"><img src="/admin/images/no.png" alt="Delete"></a></td>
  63. <td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;sid=5&amp;v=1"><img src="/admin/images/accept.png" alt="Delete"></a></td>
  64. </tr><tr id="sitem_1" style="opacity: 1;" class=""><td width="15" align="center">1</td><td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=1&amp;reorder_direction=up"><img border="0" src="/images/up_arrow.jpg"></a><a href="/admin/create_email/index.php?eid=35&amp;reorder_id=1&amp;reorder_direction=down"><img border="0" src="/images/down_arrow.jpg"></a></td><td width="575"><a href="/admin/create_email/generate.php?eid=35&amp;sid=1">image 1</a></td><td width="15" align="center"><a onclick="return confirm('Are you sure you want to delete the section?');" title="Do you want to delete this section?" class="delete" href="/admin/create_email/index.php?eid=35&amp;d=1"><img src="/admin/images/no.png" alt="Delete"></a></td>
  65. <td width="25" align="center"><a href="/admin/create_email/index.php?eid=35&amp;sid=1&amp;v=1"><img src="/admin/images/accept.png" alt="Delete"></a></td>
  66. </tr>
  67.  
  68. </tbody>
  69. </table>

Report this snippet  

You need to login to post a comment.