Skip to content

Commit

Permalink
media manager category types
Browse files Browse the repository at this point in the history
  • Loading branch information
myovchev committed Oct 31, 2012
1 parent c8612c6 commit a533274
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 10 additions & 3 deletions e107_admin/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ class media_cat_ui extends e_admin_ui
'media_cat_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'nolist'=>true, 'forced'=> TRUE, 'readonly'=>TRUE),
'media_cat_image' => array('title'=> LAN_IMAGE, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE),
'media_cat_owner' => array('title'=> "Owner", 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
'media_cat_category' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE),

'media_cat_type' => array('title'=> "Type", 'type' => 'radio', 'data'=>false, 'width' => 'auto', 'thclass' => 'left', 'validate' => true, 'nolist'=>true),

'media_cat_category' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE),
'media_cat_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
'media_cat_diz' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=150&bb=1','readonly'=>FALSE), // Display name
'media_cat_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int'),
Expand All @@ -174,6 +177,9 @@ function init()
"download" => "download"
);

// FIXME lan
$this->fields['media_cat_type']['writeParms'] = array('image' => 'Image', 'file' => 'File', 'video' => 'Video');

if($this->getAction() == 'list')
{
$this->fields['media_cat_owner']['writeParms'] = $restricted;
Expand Down Expand Up @@ -207,10 +213,11 @@ public function beforeCreate($new_data)

//$replace = array("_"," ","'",'"',"."); //FIXME Improve
//$new_data['media_cat_category'] = str_replace($replace,"-",$new_data['media_cat_category']);
$type = $this->getRequest()->getPosted('media_cat_type', 'image').'_';

$increment = ($this->ownerCount[$new_data['media_cat_owner']] +1);
$new_data['media_cat_category'] = $new_data['media_cat_owner']."_".$increment;

$new_data['media_cat_category'] = $new_data['media_cat_owner'].'_'.$type.$increment;
//print_a($new_data); exit;
return $new_data;
}

Expand Down
8 changes: 4 additions & 4 deletions e107_handlers/plugin_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1566,21 +1566,21 @@ function XmlMediaCategories($function, $tag)
{
$type = $v['@attributes']['type'];

if($type != 'image' && $type !='file')
if(strpos($type, 'image') !== 0 && strpos($type, 'file') !== 0 && strpos($type, 'video') !== 0)
{
continue;
}

if($c == 3 || ($prevType == $type))
if($c == 4 || ($prevType == $type))
{
$mes->addDebug("Only 2 Media Categories are permitted during install. One for images and one for files.");
$mes->addDebug("Only 3 Media Categories are permitted during install. One for images and one for files.");
break;
}

$prevType = $type;

$data['owner'] = $folder;
$data['category'] = $folder."_".$c;
$data['category'] = $folder."_".$type;
$data['title'] = $v['@value'];
// $data['type'] = $v['@attributes']['type']; //TODO
$data['class'] = 253;
Expand Down

0 comments on commit a533274

Please sign in to comment.