CVS edit link for tutumlum
I am a school administrator, and developing school database for 6 years along with teaching chemistry :) at the same school. I have been writing school database with php-mysql. I decided to write whole system as a group of CMS modules, and I decided for Drupal for many and strong reasons that are needless to mention here. I'm re-writing whole system as D7 modules for 4 months as School Administration package.
Developed modules till now are:
school_administration (main module) (~2200 lines),
classes_and_lessons (~1200 lines)
class_lists (~300 lines)
pdf_documentation (based on FPDF) (~400 lines)
working-on module:
grading
student_marks
in-plan modules:
grade_book
term_comments
accounting_student_payment
accounting_staff_salary
accounting_statistics
exam_stats
school_transcript
attendance
school_id_card
sitting_plans
discipline
medical_records
clubs
auto_sms_mesaging
All modules mentioned above are in use now as a single hard-coded system. I will convert all of them to D7 modules and we will continue to use same functionalities with the power of Drupal core and its modules. I want to contribute them for "Drupal in Education"
I need advice about my current modules to integrate with D7 seamlessly, I need advices about the way to write in-plan modules for best integration.
I know power of open source, I know power of sharing, I know power of Drupal, I saw power of Drupal community :)
Best Regards,
Murat Tutumlu
[Edit: information removed at request of poster]
Comments
Comment #1
tutumlum commentedComment #2
dave reidJust on an initial quick review, the profile_role.module has this in it:
So this isn't even your module? Turns out it's an existing project http://drupal.org/project/profile_role so I don't know what you're hoping to accomplish by submitting an already existing project with your CVS application. The only thing I can think of is to make yourself look better and hope we don't notice?
Comment #3
tutumlum commentedNo, I didn't submit it as my module, I convert it to D7 because it is required module. After I receive CVS account I will...
Comment #4
tutumlum commentedBy the way, If try to trick you, be sure that I should erase copy-right data, change module name, and use it as mine. I just convert and use original module to D7, and I sent it to you, If you want to try, you will need it. Thank you for your blaming :(
Comment #5
dave reidYou do not need a CVS account to help port a module to D7. All you need to do is post patches to the module's issue queue. Boombatower is quite active and isn't exactly abandoning his modules. I'm sure he would accept your porting patches. I am sorry I blamed you, but nothing in your application said "I wrote these modules, but I also helped port some existing D6 modules to D7."
Comment #6
avpadernoStill, it doesn't make sense.
You are supposed to report here your code, not the code developed from somebody else that you converted to a newer version of Drupal. If your module depends on a module that has not been converted to the Drupal version used by your module, you simply report your code adding a note that it depends on a module that needs to be ported.
Comment #7
tutumlum commentedIn info file of school_administration it is mentioned that it depends on profile_role module. And in profile module it IS mentioned that it is belong to its owner. See copyright notice :)
Comment #8
tutumlum commentedAnd I am mentioning here that FPDF is also not belong to me. Do not think same thing for it when you see it in pdf_documentation module. You can see copyright info in it too..
Comment #9
avpadernoIn school_administration.forms.php (the extension should be ".inc"):
hook_form()when they are not (the correct definition of such hook ishook_form($node, $form_state), and it's implemented by modules that handle nodes).In school_administration.install:
school_administration_.insert_field_roles()contains the following code (which should not even exist):Comment #10
tutumlum commentednumber 1:
I will maintain it. But I am not still not so clear. Ok I will try to figure it out.
number 2, 5, and 6:
That lines are used to insert data from my in-use project to new modules to try it. Do you know, for 4 modules, I wrote "query_migrate_to_drupal.php" (~900 lines) (~30Kb), it deploys more than 100,000 rows to drupal db. I sent my on-working copy directly. I put them there, because I wrote them for an installation profile, but I noticed that installation profile system of D7 is still changing, and I put it there. The reason is, I don't want to write same thing with "mysql_query()" again.
Ok, I understood that is a mistake. I will put initial data to somewhere else.
number 3:
I will change it.
number 4:
I changed my editor's configuration for drupal's indentation, tabbing, line ending etc. I don't know where it is you talked about...
Thank you for suggestions and for your time..
Comment #11
tutumlum commentedWhat do I need to do after changing? Attach again? if yes whole module system or just changed ones?
Comment #12
tutumlum commentedI started to change function names, but couldn't answer a question: What if I use those functions in other module like an API? I don't know may be it is a stupid question, but I want to clarify it.
Comment #13
avpadernoIf you call functions that are present in other modules, then the name of the function is as defined in that module. If with "using those functions in other modules" you mean that you copy the file containing the function definitions in your module, then that is not allowed.
A module uses the functions given from third-party modules, but it doesn't incorporate them inside itself. If you need some functions present in a module, then your module must declare its dependency from the other module.
Comment #14
tutumlum commentedI mean with use function as call function. Sorry.. Of course, copy-the function rename it and use is not allowed, and not a good way, because updating and security issues cannot be tracked..
So I am renaming all functions which module names are not mentioned in function name...
Comment #15
AjK commentedWaiting for new upload of corrected code.
Comment #16
tutumlum commentedComment #17
tutumlum commentedI forgot to test re-installing modules. Here is the error-free installable ones.
Comment #18
avpadernoWhat I was referring is this code (school_admin.install):
The indentation passes from 4 characters to 8, and from 8 to 13; it is supposed to pass from 4 to 6, and from 6 to 8 characters.
Comment #19
AjK commented@KiamLaLuno, if you are wanting the applicant to make changes please set the status to "needs work". Thanks :)
Comment #20
tutumlum commentedHere it is. After some more cleaning with your suggestion..
Comment #21
dave reidYour code:
Should be:
If I were to create a password.module and use my own password_inc variable and someone uninstalls your module, it will unexpectedly mess up with an unrelated module. Likewise, your table names should also be prefixed with your module's name as to avoid collision. For instance, you have a table named 'withdrawal'. [Warning: silly example ahead] What if someone wanted to create an ATM module that allowed people to withdraw things? We always need to be sure that we take care with our module's functions, variables, and table names to use the module's namespace and avoid these potential conflicts.
That was without going through the .module file. While it's clear you have a starting grasp of how to write modules, it's clear to me that there is still a lot of work to be done.
Comment #22
dave reidComment #23
tutumlum commentedI am here to work with :)
after module names issues and some making up here it is...
Comment #24
avpadernoschool_administration.module:
t(), it's perfectly useless you pass it.school_administration_access()should always return a value, not just when it isTRUE.The menu uses three '%', but only one of those values are not used; in that case, the menu should be
$items['school_administration/browse/%'], and the rest of the definition changed. I am not sure if'access arguments' => array(1)is correct, or you meant'access arguments' => array(2).There is not need to use a variable that you don't change to contain the value of a constant.
substr(), andstrlen()should be replaced by Drupal functions.'school_administration/browse/' . $group . '/' . $sub_group . '/' . $membercan be rewritten"school_administration/browse/$group/$sub_group/$member"(and so do similar strings).hook_validate()are really not; the same is true for the functions the comment says to be implementations ofhook_submit().t()doesn't understand placeholders that doesn't start with !, @, %.Comment #25
tutumlum commentedall okay as much as I figured out except last suggestion which is about HTML output. I suspected from school_administration_next_year_link() function and I simplified it.
I corrected school_administration.module and I am sending review, I will continue correcting the other files..
Comment #26
tutumlum commentedBy the way I didn't know that these posts are in public. Could you remove my personal information from my first post?
Comment #27
avpadernoSCHOOL_ADMINISTRATION_C_YEAR(which is not truly a constant, as its value is created by the result of a call tovariable_get()) it should be better to use a placeholder (as you already do in other cases).Comment #28
tutumlum commentedFirst 2 isses: done
Last issue: I checked all page callback functions but I cannot figure it out. Could you be more specific please...
Comment #29
tutumlum commentedsome typo correction..
Comment #30
avpadernoinclude_once('school_administration.forms.inc')is not necessary in Drupal 7 because, giving the right information in the .info file, Drupal will include the necessary files; that is also true for Drupal core files, and functions defined in those files.t($txt)should be avoided because it is not possible to extract the string that needs to be translated; it's better to uset('Sentence to translate, which will be catched').The menu relative URL doesn't contain a string that is specific for your module, and it could cause a conflict with another module. It is still possible for somebody else to create a module named photo.module, and your module would not allow to use it; who creates a module is not forced to check all the menu callbacks defined by third-party modules, and see if they are defined as they are supposed to be.
CONCAT_WS()is one of them.Comment #31
tutumlum commentedissue 1, 2, 3: done
issue 4: done. I couldn't find how to handle mysql HEX() function (line:1083), I just comment it for future search. If you have any idea and tell me, I will be appreciated.
issue 5: okay I moved directory validation to validate function. I'm not moving the ones "continue"s the loop...
issue 6: I modified 2 links done by <a>, Is there more? or can you be more specific?
issue 7: done, is there hook_user_view in D7? I read before that hook_user($op will be divided to separate functions. It works, but cannot see in API documentation.
Comment #32
avpadernoI already signaled a problem, but the code still have that problem.
Rather than rushing to change the problems reported in the exact code reported, it would be better to check all the code and see if a similar problem exists in other parts of the modules. Just to make an example, the problem of the namespace not being respected has been reported by Dave, but then I reported the same problem twice; the code was different all the times, but when you are said that every Drupal variable names, and all the function names must be prefixed with the module name, you should check that every functions respect that.
You could wait to attach a new copy of the files, and check the code to see if it still needs to be modified as suggested here.
Comment #33
tutumlum commentedI strictly checked school_administration module and I couldn't find namespace problem. I thought that you are reviewing only school_administration module. I think you are talking about all modules I submit. Ok let's make it more convenient. I am submitting only first two modules to review. (Maybe it is better if I submit only one?)
I will "of course" obey all of Drupal rules for all future modules as I figured out during these submissions, I am here to do it, but maintaining 6 modules together not easy.
If I am missing something please tell me..
P.S: By the way, I start to comment all functions..
Comment #34
avpadernoThe content type is not the one usually used for JPEG pictures.
We are reviewing the code, but that doesn't mean we are going to do the work for you. ;-)
This function will always return
TRUE. Without any comment present, I guess that is not what it is supposed to do.The form doesn't define any visible element; what is its purpose?
"student_marks/student//$st->school_no/view"should maybe be"student_marks/student/$st->school_no/view".Comment #35
tutumlum commenteddone,
I hope :)
Comment #36
avpadernoI am not sure it works as you thought. Trying to execute the following code
will print "AAA", differently from what you would suppose.
Comment #37
dave reidRe #36:
1. Should be
Comment #38
tutumlum commented#36:
2. what about ucwords? there is no drupal_ucwords(). Do we have to do explode, ucfirst, implode?
Comment #39
tutumlum commentedComment #40
tutumlum commentedSo, what is wrong? Why don't you review?
Comment #41
AjK commentedWhen suppyling a fixed string to t() you should not concat it like this. The correct method is:-
Yes, I know your code looks a lot more readable and neat but the reason is the extractor.php program translators use doesn't execute the code, it uses PHP's token_get_all(). The outcome of this is errors are thrown and translators cannot extract the fixed string correctly.
What is the elseif doing? It looks the same as the if. Also, I may be wrong but the if() : ... endif; format is used by themes. I thought module coding standards were to use curly braces? See http://drupal.org/coding-standards#controlstruct
Comment #42
avpadernoSome queries are still built concatenating strings.
Comment #43
tutumlum commentedDuring my summer vacation I just found a chance to work with the project. :) Please review...
Comment #44
avpadernoComment #45
tutumlum commentedI am waiting for your review.. Please review...
Comment #46
avpadernoComment #47.0
(not verified) commentedRemoving private information
Comment #49
avpaderno