Update for Drupal 6.x

leafish_paul - January 30, 2008 - 12:53
Project:Role Weights
Version:HEAD
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

Here we go again!

Converting 5.x modules to 6.x.

#1

leafish_paul - February 13, 2008 - 17:46

Anyone have any thoughts on including the new AJAXy drag n' drop weights that Drupal 6 has?

#2

leafish_paul - February 19, 2008 - 17:53

FYI, minor .info file changes and DB schema stuff for .install is already committed to HEAD.

#3

leafish_paul - February 19, 2008 - 23:28
Status:active» needs work

Attached is a starting point - most of the items from updating modules from 5.x -> 6.x are covered, I think. Current HEAD with this patch is semi-functional with 6.0, the most obvious issue being that altering the user_admin_new_role form to allow for editing the two default, locked roles isn't working.

AttachmentSize
role_weights-215820-1.patch 3.67 KB

#4

leafish_paul - February 19, 2008 - 23:38

Now includes redirecting with $form_state.

AttachmentSize
role_weights-215820-2.patch 3.88 KB

#5

Liliplanet - March 19, 2009 - 15:12

Looking so forward to the release of role weight for Drupal 6.x. Used it extensively in 5.x

Thank you!

#6

fuzzy_texan - February 18, 2009 - 02:43

Subscribing

#7

rgraves - March 16, 2009 - 15:15

Any ideas when a Drupal 6 version will be ready for production?

#8

manoloka - March 28, 2009 - 18:54

subscribing

#9

leafish_paul - March 31, 2009 - 19:33

Patch about to be committed to HEAD. No solution to editing Drupal's locked roles yet, however.

AttachmentSize
role_weights-215820-3.patch 3.6 KB

#10

leafish_paul - March 31, 2009 - 20:37
Status:needs work» needs review

Attached patch brings HEAD in line feature-wise with 5.x-1.3, including editing locked roles and re-ordering admin forms.

I've stripped out Views hooks for D5/Views 1 - this will need completely re-writing and has its own issue: #419846: Improve Views support

AttachmentSize
role_weights-215820-4.patch 5.57 KB

#11

leafish_paul - March 31, 2009 - 21:57
Status:needs review» fixed

Applied #10 to HEAD: http://drupal.org/cvs?commit=191306

Anyone willing/able to test from HEAD before I branch for 6.x?

#12

System Message - April 14, 2009 - 22:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#13

Liliplanet - April 15, 2009 - 07:36
Status:closed» active

Sorry, have to re-open issue. Been patiently waiting for months for the version 6.x, will this possibly be happening?

Just need Role Weights to sort in Views.

Thank you for any updates :)

#14

leafish_paul - April 16, 2009 - 14:46

Role Weights HEAD version should be compatible and working with 6.x. I'm super-hectic atm, but will try to branch asap so people can test a 6.x-1.x-dev version.

Unfortunately, Views 2 (D6) support is fairly complex and I have limited time so I have stripped out Views 1 (D5) support for now. Please see #419846: Improve Views support for further info - any help on this greatly appreciated.

#15

LUTi - May 22, 2009 - 10:22

I've downloaded and tested HEAD (a link in post #11) which, by the way, doesn't match the packed HEAD version.

Everything seems to work well on my system, so consider it as tested regarding me.

I believe a 6.x development version would contribute significantly to users interest (I also didn't notice those latest changes, as module was not even on my "Available Updates" list, so I have more or less forgotten that it even exists in my system...). It would also help us all to test and discuss about the same version, as now it is not so eays to get this latest release (also the link doesn't lead directly to files, but I've had to follow some links before finding the useful files listed...). So, I would suggest to put together and publish at least the 6.x-0.x-dev version ASAP.

I also think the setting in a general configuration file is not comfortable at all, not to mention that it can probably lead to more serious troubles (if someone manages to make settings file unreadable to Drupal). So, I've made some small changes to set the variable through an admin screen (as practically all other moduleas are doing it...) - this way, whatever you choose there, you shall not break anything... Furthermore, I've created a help screen (putting there more or less the useful content of the README file provided).

My contribution doesn't change the basic functionality in any aspect, it just makes the usage of this module a bit more comfortable (and maybe safe). As I am not a skilled coder, it would definitely be good that someone more experienced checks the code (it seems to work just fine on my system though). My code is in the attachment.

As a final touch, I would suggest to consider some (I believe just minor) twists to satisfy the Coder module, which currently throws out the following errors and warnings:

role_weights.module:

Line 82: Use "elseif" in place of "else if"
        else if ($form_id == 'user_admin_role') {

Line 129: Use "elseif" in place of "else if"
        else if ($form_id == 'user_admin_perm' && variable_get('role_weights_reorder_forms', FALSE)) {

Line 136: Use an indent of 2 spaces, with no tabs
            }

(!!!) Line 178: The parameters for form validation and submission functions have changed to $form, &$form_state.
      function role_weights_admin_role_submit($form_id, &$form_state) {

(!!!) Line 205: SQL query handling data in a potentially insecure way by using the %%s placeholder without wrapping it in single quotes. This is a potential source of SQL injection attacks when the value can come from user data.
              db_query('DELETE FROM {users_roles} WHERE rid = %d AND uid IN (%s)', $id, implode(', ', $uid));

---

role_weights.install:

Line -1: @file block missing (Drupal Docs)

Line 2: Include the CVS keyword $Id$ in each file. This should be in the format // $Id$ or // $Id$
        //$Id$

At least those 2 critical warnings, marked as (!!!) don't look nice at all (it may be also the Coder issue, but still - I just like it when Coder is not complaining...).

AttachmentSize
role_weights_admin_setting.diff 3.37 KB

#16

leafish_paul - June 8, 2009 - 13:38
Status:active» fixed

Thanks for your input! I have corrected some coding style as per Coder's recommendations, and the SQL insecurity is no longer an issue on supported branches (5.x-1.4, 6.x). I have also branched for 6.x, so there's a 6.x-dev version to use and test.

In order to mark this issue closed, I've added #485150: Add help and settings pages which I'll look at soon. Thanks again.

#17

System Message - June 22, 2009 - 13:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.