News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Topic Description

Started by Rudolf, January 03, 2007, 09:12:29 AM

Previous topic - Next topic

Garou

#260
I covered the install issue a long time ago

Quote from: Garou on November 03, 2008, 04:37:08 AM
Ok so I checked out the default 1.1.6 files with out any other mods. The fact that this mod wont install on it right, isn't Rudolf's fault.

Whomever was responsible for parsing the changes in the default files, left a lot of crumbs in it because according to the Installation Instructions for 1.1.6, when the mod is looking for say...
<subject>', $context['message']['subject'], ']]></subject>
it cant find it because in the Xml.template.php Im seeing...
<subject><![CDATA[', $context['message']['subject'], ']]></subject>

To the best of my knowledge the CDATA tags should not have been parsed into the xml template when they were originally modified. I could be wrong and this was done by design but I don't really think so.

So the fix is to either get the Simple Machines staff to update the 1.1.6 install file (which I doubt will happen because they are working so hard on the 2.0 updates) or for Rudolf to re-write the themes.xml in his package to accommodate for this. In the end I think it would just be easier for us to change that one file by hand.

In any case I'm attaching a copy of my hand converted 1.1.6 Xml.template.php. As long as you don't have any other mods that edit 1.1.6 Xml.template.php installed or your working with a clean install of SMF 1.1.6, meaning this is the first mod your installing, this should work for you.

In the quote I mention something about the CDATA statements not supposed to be in the file, this is not entirely correct Ive recently learned that there might be valid reasons for doing this.

Unfortunately there is an issue with the way the package manager handles this because CDATA is used as a reference when packaging a mod. I have to wonder if this isn't part of the reason why support for the mod was dropped.

In any case you will have to install the mod with errors and make the changes to the file manually.

Also when I was working on upgrading this myself I realized that if you just install the mod with errors and not try to fix the file, most functions of the mod will work. Though there may be a problem if you use quick edit to modify an existing post.

Kizo

it seems that it doesn't work with 1.1.11, i can't use it, forum just doesn't offer it.

Garou

The problem is that the author of the mod has not updated the mod or even participated in this thread for a very long time. In other words its unsupported.

That said you may be able to make it work by applying the changes listed in the parser manually as not much has changed since the mod was last updated and the current version of SMF. I believe others have gotten it to work with the latest version.

the giox

#263
I have done the modification manually on my SMF 2.0 RC, and it work perfectly.

1. first of all create the field on the Database: on "smf_messages" create the field "description". Type:VARCHAR, Lenght:255.

This is the code i have modify:

On .Sources/display.php
Code (find) Select
$context['subject'] = $topicinfo['subject'];
Code (add after) Select

$context['description'] = censorText($topicinfo['description']); //-Topic description MOD-


Code (find) Select
ms.subject,
Code (add after) Select
ms.description,
on ./Sources/MessageIndex.php
Code (find) Select
'id' => $row['ID_TOPIC'],
Code (add after) Select

'description' => $row['description'],//-Topic description MOD-


Code (find) Select
censorText($row['first_Body']);
Code (add after) Select

censorText($row['description']); //-Topic description MOD-


Code (find) Select
mf.subject AS first_Subject,
Code (add after) Select
mf.description,
on ./Sources/Post.php
Code (find) Select
$context['post_error']['long_message'] = true;
Code (add after) Select
htmltrim__recursive(htmlspecialchars__recursive($_REQUEST['description'])); //-Topic description MOD-

Code (find) Select
if (!isset($_REQUEST['subject']))
$_REQUEST['subject'] = '';

Code (add after) Select
if (!isset($_REQUEST['description'])) //-Topic description MOD-
$_REQUEST['description'] = ''; //-Topic description MOD-


Code (find) Select
// Any errors occurred?
Code (add before) Select
//-Topic description MOD- Start
$form_description = strtr($smcFunc['htmlspecialchars'](stripslashes($_REQUEST['description'])), array("\r" => '', "\n" => '', "\t" => ''));
if ($smcFunc['strlen']($form_description) > 200)
$form_description = $smcFunc['substr']($form_description, 0, 200);
//-Topic description MOD- End

Code (find) Select
censorText($context['preview_subject']);
Code (add before) Select
if (!isset($_POST['description'])) $_POST['description'] = ''; //-Topic description MOD-

Code (find) Select
// At this point, we want to make sure the subject isn't too long.
Code (add before) Select
//-Topic description MOD- Start
if (!isset($_POST['description']))
$_POST['description'] = '';
  if ($smcFunc['strlen']($_POST['description']) > 200)
