Аттачмент в быстром ответе на vBulletin

  • Автор темы dhak
  • 3130
  • Обновлено
  • 28, Mar 2013
  • #1
Можно ли сделать кнопочку аттачмент в быстром ответе, что бы можно было аттачить файлы в быстром ответе а не из расширенного режима ? Иногда адски не удобно. P.s. Advanced Quick Reply не предлогать.

dhak


Рег
21 May, 2012

Тем
19

Постов
30

Баллов
220
  • 28, Mar 2013
  • #2
Думаю что нет ничего невозможного... хотя ни разу не задавался этим вопросом. Возьмите исходный код дополнительной опции где управление вложениями, и попробуйте добавить в форму быстрого ответа.
 

Wmboard


Рег
01 Jan, 2011

Тем
522

Постов
7188

Баллов
12408
  • 29, Mar 2013
  • #3
Открываем файл showthread.php Ищем:
 'bbcodecache',
После добавляем:
 'attachmentcache',
Ищем:
 'showthread_quickreply',
После добавляем:
 'newpost_attachment', 

'newpost_attachmentbit', 
Ищем:
 // ********************************************************************************* 
// build quick reply if appropriate 
Перед этим ставим:
 // get attachment options - by abus3d (www.marsasoft.net) 

require_once(DIR . '/includes/functions_file.php');

$inimaxattach = fetch_max_upload_size();

$attachtypes =& $vbulletin->attachmentcache;

$maxattachsize = vb_number_format($inimaxattach, 1, true);

$attachcount = 0;

$attach_editor = array();

if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] AND

$vbulletin->userinfo['userid'])

{

if (!$posthash OR !$poststarttime)

{

$poststarttime = TIMENOW;

$posthash = md5($poststarttime . $vbulletin->userinfo['userid'] .

$vbulletin->userinfo['salt']);

}

else

{

if (empty($postattach))

{

$currentattaches = $db->query_read("

SELECT dateline, filename, filesize, attachmentid

FROM " . TABLE_PREFIX . "attachment

WHERE posthash = '" .

$db->escape_string($newpost['posthash']) . "'

AND userid = " .

$vbulletin->userinfo['userid']

);

while ($attach = $db->fetch_array($currentattaches))

{

$postattach["$attach[attach]"] = $attach;

}

}

if (!empty($postattach))

{

foreach($postattach AS $attachmentid => $attach)

{

$attach['extension'] =

strtolower(file_extension($attach['filename']));

$attach['filename'] =

htmlspecialchars_uni($attach['filename']);

$attach['filesize'] =

vb_number_format($attach['filesize'], 1, true);

$show['attachmentlist'] = true;

eval('$attachments .= "' .

fetch_template('newpost_attachmentbit') . '";');

$attachment_js .=

construct_attachment_add_js($attachmentid, $attach['filename'], $attach['filesize'],

$attach['extension']);

$attach_editor["$attachmentid"] =

$attach['filename'];

}

}

}

$attachurl = "t=$threadinfo[threadid]";

eval('$attachmentoption = "' . fetch_template('newpost_attachment') .

'";');

$attach_editor['hash'] = $postid;

$attach_editor['url'] =

"newattachment.php?$session[sessionurl]t=$threadinfo[threadid]&poststarttime=$poststartt

ime&posthash=$posthash";

}

else

{

$attachmentoption = '';

}
В шаблоне showthread: Ищем:
 <input type="hidden" name="p" value="$qrpostid" id="qr_postid" />
После добавляем:
 <input type="hidden" name="posthash" value="$posthash" /> 

<input type="hidden" name="poststarttime" value="$poststarttime" />
Ищем:
 <if condition="$bbuserinfo['signature']"> 

<div style="float:$stylevar[right]"><label for="cb_signature"><input type="checkbox" name="signature" value="1" id="cb_signature" tabindex="5" checked="checked" />$vbphrase[show_your_signature]</label></div>

</if>

<label for="qr_quickreply"><input type="checkbox" name="quickreply" value="1" id="qr_quickreply" accesskey="w" tabindex="4" />$vbphrase[quote_message_in_reply]</label>

</div>

</fieldset>
После добавляем:
 $attachmentoption 
В шаблоне showthread_quickreply: Ищем:
 <if condition="$show['color_bbcode']">

<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>

<td><div class="imagebutton" id="{$editorid}_popup_forecolor" title="$vbphrase[colors]">

<table cellpadding="0" cellspacing="0" border="0">

<tr>

<td id="{$editorid}_color_out"><img src="$stylevar[imgdir_editor]/color.gif" width="21" height="16" alt="" /><br /><img src="$vboptions[cleargifurl]" id="{$editorid}_color_bar" alt="" style="background-color:black" width="21" height="4" /></td>

<td class="alt_pickbutton"><img src="$stylevar[imgdir_editor]/menupop.gif" alt="" width="11" height="16" /></td>

</tr>

</table>

</div></td>

</if>
После вставляем:
 <td><div class="imagebutton" id="{$editorid}_popup_attach" title="$vbphrase[attach]">

<table cellpadding="0" cellspacing="0" border="0">

<tr>

<td><img src="$stylevar[imgdir_editor]/attach.gif" alt="" width="21" height="20" /></td>

<td class="alt_pickbutton"><img src="$stylevar[imgdir_editor]/menupop.gif" width="11" height="16" alt="" /></td>

</tr>

</table>

</div></td>
 

Mister1


Рег
02 Mar, 2013

Тем
21

Постов
208

Баллов
418
  • 29, Mar 2013
  • #4
Veter:
И что получается в итоге?
Тоже что и в расширенном:

 

Mister1


Рег
02 Mar, 2013

Тем
21

Постов
208

Баллов
418
  • 29, Mar 2013
  • #5
То есть все "Дополнительные опции" снизу? Или только "Вложить файлы"?
 

Wmboard


Рег
01 Jan, 2011

Тем
522

Постов
7188

Баллов
12408
  • 29, Mar 2013
  • #6
Veter:
То есть все "Дополнительные опции" снизу?
А какие там "Дополнительные опции"? Должны быть?
 

Mister1


Рег
02 Mar, 2013

Тем
21

Постов
208

Баллов
418
  • 29, Mar 2013
  • #7
Ну в расширенном такое огромное поле "Дополнительные опции", которые и не нужны то в БО. В БО по сути достаточно одной кнопки. Чуть ниже можете показать на картинке форму БО?
 

Wmboard


Рег
01 Jan, 2011

Тем
522

Постов
7188

Баллов
12408
  • 29, Mar 2013
  • #8
Veter:
такое огромное поле "Дополнительные опции"
Понял.
Veter:
Чуть ниже можете показать на картинке форму БО?
Пожалуйста:

 

Mister1


Рег
02 Mar, 2013

Тем
21

Постов
208

Баллов
418
Тем
49554
Комментарии
57426
Опыт
552966

Интересно