Context URL is a very little and fast module. It gives you the opportunity to use the complete page url as Context condition: you can check if the URL string matches a given shell wildcard pattern, also described in fnmatch PHP function.

So you can use wildcard * and []. Take a look at this: fnmatch.

Context URL is descended (uses code) from Context PHP, a more powerful and flexible module for Context management.

You can use it instead of a more sophisticated module like Domain Context if you want to check the domain URL. You can use, also, in place of Context plugin from path because it doesn't give you the possibility to check the complete URL but only the page part.

Commits for Context URL:
http://drupal.org/node/1387780/commits

Project Page:
http://drupal.org/sandbox/gianfrasoft/1387780

Versions:
Drupal 7

How this module is different from other similar projects:
Context URL offers a very easy approach to context definition by accessing page URLs, easyer and faster then domain module's.

CommentFileSizeAuthor
#4 drupalcs-result.txt3.02 KBtargoo
#1 syntax.txt3.77 KBnick_schuch

Comments

nick_schuch’s picture

Status: Needs review » Needs work
StatusFileSize
new3.77 KB

Your result when running it through code sniffer (also attached): http://ventral.org/pareview/httpgitdrupalorgsandboxgianfrasoft1387780git

You will need to setup a branch called 7.x-1.x instead of using the master branch.
A README.txt should be included with your module.

gianfrasoft’s picture

Thank you very muck @nick_schuch,

I committed a new version with a README.txt file included and some upgrade.

Bye.

gianfrasoft’s picture

Status: Needs work » Needs review

ok to go

targoo’s picture

Status: Needs review » Needs work
StatusFileSize
new3.02 KB

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.

targoo’s picture

Manual review :

1) contexturl.info

Clean your info file by removing :

version = "7.x-1.x-dev"
core = "7.x" (appear twice)
project = "contexturl"

gianfrasoft’s picture

Thank you targoo.

I did it.

gianfrasoft’s picture

Status: Needs work » Reviewed & tested by the community

I think it's time to go online...

patrickd’s picture

Status: Reviewed & tested by the community » Needs review

I'm sorry, don't RTBC your own issues

krylov’s picture

Hi,-
please
1. remove duplicate
core = "7.x"
from contexturl.info
2. please write README.txt

gianfrasoft’s picture

Removed duplicate
core = "7.x"
from contexturl.info

New commit is online.

Thanks.

Anonymous’s picture

Status: Needs review » Needs work

My manual review :

1) You are still working in the master branch, you're not supposed to create a subfolder called 7.x-1.x
Get a look at : http://drupal.org/node/1066342

2) The README file is not well formatted, it is supposed to be a UNIX file format with 80 columns.

3 ) Do not include the LICENSE file, it will be automatically added by drupal

4) The .info file is not well written. Version and project tag should not be there
See there http://drupal.org/node/542202

gianfrasoft’s picture

Hi, Quentin Albrand, and thank you very much for your attention.

About your first comment: I'm not a good Git user (I'm a Window's user) but my project stays on a directory structure like this:
\7.x-1.x\contexturl

I really don't understand how do the subfolders' structure have to be...

Please, help me...

patrickd’s picture

branches have nothing to do with folders or their structure, please read the documentation about how to use git on drupal.org

gianfrasoft’s picture

Status: Needs work » Needs review

I created a Branch. I hope I did a good job.

Please, take a look... Thanks!

serjas’s picture

