Autor Tópico: Resposta Rápida usando Wysiwyg  (Lida 5231 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5072
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Resposta Rápida usando Wysiwyg
« em: 25 de Julho de 2009, 15:04 »
Nome:Wysiwyg Quick Reply
Arquivo:WysiwygQuickReply_RC1.zip Mod em En
Autor do Mod:Antechinus
Type: Posting
Autor da Tradução: Candidosa2
Versões Antigas: disponível 2.0 RC1-1
Download em En - Versao: disponível  2.0 RC1-2



Source/Display.php
Pesquisar
Código: [Seleccione]
// Check if spellchecking is both enabled and actually working. (for quick reply.)
$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');


Adicionar
Código: [Seleccione]
// Start of WYSIWYG Quick Reply
// Load the editor file
require_once($sourcedir.'/Subs-Editor.php');
 
// Prevent Errors
$context['submit_label'] = isset($_REQUEST['msg']) ? $txt['save'] : $txt['post'];
$context['attached'] = '';
$context['allowed_extensions'] = '';
$context['make_poll'] = 0;

// Now create the editor.
$editorOptions = array(
'id' => 'message',
'value' => !empty($context['message']) ? $context['message'] : '',
'labels' => array(
'post_button' => $context['submit_label'],
),
// We do XML preview here.
'preview_type' => 1,
);
create_control_richedit($editorOptions);
 
// Store the ID.
$context['post_box_name'] = $editorOptions['id'];

// Set if unset (and avoid php undefined variable errors - default is FULL WYSIWYG with bbc buttons and smilies (unless set via profile OR admin)
$options['wysiwyg_quick_reply'] = isset($options['wysiwyg_quick_reply']) ? (int) $options['wysiwyg_quick_reply'] : 0 ;

// To avoid intefering with the wysiwyg for post - we temporarily override the setting, THEN, restore it after we've written the wysiwyg
$context['controls']['richedit']['message']['rich_active_original'] = !empty($context['controls']['richedit']['message']['rich_active']) ? 1 : 0 ;
// Active
$context['controls']['richedit']['message']['rich_active'] = in_array($options['wysiwyg_quick_reply'], array(0, 1, 2, 3)) ? 1 : 0 ;
// End of WYSIWYG Quick Reply

 


Display.template.php

Pesquisar
Código: [Seleccione]
<textarea cols="75" rows="7" style="width: 95%; height: 100px;" name="message" tabindex="1"></textarea><br />
Alterar por
Código: [Seleccione]
';

// Start of WYSIWYG Quick Reply
echo '<table border="0" cellpadding="3" width="100%">
<tr class="windowbg">
<td valign="top" align="left">';
 
// Only show bbcode bar if BBCodes are enabled, AND if its a quick reply mode with bbcode bar
if ($context['show_bbc'] && (in_array($options['wysiwyg_quick_reply'], array(0, 1, 4, 5))))
echo template_control_richedit($context['post_box_name'], 'bbc').'<br />';

// Only show smilies if smiliesare enabled AND if its a quick reply mode with smilies
if (!empty($context['smileys']['postform']) && (in_array($options['wysiwyg_quick_reply'], array(0, 2, 4, 6))))
echo template_control_richedit($context['post_box_name'], 'smileys').'<br />';
 
// Show the quick reply (WYSIWYG vs NON-WYSIWYG dealt with already decided in source file)
echo template_control_richedit($context['post_box_name'], 'message'), '
</td>
</tr>
</table>';
// End of WYSIWYG Quick Reply

echo '
 

Profile.template.php

Pesquisar
Código: [Seleccione]
// Choose WYSIWYG settings?
if (empty($modSettings['disable_wysiwyg']))
echo '
<tr>
<td colspan="2">
<input type="hidden" name="default_options[wysiwyg_default]" value="0" />
<label for="wysiwyg_default"><input type="checkbox" name="default_options[wysiwyg_default]" id="wysiwyg_default" value="1"', !empty($context['member']['options']['wysiwyg_default']) ? ' checked="checked"' : '', ' class="check" /> ', $txt['wysiwyg_default'], '</label>
</td>
</tr>';

Adicionar
Código: [Seleccione]
// Start of WYSIWYG Quick Reply
echo '
<tr>
<td colspan="2"><label for="wysiwyg_quick_reply">', $txt['wysiwyg_quick_reply'], '</label>
<select name="default_options[wysiwyg_quick_reply]" id="wysiwyg_quick_reply">';

// Avoid undefined errors if empty/unset for our loop
$j = !empty($context['member']['options']['wysiwyg_quick_reply']) ? (int) $context['member']['options']['wysiwyg_quick_reply'] : 0 ;
for($i=0;$i<=7;$i++)
echo '
<option value="'.$i.'"', ($i == $j ? ' selected="selected"' : ''), '>', $txt['wysiwyg_quick_reply'.$i],'</option>';
echo '
</select>
</td>
</tr>';
// Tidy up
unset($i, $j);
// End of WYSIWYG Quick Reply
 
 


Settings.template.php

Pesquisar
Código: [Seleccione]
array(
'id' => 'display_quick_reply',
'label' => $txt['display_quick_reply'],
'options' => array(
0 => $txt['display_quick_reply1'],
1 => $txt['display_quick_reply2'],
2 => $txt['display_quick_reply3']
),
'default' => true,
),

Adicionar
Código: [Seleccione]
array(
'id' => 'wysiwyg_quick_reply',
'label' => $txt['wysiwyg_quick_reply'],
'options' => array(
0 => $txt['wysiwyg_quick_reply0'],
1 => $txt['wysiwyg_quick_reply1'],
2 => $txt['wysiwyg_quick_reply2'],
3 => $txt['wysiwyg_quick_reply3'],
4 => $txt['wysiwyg_quick_reply4'],
5 => $txt['wysiwyg_quick_reply5'],
6 => $txt['wysiwyg_quick_reply6'],
7 => $txt['wysiwyg_quick_reply7'],
),
'default' => true,
),
 


Deafult scripts/xml_topic.js
Pesquisar
Código: [Seleccione]

// This is the callback function used after the XMLhttp request.
QuickReply.prototype.onQuoteReceived = function (oXMLDoc)
{
var sQuoteText = '';
 
for (var i = 0; i < oXMLDoc.getElementsByTagName('quote')[0].childNodes.length; i++)
sQuoteText += oXMLDoc.getElementsByTagName('quote')[0].childNodes[i].nodeValue;
 
replaceText(sQuoteText, document.forms.postmodify.message);
 
ajax_indicator(false);
}
 

Alterar por
Código: [Seleccione]
// This is the callback function used after the XMLhttp request.
QuickReply.prototype.onQuoteReceived = function (oXMLDoc)
{
var text = "";
 
for (var i = 0; i < oXMLDoc.getElementsByTagName("quote")[0].childNodes.length; i++)
text += oXMLDoc.getElementsByTagName("quote")[0].childNodes[i].nodeValue;

editorHandlemessage.insertText(text, false, true);
 
ajax_indicator(false);
}
 


Pesquisar
Código: [Seleccione]
getXMLDocument(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId + ';sesc=' + sSessionId + ';xml', this.onQuoteReceived);
}
// Or with a smart popup!
else
reqWin(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId + ';sesc=' + sSessionId, 240, 90);

