Quote function not working

Started by kai920, November 04, 2007, 12:08:16 PM

Previous topic - Next topic

kai920

Orstio, I am using SEF Advance. Any ideas why the quote URL is not working? It directs back to the forum index. Quoting does work inside PMs.

http://localhost/option,com_smf/Itemid,71/action,post/quote,6768/topic,1689.0/num_replies,5/sesc,dc4920d3b13c158db6d2b3679f748ea7

becomes

http://localhost/option,com_smf/Itemid,71/

Orstio

That's very strange.  Is this only on a local install?  Does the preview function do someting similar, or only the quote?

kai920

Quote from: Orstio on November 04, 2007, 12:40:51 PM
That's very strange.  Is this only on a local install?  Does the preview function do someting similar, or only the quote?

No it's on my live site as well. The preview function works just fine.

Orstio

Is there something in SEFAdvance that removes the word "post" from the query string?

kai920


kai920

Sorry, still having this issue... not being able to quote is not good :(

kai920

Orstio, if you have some time could you please take a look at this for me? I've tried contacting the developer of SEF Advance for many months now with no reply.

kai920

#7
Orstio,

Finally made a bit of progress. I discovered if I add a trailing "/", the URL works, and I am no longer redirected to the forum index.

This works:

http://localhost/option,com_smf/Itemid,71/action,post/quote,6841/topic,1818.0/num_replies,0/sesc,3bba57e6cf85a360a096f64db5a6c731/


But without the trailing slash as it is currently generated, it throws me to the forum index.

What can be done?


Found this post over at SEF Advance forums, but if I make that change to not strip the trailing slash, the URL becomes:

http://localhost/option,com_smf/Itemid,71/?action=post;quote=6841;topic=1818.0;sesc=3bba57e6cf85a360a096f64db5a6c731

kai920

Orstio:

I finally got a reply from the folks over at SEF Advanced. Can you help?

QuoteThe problem is in SMF, not in SEF Advance. After you click on the Quote link it redirects to:

/option,com_smf/Itemid,71?action=post;quote=6955;topic=1867.0;sesc=f2a051b6c91c10c737b956c94d1890f4


Of course, this is not a valid URL and that's why SEF Advance redirects back to /option,com_smf/Itemid,71/

I think it should be fixed in SMF rather than SEF Advance. It should not redirect to that faulty link, it should stay on

/option,com_smf/Itemid,71/action,post/quote,6955/topic,1867.0/sesc,f2a051b6c91c10c737b956c94d1890f4

Orstio

Quote from: kai920 on June 05, 2008, 07:31:12 PM
Orstio:

I finally got a reply from the folks over at SEF Advanced. Can you help?

QuoteThe problem is in SMF, not in SEF Advance. After you click on the Quote link it redirects to:

/option,com_smf/Itemid,71?action=post;quote=6955;topic=1867.0;sesc=f2a051b6c91c10c737b956c94d1890f4


Of course, this is not a valid URL and that's why SEF Advance redirects back to /option,com_smf/Itemid,71/

I think it should be fixed in SMF rather than SEF Advance. It should not redirect to that faulty link, it should stay on

/option,com_smf/Itemid,71/action,post/quote,6955/topic,1867.0/sesc,f2a051b6c91c10c737b956c94d1890f4

Are you using the joomlahacks integration?  All URLs in should have the semi-colons changed to slashes and the equals changed to commas.

Can I see the actual URL? 

kai920

#10
I had the Joomlahacks bridge installed - a long, long, loooong time ago. Maybe 2+ years ago. Could that be why?

Feel free to login and access any forum topic to duplicate the behavior:

1. Login with your account-- I believe you still have an account on my site...

2. Go to any URL, say http://www.kaitech.hk/option,com_smf/Itemid,71/topic,1868.0

3. Make sure quick reply box at the bottom is turned off so that when you hit quote, it does not redirect you down there. (by the way, you can see that ajax quick reply doesn't work... but I've posted about that in a different topic :) )

4. once the quick reply is disabled/closed, hit the quote button

5. and you are redirected to /option,com_smf/Itemid,71/

6. If you copy and paste the quote button's complete URL directly into your browser's address bar, it works 100%

7. This problem does not exist in Private Messages. I'll send you a test PM..

Orstio

#11
Alright, here's your problem:

You have QuickReplay enabled, but minimized by default.

The theme is checking to see if QuickReply is enabled, and is trying to post the quote to the QuickReply box with ajax, but because it is minimized, the ajax can't find the QuickReply box to post.  This probably results in an error (have you checked your SMF error log?) and redirects to the forum homepage.

If you maximize the QuickReply, you will see that it works (well, all but the ajax, which is an issue with the wrapped URLs not being converted in script.js).

The problem doesn't exist in PMs because there is no QuickReply in PMs.

kai920

#12
I see some errors in the logs, but nothing that seems to be tied in to SMF.

Quote
http://www.kaitech.hk/forums/index.php?option=com_smf&Itemid=1&action=recent&start=40
8: Undefined variable: target
File: /home/kaitech/domains/kaitech.hk/public_html/modules/mod_fpslideshow.php
Line: 308

