Jump to content

Google Docs Module Repository


Nico Knoll
 Share

Recommended Posts

Hi,

in a further post I mentioned the idea of a central "Module Repository". But there isn't a list with all of the modules. So I thought if everyone would add his module(s) to this list it would be much easier for Ryan to implement it (after the list is almost complete).

Would be great if you would add your modules (and if you like some others out of this forum).

Greets,

Nico

Link to comment
Share on other sites

Great idea Nico, thanks for getting the ball rolling on this! I've been thinking more and more about this modules directory, and it looks like we're both on the same wavelength here. I think your spreadsheet gets it nearly perfect, just a few tweaks I might suggest – let me know what you think?

1. Ultimately I want people to be able to browse by module type. So I'd suggest adding a column for module "Type" and optional "Subtype". Types would be: Process, Text formatter, Input field, Field type, jQuery, Markup, Page, Language, and Other. If it falls under "other" then, they would specify their own Subtype. I'm not positive this is the best categorization, but it's the only one we've got so far. If anyone has any ideas for a better categorization, feel free to suggest things, as the module directory may benefit from a different categorization system.

2. Instead of just Download URL, I'd suggest these 3:

  • GitHub URL (you already have this, but we'd require a GitHub URL)
  • Direct download (ZIP file) URL, regardless of where it's hosted (GitHub or otherwise). Eventually I want people to be able to install modules directly from the PW admin, so having a direct download URL will facilitate that.
  • Forum/Support URL (you already have this, but we'd keep the URLs columns all together)

3. In addition to 'description', have an optional extended description. Perhaps the two could be called 'summary' and 'body' or whatever you think is best. I'm not suggesting this to replace the "how to install" that you already have–keep it, it's great. I'm just wanting for people to have the option of including an extended description for the module's landing page. Whereas, the short 'description' or summary would appear in the module listings.

4. I like what you've done with having the creator name and forum name. Just wondering if we could split them in two columns: creator full name, and creator forum name (if multiple, then they would be split by commas). Ultimately I want people to be able to add and manage their own listings, and PW's going to need easy access to their forum name for authentication. We could get it in the parenthesis like you have, but thinking it might be even better just as separate columns… but you decide.

Link to comment
Share on other sites

Added mine just now (after I leasrned how to use GitHub - didn't want to be the only one not using it :P).

Hopefully I didn't undo/overwrite any or ryan's edits on the spreadsheet as I've no idea how Google Docs handles multiple simultaneous editors!

Link to comment
Share on other sites

  • 4 weeks later...

Just a little reminder for those who created modules: because of the forum change, the links to the "module info topics" do not work anymore. It might be a good idea to update the URL's, both in the Module info part of the module itself and in this list.

/Jasper

Link to comment
Share on other sites

Good shout - in fact it will mean anything on Github that links back doesn't work, but I think ryan may have a plan involving .htaccess for this (but changing the links would be helpful too).

Unless another moderator beats me to it I might see if I can do a search for links and update them tonight.

Link to comment
Share on other sites

All the redirects from the old (SMF) forums to the new (IP.Board) forums are now in place. This includes all the boards and topics.

You can take any URL from the old forums (http://processwire.com/talk_old/) and replace the 'talk_old' in the URL with 'talk' and it should redirect to the right place on the new forums. This includes boards, topics, and even pagination within topics.

Just in case anyone is interested (Pete?) I'm going to post how to do it, as I'm guessing someone, somewhere will eventually have this need again. And even if nobody is interested, I'm feeling proud of myself and want to type about it. :D

Redirecting all SMF boards and topics to IP.Board (IPB)

First, I added the following after the 'RewriteBase' line of IP.Board's .htaccess file:

RewriteCond %{REQUEST_URI} ^/talk/index\.php/(board|topic),
RewriteRule ^(.*)$ /redirect.php?it=$1 [L,QSA]

That basically says: Match any URLs that look like /talk/index.php/board, or /talk/index.php/topic (i.e. SMF style URLs), and send them to my PHP file called /redirect.php (rather than sending them to IP.Board). It sends the URL that was requested in a GET var called 'it' (this is the same method ProcessWire uses).

So now that we've got the URLs pointing to our /redirect.php file, we have to make the redirect.php file. Here it is (below). I'm matching the board URLs statically (with a translation array) since there are so few of them. For the topics, I'm going into both the SMF and IPB database and matching them up based on post time and subject.

<?php

// if redirect.php accessed directly without 'it' get var, then abort
if(empty($_GET['it'])) exit();

// static redirects for SMF boards => IPB boards
$redirects = array(
   'index.php/board,6.0.html' => '/talk/forum/7-news-amp-announcements/',
   'index.php/board,7.0.html' => '/talk/forum/8-getting-started/',
   'index.php/board,1.0.html' => '/talk/forum/2-general-support/',
   'index.php/board,5.0.html' => '/talk/forum/6-faqs/',
   'index.php/board,12.0.html' => '/talk/forum/13-tutorials/',
   'index.php/board,2.0.html' => '/talk/forum/3-api-amp-templates/',
   'index.php/board,3.0.html' => '/talk/forum/4-modulesplugins/',
   'index.php/board,11.0.html' => '/talk/forum/12-themes-and-profiles/',
   'index.php/board,4.0.html' => '/talk/forum/5-wishlist-amp-roadmap/',
   'index.php/board,8.0.html' => '/talk/forum/9-showcase/',
   'index.php/board,10.0.html' => '/talk/forum/11-pub/',
   );

// 'it' contains the URL that was attempted
$it = $_GET['it'];

// initialize $location, where we will store our found redirect URL
$location = '';

if(isset($redirects[$it])) {

   // see if we have a board that matches our array, so use it
   $location = $redirects[$it];

} else if(preg_match('/topic,(\d+)\.(\d+)?/', $it, $matches)) {

   // URL matches the format like: /talk/topic,1234.html (and similar)
   // so we'll connect a SMF topic ID to IPB

   $topic_id = (int) $matches[1];

   // get the optional starting post number (for pagination)
   $start = isset($matches[2]) ? (int) $matches[2] : 0;

   // get the SMF database
   $db = new mysqli('localhost', 'user', 'pass', 'smf_database');    

   // find the subject and posterTime from the SMF topic ID
   $result = $db->query("SELECT subject, posterTime FROM smf_messages WHERE smf_messages.ID_TOPIC=$topic_id ORDER BY posterTime LIMIT 1");

   if($result->num_rows) {
       // found the SMF topic
       list($subject, $posterTime) = $result->fetch_array();  

       // sanitize for query  
       $posterTime = (int) $posterTime;
       $subject = $db->escape_string(trim($subject));

       // connect to the IPB database
       $db = new mysqli('localhost', 'user', 'pass', 'ipb_database');

       // retrieve the ID and title_seo from IPB that matches the posterTime and subject
       $result = $db->query("SELECT tid, title_seo FROM ipb_topics WHERE start_date=$posterTime AND title='$subject' LIMIT 1");

       if($result->num_rows) {

           // found it, build the redirect URL
           list($id, $title_seo) = $result->fetch_array();
           $location = "/talk/topic/$id-$title_seo/";

           // add the starting post number if we're redirecting to a page number
           if($start) $location .= "page__st__$start";
       }
   }
}

// if no location was found, just redirect to the forums index
if(!$location) $location = '/talk/';

// perform the 301 redirect
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $location);
Link to comment
Share on other sites

I like it - I think I had the necessary steps in my head, just not the necessary coding skills (regex makes my brain hurt every time I have to tackle it).

This script, with a few modifications, could probably be used to redirect most old urls to new urls on most forums, so it's definitely useful and thanks for posting ryan :)

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...