From 607b5a84d92f6eea9757e57f05dab27a060fa02b Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Sun, 29 Apr 2012 11:15:44 +0000 Subject: [PATCH] Media-Manager enhancements --- e107_admin/image.php | 5 ++-- e107_handlers/media_class.php | 53 +++++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/e107_admin/image.php b/e107_admin/image.php index 987bcdd50..c56bf027b 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -397,13 +397,12 @@ class media_admin_ui extends e_admin_ui Library
-
Filter:
 
-
"; + "; // This should really be replaced with the generic LIST function, but with it's own template for markup. $text .= e107::getMedia()->mediaSelect($this->getQuery('for'),$this->getQuery('tagid')); // eg. news, news-thumbnail - $text .= "
+ $text .= "
diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 04cf95760..12b301551 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -334,45 +334,58 @@ class e_media public function mediaSelect($cat='',$tagid=null,$att=null) { - $onclick = null; + $onclick = null; // option to override onclick behavior. See ibrowser.php - $cat = ($cat) ? $cat."+" : ""; - parse_str($att); + $cat = ($cat) ? $cat."+" : ""; // the '+' loads category '_common' as well as the chosen category. - $images = $this->getImages($cat,0,30); - $att = 'aw=120&ah=100'; + parse_str($att); // grab 'onclick' . + // $total_images = $this->getImages($cat); // for use by next/prev in filter at some point. + $images = $this->getImages($cat,0,30); + $att = 'aw=120&ah=100'; + $prevId = $tagid."_prev"; + + // EXAMPLE of FILTER GUI. + // This filter should run independently of admin_ui so that it can also be utilized by ibrowser.php + $text .= "
Filter: "; + $text .= " "; // Manual filter, if onkeyup ajax fails for some reason. + $text .= ""; // see previous page of images. + $text .= ""; // see next page of images. + $text .= " Displaying 0-30 of 150 images.
 
+
\n"; - $prevId = $tagid."_prev"; - $onclick_clear = "parent.document.getElementById('{$tagid}').value = ''; + if($onclick == null) // e107 Media Manager Only. TinyMce doesn't need it. + { + $onclick_clear = "parent.document.getElementById('{$tagid}').value = ''; parent.document.getElementById('".$prevId."').src = '".e_IMAGE_ABS."generic/blank.gif'; parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); return false;"; - - $text .= " -
- No Image
"; + + $text .= "
+
+ No Image
"; + } + $srch = array("{MEDIA_URL}","{MEDIA_PATH}"); foreach($images as $im) { - $media_path = e107::getParser()->replaceConstants($im['media_url'],'full'); - $realPath = e107::getParser()->thumbUrl($im['media_url'], $att); - $diz = e107::getParser()->toAttribute($im['media_title']); + $media_path = e107::getParser()->replaceConstants($im['media_url'],'full'); + $realPath = e107::getParser()->thumbUrl($im['media_url'], $att); + $diz = e107::getParser()->toAttribute($im['media_title']); + $repl = array($im['media_url'],$media_path); - $repl = array($im['media_url'],$media_path); - - if($onclick == null) + if($onclick == null) // e107 Media Manager { $onclicki = "parent.document.getElementById('{$tagid}').value = '{$im['media_url']}'; parent.document.getElementById('".$prevId."').src = '{$realPath}'; parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); return false;"; } - else + else // TinyMce and other applications. { $onclicki = str_replace($srch,$repl,$onclick); } @@ -384,6 +397,10 @@ class e_media } + + + + $text .= "
"; return $text; }