Changeset 507146
- Timestamp:
- 02/19/2012 01:02:29 AM (14 years ago)
- File:
-
- 1 edited
-
token-manager/trunk/tokens.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
token-manager/trunk/tokens.php
r506738 r507146 85 85 //get the number of records in the database table 86 86 $pagination_count = 0; 87 $startid = 0; 88 $endid = 0; 87 89 if(!empty($filt)) 88 90 { 91 $startid = $wpdb->get_var($wpdb->prepare("SELECT a.id 92 FROM $tablename1 a 93 LEFT JOIN $tablename2 b ON a.typeid = b.id 94 LEFT JOIN $tablename3 c ON a.authorid = c.ID 95 WHERE a.active = 1 AND b.active = 1 AND a.siteid='$siteid' AND a.blogid='$blogid' order by a.processorder DESC LIMIT 1")); 96 97 $endid = $wpdb->get_var($wpdb->prepare("SELECT a.id 98 FROM $tablename1 a 99 LEFT JOIN $tablename2 b ON a.typeid = b.id 100 LEFT JOIN $tablename3 c ON a.authorid = c.ID 101 WHERE a.active = 1 AND b.active = 1 AND a.siteid='$siteid' AND a.blogid='$blogid' order by a.processorder ASC LIMIT 1")); 102 89 103 $pagination_count = $wpdb->get_var($wpdb->prepare("SELECT count(*) 90 104 FROM $tablename1 a … … 95 109 else 96 110 { 111 $startid = $wpdb->get_var($wpdb->prepare("SELECT a.id 112 FROM $tablename1 a 113 LEFT JOIN $tablename2 b ON a.typeid = b.id 114 LEFT JOIN $tablename3 c ON a.authorid = c.ID 115 WHERE a.active = 1 AND b.active = 1 AND a.siteid='$siteid' AND a.blogid='$blogid' order by a.processorder DESC LIMIT 1")); 116 117 $endid = $wpdb->get_var($wpdb->prepare("SELECT a.id 118 FROM $tablename1 a 119 LEFT JOIN $tablename2 b ON a.typeid = b.id 120 LEFT JOIN $tablename3 c ON a.authorid = c.ID 121 WHERE a.active = 1 AND b.active = 1 AND a.siteid='$siteid' AND a.blogid='$blogid' order by a.processorder ASC LIMIT 1")); 122 97 123 $pagination_count = $wpdb->get_var($wpdb->prepare("SELECT count(*) 98 124 FROM $tablename1 a … … 109 135 $list_start = $paging->get_rangestart()-1; 110 136 $results = $paging->render('Find Token') . '<table class="widefat"> 111 <thead><tr><th></th><th></th><th></th><th></th><th></th><th> Token ID</th><th>Token Name</th><th>Token Type</th><th></th><th></th></tr></thead>112 <tfoot><tr><th></th><th></th><th></th><th></th><th></th><th> Token ID</th><th>Token Name</th><th>Token Type</th><th></th><th></th></tr></tfoot><tbody>';137 <thead><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th>Order</th><th>Token ID</th><th>Token Name</th><th>Token Type</th><th></th><th></th></tr></thead> 138 <tfoot><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th>Order</th><th>Token ID</th><th>Token Name</th><th>Token Type</th><th></th><th></th></tr></tfoot><tbody>'; 113 139 114 140 if(!empty($filt)) 115 141 { 116 $items = $wpdb->get_results("SELECT a.id as id, a. tokenname as tokenname, a.frontpage as frontpage, a.allpages as allpages, b.tokentype as tokentype, FROM_UNIXTIME(a.datecreated) as datecreated,142 $items = $wpdb->get_results("SELECT a.id as id, a.processorder as processorder, a.tokenname as tokenname, a.frontpage as frontpage, a.allpages as allpages, b.tokentype as tokentype, FROM_UNIXTIME(a.datecreated) as datecreated, 117 143 FROM_UNIXTIME(a.lastupdated) as lastupdated, a.description as description, c.user_login as author, a.authorid as authorid, a.version as version 118 144 FROM $tablename1 a … … 120 146 LEFT JOIN $tablename3 c ON a.authorid = c.ID 121 147 WHERE a.active = 1 AND b.active = 1 AND a.siteid='$siteid' AND a.blogid='$blogid' $filt 122 ORDER BY a. datecreatedDESC LIMIT $list_start, $list_end");148 ORDER BY a.processorder DESC LIMIT $list_start, $list_end"); 123 149 } 124 150 else 125 151 { 126 $items = $wpdb->get_results("SELECT a.id as id, a. tokenname as tokenname, a.frontpage as frontpage, a.allpages as allpages, b.tokentype as tokentype, FROM_UNIXTIME(a.datecreated) as datecreated,152 $items = $wpdb->get_results("SELECT a.id as id, a.processorder as processorder, a.tokenname as tokenname, a.frontpage as frontpage, a.allpages as allpages, b.tokentype as tokentype, FROM_UNIXTIME(a.datecreated) as datecreated, 127 153 FROM_UNIXTIME(a.lastupdated) as lastupdated, a.description as description, c.user_login as author, a.authorid as authorid, a.version as version 128 154 FROM $tablename1 a … … 130 156 LEFT JOIN $tablename3 c ON a.authorid = c.ID 131 157 WHERE a.active = 1 AND b.active = 1 AND a.siteid='$siteid' AND a.blogid='$blogid' 132 ORDER BY a. datecreatedDESC LIMIT $list_start, $list_end");158 ORDER BY a.processorder DESC LIMIT $list_start, $list_end"); 133 159 } 134 160 … … 140 166 $alttext = ($alt) ? 'alternate' : ''; 141 167 $id = $item->id; 168 $processorder = $item->processorder; 142 169 $tokenname = '{' . $item->tokenname . '}'; 143 170 $tokentype = $item->tokentype; … … 148 175 $authorid = $item->authorid; 149 176 $version = $item->version; 177 $moveup = ($id!=$startid) ? "<td style=\"width: 16px; cursor: pointer;\"><a href=\"javascript:void(0);\" onclick=\"moveup($id);\"><img src=\"" . plugin_dir_url( __FILE__ ) . "icons/up.png\" alt=\"Process Token After\" title=\"Process Token After\" /></a></td>" : "<td style=\"width: 16px;\"></td>"; 178 $movedown = ($id!=$endid) ? "<td style=\"width: 16px; cursor: pointer;\"><a href=\"javascript:void(0);\" onclick=\"movedown($id);\"><img src=\"" . plugin_dir_url( __FILE__ ) . "icons/down.png\" alt=\"Process Token Before\" title=\"Process Token Before\" /></a></td>" : "<td style=\"width: 16px;\"></td>"; 150 179 $results .= "<tr class=\"" . $alttext . "\"> 180 $moveup 181 $movedown 151 182 <td style=\"width: 16px; cursor: pointer;\"><a href=\"admin.php?page=tokenmanageredit&tid=$id\"><img src=\"" . plugin_dir_url( __FILE__ ) . "icons/edit.png\" alt=\"Edit Token ($id)\" title=\"Edit Token ($id)\" /></a></td> 152 183 <td style=\"width: 16px;\"><img src=\"" . plugin_dir_url( __FILE__ ) . "icons/stats.png\" alt=\"Date Created: $datecreated | Last Updated: $lastupdated\" title=\"Date Created: $datecreated | Last Updated: $lastupdated\" /></td> … … 154 185 <td style=\"width: 16px;\"><img src=\"" . plugin_dir_url( __FILE__ ) . "icons/description.png\" alt=\"$description\" title=\"$description\" /></td> 155 186 <td style=\"width: 16px; cursor: pointer;\"><a href=\"javascript:void(0);\" onclick=\"loadpopup($id);\"><img src=\"" . plugin_dir_url( __FILE__ ) . "icons/pages.png\" alt=\"Attached Pages\" title=\"Attached Pages\" /></a></td> 187 <td style=\"width: 85px;\">$processorder</td> 156 188 <td style=\"width: 85px;\">$id</td> 157 189 <td>$tokenname</td> … … 311 343 document.getElementById('tokenid').value=id; 312 344 document.getElementById('myfrom').submit(); 345 } 346 } 347 348 function moveup(tid) 349 { 350 if(tid) 351 { 352 var a = new System.Net.Ajax.Request("POST","admin.php?page=tokenmanagerjson", pocb, true); 353 a.AddParam("json","moveup"); 354 a.AddParam("tid",tid); 355 var b = new System.Net.Ajax.PageRequests(a); 356 var c = new System.Net.Ajax.Connection(b); 357 c.Open(); 358 } 359 } 360 361 function movedown(tid) 362 { 363 if(tid) 364 { 365 var a = new System.Net.Ajax.Request("POST","admin.php?page=tokenmanagerjson", pocb, true); 366 a.AddParam("json","movedown"); 367 a.AddParam("tid",tid); 368 var b = new System.Net.Ajax.PageRequests(a); 369 var c = new System.Net.Ajax.Connection(b); 370 c.Open(); 371 } 372 } 373 374 function pocb(src) 375 { 376 if(src.ReadyState==4 && src.Status==200) 377 { 378 window.location.href=window.location.href; 313 379 } 314 380 }
Note: See TracChangeset
for help on using the changeset viewer.