1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Issue #1974 - Media-Manager file-mode: Added Option to remove selected file. Fixes #1959 - allow for more than one media-category of a particular type during plugin installation. Issue #6 LAN fix on "Choose a file".

This commit is contained in:
Cameron 2016-10-31 20:34:59 -07:00
parent 7041f9b6a8
commit dc6754d0e8
10 changed files with 55 additions and 20 deletions

View File

@ -585,7 +585,9 @@ class media_form_ui extends e_admin_form_ui
$for = $this->getController()->getQuery('for');
if(strpos($for, '_file') !==false)
if(strpos($for, '_file') !==false )
{
$type = 'file';
}
@ -1017,7 +1019,7 @@ class media_admin_ui extends e_admin_ui
function dialogPage() // Popup dialogPage for Image Selection.
{
$cat = $this->getQuery('for');
$file = (substr($cat,-5) == "_file") ? TRUE : FALSE;
$file = (preg_match('/_file(_[\d]{1,2})?$/',$cat)) ? TRUE : FALSE;
$mes = e107::getMessage();
$mes->addDebug("For:".$cat);
$mes->addDebug("Bbcode: ".$this->getQuery('bbcode'));
@ -1048,8 +1050,17 @@ class media_admin_ui extends e_admin_ui
{
$this->fields[$k]['filter'] = false;
}
echo $this->mediaSelectUpload('file');
echo $this->mediaSelectUpload('file');
$tagid = e107::getParser()->filter($this->getQuery('tagid'));
echo '<div class="media-select-file-footer"><a class="btn btn-danger e-media-select-file-none e-dialog-close" data-target="'.$tagid.'" data-target-label="'.LAN_CHOOSE_FILE.'" href="#" ><span><i class="fa fa-ban"></i> '.IMALAN_167.'</span></a></div>';
}
else
{
@ -1071,7 +1082,7 @@ class media_admin_ui extends e_admin_ui
}
// if 'for' has no value, files are placed in /temp and not added to the db.
$text = IMALAN_145;
$text = "<h4>".IMALAN_145."</h4>";
$text .= '<div id="uploader" rel="'.e_JS.'plupload/upload.php?for='.$this->getQuery('for').'">
<p>'.IMALAN_146.'</p>
</div>';
@ -1080,7 +1091,7 @@ class media_admin_ui extends e_admin_ui
$text .= $frm->open('upload-url-form','post');
$text .= '<div class="plupload_header_content">';
$text .= IMALAN_147;
$text .= "<h4>".IMALAN_147."</h4>";
$text .= "<div class='plupload_header_text form-inline' style='padding-left:20px;padding-right:20px'>";
$text .= "<table class='table'>";

View File

@ -1238,7 +1238,7 @@ class e_form
}
$default_label = ($default) ? $default : "Choose a file";
$default_label = ($default) ? $default : LAN_CHOOSE_FILE;
$label = "<span id='{$name_id}_prev' class='btn btn-default btn-small'>".basename($default_label)."</span>";
$sc_parameters['mode'] = 'main';

View File

@ -2281,6 +2281,8 @@ class e107plugin
case 'install':
case 'refresh':
$c = 1;
$i = array('file'=>1, 'image'=>1, 'video'=>1);
foreach($tag['mediaCategories']['category'] as $v)
{
$type = $v['@attributes']['type'];
@ -2290,17 +2292,23 @@ class e107plugin
continue;
}
if($c == 4 || ($prevType == $type))
if($c == 4)
{
$mes->addDebug(EPL_ADLAN_244);
break;
}
$prevType = $type;
// $prevType = $type;
$data['owner'] = $folder;
$data['image'] = vartrue($v['@attributes']['image']);
$data['category'] = $folder."_".$type;
$data['category'] = $folder."_".$type;
if($i[$type] > 1)
{
$data['category'] .= "_".$i[$type];
}
$data['title'] = $v['@value'];
$data['sef'] = vartrue($v['@attributes']['sef']);
// $data['type'] = $v['@attributes']['type']; //TODO
@ -2309,7 +2317,8 @@ class e107plugin
$status = e107::getMedia()->createCategory($data) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Media Category: {$data['category']}", $status);
e107::getMedia()->import($data['category'],e_PLUGIN.$folder, false,'min-size=20000');
$c++;
$c++;
$i[$type]++;
}
break;

View File

