森林之原
五月 23, 2012, 12:35:42 am *
歡迎光臨, 訪客. 請先 登入註冊一個帳號.

請輸入帳號, 密碼以及預計登入時間
新聞: 森林之原歡迎您的蒞臨!
森林之原提供自由軟體的支援,包括繁體中文的翻譯。
 
   首頁   說明 搜尋 日曆 登入 註冊  
頁: [1]   向下
  寄送主題  |  列印  
作者 主題: smf 1.1 rc 1 上傳檔案時,上傳區域預設是一個  (閱讀 3053 次)
0 會員 以及 2 訪客 正在閱讀本篇主題.
mat
初學者
*
離線 離線

文章: 15


« 於: 十二月 26, 2005, 04:09:36 am »

重發主題 XD

就是,在上傳檔案的時候,它不是有一個文字方塊可以讓使用者直接輸入路徑+檔名,旁邊還有
個按鈕可以讓使用者瀏覽檔案,選擇所要上傳的檔案。
就是那一組,smf 1.1 rc1裡預設是一組而已,是想說看能不能一次顯示個十組。

在smf 1.1 rc1 附件檔上傳的部份,預設可以讓使用者選擇檔案上傳,只有一組text+button
在看了Themes下之default裡的Post.template.php,感覺上應該是這裡:
程式碼:
// Is the user allowed to post any additional ones? If so give them the boxes to do it!
if ($context['can_post_attachment'])
{
echo '
<tr id="postAttachment2">
<td align="right" valign="top">
<b>', $txt['smf119'], ':</b>
</td>
<td class="smalltext">
<input type="file" size="48" name="attachment[]" />';


// Show more boxes only if they aren't approaching their limit.
if ($context['num_allowed_attachments'] > 1)
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var allowed_attachments = ', $context['num_allowed_attachments'], ' - 1;

function addAttachment()
{
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="48" name="attachment[]" /><span id="moreAttachments"></span>\');
allowed_attachments = allowed_attachments - 1;

return true;
}
// ]]></script>
<span id="moreAttachments"></span> <a href="javascript:addAttachment(); void(0);">(', $txt['more_attachments'], ')</a><br />
<noscript><input type="file" size="48" name="attachment[]" /><br /></noscript>';
else
echo '
<br />';

// Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
if (!empty($modSettings['attachmentCheckExtensions']))
echo '
', $txt['smf120'], ': ', $context['allowed_extensions'], '<br />';
echo '
', $txt['smf121'], ': ', $modSettings['attachmentSizeLimit'], ' ' . $txt['smf211'], !empty($modSettings['attachmentNumPerPostLimit']) ? ', ' . $txt['maxAttachPerPost'] . ': ' . $modSettings['attachmentNumPerPostLimit'] : '', '
</td>
</tr>';
}

像是<input type 那行在控制一次可以讓使用者上傳的檔案數量(以不按增加附檔案來說),
不過不知道如何修改,多增加幾行上去試,也是顯示一組。還是說,需要修改的地方不只是這
行而已?

// Show more boxes only if they aren't approaching their limit.

// Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
之間的程式碼,感覺上像是在做上傳檔案(text+button為一組)總數的檢查。
是否可以指導一下 Orz...........
向版主檢舉   已記錄
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 回覆文章 #1 於: 十二月 26, 2005, 06:41:10 pm »

Open Post.template.php
Find:
程式碼:
<input type="file" size="48" name="attachment[]" />';

// Show more boxes only if they aren't approaching their limit.
if ($context['num_allowed_attachments'] > 1)
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var allowed_attachments = ', $context['num_allowed_attachments'], ' - 1;

function addAttachment()
{
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="48" name="attachment[]" /><span id="moreAttachments"></span>\');
allowed_attachments = allowed_attachments - 1;

return true;
}
// ]]></script>
<span id="moreAttachments"></span> <a href="javascript:addAttachment(); void(0);">(', $txt['more_attachments'], ')</a><br />
<noscript><input type="file" size="48" name="attachment[]" /><br /></noscript>';
else
echo '
<br />';

Replace with:
程式碼:
<input type="file" size="48" name="attachment[]" /><br />';

// Show more boxes only if they aren't approaching their limit.
if ($context['num_allowed_attachments'] > 1)
{
for ($i = 0; $i < $context['num_allowed_attachments'] - 1; $i++)
{
echo '
<br /><input type="file" size="48" name="attachment[]" /><br />';
}
}

我測試了沒問題,有問題請回覆。
向版主檢舉   已記錄

頁: [1]   向上
  寄送主題  |  列印  
 
前往:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006, Simple Machines LLC Valid XHTML 1.0! Valid CSS!