Opened 10 years ago
Closed 10 years ago
#2593 closed defect (fixed)
Use GRASS GIS 7 for module of the day
Reported by: | wenzeslaus | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | Website |
Component: | Website | Version: | unspecified |
Keywords: | php | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
Currently GRASS GIS 6 modules are used for module of the day at http://grass.osgeo.org/. Please update to GRASS GIS 7.
(I noticed because I just got d.ask
.)
Change History (15)
follow-up: 7 comment:1 by , 10 years ago
comment:2 by , 10 years ago
Keywords: | php added |
---|
The PHP code seems to be broken: it should fetch the full_index.html and then parse it but it does not get any input.
The "module_of_the_day" code is temporarily posted here: http://pastebin.com/qjGCk3kV
follow-up: 4 comment:3 by , 10 years ago
It shows t.rast.accumulate
now for me but the link is broken. The only temporal module with generated manual is t.connect
:
follow-up: 5 comment:4 by , 10 years ago
Replying to wenzeslaus:
It shows
t.rast.accumulate
now for me but the link is broken. The only temporal module with generated manual ist.connect
:
GRASS GIS 7.0.1svn r65380 compilation log -------------------------------------------------- Started compilation: Sat Jun 6 04:20:40 PDT 2015 -- Errors in: /home/neteler/grass70_svn_relbranch_bin_snapshot/grass70_relbranch/lib/python/pygrass/modules/interface /home/neteler/grass70_svn_relbranch_bin_snapshot/grass70_relbranch/temporal/t.create /home/neteler/grass70_svn_relbranch_bin_snapshot/grass70_relbranch/temporal/t.support /home/neteler/grass70_svn_relbranch_bin_snapshot/grass70_relbranch/temporal/t.topology ...
I generated a fresh log:
http://grass.osgeo.org/grass70/binary/linux/snapshot/build.log
The issue also here:
env = {k.strip(): v.strip() for k, v in [row.split(':') ^ SyntaxError: invalid syntax
follow-up: 6 comment:5 by , 10 years ago
comment:6 by , 10 years ago
follow-up: 8 comment:7 by , 10 years ago
Good to see the modules back.
Replying to neteler:
I have updated it to G70.
But for me it always shows the same module, even in "random" rather than "day" mode.
Managed in the CMS in:
Extensions -> User defined tags
I suppose this is still an issue. I see t.rast.accumulate
as I saw yesterday.
follow-up: 9 comment:8 by , 10 years ago
Replying to wenzeslaus:
I suppose this is still an issue. I see
t.rast.accumulate
as I saw yesterday.
Yes, because nobody fixed the PHP code... I put it again here for inspection:
follow-up: 10 comment:9 by , 10 years ago
Replying to neteler:
Replying to wenzeslaus:
I suppose this is still an issue. I see
t.rast.accumulate
as I saw yesterday.Yes, because nobody fixed the PHP code... I put it again here for inspection:
I spent just few seconds looking at it and I lack the context a little bit but I would say that t.rast.accumulate is hardcoded there. Is that possible?
comment:10 by , 10 years ago
Replying to wenzeslaus:
I spent just few seconds looking at it and I lack the context a little bit but I would say that t.rast.accumulate is hardcoded there. Is that possible?
AFAIK it should be only used as fall-back in case that the index of manual pages could not be retrieved. For readability, I have reformatted the code with an online PHP beautifier:
follow-up: 12 comment:11 by , 10 years ago
Well, the code has a few strange places which would use some refactoring, but anyway, I think that the change should be applied everywhere:
- while (substr($a[$ra], 0, 27) != "<tr><td valign=top><a href=") + while (substr($a[$ra], 0, 29) != "<tr><td valign=\"top\"><a href=")
This will need to be changed next time the HTML file will be changed, e.g. replacing attributes by styles or change in formatting. Besides possible refactoring of this PHP, the complete solution I have in mind for some time already is to have XML, CSV, JSON and plain text files generated automatically and available online. These files could be used by tools like this one (or some interactive manual pages) for searching and showing info about modules without parsing of HTML which can change anytime.
For the "random" part this should be changed too (just optimization and avoiding a warning):
- $ra = rand(0, 1000); + $ra = rand(0, count($a));
I'm not sure how the "day" part should be changed if at all, but there are some magic numbers as well.
BTW, I saved the file and then executed in command line using php grass_moday.php
. I had to add <?php
at the beginning and ?>
at the end. I also downloaded the full_index.html file (wget http://grass.osgeo.org/grass70/manuals/full_index.html
)
BTW2, these things are not in grass-web repository? Why not? Are they too intimate, i.e. too many strange paths etc.? Or too much management overhead?
comment:12 by , 10 years ago
Replying to wenzeslaus: ...
well done, I applied both changes and it finally works! http://grass.osgeo.org/
BTW2, these things are not in grass-web repository? Why not?
Because that repo was abandoned years ago when we switched to the CMS.
Are they too intimate, i.e. too many strange paths etc.? Or too much management overhead?
No, it is simply all in the CMS ("user defined tags").
comment:13 by , 10 years ago
Mhh, while the module selection now works, the subdir path is lacking and the respective manual page not found.
comment:14 by , 10 years ago
Now I see that the first change needs to be applied also in the "find and replace" part:
$what = array( - "<tr><td valign=top><a href=\"", + "<tr><td valign=\"top\"><a href=\"", "</a>", "<td>", "</td>" ); $with = array( - "<tr><td valign=top><a href=\"$fullindex_directory/", + "<tr><td valign=\"top\"><a href=\"$fullindex_directory/", "</a>", "<td>", "</td>" ); return "<table>" . str_replace($what, $with, $a[$ra]) . "</table>";
What the rest of the items in the array mean, I have no idea.
comment:15 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Evviva - after so many years the "Module of the day" mechanism finally works.
Thanks, Vaclav.
I have updated it to G70.
But for me it always shows the same module, even in "random" rather than "day" mode.
Managed in the CMS in:
Extensions -> User defined tags