$_POST['description'] = addslashes($smcFunc['substr'](stripslashes($_POST['description']), 0, 200));
  $_POST['description'] = strtr($smcFunc['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));
  //-Topic description MOD- End


Code (find) Select
'subject' => isset($_POST['subject']) ? $_POST['subject'] : null,
Code (add after) Select
'description' => isset($_POST['description']) ? $_POST['description'] : null,

Code (find) Select
if (isset($_POST['message']))
Code (add before) Select
//-Topic description MOD- Start
if (isset($_POST['description']))
{
$_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));

// Maximum number of characters.
if ($smcFunc['strlen']($_POST['description']) > 200)
$_POST['description'] = $smcFunc['substr']($_POST['description'], 0, 200);
}
else $_POST['description'] = '';
//-Topic description MOD- End


Code (find) Select
m.poster_Email, m.subject,2 times
Code (add after) Select
m.description,

Code (find) Select
m.ID_TOPIC, m.subject
Code (add after) Select
, m.description

Code (find) Select
'subject' => $_POST['subject'],
Code (add after) Select

'description' => $_POST['description'], //-Topic description MOD-


Code (find) Select
$form_subject = $row['subject'];
Code (add after) Select

$form_description = $row['description']; //-Topic description MOD-


Code (find) Select
$context['subject'] = addcslashes($form_subject, '"');
Code (add after) Select
$context['description'] = isset($form_description) ? addcslashes($form_description, '"') : ''; //-Topic description MOD-

Code (find) Select
'subject' => isset($_POST['subject']) ? $_POST['subject'] : null,
Code (add after) Select
'description' => isset($_POST['description']) ? $_POST['description'] : null,

Code (find) Select
'subject' => addcslashes($row['subject'], '"'),
Code (add before) Select
'is_first_post' => $is_first_post, //-Topic description MOD-
'description' => $is_first_post ? addcslashes($row['description'], '"') : '', //-Topic description MOD-


Code (find) Select
'subject' => $msgOptions['subject'],
Code (add after) Select
'description' => $msgOptions['description'], //-Topic description MOD-

Code (find) Select
'subject' => isset($msgOptions['subject']) ? $msgOptions['subject'] : '',
Code (add after) Select
'description' => isset($msgOptions['description']) ? $msgOptions['description'] : '', //-Topic description MOD-
on ./Sources/Subs-Post.php
Code (find) Select
// Insert the post.
Code (replace) Select
// Insert the post. -Topic description MOD- query modified

Code (find) Select
'id_member' => 'int', 'subject' => 'string-255',
Code (add after) Select
'description' => 'string-255',

Code (find) Select
$msgOptions['subject'],
Code (add after) Select
$msgOptions['description'],

Code (find) Select
$messages_columns['subject'] = $msgOptions['subject'];
Code (add after) Select
if (isset($msgOptions['description'])) //-Topic description MOD-
$messages_columns['description'] = $msgOptions['description']; //-Topic description MOD-


Another modification is needed.
In the original mod. the author as missed the topic move.
When a topic was moved you can't leave a topic with the topic-redirection.
with this modify now you can move the topic with a redirect:

on .source/MoveTopic.php
Code (find) Select
'subject' => $txt['moved'] . ': ' . $subject,
Code (add after) Select
'description' => '',

This is only the modification about the "source" code.
The template code is based on your template.

P.S. This is not "official" modification, is based on this mod. But in my forum it work
P.P.S. sorry for my bad english, i'm italian

Blackdozer

Quote from: the giox on February 14, 2010, 05:55:26 PM
I have done the modification manually on my SMF 2.0 RC, and it work perfectly.

1. first of all create the field on the Database: on "smf_messages" create the field "description". Type:VARCHAR, Lenght:255.

This is the code i have modify:

On .Sources/display.php
Code (find) Select
$context['subject'] = $topicinfo['subject'];
Code (add after) Select

$context['description'] = censorText($topicinfo['description']); //-Topic description MOD-


Code (find) Select
ms.subject,
Code (add after) Select
ms.description,
on ./Sources/MessageIndex.php
Code (find) Select
'id' => $row['ID_TOPIC'],
Code (add after) Select

'description' => $row['description'],//-Topic description MOD-


Code (find) Select
censorText($row['first_Body']);
Code (add after) Select

censorText($row['description']); //-Topic description MOD-


Code (find) Select
mf.subject AS first_Subject,
Code (add after) Select
mf.description,
on ./Sources/Post.php
Code (find) Select
$context['post_error']['long_message'] = true;
Code (add after) Select
htmltrim__recursive(htmlspecialchars__recursive($_REQUEST['description'])); //-Topic description MOD-