Alterar por
Código: [Seleccione]
getXMLDocument(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId + ';sesc=' + sSessionId + ';xml;pb=message;mode=' + (editorHandlemessage.bRichTextEnabled ? 1 : 0), this.onQuoteReceived);
}
// Or with a smart popup!
else
reqWin(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId + ';sesc=' + sSessionId +';pb=message;mode=' + (editorHandlemessage.bRichTextEnabled ? 1 : 0), 240, 90);


/langues Modifications.portuguese_pt.php

Código: [Seleccione]
$txt['wysiwyg_quick_reply'] = 'Escolher tipo de resposta r&aacute;pida';
$txt['wysiwyg_quick_reply0'] = 'WYSIWYG (BBC com bot&otilde;es e smilies)';
$txt['wysiwyg_quick_reply1'] = 'WYSIWYG (BBC apenas com bot&otilde;es)';
$txt['wysiwyg_quick_reply2'] = 'WYSIWYG (apenas com smilies)';
$txt['wysiwyg_quick_reply3'] = 'WYSIWYG Somente';
$txt['wysiwyg_quick_reply4'] = 'Non-WYSIWYG (BBC com bot&otilde;es e smilies)';
$txt['wysiwyg_quick_reply5'] = 'Non-WYSIWYG (BBC apenas com bot&otilde;es)';
$txt['wysiwyg_quick_reply6'] = 'Non-WYSIWYG (apenas com smilies)';
$txt['wysiwyg_quick_reply7'] = 'Non-WYSIWYG (padr&atilde;o)';