Posted by sajt on May 14, 2010 at 7:13am
| Project: | Drupal.org CVS applications |
| Component: | Miscellaneous |
| Category: | task |
| Priority: | normal |
| Assigned: | kiamlaluno |
| Status: | closed (fixed) |
| Issue tags: | module review |
| Project: | Drupal.org CVS applications |
| Component: | Miscellaneous |
| Category: | task |
| Priority: | normal |
| Assigned: | kiamlaluno |
| Status: | closed (fixed) |
| Issue tags: | module review |
Comments
#1
I like a CVS account for this module. And some review of my code :)
Thanks!
#2
Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.
As per http://drupal.org/cvs-application/requirements, the motivation message should be expanded to contain more details about the features of the proposed module/theme; for modules it should include also a comparison with the existing solutions, while for themes a screenshot is also required.
#3
What I must to do? Waiting?
#4
See comment #2.
#5
The nameday module creates a block with the current (in this time only Hungarian) name-day(s) and holiday if it exists. You can easily add your country's name-days and holidays.
#6
#7
What I must to make? Is somthing wrong?
#8
I putted the code to the github: http://github.com/sajt/nameday I do not really understand why I can not get CVS access.
#9
From http://drupal.org/cvs-application/requirements, "...You must provide a motivation message, which should be a few paragraphs instead of only a few sentences. It should include details about your contribution, its features, how it compares to already existing solutions, links to screenshots or a demo, etc...."
#10
A lot of portal site like to show the actual name day, in some country (you can see a list in the Wikipedia). There was a lot of solution for it, but no drupal modules. (I did not find).
This module is very easy of use. Install it as usual and select the block from the admin/build/block list. The name day is depend on the current language (and naturally on the current date) and now only hungarian name days is working.
I welcome the new languages files for other countries. The file description is in the datas/README.txt. This file is included when You install the module.
#11
Whats news?
#12
I think my project a little bit better than this: http://drupal.org/project/chuck
#13
I've done a visual review of the code.
It looks pretty good overall -- clearly good attention to detail and use of Drupal's APIs and conventions. Its purpose is quite esoteric, but that's fine :)
A few things that need work though:
- Quite a big architectural problem this one: you populate your database table from the included data file in hook_install. How is a user of the module going to get updated data from later versions of the module, or from their own data file? You need to think about a more flexible way of doing this. I suggest you look at how Ubercart handles country information files: there's a UI for adding a custom one, or for reading in data from one that's in the module's own data folder. It looks like you have the same requirements.
- variable_set("show_date", TRUE); -- namespace your variables.
- also, there's no point in setting a variable in your hook_install. Instead, take the value TRUE as your default!
- $lang = $GLOBALS["language"]->language; -- I'm not sure of this, but should you just say 'global $language'?
- $date = getdate(); -- you might want to account for the user's timezone?
- echo format_date(time(), "small"); -- the standard in TPL files is print, not echo.
- also, it's a nice touch to indent the code in TPL, ie indent this line because it's inside an if block. It makes the logic of your TPL much clearer to follow, as at the moment it's hard to see where the ifs end and what gets printed unconditionally.
- <?php if ($date):?> -- think the convention is a space before the closing angle bracket -- check what core does.
- finally, a minor point: no blank line between function doc blocks and the function declaration. But bonus points for putting these in! :)
I'm not sure whether to set this to 'needs work' or RTBC. The architectural problem I mentioned is a big task and needs addressing, but on the other hand the best course might be to grant CVS access so the module author can make a dev release and potentially get the attention of other interested developers to help with this. I'll leave this decision to one of the admins :)
#14
<?phpfunction nameday_install() {
drupal_install_schema("nameday");
variable_set("show_date", TRUE);
$dir = drupal_get_path("module", "nameday") . "/datas/";
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== FALSE) {
$pathinfo = (pathinfo($file));
if ($pathinfo["extension"] == "namedays") {
$lang = $pathinfo["filename"];
$langfile = file($dir . $file);
foreach ($langfile as $row) {
$currentrow = split(";", $row);
if (count($currentrow) == 3) {
$currentrow[3] = "";
}
db_query("INSERT INTO {nameday} (month, day, language, name, holiday) VALUES (%d, %d, '%s', '%s', '%s')", $currentrow[0], $currentrow[1], $lang, $currentrow[2], $currentrow[3]);
}
}
}
closedir($dh);
}
}
?>
Why isn't the code using
file_scan_dir()?<?phpcase 'list':
$blocks[0]['info'] = "Name day";
return $blocks;
?>
Strings used in the user interface should be translated.
#15
Thank you for the nice reviews. In last time I rewritten the full module, for example I putted the token support. I make some changes and I am considering your suggestions. When I finished it, I will put the new module.
Thanks.
#16
I finished the changes. Only Joachim's UI suggestion is missing for the data-table manipulation, I must to think about the correct interface.
I hope every other errors is fixed. I added a little token support, what is pre-alpha and maybe very useless.
#17
Change status
#18
anybody?
#19
Teszt
#20
A few minor points for consistency within Drupal:
- the 'datas' directory should be 'data'. ('data' is already a plural...)
- the standard filename for admin pages is MODULE.admin.inc rather than nameday.settings.inc.
The more complex logic in your TPL should really be moved up to a preprocessor function:
- print format_date(time(), variable_get('nameday_date_format', 'small'), variable_get('nameday_date_format_custom', ''));
This should be just a print $nameday_date; do the formatting work in the preprocessor.
- if ($nameday['holiday'] != '' && variable_get('nameday_show_holiday', TRUE))
This should be just if ($holiday):
> I must to think about the correct interface.
What I'd suggest is something like a list of the language files the system has found, along with operations depending on whether the system also has data for that language in the DB:
language status operations
- English new [load data button]
- French loaded [refresh data button]
Good idea adding token support btw! :)
#21
Thanks for the fast answer. I made the suggested changes, except the last one. I will make it, when I get an other name-day file than Hungarian :)
#22
#23
Automatically closed -- issue fixed for 2 weeks with no activity.