I am not sure if this is a bug or pathauto intends that letters in uppercase becomes lowercase.

If this is a bug, well...then letters in uppercase are transformed to lowercase. If relevant, I am running pathauto.module,v 1.22.2.9 2006/10/22 21:51:09

if this is intended and therefore isn't a bug then please consider this as a support/feature request.

For example:
nodetype IS blog.
nodepath settings/pattern for all blog paths is [user]/Blogs/[catpath]/[title]
and my categories are actually all capitalized eg. Travel
eg. title is Oslo by Night, user is JohnNoc

separator is -

so instead of having: www.example.com/JohnNoc/Blogs/Travel/Oslo-by-Night
I get: www.example.com/johnnoc/blogs/travel/oslo-by-night

Thanks!

John

Comments

JohnNoc-old’s picture

This page was duplicated...sorry... but this is the correct one.

greggles’s picture

Title: uppercase becomes lowercase » allow users to specify whether the URL should be all lower case or leave patterns alone
Version: 4.7.x-1.x-dev » 6.x-1.x-dev
Category: bug » feature
Status: Active » Postponed

Yes, it is currently by design that it works this way and have changed the status, version, and category to correspond. I set it to postponed just because I'm not going to work on it. If someone else wants to assign it to themselves and work on it then they should take it out of postponed.

If we implement it then the best way will probably be an option for the user to specify whether they want:

1. leave the pattern alone (e.g. if it comes in as JohnNoc then leave it as JohnNoc)
2. lowercase the pattern (e.g. if it comes in as JohnNoc then turn it into johnnoc)

Perhaps there is another option (uppercasing the pattern, or mixed-casing it) though I don't think those would be popular.

Do you have any thoughts on how to implement this in the UI?

My initial thought was just radio buttons or a checkbox.

My second thought was that we could use the pattern to indicuate how it should be treated so that:

[user] indicates that you want it to be lowercased
[User] indicates that you want it to just be left alone (e.g. don't change the case of the characters)
[USER] indicates that you want it to be turned into caps

That would add some complexity in the replacement of the strings, but provides the option of casing without requiring yet another checkbox and allows for very granular control over the patterns.

JohnNoc-old’s picture

Hi! Thanks for looking into this. I just hope that someone takes the time in trying to implement this :-)

Anyway, regarding your thoughts on the matter.....

  1. I totally agree with these two options.

    If we implement it then the best way will probably be an option for the user to specify whether they want:

    1. leave the pattern alone (e.g. if it comes in as JohnNoc then leave it as JohnNoc)
    2. lowercase the pattern (e.g. if it comes in as JohnNoc then turn it into johnnoc)
  2. I also agree that the 3rd option will not be that popular. But if it isn't that much complicated coding wise (w/c i don't have a clue on), then why not add it as well. Adding more options I think is always a good thing...more freedom to the user.
  3. UI implementation?
    Personally, I prefer the radio button over the checkbox and over the use of patterns-per-path-setting. A checkbox, in my opinion, connotes multiple selection, (eg. check which are appropriate) whereas a radio button gives an either-or connotation, don't you agree? And in this case, a user cannot choose more than one option, either 'all lowercase' or 'Leave-As-Is".

    Regarding using patterns to indicate how capitalization should be treated, giving that much freedom of choosing different patterns per nodetype, Category, blog, User-Tracker, USER, etc. opens up the possibility of url clutter for the site. It will be confusing to site visitors. IMO, it will be a step backward for websites and is not so Web 2.0/3.0's "well-formedness".

    To illustrate that patterns-per-path-setting looks dirty:
    www.example.com/User/greggles/BLOG/Blog-Title
    www.example.com/articles/Article-Title
    www.example.com/Books/book-path/Page-Title
    www.example.com/IMAGES/Category/image-title
    www.example.com/contact-us
    www.example.com/Front-Page
    www.example.com/User/greggles/TRACKER
    of course a user can make sure that all nodetypes look the same, all titles look the same but if users dont have a choice on this, it's like we are assuring that url of drupal powered sites, even if they have the freedom and the power of creating aliases, will still be well-formed. Does that make sense?

    So site-wide, it's either all are in lowercase (most-widely used) or leave-as-is (for URLs to be contextual, and well-formed)....and selected via a radio button

  4. ...and because this request has a 'postponed' status. here are my views why this feature will be a good addition.
    Selling points to Drupal coders: The feature....

I believe that this will be a great feature for Drupal sites. Are you convinced now? :-))

Thanks for taking the time in reading this looooong comment.

John

greggles’s picture

Hi John,

First, thanks for the long and well thought out response. I do appreciate you spending time and providing such a well thought out analysis.

That said - I'm not interested in spending my free time on it but perhaps someone else will be. If you or anyone else creates a patch and provides guidance on how to test it I'd be happy to review and apply.

