Add setting to disable auto URL aliases for project nodes

nezroy - March 21, 2007 - 04:58
Project:Project
Version:6.x-1.x-dev
Component:Projects
Category:feature request
Priority:normal
Assigned:dww
Status:closed
Issue tags:6.x-1.0 wishlist
Description

Submitting a patch that adds two straightforward options. One disables the automatic creation of URL aliases (i.e. in the case that you want to use pathauto), and the other disables the automatic project overview page at the project/ URL (i.e. in the case that you want to use a view).

AttachmentSize
disable_auto_alias_overview.patch3.74 KB

#1

dww - March 21, 2007 - 06:34
Status:active» needs review

looks pretty good to me. but, i'm not using my normal workstation, so i can't actually test this well right now. will take another look when i have access to my test sites again.

#2

dww - June 6, 2007 - 07:35
Status:needs review» needs work

still haven't tested this, but i noticed a minor gripe with the code style: True should be TRUE. otherwise, this really should be RTBC.

#3

aclight - April 13, 2008 - 00:28

--------------------------
File to patch: project.module
patching file project.module
Hunk #1 succeeded at 246 with fuzz 2 (offset 129 lines).
Hunk #2 succeeded at 337 with fuzz 2 (offset 110 lines).
Hunk #3 FAILED at 467.
1 out of 3 hunks FAILED -- saving rejects to file project.module.rej

Note also that this patch creates a new variable, but does not include code in project.install to delete the variable in hook_uninstall(). That function might not have existed when this patch was originally written, but it's there now.

#4

agentrickard - August 6, 2008 - 14:17
Status:needs work» needs review

The 'project' path is a normal menu item and can be disabled via the menu system.

Turned off path aliasing makes sense to me, patch attached.

AttachmentSize
project_alias.patch 2.96 KB

#5

aclight - August 6, 2008 - 15:04

I could be wrong, and haven't checked the code, but it seems like we'd need some additional code in project_project_breadcrumb (or whatever that function is called), since I seem to recall that this function relies on the path of projects being /project/

#6

agentrickard - August 6, 2008 - 17:13

Does not appear to be an issue. The attached screenshots show the output of project_project_set_breadcrumb() with the patch applied and not. The menu system recognizes the project node as part of the Project* menu hierarchy in both cases.

AttachmentSize
breadcrumb_with_alias.png 41.47 KB
breadcrumb_with_patch.png 41.2 KB

#7

aclight - August 9, 2008 - 15:46
Title:Flags to disable auto alias and overview creation» Add setting to disable auto alias and overview creation

This looks good to me, but I have a few comments:

1. Do we want to wrap:

+  $form['project_enable_alias'] = array(
+    '#type' => 'checkbox', '#title' => t('Enable auto-generated project/[name] alias'),
+    '#default_value' => variable_get('project_enable_alias', TRUE),
+    '#description' => t('If checked, project module will automatically generate path aliases for each project. Uncheck if you want to use pathauto, for example.')
+  );

in something like:
if (module_exists('path')) {
}

Because if the path module isn't enabled, the setting will make no sense because aliases won't be generated anyway.

2. I fixed a code style error in the patch and reworded the title and description of the setting to be (IMO) more clear.

3. The description text for the Project short name (URI) element on the project node form is this:
"This will be used to generate a /project// URL for your project. This string is also used to generate the name of releases associated with this project."

However, if this new setting is disabled, an alias as such won't actually be created. This would also be the case in the module as it is now if the path module is disabled. Do we want to somehow change this description to be more clear? I'm not sure it's necessary, but for example if the user wanted to use pathauto to create aliases at /project/foo//, then I think the description in that field could confuse project owners.

AttachmentSize
129664_project_alias_setting_7.patch 3.35 KB

#8

aclight - August 9, 2008 - 18:14
Status:needs review» needs work

Also, what about the code in project_project_view(). $project->uri is used directly there to create links, and that's going to cause a problem if the shortname isn't aliased as expected, I believe. Setting to CNW for that reason.

#9

agentrickard - August 12, 2008 - 15:58
Status:needs work» needs review

Attached revision addresses the issues above, as follows:

1) Wrapped in a check, and the variable is set to FALSE if path does not exist.
2) Incorporated.
3) Fixed by adding variant text based on the setting. Also required a modification to project_release_alter_project_form().

As for the links in project_project_view(), these are not affected. $node->uri is actually the stored value of the short name from the form. These do not seem to be path aliases. Instead they are links that are interpreted by project_project_retrieve(), which accepts either the short name or the node id of the project.

AttachmentSize
129664_project_alias_settings_9.patch 4.62 KB

#10

dww - March 17, 2009 - 09:15
Version:5.x-0.1-beta» 6.x-1.x-dev
Status:needs review» needs work

I'd love to get this in before 6.x-1.0 (and I'd probably be willing to commit a backport to D5 if anyone still cares). Anyone up for a re-roll?

#11

fuzzy_texan - April 23, 2009 - 02:08

#12

dww - August 10, 2009 - 21:39
Assigned to:Anonymous» dww
Status:needs work» needs review

Rerolled for D6 in HEAD.

AttachmentSize
129664-12.project_alias_settings.patch 5.9 KB

#13

dww - August 10, 2009 - 22:51
Title:Add setting to disable auto alias and overview creation» Add setting to disable auto URL aliases for project nodes
Status:needs review» fixed

Committed to HEAD. I don't care enough for a backport to D5, but if anyone's interested, feel free to reopen this with a patch.

#14

System Message - August 24, 2009 - 23:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.