Code (find) Select
if (!isset($_REQUEST['subject']))
$_REQUEST['subject'] = '';

Code (add after) Select
if (!isset($_REQUEST['description'])) //-Topic description MOD-
$_REQUEST['description'] = ''; //-Topic description MOD-


Code (find) Select
// Any errors occurred?
Code (add before) Select
//-Topic description MOD- Start
$form_description = strtr($smcFunc['htmlspecialchars'](stripslashes($_REQUEST['description'])), array("\r" => '', "\n" => '', "\t" => ''));
if ($smcFunc['strlen']($form_description) > 200)
$form_description = $smcFunc['substr']($form_description, 0, 200);
//-Topic description MOD- End

Code (find) Select
censorText($context['preview_subject']);
Code (add before) Select
if (!isset($_POST['description'])) $_POST['description'] = ''; //-Topic description MOD-

Code (find) Select
// At this point, we want to make sure the subject isn't too long.
Code (add before) Select
//-Topic description MOD- Start
if (!isset($_POST['description']))
$_POST['description'] = '';
  if ($smcFunc['strlen']($_POST['description']) > 200)
$_POST['description'] = addslashes($smcFunc['substr'](stripslashes($_POST['description']), 0, 200));
  $_POST['description'] = strtr($smcFunc['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));
  //-Topic description MOD- End


Code (find) Select
'subject' => isset($_POST['subject']) ? $_POST['subject'] : null,
Code (add after) Select
'description' => isset($_POST['description']) ? $_POST['description'] : null,

Code (find) Select
if (isset($_POST['message']))
Code (add before) Select
//-Topic description MOD- Start
if (isset($_POST['description']))
{
$_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));

// Maximum number of characters.
if ($smcFunc['strlen']($_POST['description']) > 200)
$_POST['description'] = $smcFunc['substr']($_POST['description'], 0, 200);
}
else $_POST['description'] = '';
//-Topic description MOD- End


Code (find) Select
m.poster_Email, m.subject,2 times
Code (add after) Select
m.description,

Code (find) Select
m.ID_TOPIC, m.subject
Code (add after) Select
, m.description

Code (find) Select
'subject' => $_POST['subject'],
Code (add after) Select

'description' => $_POST['description'], //-Topic description MOD-


Code (find) Select
$form_subject = $row['subject'];
Code (add after) Select

$form_description = $row['description']; //-Topic description MOD-


Code (find) Select
$context['subject'] = addcslashes($form_subject, '"');
Code (add after) Select
$context['description'] = isset($form_description) ? addcslashes($form_description, '"') : ''; //-Topic description MOD-

Code (find) Select
'subject' => isset($_POST['subject']) ? $_POST['subject'] : null,
Code (add after) Select
'description' => isset($_POST['description']) ? $_POST['description'] : null,

Code (find) Select
'subject' => addcslashes($row['subject'], '"'),
Code (add before) Select
'is_first_post' => $is_first_post, //-Topic description MOD-
'description' => $is_first_post ? addcslashes($row['description'], '"') : '', //-Topic description MOD-


Code (find) Select
'subject' => $msgOptions['subject'],
Code (add after) Select
'description' => $msgOptions['description'], //-Topic description MOD-

Code (find) Select
'subject' => isset($msgOptions['subject']) ? $msgOptions['subject'] : '',
Code (add after) Select
'description' => isset($msgOptions['description']) ? $msgOptions['description'] : '', //-Topic description MOD-
on ./Sources/Subs-Post.php
Code (find) Select
// Insert the post.
Code (replace) Select
// Insert the post. -Topic description MOD- query modified

Code (find) Select
'id_member' => 'int', 'subject' => 'string-255',
Code (add after) Select
'description' => 'string-255',

Code (find) Select
$msgOptions['subject'],
Code (add after) Select
$msgOptions['description'],

Code (find) Select
$messages_columns['subject'] = $msgOptions['subject'];
Code (add after) Select
if (isset($msgOptions['description'])) //-Topic description MOD-
$messages_columns['description'] = $msgOptions['description']; //-Topic description MOD-

Thanks, just need to put the author

the giox

I've added new source code for movetopic.php

Please don't quote all the post ;)

Am'

Quote from: the giox on February 15, 2010, 05:14:16 PM
I've added new source code for movetopic.php

Please don't quote all the post ;)

