Skip to content

Commit

Permalink
Media-Manager news now includes common images/video etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaMer0n committed Aug 23, 2018
1 parent 4c41fb6 commit ea4affe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
6 changes: 4 additions & 2 deletions e107_admin/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,8 @@ private function mediaManagerTabs()

$cat = $this->getQuery('for');

$cat = urldecode($cat);

$tabOptions = array(
'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' ),
Expand Down Expand Up @@ -1691,10 +1693,10 @@ private function imageAttributesTab()
private function mediaManagerPlaceholders()
{
$type = (E107_DEBUG_LEVEL > 0) ? "text" : "hidden";
$br = (E107_DEBUG_LEVEL > 0) ? "<br />" : "";
$br = (E107_DEBUG_LEVEL > 0) ? "<br style='clear:both' />" : "";

$text = "
".$br."<input title='bbcode' type='{$type}' readonly='readonly' class='span11 col-md-11' id='bbcode_holder' name='bbcode_holder' value='' />
".$br."<input title='bbcode' type='{$type}' style=readonly='readonly' class='span11 col-md-11' id='bbcode_holder' name='bbcode_holder' value='' />
".$br."<input title='html/wysiwyg' type='{$type}' class='span11 col-md-11' readonly='readonly' id='html_holder' name='html_holder' value='' />
".$br."<input title='(preview) src' type='{$type}' class='span11 col-md-11' readonly='readonly' id='src' name='src' value='' />
".$br."<input title='path (saved to db)' type='{$type}' class='span11 col-md-11' readonly='readonly' id='path' name='path' value='' />
Expand Down
10 changes: 5 additions & 5 deletions e107_admin/newspost.php
Original file line number Diff line number Diff line change
Expand Up @@ -1753,11 +1753,11 @@ function news_thumbnail($curval,$mode)
}


$text = $frm->imagepicker('news_thumbnail[0]', varset($thumbTmp[0]), varset($paths[0]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text .= $frm->imagepicker('news_thumbnail[1]', varset($thumbTmp[1]), varset($paths[1]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text .= $frm->imagepicker('news_thumbnail[2]', varset($thumbTmp[2]), varset($paths[2]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text .= $frm->imagepicker('news_thumbnail[3]', varset($thumbTmp[3]), varset($paths[3]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text .= $frm->imagepicker('news_thumbnail[4]', varset($thumbTmp[4]), varset($paths[4]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text = $frm->imagepicker('news_thumbnail[0]', varset($thumbTmp[0]), varset($paths[0]), array('media' => 'news+', 'video' => 1, 'legacyPath' => '{e_IMAGE}newspost_images'));
$text .= $frm->imagepicker('news_thumbnail[1]', varset($thumbTmp[1]), varset($paths[1]), array('media' => 'news+', 'video' => 1, 'legacyPath' => '{e_IMAGE}newspost_images'));
$text .= $frm->imagepicker('news_thumbnail[2]', varset($thumbTmp[2]), varset($paths[2]), array('media' => 'news+', 'video' => 1, 'legacyPath' => '{e_IMAGE}newspost_images'));
$text .= $frm->imagepicker('news_thumbnail[3]', varset($thumbTmp[3]), varset($paths[3]), array('media' => 'news+', 'video' => 1, 'legacyPath' => '{e_IMAGE}newspost_images'));
$text .= $frm->imagepicker('news_thumbnail[4]', varset($thumbTmp[4]), varset($paths[4]), array('media' => 'news+', 'video' => 1, 'legacyPath' => '{e_IMAGE}newspost_images'));

// $text .= "<div class='field-help'>Insert image/video into designated area of template.</div>";
return $text;
Expand Down
4 changes: 4 additions & 0 deletions e107_handlers/form_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,14 @@ public function mediaUrl($category = '', $label = '', $tagid='', $extras=null)
parse_str($extras,$extras);
}

$category = str_replace('+', '^', $category); // Bc Fix.

$cat = ($category) ? '&amp;for='.urlencode($category) : "";
$mode = vartrue($extras['mode'],'main');
$action = vartrue($extras['action'],'dialog');



if(empty($label))
{
$label = ' Upload an image or file';
Expand Down
14 changes: 9 additions & 5 deletions e107_handlers/media_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public function getImages($cat='', $from=0, $amount=null, $search=null, $orderby
* Return an array of Images in a particular category
*
* @param string $type image|audio|video
* @param string $cat : category name. use + to include _common eg. 'news+'
* @param string $cat : category name. use ^ to include _common eg. 'news^'
* @param int $from
* @param int|string $amount
* @param string $search
Expand All @@ -483,18 +483,21 @@ public function getImages($cat='', $from=0, $amount=null, $search=null, $orderby
*/
private function getMedia($type, $cat='', $from=0, $amount=null, $search=null, $orderby=null)
{

// print_a($cat);
// $inc = array();
$searchinc = array();
$catArray = array();

if(strpos($cat,"+") || !$cat)
if(strpos($cat,"^") || !$cat)
{
$cat = str_replace("+","",$cat);
$cat = str_replace("^","",$cat);
$catArray[] = '_common_'.$type;
}

if($cat)
{
if(strpos($cat, "|") && !strpos($cat,"+") )
if(strpos($cat, "|") && !strpos($cat,"^") )
{
$catArray = explode("|",$cat);
}
Expand All @@ -509,6 +512,7 @@ private function getMedia($type, $cat='', $from=0, $amount=null, $search=null, $
}
}


// TODO check the category is valid.

if($search)
Expand Down Expand Up @@ -540,7 +544,7 @@ private function getMedia($type, $cat='', $from=0, $amount=null, $search=null, $
}
else
{
$query .= " ORDER BY media_id DESC";
$query .= " ORDER BY media_category ASC, media_id DESC"; // places the specified category before the _common categories.
}

if($amount == 'all')
Expand Down

0 comments on commit ea4affe

Please sign in to comment.