diff -r 000000000000 -r 03b0d1493584 web/wp-content/plugins/gigs-calendar/archive.ajax.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/gigs-calendar/archive.ajax.php Wed Dec 23 17:55:33 2009 +0000 @@ -0,0 +1,556 @@ +search("date <= CURDATE()", 'date DESC'); + ?> + + + + + + + + + + + + + fetch() ) : $v = $g->getVenue(); $p = $g->getPerformances(); $post = get_post($g->postID);?> + "> + + + + + + + + "> + + + + + +
id; ?>name; ?>city . (!empty($v->state) ? ', ' . $v->state : '') ?>date ?> + fetch() ) : ?> + time) ?> + + +
+ <?php _e('View Gig', $gcd) ?> + <?php _e('Edit', $gcd) ?> + + <?php _e('Map', $gcd) ?> + + + <?php _e('Edit WordPress Post', $gcd) ?> + + <?php _e('Delete', $gcd) ?> +
+
+ + + delete(); + echo '{"success": ' . ($result ? 'true' : 'false') . ',"action":"delete"' . ($result ? '' : ',"error":"db"') . '}'; + break; + case 'edit': + $g = new gig($_POST['id']); + $p = $g->getPerformances(); + $v = $g->getVenue(); + ?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + = 2.5 ) : ?> + postID); + dtcGigs::extraFields(apply_filters('gigCal_gigs_extraFields', array()), $metadata, $g->id); + ?> + + + + + fetch() ) : ?> + + + + + +
+

+
+
+ name . ' - ' . $v->getCity() ?> +
+ +
+
+ +
+
+

<?php _e('Expand', $gcd); ?>

+
+
+ + + + + + + + + + postID); + foreach ( $metadata as $key => $values ) { + foreach ( $values as $index => $value ) { + if ( substr($key, 0, 1) != '_' ) { + ?> + + + + + +
+ + + + <?php _e('Remove Custom Field', $gcd) ?>
+
+
+

+ + + + +

+

+
+
+
+

+
you are giving at a venue on the given date.', $gcd) ?>
+
+ id, false) ?> +
+
+
+
+ + + + + +
+
+ + + date = $_POST['date']; + $g->notes = $_POST['notes']; + $g->setTags($_POST['tags']); + $g->eventName = $_POST['eventName']; + + if ( isset($_POST['performanceID']) ) { + foreach ( $_POST['performanceID'] as $key => $pid ) { + $p = new performance((empty($pid) ? null : $pid)); + $p->gigID = $g->id; + $p->link = $_POST['link'][$key]; + $p->shortNotes = $_POST['shortNotes'][$key]; + $p->ages = (empty($_POST['ages-custom'][$key]) ? $_POST['ages'][$key] : $_POST['ages-custom'][$key]); + $p->time = date("H:i:s", strtotime($_POST['hour'][$key] . ':' . $_POST['minute'][$key] . ' ' . $_POST['meridiem'][$key])); + $p->save(); + } + } + + $p = new performance(); + if ( isset($_POST['delete']) ) { + foreach ( $_POST['delete'] as $pid ) { + $p->get($pid); + $p->delete(); + } + } + + $g->save(); + + foreach ( $_POST['deletecustom'] as $key => $delete ) { + if ( $delete ) { + delete_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['old-custom-value'][$key]); + } + } + + foreach ( $_POST['custom-key'] as $key => $field ) { + if ( is_array($_POST['custom-value'][$key]) ) { + foreach ( $_POST['custom-value'][$key] as $k => $v ) { + if ( $v === "" ) { + unset($_POST['custom-value'][$key][$k]); + } + } + } + if ( empty($_POST['custom-value'][$key]) && empty($_POST['old-custom-value'][$key]) ) { + // If both value fields are empty, just ignore this field. + continue; + } elseif ( $_POST['custom-value'][$key] === "" ) { + // If the old value is not empty, but the new one is, delete this sucker. + delete_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['old-custom-value'][$key]); + } elseif ( $_POST['old-custom-value'][$key] === "" ) { + // If the old value is empty, but the new one is not, create a new custom field. + add_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['custom-value'][$key]); + } elseif ( $_POST['old-custom-value'][$key] != $_POST['custom-value'][$key] && $_POST['old-custom-value'][$key] != serialize($_POST['custom-value'][$key]) ) { + // If the old and new values are not equal, update the custom field. + update_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['custom-value'][$key], unserialize($_POST['old-custom-value'][$key])); + } + } + + echo '{success:true, gig:' . $g->toJSON() . '}'; + break; + + case 'performance-form': + if ( isset($_POST['id']) ) { + pForm($_POST['id'], false); + } else { + pForm((int) $_POST['count'], true); + } + break; +} + + +function pForm($id, $new = true, $remove = true) { + global $folder, $gcd, $options; + $p = new performance(); + if ( $new ) { + $count = 'c' . $id; + } else { + $p->get($id); + $count = 'id' . $id; + } + + $ages = $options['ages-list']; + + $time = explode(":", $p->time); + $minutes = $time[1]; + + if ( $options['time-12h'] ) { + if ( $time[0] == 0 ) { + $hour = "12"; + $meridiem = "AM"; + } elseif ( $time[0] == 12 ) { + $hour = "12"; + $meridiem = "PM"; + } elseif ( $time[0] < 12 ) { + $hour = $time[0]; + $meridiem = "AM"; + } else { + $hour = $time[0] - 12; + $meridiem = "PM"; + } + } else { + $hour = $time[0]; + } + ?> + + + + + + + + + + +
+ + +
+ + + + + + + + +
<?php _e('Remove Performance', $gcd) ?>
+ +
+
+ + + +
+ + + +
+ + + + + +
+ +