mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-13 20:32:11 +02:00
Merge pull request #3896 from Zoddo/ticket/14157
[ticket/14157] Allow to set the alt/title attribute on post icons
This commit is contained in:
commit
d1b7101fed
@ -89,6 +89,9 @@
|
||||
<!-- ENDIF -->
|
||||
<td>{L_WIDTH}</td>
|
||||
<td>{L_HEIGHT}</td>
|
||||
<!-- IF not S_SMILIES -->
|
||||
<td>{L_ALT_TEXT}</td>
|
||||
<!-- ENDIF -->
|
||||
<td>{L_DISPLAY_ON_POSTING}</td>
|
||||
<!-- IF ID or S_ADD -->
|
||||
<td>{L_ORDER}</td>
|
||||
@ -102,7 +105,7 @@
|
||||
<!-- BEGIN items -->
|
||||
<tr>
|
||||
|
||||
<td style="text-align: center;"><img src="{items.IMG_SRC}" alt="" title="" /><input type="hidden" name="image[{items.IMG}]" value="1" /></td>
|
||||
<td style="text-align: center;"><img src="{items.IMG_SRC}" alt="{items.TEXT_ALT}" title="{items.TEXT_ALT}" /><input type="hidden" name="image[{items.IMG}]" value="1" /></td>
|
||||
<td style="vertical-align: top;">[{items.IMG}]</td>
|
||||
<!-- IF S_SMILIES -->
|
||||
<td><input class="text post" type="text" name="code[{items.IMG}]" value="{items.CODE}" size="10" maxlength="50" /></td>
|
||||
@ -110,6 +113,9 @@
|
||||
<!-- ENDIF -->
|
||||
<td><input class="text post" type="number" size="3" name="width[{items.IMG}]" value="{items.WIDTH}" /></td>
|
||||
<td><input class="text post" type="number" size="3" name="height[{items.IMG}]" value="{items.HEIGHT}" /></td>
|
||||
<!-- IF not S_SMILIES -->
|
||||
<td><input class="text post" type="text" name="alt[{items.IMG}]" value="{items.ALT}" size="10" maxlength="50" /></td>
|
||||
<!-- ENDIF -->
|
||||
<td>
|
||||
<input type="checkbox" class="radio" name="display_on_posting[{items.IMG}]"{items.POSTING_CHECKED} onclick="toggle_select('{items.A_IMG}', this.checked, '{items.S_ROW_COUNT}');"/>
|
||||
<!-- IF items.S_ID -->
|
||||
|
@ -248,7 +248,7 @@ class acp_icons
|
||||
$data = $_images;
|
||||
}
|
||||
|
||||
$colspan = (($mode == 'smilies') ? 7 : 5);
|
||||
$colspan = (($mode == 'smilies') ? 7 : 6);
|
||||
$colspan += ($icon_id) ? 1 : 0;
|
||||
$colspan += ($action == 'add') ? 2 : 0;
|
||||
|
||||
@ -292,6 +292,8 @@ class acp_icons
|
||||
'ID' => (isset($img_row[$fields . '_id'])) ? $img_row[$fields . '_id'] : 0,
|
||||
'WIDTH' => (!empty($img_row[$fields .'_width'])) ? $img_row[$fields .'_width'] : $img_row['width'],
|
||||
'HEIGHT' => (!empty($img_row[$fields .'_height'])) ? $img_row[$fields .'_height'] : $img_row['height'],
|
||||
'TEXT_ALT' => ($mode == 'icons' && !empty($img_row['icons_alt'])) ? $img_row['icons_alt'] : $img,
|
||||
'ALT' => ($mode == 'icons' && !empty($img_row['icons_alt'])) ? $img_row['icons_alt'] : '',
|
||||
'POSTING_CHECKED' => (!empty($img_row['display_on_posting']) || $action == 'add') ? ' checked="checked"' : '',
|
||||
));
|
||||
}
|
||||
@ -336,6 +338,7 @@ class acp_icons
|
||||
$image_add = (isset($_POST['add_img'])) ? $request->variable('add_img', array('' => 0)) : array();
|
||||
$image_emotion = $request->variable('emotion', array('' => ''), true);
|
||||
$image_code = $request->variable('code', array('' => ''), true);
|
||||
$image_alt = ($request->is_set_post('alt')) ? $request->variable('alt', array('' => ''), true) : array();
|
||||
$image_display_on_posting = (isset($_POST['display_on_posting'])) ? $request->variable('display_on_posting', array('' => 0)) : array();
|
||||
|
||||
// Ok, add the relevant bits if we are adding new codes to existing emoticons...
|
||||
@ -438,6 +441,13 @@ class acp_icons
|
||||
);
|
||||
}
|
||||
|
||||
if ($mode == 'icons')
|
||||
{
|
||||
$img_sql = array_merge($img_sql, array(
|
||||
'icons_alt' => $image_alt[$image])
|
||||
);
|
||||
}
|
||||
|
||||
// Image_order holds the 'new' order value
|
||||
if (!empty($image_order[$image]))
|
||||
{
|
||||
@ -921,7 +931,7 @@ class acp_icons
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$alt_text = ($mode == 'smilies') ? $row['code'] : '';
|
||||
$alt_text = ($mode == 'smilies') ? $row['code'] : (($mode == 'icons' && !empty($row['icons_alt'])) ? $row['icons_alt'] : $row['icons_url']);
|
||||
|
||||
$template->assign_block_vars('items', array(
|
||||
'S_SPACER' => (!$spacer && !$row['display_on_posting']) ? true : false,
|
||||
|
@ -311,10 +311,10 @@ function posting_gen_topic_icons($mode, $icon_id)
|
||||
{
|
||||
$template->assign_block_vars('topic_icon', array(
|
||||
'ICON_ID' => $id,
|
||||
'ICON_NAME' => $data['img'],
|
||||
'ICON_IMG' => $root_path . $config['icons_path'] . '/' . $data['img'],
|
||||
'ICON_WIDTH' => $data['width'],
|
||||
'ICON_HEIGHT' => $data['height'],
|
||||
'ICON_ALT' => $data['alt'],
|
||||
|
||||
'S_CHECKED' => ($id == $icon_id) ? true : false,
|
||||
'S_ICON_CHECKED' => ($id == $icon_id) ? ' checked="checked"' : '')
|
||||
|
@ -83,6 +83,7 @@ $lang = array_merge($lang, array(
|
||||
'ALL_POSTS' => 'All posts',
|
||||
'ALL_TIMES' => 'All times are <span title="%2$s">%1$s</span>',
|
||||
'ALL_TOPICS' => 'All Topics',
|
||||
'ALT_TEXT' => 'Alternative text',
|
||||
'AND' => 'And',
|
||||
'ARE_WATCHING_FORUM' => 'You have subscribed to be notified of new posts in this forum.',
|
||||
'ARE_WATCHING_TOPIC' => 'You have subscribed to be notified of new posts in this topic.',
|
||||
|
1
phpBB/phpbb/cache/service.php
vendored
1
phpBB/phpbb/cache/service.php
vendored
@ -141,6 +141,7 @@ class service
|
||||
$icons[$row['icons_id']]['img'] = $row['icons_url'];
|
||||
$icons[$row['icons_id']]['width'] = (int) $row['icons_width'];
|
||||
$icons[$row['icons_id']]['height'] = (int) $row['icons_height'];
|
||||
$icons[$row['icons_id']]['alt'] = ($row['icons_alt']) ? $row['icons_alt'] : '';
|
||||
$icons[$row['icons_id']]['display'] = (bool) $row['display_on_posting'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
44
phpBB/phpbb/db/migration/data/v320/icons_alt.php
Normal file
44
phpBB/phpbb/db/migration/data/v320/icons_alt.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v320;
|
||||
|
||||
class icons_alt extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array('\phpbb\db\migration\data\v310\dev');
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
$this->table_prefix . 'icons' => array(
|
||||
'icons_alt' => array('VCHAR', '', 'after' => 'icons_height'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'icons' => array(
|
||||
'icons_alt',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
<dt><label for="icon">{L_ICON}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label for="icon"><input type="radio" name="icon" id="icon" value="0" checked="checked" tabindex="1" /> <!-- IF S_SHOW_TOPIC_ICONS -->{L_NO_TOPIC_ICON}<!-- ELSE -->{L_NO_PM_ICON}<!-- ENDIF --></label>
|
||||
<!-- BEGIN topic_icon --><label for="icon-{topic_icon.ICON_ID}"><input type="radio" name="icon" id="icon-{topic_icon.ICON_ID}" value="{topic_icon.ICON_ID}" {topic_icon.S_ICON_CHECKED} tabindex="1" /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="{topic_icon.ICON_NAME}" title="" /></label> <!-- END topic_icon -->
|
||||
<!-- BEGIN topic_icon --><label for="icon-{topic_icon.ICON_ID}"><input type="radio" name="icon" id="icon-{topic_icon.ICON_ID}" value="{topic_icon.ICON_ID}" {topic_icon.S_ICON_CHECKED} tabindex="1" /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="{topic_icon.ICON_ALT}" title="{topic_icon.ICON_ALT}" /></label> <!-- END topic_icon -->
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
|
@ -222,7 +222,7 @@
|
||||
<!-- ENDIF -->
|
||||
<div id="post_content{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
|
||||
|
||||
<h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3>
|
||||
<h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="{postrow.POST_ICON_IMG_ALT}" title="{postrow.POST_ICON_IMG_ALT}" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3>
|
||||
|
||||
<!-- DEFINE $SHOW_POST_BUTTONS = (postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE) -->
|
||||
<!-- EVENT viewtopic_body_post_buttons_list_before -->
|
||||
|
@ -1891,6 +1891,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||
'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '',
|
||||
'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '',
|
||||
'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '',
|
||||
'POST_ICON_IMG_ALT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['alt'] : '',
|
||||
'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')),
|
||||
'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false),
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user