Thanks again.

jaydub’s picture

Version: 6.x-1.x-dev » 4.7.x-1.x-dev
Status: Postponed » Needs review
StatusFileSize
new2.28 KB

I just ran into this very same issue today so here's my attempt at a patch. this is for the latest 4.7.x module. I created a radio option in the settings where value of 0 is keep lowercase and value of 1 is maintain user's case. I searched and found 3 calls to drupal_strtolower and just wrapped those 3 function calls in IF..THEN tests based on the value of the setting.

A quick test seems to be ok...feel free to try out and let me know.

greggles’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Needs review » Needs work

It's a feature request so it needs to be for 5.x and not 4.7.

Thanks for rolling this, though. Hopefully it will be small change for 5.x.

greggles’s picture

I just took a closer look and would port this to 5.x-

However - it's not clear to me why you removed the strtolower on the variable_gets:

$pattern = drupal_strtolower(variable_get('pathauto_'.$module.'_pattern', ''));

that seems like it's intended to remove the situation of an admin who sets [Title] and then gets the literal "[Title]" in the URL rather than the replacement. I think we should leave those two in the code unless you are seeing something that I'm missing.

Eep’s picture

Version: 5.x-1.x-dev » 5.x-1.2

Subscribing... (what kind of forum doesn't have a way to subscribe without having to post? sheesh)

greggles’s picture

Version: 5.x-1.2 » 6.x-1.x-dev

changing version to the right one (no new features in 1.x).

See http://drupal.org/node/34496 for information on subscribing without followup.

@eep, you would endear yourself to the community if you 1) searched for issues prior to complaining about them 2) worked to fix some of them instead of complaining.

Eep’s picture

I complain when something isn't easy. Each issue/thread should have a "subscribe" button in the thread, as is common in, oh, just about every forum software out there--except Drupal's, that is.

If no one complained, everyone would think everything was just fine, but it's not. :)

greggles’s picture

Version: 6.x-1.x-dev » 5.x-2.x-dev
Status: Needs work » Fixed

I committed a variation of what jaydub had created to the 5.x-2.x branch.

Thanks everyone for your ideas, code, and reviews.

David Latapie’s picture

Title: allow users to specify whether the URL should be all lower case or leave patterns alone » Subscribing

Just to subscribe to the issue.

David Latapie’s picture

Title: Subscribing » Case-sensitive?
greggles’s picture

Title: Case-sensitive? » allow admins to specify whether the URL should be all lower case or leave patterns alone

@david lataple - please note that this is already implemented on the 5.x-2.x branch. So, you should be able to just use that to test out the feature.

Anonymous’s picture

Status: Fixed » Closed (fixed)
J-K@www.drupalcenter.de’s picture

Category: feature » bug
Status: Closed (fixed) » Active

I don't know, if the right way is to re-active this issue or if i should create a new issue.

Although the option "Character case" is set to "Leave case the same as source token values.", my path becomes lowercase: In fact, for example my pattern for all image paths is "Bild/[title-raw]" (without quotation marks of course).
But pathauto generate a path like "/bild/Title". The spelling of [title-raw] is correct, but my static text "Bild" becomes lowercase.

Why?
Is there a way to correct this behavior?

Thanks,
J-K

greggles’s picture

Status: Active » Needs review
StatusFileSize
new1.3 KB

Well, this seems to be caused by the following code:

  if ($type) {
    $pattern = drupal_strtolower(variable_get('pathauto_'. $module .'_'. $type .'_pattern', ''));
  }
  if (!trim($pattern)) {
    $pattern = drupal_strtolower(variable_get('pathauto_'. $module .'_pattern', ''));
  }

Which was added (more or less, it's been modified a couple times, but look for the strtowloer(variable_get( in http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/pathauto/pa...

That's revision 1.1.2.1 from February of 2005. So, I guess it's just always been this way. The only reason I can imagine that this would be a problem is if an admin sets something like [Title-raw] as the token, but our token checking should fix that, so...I'm inclined to switch this around. Please test the attached patch.

Thanks.

J-K@www.drupalcenter.de’s picture

Yes,
the patch fixed it!
THANKS!

I'm not sure if it belongs to this, but in pathauto_node.inc , line 53 there is also code with strtolower:

if (!trim($pattern)) {
      $pattern = drupal_strtolower(variable_get('pathauto_node_pattern', ''));
    }

J-K

greggles’s picture

updated patch to include that change. Your catch made sure this will work for bulkupdates as well.

Applied to DRUPAL-5--2 - 6.x coming soon.

greggles’s picture

Status: Needs review » Fixed

And to 6.x.

Thanks for the quick testing and for the additional change, J-K!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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