Event List - Version 0.6.1

Version Description

(2013-01-03) = * fixed redirect issue in admin event table * fixed a bug in filterbar javascript * fixed a problem with wrong format of deatails in admin event table * changed button text for event update from "Publish" to "Update" * show required manual widget update message on the frontpage only to users with required privileges

Download this release

Release Info

Developer mibuthu
Plugin Icon 128x128 Event List
Version 0.6.1
Comparing to
See all releases

Code changes from version 0.6.0 to 0.6.1

admin/includes/admin-main.php CHANGED
@@ -37,12 +37,12 @@ class EL_Admin_Main {
37
  if(!empty($_POST)) {
38
  $id = $this->db->update_event($_POST, __('Y/m/d'));
39
  $error = !$id;
40
- $this->redirect('added', $error, array('title' => $_POST['title'], 'id' => $id));
41
  }
42
  case 'edited':
43
  if(!empty($_POST)) {
44
  $error = !$this->db->update_event($_POST, __('Y/m/d'));
45
- $this->redirect('modified', $error, array('title' => $_POST['title'], 'id' => $_POST['id']));
46
  }
47
  break;
48
  case 'delete':
@@ -51,6 +51,9 @@ class EL_Admin_Main {
51
  $this->redirect('deleted', $error, array('id' => $_GET['id']));
52
  }
53
  break;
 
 
 
54
  }
55
  }
56
  // cleanup query args when filter button was pressed
@@ -154,15 +157,15 @@ class EL_Admin_Main {
154
  switch($action) {
155
  case 'added':
156
  if(!$error)
157
- $this->show_update_message('New Event "'.stripslashes($_GET['title']).'" was added.');
158
  else
159
- $this->show_error_message('Error: New Event "'.stripslashes($_GET['title']).'" could not be added.');
160
  break;
161
  case 'modified':
162
  if(!$error)
163
- $this->show_update_message('Event "'.stripslashes($_GET['title']).'" (id: '.$_GET['id'].') was modified.');
164
  else
165
- $this->show_error_message('Error: Event "'.stripslashes($_GET['title']).'" (id: '.$_GET['id'].') could not be modified.');
166
  break;
167
  case 'deleted':
168
  $num_deleted = count(explode(',', $_GET['id']));
@@ -186,7 +189,7 @@ class EL_Admin_Main {
186
  }
187
 
188
  private function redirect($action=false, $error=false, $query_args=array()) {
189
- $url = remove_query_arg(array('action', 'action2', 'filter', '_wpnonce', '_wp_http_referer'), $_SERVER['REQUEST_URI']);
190
  if($action) {
191
  $url = add_query_arg('action', $action, $url);
192
  }
37
  if(!empty($_POST)) {
38
  $id = $this->db->update_event($_POST, __('Y/m/d'));
39
  $error = !$id;
40
+ $this->redirect('added', $error, array('title' => urlencode($_POST['title']), 'id' => $id));
41
  }
42
  case 'edited':
43
  if(!empty($_POST)) {
44
  $error = !$this->db->update_event($_POST, __('Y/m/d'));
45
+ $this->redirect('modified', $error, array('title' => urlencode($_POST['title']), 'id' => $_POST['id']));
46
  }
47
  break;
48
  case 'delete':
51
  $this->redirect('deleted', $error, array('id' => $_GET['id']));
52
  }
53
  break;
54
+ // proceed with header if a bulk action was triggered (required due to "noheader" attribute for all action above)
55
+ case 'delete_bulk':
56
+ require_once(ABSPATH.'wp-admin/admin-header.php');
57
  }
58
  }
59
  // cleanup query args when filter button was pressed
157
  switch($action) {
158
  case 'added':
159
  if(!$error)
160
+ $this->show_update_message('New Event "'.esc_html(stripslashes($_GET['title'])).'" was added.');
161
  else
162
+ $this->show_error_message('Error: New Event "'.esc_html(stripslashes($_GET['title'])).'" could not be added.');
163
  break;
164
  case 'modified':
165
  if(!$error)
166
+ $this->show_update_message('Event "'.esc_html(stripslashes($_GET['title'])).'" (id: '.$_GET['id'].') was modified.');
167
  else
168
+ $this->show_error_message('Error: Event "'.esc_html(stripslashes($_GET['title'])).'" (id: '.$_GET['id'].') could not be modified.');
169
  break;
170
  case 'deleted':
171
  $num_deleted = count(explode(',', $_GET['id']));
189
  }
190
 
