Jump to content

Modules Directory


ryan
 Share

Recommended Posts

Thanks for adding your modules Pete!

The ability to upload images for illustration/instruction purposes

I agree I'd like to add this eventually, but really only had a day of time to put towards the directory, so decided to leave that out. I think it's adequate that users can link to their image in the forum or GitHub with the BBCode tag. When I get more time, I'll add file uploads in the directory.

The ability to link to a YouTube or Vimeo video

This one should be relatively easy with the new TextformatterVideoEmbed module. :) Though I think I need to modify it a bit to recognize videos in BBCode, since BBCode seems to be using double <br> tags rather than paragraphs.

A download counter

I'd like to do this with a little javascript attached to the <a>, so as to avoid routing the file download through any passthru scripts, especially since we aren't hosting the downloads. But we can only count the downloads that originate from people clicking our download button. We can't track git clones or downloads from there, which I'm guessing would be a significant amount. Still, that may be okay as download quantity probably is still a good factor to judge relative popularity among modules.

One cool thing to consider: since we are now requiring a download URL to a ZIP file, and we're providing a web service of the data, we now have the prerequisites for automatic 1-click-installation directly in ProcessWire. It's cool to dream about anyway.

  • Like 1
Link to comment
Share on other sites

Didn't know whether we could grab images in an img tag via the BBCode library you'd used, but it males sense that you would be able to now I think about it since that ability has been around since the invention of BBCode, so that's handy.

You certainly managed a lot in one day! If I had days where I could pull off that amount of work then I'd I'd have less personal projects in the planning stages ;)

I agree with you on all the other points, and I like the idea of a module installer inside ProcessWire ;)

I foresee two download URLs being commonly used (I've used them both) - one is the direct link to the GitHub download and the other one is the direct link to an attachment on the forums. I guess it would be a case of somehow checking if a given URL is trying to pass the module installer a zip file and if so then grab it, else link to the download page.

I'm also guessing this is why you ask people for the class name, since inside a non-Github zip file the structure could be a bit odd, so being able to search for a file called ClassName.module within a zip file's folders would allow you to correctly install the module in the right place (for example in the event anyone zips up an unnecessarily long folder structure along the lines of /my/first/modules/doodah/MarkupSitemapXML/ which contains MarkupSitemapXML.module, not that I'd make it that hard for you ;)).

Link to comment
Share on other sites

You certainly managed a lot in one day! If I had days where I could pull off that amount of work then I'd I'd have less personal projects in the planning stages

When I'm motivated, I can develop stuff in PW pretty quickly. Other stuff, not so quickly. :) I'm sure I have just as many personal projects in the planning stages, though almost all are at least PW-related.

I foresee two download URLs being commonly used (I've used them both) - one is the direct link to the GitHub download and the other one is the direct link to an attachment on the forums.

The advantage of the GitHub download URL is that it never changes. So the same URL always points to the latest stable version. Linking to files in the forum is more tricky, because the author may have uploaded another and forgot to update the module listing, or may have simply posted another file, etc.

I'm also guessing this is why you ask people for the class name, since inside a non-Github zip file the structure could be a bit odd, so being able to search for a file called ClassName.module within a zip file's folders would allow you to correctly install the module in the right place

That's pretty much right. If we went towards an auto-installer, it would know to create a directory called /site/modules/[class-name]/ and unzip the files into that directory.

The other part of it is that the class name is used as the module's URL name in the directory (after being converted from camelCase to not-camel-case). This ensures no two modules exist in the directory that have the same class name.

Link to comment
Share on other sites

Nico, have you had a chance to try adding modules to the directory again? We've had a lot of stuff added, but I don't think any of yours are in there yet. Let me know if you are still running into any issues with the add module page.

Link to comment
Share on other sites

I noticed something also only while working on the Modules Manager module :)

Ryan, what's about the module version in code (000)? Is it also valid to write 1.0 or 1.0.1 in getModuleInfo array? I noticed some people (diogo, nico) use this to write the version and I think it's wrong.

Considering this it is a little annoying that one have to insert it manually and in two different formatting. On the module directory you enter 1.0.0 in the module code 100. Wouldn't it be better to make it consistent?

Also to understand it in general, why does 008 not work and return 0 or 0.0.0 ? I figure it is because it's octal? But why?

Link to comment
Share on other sites

I should probably make the module 'add' page use an integer rather than a string. But the two can be translated to/from each other (integer -> string).

1 = 0.0.1

10 = 0.1.0

100 = 1.0.0

111 = 1.1.1

I will plan to add this clarification to the module add form.

Link to comment
Share on other sites

Hi Ryan and all others!

This is a great addition and it will make it so much easier for PW users to find all these cool modules and themes.

I haven't been very active recently (have been without internet for quite some time because we moved to a new house and the internet/phone company had some issues when connecting us). But soon I'll become more active again and will update a few of my modules/language packs.

/Jasper

  • Like 1
Link to comment
Share on other sites

Soma's module manager wasn't able to get the file from the forum thread of my module http://processwire.com/talk/topic/1182-module-image-tags/.

Meanwhile, I created a github page and all works now.

I noticed that when I opened the link in the browser from the module manager, I was asked to login to get to the file. So, that's where the problem lives. The files from the forum are not opened to everyone, so they shouldn't be used on the modules pages as the download link. My mistake, but maybe there should be a reference to this on the "download url" field description.

  • Like 1
Link to comment
Share on other sites

It looks like hotlinking images from the forum also doesn't work. Not sure if it's the same issue with whether the user is logged in, or if it's just that the URLs are so long and complex that BBCode no longer recognizes them as valid image URLs.

During one of the next updates to the directory, I'm hoping to add file upload capability for image and archives, for the situations where GitHub may not be in use.

Also to understand it in general, why does 008 not work and return 0 or 0.0.0 ? I figure it is because it's octal? But why?

I don't know? :huh: Curious if anyone else does. I don't think I've worked with octal numbers in PHP before.

Link to comment
Share on other sites

PHP-newbie just had to find this one out - but it wasn't actually that much of a PHP-related thing after all... ;)

Also to understand it in general, why does 008 not work and return 0 or 0.0.0 ? I figure it is because it's octal? But why?

Yes, the leading zero makes it octal - and octal numbers may contain only digits 0-7, so your example was just a bit off the limits :). PHP.net says: "If an invalid digit is given in an octal integer (i.e. 8 or 9), the rest of the number is ignored.". (Whole article on integers.) And there's the explanation for 008 becoming a zero in the quote as well.

  • Like 2
Link to comment
Share on other sites

I don't know? :huh: Curious if anyone else does. I don't think I've worked with octal numbers in PHP before.

Well I was mixing something, the octal was from the permissions. However, you really don't know why the versioning number in modules is bugged?

Language Localized URl module has 008, but it show 0.0.0. Also 009 does. If entering 100 it works, or 007 too.

post-100-0-21907900-1343413411_thumb.png

Link to comment
Share on other sites

Soma - nik posted the answer at the same moment you hit reply, so check his post before yours ;)