you can create a package for smf2 please ?  :-[ :-[ :-[ :-[
اذا أحس أحد انه لم يخطأ ابدا في حياته, فهذا يعني أنه لم يجرب أي جديد في حياته
My Mods For SMF 2 RC3 : XQuote XCode - Vbulletin Style New Meta Tags

the giox

Quote from: Am' on February 15, 2010, 05:36:56 PM
Quote from: the giox on February 15, 2010, 05:14:16 PM
I've added new source code for movetopic.php

Please don't quote all the post ;)

you can create a package for smf2 please ?  :-[ :-[ :-[ :-[

No sorry... i'va made all my modify by manual.
This is only an help to everything need this mod. on 2.0 RC2.
I've tested in the curve theme and this is for that template:

on ./Themes/default/Display.template.php
Code (find) Select
<span id="top_subject">', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')</span>
Code (add after) Select
</h3>


<h3 class="catbg"><span class="left"></span>
<span id="description">', $txt['topic_description'], ': ', $context['description'], '</span>


Code (find) Select
sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="6" class="input_text" />'), ',
Code (add after) Select
sTemplateDescriptionEdit: ',JavascriptEscape('<input type="text" style="width: 90%;" name="description" value="%description%" size="60" maxlength="80" tabindex="6" class="input_text"/>'),',

Code (find) Select
<input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="2" class="button_submit" />
Code (add before) Select
<input type="hidden" name="description" value="" readonly /><!-- //-Topic description MOD- -->
on ./Themes/default/MessageIndex.template.php
Code (find) Select
<p>', $txt['started_by'], ' ', $topic['first_post']['member']['link'], '
Code (add before) Select
<br /><span id="msg_descr_' , $topic['first_post']['id'] , '" class="topic_description">',$topic['description'],'</span>',' <!-- //-Topic Description MOD- -->

Code (find) Select
setInnerHTML(cur_subject_div, \'<input type="text" name="subject" value="\' + subject + \'" size="60" style="width: 95%;"  maxlength="80" onkeypress="modify_topic_keypress(event)" class="input_text" /><input type="hidden" name="topic" value="\' + cur_topic_id + \'" /><input type="hidden" name="msg" value="\' + cur_msg_id.substr(4) + \'" />\');
Code (add after) Select
setInnerHTML(cur_description_div, \'<input type="text" name="description" value="\' + description + \'" size="60" style="width: 99%;"  maxlength="80" onkeypress="modify_topic_keypress(event)" />\');

Code (find) Select
setInnerHTML(cur_subject_div, \'<a href="', $scripturl, '?topic=\' + cur_topic_id + \'.0">\' + subject + \'<\' +\'/a>\');
Code (add after) Select
setInnerHTML(cur_description_div, description);
on ./Themes/default/Post.template.php
Code (find) Select
var textFields = ["subject",
Code (add after) Select
"description",

Code (find) Select
<dt>
', $txt['message_icon'], ':

Code (add before) Select
<!-- //-Topic description MOD- Start -->
', (!empty($context['is_first_post']) ?
'
<dt align="right" style="font-weight: bold;" id="caption_description">
'. $txt['topic_description']. ':
</dt>
<dd>
<input type="text" name="description" value="'. $context['description'] .'" tabindex="'. $context['tabindex']++. '" size="80" maxlength="80" />
</dd>
':'<input type="hidden" name="description" value="" readonly />') ,'
<!-- //-Topic description MOD- End -->

on ./Themes/default/languages/index.english.php
Code (find) Select
?>
Code (add before) Select

$txt['topic_description'] = 'Description'; //-Topic description MOD-

on ./Themes/default/css/index.css
Code (find) Select
#forumposts h3 span#top_subject
Code (add after) Select
#description

Code (find) Select
#forumposts h3 img
{
float: left;
margin: 4px 0.5em 0 0;
}

Code (add before) Select
#forumposts h3 span#description
{
margin: 0 0 0 12.7em;
}


I haven't modify Xml.template.php

Garou

This mod is near impossible to create a package for anyway. For instance in ./Sources/Post.php contains a bit of code that is identical in a couple places the package parser will end up adding the code to the first instance twice. So to make it work correctly you would have to have the package make the first change with the mod and manually add the second one.

The package parser also has issues with the code in the Xml.template.php as it has cdata commands in the file and the code you put in the package to update the file. The parser uses cdata lines as reference points for inserting code as well. This is what was causing the mod to fail on install in 1.1 and the same would happen in 2.0

No matter how you slice it you would have to make some changes manually in order to get this to work right and as such I'm sure SMF wouldn't approve the mod under their current terms for modifications.

aprild

I'm running 1.1.11 and I'd like to try this mod... but will the "handmade" changes posted above by the giox work since he said he was running SMF2?

I'm guessing not.... But if it does...

Anyone willing to tell me how he made the changes he made to the Database as he lists as kind-of the first step?

Garou

No that is the changes to make it work on 2.0 RC2

For 1.1.11 would be to download the original mod and install it with errors and or make manual changes using http://custom.simplemachines.org/mods/index.php?action=parse;mod=606;attach=47382;smf_version=1.1.11

One thing you have to note in the ./Sources/Post.php there is a line that says...
Find:
m.posterEmail, m.subject,
Add After:
m.description,

There are actually two sections that that change is called for, im not sure that it shows in the parsed instructions but if you know how to read an install file you will see it. The thing is that the way the package manager works it will end up adding the line to the first instance twice rather then trying to find the second instance. You will have to add it to the second instance manually.

The other issue you will run into and actually causes the mod to fail in install is in ./Themes/default/Xml.template.php.
In the manual instructions it says to find
<subject>', $context['message']['subject'], ']]></subject>
however in the actual file it reads as....
<subject><![CDATA[', $context['message']['subject'], ']]></subject>

There are multiple instances of this and the way the package manager works using CDATA lines to find and replace code from the mod it is impossible to change a line like that using the package manager. All changes to that file will also have to be done manually and when searching in the actual files they will be hard to find because the parser ignores the CDATA lines in the same way the package manger does.

Because of these issues you will probably never see an official updated package of this mod for 1.1.x or 2.0.x as they have the exact same problems. The only way to truly make this work is to make at least some of the changes changes manually and as such SMF wouldn't approve a new mod and I think that's part of the reason the author no longer supports the existing one.

Sheepy

Well, I needed this pretty bad for my SMF 2.0 RC3. And I don't want to have to re-apply the modifications manually on RC4 and gold.

So here is a package that contains the manual 2.0 RC2 modifications listed by Blackdozer, modified to work with RC3.

bros

I think I love you for doing that Sheepy

bros

Quote from: Sheepy on August 07, 2010, 09:07:18 AM
Well, I needed this pretty bad for my SMF 2.0 RC3. And I don't want to have to re-apply the modifications manually on RC4 and gold.

So here is a package that contains the manual 2.0 RC2 modifications listed by Blackdozer, modified to work with RC3.

damn it has multiple errors on RC4.

!RFAN


squad



I hope, beg this modification is able to be update to be used with SMF 2.0 RC4 & the
future versions as I find this the most useful and best modification I've used.

Rudolf

#276
Quote from: Garou on February 15, 2010, 09:57:15 PM
This mod is near impossible to create a package for anyway. For instance in ./Sources/Post.php contains a bit of code that is identical in a couple places the package parser will end up adding the code to the first instance twice. So to make it work correctly you would have to have the package make the first change with the mod and manually add the second one.

Unfortunately the package manager was crippled in 1.1 to don't allow multiple search/replace of the same operation.
See this discussion  and this bug report for more information on the subject. However I used workarounds to be able to make all the changes automatically.

As for the CDATA issue.
There was a bug introduced in 1.1.5 in which the parser fails to parse nested CDATA tags correctly.
To fix it:
In Subs-Package.php
Code (Search for) Select

// Handle Cdata blocks.
elseif (!$inComment && $part === '<![CDATA[')


Code (Replace with) Select

// Handle Cdata blocks.
elseif (!$inComment && !$inCdata && $part === '<![CDATA[')


Unfortunately that's not something I can fix. Apply this small change in your Subs-Package.php file before trying to install, and the mod should install just fine on a vanilla SMF 1.1.13. It does for me.

As for people wanting a version for 2.0.
I was planning to update it once the final 2.0 came out. 4 years ago!
I might still update it.
But for god's sake,  don't hold your breath!!!
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Rudolf

Quote from: Rudolf on February 18, 2011, 07:21:04 PM
Quote from: Garou on February 15, 2010, 09:57:15 PM
This mod is near impossible to create a package for anyway. For instance in ./Sources/Post.php contains a bit of code that is identical in a couple places the package parser will end up adding the code to the first instance twice. So to make it work correctly you would have to have the package make the first change with the mod and manually add the second one.

Jeez, I didn't realize this was one year ago.  :o
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Garou

Rudolph!!!
Glad to see you back in this thread.

When I was working on a version for RC2 it didn't have the same issue with installing. While it has the same thing with having to edit the same code in multiple places, for the second instance the default SMF code was using extra white space. I dont know if this still holds true in RC5 though. I tossed all my notes and code... Well, Id rather not get into it but I do remember that much.

helike13

Will this mod ever be compatible with RC5?

Advertisement: