Changeset 2798476
- Timestamp:
- 10/13/2022 06:42:43 PM (3 years ago)
- Location:
- stafflist/trunk
- Files:
-
- 4 edited
-
readme.txt (modified) (1 diff)
-
stafflist.js (modified) (1 diff)
-
stafflist.php (modified) (8 diffs)
-
stafflist_admin.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
stafflist/trunk/readme.txt
r2718709 r2798476 103 103 104 104 == Changelog == 105 = 3.1.9 = 106 * Added a new shortcode attribute `sort=n`, where n is the column to be use for sorting when StaffList is first rendered (Your website visitors may still change the sort as they please afterward). Hover the column names in the admin page to reference column numbers that can be used. Per request by @jorniel1 (Thank you); 107 108 = 3.1.8 = 109 * Rewrote a $wpdb->prepare statement that was producing a WP deprecated warning; 105 110 106 111 = 3.1.7 = -
stafflist/trunk/stafflist.js
r2458455 r2798476 63 63 var data = { action: 'ajax_build', 64 64 wait: wait, 65 sort: form.find("input[rel='sl_sort']").val(), 65 66 rows: form.find("input[rel='sl_rows']").val() } 66 67 -
stafflist/trunk/stafflist.php
r2718709 r2798476 4 4 Plugin URI: http://wordpress.org/plugins/stafflist/ 5 5 Description: A super simplified staff directory tool 6 Version: 3.1. 76 Version: 3.1.9 7 7 Author: era404 8 8 Author URI: http://www.era404.com … … 233 233 } else { 234 234 $w = false; 235 $where = " ";236 $params = array( );235 $where = "WHERE 1=%d"; 236 $params = array(1); 237 237 } 238 238 … … 263 263 You can insert the StaffList directory into any WordPress page or post using the shortcode:<br /> 264 264 <tt>[stafflist]</tt><br /> 265 If you wish to change the default number of rows from {$rows} per page, use the shortcode attribute:<br /> 266 <tt style='color:#0073AA; font-weight:bold;'>[stafflist <span>rows=50</span>]</tt><br /> 267 If you wish to use just a subset of records, use the shortcode attribute:<br /> 265 If you wish to change the default number of rows from {$rows} per page, use the shortcode <strong>rows</strong> attribute:<br /> 266 <tt style='color:#0073AA; font-weight:bold;'>[stafflist <span>rows=50</span>]</tt><br /> 267 To specify the initial sort column, hover the column names below to find its number, and use it in the shortcode <strong>sort</strong> attribute:<br /> 268 <tt style='color:#0073AA; font-weight:bold;'>[stafflist <span>sort=4</span>]</tt><br /> 269 If you wish to use just a subset of records, use the shortcode <strong>subset</strong> attribute:<br /> 268 270 <tt style='color:#0073AA; font-weight:bold;'>[stafflist <span>subset="department:marketing"</span>]</tt><br /> 269 If you have a column in your StaffList called "Building" and wish to show records from Building A and Building B, use:<br />271 If you have a column in your StaffList called "Building" and wish to show only records from Building A and Building B, use:<br /> 270 272 <tt style='color:#0073AA; font-weight:bold;'>[stafflist <span>subset="building:a|b"</span>]</tt><br /> 271 273 Searches are performed as you type and when the enter key is pressed. 272 If you wish to limit this function to just enter (or just type), use:<br />274 To limit this function to just enter (or just type), use:<br /> 273 275 <tt style='color:#0073AA; font-weight:bold;'>[stafflist <span>on="enter"</span>]</tt> or 274 276 <tt style='color:#0073AA; font-weight:bold;'>[stafflist <span>on="type"</span>]</tt><br /> … … 295 297 <table id='stafflists' style='border:1px solid #E8E8E8;'>"; 296 298 echo "<thead id='stafflisthead'><tr> 297 <th><a href='{$stafflisturl}&s=last' title='Sort by Last Name A-Z' class='sort_a ".($s=='last'?'selected':'')."'><span>Ascending</span></a> Last Name 299 <th><a href='{$stafflisturl}&s=last' title='Sort by Last Name A-Z' class='sort_a ".($s=='last'?'selected':'')."'><span>Ascending</span></a> 300 <a title='For initial sort by Last Name, use "sort=1" in your shortcode.'>Last Name</a> 298 301 <a href='{$stafflisturl}&s=last-' title='Sort by Last Name Z-A' class='sort_d ".($s=='last-'?'selected':'')."'><span>Descending</span></a> 299 302 </th><th> </th> 300 <th><a href='{$stafflisturl}&s=first' title='Sort by First Name Ascending' class='sort_a ".($s=='first'?'selected':'')."'><span>Ascending</span></a> First Name 303 <th><a href='{$stafflisturl}&s=first' title='Sort by First Name Ascending' class='sort_a ".($s=='first'?'selected':'')."'><span>Ascending</span></a> 304 <a title='For initial sort by First Name, use "sort=2" in your shortcode.'>First Name</a> 301 305 <a href='{$stafflisturl}&s=first-' title='Sort by First Name Descending' class='sort_d ".($s=='first-'?'selected':'')."'><span>Descending</span></a> 302 306 </th><th> </th> 303 <th><a href='{$stafflisturl}&s=dept' title='Sort by Department Ascending' class='sort_a ".($s=='dept'?'selected':'')."'><span>Ascending</span></a> Department 307 <th><a href='{$stafflisturl}&s=dept' title='Sort by Department Ascending' class='sort_a ".($s=='dept'?'selected':'')."'><span>Ascending</span></a> 308 <a title='For initial sort by Department, use "sort=3" in your shortcode.'>Department</a> 304 309 <a href='{$stafflisturl}&s=dept-' title='Sort by Department Descending' class='sort_d ".($s=='dept-'?'selected':'')."'><span>Descending</span></a> 305 310 </th><th> </th> 306 <th><a href='{$stafflisturl}&s=email' title='Sort by Email Address Ascending' class='sort_a ".($s=='email'?'selected':'')."'><span>Ascending</span></a> Email Address 311 <th><a href='{$stafflisturl}&s=email' title='Sort by Email Address Ascending' class='sort_a ".($s=='email'?'selected':'')."'><span>Ascending</span></a> 312 <a title='For initial sort by Email Address, use "sort=4" in your shortcode.'>Email Address 307 313 <a href='{$stafflisturl}&s=email-' title='Sort by Email Address Descending' class='sort_d ".($s=='email-'?'selected':'')."'><span>Descending</span></a> 308 314 </th><th> </th> … … 315 321 $del = "<a href='".wp_nonce_url("{$stafflisturl}&remove={$v['id']}&p={$p}&s={$s}")."' class='remove' 316 322 onclick='javascript:if(!confirm(\"Are you sure you want to delete this staff record?\")) return false;' 317 title='Permanently Delete This Staff Record' target='_self' 318 /></a>"; 323 title='Permanently Delete This Staff Record' target='_self'></a>"; 319 324 $i++; 320 325 … … 950 955 $active = 0; 951 956 foreach($nonstd as $k=>$col) { 952 echo "<th>{$col['name']}</th><th> </th>"; 957 echo "\n\t\t\t<th>\n". 958 "\t\t\t\t<a title='For initial sort by ".esc_attr($col['name']).", use "sort={$col['id']}" in your shortcode.'>{$col['name']}</a>\n". 959 "\t\t\t</th>\n\t\t\t<th> </th>"; 953 960 $active++; 954 961 } … … 1218 1225 1219 1226 //default sort 1220 if(!$sort = $wpdb->get_var("SELECT id FROM {$staffmetadb} WHERE active>0 ORDER BY colpos ASC LIMIT 1")) $sort = 1; 1227 if(isset($atts['sort']) && 1228 is_numeric($atts['sort']) && 1229 $wpdb->get_var($wpdb->prepare("SELECT active FROM {$staffmetadb} WHERE id=%d", (int) $atts['sort']))==1){ 1230 $sort = (int) $atts['sort']; //shortcode sort=# 1231 } elseif(!$sort = $wpdb->get_var("SELECT id FROM {$staffmetadb} WHERE active>0 ORDER BY colpos ASC LIMIT 1")){ 1232 $sort = 1; 1233 } 1221 1234 //number of results rows 1222 1235 if(isset($atts['rows']) && is_numeric($atts['rows']) && $atts['rows'] > 0 && $atts['rows'] <= 100) $rows = $atts['rows']; … … 1225 1238 //search on 1226 1239 if(isset($atts['on']) && in_array($atts['on'],array("enter","type","wait"))) $on=$atts['on']; 1240 1227 1241 //custom messaging 1228 1242 $searchdir = get_option("stafflist_rename_searchdir"); //use custom message, if set -
stafflist/trunk/stafflist_admin.css
r2550014 r2798476 103 103 background-color: #cfcfcf; 104 104 font-weight: bold; 105 cursor: pointer; 106 } 107 #stafflisthead tr th a { 108 cursor: pointer; 105 109 } 106 110 tr.row {
Note: See TracChangeset
for help on using the changeset viewer.