EDIT: Oh, actually you already saw it as you already "Like" it.

Link to comment
Share on other sites

Yeah so I'm utterly confused, can someone enlighten me? :D Ryan? I want to be able to write 008 version! Wait, is it supposed to only go from 0-8? And why you're telling you don't know why and don't know octals? Maybe I'm wrong but I would expect you know about that? :) *scratches head*

Edit: I have no experience in proper versioning so forgive me my bothering, I'm might missunderstand this completely? Why is it using octals and the creator of it says he doesn't know? Sorry Ryan! :D

Link to comment
Share on other sites

Thanks Diogo, I think it dawns on me. So I have to write 010 or just 8. Got it. That has to be the most complex thing about modules in PW then. ;)

But why this method to write it in octal form? Is that common?

Link to comment
Share on other sites

Who's using octals? The module version number was never meant to be octals. It's just meant to be a plain integer. If you've ever seen me put leading zeros in a version number (whether in modules or in examples) then it was by mistake (let me know where so I can fix it!)

If you want to have version 0.0.1 then use: 1

If you want to have version 1.0.0 then use 100

If you want to have version 2.1.1 the use 211

Does this make sense? Or am I misunderstanding the question? :)

Link to comment
Share on other sites

Ok think it was only me being confused as you have 100 instead of 1.0.0 I'm sure I've seen 001 somewhere too. I always wondered but never bothered.

I think all yours are correct, but here you go.

class PagePathHistory extends WireData implements Module {
public static function getModuleInfo() {
 return array(
'title' => 'Page Path History',
'version' => 001,
'summary' => "Keeps track of past URLs where pages have lived and automatically redirects (301 permament) to the new location whenever the past URL is accessed. BETA TEST ONLY.",
'href' => 'http://processwire.com',
'singular' => true,
'autoload' => true,
 );
}
Link to comment
Share on other sites

Ryan, I'm trying to do ajax request to single modules. So far it would work (yes even cross domain), but the data returned is not valid. Can you check for ajax request and output the json different so it can be requested also from js?

The trick is to add the callback get var and wrap the json in parathesis ( { json } ).

Like this.

echo $_GET['callback'] . '(' . json_encode($results) . ')';

Maybe you can test for yourself to make sure it works, or I will do.

var jqxhr = $.getJSON('http://modules.processwire.com/export-json/'+mname+'/?apikey=pw223&of=1&jsoncallback=?',
 function(json){
console.log(json);
 }
);

Thanks.

Link to comment
Share on other sites

Ryan, I'm trying to do ajax request to single modules. So far it would work (yes even cross domain), but the data returned is not valid. Can you check for ajax request and output the json different so it can be requested also from js?

The trick is to add the callback get var and wrap the json in parathesis ( { json } ).

Like this.

echo $_GET['callback'] . '(' . json_encode($results) . ')';

Maybe you can test for yourself to make sure it works, or I will do.

var jqxhr = $.getJSON('http://modules.processwire.com/export-json/'+mname+'/?apikey=pw223&of=1&jsoncallback=?',
 function(json){
console.log(json);
 }
);

Thanks.

What you are describing is called JSONP (JSON with Padding). So the original data is valid, but not usable from cross domain. You can add own "cache" for it also (get the data through local php script) - but of course would be much more straightforward if JSONP would be available also.

PS: I love the modules directory and modules manager! You rock fellas!

  • Like 1
Link to comment
Share on other sites

I know apeisa. If adding this callback it will be valid. I know I could also cache it and download it but wanted to have it responsive for mouse hover. But I added the summary as this is loaded already. I think any makes not much sense to show whole description in the admin. It would be nice to be able to make requests using ajax.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...