In addition to the existing "list all projects of a specific type alphabetically", we'd like to be able to browse projects by category, by date, and potentially by other parameters, e.g., most popular.
Here's a first rough take on how to do this.
The approach is based on adding new path options. Instead of
project/type/version
(what we currently have), a fully expanded path would now include:
project/type/sort_option/version/tid
Sort_option is the means used to browse/sort projects. I've implemented 'recent' (view by date), 'categories' (view by category--more on this below), and 'all' (what we now have: all alphabetically). Other opions, e.g., 'popular', could readily be added given data to use.
The tid on the end of the path is used only for the 'category' sort_option, and is a requested category.
Some paths and what they would produce:
project- a list of available project types (Modules, Themes, etc.)
project/Modules/recent/4- paged list of recently added or updated version 4 modules
project/Modules/categories/4- list of categories having version 4 modules
project/Modules/categories/4/521- paged list of version 4 modules in term 521 (which could be, e.g., "xml", for modules using xml)
To avoid having too many levels of local tasks, I've moved
project/type
to be a MENU_NORMAL_ITEM instead, so that the local items begin with the sort_option instead.
Like I said, it's rough. A lot of what needs fixing up relates to the versioning, and to default local tasks. But some initial feedback first would be great. Is this a good approach?
Screenshot to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | project_sort_options_9.patch | 31.67 KB | nedjo |
| #25 | project-sort-options_8.patch | 29.12 KB | nedjo |
| #20 | project-sort-options_7.patch | 28.03 KB | nedjo |
| #19 | project-sort-options_6.patch | 29.64 KB | nedjo |
| #14 | project-sort-options_5.patch | 18.93 KB | nedjo |
Comments
Comment #1
nedjoScreenshot. With incorrect breadcrumb, confirming that this is indeed rough!
Comment #2
nedjoComment #3
pfaoclePatch?
Comment #4
nedjoDon't know what void the attachments disappeared into. Here, for what it's worth, is the pre-forms api changes patch I posted before. I'm hoping to get time to work on this next week, and will post an improved patch as soon as I can.
Comment #5
nedjoOkay, here's a more polished patch. The trickiest part was ensuring that paths are set correctly to conform with MENU_DEFAULT_LOCAL_TASKs. A $base_url variable is used, and added to selectively, i.e., only when the url fragment in question isn't the default local task and therefore needs to be included.
Sort option is a configuration option. Setting it to 'categories' will bring up the category navigation by default.
As well as the local tasks, I've added in a block for category navigation (this was issue #32394). The block displays only when we are browsing projects by category, and lists available categories by version.
Testing steps:
* apply patch
* ensure you have some test projects, ideally with versioned releases
* click the 'projects' link in navigation
A test version is up temporarily at:
http://www.islandnet.com/~nedjo/costarica/?q=project
I've done some basic testing but more would be great. E.g., I haven't looked closely at how this works when taxonomy is disabled, or when we are not browsing by version.
How does the basic approach look? Any suggested tweaks, or wish list items for what this doesn't do?
Comment #6
nedjoBugfix in block (and leaving out release.inc changes from previous patch, designed to refresh cached release version listing as needed--this should be a separate issue.).
Comment #7
webchickExcellent!!
Reviewing off the demo...
1. Is it easy to check if there are projects of a category type and *not* display that category name if so? (e.g. xml, etc.)
2. Under categories, when I click on the "cvs" revision, and click one of the categories listed there (utility, widgets) I get the error:
user error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
query: SELECT DISTINCT(n.nid), n.title, nr.teaser, nr.format, n.changed, p.issues FROM node n INNER JOIN node_revisions nr ON n.vid = nr.vid INNER JOIN project_projects p ON n.nid = p.nid LEFT JOIN term_node r ON n.nid = r.nid WHERE n.status = 1 AND r.tid = 1 ORDER BY in /data/in/n/nedjo/www/costarica/includes/database.mysql.inc on line 108.
3. In the "all" view, is it possible to display what category(ies) each project belongs to along with the download | find out more | bugs and features links?
That's all I see right off. Overall, this will be a very welcome addition to Drupal.org! Thank you so much for taking this on!
Comment #8
webchick1. Is it easy to check if there are projects of a category type and *not* display that category name if so? (e.g. xml, etc.)
That was really wrongly and weirdly worded, hehe. I meant that if there aren't any "xml" projects, "xml" shouldn't be displayed in the category list, else it's just a click that goes nowhere.
Comment #9
webchickThought of another couple things (sorry but you asked ;))
1. How does the "recent" list get its date/time value? Is it based on when the project was created, when the project description was last updated? Or (most peoples' preference, but may not be achievable) on when the last CVS commit was issued to the project?
2. Could you please display the "Last updated" date/time (or the "Created on" date/time if that's what it's sorting on) in the list of most recent projects?
Comment #10
nedjoThanks for the cogent comments.
Thanks, fixed in attached patch.
When the patch at http://drupal.org/node/37927 is committed (reviews anyone?), we'll be able to sort by CVS commit change date.
Good point. The code does do this check. I think we're seeing the result of some data anomoly from my various previous test projects, i.e., a project categorized as xml whose manually-created release doesn't have a file and so isn't showing up.
As more reviews come in I'll work on revisions including suggestions like showing dates/categories.
Comment #11
Bèr Kessels commentedReviewing the DEMO.
* I beleive the primary browsing method is the version. It is the first selection criteria when one wants modules. So i think the version should be the main tabs
* If my previous point is found unfit, then at least it should remember my last chosen version and choose that as default on another tab. If I go to recent, choose "hello" and then browse to all it reverts to the default version.
* I beleive we need to have more then one vocabulary:
* category of use (what you have now)
* maturity (stable, betha, alpha, in development)
* audience (developers/API, administrators, end-users, moderators)
* and last I think we could hook in cvs module to present an additional list of most acti ve projects. cvs module has that data available.
So far, I really really like this idea, thank you for all the hard work.
Comment #12
dries commentedReviewing the demo without reading the other reviews or nedjo's explanation:
(I didn't want to pollute my opinion so excuse me if I'm stating the obvious or repeating what is already known.)
?tid=x?Comment #13
dries commentedI read Ber's review now. Some comments:
* I beleive the primary browsing method is the version. It is the first selection criteria when one wants modules. So i think the version should be the main tabs.
I disagree. Speaking for myself, I want to get to the project quick. Once I found the project, I want to check the available versions. I don't want to bother with versions until I found what I'm looking for. Browsing by version is not very useful IMO and only adds more intermediate clicks.
* maturity (stable, betha, alpha, in development)
That is where rating comes in. Rating should be a fourth tab: 'sort by rating'.
Comment #14
nedjoHere's an updated patch implementing many of the suggestions/requests. The updated demo is at (same place):
http://www.islandnet.com/~nedjo/costarica/?q=project
The main visible changes are:
* implemented category choices as tertiary/third-level local tasks
* breadcrumbs (I think) fixed, redundant labels/titles eliminated
* primary task tabs read 'browse by category', 'browse by date', etc.
* &tid=x removed from url
* browse by date shows last changed time
* deleted the block
Changes in coding approach:
* factored out sorting methods into a single hook function project_project_sort_methods(). This provides a clear basis for later adding in further sorting methods.
Problems at this point:
* When browsing by category, the secondary local task tabs don't register the 'active' task (except when the third-level local task is the DEFAULT_LOCAL_TASK). I'm having a hard time troubleshooting this problem, as I don't follow well how menu.inc handles determination of what is on the active path. Help on this from a menu guru would be very welcome.
Comments:
* It's a challenge to get these sorting methods to work in all the various scenarios possible in project.module: taxonomy is enabled or not, we're browsing by version or not, etc. I've taken the approach of introducing full functionality for the drupal.org configuration- taxonomy enabled, browsing by version - and then selectively disabling methods in other configurations when enabling them is too difficult. E.g., I've disabled browsing by category when we have browsing by version disabled.
Comment #15
nedjoFound the local tasks solution (thanks to Richard Archer for troubleshooting help). It was a css issue that should probably be fixed in drupal.css, so I posted a patch, http://drupal.org/node/38862. Failing that I could just add a couple of lines to project.css. The test site is now displaying correctly.
Comment #16
nedjoSounds useful. Would I do this through sessions?
I'm thinking of this as only one way of categorizing the content. We can add additional vocabs as well, but it would seem messy to mix them into this same interface.
Comment #17
dries commented<h2>$date</h2>tags separating projects by date. Right now, the Last changed changed date is tiny. The Last change date should be added to the project overview page.?q=node/1/releaseare not correct.(I created an account on your test site. Could I get additional permissions to play with the categorization, etc?)
Comment #18
nedjoThanks for comments, I'll get coding. Some quick thoughts/questions meantime.
Would it help if we presented the categories differently, e.g., as a list? The certainly don't have to be tabs.
Can do. This would be consistent with cvslog. (Maybe I'll look there to crib code.)
What I've done is retain the browsing by version that's currently in the module as a second-level local task. Dries, are you saying you'd prefer to ax this altogether, and have lists that mixed versions? E.g., if we're viewing modles in a particular category, we'd see a list of modules that could be any version, then we'd pull up specific listings and see if they included the version we're looking for?
I agree this would make the presentation simpler. But I'm thinking of Ber's point above,
. Eliminating the version altogether from browsing/sorting would have some cost in terms of user expectations. And it will require a lot of recoding :). Maybe I'm just feeling lazy, but I'm wondering if we can get some user feedback on this before stripping out the version browsing. Maybe I'll post a question to the development list.
I don't *think* that's caused by this patch. I'll take a look and maybe open another issue (or eat my words).
On my demo site, I think this just reflects empty data (lack of categorized themes).
Comment #19
nedjoHere's a fixed up patch. Changes:
* Eliminated version local tasks. We now have a select control, labeled "Filter by version", that can be used to select a particular version. As per Ber's suggestion, once set, the version persists across a session. (If the configuration option for browsing by version is set to disabled, this control disappears.)
* When browsing by category, available categories are in collapsible fieldset, expanded when no term has been selected and collapsed when there is a term selected. This way users can easily switch to a different category, but screen space isn't cluttered. Added list-style-image to visually identify the active category in the list. Added numbers of projects next to the categories.
* Added links to categories to project view. Disabled the regular $node->taxonomy links, as they lead to the taxonomy/term/tid path, not useful in this case.
* Added date headline separator when browsing by date.
* Added block for quickly navigating to a particular project. This addresses the "I already know what project I want, I just want to get to it" need. It can also be a quick way to browse all projects by name.
* Several minor formatting and similar changes.
Updates viewable at:
http://www.islandnet.com/~nedjo/costarica/?q=project/Modules/
Comment #20
nedjoFix to a couple of errors in the previous patch, e.g., sort order in listings (I'd used n.title DESC instead of ASC), plus a bit of cleanup.
Comment #21
dries commented- css names should not use underscores. Use dashes instead.
- Do we need the new CSS definiations? Can we reuse the normal arrows? Just making sure we're not mixing styles.
- I think you can drop the 'quick' from the project block.
- The project settings page (admin/settings/project) could use some fieldsets.
- The following code looks somewhat hairy -- and possibly dangerous. You're doing a goto to user-supplied data. Better make sure it's 100% secure and that it can't be used for XSS attackes. It's a bad idea in general.
- Ditto for the following code. Be careful with storing user-supplied data in session variables. Normally, you should not use
$_POST. Instead you should use the filtered/validated data that is given to you by the forms API (typically,$form_values).- You might need a check_plain() here (XSS):
+ $output .= '<p>' . $term->description . '</p>';- Make sure arg(3) is an integer:
- Is
$sort_methodinproject_page_overview()validated? Looks like you might be using raw user data without xss checking.- Can't you use the built-in destination-stuff instead of the newly introduce caller stuff?
- For security, you might want to do a check_url() on
+ $output .= ">$link</li>\n";.- $link is not defined? You'll want to use check_plain() and check_url() here.
Comment #22
Bèr Kessels commentedReviewing the latest demo (not the code)
When we have a nested list:
The ones listed under "handy widgets (1) " are also part of the group "widgets", hence it should be:
Or, in words, when i click "widgets" the ones listed under " handy widgets" should appear too.
http://www.islandnet.com/~nedjo/costarica/?q=project/issues&projects=13,...
Still gives a very very wide interface. Nothing new here though! It is just annoying (esp with bluebeach theme blocks overlapping it)
All in all: I love the work done so far.
Bèr
Comment #23
factoryjoe commentedCould you also auto-alias "/project/foo" to "/projects/foo". I know that convention is to use the module name (in the singular) but I always type "projects" when trying to get to a Drupal project and it's rather silly that redirection doesn't automatically occur (I would go so far as to suggest making "/projects" the default instead of "/project").
Comment #24
drewish commentedcouple of things i noticed:
* the breadcrumb links don't seem to be of much use navigating. the bread crumb on the test theme page shows css as a parent but clicking the link doesn't list the project.
* i'd like the project's node view to display the node's versions (though that maybe outside the scope of your changes)
* i think someone else mentioned it, but i wonder if empty categories should be listed. on this test site it's easy to skip past them, but on the drupal site, say after the 4.7 branch was added to the modules, all the empty categories would be pretty distracting.
Comment #25
nedjoHere's a new patch addressing issues and suggestions. There are two areas I'd like some final guidance on (see end of this post).
Changes made:
I couldn't find a place where I had done this.
I had used the new styles to further highlight the currently selected term, but for simplicity and consistency I've dropped this.
Done
Separate issue, not done here.
Hmm. What I'm doing is not much different from the
drupal_goto(), which goes to a REQUEST (hence, user-supplied) variable. I'm not sure offhand how to improve this.I've reworked this to use $form_values.
Done.
Done.
$sort_method isn't user-supplied here.
Yes, done.
Done.
Done.
It's a good suggestion, but would require a bunch of recoding. I also noticed that how I had done this, with indenting of second+ level terms, didn't work because e.g. a project categorized into "mail" and "handy widgets" made it look like "handy widgets" was a subcategory of "mail". So, for now, I've just dropped the indenting. I suggest we keep this question in mind for a later patch.
Good idea, not done here.
This was a leftover problem from the taxonomy changes--project.inc chose the first matching term for the breadcrumb. I've fixed this in
project_project_set_location().Yes, not done here.
Hmm. I'm hoping this won't be an issue on drupal.org, as we'll fill categories as we create them.
Remaining issues
1. While what we've done here should work fine for modules and themes, it's not going to work for the Drupal project, since that single project doesn't need categorization etc. Here's how the page looks on my test site:
http://www.islandnet.com/~nedjo/costarica/?q=project/Drupal+project
How should we handle this?
2. We really need to improve the display at /project. Here's my test site:
http://www.islandnet.com/~nedjo/costarica/?q=project
We should be showing information (at least descriptions) of each project type. What else? First few listings from each browsing sort_option (category, date, name), with link to more?
Comment #26
dries commentedFor 1, maybe we can create a category 'core' and add the 'Drupal project' to it? We could also add the infrastructure and the documentation project?
Comment #27
nedjoAttached is the version of this large patch that I just applied. There were no remaining errors on testing, but no doubt it will need further tweaks as it is used and extended.
Significant changes since the previous version of this patch:
1. SQL for browsing queries reworked to be generated on the basis of nested arrays (somewhat comparable to Forms API). This allows cleaner implementation.
2. Previously projects were first selected and then a second query was done on each project in the result set to see if there was a release. We now test for releases (if appropriate) in the initial query, so these costly extra queries have been eliminated.
3. The project_sort_options hook options have been simplified/reduced in number.
4. We use a _term_path() hook so provide the correct path for terms in the projects vocabulary.
(The patch included a couple of unrelated cleanup details.)
I'll be available for fixes as necessary later in the week (I'm on the road for the next couple of days).
Comment #28
(not verified) commentedComment #29
dan_aka_jack commentedHi there,
I'm afraid I get errors when I try to browse by category / date / name. Here are the specific errors that are reported:
Browse by category:
I get this error:
The category description is shown.
The "category" box is show but no categories are listed (even though I have setup a couple of categories in the taxonomy system)
Browse by date:
This error is shown:
And no projects or dates are show... it's just blank beneith the error except for the category description.
Browse by name:
When I browse by name, no error is reported but no projects are listed. Just the category description is shown.
I can submit projects and submit issues just fine.
I'm using the most recent project code from CVS along with Drupal 4.7-beta4.
MySQL version 4.1.14
PHP version 4.4.1
Many thanks,
Jack
Comment #30
dan_aka_jack commentedAny news?
Comment #31
dan_aka_jack commentedHi,
I've just updated to the latest code from CVS. Now the SQL errors have gone. But no projects get listed in the "browse by {category,date,name}" tabs.
Comment #32
nedjoThe handling is different depending on whether or not you're browsing by release, and wheter taxonomy is enabled. It may be that I've made an error when no releases are present, or when we are not browsing by releases.
Do you have taxonomy enabled? If so, have you created multi-level categories in the Projects vocabulary, and do you have projects categorized by top-level and secondary-level category? (Category options will only appear when browsing by category if there are categories with projects assigned to them.)
What are your settings at administer > settings > project for
* Browse projects by releases
* Default release overview
And have you run cron or scanned for releases? Do you have projects with releases (and accompanying files)?
Comment #33
nedjoThe issue you report should be resolved by the recent fix for issue #48054. If not, please reopen that issue.
Comment #34
(not verified) commented