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

Added support for bootstrap glyphs (see admin-> Site-links icon for example)

This commit is contained in:
Cameron
2013-07-12 07:13:10 -07:00
parent 62f178f9bb
commit 955bb78769
10 changed files with 295 additions and 57 deletions

View File

@@ -283,33 +283,18 @@ class e_form
* @param $name
* @param $default value
* @param $label
* @param $sc_parms
* @param $options - gylphs=1
* @param $ajax
*/
function iconpicker($name, $default, $label, $sc_parameters = '', $ajax = true)
function iconpicker($name, $default, $label, $options = array(), $ajax = true)
{
// TODO - Hide the <input type='text'> element, and display the icon itself after it has been chosen.
// eg. <img id='iconview' src='".$img."' style='border:0; ".$blank_display."' alt='' />
// The button itself could be replaced with an icon just for this purpose.
return $this->imagepicker($name, $default, $label, 'media=_icon');
/*
$e107 = e107::getInstance();
$id = $this->name2id($name);
$sc_parameters .= '&id='.$id;
$jsfunc = $ajax ? "e107Ajax.toggleUpdate('{$id}-iconpicker', '{$id}-iconpicker-cn', 'sc:iconpicker=".urlencode($sc_parameters)."', '{$id}-iconpicker-ajax', { overlayElement: '{$id}-iconpicker-button' })" : "e107Helper.toggle('{$id}-iconpicker')";
$ret = $this->text($name, $default);
// $ret .= $this->iconpreview($id,$default); //FIXME
$ret .= $this->admin_button($name.'-iconpicker-button', $label, 'action', '', array('other' => "onclick=\"{$jsfunc}\""));
$ret .= "
<div id='{$id}-iconpicker' class='e-hideme'>
<div class='expand-container' id='{$id}-iconpicker-cn'>
".(!$ajax ? $tp->parseTemplate('{ICONPICKER='.$sc_parameters.'}') : '')."
</div>
</div>
";
return $ret;
*/
$options['media'] = '_icon';
return $this->imagepicker($name, $default, $label, $options);
}
/**
@@ -341,7 +326,11 @@ class e_form
{
$url .= "&amp;w=".$extras['w'];
}
if(vartrue($extras['glyphs']))
{
$url .= "&amp;glyphs=1";
}
$title = "Media Manager : ".$category;
@@ -531,8 +520,24 @@ class e_form
{
$ret = "<div class='imgselector-container' style='display:block;width:64px;min-height:64px'>";
$thpath = isset($sc_parameters['nothumb']) || vartrue($hide) ? $default : $default_thumb;
$style = ($blank) ? "width:64px;height:64px" : "";
$label = "<img id='{$name_id}_prev' src='{$default_url}' alt='{$default_url}' class='well well-small image-selector' style='{$style}' />";
$style = ($blank) ? "width:64px;height:64px;font-size:32px;" : "font-size:32px;";
$label = "<div id='{$name_id}_prev' class='text-center well well-small image-selector' style='{$style}'>";
if($glyph = $tp->glyph($default_url))
{
$label .= $glyph;
}
else
{
$label .= "<img src='{$default_url}' alt='{$default_url}' />";
}
$label .= "
</div>";
// $label = "<img id='{$name_id}_prev' src='{$default_url}' alt='{$default_url}' class='well well-small image-selector' style='{$style}' />";
}
else // Images
@@ -2608,7 +2613,15 @@ class e_form
break;
case 'icon':
$value = '<img src="'.$tp->replaceConstants(vartrue($parms['pre']).$value, 'abs').'" alt="'.basename($value).'" class="icon'.(vartrue($parms['class']) ? ' '.$parms['class'] : '').'" />';
if($glyph = $tp->glyph($value))
{
$value = $glyph;
}
else
{
$value = '<img src="'.$tp->replaceConstants(vartrue($parms['pre']).$value, 'abs').'" alt="'.basename($value).'" class="icon'.(vartrue($parms['class']) ? ' '.$parms['class'] : '').'" />';
}
break;
case 'file':