191
  private function redirect($action=false, $error=false, $query_args=array()) {
192
+ $url = remove_query_arg(array('noheader', 'action', 'action2', 'filter', '_wpnonce', '_wp_http_referer'), $_SERVER['REQUEST_URI']);
193
  if($action) {
194
  $url = add_query_arg('action', $action, $url);
195
  }
admin/includes/admin-new.php CHANGED
@@ -66,7 +66,7 @@ class EL_Admin_New {
66
  $json = json_encode(array('el_url' => EL_URL,
67
  'el_date_format' => $this->datepicker_format(__('Y/m/d'))));
68
  $out = '
69
- <form method="POST" action="?page=el_admin_main">';
70
  $out .= "
71
  <input type='hidden' id='json_for_js' value='".$json."' />"; // single quote required for value due to json layout
72
  // TODO: saving changed metabox status and order is not working yet
@@ -107,8 +107,8 @@ class EL_Admin_New {
107
  <th><label>Event Details</label></th>
108
  <td>';
109
  $editor_settings = array('media_buttons' => true,
110
- 'wpautop' => false,
111
- 'textarea_rows' => 20);
112
  ob_start();
113
  wp_editor(isset($event->details) ? $event->details : '', 'details', $editor_settings);
114
  $out .= ob_get_contents();
@@ -137,9 +137,11 @@ class EL_Admin_New {
137
  }
138
 
139
  public function render_publish_metabox() {
 
 
140
  $out = '<div class="submitbox">
141
  <div id="delete-action"><a href="?page=el_admin_main" class="submitdelete deletion">'.__('Cancel').'</a></div>
142
- <div id="publishing-action"><input type="submit" class="button button-primary button-large" name="publish" value="'.__('Publish').'" id="publish"></div>
143
  <div class="clear"></div>
144
  </div>';
145
  echo $out;
66
  $json = json_encode(array('el_url' => EL_URL,
67
  'el_date_format' => $this->datepicker_format(__('Y/m/d'))));
68
  $out = '
69
+ <form method="POST" action="'.add_query_arg('noheader', 'true', '?page=el_admin_main').'">';
70
  $out .= "
71
  <input type='hidden' id='json_for_js' value='".$json."' />"; // single quote required for value due to json layout
72
  // TODO: saving changed metabox status and order is not working yet
107
  <th><label>Event Details</label></th>
108
  <td>';
109
  $editor_settings = array('media_buttons' => true,
110
+ 'wpautop' => false,
111
+ 'textarea_rows' => 20);
112
  ob_start();
113
  wp_editor(isset($event->details) ? $event->details : '', 'details', $editor_settings);
114
  $out .= ob_get_contents();
137
  }
138
 
139
  public function render_publish_metabox() {
140
+ $edit = (isset($_GET['id']) && is_numeric($_GET['id']) && isset($_GET['action']) && 'edit' === $_GET['action']) ? true : false;
141
+ $button_text = $edit ? __('Update') : __('Publish');
142
  $out = '<div class="submitbox">
143
  <div id="delete-action"><a href="?page=el_admin_main" class="submitdelete deletion">'.__('Cancel').'</a></div>
144
+ <div id="publishing-action"><input type="submit" class="button button-primary button-large" name="publish" value="'.$button_text.'" id="publish"></div>
145
  <div class="clear"></div>
146
  </div>';
147
  echo $out;
admin/includes/event_table.php CHANGED
@@ -45,7 +45,7 @@ class EL_Event_Table extends WP_List_Table {
45
  case 'date' :
46
  return $this->format_event_date($item->start_date, $item->end_date, $item->time);
47
  case 'details' :
48
- return '<div>'.esc_html($this->db->truncate(80, $item->details)).'</div>';
49
  case 'pub_user' :
50
  return get_userdata($item->pub_user)->user_login;
51
  case 'pub_date' :
@@ -170,6 +170,7 @@ class EL_Event_Table extends WP_List_Table {
170
  $out .= $this->filterbar->show_years('?page=el_admin_main', $this->args, 'dropdown', 'admin');
171
  $out .= $this->filterbar->show_cats('?page=el_admin_main', $this->args, 'dropdown', 'admin');
172
  $out .= '
 
173
  <input id="event-query-submit" class="button" type="submit" name ="filter" value="'.__('Filter').'" />
174
  </div>';
175
  }
45
  case 'date' :
46
  return $this->format_event_date($item->start_date, $item->end_date, $item->time);
47
  case 'details' :
48
+ return '<div>'.$this->db->truncate(80, $item->details).'</div>';
49
  case 'pub_user' :
50
  return get_userdata($item->pub_user)->user_login;
51
  case 'pub_date' :
170
  $out .= $this->filterbar->show_years('?page=el_admin_main', $this->args, 'dropdown', 'admin');
171
  $out .= $this->filterbar->show_cats('?page=el_admin_main', $this->args, 'dropdown', 'admin');
172
  $out .= '
173
+ <input type="hidden" name="noheader" value="true" />
174
  <input id="event-query-submit" class="button" type="submit" name ="filter" value="'.__('Filter').'" />
175
  </div>';
176
  }
admin/js/admin_main.js CHANGED
@@ -3,6 +3,6 @@
3
  // Confirmation for event deletion
4
  function eventlist_deleteEvent (id) {
5
  if (confirm("Are you sure you want to delete this event from you the database? This is a permanent action.")) {
6
- document.location.href = "?page=el_admin_main&id=" + id + "&action=delete";
7
  }
8
- }
3
  // Confirmation for event deletion
4
  function eventlist_deleteEvent (id) {
5
  if (confirm("Are you sure you want to delete this event from you the database? This is a permanent action.")) {
6
+ document.location.href = "?page=el_admin_main&id=" + id + "&action=delete&noheader=true";
7
  }
8
+ }
event-list.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Event List
4
  Plugin URI: http://wordpress.org/extend/plugins/event-list/
5
  Description: Manage your events and show them in a list view on your site.
6
- Version: 0.6.0
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
@@ -56,7 +56,6 @@ class Event_List {
56
  if($options->get('el_enable_feed')) {
57
  include_once(EL_PATH.'includes/feed.php');
58
  $feed = EL_Feed::get_instance();
59
- //echo $feed->create_events_feed();
60
  }
61
 
62
  // ADMIN PAGE:
3
  Plugin Name: Event List
4
  Plugin URI: http://wordpress.org/extend/plugins/event-list/
5
  Description: Manage your events and show them in a list view on your site.
6
+ Version: 0.6.1
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
56
  if($options->get('el_enable_feed')) {
57
  include_once(EL_PATH.'includes/feed.php');
58
  $feed = EL_Feed::get_instance();
 
59
  }
60
 
61
  // ADMIN PAGE:
includes/js/filterbar.js CHANGED
@@ -17,7 +17,7 @@ function updateUrlParameter(url, paramName, paramVal, sc_id) {
17
  var newParams = "";
18
  var seperator = "?";
19
  var paramNameAdded = false;
20
- if(null != oldParams.length) {
21
  urlArray = oldParams.split("&");
22
  for(i=0; i<urlArray.length; i++) {
23
  if(urlArray[i].split("=")[0] == "event_id"+sc_id) {
17
  var newParams = "";
18
  var seperator = "?";
19
  var paramNameAdded = false;
20
+ if(null != oldParams) {
21
  urlArray = oldParams.split("&");
22
  for(i=0; i<urlArray.length; i++) {
23
  if(urlArray[i].split("=")[0] == "event_id"+sc_id) {
includes/widget.php CHANGED
@@ -257,7 +257,9 @@ class EL_Widget extends WP_Widget {
257
  // required change of cat_filter in version 0.6.0 (can be removed in 0.7.0)
258
  if(isset($instance['cat_filter']) && 'none' === $instance['cat_filter']) {
259
  if($on_frontpage) {
260
- echo '<p style="color:red"><strong>Please visit widget admin page and press "Save" to perform the required widget updates (required due to changes in new plugin version) !</strong></p>';
 
 
261
  }
262
  else {
263
  echo '<p style="color:red"><strong>Press "Save" to perform the required widget updates (required due to changes in new plugin version) !</strong></p>';
257
  // required change of cat_filter in version 0.6.0 (can be removed in 0.7.0)
258
  if(isset($instance['cat_filter']) && 'none' === $instance['cat_filter']) {
259
  if($on_frontpage) {
260
+ if(current_user_can('edit_theme_options')) {
261
+ echo '<p style="color:red"><strong>Please visit widget admin page (Appearance -> Widgets) and press "Save" to perform the required widget updates (required due to changes in new plugin version) !</strong></p>';
262
+ }
263
  }
264
  else {
265
  echo '<p style="color:red"><strong>Press "Save" to perform the required widget updates (required due to changes in new plugin version) !</strong></p>';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, filter, admin, attribute, widget, sidebar, feed, rss
5
  Requires at least: 3.3
6
  Tested up to: 3.8
7
- Stable tag: 0.6.0
8
  Plugin URI: http://wordpress.org/extend/plugins/event-list
9
  Licence: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -71,6 +71,13 @@ Another possibility would be to call the wordpress function "do_shortcode()".
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
74
  = 0.6.0 (2013-12-31) =
75
  * added adjustment options for the filterbar (shortcode attribute "filterbar_items")
76
  * added "All" and "Past" options to years filter in filterbar
4
  Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, filter, admin, attribute, widget, sidebar, feed, rss
5
  Requires at least: 3.3
6
  Tested up to: 3.8
7
+ Stable tag: 0.6.1
8
  Plugin URI: http://wordpress.org/extend/plugins/event-list
9
  Licence: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
71
 
72
  == Changelog ==
73
 
74
+ = 0.6.1 (2013-01-03) =
75
+ * fixed redirect issue in admin event table
76
+ * fixed a bug in filterbar javascript
77
+ * fixed a problem with wrong format of deatails in admin event table
78
+ * changed button text for event update from "Publish" to "Update"
79
+ * show required manual widget update message on the frontpage only to users with required privileges
80
+
81
  = 0.6.0 (2013-12-31) =
82
  * added adjustment options for the filterbar (shortcode attribute "filterbar_items")
83
  * added "All" and "Past" options to years filter in filterbar