mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Media-Manager Issue #3200 Work in Progress. Local video-file browser.
This commit is contained in:
@@ -1077,17 +1077,31 @@ 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->youtubeTab($parm);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
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']));
|
$parm = array('search' => $tp->filter($_GET['search']));
|
||||||
echo $this->videoTab($parm);
|
echo $this->videoTab($parm);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->getAction() == 'glyph')
|
if($this->getAction() === 'audio')
|
||||||
{
|
{
|
||||||
$parm = array('search' => $tp->filter($_GET['search']));
|
$parm = array('search' => $tp->filter($_GET['search']));
|
||||||
echo $this->glyphTab($parm);
|
echo $this->audioTab($parm);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1315,7 +1329,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
if($type === 'video')
|
if($type === 'video')
|
||||||
{
|
{
|
||||||
$tabs = array(
|
$tabs = array(
|
||||||
'youtube' => array('caption'=>'Youtube', 'text' => $this->videoTab())
|
'youtube' => array('caption'=>'Youtube', 'text' => $this->youtubeTab())
|
||||||
);
|
);
|
||||||
|
|
||||||
return $frm->tabs($tabs, array('class'=>'media-manager'));
|
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 = array();
|
||||||
$options['bbcode'] = ($this->getQuery('bbcode')=='img') ? 'img' : FALSE;
|
$options['bbcode'] = ($this->getQuery('bbcode')=='img') ? 'img' : FALSE;
|
||||||
@@ -1344,7 +1358,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
}
|
}
|
||||||
else
|
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')
|
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')
|
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 .= "<div class='row-fluid'>";
|
||||||
$text .= $this->videoTab();
|
$text .= $this->youtubeTab();
|
||||||
$text .= "</div>";
|
$text .= "</div>";
|
||||||
// $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;
|
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=array())
|
||||||
function glyphTab($parm='')
|
|
||||||
{
|
{
|
||||||
|
|
||||||
$parms = array(
|
$parms = array(
|
||||||
@@ -1664,9 +1762,6 @@ class media_admin_ui extends e_admin_ui
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!empty($parm['search']))
|
if(!empty($parm['search']))
|
||||||
{
|
{
|
||||||
$filtered = array();
|
$filtered = array();
|
||||||
@@ -1726,7 +1821,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
* @see https://www.googleapis.com/youtube/v3/search
|
* @see https://www.googleapis.com/youtube/v3/search
|
||||||
*/
|
*/
|
||||||
function videoTab($parm='')
|
function youtubeTab($parm='')
|
||||||
{
|
{
|
||||||
$apiKey = e107::pref('core','youtube_apikey');
|
$apiKey = e107::pref('core','youtube_apikey');
|
||||||
|
|
||||||
|
@@ -411,7 +411,28 @@ class e_file
|
|||||||
|
|
||||||
if(empty($finfo['mime'])) // last resort.
|
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
|
* Return an array of Images in a particular category
|
||||||
* @param string $cat : category name. use + to include _common eg. 'news+'
|
* @param string $cat : category name. use + to include _common eg. 'news+'
|
||||||
@@ -1265,29 +1270,66 @@ class e_media
|
|||||||
$close = (E107_DEBUG_LEVEL > 0) ? "" : " data-close='true' "; //
|
$close = (E107_DEBUG_LEVEL > 0) ? "" : " data-close='true' "; //
|
||||||
$select = (E107_DEBUG_LEVEL > 0) ? '' : " e-dialog-save e-dialog-close";
|
$select = (E107_DEBUG_LEVEL > 0) ? '' : " e-dialog-save e-dialog-close";
|
||||||
|
|
||||||
|
$text = "\n\n<!-- Start Item -->
|
||||||
|
|
||||||
|
<div class='media-carousel ".$data['gridClass']."'>
|
||||||
|
|
||||||
$text = "\n\n<!-- Start Item -->\n<div class='media-carousel ".$data['gridClass']."'>
|
<div class='well clearfix'>\n";
|
||||||
|
|
||||||
<div class='well clearfix'>
|
$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='#' >";
|
||||||
|
|
||||||
<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'])
|
||||||
|
|
||||||
if($data['type'] == 'image')
|
|
||||||
{
|
{
|
||||||
$text .= '<img class="img-responsive img-fluid" alt="" src="'.$data['thumbUrl'].'" style="width:100%;display:inline-block" />';
|
case "video":
|
||||||
}
|
$mime = vartrue($data['mime'],"video/mp4");
|
||||||
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 .= '<video width="'.$data['width'].'" height="'.$data['height'].'" controls >
|
||||||
{
|
<source src="'.$data['thumbUrl'].'" type="'.$mime.'">
|
||||||
$text .= "\n<div><small class='media-carousel-item-caption'>".$data['title']."</small></div>";
|
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>
|
$text .= "</div>
|
||||||
|
|
||||||
</div>\n<!-- End Item -->\n\n";
|
</div>\n<!-- End Item -->\n\n";
|
||||||
@@ -1453,7 +1495,6 @@ class e_media
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$val['width'] = $parm['width'];
|
$val['width'] = $parm['width'];
|
||||||
$val['height'] = $parm['height'];
|
$val['height'] = $parm['height'];
|
||||||
$val['id'] = $parm['id'];
|
$val['id'] = $parm['id'];
|
||||||
|
Reference in New Issue
Block a user