| 499 | | setButtons(slot, n, slots); |
| 500 | | function setButtons(slot, n, slots) |
| 501 | | { |
| 502 | | if (n > 0) |
| 503 | | { |
| 504 | | // TODO: this is not sensitive enough to nested areas |
| 505 | | $(slot).find('.a-arrow-up').show().unbind('click').click(function() { |
| 506 | | // It would be nice to confirm success here in some way |
| 507 | | $.get(updateAction, { id: id, name: name, permid: $(slot).data('a-permid'), up: 1 }); |
| 508 | | apostrophe.swapNodes(slot, slots[n - 1]); |
| 509 | | apostrophe.areaUpdateMoveButtons(updateAction, id, name); |
| 510 | | return false; |
| 511 | | }); |
| 512 | | } |
| 513 | | else |
| 514 | | { |
| 515 | | $(slot).find('.a-arrow-up').hide(); |
| 516 | | } |
| 517 | | if (n < (slots.length - 1)) |
| 518 | | { |
| 519 | | $(slot).find('.a-arrow-down').show().unbind('click').click(function() { |
| 520 | | // It would be nice to confirm success here in some way |
| 521 | | $.get(updateAction, { id: id, name: name, permid: $(slot).data('a-permid'), up: 0 }); |
| 522 | | apostrophe.swapNodes(slot, slots[n + 1]); |
| 523 | | apostrophe.areaUpdateMoveButtons(updateAction, id, name); |
| 524 | | return false; |
| 525 | | }); |
| 526 | | } |
| 527 | | else |
| 528 | | { |
| 529 | | $(slot).find('.a-arrow-down').hide(); |
| 530 | | } |
| 531 | | } |
| | 499 | slotUpdateMoveButtons(id, name, slot, n, slots, updateAction); |
| | 507 | |
| | 508 | // Private methods callable only from the above (no this.foo = bar) |
| | 509 | function slotUpdateMoveButtons(id, name, slot, n, slots, updateAction) |
| | 510 | { |
| | 511 | if (n > 0) |
| | 512 | { |
| | 513 | // TODO: this is not sensitive enough to nested areas |
| | 514 | $(slot).find('.a-arrow-up').show().unbind('click').click(function() { |
| | 515 | // It would be nice to confirm success here in some way |
| | 516 | $.get(updateAction, { id: id, name: name, permid: $(slot).data('a-permid'), up: 1 }); |
| | 517 | apostrophe.swapNodes(slot, slots[n - 1]); |
| | 518 | apostrophe.areaUpdateMoveButtons(updateAction, id, name); |
| | 519 | return false; |
| | 520 | }); |
| | 521 | } |
| | 522 | else |
| | 523 | { |
| | 524 | $(slot).find('.a-arrow-up').hide(); |
| | 525 | } |
| | 526 | if (n < (slots.length - 1)) |
| | 527 | { |
| | 528 | $(slot).find('.a-arrow-down').show().unbind('click').click(function() { |
| | 529 | // It would be nice to confirm success here in some way |
| | 530 | $.get(updateAction, { id: id, name: name, permid: $(slot).data('a-permid'), up: 0 }); |
| | 531 | apostrophe.swapNodes(slot, slots[n + 1]); |
| | 532 | apostrophe.areaUpdateMoveButtons(updateAction, id, name); |
| | 533 | return false; |
| | 534 | }); |
| | 535 | } |
| | 536 | else |
| | 537 | { |
| | 538 | $(slot).find('.a-arrow-down').hide(); |
| | 539 | } |
| | 540 | } |