Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2012-05-06 14:35:58

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,705
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

A couple of other minor edge-case suggestions:

  • Jukka has a newer version of rah_external_output in the works on his github page that uses forms and does away with the own table and admin pane. That necessitates a small change to your safe_upsert to cbe_helpful_enabled in the creation of two forms.
  • Could your admin restore function also check whether the cbe_helpful_votes and cbe_helpful_count tables exist, and create these too if they do not exist (likewise the rah_eo forms/table entries)? When using the plugin from the /plugins directory, the tables aren’t created. Your restore function is helpful because it create the prefs tables but cbe_helpful_count and vote have to be created by hand or by executing the enabled function manually.
  • The cbe_helpful_deleted function deletes the count and votes tables, but it is conceivable that the site_owner might want to retain these, particularly as if inadvertently deleted these details are irretrievable. Perhaps the function could ask before deleting these, or alternatively be split into two, one part to “reset/delete the votes and counts” and one to delete the remainder.

TXP Builders – finely-crafted code, design and txp

Offline

#38 2012-05-06 15:45:05

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

Ok. Today’s atmosphere : rainy sunday afternoon.
Noted down for next week, and further :

  • list articles based on time
  • study above suggestions

Offline

#39 2012-05-06 19:55:04

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 390

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

Here goes my suggestion then :-D

A new tag for display the TOTAL number of votes for an article (positive and negative summatory).

Why? because it is a data commonly used in hreview agregate microformat, and other semantic markup systems like schema.org for agregating reviews. Very, very interesting for SEO.


<txp:rocks/>

Offline

#40 2012-05-30 06:46:33

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

You have been heard !

New tag : <txp:cbe_helpful_total_votes /> to display the total number of votes.

New attribute : <txp:cbe_helpful_list period="{ {this | last} {year | month | week | day } | today | yesterday }" /> to restrict list on a given period of time. Leave period to get overall time list (i.e. no time restriction).

Note : if you use any tag (such as <txp:cbe_helpful_score /> or <txp:cbe_helpful_total_votes />) inside <txp:cbe_helpful_list period="some_period />, restriction time will apply.

Also corrected a miscalculation that nobody seems to have noticed.

And finally, as recently seen on twitter :

https://twitter.com/brionec/status/206331898673373184

Offline

#41 2012-05-30 07:31:07

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

jakob wrote:

Jukka has a newer version of rah_external_output in the works on his github page that uses forms and does away with the own table and admin pane. That necessitates a small change to your safe_upsert to cbe_helpful_enabled in the creation of two forms.

As jakob notes, the next release of rah_external_output will migrate away from its own database table and interface to Textpattern’s native form templates.

Claire, you can find the new version Jakob mention and working documentation at https://github.com/gocom/rah_external_output.

If you wish to support and use rah_eo v1.0 and later, the rows pretty much are needed to be inserted to txp_form table instead of the current rah_external_output. Don’t worry about migrating and rah_eo updaters, rah_eo has its own migration script in places that runs on updates. This covers already existing cbe_helpful installation on rah_eo’s part.

Rah_eo’s snippets work similarly as they do now, as frontend goes. As rah_eo’s documentation mentions, the plugin uses prefixed forms, and supports both (inline) header lines and file extensions. Knowing that, the current database insert lines for cbe_helpful could be changed to something as following;

safe_upsert(
	'txp_form',
	"name='rah_eo_cbe_helpful_ajax.html',
	Form='{$code}'",
	"name='rah_eo_cbe_helpful_ajax.html'"
);

safe_upsert(
	'txp_form',
	"name='rah_eo_cbe_helpful_js.js',
	Form='{$js}'",
	"name='rah_eo_cbe_helpful_js.js'"
);

No other changes should be required as far as I’m aware, apart from a version check that checks which rah_eo version is installed etc. As it those lines add Forms you could also just run those queries no matter what the rah_eo version is as the txp_form table is part of the Textpattern core. The next release version of rah_eo which implements the new db structure and Forms integration will be numbered plainly as 1.0, which you can use to base a version number check (e.g. using PHP’s version_compare) if you may.

Last edited by Gocom (2012-05-30 07:37:01)

Offline

#42 2012-05-30 10:55:39

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

I didn’t realize how much of rah_external_output had changed and improved. Thank you for pointing that out.

Remembered also about Jakob’s suggestions.

It appears that after a front-side update, it’s time to work on the plugin’s admin side.

Offline

#43 2012-05-30 22:17:38

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,705
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

Remembered also about Jakob’s suggestions

I found this problem occurs when you use cbe_helpful inside an li list…

If it’s any help, the problem I described here can be (partially) resolved by adding wraptag="ul" so that the li’s inserted by the function are correctly wrapped. You might still want to address the correct wrapping of the li’s if the wraptag is not set.


TXP Builders – finely-crafted code, design and txp

Offline

#44 2012-07-16 13:57:18

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

Fresh today : v0.5 ! It supports new rah_external_output database structure. The old one is no longer supported.
Download link is in the original post.

It also checks if all table are present and restore them if not. But be careful : if only one table is missing, it is restored but the others are left untouched. It can lead to inconsistencies between data.

To discuss a little further :

  • The plugin doesn’t offer saving/restoring backups. I think this is the webmaster to decide (via phpMyAdmin, or rss_admin_db_manager).
  • I assume that when the plugin is deleted, it’s because it will no longer be used. If data are to be saved, backup should be performed first.
  • If the plugin is temporarily paused, just deactivate it. All preferences and data will remain.

Finally, I failed to reproduce the bug. With something like

<ul>
<li>Vote</li>
<li><txp:cbe_helpful /></li>
</ul>

… sorry, but it works.
What are your codes ?

Last edited by CeBe (2012-07-16 18:37:34)

Offline

#45 2012-07-18 10:47:00

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

Hi Claire, Just trying to get the plugin working on a development setup for an internal project and encountered a small problem – the js from rah_external_output isn’t loading.

The website is set up at the following URL: http://webserver/intranet <- not that it’s installed in a subfolder.

Looking in my error console it looks like it’s trying to load:

http://webserver/?rah_external_output=cbe_helpful_js

Rather than:

http://webserver/intranet/?rah_external_output=cbe_helpful_js (which displays the correct js if entered manually)

My Site URL set in the textpattern preferences is: webserver/intranet

Is this a problem with my setup?

Thanks, Doug.

Offline

#46 2012-07-18 11:45:42

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

douglgm a écrit:

My Site URL set in the textpattern preferences is: webserver/intranet

Is this a problem with my setup?

Not at all. Error is my own >.<
BTW, there is the same problem with the ajax snippet.
Just wait a little bit, I will post a correction today.
Thank you.

Last edited by CeBe (2012-07-18 11:46:00)

Offline

#47 2012-07-18 12:10:24

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

Thanks for the quick response Claire. I look forward to the fix! :-)

Offline

#48 2012-07-18 12:12:59

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_helpful: Visitors can rate articles (based on wlk_helpful)

v0.5.1 published !
Sorry for the inconvience, and thank you for having reported :)

Last edited by CeBe (2012-07-18 12:16:03)

Offline

Board footer

Powered by FluxBB