Permalink
Browse files

bugfixes

  • Loading branch information...
1 parent 3cd584b commit 08b6e3073027459000200496e3b984e5642d5373 Willem Van der Merwe committed Feb 29, 2012
Showing with 23 additions and 15 deletions.
  1. +5 −2 index.php
  2. +9 −6 views/event.php
  3. +9 −7 views/events.php
View
@@ -75,7 +75,9 @@
view('decks', $data);
break;
case 'deck':
+ $deck_card_ids = array();
$deck_id = get('id');
+ $data['editable'] = false;
if (isset($deck_id)) {
$deck = callAPI("deck/get?id=$deck_id", array(), 'obj');
if (empty($deck) || !$deck->id) {
@@ -86,9 +88,9 @@
$deck_cards = callAPI("card", array('deck_id'=>$deck_id), 'obj');
foreach($deck_cards as $card) {
$deck_card_ids[] = $card->id;
- $data['deck_card_ids'] = implode(',',$deck_card_ids);
}
-
+ $data['editable'] = is('super') || (is('admin') && is('owner',$deck));
+ $data['deck_card_ids'] = implode(',',$deck_card_ids);
$data['edit_deck_id'] = $deck_id;
$data['edit_deck'] = $deck;
$data['deck_cards'] = $deck_cards;
@@ -107,6 +109,7 @@
view('events',$data);
break;
case 'event':
+ $data['event_cards'] = array();
$event_id = get('id');
if (isset($event_id)) {
$event = callAPI("event/get?id=$event_id", array(), 'obj');
View
@@ -94,12 +94,15 @@
<!-- Buttons -->
<div class="non-label-section">
- <?php if(is('super') || is('owner', $event )) {?>
- <input type="button" id="save" class="button medium blue" value="Save" />
- <a href="index.php?do=events" class="button medium">Cancel</a>
- <?php }else{?>
+ <?php if(isset($event) && (is('super') || is('owner',$event))):?>
+ <input type="button" id="save" class="button medium blue" value="Save" />
+ <a href="index.php?do=events" class="button medium">Cancel</a>
+ <?php elseif(is('admin')):?>
+ <input type="button" id="save" class="button medium blue" value="Save" />
+ <a href="index.php?do=events" class="button medium">Cancel</a>
+ <?php else:?>
<p class="button medium disabled" id="fakesave">Only owner can edit</p>
- <?php }?>
+ <?php endif;?>
</div>
</fieldset>
@@ -126,7 +129,7 @@
<h3>Add cards from Deck</h3>
<div>
<?php foreach($data['decks'] as $deck){
- echo("<span class='list-col'><label><input type='radio' name='deck_id' value=".$deck->id.'"> '.$deck->name."</label></span>");
+ echo("<span class='list-col'><label><input type='radio' name='deck_id' value='$deck->id'>$deck->name</label></span>");
} ?>
</div>
<!-- Buttons -->
View
@@ -7,13 +7,15 @@
<script src="assets/js/chosen/chosen.jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
- $('#events')
- .tablesorter({dateFormat: 'ddmmyyyy', widthFixed: true, widgets: ['zebra'],sortList:[[3,1]],headers: {
- //3: { sorter: "shortDate", dateFormat: 'ddmmyyyy' }, // dateFormat will parsed as the default above
- // 4: { sorter: "shortDate"}, // set day first format
- 5: { sorter: false}
- }})
- .tablesorterPager({container: $("#table-pager-1")});
+ if($('#events').length) {
+ $('#events')
+ .tablesorter({dateFormat: 'ddmmyyyy', widthFixed: true, widgets: ['zebra'],sortList:[[3,1]],headers: {
+ //3: { sorter: "shortDate", dateFormat: 'ddmmyyyy' }, // dateFormat will parsed as the default above
+ // 4: { sorter: "shortDate"}, // set day first format
+ 5: { sorter: false}
+ }})
+ .tablesorterPager({container: $("#table-pager-1")});
+ }
});
</script>
<!-- BEGIN PAGE BREADCRUMBS/TITLE -->

0 comments on commit 08b6e30

Please sign in to comment.