1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

bbcode for adding local images now retrieving images from media-manager.

This commit is contained in:
CaMer0n
2011-05-05 11:30:00 +00:00
parent f0f20dae7a
commit 4113e8801d
4 changed files with 71 additions and 24 deletions

View File

@@ -402,6 +402,9 @@ class e_form
return "<textarea name='{$name}' rows='{$rows}' cols='{$cols}'".$this->get_attributes($options, $name).">{$value}</textarea>".(false !== $counter ? $this->hidden('__'.$name.'autoheight_opt', $counter) : '');
}
/**
* Bbcode Area. Name, value, help_mode, form-id, size, counter
*/
function bbarea($name, $value, $help_mod = '', $help_tagid='', $size = 'large', $counter = false)
{
//size - large|medium|small

View File

@@ -20,6 +20,8 @@ if (!defined('e107_INIT')) { exit; }
class e_media
{
var $imagelist = array();
/**
* Import files from specified path into media database.
* @param string $cat Category nickname
@@ -218,6 +220,46 @@ class e_media
{
// TODO
}
/**
* Generate Simple Thumbnail window for image-selection
* TODO Use Whole-page popup window
* TODO Add an upload Tab?.
* TODO Real-time ajax filter by keyword
*/
public function imageSelect($cat,$formid='imageSel')
{
$sql = e107::getDb();
$tp = e107::getParser();
$text .= "<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
$text .="<div style='-moz-box-shadow: 3px 3px 3px #808080;
-webkit-box-shadow: 3px 3px 3px #808080;
box-shadow: 3px 3px 3px #808080;
background-color:black;border:1px solid black;position:absolute; height:200px;width:205px;overflow-y:scroll; bottom:30px; right:100px'>";
$total = ($sql->db_Select_gen("SELECT * FROM `#core_media` WHERE media_category = '_common' OR media_category = '".$cat."' ORDER BY media_category,media_datestamp DESC ")) ? TRUE : FALSE;
$text .= "<div style='font-size:120%;font-weight:bold;text-align:right;margin-right:10px'><a title='Close' style='text-decoration:none;color:white' href=\"javascript:expandit('{$formid}')\" >x</div>";
while ($row = $sql->db_Fetch())
{
$image = $row['media_url'];
$diz = $row['media_name']." : ". $row['media_dimensions'];
$insert = "[img]".$image."[/img]";
$text .= "
<div style='border:1px solid silver;margin:5px;width:50px;height:50px;overflow:hidden;float:left'>
<a title=\"".$diz."\" href=\"javascript:addtext('".$insert."', true); expandit('{$formid}')\" >
<img src='".e107::getParser()->thumbUrl($image, 'w=100', true)."' alt=\"".$diz."\" width='50px' />
</a>
</div>";
}
$text .= "</div></div>";
return $text;
}
}

View File

@@ -71,7 +71,7 @@ function display_help($tagid="helpb", $mode = 1, $addtextfunc = "addtext", $help
$temp['extended'] = $BBCODE_TEMPLATE_NEWSPOST;
$temp['admin'] = $BBCODE_TEMPLATE_ADMIN;
$temp['mailout'] = $BBCODE_TEMPLATE_MAILOUT;
$temp['cpage'] = $BBCODE_TEMPLATE_CPAGE;
$temp['page'] = $BBCODE_TEMPLATE_CPAGE;
$temp['maintenance']= $BBCODE_TEMPLATE_ADMIN;
$temp['comment'] = "{BB_HELP}<br />".$BBCODE_TEMPLATE;
@@ -182,25 +182,24 @@ function Color_Select($formid='col_selector') {
}
function PreImage_Select($formid) {
global $fl, $tp, $bbcode_imagedir;
$path = ($bbcode_imagedir) ? $bbcode_imagedir : e_IMAGE."newspost_images/";
$formid = ($formid) ? ($formid) : "preimage_selector";
if(!is_object($fl)){
require_once(e_HANDLER."file_class.php");
$fl = new e_file;
}
// $rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
$imagelist = $fl->get_files($path,'','standard',2);
sort($imagelist);
$text ="<!-- Start of PreImage selector -->
<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
$text .="<div style='position:absolute; bottom:30px; right:100px'>";
function PreImage_Select($formid='preimage_selector')
{
global $bbcode_imagedir;
$med = e107::getMedia();
$text ="<!-- Start of PreImage selector -->";
$text .= $med->imageSelect($bbcode_imagedir,$formid);
return $text;
/*
$fl = e107::getFile();
$imagelist = $fl->get_files($path,'','standard',2);
sort($imagelist);
$text .= "<table class='fborder' style='background-color: #fff'>
<tr><td class='forumheader3' style='white-space: nowrap'>";
@@ -224,6 +223,7 @@ function PreImage_Select($formid) {
$text .="</td></tr> \n </table></div>
</div>\n<!-- End of PreImage selector -->\n";
return $text;
*/
}
@@ -236,6 +236,8 @@ function PreFile_Select($formid='prefile_selector')
global $IMAGES_DIRECTORY, $fl;
$sql = e107::getDb();
$fl = e107::getFile();
$filelist = array();
$downloadList = array();

View File

@@ -48,7 +48,7 @@ $BBCODE_TEMPLATE_ADMIN = "
<div class='field-spacer'><!-- --></div>
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=center}{BB=left}
{BB=right}{BB=bq}{BB=code}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}
{BB_PREIMAGEDIR=".e_IMAGE."}
{BB_PREIMAGEDIR}
{BB=preimage}{BB=prefile}{BB=flash}{BB=youtube}
<div class='field-spacer'><!-- --></div>
";
@@ -58,7 +58,7 @@ $BBCODE_TEMPLATE_MAILOUT = "
<div class='field-spacer'><!-- --></div>
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=center}{BB=left}
{BB=right}{BB=bq}{BB=code}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}
{BB_PREIMAGEDIR=".e_IMAGE."}
{BB_PREIMAGEDIR}
{BB=preimage}{BB=prefile}{BB=flash}{BB=shortcode}
<div class='field-spacer'><!-- --></div>
";
@@ -70,7 +70,7 @@ $BBCODE_TEMPLATE_NEWSPOST = "
<div class='field-spacer'><!-- --></div>
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=center}{BB=left}
{BB=right}{BB=bq}{BB=code}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}
{BB_PREIMAGEDIR=".e_IMAGE."newspost_images/}
{BB_PREIMAGEDIR=news}
{BB=preimage}{BB=prefile}{BB=flash}{BB=youtube}
<div class='field-spacer'><!-- --></div>
";
@@ -81,7 +81,7 @@ $BBCODE_TEMPLATE_CPAGE = "
{BB=newpage}
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=center}{BB=left}{BB=right}
{BB=bq}{BB=code}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}
{BB_PREIMAGEDIR=".e_IMAGE."custom/}
{BB_PREIMAGEDIR=page}
{BB=preimage}{BB=prefile}{BB=flash}{BB=youtube}
<div class='field-spacer'><!-- --></div>
";