From 0b19510ad38afc0ab78e3a48a06a5d1c39ad47b3 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 22 Mar 2013 16:55:22 -0700 Subject: [PATCH] Closes Issue #147 - modal from main Media-Manager page. --- e107_admin/header.php | 2 +- e107_admin/image.php | 5 ++++ e107_handlers/media_class.php | 47 ++++++++++++++++++----------------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/e107_admin/header.php b/e107_admin/header.php index 7b7598e4c..95285581b 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -448,7 +448,7 @@ echo getModal(); if(e_PAGE == "image.php") { - return; + // return; } diff --git a/e107_admin/image.php b/e107_admin/image.php index 7ba30c7c2..bdfb48778 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -56,6 +56,11 @@ if(vartrue($_GET['action']) == 'nav' && e_AJAX_REQUEST) //XXX Doesn't work corre $bbcodeMode .= "&from=".intval($_GET['from']); } + if($_GET['w']) + { + $bbcodeMode .= "&w=".intval($_GET['w']); + } + $bbcodeMode .= "&nav=1"; $tag = ($bbcodeMode===false) ? false : $_GET['tagid']; // eg. news, news-thumbnail diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 75226818f..e3f48caf3 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -467,11 +467,8 @@ class e_media /** * Generate Simple Thumbnail window for image -selection - * TODO Use Whole-page popup window - * TODO Add an upload Tab?. - * TODO Real-time ajax filter by keyword */ - public function imageSelect($cat,$formid='imageSel') + private function imageSelect($cat,$formid='imageSel') { $sql = e107::getDb(); $tp = e107::getParser(); @@ -505,20 +502,23 @@ class e_media } - public function mediaSelectNav($category,$att) + private function mediaSelectNav($category, $tagid='', $option=null) { - parse_str($att,$option); + if(is_string($option)) + { + parse_str($option,$option); + } - $cat = varset($category) ? '&for='.$category : ""; + $cat = varset($category) ? '&for='.$category : ""; + $cat .= varset($tagid) ? '&tagid='.$tagid : ""; - // if(!$label) $label = ' Upload an image or file'; - if(varset($option['tagid'])) $cat .= '&tagid='.$option['tagid']; - if(varset($option['bbcode'])) $cat .= '&bbcode='.$option['bbcode']; + $cat .= varset($option['bbcode']) ? '&bbcode='.$option['bbcode'] : ""; + $cat .= varset($option['limit']) ? "&limit=".$option['limit'] : ""; + $cat .= varset($option['frm']) ? "&frm=".$option['frm'] : ""; + $cat .= varset($option['w']) ? "&w=".$option['w'] : ""; + + $url = e_ADMIN_ABS."image.php?mode=main&action=nav&iframe=1".$cat."&from=0"; - $cat .= varset($option['limit']) ? "&limit=".$option['limit'] : ""; - $cat .= varset($option['frm']) ? "&frm=".$option['frm'] : ""; - - $url = e_ADMIN_ABS."image.php?mode=main&action=nav&iframe=1".$cat; return $url; } @@ -571,23 +571,26 @@ class e_media $prevId = $tagid."_prev"; // ID of image in Form. $thumbAtt = 'aw=120&ah=100'; // Thumbnail of the Media-Manager Preview. + // EXAMPLE of FILTER GUI. $text = ""; $dipTotal = (($frm + $limit) < $total) ? ($frm + $limit) : $total; if($navMode === false) { - + // $data_src = $this->mediaSelectNav($category,$tagid, "bbcode=".$bbcode)."&from=0"; + $data_src = $this->mediaSelectNav($category,$tagid, $option); // ."&from=0"; + // Inline style to override jquery-ui stuff. $text .= "
- + "; // $text .= " "; // Manual filter, if onkeyup ajax fails for some reason. - $text .= ""; // Manual filter, if onkeyup ajax fails for some reason. + $text .= ""; // Manual filter, if onkeyup ajax fails for some reason. - $text .= " "; // see next page of images. + $text .= " "; // see next page of images. - $text .= ""; // see next page of images. + $text .= ""; // see next page of images. $text .= "
"; $text .= " @@ -623,7 +626,7 @@ class e_media } - +// print_a($option); $tp = e107::getParser(); @@ -641,9 +644,7 @@ class e_media $w = ($dbWidth > 400) ? 400 : intval($dbWidth); // $w = vartrue($w,0); // $h = vartrue($w,0); - - - + $class = ($category !='_icon') ? "media-select-image" : "media-select-icon"; $media_path = ($w || $h) ? $tp->thumbUrl($im['media_url'], "&w={$w}") : $tp->thumbUrl($im['media_url']); // $tp->replaceConstants($im['media_url'],'full'); // max-size