1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

fixes #1412 implemented a forum image/icon which is displayed in front

of the forum name. Displaysize of the image can be defined in the
templates.
This commit is contained in:
Achim Ennenbach 2018-08-14 13:52:39 +02:00
parent acfaf2df8e
commit 7ddb9a44db
7 changed files with 69 additions and 26 deletions

View File

@ -136,26 +136,27 @@ if(!deftrue('OLD_FORUMADMIN'))
protected $fields = array (
'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
'forum_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_name' => array ( 'title' => LAN_TITLE, 'type' => 'method', 'inline'=>true, 'data' => 'str', 'width' => '40%', 'help' => FORLAN_223, 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_sef' => array ( 'title' => LAN_SEFURL, 'type' => 'text', 'batch'=>true, 'inline'=>true, 'noedit'=>false, 'data' => 'str', 'width' => 'auto', 'help' => 'Leave blank to auto-generate it from the title above.', 'readParms' => '', 'writeParms' => 'sef=forum_name&size=xxlarge', 'class' => 'left', 'thclass' => 'left', ),
'forum_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'textarea', 'data' => 'str', 'width' => '30%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_name' => array ( 'title' => LAN_TITLE, 'type' => 'method', 'inline'=>true, 'data' => 'str', 'width' => '40%', 'help' => FORLAN_223, 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_sef' => array ( 'title' => LAN_SEFURL, 'type' => 'text', 'batch'=>true, 'inline'=>true, 'noedit'=>false, 'data' => 'str', 'width' => 'auto', 'help' => 'Leave blank to auto-generate it from the title above.', 'readParms' => '', 'writeParms' => 'sef=forum_name&size=xxlarge', 'class' => 'left', 'thclass' => 'left', ),
'forum_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'textarea', 'data' => 'str', 'width' => '30%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_image' => array ( 'title' => LAN_ICON, 'type' => 'image', 'batch'=>false, 'inline'=>false, 'noedit'=>false, 'data' => 'str', 'width' => 'auto', 'help' => 'Will be displayed next to the forum name', 'readParms' => '', 'writeParms' => 'media=forum&max=1', 'class' => 'center', 'thclass' => 'center', ),
'forum_parent' => array ( 'title' => FORLAN_75, 'type' => 'dropdown', 'data' => 'int', 'width' => '10%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_sub' => array ( 'title' => LAN_FORUM_1002, 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'center', 'thclass' => 'center', ),
'forum_moderators' => array ( 'title' => LAN_FORUM_2003, 'type' => 'userclass', 'inline'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => 'classlist=admin,main,classes', 'writeParms' => "classlist=admin,main,mods,classes", 'class' => 'left', 'thclass' => 'left', ),
'forum_threads' => array ( 'title' => LAN_FORUM_1003, 'type' => 'number', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_replies' => array ( 'title' => LAN_FORUM_0003, 'type' => 'number', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_lastpost_user' => array ( 'title' => LAN_AUTHOR, 'type' => 'hidden', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_lastpost_user_anon' => array ( 'title' => FORLAN_204, 'type' => 'hidden','noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_lastpost_info' => array ( 'title' => LAN_PLUGIN_FORUM_LATESTPOSTS, 'type' => 'hidden', 'noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_class' => array ( 'title' => LAN_VISIBILITY, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'inline' => true, 'help' => '', 'readParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'writeParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'class' => 'left', 'thclass' => 'left', ),
'forum_order' => array ( 'title' => LAN_ORDER, 'type' => 'text', 'data' => 'int', 'inline'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_postclass' => array ( 'title' => FORLAN_205, 'type' => 'userclass', 'inline'=>true,'filter'=>true, 'batch'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'writeParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'class' => 'center', 'thclass' => 'center', ),
'forum_threadclass' => array ( 'title' => FORLAN_206, 'type' => 'userclass', 'inline'=>true, 'filter'=>true, 'batch'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'writeParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'class' => 'center', 'thclass' => 'center', ),
'forum_datestamp' => array ( 'title' => LAN_DATESTAMP, 'type' => 'datestamp', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'right', 'thclass' => 'center', ),
// 'Sort' => array ( 'title' => 'Sort', 'type' => 'text', 'data' => 'str', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_options' => array ( 'title' => LAN_OPTIONS, 'type' => 'hidden', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', 'sort'=>1 ),
'forum_sub' => array ( 'title' => LAN_FORUM_1002, 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'center', 'thclass' => 'center', ),
'forum_moderators' => array ( 'title' => LAN_FORUM_2003, 'type' => 'userclass', 'inline'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => 'classlist=admin,main,classes', 'writeParms' => "classlist=admin,main,mods,classes", 'class' => 'left', 'thclass' => 'left', ),
'forum_threads' => array ( 'title' => LAN_FORUM_1003, 'type' => 'number', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_replies' => array ( 'title' => LAN_FORUM_0003, 'type' => 'number', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_lastpost_user' => array ( 'title' => LAN_AUTHOR, 'type' => 'hidden', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_lastpost_user_anon' => array ( 'title' => FORLAN_204, 'type' => 'hidden','noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_lastpost_info' => array ( 'title' => LAN_PLUGIN_FORUM_LATESTPOSTS, 'type' => 'hidden', 'noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_class' => array ( 'title' => LAN_VISIBILITY, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'inline' => true, 'help' => '', 'readParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'writeParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'class' => 'left', 'thclass' => 'left', ),
'forum_order' => array ( 'title' => LAN_ORDER, 'type' => 'text', 'data' => 'int', 'inline'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_postclass' => array ( 'title' => FORLAN_205, 'type' => 'userclass', 'inline'=>true,'filter'=>true, 'batch'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'writeParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'class' => 'center', 'thclass' => 'center', ),
'forum_threadclass' => array ( 'title' => FORLAN_206, 'type' => 'userclass', 'inline'=>true, 'filter'=>true, 'batch'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'writeParms' => array('classlist'=>'public,guest,nobody,member,admin,main,new,mods,classes'), 'class' => 'center', 'thclass' => 'center', ),
'forum_datestamp' => array ( 'title' => LAN_DATESTAMP, 'type' => 'datestamp', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'right', 'thclass' => 'center', ),
// 'Sort' => array ( 'title' => 'Sort', 'type' => 'text', 'data' => 'str', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'forum_options' => array ( 'title' => LAN_OPTIONS, 'type' => 'hidden', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', 'sort'=>1 ),
);
protected $fieldpref = array('forum_name', 'forum_parent', 'Sort', 'forum_description', 'forum_class', 'forum_postclass', 'forum_threadclass', 'forum_order');

View File

@ -2,6 +2,7 @@ CREATE TABLE forum (
`forum_id` int(10) unsigned NOT NULL auto_increment,
`forum_name` varchar(250) NOT NULL default '',
`forum_description` text,
`forum_image` varchar(250) DEFAULT NULL,
`forum_parent` int(10) unsigned NOT NULL default '0',
`forum_sub` int(10) unsigned NOT NULL default '0',
`forum_datestamp` int(10) unsigned NOT NULL default '0',

View File

@ -336,6 +336,7 @@ $fVars->MODERATORS = LAN_FORUM_1009.': '.implode(', ', $modUser);
$fVars->BROWSERS = '';
--*/
$forumSCvars['forum_name']= $forumInfo['forum_name'];
$forumSCvars['forum_image']= $forumInfo['forum_image'];
$forumSCvars['modUser']= $modUser;
$forumSCvars['track_online']= varset($pref['track_online']);

View File

@ -328,6 +328,16 @@ class forum_shortcodes extends e_shortcode
}
function sc_parentimage($parms=null)
{
if (empty($this->var['forum_image'])) return '';
if (!empty($parms) && !is_array($parms)) parse_str($parms, $parms);
if (empty($parms)) $parms = array();
$parms = array_merge(array('class'=>'img-fluid', 'h' => 50), $parms);
$text = e107::getParser()->toImage($this->var['forum_image'], $parms);
return $text.' ';
}
function sc_parentname()
{
return $this->var['forum_name'];
@ -362,10 +372,20 @@ class forum_shortcodes extends e_shortcode
}
function sc_forumimage($parms=null)
{
if(empty($this->var['forum_image'])) return '';
if (!empty($parms) && !is_array($parms)) parse_str($parms, $parms);
if (empty($parms)) $parms = array();
$parms = array_merge(array('class'=>'img-fluid', 'h' => 50), $parms);
$text = e107::getParser()->toImage($this->var['forum_image'], $parms);
return "<a href='".e107::url('forum', 'forum', $this->var)."'>{$text}</a>&nbsp;";
}
function sc_forumname()
{
// global $f;
// $tp = e107::getParser();
if(substr($this->var['forum_name'], 0, 1) == '*')
{
$this->var['forum_name'] = substr($this->var['forum_name'], 1);

View File

@ -140,6 +140,16 @@
return $this->var['forum_crumb'];
}
function sc_forumimage($parms=null)
{
if(empty($this->var['forum_image'])) return '';
if (!empty($parms) && !is_array($parms)) parse_str($parms, $parms);
if (empty($parms)) $parms = array();
$parms = array_merge(array('class'=>'img-fluid', 'h' => 50), $parms);
$text = e107::getParser()->toImage($this->var['forum_image'], $parms);
return $text."&nbsp;";
}
function sc_forumtitle()
{
return $this->var['forum_name'];
@ -485,6 +495,16 @@
------*/
function sc_sub_forumimage($parms=null)
{
if(empty($this->var['forum_image'])) return '';
if (!empty($parms) && !is_array($parms)) parse_str($parms, $parms);
if (empty($parms)) $parms = array();
$parms = array_merge(array('class'=>'img-fluid', 'h' => 50), $parms);
$text = e107::getParser()->toImage($this->var['forum_image'], $parms);
return "<a href='".e107::url('forum', 'forum', $this->var)."'>{$text}</a>&nbsp;";
}
function sc_sub_forumtitle()
{
$forumName = e107::getParser()->toHTML($this->var['forum_name'], true);

View File

@ -121,7 +121,7 @@ $FORUM_TEMPLATE['main']['start'] = "{FORUM_BREADCRUMB}
</tr>";
$FORUM_TEMPLATE['main']['parent'] = "<tr class='forum-parent'>
<th colspan='2'>{PARENTNAME} {PARENTSTATUS}</th>
<th colspan='2'>{PARENTIMAGE:h=50}{PARENTNAME} {PARENTSTATUS}</th>
<th class='hidden-xs text-center'>".LAN_FORUM_0003."</th>
<th class='text-center'>".LAN_FORUM_0002."</th>
<th class='hidden-xs text-center'>".LAN_FORUM_0004."</th>
@ -131,7 +131,7 @@ $FORUM_TEMPLATE['main']['parent'] = "<tr class='forum-parent'>
$FORUM_TEMPLATE['main']['forum'] = "<tr>
<td>{NEWFLAG}</td>
<td>{FORUMNAME}<br /><small>{FORUMDESCRIPTION}</small>{FORUMSUBFORUMS}</td>
<td>{FORUMIMAGE:h=50}{FORUMNAME}<br /><small>{FORUMDESCRIPTION}</small>{FORUMSUBFORUMS}</td>
<td class='hidden-xs text-center'>{REPLIESX}</td>
<td class='text-center'>{THREADSX}</td>
<td class='hidden-xs text-center'><small>{LASTPOST:type=username} {LASTPOST:type=datelink}</small></td>

View File

@ -270,7 +270,7 @@ $FORUM_CRUMB['sitename']['sep'] = " :: ";
$FORUM_CRUMB['forums']['value'] = "<a class='forumlink' href='{FORUMS_HREF}'>{FORUMS_TITLE}</a>";
$FORUM_CRUMB['forums']['sep'] = " :: ";
$FORUM_CRUMB['parent']['value'] = "<a class='forumlink' href='{PARENT_HREF}'>{PARENT_TITLE}</a>";
$FORUM_CRUMB['parent']['value'] = "<a class='forumlink' href='{PARENT_HREF}'>{PARENT_TITLE}</a>";
$FORUM_CRUMB['parent']['sep'] = " :: ";
$FORUM_CRUMB['subparent']['value'] = "<a class='forumlink' href='{SUBPARENT_HREF}'>{SUBPARENT_TITLE}</a>";
@ -288,7 +288,7 @@ $FORUM_VIEWFORUM_TEMPLATE['caption'] = "";
$FORUM_VIEWFORUM_TEMPLATE['start'] = "<div id='forum-viewforum'>";
$FORUM_VIEWFORUM_TEMPLATE['header'] = "<div class=' row-fluid'><div>{BREADCRUMB}</div></div>
<div class='row row-fluid'>
<div class='col-md-9 span9 pull-left'><h3>{FORUMTITLE}</h3></div>
<div class='col-md-9 span9 pull-left'><h3>{FORUMIMAGE:h=60}{FORUMTITLE}</h3></div>
<div class='col-md-3 span3 pull-right right' style='padding-top:10px'>{NEWTHREADBUTTONX}</div></div>
<table class='table table-hover table-striped table-bordered'>
<colgroup>
@ -329,7 +329,7 @@ $FORUM_VIEWFORUM_TEMPLATE['sub-header'] = "<tr>
</tr>";
$FORUM_VIEWFORUM_TEMPLATE['sub-item'] = "<tr><td>{NEWFLAG}</td>
<td><div>{SUB_FORUMTITLE}</div><small>{SUB_DESCRIPTION}</small></td>
<td><div>{SUB_FORUMIMAGE:h=50}{SUB_FORUMTITLE}</div><small>{SUB_DESCRIPTION}</small></td>
<td class='text-center'>{SUB_REPLIESX}</td>
<td class='hidden-xs text-center'>{SUB_THREADSX}</td>
<td class='hidden-xs'><small>{SUB_LASTPOSTUSER} {SUB_LASTPOSTDATE}</small></td>