Name Quote Mod

Started by Grek.Kamchatka, November 05, 2005, 04:55:22 AM

Previous topic - Next topic

Grek.Kamchatka

Link to Mod

Just click on users nickname and it will be in the answer field.
Tested only on SMF 1.1 RC1


J. Williams

Try saving it with extra .gz
Joshua Jon Williams
Back in Action.

GC

now the download doesn't exist...

Grek.Kamchatka

Hm, but look at Downloads field. It's 37) I try to download this mod, bet everything ok.

BBC

Does it work for 1.1.2 ??

BBC

I coul´d edit this mod manually to work with 1.1.2, but I cannot find line

function onDocReceived(XMLDoc)

in Display.template.php. I am using default theme.

Can some of moderators help me with that line?

It says that I should paste this:
function doName(messageid)
        {
                if (currentSwap)
                        window.location.href = "', $scripturl, '?action=post;quote=" + messageid + ";topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '";
                else
                {
                        window.open("', $scripturl, '?action=quotename;quote=" + messageid + ";sesc=', $context['session_id'], '", "quote", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,top=40,left=40,width=240,height=90,resizable=no;");
                        if (navigator.appName == "Microsoft Internet Explorer")
                                window.location.hash = "quickreply";
                        else
                                window.location.hash = "#quickreply";
                }
        }


before that line. Can I dare to put it somwhere else?

kaajee

Quote from: BBC on April 06, 2007, 11:33:55 AM
Does it work for 1.1.2 ??
At my 1.1.2 it doesn't work, but you figured that out yourself already.........

BBC

Would anyone with enough programming knowledge be so nice to continue developing this mod?

alado

#9
Will this module to work under 1.1.5 ?

L.G.S

The topic is almost 3 years old and hasn't been updated.. :X
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


BBC

I got it to work with 1.1.2v before. Worked without problems. It´s pitty thah such mod is without further development.

BBC

#12
Never mind, I found it here:
http://www.simplemachines.org/community/index.php?topic=21285.0

Very simple, it SHOULD be as default in SMF. Especially because it only ads some few lines and don´t delete anything.

Works with 2.04b too. Ads 2 buttons under avatar. Click on first you get only qoute with username you are quoting Tex, @ "Username": (I changed in script,js "2" to "@")

Second button, select partial text you want to qoute then click on the button.

goobit

I fixed it for SMF 1.1.8.

Works for me but use at your own risk.

Just replace content of the Name_Quote_Mod.xml file in the package. Make backup before trying to install.

<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>IvanV.PetrovichAkaGrek:NameQuoteMod</id>
<version>1.0</version>
<file name="$sourcedir/Post.php">
<operation>
<search position="after"><![CDATA[// Posting a reply without a quote?
]]></search>
<add><![CDATA[// Posting a named reply?
                elseif (!empty($topic) && !empty($_REQUEST['quotename']))
                {
                        checkSession('get');

                        // Make sure they _can_ quote this post, and if so get it.
                        $request = db_query("
                                SELECT m.subject, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime, m.body
                                FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b)
                                        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
                                WHERE m.ID_MSG = " . (int) $_REQUEST['quotename'] . "
                                        AND b.ID_BOARD = m.ID_BOARD
                                        AND $user_info[query_see_board]
                                LIMIT 1", __FILE__, __LINE__);
                        if (mysql_num_rows($request) == 0)
                                fatal_lang_error('smf232');
                        list ($form_subject, $mname, $mdate, $form_message) = mysql_fetch_row($request);
                        mysql_free_result($request);

                        // Add 'Re: ' to the front of the quoted subject.
                        if (trim($txt['response_prefix']) != '' && strpos($form_subject, trim($txt['response_prefix'])) !== 0)
                                $form_subject = $txt['response_prefix'] . $form_subject;

                        // Censor the message and subject.
                        censorText($form_message);
                        censorText($form_subject);

                        $form_message = preg_replace('~<br(?: /)?>~i', "\n", $form_message);

                        // Remove any nested quotes, if necessary.
                        if (!empty($modSettings['removeNestedQuotes']))
                                $form_message = preg_replace(array('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '~^\n~', '~\[/quote\]~'), '', $form_message);

                        // Add a quote string on the front and end.
                        $form_message = '[b]' . $mname . '[/b], ';
                }
]]></add>
</operation>
<operation>
<search position="end"></search>
<add><![CDATA[
function QuoteName()
{
global $db_prefix, $modSettings, $user_info, $txt, $settings, $context;
global $sourcedir, $func;

loadLanguage('Post');
if (!isset($_REQUEST['xml']))
loadTemplate('Post');

checkSession('get');

include_once($sourcedir . '/Subs-Post.php');

$moderate_boards = boardsAllowedTo('moderate_board');

$request = db_query("
SELECT IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime, m.body, m.ID_TOPIC, m.subject, t.locked
FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b, {$db_prefix}topics AS t)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE m.ID_MSG = " . (int) $_REQUEST['quote'] . "
AND b.ID_BOARD = m.ID_BOARD
AND t.ID_TOPIC = m.ID_TOPIC
AND $user_info[query_see_board]" . (!isset($_REQUEST['modify']) || (!empty($moderate_boards) && $moderate_boards[0] == 0) ? '' : '
AND (t.locked = 0' . (empty($moderate_boards) ? '' : ' OR b.ID_BOARD IN (' . implode(', ', $moderate_boards) . ')') . ')') . "
LIMIT 1", __FILE__, __LINE__);
$context['close_window'] = mysql_num_rows($request) == 0;

$context['sub_template'] = 'quotefast';
if (mysql_num_rows($request) != 0)
{
$row = mysql_fetch_assoc($request);
mysql_free_result($request);

// Censor the message!
censorText($row['posterName']);

// Want to modify a single message by double clicking it?
if (isset($_REQUEST['modify']))
{
censorText($row['subject']);

$context['sub_template'] = 'modifyfast';
$context['message'] = array(
'id' => $_REQUEST['quote'],
'body' => $row['posterName'],
'subject' => addcslashes($row['subject'], '"'),
);

return;
}

// Add a quote string on the front and end.
$context['quote']['xml'] = '[b]' . $row['posterName'] . '[/b], ';
$context['quote']['text'] = strtr(un_htmlspecialchars($context['quote']['xml']), array('\'' => '\\\'', '\\' => '\\\\', "\n" => '\\n', '</script>' => '</\' + \'script>'));
$context['quote']['xml'] = strtr($context['quote']['xml'], array('&nbsp;' => '&#160;', '<' => '&lt;', '>' => '&gt;'));

$context['quote']['mozilla'] = strtr($func['htmlspecialchars']($context['quote']['text']), array('&quot;' => '"'));
}
// !!! Needs a nicer interface.
// In case our message has been removed in the meantime.
elseif (isset($_REQUEST['modify']))
{
$context['sub_template'] = 'modifyfast';
$context['message'] = array(
'id' => 0,
'body' => '',
'subject' => '',
);
}
else
$context['quote'] = array(
'xml' => '',
'mozilla' => '',
'text' => '',
);
}
]]></add>
</operation>
</file>
<file name="$themedir/Display.template.php">
<operation>
<search position="replace"><![CDATA[<b>', $message['member']['link'], '</b>
<div class="smalltext">';
]]></search>
<add><![CDATA[ ';

                // Can they reply?  Have they turned on quick reply?
                if ($context['can_reply'] && !empty($options['display_quick_reply']))
                        echo '
                                 <b><a href="', $scripturl, '?action=post;quotename=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], ';sesc=', $context['session_id'], '" title="', $txt['add_username_in_replay'], '" onclick="doName(', $message['id'], ', \'', $context['session_id'], '\'); return false;">', $message['member']['name'], '</a></b><br /><div class="smalltext">';

                // So... quick reply is off, but they *can* reply?
                elseif ($context['can_reply'])
                        echo '
                                 <b><a href="', $scripturl, '?action=post;quotename=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], ';sesc=', $context['session_id'], '" title="', $txt['add_username_in_replay'], '">', $message['member']['name'], '</a></b><br />
                                 <div class="smalltext">';
                else
                        echo '<b>',$message['member']['name'],'</b><br /><div class="smalltext">';
]]></add>
</operation>
</file>
<file name="$themedir/xml_topic.js">
<operation>
<search position="end"></search>
<add><![CDATA[

function doName(messageid, cur_session_id)
{                             
  if (quickReplyCollapsed)                       
    window.location.href = smf_scripturl + "?action=post;quotename=" + messageid + ";topic=" + smf_topic + "." + smf_start + ";sesc=" + cur_session_id;                       
  else
  {
if (window.XMLHttpRequest)
{
if (typeof window.ajax_indicator == "function")
ajax_indicator(true);
getXMLDocument(smf_scripturl + "?action=quotename;quote=" + messageid + ";sesc=" + cur_session_id + ";xml", onDocReceived);
}
else
reqWin(smf_scripturl + "?action=quotename;quote=" + messageid + ";sesc=" + cur_session_id, 240, 90);
   
    if (navigator.appName == "Microsoft Internet Explorer")
      window.location.hash = "quickreply";
    else
      window.location.hash = "#quickreply";
  }
}
]]></add>
</operation>
</file>
<file name="$languagedir/index.english.php">
<operation>
<search position="end"></search>
<add><![CDATA[

$txt['add_username_in_replay'] = 'Add user name in replay form';
]]></add>
</operation>
</file>
<file name="$boarddir/index.php">
<operation>
<search position="before"><![CDATA['quotefast' => array('Post.php', 'QuoteFast'),
]]></search>
<add><![CDATA[                'quotename' => array('Post.php', 'QuoteName'),
]]></add>
</operation>
</file>
</modification>

Advertisement: