mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Issue #4049 - Media-Manager Url fix. Fixed Media Preview.
Admin-ui: type='media' example added to blank plugin.
This commit is contained in:
@@ -715,70 +715,75 @@ class media_form_ui extends e_admin_form_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function media_preview($curVal, $mode, $attributes, $id=null)
|
private function getMediaType()
|
||||||
{
|
{
|
||||||
|
list($type,$extra) = explode("/",$this->getController()->getFieldVar('media_type'));
|
||||||
$attributes['type'] = 'image';
|
$category = $this->getController()->getFieldVar('media_category');
|
||||||
|
if(strpos($category, '_icon') === 0)
|
||||||
switch($mode)
|
|
||||||
{
|
{
|
||||||
case 'read':
|
$type = 'icon';
|
||||||
if($this->getController()->getAction() === 'grid')
|
|
||||||
{
|
|
||||||
$tp = e107::getParser();
|
|
||||||
$img = $this->getController()->getFieldVar('media_url');
|
|
||||||
$size = 400;
|
|
||||||
return $tp->toImage($img, array('w'=>$size,'h'=>$size, 'crop'=>1));
|
|
||||||
}
|
|
||||||
|
|
||||||
$attributes['readParms'] = 'thumb=60&thumb_urlraw=0&thumb_aw=60';
|
|
||||||
$val = $this->getController()->getListModel()->get('media_url');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'write':
|
|
||||||
$attributes['readParms'] = 'thumb=180&thumb_urlraw=0&thumb_aw=180';
|
|
||||||
$val = $this->getController()->getModel()->get('media_url');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'filter':
|
|
||||||
case 'batch':
|
|
||||||
return '';
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->renderValue('media_preview', $val, $attributes, $id);
|
return $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
function media_preview($curVal, $mode, $attributes, $id=null)
|
||||||
|
{
|
||||||
|
if($mode == 'filter' || $mode === 'batch' || $mode == 'inline')
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$attributes['type'] = 'image';
|
||||||
|
$value = $this->getController()->getFieldVar('media_url');
|
||||||
|
$type = $this->getMediaType();
|
||||||
|
|
||||||
|
if($this->getController()->getAction() === 'grid')
|
||||||
|
{
|
||||||
|
$size = 250;
|
||||||
|
return "<div style='min-height:250px'>".e107::getMedia()->previewTag($value, array('type'=>$type, 'w'=>250, 'h'=>$size, 'crop'=>1))."</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$size = ($mode === 'write') ? 400 : 180;
|
||||||
|
|
||||||
|
return e107::getMedia()->previewTag($value, array('type'=>$type, 'w'=>$size, 'h'=>$size));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function media_sef($curVal, $mode, $attributes, $id=null)
|
function media_sef($curVal, $mode, $attributes, $id=null)
|
||||||
{
|
{
|
||||||
|
if($mode == 'filter' || $mode == 'batch')
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$val = $this->getController()->getFieldVar('media_url');
|
$val = $this->getController()->getFieldVar('media_url');
|
||||||
|
$type = $this->getMediaType();
|
||||||
|
|
||||||
$parm = array('w'=>800);
|
|
||||||
$path = e107::getParser()->thumbUrl($val,$parm);
|
|
||||||
|
|
||||||
$base = '';
|
|
||||||
switch($mode)
|
switch($type)
|
||||||
{
|
{
|
||||||
/* case 'read':
|
case "label1":
|
||||||
return ltrim($path, e_HTTP);
|
// code
|
||||||
break;*/
|
break;
|
||||||
|
|
||||||
case 'read':
|
case "audio":
|
||||||
case 'write':
|
case "icon":
|
||||||
// $attributes['readParms'] = 'thumb=180&thumb_urlraw=0&thumb_aw=180';
|
$path = e107::getParser()->replaceConstants($val, 'abs');
|
||||||
// $val = $this->getController()->getModel()->get('media_url');
|
break;
|
||||||
$url = SITEURLBASE.$path;
|
|
||||||
return "<a href='".$url."' rel='external' title='".LAN_EFORM_010."'><small>".$url."</small></a>";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'filter':
|
default:
|
||||||
case 'batch':
|
$parm = array('w'=>800);
|
||||||
return '';
|
$path = e107::getParser()->thumbUrl($val,$parm);
|
||||||
break;
|
// code to be executed if n is different from all labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$url = SITEURLBASE.$path;
|
||||||
|
return "<a href='".$url."' rel='external' title='".LAN_EFORM_010."'><small>".$url."</small></a>";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5316,6 +5316,13 @@ var_dump($select_options);*/
|
|||||||
|
|
||||||
|
|
||||||
case 'media':
|
case 'media':
|
||||||
|
|
||||||
|
if(!empty($value) && $attributes['data'] === 'json')
|
||||||
|
{
|
||||||
|
$tmp = e107::unserialize($value);
|
||||||
|
$value = !empty($tmp[0]['path']) ? $tmp[0]['path'] : null; // display first item.
|
||||||
|
}
|
||||||
|
|
||||||
return e107::getMedia()->previewTag($value, $parms);
|
return e107::getMedia()->previewTag($value, $parms);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -6006,6 +6013,11 @@ var_dump($select_options);*/
|
|||||||
|
|
||||||
$max = varset($parms['max'],1);
|
$max = varset($parms['max'],1);
|
||||||
|
|
||||||
|
if(!empty($value) && $attributes['data'] === 'json')
|
||||||
|
{
|
||||||
|
$value = e107::unserialize($value);
|
||||||
|
}
|
||||||
|
|
||||||
$ret = "<div class='mediaselector-multi field-element-media'>";
|
$ret = "<div class='mediaselector-multi field-element-media'>";
|
||||||
for ($i=0; $i < $max; $i++)
|
for ($i=0; $i < $max; $i++)
|
||||||
{
|
{
|
||||||
|
@@ -1168,6 +1168,11 @@ class e_media
|
|||||||
{
|
{
|
||||||
$type = pathinfo($mediaURL,PATHINFO_EXTENSION);
|
$type = pathinfo($mediaURL,PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
if($type == 'glyph')
|
||||||
|
{
|
||||||
|
return 'glyph';
|
||||||
|
}
|
||||||
|
|
||||||
foreach($this->mimeExtensions as $key=>$exts)
|
foreach($this->mimeExtensions as $key=>$exts)
|
||||||
{
|
{
|
||||||
if(!in_array($type, $exts))
|
if(!in_array($type, $exts))
|
||||||
@@ -1195,6 +1200,7 @@ class e_media
|
|||||||
|
|
||||||
$width = vartrue($options['w'], 220);
|
$width = vartrue($options['w'], 220);
|
||||||
$height = vartrue($options['h'], 190);
|
$height = vartrue($options['h'], 190);
|
||||||
|
$crop = vartrue($options['crop'], 0);
|
||||||
$preview = '';
|
$preview = '';
|
||||||
|
|
||||||
switch($type)
|
switch($type)
|
||||||
@@ -1211,7 +1217,7 @@ class e_media
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "image":
|
case "image":
|
||||||
$preview = $tp->toImage($default, array('w'=>$width, 'h'=>$height, 'class'=>'image-selector img-responsive img-fluid', 'legacy'=>varset($options['legacyPath'])));
|
$preview = $tp->toImage($default, array('w'=>$width, 'h'=>$height, 'crop'=>$crop, 'class'=>'image-selector img-responsive img-fluid', 'legacy'=>varset($options['legacyPath'])));
|
||||||
// $previewURL = $tp->thumbUrl($default, array('w'=>800));
|
// $previewURL = $tp->thumbUrl($default, array('w'=>800));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -55,6 +55,7 @@ CREATE TABLE blank (
|
|||||||
`blank_date` int(10) NOT NULL,
|
`blank_date` int(10) NOT NULL,
|
||||||
`blank_compatibility` varchar(5) NOT NULL,
|
`blank_compatibility` varchar(5) NOT NULL,
|
||||||
`blank_url` varchar(255) NOT NULL,
|
`blank_url` varchar(255) NOT NULL,
|
||||||
|
`blank_media` json DEFAULT NULL,
|
||||||
`blank_class` int(10) NOT NULL,
|
`blank_class` int(10) NOT NULL,
|
||||||
PRIMARY KEY (`blank_id`)
|
PRIMARY KEY (`blank_id`)
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
@@ -91,7 +91,7 @@ class plugin_blank_admin_ui extends e_admin_ui
|
|||||||
* Example: 'r.blank'
|
* Example: 'r.blank'
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $table = "_blank";
|
protected $table = "blank";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is only needed if you need to JOIN tables AND don't wanna use $tableJoin
|
* This is only needed if you need to JOIN tables AND don't wanna use $tableJoin
|
||||||
@@ -253,9 +253,11 @@ class plugin_blank_admin_ui extends e_admin_ui
|
|||||||
'blank_version' => array('title'=> 'Version', 'type' => 'number', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
'blank_version' => array('title'=> 'Version', 'type' => 'number', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
||||||
'blank_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
'blank_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'blank_authorURL' => array('title'=> "Url", 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
'blank_authorURL' => array('title'=> "Url", 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'blank_date' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'readParms' => 'long', 'writeParms' => 'type=datetime'),
|
'blank_date' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'readParms' => 'long', 'writeParms' => array('type' => 'datetime')),
|
||||||
'blank_compatibility' => array('title'=> 'Compatible', 'type' => 'text', 'data' => 'str', 'width' => '10%', 'thclass' => 'center' ),
|
'blank_compatibility' => array('title'=> 'Compatible', 'type' => 'text', 'data' => 'str', 'width' => '10%', 'thclass' => 'center' ),
|
||||||
'blank_url' => array('title'=> LAN_URL, 'type' => 'file', 'data' => 'str', 'width' => '20%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'parms' => 'truncate=30', 'validate' => false, 'help' => 'Enter blank URL here', 'error' => 'please, ener valid URL'),
|
'blank_url' => array('title'=> LAN_URL, 'type' => 'file', 'data' => 'str', 'width' => '20%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'readParms' => array('truncate' => 30), 'validate' => false, 'help' => 'Enter blank URL here', 'error' => 'please, enter valid URL'),
|
||||||
|
'blank_media' => array('title'=> "Media", 'type' => 'media', 'data' => 'json', 'width' => '20%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'readParms' => array('truncate' => 30), 'writeParms'=>array(/*'w'=>200, 'h'=>150,*/ 'image'=>1, 'video'=>1, 'youtube'=>1, 'audio'=>1, 'glyph'=>1), 'validate' => false),
|
||||||
|
|
||||||
'test_list_1' => array('title'=> 'test 1', 'type' => 'boolean', 'data' => false, 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
|
'test_list_1' => array('title'=> 'test 1', 'type' => 'boolean', 'data' => false, 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
|
||||||
'blank_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'filter'=>true, 'batch'=>true, 'width'=>'auto'),
|
'blank_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'filter'=>true, 'batch'=>true, 'width'=>'auto'),
|
||||||
|
|
||||||
|
@@ -560,6 +560,7 @@ img.S32:hover {}
|
|||||||
|
|
||||||
.adminlist .col-selection-cont { position: relative; float:right; }
|
.adminlist .col-selection-cont { position: relative; float:right; }
|
||||||
table.adminlist { margin-bottom: 0 }
|
table.adminlist { margin-bottom: 0 }
|
||||||
|
table.adminlist td .video-responsive { height: auto; padding:0 }
|
||||||
|
|
||||||
span.e-search input[type='text'] { padding-left:15px; font-style: italic }
|
span.e-search input[type='text'] { padding-left:15px; font-style: italic }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user