1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Issue #1156 - No avatar images were showing as in use. This should fix it.

This commit is contained in:
Cameron
2015-08-16 15:05:34 -07:00
parent c41d8dbbe0
commit faba6e9bea

View File

@@ -1870,6 +1870,12 @@ class media_admin_ui extends e_admin_ui
} }
e107::css('inline', '
span.avatar-label { width:100%; display:block; padding:5px; margin-bottom:5px }
div.avatar-container { margin-bottom:5px; max-height:350px }
');
$sql = e107::getDb(); $sql = e107::getDb();
$frm = e107::getForm(); $frm = e107::getForm();
$tp = e107::getParser(); $tp = e107::getParser();
@@ -1899,14 +1905,14 @@ class media_admin_ui extends e_admin_ui
foreach($tmp as $val) foreach($tmp as $val)
{ {
$id = $val['user_id']; $id = $val['user_id'];
$imageUsed[$id] = $val['user_image']; $imageUsed[$id] = str_replace("-upload-","", $val['user_image']);
} }
$userImages = array_flip($imageUsed); $userImages = array_flip($imageUsed);
$text = $frm->open('core-image-avatars'); $text = $frm->open('core-image-avatars');
$text .= "<fieldset id='core-iamge-show-avatars'>"; $text .= "<div id='core-image-show-avatars' class='row'>";
$count = 0; $count = 0;
while (list($key, $image_name) = each($dirlist)) while (list($key, $image_name) = each($dirlist))
@@ -1929,8 +1935,14 @@ class media_admin_ui extends e_admin_ui
*/ */
// : // :
// $fileName = basename($image_name);
$fileName = basename($image_name); $fileName = basename($image_name);
$users = (in_array($fileName,$imageUsed)) ? "<span class='badge badge-warning' style='margin-bottom:5px'>Image in use</span>" : '<span class="badge" style="margin-bottom:5px">Not in use</span>';
$users = (in_array($fileName,$imageUsed)) ? "<span class='label label-warning avatar-label'>Image in use</span>" : '<span class="label label-default avatar-label" >Not in use</span>';
//directory? //directory?
if(is_dir(e_MEDIA."avatars/".$image_name)) if(is_dir(e_MEDIA."avatars/".$image_name))
@@ -1953,25 +1965,26 @@ class media_admin_ui extends e_admin_ui
//Friendly UI - click text to select a form element //Friendly UI - click text to select a form element
// Resized on-the-fly - avatar-size no longer an issue. // Resized on-the-fly - avatar-size no longer an issue.
$attr = "aw=".$pref['im_width']."&ah=".$pref['im_height']; // $attr = "aw=".$pref['im_width']."&ah=".$pref['im_height'];
$attr = "aw=200&ah=200";
$img_path = $tp->thumbUrl(e_MEDIA_ABS."avatars/".$image_name,$attr); $img_path = $tp->thumbUrl(e_MEDIA_ABS."avatars/".$image_name,$attr);
$type = dirname($image_name); $type = dirname($image_name);
if($prevType != $type) if($prevType != $type)
{ {
$text .= "<div class='clearfix'></div> $text .= "<div class='col-md-12 clearfix'></div>
<h5 >".$type."</h5>"; <h4 class='clearfix col-md-12' >".$type."</h4>";
} }
$for = $frm->name2id('multiaction-'.$image_name); $for = $frm->name2id('multiaction-'.$image_name);
$img_src = "<label for='".$for."' > $img_src = "
<div class='thumbnail'> <div class='thumbnail'>
<img src='".$img_path."' alt='{$image_name}' title='".IMALAN_66.": {$image_name}' /> <label for='".$for."' ><img class='img-responsive' src='".$img_path."' alt='{$image_name}' title='".IMALAN_66.": {$image_name}' /></label>
</div> </div>
</label>"; ";
$prevType = $type; $prevType = $type;
@@ -1983,12 +1996,12 @@ class media_admin_ui extends e_admin_ui
$text .= " $text .= "
<div class='buttons-bar image-box f-left center autocheck' style='margin:5px; width: ".(intval($pref['im_width'])+40)."px; height: ".(intval($pref['im_height'])+100)."px;'> <div class=' col-md-1 center autocheck avatar-container' >
<div class='well'> <div class='well'>
<div class='image-users'>{$users}</div> <div class='image-users'>{$users}</div>
<div class='image-preview'>{$img_src}</div> <div class='image-preview'>{$img_src}</div>
<div class='image-delete'> <div class='image-delete'>
".$frm->checkbox('multiaction[]', intval($userImages[$fileName])."#{$image_pre}{$image_name}", false, array('id' => false, 'disabled' => $disabled))." ".$frm->checkbox('multiaction[]', intval($userImages[$fileName])."#{$image_pre}{$image_name}", false, array('id' => $for, 'disabled' => $disabled))."
</div> </div>
</div> </div>
@@ -1997,9 +2010,10 @@ class media_admin_ui extends e_admin_ui
$count++; $count++;
} }
$text .= " $text .= "</div>
<div class='spacer clear'>
<div class='buttons-bar'> <div class='col-md-12 spacer clearfix'>
<div class='row buttons-bar'>
<input type='hidden' name='show_avatars' value='1' /> <input type='hidden' name='show_avatars' value='1' />
".$frm->admin_button('e_check_all', LAN_CHECKALL, 'action')." ".$frm->admin_button('e_check_all', LAN_CHECKALL, 'action')."
".$frm->admin_button('e_uncheck_all', LAN_UNCHECKALL, 'action')." ".$frm->admin_button('e_uncheck_all', LAN_UNCHECKALL, 'action')."
@@ -2008,7 +2022,8 @@ class media_admin_ui extends e_admin_ui
</div> </div>
</div> </div>
</fieldset>
</form> </form>
"; ";
// $frm->admin_button('submit_cancel_show', IMALAN_68, 'cancel') // $frm->admin_button('submit_cancel_show', IMALAN_68, 'cancel')