mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Added support for bootstrap glyphs (see admin-> Site-links icon for example)
This commit is contained in:
@@ -994,10 +994,6 @@ class media_admin_ui extends e_admin_ui
|
||||
$options = array();
|
||||
$options['bbcode'] = ($this->getQuery('bbcode')=='img') ? 'img' : FALSE;
|
||||
|
||||
if($this->getQuery('for') == '_icon')
|
||||
{
|
||||
// $options['glyphs'] = true;
|
||||
}
|
||||
|
||||
$text = "
|
||||
|
||||
@@ -1010,7 +1006,7 @@ class media_admin_ui extends e_admin_ui
|
||||
$text .= "<li><a data-toggle='tab' href='#core-media-style'>Appearance</a></li>\n";
|
||||
}
|
||||
|
||||
if(varset($options['glyphs']))
|
||||
if($this->getQuery('glyphs') == 1)
|
||||
{
|
||||
$text .= "<li><a data-toggle='tab' href='#core-media-glyphs'>Glyphs</a></li>\n";
|
||||
}
|
||||
@@ -1137,14 +1133,21 @@ class media_admin_ui extends e_admin_ui
|
||||
</div>";
|
||||
}
|
||||
|
||||
if(varset($options['glyphs']))
|
||||
if($this->getQuery('glyphs') == 1)
|
||||
{
|
||||
//TODO
|
||||
$text .= "<div class='tab-pane' id='core-media-glyphs'>
|
||||
$text .= "<div class='tab-pane clearfix' id='core-media-glyphs' style='font-size:24px'>";
|
||||
$glyphs = e107::getMedia()->getGlyphs();
|
||||
|
||||
foreach($glyphs as $val)
|
||||
{
|
||||
$text .= "<a data-toggle='context' class='e-media-select e-dialog-close e-tip' data-id='{$im['media_id']}' data-width='32' data-height='32' data-src='{$val}' data-type='glyph' data-bbcode='{$data_bb}' data-target='".$this->getQuery('tagid')."' data-path='{$val}.glyph' data-preview='{$val}.glyph' title='".$val."' style='float:left' href='#' >";
|
||||
$text .= "<span style='margin:7px;display:inline-block'><i class='".$val."' style='color:white' ></i></span>";
|
||||
$text .= "</a>\n\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
$text .= "</div>
|
||||
";
|
||||
|
||||
|
||||
@@ -1153,7 +1156,8 @@ class media_admin_ui extends e_admin_ui
|
||||
$text .= "</div>";
|
||||
|
||||
// For BBCODE mode. //TODO image-float.
|
||||
if($options['bbcode'])
|
||||
|
||||
if($options['bbcode'] || E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
|
||||
|
||||
@@ -1184,9 +1188,7 @@ class media_admin_ui extends e_admin_ui
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function importPage()
|
||||
|
@@ -78,7 +78,7 @@ class links_admin_ui extends e_admin_ui
|
||||
|
||||
protected $fields = array(
|
||||
'checkboxes' => array('title'=> '', 'width' => '3%','forced' => true, 'thclass' => 'center first','class' => 'center first'),
|
||||
'link_button' => array('title'=> LAN_ICON, 'type'=>'icon', 'width'=>'5%', 'thclass' => 'center', 'class'=>'center'),
|
||||
'link_button' => array('title'=> LAN_ICON, 'type'=>'icon', 'width'=>'5%', 'thclass' => 'center', 'class'=>'center', 'writeParms'=>'glyphs=1'),
|
||||
'link_id' => array('title'=> LAN_ID, 'type'=>'text','readParms'=>'link=link_url&target=dialog','noedit'=>TRUE),
|
||||
'link_name' => array('title'=> LCLAN_15, 'width'=>'auto','type'=>'text', 'inline'=>true, 'required' => true, 'validate' => true),
|
||||
'link_category' => array('title'=> LAN_TEMPLATE, 'type' => 'dropdown', 'inline'=>true, 'batch'=>true, 'filter'=>true, 'width' => 'auto'),
|
||||
|
@@ -1549,7 +1549,6 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
||||
{
|
||||
$catid = $admin_cat['id'][$subitem[4]];
|
||||
$tmp = array();
|
||||
|
||||
$tmp['text'] = $subitem[1];
|
||||
$tmp['description'] = $subitem[2];
|
||||
$tmp['link'] = $subitem[0];
|
||||
@@ -1749,7 +1748,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
||||
$tmp[$c]['link'] = $tp->replaceConstants($link,'full');
|
||||
$tmp[$c]['image'] = vartrue($lk['link_button']) ? "<img class='icon S16' src='".$tp->replaceConstants($lk['link_button'])."' alt='".$tp->toAttribute($lk['link_description'],'','defs')."' />": "" ;
|
||||
$tmp[$c]['image_large'] = '';
|
||||
$tmp[$c]['image_src'] = '';
|
||||
$tmp[$c]['image_src'] = vartrue($lk['link_button']);
|
||||
$tmp[$c]['image_large_src'] = '';
|
||||
$tmp[$c]['perm'] = '';
|
||||
$c++;
|
||||
|
@@ -23,7 +23,7 @@ $NAVIGATION_TEMPLATE['main']['item'] = '
|
||||
$NAVIGATION_TEMPLATE['main']['item_submenu'] = '
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}" >
|
||||
{LINK_NAME}
|
||||
{LINK_IMAGE}{LINK_NAME}
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
{LINK_SUB}
|
||||
@@ -33,7 +33,7 @@ $NAVIGATION_TEMPLATE['main']['item_submenu'] = '
|
||||
$NAVIGATION_TEMPLATE['main']['item_submenu_active'] = '
|
||||
<li class="dropdown active">
|
||||
<a class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}">
|
||||
{LINK_IMAGE} {LINK_NAME}
|
||||
{LINK_IMAGE}{LINK_NAME}
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
{LINK_SUB}
|
||||
|
@@ -2430,6 +2430,10 @@ class e_parse extends e_parser
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given an email address, returns a link including js-based obfuscation
|
||||
*/
|
||||
@@ -2609,11 +2613,30 @@ class e_parser
|
||||
|
||||
|
||||
|
||||
// Parse i_xxxx to bootstrap glyph format.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Parse xxxxx.glyph file to bootstrap glyph format.
|
||||
* @return FALSE if not a glyph file or if bootstrap is not found.
|
||||
*/
|
||||
public function glyph($text)
|
||||
{
|
||||
$text = preg_replace('/\[(i_[\w]*)\]/',"<i class='$1'></i>", $text);
|
||||
return $text;
|
||||
if(!deftrue('BOOTSTRAP'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(substr($text,-6) == '.glyph') // Bootstrap or Font-Awesome.
|
||||
{
|
||||
list($cls,$tmp) = explode('.glyph',$text);
|
||||
return "<i class='".$cls."'></i> "; // retain space.
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
//$text = preg_replace('/\[(i_[\w]*)\]/',"<i class='$1'></i>", $text);
|
||||
// return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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 .= "&w=".$extras['w'];
|
||||
}
|
||||
|
||||
|
||||
if(vartrue($extras['glyphs']))
|
||||
{
|
||||
$url .= "&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':
|
||||
|
@@ -659,10 +659,10 @@ class e_media
|
||||
$repl = array($im['media_url'],$media_path);
|
||||
|
||||
if($bbcode == null) // e107 Media Manager
|
||||
{
|
||||
{
|
||||
$onclicki = "parent.document.getElementById('{$tagid}').value = '{$im['media_url']}';
|
||||
parent.document.getElementById('".$prevId."').src = '{$realPath}';
|
||||
return false;";
|
||||
parent.document.getElementById('".$prevId."').src = '{$realPath}';
|
||||
return false;";
|
||||
//$onclicki = "";
|
||||
$class .= " e-media-select e-dialog-close";
|
||||
}
|
||||
@@ -753,6 +753,162 @@ class e_media
|
||||
|
||||
return $newpath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getGlyphs()
|
||||
{
|
||||
$icons = array(
|
||||
"icon-glass",
|
||||
"icon-music",
|
||||
"icon-search",
|
||||
"icon-envelope",
|
||||
"icon-heart",
|
||||
"icon-star",
|
||||
"icon-star-empty",
|
||||
"icon-user",
|
||||
"icon-film",
|
||||
"icon-th-large",
|
||||
"icon-th",
|
||||
"icon-th-list",
|
||||
"icon-ok",
|
||||
"icon-remove",
|
||||
"icon-zoom-in",
|
||||
"icon-zoom-out",
|
||||
"icon-off",
|
||||
"icon-signal",
|
||||
"icon-cog",
|
||||
"icon-trash",
|
||||
"icon-home",
|
||||
"icon-file",
|
||||
"icon-time",
|
||||
"icon-road",
|
||||
"icon-download-alt",
|
||||
"icon-download",
|
||||
"icon-upload",
|
||||
"icon-inbox",
|
||||
"icon-play-circle",
|
||||
"icon-repeat",
|
||||
"icon-refresh",
|
||||
"icon-list-alt",
|
||||
"icon-lock",
|
||||
"icon-flag",
|
||||
"icon-headphones",
|
||||
"icon-volume-off",
|
||||
"icon-volume-down",
|
||||
"icon-volume-up",
|
||||
"icon-qrcode",
|
||||
"icon-barcode",
|
||||
"icon-tag",
|
||||
"icon-tags",
|
||||
"icon-book",
|
||||
"icon-bookmark",
|
||||
"icon-print",
|
||||
"icon-camera",
|
||||
"icon-font",
|
||||
"icon-bold",
|
||||
"icon-italic",
|
||||
"icon-text-height",
|
||||
"icon-text-width",
|
||||
"icon-align-left",
|
||||
"icon-align-center",
|
||||
"icon-align-right",
|
||||
"icon-align-justify",
|
||||
"icon-list",
|
||||
|
||||
"icon-indent-left",
|
||||
"icon-indent-right",
|
||||
"icon-facetime-video",
|
||||
"icon-picture",
|
||||
"icon-pencil",
|
||||
"icon-map-marker",
|
||||
"icon-adjust",
|
||||
"icon-tint",
|
||||
"icon-edit",
|
||||
"icon-share",
|
||||
"icon-check",
|
||||
"icon-move",
|
||||
"icon-step-backward",
|
||||
"icon-fast-backward",
|
||||
"icon-backward",
|
||||
"icon-play",
|
||||
"icon-pause",
|
||||
"icon-stop",
|
||||
"icon-forward",
|
||||
"icon-fast-forward",
|
||||
"icon-step-forward",
|
||||
"icon-eject",
|
||||
"icon-chevron-left",
|
||||
"icon-chevron-right",
|
||||
"icon-plus-sign",
|
||||
"icon-minus-sign",
|
||||
"icon-remove-sign",
|
||||
"icon-ok-sign",
|
||||
|
||||
"icon-question-sign",
|
||||
"icon-info-sign",
|
||||
"icon-screenshot",
|
||||
"icon-remove-circle",
|
||||
"icon-ok-circle",
|
||||
"icon-ban-circle",
|
||||
"icon-arrow-left",
|
||||
"icon-arrow-right",
|
||||
"icon-arrow-up",
|
||||
"icon-arrow-down",
|
||||
"icon-share-alt",
|
||||
"icon-resize-full",
|
||||
"icon-resize-small",
|
||||
"icon-plus",
|
||||
"icon-minus",
|
||||
"icon-asterisk",
|
||||
"icon-exclamation-sign",
|
||||
"icon-gift",
|
||||
"icon-leaf",
|
||||
"icon-fire",
|
||||
"icon-eye-open",
|
||||
"icon-eye-close",
|
||||
"icon-warning-sign",
|
||||
"icon-plane",
|
||||
"icon-calendar",
|
||||
"icon-random",
|
||||
"icon-comment",
|
||||
"icon-magnet",
|
||||
|
||||
"icon-chevron-up",
|
||||
"icon-chevron-down",
|
||||
"icon-retweet",
|
||||
"icon-shopping-cart",
|
||||
"icon-folder-close",
|
||||
"icon-folder-open",
|
||||
"icon-resize-vertical",
|
||||
"icon-resize-horizontal",
|
||||
"icon-hdd",
|
||||
"icon-bullhorn",
|
||||
"icon-bell",
|
||||
"icon-certificate",
|
||||
"icon-thumbs-up",
|
||||
"icon-thumbs-down",
|
||||
"icon-hand-right",
|
||||
"icon-hand-left",
|
||||
"icon-hand-up",
|
||||
"icon-hand-down",
|
||||
"icon-circle-arrow-right",
|
||||
"icon-circle-arrow-left",
|
||||
"icon-circle-arrow-up",
|
||||
"icon-circle-arrow-down",
|
||||
"icon-globe",
|
||||
"icon-wrench",
|
||||
"icon-tasks",
|
||||
"icon-filter",
|
||||
"icon-briefcase",
|
||||
"icon-fullscreen"
|
||||
);
|
||||
|
||||
return $icons;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getPath($mime)
|
||||
|
@@ -1058,6 +1058,8 @@ class e_navigation
|
||||
{
|
||||
|
||||
global $E_ADMIN_MENU; //TODO remove me?
|
||||
$tp = e107::getParser();
|
||||
|
||||
if (!$tmpl)
|
||||
$tmpl = $E_ADMIN_MENU;
|
||||
|
||||
@@ -1213,7 +1215,16 @@ class e_navigation
|
||||
|
||||
$replace[7] = varset($e107_vars[$act]['link_class']);
|
||||
$replace[8] = '';
|
||||
$replace[9] = varset($e107_vars[$act]['image']);
|
||||
|
||||
if(vartrue($e107_vars[$act]['image_src']) && strstr($e107_vars[$act]['image_src'],'.glyph'))
|
||||
{
|
||||
$replace[9] = $tp->glyph($e107_vars[$act]['image_src']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$replace[9] = varset($e107_vars[$act]['image']);
|
||||
}
|
||||
|
||||
|
||||
if($rid == 'logout' || $rid == 'home' || $rid == 'language')
|
||||
{
|
||||
@@ -1605,8 +1616,22 @@ class navigation_shortcodes extends e_shortcode
|
||||
*/
|
||||
function sc_link_image($parm='')
|
||||
{
|
||||
if (!vartrue($this->var['link_image'])) return '';
|
||||
return e107::getParser()->replaceConstants($this->var['link_image'], 'full', TRUE);
|
||||
$tp = e107::getParser();
|
||||
|
||||
if (!vartrue($this->var['link_button'])) return '';
|
||||
|
||||
if($icon = $tp->glyph($this->var['link_button']))
|
||||
{
|
||||
return $icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = e107::getParser()->replaceConstants($this->var['link_button'], 'full', TRUE);
|
||||
return "<img src='".$path."' alt='' />";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -7,6 +7,7 @@ define("SEP"," <i class='icon-play e-breadcrumb'></i> ");
|
||||
e107::js('core','bootstrap/js/bootstrap.min.js');
|
||||
e107::css('core','bootstrap/css/bootstrap.min.css');
|
||||
e107::css('core','bootstrap/css/bootstrap-responsive.min.css');
|
||||
e107::css('url', "//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css");
|
||||
// e107::css('core','bootstrap/css/jquery-ui.custom.css');
|
||||
e107::css('theme','admin_style.css');
|
||||
|
||||
|
@@ -140,8 +140,9 @@ $(document).ready(function()
|
||||
var name = $(this).attr('data-name');
|
||||
var width = $(this).attr('data-width');
|
||||
var height = ''; // disable for now - will be updated by bb parser. // $(this).attr('data-height');
|
||||
|
||||
|
||||
var type = $(this).attr('data-type');
|
||||
|
||||
// return;
|
||||
// alert(width);
|
||||
|
||||
$(this).addClass("media-select-active");
|
||||
@@ -181,8 +182,26 @@ $(document).ready(function()
|
||||
$('#width').val(width);
|
||||
$('#height').val(height);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('img#' + target + "_prev", window.top.document).attr('src',preview); // set new value
|
||||
|
||||
|
||||
if(type == 'glyph')
|
||||
{
|
||||
preview = "<i class='" + src + "'></i>";
|
||||
$('#html_holder').val(preview);
|
||||
$('#path').attr('value',path);
|
||||
}
|
||||
else
|
||||
{
|
||||
eMediaAttribute(this);
|
||||
preview = $('#html_holder').val();
|
||||
}
|
||||
|
||||
|
||||
$('div#' + target + "_prev", window.top.document).html(preview); // set new value
|
||||
$('span#' + target + "_prev", window.top.document).html(preview); // set new value
|
||||
|
||||
@@ -192,7 +211,7 @@ $(document).ready(function()
|
||||
$('input#' + target , window.top.document).attr('value',path); // set new value
|
||||
}
|
||||
|
||||
eMediaAttribute(this);
|
||||
|
||||
|
||||
|
||||
// $(this).parent('#src').attr('value',preview); // set new value
|
||||
|
Reference in New Issue
Block a user