mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
MediaPicker fixes.
This commit is contained in:
parent
891b5f044e
commit
acfaf2df8e
@ -931,66 +931,6 @@ class media_admin_ui extends e_admin_ui
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
".IMALAN_1."
|
||||
</td>
|
||||
<td>
|
||||
<div class='auto-toggle-area autocheck'>
|
||||
".$frm->checkbox('image_post', 1, $pref['image_post'])."
|
||||
<div class='field-help'>".IMALAN_2."</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
".IMALAN_10."
|
||||
</td>
|
||||
<td>
|
||||
".r_userclass('image_post_class',$pref['image_post_class'],"off","public,guest,nobody,member,admin,main,classes")."
|
||||
<div class='field-help'>".IMALAN_11."</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
".IMALAN_12."
|
||||
</td>
|
||||
<td>
|
||||
".$frm->select_open('image_post_disabled_method')."
|
||||
".$frm->option(IMALAN_14, '0', ($pref['image_post_disabled_method'] == "0"))."
|
||||
".$frm->option(IMALAN_15, '1', ($pref['image_post_disabled_method'] == "1"))."
|
||||
".$frm->select_close()."
|
||||
<div class='field-help'>".IMALAN_13."</div>
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
list($img_import_w,$img_import_h) = explode("x",$pref['img_import_resize']);
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".IMALAN_105."<div class='label-note'>".IMALAN_106."</div></td>
|
||||
<td>
|
||||
".$frm->text('img_import_resize_w', $img_import_w,4)."px X ".$frm->text('img_import_resize_h', $img_import_h,4)."px
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".IMALAN_3."<div class='label-note'>".IMALAN_54." {$gd_version}</div></td>
|
||||
<td>
|
||||
".$frm->select_open('resize_method')."
|
||||
".$frm->option('gd1', 'gd1', ($pref['resize_method'] == "gd1"))."
|
||||
".$frm->option('gd2', 'gd2', ($pref['resize_method'] == "gd2"))."
|
||||
".$frm->option('ImageMagick', 'ImageMagick', ($pref['resize_method'] == "ImageMagick"))."
|
||||
".$frm->select_close()."
|
||||
<div class='field-help'>".IMALAN_4."</div>
|
||||
</td>
|
||||
</tr>";
|
||||
*/
|
||||
protected $cats = array();
|
||||
protected $owner = array();
|
||||
protected $ownercats = array();
|
||||
@ -1071,18 +1011,60 @@ class media_admin_ui extends e_admin_ui
|
||||
e107::getCache()->clearAll('image');
|
||||
|
||||
// print_a($_GET);
|
||||
if(e_AJAX_REQUEST)
|
||||
{
|
||||
$parm = array('search' => $tp->filter($_GET['search']));
|
||||
|
||||
switch($this->getAction())
|
||||
{
|
||||
case "youtube":
|
||||
echo $this->youtubeTab($parm);
|
||||
break;
|
||||
|
||||
case "glyph":
|
||||
echo $this->glyphTab($parm);
|
||||
break;
|
||||
|
||||
case "icon":
|
||||
echo $this->iconTab($parm);
|
||||
break;
|
||||
|
||||
case "image2":
|
||||
$cat = $tp->filter($_GET['for']);
|
||||
echo $this->imageTab2($cat,$parm);
|
||||
break;
|
||||
|
||||
|
||||
case "video":
|
||||
$cat = $tp->filter($_GET['for']);
|
||||
echo $this->videoTab($cat, $parm);
|
||||
break;
|
||||
|
||||
case "audio":
|
||||
$cat = $tp->filter($_GET['for']);
|
||||
echo $this->audioTab($cat, $parm);
|
||||
break;
|
||||
|
||||
default:
|
||||
// code to be executed if n is different from all labels;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
if($this->getAction() === 'youtube')
|
||||
{
|
||||
$parm = array('search' => $tp->filter($_GET['search']));
|
||||
|
||||
echo $this->youtubeTab($parm);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->getAction() === 'glyph')
|
||||
{
|
||||
$parm = array('search' => $tp->filter($_GET['search']));
|
||||
echo $this->glyphTab($parm);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->getAction() === 'glyph')
|
||||
{
|
||||
@ -1115,7 +1097,7 @@ class media_admin_ui extends e_admin_ui
|
||||
echo $this->imageTab2($cat,$parm);
|
||||
exit;
|
||||
}
|
||||
|
||||
*/
|
||||
if($this->getAction() == 'nav' )
|
||||
{
|
||||
//echo $this->navPage();\
|
||||
@ -1392,19 +1374,17 @@ class media_admin_ui extends e_admin_ui
|
||||
$cat = $this->getQuery('for');
|
||||
|
||||
$tabOptions = array(
|
||||
'core-media-icons' => array('caption'=> $tp->toGlyph('fa-file-photo-o').IMALAN_72, 'method' => 'iconTab' ),
|
||||
'core-media-icon' => array('caption'=> $tp->toGlyph('fa-file-photo-o').IMALAN_72, 'method' => 'iconTab' ),
|
||||
'core-media-image' => array('caption'=> $tp->toGlyph('fa-file-photo-o').ADLAN_105, 'method' => 'imageTab2' ),
|
||||
'core-media-video' => array('caption'=> $tp->toGlyph('fa-file-video-o').IMALAN_163, 'method' => 'videoTab'),
|
||||
'core-media-audio' => array('caption'=> $tp->toGlyph('fa-file-audio-o')."Audio", 'method' => 'audioTab'),
|
||||
'core-media-youtube' => array('caption'=> $tp->toGlyph('fa-youtube-play')."Youtube", 'method' => 'youtubeTab' ),
|
||||
'core-media-glyphs' => array('caption'=> $tp->toGlyph('fa-flag')."Glyphs", 'method' => 'glyphTab'),
|
||||
'core-media-glyph' => array('caption'=> $tp->toGlyph('fa-flag')."Glyphs", 'method' => 'glyphTab'),
|
||||
);
|
||||
|
||||
if(!empty($options['bbcode']))
|
||||
{
|
||||
$tabOptions['core-media-img'] = $tabOptions['core-media-image'];
|
||||
$tabOptions['core-media-glyph'] = $tabOptions['core-media-glyphs'];
|
||||
|
||||
}
|
||||
|
||||
$tabs = array();
|
||||
@ -1486,7 +1466,7 @@ class media_admin_ui extends e_admin_ui
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->getQuery('bbcode') == 'glyphs')
|
||||
if($this->getQuery('bbcode') == 'glyph')
|
||||
{
|
||||
$glyphActive = 'active';
|
||||
}
|
||||
@ -1511,7 +1491,7 @@ class media_admin_ui extends e_admin_ui
|
||||
}
|
||||
|
||||
|
||||
if($this->getQuery('glyphs') == 1 || $this->getQuery('bbcode') == 'glyph')
|
||||
if($this->getQuery('glyph') == 1 || $this->getQuery('bbcode') == 'glyph')
|
||||
{
|
||||
$text .= "<li class='{$glyphActive}'><a data-toggle='tab' href='#core-media-glyphs'>"."Glyphs</a></li>\n";
|
||||
}
|
||||
@ -1591,7 +1571,7 @@ class media_admin_ui extends e_admin_ui
|
||||
$text .= "</div>";
|
||||
}*/
|
||||
|
||||
if($this->getQuery('glyphs') == 1 || $this->getQuery('bbcode') == 'glyph')
|
||||
if($this->getQuery('glyph') == 1 || $this->getQuery('bbcode') == 'glyph')
|
||||
{
|
||||
$text .= "<div class='tab-pane clearfix {$glyphActive}' id='core-media-glyphs'>";
|
||||
$text .= $this->glyphTab();
|
||||
@ -1749,7 +1729,7 @@ class media_admin_ui extends e_admin_ui
|
||||
}
|
||||
|
||||
|
||||
private function iconTab($category='',$option=array())
|
||||
private function iconTab($option=array())
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
@ -1759,7 +1739,7 @@ class media_admin_ui extends e_admin_ui
|
||||
'type' =>'icon', // how should it be rendered?
|
||||
'category' => $category,
|
||||
'tagid' => $this->getQuery('tagid'),
|
||||
'action' =>'icons', // Used by AJAX to identify correct function.
|
||||
'action' =>'icon', // Used by AJAX to identify correct function.
|
||||
'perPage' => 80,
|
||||
'gridClass' => 'media-carousel-item-glyph pull-left',
|
||||
'bbcode' => 'image',
|
||||
@ -2832,12 +2812,6 @@ class media_admin_ui extends e_admin_ui
|
||||
// $ns->tablerender(LAN_MEDIAMANAGER." :: ".IMALAN_18, $mes->render().$text);
|
||||
}
|
||||
|
||||
function iconsTab()
|
||||
{
|
||||
// $this->icon_editor();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Invoked just before item create event
|
||||
@ -3536,20 +3510,6 @@ e107::getAdminUI()->runPage();
|
||||
$action = e_QUERY;
|
||||
|
||||
|
||||
if(varset($_GET['action']) == "icons")
|
||||
{
|
||||
// icon_editor();
|
||||
}
|
||||
|
||||
if(varset($_GET['action']) == "avatars")
|
||||
{
|
||||
// show_avatars();
|
||||
}
|
||||
|
||||
if(varset($_GET['action']) == 'settings')
|
||||
{
|
||||
// main_config();
|
||||
}
|
||||
/*
|
||||
* DELETE CHECKED AVATARS - SHOW AVATAR SCREEN
|
||||
*/
|
||||
|
@ -976,29 +976,45 @@ class e_form
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Internal Function used by imagepicker, filepicker, mediapicker()
|
||||
*/
|
||||
* @param string $category
|
||||
* @param string $label
|
||||
* @param string $tagid
|
||||
* @param null $extras
|
||||
* @return string
|
||||
*/
|
||||
private function mediaUrl($category = '', $label = '', $tagid='', $extras=null)
|
||||
{
|
||||
|
||||
$cat = ($category) ? '&for='.urlencode($category) : "";
|
||||
if(!$label) $label = ' Upload an image or file';
|
||||
if($tagid) $cat .= '&tagid='.$tagid;
|
||||
|
||||
if(is_string($extras))
|
||||
{
|
||||
parse_str($extras,$extras);
|
||||
}
|
||||
|
||||
if(vartrue($extras['bbcode'])) $cat .= '&bbcode=1';
|
||||
$mode = vartrue($extras['mode'],'main');
|
||||
$action = vartrue($extras['action'],'dialog');
|
||||
// $tabs // TODO - option to choose which tabs to display.
|
||||
|
||||
//TODO Parse selection data back to parent form.
|
||||
|
||||
$cat = ($category) ? '&for='.urlencode($category) : "";
|
||||
$mode = vartrue($extras['mode'],'main');
|
||||
$action = vartrue($extras['action'],'dialog');
|
||||
|
||||
if(empty($label))
|
||||
{
|
||||
$label = ' Upload an image or file';
|
||||
}
|
||||
|
||||
// TODO - option to choose which tabs to display by default.
|
||||
|
||||
$url = e_ADMIN_ABS."image.php?mode={$mode}&action={$action}".$cat;
|
||||
|
||||
if(!empty($tagid))
|
||||
{
|
||||
$url .= '&tagid='.$tagid;
|
||||
}
|
||||
|
||||
if(!empty($extras['bbcode']))
|
||||
{
|
||||
$url .= '&bbcode=1';
|
||||
}
|
||||
|
||||
$url .= "&iframe=1";
|
||||
|
||||
if(vartrue($extras['w']))
|
||||
@ -1011,14 +1027,14 @@ class e_form
|
||||
$url .= "&image=1";
|
||||
}
|
||||
|
||||
if(!empty($extras['glyphs']))
|
||||
if(!empty($extras['glyphs']) || !empty($extras['glyph']))
|
||||
{
|
||||
$url .= "&glyphs=1";
|
||||
$url .= "&glyph=1";
|
||||
}
|
||||
|
||||
if(!empty($extras['icons']))
|
||||
if(!empty($extras['icons']) || !empty($extras['icon']))
|
||||
{
|
||||
$url .= "&icons=1";
|
||||
$url .= "&icon=1";
|
||||
}
|
||||
|
||||
if(!empty($extras['youtube']))
|
||||
@ -1036,8 +1052,6 @@ class e_form
|
||||
$url .= "&audio=1";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!empty($extras['path']) && $extras['path'] == 'plugin')
|
||||
{
|
||||
$url .= "&path=".deftrue('e_CURRENT_PLUGIN');
|
||||
@ -1056,37 +1070,13 @@ class e_form
|
||||
$class = !empty($extras['class']) ? $extras['class']." " : '';
|
||||
$title = !empty($extras['title']) ? $extras['title'] : $title;
|
||||
|
||||
|
||||
// $ret = "<a title=\"{$title}\" rel='external' class='e-dialog' href='".$url."'>".$label."</a>"; // using colorXXXbox.
|
||||
$ret = "<a title=\"{$title}\" class='".$class."e-modal' data-modal-caption='".LAN_EFORM_007."' data-cache='false' data-target='#uiModal' href='".$url."'>".$label."</a>"; // using bootstrap.
|
||||
|
||||
|
||||
// $footer = "<div style=\'padding:5px;text-align:center\' <a href=\'#\' >Save</a></div>";
|
||||
$footer = '';
|
||||
if(!e107::getRegistry('core/form/mediaurl'))
|
||||
{
|
||||
/*
|
||||
e107::js('core','core/admin.js','prototype');
|
||||
e107::js('core','core/dialog.js','prototype');
|
||||
e107::js('core','core/draggable.js','prototype');
|
||||
e107::css('core','core/dialog/dialog.css','prototype');
|
||||
e107::css('core','core/dialog/e107/e107.css','prototype');
|
||||
e107::js('footer-inline','
|
||||
$$("a.e-dialog").invoke("observe", "click", function(ev) {
|
||||
var element = ev.findElement("a");
|
||||
ev.stop();
|
||||
new e107Widgets.URLDialog(element.href, {
|
||||
id: element["id"] || "e-dialog",
|
||||
width: 890,
|
||||
height: 680
|
||||
|
||||
}).center().setHeader("Media Manager : '.$category.'").setFooter('.$footer.').activate().show();
|
||||
});
|
||||
|
||||
','prototype');
|
||||
*/
|
||||
e107::setRegistry('core/form/mediaurl', true);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -1394,13 +1384,16 @@ class e_form
|
||||
* @param string $name input name
|
||||
* @param string $default default value
|
||||
* @param string $parms shortcode parameters
|
||||
* --- SC Parameter list ---
|
||||
* --- $parms list ---
|
||||
* - media: if present - load from media category table
|
||||
* - w: preview width in pixels
|
||||
* - h: preview height in pixels
|
||||
* - help: tooltip
|
||||
* - video: when set to true, will enable the Youtube (video) tab.
|
||||
* @example $frm->imagepicker('banner_image', $_POST['banner_image'], '', 'banner'); // all images from category 'banner_image' + common images.
|
||||
* - youtube=1 (Enables the Youtube tab)
|
||||
* - image=1 (Enable the Images tab)
|
||||
* - video=1 (Enable the Video tab)
|
||||
* - audio=1 (Enable the Audio tab)
|
||||
* - glyph=1 (Enable the Glyphs tab).
|
||||
* @example $frm->imagepicker('banner_image', $_POST['banner_image'], '', 'media=banner&w=600');
|
||||
* @return string html output
|
||||
*/
|
||||
@ -5238,6 +5231,11 @@ class e_form
|
||||
return $tp->toImage($value, $thparms);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'media':
|
||||
return e107::getMedia()->previewTag($value, $parms);
|
||||
break;
|
||||
|
||||
case 'files':
|
||||
$ret = '<ol>';
|
||||
@ -5877,6 +5875,28 @@ class e_form
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/** Generic Media Pick for combinations of images, audio, video, glyphs, files, etc. Field Type = json */
|
||||
case 'media':
|
||||
|
||||
if(!deftrue('e_DEBUG_MEDIAPICKER'))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$max = varset($parms['max'],1);
|
||||
|
||||
$ret = '';
|
||||
for ($i=0; $i < $max; $i++)
|
||||
{
|
||||
$k = $key.'['.$i.'][path]';
|
||||
$ival = $value[$i]['path'];
|
||||
|
||||
$ret .= $this->mediapicker($k, $ival, $parms);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
break;
|
||||
|
||||
case 'files':
|
||||
|
||||
|
@ -502,9 +502,9 @@ class e_media
|
||||
{
|
||||
$catArray[] = $cat;
|
||||
|
||||
if($type === 'image')
|
||||
if($type === 'image' || $type === 'audio'|| $type === 'video')
|
||||
{
|
||||
$catArray[] = $cat.'_image'; // BC Fix.
|
||||
$catArray[] = $cat.'_'.$type; // BC Fix.
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1370,7 +1370,7 @@ class e_media
|
||||
$class = varset($data['class'],'');
|
||||
$dataPreview = !empty($data['previewHtml']) ? base64_encode($data['previewHtml']) : '';
|
||||
|
||||
$linkTag = "<a data-toggle='context' class='e-media-select e-tip".$select." ".$class."' ".$close." data-id='".$data['id']."' data-width='".$data['width']."' data-height='".$data['height']."' data-src='".$data['previewUrl']."' data-type='".$data['type']."' data-bbcode='".$data['bbcode']."' data-target='".$data['tagid']."' data-path='".$data['saveValue']."' data-preview='".$data['previewUrl']."' data-preview-html='".$dataPreview."' title=\"".$data['title']."\" style='".$style."' href='#' >";
|
||||
$linkTag = "<a data-toggle='context' class='e-media-select ".$select." ".$class."' ".$close." data-id='".$data['id']."' data-width='".$data['width']."' data-height='".$data['height']."' data-src='".$data['previewUrl']."' data-type='".$data['type']."' data-bbcode='".$data['bbcode']."' data-target='".$data['tagid']."' data-path='".$data['saveValue']."' data-preview='".$data['previewUrl']."' data-preview-html='".$dataPreview."' title=\"".$data['title']."\" style='".$style."' href='#' >";
|
||||
|
||||
return $linkTag;
|
||||
|
||||
|
@ -267,7 +267,7 @@ td.right, th.right { text-align:right }
|
||||
|
||||
/* media picker New in v2.1.9 */
|
||||
#media-browser-container-glyph,
|
||||
#media-browser-container-icons { margin-left: 15px }
|
||||
#media-browser-container-icon { margin-left: 15px }
|
||||
|
||||
.media-carousel-item-image .well { height: 200px; overflow:hidden }
|
||||
.media-carousel-item-image span { display:block; height:150px; text-align: center; }
|
||||
@ -281,6 +281,9 @@ td.right, th.right { text-align:right }
|
||||
.media-carousel-item-container video,
|
||||
.media-carousel-item-container audio { width: 100% }
|
||||
.media-carousel-item-glyph { width: 64px; height:64px; overflow:hidden; margin-right:5px; margin-bottom:5px }
|
||||
.media-carousel-item-glyph .media-carousel-item-container { min-height:64px; height:64px}
|
||||
.media-carousel-item-glyph a { height: 100%; display: block; }
|
||||
|
||||
|
||||
.mediaselector-preview { height: 140px; overflow: hidden }
|
||||
.mediaselector-preview img,
|
||||
@ -294,10 +297,10 @@ td.right, th.right { text-align:right }
|
||||
|
||||
.mediaselector-container .overlay { position: absolute; bottom: 5px; text-align: right; display: block; width: 100%; right: 5px; }
|
||||
|
||||
.mediaselector-container-icons { height: 64px; margin:0; }
|
||||
.mediaselector-container-icons .overlay { top:0; left:0; }
|
||||
.mediaselector-container-icons .overlay span { width:64px; height:64px; display:block; }
|
||||
.mediaselector-container-icons .mediaselector-preview { height: auto; padding: 0; text-align: center; }
|
||||
.mediaselector-container-icon { height: 64px; margin:0; }
|
||||
.mediaselector-container-icon .overlay { top:0; left:0; }
|
||||
.mediaselector-container-icon .overlay span { width:64px; height:64px; display:block; }
|
||||
.mediaselector-container-icon .mediaselector-preview { height: auto; padding: 0; text-align: center; }
|
||||
|
||||
/* dropzone new in v2.1.9 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user