1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Media-Manager enhancements

This commit is contained in:
CaMer0n
2012-04-29 11:15:44 +00:00
parent c48a85fb77
commit 607b5a84d9
2 changed files with 37 additions and 21 deletions

View File

@@ -397,13 +397,12 @@ class media_admin_ui extends e_admin_ui
<legend>Library</legend> <legend>Library</legend>
<table cellpadding='0' cellspacing='0' class='adminedit'> <table cellpadding='0' cellspacing='0' class='adminedit'>
<tbody><tr><td> <tbody><tr><td>
<div>Filter: <input type='text' name='non-working-filter-example' value='' /><br />&nbsp;</div> ";
<div>";
// This should really be replaced with the generic LIST function, but with it's own template for markup. // 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 .= e107::getMedia()->mediaSelect($this->getQuery('for'),$this->getQuery('tagid')); // eg. news, news-thumbnail
$text .= "</div> $text .= "
</td></tr> </td></tr>
</tbody></table> </tbody></table>
</fieldset> </fieldset>

View File

@@ -334,45 +334,58 @@ class e_media
public function mediaSelect($cat='',$tagid=null,$att=null) public function mediaSelect($cat='',$tagid=null,$att=null)
{ {
$onclick = null; $onclick = null; // option to override onclick behavior. See ibrowser.php
$cat = ($cat) ? $cat."+" : ""; $cat = ($cat) ? $cat."+" : ""; // the '+' loads category '_common' as well as the chosen category.
parse_str($att);
$images = $this->getImages($cat,0,30); parse_str($att); // grab 'onclick' .
$att = 'aw=120&ah=100';
// $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 .= "<div>Filter: <input type='text' name='non-working-filter-example' value='' />";
$text .= "<input type='button' value='Go' /> "; // Manual filter, if onkeyup ajax fails for some reason.
$text .= "<input type='button' value='&laquo;' />"; // see previous page of images.
$text .= "<input type='button' value='&raquo;' />"; // see next page of images.
$text .= " Displaying 0-30 of 150 images.<br />&nbsp; </div>
<div>\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.document.getElementById('".$prevId."').src = '".e_IMAGE_ABS."generic/blank.gif';
parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close();
return false;"; return false;";
$text .= "<a class='media-select-clear' style='float:left' href='#' onclick=\"{$onclick_clear}\" > $text .= "<a class='media-select-clear' style='float:left' href='#' onclick=\"{$onclick_clear}\" >
<div style='display:block;border:1px solid silver;padding-top:40px;text-align:center;vertical-align:middle;width:120px;height:58px'> <div style='display:block;border:1px solid silver;padding-top:40px;text-align:center;vertical-align:middle;width:120px;height:58px'>
No Image</div>"; No Image</div>";
}
$srch = array("{MEDIA_URL}","{MEDIA_PATH}"); $srch = array("{MEDIA_URL}","{MEDIA_PATH}");
foreach($images as $im) foreach($images as $im)
{ {
$media_path = e107::getParser()->replaceConstants($im['media_url'],'full'); $media_path = e107::getParser()->replaceConstants($im['media_url'],'full');
$realPath = e107::getParser()->thumbUrl($im['media_url'], $att); $realPath = e107::getParser()->thumbUrl($im['media_url'], $att);
$diz = e107::getParser()->toAttribute($im['media_title']); $diz = e107::getParser()->toAttribute($im['media_title']);
$repl = array($im['media_url'],$media_path);
$repl = array($im['media_url'],$media_path); if($onclick == null) // e107 Media Manager
if($onclick == null)
{ {
$onclicki = "parent.document.getElementById('{$tagid}').value = '{$im['media_url']}'; $onclicki = "parent.document.getElementById('{$tagid}').value = '{$im['media_url']}';
parent.document.getElementById('".$prevId."').src = '{$realPath}'; parent.document.getElementById('".$prevId."').src = '{$realPath}';
parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close();
return false;"; return false;";
} }
else else // TinyMce and other applications.
{ {
$onclicki = str_replace($srch,$repl,$onclick); $onclicki = str_replace($srch,$repl,$onclick);
} }
@@ -384,6 +397,10 @@ class e_media
} }
$text .= "</div>";
return $text; return $text;
} }