I see what you mean now - I disabled (turned off) quick reply completely and the quoting works inside topics.

So this has something to do with AJAX not working with quick reply?

Orstio

QuoteSo this has something to do with AJAX not working with quick reply?

Something like that, but not exactly.

There are some changes you can make to xml_topic.js, for example, to make the ajax functions work with the bridged forum:

http://www.simplemachines.org/community/index.php?topic=130728.msg835616#msg835616

However, they won't work properly on your site due to the double head tags issue.


kai920

OK, so I need to tackle the double head tags, then do some xml_topic.js changes...

Orstio

Because you're using the default theme, you can probably just install this mod:

http://custom.simplemachines.org/mods/index.php?mod=265

kai920

Great, thanks. Turns out I already had that mod on the server but I guess due to SMF 1.1.5 upgrade the package was not applied. I have re-applied it..

kai920

You are an absolute genius. :D

I did the edits as specified to the xml_topic.js, and now these work inside the bridged forum:

--inline message ajax edit
--quoting with quick reply shown, set to off by default (correctly quotes the message and does not redirect me to forum index)
--quoting with quick reply shown, set to on by default (correctly populates the quoted post in the quick reply box)


Couple of questions:

  • do the edits affect an unbridged/standalone forum? I tested it briefly on a standalone forum and the ajax functions appear to be ok.
  • what needs to be done to enable ajax editing of topic titles in a board index? xml_board.js?

Orstio

Quotedo the edits affect an unbridged/standalone forum? I tested it briefly on a standalone forum and the ajax functions appear to be ok.

The edits should actually break the ajax functions in the stand alone forum.

Quotewhat needs to be done to enable ajax editing of topic titles in a board index? xml_board.js?

Yes, try xml_board.js and script.js.  Anything that generates a URL should have commes and slashes instead of ampersands and equals.

kai920

Quote from: Orstio on June 05, 2008, 11:40:38 PM
Quotedo the edits affect an unbridged/standalone forum? I tested it briefly on a standalone forum and the ajax functions appear to be ok.

The edits should actually break the ajax functions in the stand alone forum.

Quotewhat needs to be done to enable ajax editing of topic titles in a board index? xml_board.js?

Yes, try xml_board.js and script.js.  Anything that generates a URL should have commes and slashes instead of ampersands and equals.

Is there a way to alter the .js files so it will work in both standalone and bridged forum?

For example

"if in bridged forum" - use commas and slashes
"if standalone" - do no changes (ampersands and equals)

Orstio


kai920

thanks, I will give that a look. think I am running into the
same problems w the "ajax quick reply" mod.

kai920

#22
Another question on AJAX functions: Under the forum's statistics center, when I click to expand each month - a bunch of extra table cells are generated. The attachments will clearly explain what I mean.

Is this also related to javascript and SEF URLs?  AFAIK, no javascript errors show up in FF console...

Extra tables cells are obviously not generated in standalone forum :)

PS. Is SMF's site attachment width not set at 600px? My attachments came in at the original width..

kai920

#23
Quote from: Orstio on June 09, 2008, 11:14:15 PM
Yes, but you would need to turn your js files into php files:

1. Does this mean I need to rename the js into a php and "echo" everything out. The J/M one would then be called something xml_topic_wrapped.js with the commas, slashes changed etc.  Or is it more involved than that?

2. Should I use if (empty($_REQUEST['option'])) to check for the presence of Mambo/Joomla?

3. The file to edit would be index.template.php? I only see 2 calls to js in there.. sha1.js (I can leave this alone yes?) and script.js?fin11.

PS. Could I add a check right inside the javascript somehow to check the state of _REQUEST['option']?  Since this is how technoadvice recommended checking for M/J. would it be possible to do something like this?


if (!empty($_REQUEST['option'])){
    sendXMLDocument(smf_scripturl + "/action,post2/topic," + smf_topic + "/xml,xml", x.join("&"), onPostDone);
} else {
    sendXMLDocument(smf_scripturl + "?action=post2;topic=" + smf_topic + ";xml", x.join("&"), onPostDone);
}

kai920

Quote from: kai920 on June 11, 2008, 09:46:48 PM
PS. Could I add a check right inside the javascript somehow to check the state of _REQUEST['option']?  Since this is how technoadvice recommended checking for M/J. would it be possible to do something like this?

Hey Orstio,

I found a nice function here that can parse variables from a Joomla/Mambo non-SEF url.


function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

This works for a standard URL like index.php?option=com_smf&Itemid=888. I can get the parameter using gup('option').

Do you know how to modify this function to automatically parse J/M SEF URLs? Ideally it would be able to auto-detect the presence of $mosConfig_sef.

Would this work?

if 'option' does not exist in the URL, assume we're SMF-only.
1. -- use regular SMF URLs (ie. smf_scripturl + "?action=post2;topic=888" )

if 'option does exist in the URL, assume we're in Joomla/Mambo.
2. -- if sef on, use SEF URLs (ie. smf_scripturl + "/action,post2/topic," + smf_topic)
3. -- if sef off, use regular URLs (ie. ie. smf_scripturl + "?action=post2;topic=888")

Advertisement: