mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
Media-Manager Issue #3200 Work in Progress. Local video-file browser.
This commit is contained in:
parent
bac96528fc
commit
bb7f8717fa
@ -1077,19 +1077,33 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
|
||||
|
||||
if($this->getAction() == 'youtube')
|
||||
if($this->getAction() === 'youtube')
|
||||
{
|
||||
$parm = array('search' => $tp->filter($_GET['search']));
|
||||
echo $this->videoTab($parm);
|
||||
echo $this->youtubeTab($parm);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->getAction() == 'glyph')
|
||||
if($this->getAction() === 'glyph')
|
||||
{
|
||||
$parm = array('search' => $tp->filter($_GET['search']));
|
||||
echo $this->glyphTab($parm);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->getAction() === 'video')
|
||||
{
|
||||
$parm = array('search' => $tp->filter($_GET['search']));
|
||||
echo $this->videoTab($parm);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->getAction() === 'audio')
|
||||
{
|
||||
$parm = array('search' => $tp->filter($_GET['search']));
|
||||
echo $this->audioTab($parm);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->getAction() == 'nav' )
|
||||
{
|
||||
@ -1315,7 +1329,7 @@ class media_admin_ui extends e_admin_ui
|
||||
if($type === 'video')
|
||||
{
|
||||
$tabs = array(
|
||||
'youtube' => array('caption'=>'Youtube', 'text' => $this->videoTab())
|
||||
'youtube' => array('caption'=>'Youtube', 'text' => $this->youtubeTab())
|
||||
);
|
||||
|
||||
return $frm->tabs($tabs, array('class'=>'media-manager'));
|
||||
@ -1324,7 +1338,7 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
|
||||
|
||||
$videoActive = 'inactive';
|
||||
$youtubeActive = 'inactive';
|
||||
|
||||
$options = array();
|
||||
$options['bbcode'] = ($this->getQuery('bbcode')=='img') ? 'img' : FALSE;
|
||||
@ -1344,7 +1358,7 @@ class media_admin_ui extends e_admin_ui
|
||||
}
|
||||
else
|
||||
{
|
||||
$videoActive = 'active';
|
||||
$youtubeActive = 'active';
|
||||
}
|
||||
|
||||
|
||||
@ -1367,7 +1381,12 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
if($this->getQuery('video') == 1 || $this->getQuery('bbcode') == 'video')
|
||||
{
|
||||
$text .= "<li class='{$videoActive}'><a data-toggle='tab' href='#core-media-video'>Youtube</a></li>\n";
|
||||
$text .= "<li class='{$youtubeActive}'><a data-toggle='tab' href='#core-media-youtube'>Youtube</a></li>\n";
|
||||
|
||||
if(deftrue('e_DEBUG_VIDEO'))
|
||||
{
|
||||
$text .= "<li class='{$videoActive}'><a data-toggle='tab' href='#core-media-video'>Videos</a></li>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1496,15 +1515,33 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
if($this->getQuery('video') || $this->getQuery('bbcode') == 'video')
|
||||
{
|
||||
$text .= "<div class='tab-pane clearfix {$videoActive}' id='core-media-video' >";
|
||||
$text .= "<div class='tab-pane clearfix {$youtubeActive}' id='core-media-youtube' >";
|
||||
// $text .= "<div class='row-fluid'>";
|
||||
$text .= $this->videoTab();
|
||||
$text .= "</div>";
|
||||
// $text .= "</div>";
|
||||
$text .= $this->youtubeTab();
|
||||
$text .= "</div>";
|
||||
|
||||
if(deftrue('e_DEBUG_VIDEO'))
|
||||
{
|
||||
$text .= "<div class='tab-pane clearfix {$videoActive}' id='core-media-video' >";
|
||||
// $text .= "<div class='row-fluid'>";
|
||||
$text .= $this->videoTab();
|
||||
$text .= "</div>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// todo
|
||||
if($this->getQuery('audio') || $this->getQuery('bbcode') == 'audio')
|
||||
{
|
||||
if(deftrue('e_DEBUG_AUDIO'))
|
||||
{
|
||||
$text .= "<div class='tab-pane clearfix {$videoActive}' id='core-media-audio' >";
|
||||
// $text .= "<div class='row-fluid'>";
|
||||
$text .= $this->audioTab();
|
||||
$text .= "</div>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1566,13 +1603,74 @@ class media_admin_ui extends e_admin_ui
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
function audioTab($parm=array())
|
||||
{
|
||||
//todo (@see videoTab)
|
||||
|
||||
}
|
||||
|
||||
|
||||
function videoTab($parm=array())
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$parms = array(
|
||||
'width' => 340,
|
||||
'height' => 220,
|
||||
'type' =>'video',
|
||||
'tagid' => $this->getQuery('tagid'),
|
||||
'action' =>'video', // Used by AJAX to identify correct function.
|
||||
'perPage' => 12,
|
||||
'gridClass' => 'media-carousel-item-video pull-left',
|
||||
'bbcode' => 'video',
|
||||
'close' => 'true'
|
||||
|
||||
);
|
||||
|
||||
$items = array();
|
||||
|
||||
$videos = e107::getMedia()->getVideos();
|
||||
|
||||
foreach($videos as $val)
|
||||
{
|
||||
$items[] = array(
|
||||
'previewUrl' => e_IMAGE_ABS."generic/playlist_120.png", //todo place entire video tag into imagepicker when saving.
|
||||
'saveValue' => $val['media_url'],
|
||||
'thumbUrl' => $tp->replaceConstants($val['media_url']),
|
||||
'title' => $val['media_name'],
|
||||
'slideCaption' => '',
|
||||
'slideCategory' => 'bootstrap',
|
||||
'mime' => $val['media_type']
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(!empty($parm['search']))
|
||||
{
|
||||
$filtered = array();
|
||||
if(!empty($items))
|
||||
{
|
||||
foreach($items as $v)
|
||||
{
|
||||
if(strpos($v['title'], $parm['search'])!==false)
|
||||
{
|
||||
$filtered[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
$items = $filtered;
|
||||
}
|
||||
|
||||
return e107::getMedia()->browserCarousel($items, $parms);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function glyphTab($parm='')
|
||||
function glyphTab($parm=array())
|
||||
{
|
||||
|
||||
$parms = array(
|
||||
@ -1663,9 +1761,6 @@ class media_admin_ui extends e_admin_ui
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(!empty($parm['search']))
|
||||
{
|
||||
@ -1726,7 +1821,7 @@ class media_admin_ui extends e_admin_ui
|
||||
* @return mixed|string
|
||||
* @see https://www.googleapis.com/youtube/v3/search
|
||||
*/
|
||||
function videoTab($parm='')
|
||||
function youtubeTab($parm='')
|
||||
{
|
||||
$apiKey = e107::pref('core','youtube_apikey');
|
||||
|
||||
@ -2691,7 +2786,7 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
$default = $this->getFileXml($f['fname']);
|
||||
$f = $fl->cleanFileName($f,true);
|
||||
|
||||
|
||||
$c = md5($f['path'].$f['fname']);
|
||||
|
||||
if($f['error'])
|
||||
|
@ -411,7 +411,28 @@ class e_file
|
||||
|
||||
if(empty($finfo['mime'])) // last resort.
|
||||
{
|
||||
$finfo['mime'] = 'application/'.$finfo['pathinfo']['extension'];
|
||||
switch($finfo['pathinfo']['extension'])
|
||||
{
|
||||
case "mp3":
|
||||
$finfo['mime'] = 'audio/mpeg';
|
||||
break;
|
||||
|
||||
case "ogg":
|
||||
$finfo['mime'] = 'audio/ogg';
|
||||
break;
|
||||
|
||||
case "mp4":
|
||||
$finfo['mime'] = 'video/mp4';
|
||||
break;
|
||||
|
||||
case "3gp":
|
||||
$finfo['mime'] = 'video/3gpp';
|
||||
break;
|
||||
|
||||
default:
|
||||
$finfo['mime'] = 'application/'.$finfo['pathinfo']['extension'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -431,6 +431,11 @@ class e_media
|
||||
}
|
||||
|
||||
|
||||
public function getVideos($from=0, $amount = null, $search = null)
|
||||
{
|
||||
return $this->getImages('_common_video', $from, $amount, $search);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of Images in a particular category
|
||||
* @param string $cat : category name. use + to include _common eg. 'news+'
|
||||
@ -1265,28 +1270,65 @@ class e_media
|
||||
$close = (E107_DEBUG_LEVEL > 0) ? "" : " data-close='true' "; //
|
||||
$select = (E107_DEBUG_LEVEL > 0) ? '' : " e-dialog-save e-dialog-close";
|
||||
|
||||
|
||||
|
||||
$text = "\n\n<!-- Start Item -->\n<div class='media-carousel ".$data['gridClass']."'>
|
||||
$text = "\n\n<!-- Start Item -->
|
||||
|
||||
<div class='well clearfix'>
|
||||
|
||||
<a data-toggle='context' class='e-media-select e-tip".$select."' ".$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']."' title=\"".$data['title']."\" style='float:left' href='#' >";
|
||||
<div class='media-carousel ".$data['gridClass']."'>
|
||||
|
||||
if($data['type'] == 'image')
|
||||
<div class='well clearfix'>\n";
|
||||
|
||||
$linkTag = "<a data-toggle='context' class='e-media-select e-tip".$select."' ".$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']."' title=\"".$data['title']."\" style='float:left' href='#' >";
|
||||
|
||||
switch($data['type'])
|
||||
{
|
||||
$text .= '<img class="img-responsive img-fluid" alt="" src="'.$data['thumbUrl'].'" style="width:100%;display:inline-block" />';
|
||||
}
|
||||
elseif($data['type'] == 'glyph')
|
||||
{
|
||||
$text .= "\n<span style='margin:7px;display:inline-block;color: inherit'>".$tp->toGlyph($data['thumbUrl'],false)."</span>";
|
||||
}
|
||||
$text .= "\n</a>\n\n";
|
||||
|
||||
if($data['type'] == 'image')
|
||||
{
|
||||
$text .= "\n<div><small class='media-carousel-item-caption'>".$data['title']."</small></div>";
|
||||
case "video":
|
||||
$mime = vartrue($data['mime'],"video/mp4");
|
||||
|
||||
$text .= '<video width="'.$data['width'].'" height="'.$data['height'].'" controls >
|
||||
<source src="'.$data['thumbUrl'].'" type="'.$mime.'">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
<div class="clearfix" style="text-align:center">';
|
||||
|
||||
$text .= $linkTag;
|
||||
$text .= "\n".$data['title'];
|
||||
$text .= "\n</a></div>\n\n";
|
||||
break;
|
||||
|
||||
case "audio":
|
||||
$mime = vartrue($data['mime'],"audio/mpeg");
|
||||
$text .= '<audio controls>
|
||||
<source src="'.$data['thumbUrl'].'" type="'.$mime.'">
|
||||
|
||||
Your browser does not support the audio tag.
|
||||
</audio>
|
||||
<div class="clearfix" style="text-align:center">';
|
||||
|
||||
$text .= $linkTag;
|
||||
$text .= "\n".$data['title'];
|
||||
$text .= "\n</a></div>\n\n";
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "image":
|
||||
$text .= $linkTag;
|
||||
$text .= '<img class="img-responsive img-fluid" alt="" src="'.$data['thumbUrl'].'" style="width:100%;display:inline-block" />';
|
||||
$text .= "\n</a>\n\n";
|
||||
$text .= "\n<div><small class='media-carousel-item-caption'>".$data['title']."</small></div>";
|
||||
break;
|
||||
|
||||
|
||||
case "glyph":
|
||||
$text .= $linkTag;
|
||||
$text .= "\n<span style='margin:7px;display:inline-block;color: inherit'>".$tp->toGlyph($data['thumbUrl'],false)."</span>";
|
||||
$text .= "\n</a>\n\n";
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
// code to be executed if n is different from all labels;
|
||||
}
|
||||
|
||||
|
||||
$text .= "</div>
|
||||
|
||||
@ -1453,7 +1495,6 @@ class e_media
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$val['width'] = $parm['width'];
|
||||
$val['height'] = $parm['height'];
|
||||
$val['id'] = $parm['id'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user