to access the files, i have to go 3 level after branch .. is that permitted? (http://drupalcode.org/sandbox/gianfrasoft/1387780.git/tree/refs/heads/7....)

sreynen’s picture

Status: Needs review » Needs work

Hi gianfrasoft,

As #15 suggested, you need to move the files up to the same directly your .git is in, so the repository is a list of the files in your project, not a container directory.

klausi’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

gianfrasoft’s picture

Status: Closed (won't fix) » Needs work

Sorry, my problems with git is the only reason why I can not close this project.

I'll try again.

mxt’s picture

Please, release this as full project: I'm using subpathauto and context modules, but no context can be set with urls like node/*/sub-page.

I think this module can resolve this issue (can't it ?)

Thank you very much

PS: I've also evaluated this sandbox project: http://drupal.org/node/1475274 but seems that there is no more activities there...

gianfrasoft’s picture

Yes, it does exactly what you say.

I have some problem with Git configurations and have no time to solve it... sorry.

I'll try to do something next week. Any help would be appreciated.

mxt’s picture

Ok, I've tried to test your module, here's the results:

  1. Iast commit doesn't work due to some folder issues (/plugins), so I've used the 4e1f397 commit snapshot.
  2. I'm not sure about the use of:
    $current_url = $_SERVER['HTTP_HOST'].request_uri();
    in your execute() function, because it check all the url (ok, this is by design) but how do you manage it when you deploy your site from development to stage to production? You have to change the url in every ambient? For example:

    I think this module should limit the url checking only for the last part (using for example $current_url = request_path();) and leave to Domain Context module the management of complete urls.

  3. Your execute function works only if only one path is written in the context condition textarea: if you write more than one path (one per line) the matching can't works and the condition is not triggered. So the module have to manage better multivalues in $options['pageurl']

However this is a very useful module: thank you for working on it!

Hope this help

Good work!

deciphered’s picture

I have tested the latest copy of the module and it's not currently working, however I did supply a patch (as I actually need this module) to get it back on track as well as extended an offer to help mentor the developer to get the module ready to release.

mxt’s picture

Thank you Deciphered!

FYI in the meantime I'm using Context Request Path that works like a charm.

Can we hope for an integration between these two modules? For example the feature to check ALL the full url or only the final part could be an option to choose from.

Thank you very much

deciphered’s picture

MXT,

My specific need is only achievable with the Context URL module, so I can't really comment on integration with the two, and it's really up to the two developers to discuss that prospect, but in general I'm all for collaboration.

gianfrasoft’s picture

That's right! It's a limit, I know: you have to change context rules every time you move your site to another host but I don't want Context URL to be limited to specific domain.

One of the greatest opportunity offered by this module is to rule domains!

Differently, I agree when you say that the module have to manage better multivalues in $options['pageurl']. I'll create a patch asap.

Thank you!

gianfrasoft’s picture

Title: Context URL » Manage multivalues in $options['pageurl']
Assigned: Unassigned » gianfrasoft
Category: task » feature
Status: Needs work » Active

Ok, so I changet title and categoty to this task.

klausi’s picture

Title: Manage multivalues in $options['pageurl'] » Context URL
Assigned: gianfrasoft » Unassigned
Category: feature » task

Project applications are tasks. Only reviewers should assign project application issues to themselves. The project application title should reflect the module/theme name.

You need to set the status to "needs review" if you want to get a review, see http://drupal.org/node/532400

gianfrasoft’s picture

Status: Active » Needs review

Sorry! I mixed up the task I was working on at the same time!

@MXT, I'll work on your request just after my module will go online!

Thank you, @klausi.

gianfrasoft’s picture

I updated project to a new stable version.

Thank you, Stuart Clark!

deciphered’s picture

Status: Needs review » Reviewed & tested by the community

I've left one last set of notes on coding standards, just regarding whitespace in a few of the files.

There's a few other minor issues via Coder, but I think this is definitely in a releasable state.

I would recommend some reading of Git workflow as there seemed to be quite a bit of confusion, tagging a sandbox release and such, but good work otherwise. Happy enough to mark it as RTBC.

deciphered’s picture

@MXT,

Looking back at your comments on #21, I have to completely disagree, the reason I wanted this module was that I don't want the complexity of the Domain module but I want a way to switch certain reactions based on the domain of the URL for the purposes of environment switching.

For example, with this module plus my recently released Contextual variables module I can set a reaction on www.mysite.com* that will disable the Environment indicator from showing up and I didn't need to resort to the complexity of the Domain Access module to do it, simply a Context condition and reaction.

If anything, I would vote that this module should only deal with the domain part of the URL as for me the path can be managed via the existing reactions, but I see no reason to reduce that functionality when it doesn't hurt anyone.

mxt’s picture

@Deciphered,

in my #23 I've already proposed to add an interface option that could resolve the impasse: a simple radio-button like this for example:

[] check ALL the full url (domain included).
[] check only the final part of the URL (request_path).

Could this be the solution to meet all needs and make this module really complete?

gianfrasoft’s picture

I think this could be an interesting enhancement for the module for what you could open an issue on module's page (please, do it!).

Here the discussion is about the module validation and I hope you would support it: I'll give my time to support all the requests from the community because my interest is to make my module even more useful.

Thank you very much for your suggestions!

stborchert’s picture

Status: Reviewed & tested by the community » Needs work

Hi Gianfranco.

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Your branch should be named "7.x-1.x" (so you need to delete the branch "7.x-1.0" as well).

Additionally you've already created a tag named "7.x-1.0" which is basically an indicator for the first stable release (which is not ready yet).

Leaving this behind the module looks very clean and very (!) usefull.

gianfrasoft’s picture

Status: Needs work » Needs review

Thank you. Now I changed default branch and deleted all tags. Please, check...

kscheirer’s picture

Assigned: Unassigned » kscheirer

It wasn't clear to me form the project description what your module does - especially since Context already supports path matching. I think you could use a few examples on how it works instead of just referring to fnmatch.

kscheirer’s picture

Assigned: kscheirer » Unassigned
Status: Needs review » Reviewed & tested by the community

What is on the first line of your README? I see it in my browser as \feff.

These kinds of comments are useless - either put something helpful in there or just delete them :)


/**
  * condition_values function
  */
function condition_values() {
  return array(1 => t('True'));
}

There's a typo in your plugin, "forumula" should be "formula".

Instead of $_SERVER['HTTP_HOST'] I think you can use the global $base_url variable. The boolean logic in your execute() function is a little messy, you could definitely clean that up, but it seems like it would work. You should also remove the master and 7.x-1.0 branch, and just work out of your 7.x-1.x branch only. When you are ready for a point release (7.x-1.0) - that's a tag that you make from the 7.x-1.x branch.

These are mostly minor issues though, except for maybe the git branches, but I don't see any critical problems.

kscheirer’s picture

This may be a duplicate of Context Domain, although context domain doesn't seem to have a release? Not sure how to handle that.

gianfrasoft’s picture

Ok. As I wrote in project description:

You can use it instead of a more sophisticated module like Domain Context if you want to check the domain URL. You can use, also, in place of Context plugin from path because it doesn't give you the possibility to check the complete URL but only the page part.

I think this is clear. In other words, using Domain Context means to put thousands of PHP commands in your project, using Context path plugin means that you have the possibility to check only the page part of the URL.

Tou can suggest me a different description, my english isn't great... sorry. But my module is in sandbox since 1 year and now it works very well...

gianfrasoft’s picture

What is on the first line of your README? I see it in my browser as \feff.

I changed file format to UTF8 without BOM.

These kinds of comments are useless - either put something helpful in there or just delete them :)

Do you think this is a problem?

There's a typo in your plugin, "forumula" should be "formula".

Ok, corrected!

Instead of $_SERVER['HTTP_HOST'] I think you can use the global $base_url variable.

In my test installation, based on Microsoft IIS, sometimes $base_url is empty. I couldn't solve this problem but I see on Internet there are other people with the same problem. So I can't use the variable. But I don't think this might be a problem for the publication of my module...

The boolean logic in your execute() function is a little messy, you could definitely clean that up, but it seems like it would work

I need to go online, after that I can plan to refactor the module and write a better code. After all you can see there are lots of conditions...

You should also remove the master and 7.x-1.0 branch, and just work out of your 7.x-1.x branch only. When you are ready for a point release (7.x-1.0) - that's a tag that you make from the 7.x-1.x branch.

Ok, I'm going to do it...

gianfrasoft’s picture

No, it is not!

From description:

You can use it instead of a more sophisticated module like Domain Context if you want to check the domain URL.

Domain is a very big module: why do I have to install Domain if I can install a faster and smaller module like Context URL and do the same in a more and more easy way?

gianfrasoft’s picture

@kscheirer

Thank you for everyting you did for this module.

I see on GIT one only branch and in Readme file disappeared \feff char. Any other consideration from you will be welcome.

Bye.

kscheirer’s picture

Thanks for the extra info, you already have RTBC from me :)

chx’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, gianfrasoft!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

.