mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Media-Manager ajax navigation done and other js cleanup.
This commit is contained in:
@@ -439,6 +439,11 @@ class media_admin_ui extends e_admin_ui
|
|||||||
$text .= "<li id='tab-style'><a href='#core-media-style'>Appearance</a></li>\n";
|
$text .= "<li id='tab-style'><a href='#core-media-style'>Appearance</a></li>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($_GET['from'])
|
||||||
|
{
|
||||||
|
$bbcodeMode .= "&from=".intval($_GET['from']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
</ul>
|
</ul>
|
||||||
@@ -487,8 +492,8 @@ class media_admin_ui extends e_admin_ui
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Dimensions: </td>
|
<td>Dimensions: </td>
|
||||||
<td>
|
<td>
|
||||||
<input type='text' id='width' name='width' size='4' style='width:50px' value='' onkeyup='updateBB()' /> px
|
<input type='text' class='e-media-attribute' id='width' name='width' size='4' style='width:50px' value='' /> px
|
||||||
X <input type='text' id='height' name='height' size='4' style='width:50px' value='' onkeyup='updateBB()' /> px
|
X <input type='text' class='e-media-attribute' id='height' name='height' size='4' style='width:50px' value='' /> px
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@@ -499,22 +504,22 @@ class media_admin_ui extends e_admin_ui
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Margin-Left: </td>
|
<td>Margin-Left: </td>
|
||||||
<td><input type='text' id='margin-left' name='margin_left' value='' onkeyup='updateBB()' /></td>
|
<td><input class='e-media-attribute' type='text' id='margin-left' name='margin_left' value='' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Margin-Right: </td>
|
<td>Margin-Right: </td>
|
||||||
<td><input type='text' id='margin-right' name='margin_right' value='' onkeyup='updateBB()' /></td>
|
<td><input class='e-media-attribute' type='text' id='margin-right' name='margin_right' value='' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Margin-Top: </td>
|
<td>Margin-Top: </td>
|
||||||
<td><input type='text' id='margin-top' name='margin_top' value='' onkeyup='updateBB()' /></td>
|
<td><input class='e-media-attribute' type='text' id='margin-top' name='margin_top' value='' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Margin-Bottom: </td>
|
<td>Margin-Bottom: </td>
|
||||||
<td><input type='text' id='margin-bottom' name='margin_bottom' value='' onkeyup='updateBB()' /></td>
|
<td><input class='e-media-attribute' type='text' id='margin-bottom' name='margin_bottom' value='' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
@@ -530,91 +535,24 @@ class media_admin_ui extends e_admin_ui
|
|||||||
// For BBCODE mode. //TODO image-float.
|
// For BBCODE mode. //TODO image-float.
|
||||||
if($bbcodeMode)
|
if($bbcodeMode)
|
||||||
{
|
{
|
||||||
$text .= "To be Hidden<br />
|
|
||||||
bbcode: <input type='text' style='width:800px' id='bbcode_holder' name='bbcode_holder' value='' /><br />
|
|
||||||
html: <input type='text' style='width:800px' id='html_holder' name='html_holder' value='' />
|
|
||||||
<br />src: <input type='text' style='width:600px' id='src' name='src' value='' />
|
|
||||||
";
|
|
||||||
|
|
||||||
$text .= "<div style='text-align:right;padding:5px'>
|
$text .= "<div style='text-align:right;padding:5px'>
|
||||||
|
|
||||||
<button type='submit' class='submit e-dialog-save e-dialog-close' data-target='".$this->getQuery('tagid')."' name='save_image' value='Save' onclick=\"saveBB();\" >
|
<button type='submit' class='submit e-dialog-save e-dialog-close' data-target='".$this->getQuery('tagid')."' name='save_image' value='Save' onclick=\"saveBB();\" >
|
||||||
<span>Save</span>
|
<span>Save</span>
|
||||||
</button>
|
</button>
|
||||||
<button type='submit' class='submit' name='cancel_image' value='Cancel' onclick=\"parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close();\" >
|
<button type='submit' class='submit e-dialog-close' name='cancel_image' value='Cancel' >
|
||||||
<span>Cancel</span>
|
<span>Cancel</span>
|
||||||
</button>
|
</button>
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
|
// TODO to eventually be hidden.
|
||||||
e107::getJs()->footerInline("
|
$text .= "bbcode: <input type='text' style='width:800px' id='bbcode_holder' name='bbcode_holder' value='' />
|
||||||
|
<br />html: <input type='text' style='width:800px' id='html_holder' name='html_holder' value='' />
|
||||||
|
<br />src: <input type='text' style='width:600px' id='src' name='src' value='' />
|
||||||
/* Generate an IMG bbcode based on input by user */
|
<br />path: <input type='text' style='width:600px' id='path' name='path' value='' />
|
||||||
function updateBB()
|
";
|
||||||
{
|
|
||||||
var style = '';
|
|
||||||
var bb = '';
|
|
||||||
|
|
||||||
var src = document.getElementById('src').value;
|
|
||||||
var width = document.getElementById('width').value;
|
|
||||||
var height = document.getElementById('height').value;
|
|
||||||
var margin_top = document.getElementById('margin-top').value;
|
|
||||||
var margin_bottom = document.getElementById('margin-bottom').value;
|
|
||||||
var margin_right = document.getElementById('margin-right').value;
|
|
||||||
var margin_left = document.getElementById('margin-left').value;
|
|
||||||
|
|
||||||
if(width !='')
|
|
||||||
{
|
|
||||||
// style = style + 'width:' + width + 'px;';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(height !='')
|
|
||||||
{
|
|
||||||
// style = style + 'height:' + height + 'px;';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(margin_right !='')
|
|
||||||
{
|
|
||||||
style = style + 'margin-right:' + margin_right + 'px;';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(margin_left !='')
|
|
||||||
{
|
|
||||||
style = style + 'margin-left:' + margin_left + 'px;';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(margin_top !='')
|
|
||||||
{
|
|
||||||
style = style + 'margin-top:' + margin_top + 'px;';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(margin_bottom !='')
|
|
||||||
{
|
|
||||||
style = style + 'margin-bottom:' + margin_bottom + 'px;';
|
|
||||||
}
|
|
||||||
|
|
||||||
bb = '[img';
|
|
||||||
|
|
||||||
if(style !='')
|
|
||||||
{
|
|
||||||
bb = bb + ' style='+style;
|
|
||||||
}
|
|
||||||
|
|
||||||
bb = bb + ']';
|
|
||||||
bb = bb + src;
|
|
||||||
bb = bb + '[/img]';
|
|
||||||
|
|
||||||
document.getElementById('bbcode_holder').value = bb;
|
|
||||||
|
|
||||||
// var html = '<img style=\"' + style + '\" src=\"'+ src +'\" />';
|
|
||||||
var html = '<img style=\"' + style + '\" src=\"'+ src +'\" alt=\"\" width=\"' + width + '\" height=\"' + height + '\"/>';
|
|
||||||
|
|
||||||
document.getElementById('html_holder').value = html;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@ class bbcode_shortcodes
|
|||||||
|
|
||||||
$bbcode['fontsize'] = array("expandit","size_selector_".$rand, LANHELP_22,"fontsize.png","Size_Select",'size_selector_'.$rand);
|
$bbcode['fontsize'] = array("expandit","size_selector_".$rand, LANHELP_22,"fontsize.png","Size_Select",'size_selector_'.$rand);
|
||||||
$bbcode['fontcol'] = array("expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand);
|
$bbcode['fontcol'] = array("expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand);
|
||||||
$bbcode['preimage'] = array("expandit","preimage_selector_".$rand, LANHELP_45.$imagedir_display,"preimage.png","PreImage_Select","preimage_selector_".$rand);
|
$bbcode['preimage'] = array("e-dialog","preimage_selector_".$rand, LANHELP_45.$imagedir_display,"preimage.png","PreImage_Select","preimage_selector_".$rand);
|
||||||
$bbcode['prefile'] = array("expandit","prefile_selector_".$rand, LANHELP_39,"prefile.png","PreFile_Select",'prefile_selector_'.$rand);
|
$bbcode['prefile'] = array("expandit","prefile_selector_".$rand, LANHELP_39,"prefile.png","PreFile_Select",'prefile_selector_'.$rand);
|
||||||
|
|
||||||
if(!isset($iconpath[$parm]))
|
if(!isset($iconpath[$parm]))
|
||||||
|
@@ -10,8 +10,6 @@ font-size:10px;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.neutral{
|
.neutral{
|
||||||
|
|
||||||
|
|
||||||
border:1px solid #000000;
|
border:1px solid #000000;
|
||||||
background-color:#FFFFFF;
|
background-color:#FFFFFF;
|
||||||
}
|
}
|
||||||
@@ -46,11 +44,11 @@ color:#FFFFFF;
|
|||||||
|
|
||||||
#pwdMeter {
|
#pwdMeter {
|
||||||
width:150px;
|
width:150px;
|
||||||
padding:2px;
|
padding:1px;
|
||||||
color:#000000;
|
color:#000000;
|
||||||
font-size:6px;
|
font-size:6px;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
height:12px;
|
height:13px;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
margin-top:4px;
|
margin-top:4px;
|
||||||
}
|
}
|
||||||
|
@@ -264,7 +264,21 @@ class e_media
|
|||||||
*/
|
*/
|
||||||
public function countImages($cat)
|
public function countImages($cat)
|
||||||
{
|
{
|
||||||
$query = "SELECT media_id FROM #core_media WHERE media_category = '".$cat."' ";
|
$inc = array();
|
||||||
|
|
||||||
|
if(strpos($cat,"+") || !$cat)
|
||||||
|
{
|
||||||
|
$cat = str_replace("+","",$cat);
|
||||||
|
$inc[] = "media_category = '_common_image' ";
|
||||||
|
}
|
||||||
|
if($cat)
|
||||||
|
{
|
||||||
|
$inc[] = "media_category REGEXP '(^|,)(".$cat.")(,|$)' "; // for multiple category field.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$query = "SELECT * FROM #core_media WHERE media_userclass IN (".USERCLASS_LIST.") AND ( ".implode(" OR ",$inc)." )" ;
|
||||||
|
|
||||||
return e107::getDb()->db_Select_gen($query);
|
return e107::getDb()->db_Select_gen($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,17 +398,46 @@ class e_media
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function mediaSelect($cat='',$tagid=null,$att=null)
|
public function mediaSelectNav($category,$att)
|
||||||
{
|
{
|
||||||
$bbcode = null; // option to override onclick behavior. See ibrowser.php
|
parse_str($att,$option);
|
||||||
|
|
||||||
if($cat !='_icon')
|
$cat = ($category) ? '&for='.$category : "";
|
||||||
|
if(!$label) $label = ' Upload an image or file';
|
||||||
|
if($option['tagid']) $cat .= '&tagid='.$option['tagid'];
|
||||||
|
if($option['bbcode']) $cat .= '&bbcode=1';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$cat .= ($option['limit']) ? "&limit=".$option['limit'] : "";
|
||||||
|
|
||||||
|
$cat .= ($option['frm']) ? "&frm=".$option['frm'] : "";
|
||||||
|
|
||||||
|
|
||||||
|
$url = e_ADMIN_ABS."image.php?mode=main&action=dialog".$cat;
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function mediaSelect($category='',$tagid=null,$att=null)
|
||||||
|
{
|
||||||
|
|
||||||
|
parse_str($att,$option); // grab 'onclick' .
|
||||||
|
|
||||||
|
$frm = ($option['from']) ? $option['from'] : 0;
|
||||||
|
$limit = ($option['limit']) ? $option['limit'] : 20;
|
||||||
|
$newfrm = $frm + $limit;
|
||||||
|
$bbcode = ($option['bbcode']) ? $option['bbcode'] : null;
|
||||||
|
|
||||||
|
if($category !='_icon')
|
||||||
{
|
{
|
||||||
$cat = ($cat) ? $cat."+" : ""; // the '+' loads category '_common' as well as the chosen category.
|
$cat = ($category) ? $category."+" : ""; // the '+' loads category '_common' as well as the chosen category.
|
||||||
$images = $this->getImages($cat,0,21);
|
$images = $this->getImages($cat,$frm,$limit);
|
||||||
$class = "media-select-image";
|
$class = "media-select-image";
|
||||||
$w = 120;
|
$w = 120;
|
||||||
$h = 100;
|
$h = 100;
|
||||||
|
$total = $this->countImages($cat);
|
||||||
}
|
}
|
||||||
else // Icons
|
else // Icons
|
||||||
{
|
{
|
||||||
@@ -403,9 +446,11 @@ class e_media
|
|||||||
$class = "media-select-icon";
|
$class = "media-select-icon";
|
||||||
$w = 64;
|
$w = 64;
|
||||||
$h = 64;
|
$h = 64;
|
||||||
|
$total = 500;
|
||||||
|
// $total = $this->countIcons($cat); //TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_str($att); // grab 'onclick' .
|
|
||||||
|
|
||||||
// $total_images = $this->getImages($cat); // for use by next/prev in filter at some point.
|
// $total_images = $this->getImages($cat); // for use by next/prev in filter at some point.
|
||||||
|
|
||||||
@@ -414,14 +459,17 @@ class e_media
|
|||||||
|
|
||||||
// EXAMPLE of FILTER GUI.
|
// EXAMPLE of FILTER GUI.
|
||||||
// $text .= "CAT=".$cat;
|
// $text .= "CAT=".$cat;
|
||||||
|
$dipTotal = (($frm + $limit) < $total) ? ($frm + $limit) : $total;
|
||||||
|
|
||||||
$text .= "<div>Filter: <input type='text' name='non-working-filter-example' value='' />";
|
$text .= "<div>Filter: <input type='text' name='non-working-filter-example' value='' />";
|
||||||
$text .= "<input type='button' value='Go' /> "; // Manual filter, if onkeyup ajax fails for some reason.
|
$text .= "<input type='button' value='Go' /> "; // Manual filter, if onkeyup ajax fails for some reason.
|
||||||
$text .= "<input type='button' value='«' />"; // see previous page of images.
|
// $text .= "<input type='button' value='«' />"; // see previous page of images.
|
||||||
$text .= "<input type='button' value='»' />"; // see next page of images.
|
$text .= "<a class='button e-nav e-ajax' href='#media-select-container' data-nav-total='".$total."' data-nav-dir='down' data-nav-inc='".$limit."' data-src='".$this->mediaSelectNav($category,"tagid=".$tagid."&bbcode=".$bbcode)."&from=0 #media-select-container' >«</a>"; // see next page of images.
|
||||||
$text .= " Displaying 0-24 of 150 images.<br /> </div>
|
|
||||||
<div class='media-select-container'>\n";
|
|
||||||
|
|
||||||
|
$text .= " <a class='button e-nav e-ajax' href='#media-select-container' data-nav-total='".$total."' data-nav-dir='up' data-nav-inc='".$limit."' data-src='".$this->mediaSelectNav($category,"tagid=".$tagid."&bbcode=".$bbcode)."&from=0 #media-select-container' >»</a>"; // see next page of images.
|
||||||
|
$text .= "</div>
|
||||||
|
<div id='media-select-container'>
|
||||||
|
<div style='text-align:right; display:block'> Displaying ".($frm +1)."-".($dipTotal)." of ".$total." images.</div>\n";
|
||||||
|
|
||||||
if($bbcode == null) // e107 Media Manager - new-image mode.
|
if($bbcode == null) // e107 Media Manager - new-image mode.
|
||||||
{
|
{
|
||||||
@@ -438,6 +486,7 @@ class e_media
|
|||||||
|
|
||||||
foreach($images as $im)
|
foreach($images as $im)
|
||||||
{
|
{
|
||||||
|
$class = ($category !='_icon') ? "media-select-image" : "media-select-icon";
|
||||||
$media_path = e107::getParser()->replaceConstants($im['media_url'],'full');
|
$media_path = e107::getParser()->replaceConstants($im['media_url'],'full');
|
||||||
$realPath = e107::getParser()->thumbUrl($im['media_url'], $att);
|
$realPath = e107::getParser()->thumbUrl($im['media_url'], $att);
|
||||||
$diz = e107::getParser()->toAttribute($im['media_title']);
|
$diz = e107::getParser()->toAttribute($im['media_title']);
|
||||||
|
@@ -1060,7 +1060,7 @@ class e_userperms
|
|||||||
$id = "id_".$uniqueID;
|
$id = "id_".$uniqueID;
|
||||||
|
|
||||||
|
|
||||||
$text = "<div onclick=\"e107Helper.toggle('id_{$id}')\" class='e-pointer' title='".ADMSLAN_71."'>{$perms}</div>\n";
|
$text = "<div href='#id_{$id}' class='e-pointer e-expandit' title='".ADMSLAN_71."'>{$perms}</div>\n";
|
||||||
|
|
||||||
if(varset($ptext))
|
if(varset($ptext))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user