@ -530,7 +530,7 @@ class e_pref extends e_front_model
if(!$this->data_has_changed && !$force)
{
e107::getMessage()->addInfo('Settings not saved as no changes were made.', $this->prefid, $session_messages)->moveStack($this->prefid);
e107::getMessage()->addInfo(LAN_SETTINGS_NOT_SAVED_NO_CHANGES_MADE, $this->prefid, $session_messages)->moveStack($this->prefid);
return 0;
}
@ -646,7 +646,7 @@ class e_pref extends e_front_model
}
else
{
e107::getMessage()->addInfo('Settings not saved as no changes were made.', $this->prefid, $session_messages);
e107::getMessage()->addInfo(LAN_SETTINGS_NOT_SAVED_NO_CHANGES_MADE, $this->prefid, $session_messages);
if(!$disallow_logs) $log->flushMessages('LAN_FIXME', E_LOG_INFORMATIVE, '', $this->prefid);
e107::getMessage()->moveStack($this->prefid);
return 0;

View File

@ -126,5 +126,6 @@ define("LAN_GENERATE", "Generate");
define("LAN_SUMMARY", "Summary"); // TODO more files use summary replace
define("LAN_REQUIRED_BLANK", "Required field(s) were left blank.");
define("LAN_PLEASEWAIT", "Please Wait");
define("LAN_CHOOSE_FILE", "Choose a file");
?>

View File

@ -454,4 +454,4 @@ define("LAN_LATEST_COMMENTS", "Latest Comments");
define("LAN_PERSONALIZE", "Personalize");
define("LAN_SELECT_COLUMNS_TO_DISPLAY", "Select columns to display");
define("LAN_DISPLAY_COLUMNS", "Display Columns");
define("LAN_SETTINGS_NOT_SAVED_AS_NO_CHANGES_WERE_MADE", "Settings not saved as no changes were made.");
define("LAN_SETTINGS_NOT_SAVED_NO_CHANGES_MADE", "Settings not saved as no changes were made.");

View File

@ -179,9 +179,9 @@ define('IMALAN_141', "Bottom");
define('IMALAN_142', "Tile");
define('IMALAN_143', "Image");
define('IMALAN_144', "File");
define('IMALAN_145', "<h4>From your computer</h4>");
define('IMALAN_145', "From your computer");
define('IMALAN_146', "No HTML5 support.");
define('IMALAN_147', "<h4>From a remote location</h4>");
define('IMALAN_147', "From a remote location");
define('IMALAN_148', "Image/File URL");
define('IMALAN_149', "Start Upload");
define('IMALAN_150', "Upload a File");
@ -201,7 +201,7 @@ define('IMALAN_163', "Video");
define('IMALAN_164', ""); // Unused
define('IMALAN_165', "No images");
define('IMALAN_166', "Upload images or files");
define('IMALAN_167', "Choose file");
define('IMALAN_167', "No file");
define('IMALAN_168', "Click on the avatar to change it");
define('IMALAN_169', "No Avatars Available");
define('IMALAN_170', "Choose this avatar");
@ -209,4 +209,6 @@ define('IMALAN_171', "Admin-Only Notice: The folder");
define('IMALAN_172', "is empty. Upload some default avatars images to this folder for users to choose avatars from.");
define('IMALAN_173', "No media owner found.");
?>

View File

@ -282,7 +282,7 @@ define ("EPL_ADLAN_240","Removing Table:");
define ("EPL_ADLAN_241","Adding Pref:");
define ("EPL_ADLAN_242","Removing Pref:");
define ("EPL_ADLAN_243","Updating Pref:");
define ("EPL_ADLAN_244","Only 3 Media Categories are permitted during install. One for images and one for files.");
define ("EPL_ADLAN_244","Only 5 Media Categories are permitted during installation.");
define ("LAN_RELEASED", "Released");
define ("LAN_REPAIR_PLUGIN_SETTINGS", "Repair plugin settings");

View File

@ -917,6 +917,8 @@ a.e-media-select
color: inherit
}
.media-select-file-footer { padding:30px; text-align:center }
#cboxOverlay{ background-color:#000000;}
#colorbox{

View File

@ -141,8 +141,18 @@ $(document).ready(function()
}
$(document).on("click", ".e-media-select-file-none", function(){
var target = $(this).attr('data-target');
var label = $(this).attr('data-target-label');
parent.$('input#'+target).val(null);
parent.$('input#'+target+'-id').val(null);
parent.$('input#'+target+'-path').val(null);
parent.$('input#'+target+'-name').val(null);
parent.$('#'+target+'_prev').text(label);
});
// $(".e-media-select").click(function () {
$(document).on("click", ".e-media-select", function(){