|
|
Forum-Information
Before posting about errors, make sure that the answer cannot already be found
in our FAQ or by searching this forum!
Posting is restricted to registered users ( registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.
|
Creating and modifying plugins.
-

judebert
- Regular
-
- Posts: 2478
- Joined: Sat Oct 15, 2005 6:57 am
- Location: Orlando, FL
-
by judebert » Thu Jan 31, 2008 9:35 pm
I'm getting closer! I've just run into my first difficult problem!
The voting doesn't work well with permalinks.
If you're voting from the extended article of a permalinked page, you get returned to the front page. If the article is still on the front page, its voting bar is placed at the top. Your vote still gets recorded.
I was expecting to be returned to the permalinked page, with the voting bar at the top.
I think the problem is the URL of the voting link. It's created by appending "&serendipity[karmaVote]=X&serendipity[karmaID]=Y#karmaVoteY" to the original URL. The karmaVote and karmaID are still used, and the #karmaVoteY moves you to the voting bar.
Unfortunately, on a permalink page, the url looks like this:
yourblog/index.php?/permalink/Permalink.html&serendipity[karma...
While the relevant RewriteRules, at the very bottom of the .htaccess, are:
RewriteRule ^index\.(html?|php.+) index.php [R=permanent,L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]
I'm not certain, but I think the first one of that three is picking up the URL. We are pointing to index.php.+, so we're getting redirected to index.php, right? (My address bar still points to the full URL, and all the voting links are still pointing to the full URL, too.)
When I do this from a non-permalinked article, it works as expected.
In the code, I get the URL with serendipity_currentURL(). Is there a better way to get the URL of the current page, for my purposes?
-

garvinhicking
- Core Developer
-
- Posts: 28954
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
-
by garvinhicking » Fri Feb 01, 2008 1:44 am
Hi!
Ah, you meant "Custom Permalinks" using the plugin.
Are you already using the version I updated yesterday? Actually I believe the fix I applied will also fix your problem.
Regards,
Garvin
-

judebert
- Regular
-
- Posts: 2478
- Joined: Sat Oct 15, 2005 6:57 am
- Location: Orlando, FL
-
by judebert » Fri Feb 01, 2008 6:15 pm
Excellent, I'll give that a shot.
I expect to finish this soon; possibly before the weekend.
-
gregman
- Regular
-
- Posts: 92
- Joined: Wed Aug 15, 2007 9:32 pm
-
by gregman » Fri Feb 15, 2008 10:44 am
AWESOME, GUYS!
I just installed the new plugin and I am speechless!
Just some few suggestions:
- Code: Select all
@define('PLUGIN_KARMA_IMAGE_NONE_RATING', 'keine'); @define('PLUGIN_KARMA_TAB_OPTIONS', 'Optionen'); @define('PLUGIN_KARMA_TAB_APPEARANCE', 'Aussehen'); @define('PLUGIN_KARMA_TAB_TEXT', 'Text');
was missing in the german language files. Further I experienced some problems with word rating switched on. The word-rating doesn't match to a negative given vote. This probably is caused by the integer converting (e.g. integer of -2 + 0.5 = - 1!). Therefore I removed this line and switched the following code to - Code: Select all
if ($rating < -1.5) { $rating = PLUGIN_KARMA_VOTEPOINT_1; } elseif ($rating < -0.5) { $rating = PLUGIN_KARMA_VOTEPOINT_2; } elseif ($rating < 0.5) { $rating = PLUGIN_KARMA_VOTEPOINT_3; } elseif ($rating < 1.5) { $rating = PLUGIN_KARMA_VOTEPOINT_4; } else { $rating = PLUGIN_KARMA_VOTEPOINT_5; }
Greg
-

judebert
- Regular
-
- Posts: 2478
- Joined: Sat Oct 15, 2005 6:57 am
- Location: Orlando, FL
-
by judebert » Fri Feb 15, 2008 8:05 pm
Ah, good idea. (I guess I never had any entries rated below "Okay".  ) No need to truncate to an integer. Why didn't I think of that?
I'll have that checked in about 10 minutes from now.
And thanks! You contributed the impetus to get this moving; I'm glad you're impressed with the result!
-
gregman
- Regular
-
- Posts: 92
- Joined: Wed Aug 15, 2007 9:32 pm
-
by gregman » Sat Feb 16, 2008 2:38 pm
I just thought about the problem with the custom permalink plugin. Wouldn't it help to use $_SERVER['REQUEST_URI'] on every entry with an .htm/l ending, e.g.
- Code: Select all
if (stristr($_SERVER['REQUEST_URI'], ".htm")) { $url = $_SERVER['REQUEST_URI'] . '?'; } else { $url = serendipity_currentURL() . '&'; }
It works fine on my installation.
Greg
-

garvinhicking
- Core Developer
-
- Posts: 28954
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
-
by garvinhicking » Sat Feb 16, 2008 3:59 pm
Hi!
That would create trouble on servers without URL rewriting cause it would then use index.php?/archives/permalink.htm?blabla with two "?"s.
Regards,
Garvin
-
gregman
- Regular
-
- Posts: 92
- Joined: Wed Aug 15, 2007 9:32 pm
-
by gregman » Sat Feb 16, 2008 6:14 pm
Ah, I see. Well then, how about:
- Code: Select all
if (stristr($_SERVER['REQUEST_URI'], "index.php?")) { $url = serendipity_currentURL() . '&'; } else { $url = $_SERVER['REQUEST_URI'] . '?'; }
Greg
-

blog.brockha.us
- Regular
-
- Posts: 695
- Joined: Tue Jul 03, 2007 3:34 am
- Location: Berlin, Germany
-
Enahncement wishes
by blog.brockha.us » Sun Feb 17, 2008 6:34 pm
I would like to see some enhancements in the plugin:
* It would be nice to have the voting implemented as AJAX calls, so we don't have to reload the page for this.
* An option to disable the page call counter, if the visitor is just voting, proviewing or comitting a comment.
Is there something we can do about it?
About the German language files: I already changed them in the cvs. It seems my last changes didn't reach judebert, so they didn't made it into the cvs.
-

judebert
- Regular
-
- Posts: 2478
- Joined: Sat Oct 15, 2005 6:57 am
- Location: Orlando, FL
-
Re: Enahncement wishes
by judebert » Mon Feb 18, 2008 8:47 pm
blog.brockha.us wrote:* It would be nice to have the voting implemented as AJAX calls, so we don't have to reload the page for this.
I'll look into it and see what I can do. blog.brockha.us wrote:* An option to disable the page call counter, if the visitor is just voting, proviewing or comitting a comment.
An interesting idea. It should be possible: just check for the appropriate fields and refuse to increment the visit counter if they're present. blog.brockha.us wrote:About the German language files: I already changed them in the cvs. It seems my last changes didn't reach judebert, so they didn't made it into the cvs.
I thought I included those. If you send them again, I'll be happy to re-commit them.
-
gregman
- Regular
-
- Posts: 92
- Joined: Wed Aug 15, 2007 9:32 pm
-
Re: Enahncement wishes
by gregman » Sat Mar 19, 2011 12:26 am
blog.brockha.us wrote:* It would be nice to have the voting implemented as AJAX calls, so we don't have to reload the page for this.
I recently managed to do this using jquery but the "ajax call" feature only supports imagevoting and no voting timeouts. If it seems to be of use anyhow let me know. I will share some code.
Return to Plugins
Who is online
Users browsing this forum: Google [Bot] and 2 guests
|