X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl-cms.git;a=blobdiff_plain;f=admin_pages.php;h=9c7f56aa224e9b3d22ed410ff71e7a6f2405a122;hp=07368794fd7fffb52700eb600241c5eaec159427;hb=40e5acacf037bc97c69e25aeae2bfbf14f77c7ec;hpb=c7671fecb940a35a72483dcd2eb40fa8ebce3a8b diff --git a/admin_pages.php b/admin_pages.php index 0736879..9c7f56a 100644 --- a/admin_pages.php +++ b/admin_pages.php @@ -1,13 +1,10 @@ '' . $id, + 'thumb' => $parts[3], + 'image' => $parts[0], + 'image_width' => (int)$parts[1], + 'image_height' => (int)$parts[2], + 'sizes' => $row['sizes'], + 'name' => $row['name'], + 'caption' => $row['caption'] + ]; + $id += 1; + } unset($row); } - return $images; + return $out; } function admin_pages_main_listing() { - $listing_rows = db_get_assocs('cms_pages', 'id,filename,coalesce(nullif(nav_title,\'\'), title) as title', 'order by concat(nav_title,title)'); - tem_set('listings', $listing_rows); + $data = array(); + $desc = ''; + $sort = _REQUEST_cut('sort'); + if ($sort && substr($sort, 0, 1) === '-') { + $sort = substr($sort, 1); + $desc = ' DESC '; + } else { + $data["sorting-by-$sort"] = '-'; + } + $legal_sorts = explode(',', ADMIN_PAGES_DB_FIELDS); + if (!$sort || !in_array($sort, $legal_sorts)) { + $sort = 'filename'; + } + + $data['rows'] = db_get_assocs('cms_pages', 'id,coalesce(nullif(nav_title,\'\'), title) as title,filename', "order by $sort $desc limit 1000"); + tem_set('listing', $data); } function admin_pages_main_form($id = false) { @@ -98,6 +120,7 @@ function admin_pages_main_form($id = false) { tem_set('id', $id); } + tem_set('$basename', 'admin_pages'); $navbar_options = array(array('ignored', 'Not at all'), array('0', 'First')); $rows = db_get_rows('cms_pages', 'id,coalesce(nullif(nav_title,\'\'), title) as title,navbar', 'where navbar != 0 order by navbar'); @@ -148,7 +171,7 @@ function admin_pages_main_form($id = false) { $data = array('filename' => format_cms_filename($_REQUEST['new_filename'])); } - tem_set('wfpl_images', admin_pages_get_images()); + tem_set('wfpl_images_json', json_encode(admin_pages_get_images())); tem_set('form', $data); tem_set('$head'); # wysiwyg init goes in }