google_form is a module which exposes a Google Form into a block
It takes a Google Form key and will pull the html data from Google via drupal_http_request and parse it into a basic html form which is then inserted into a block which can be placed anywhere within a Drupal website, form submissions also happen via drupal_http_request and without the need to embed an iframe in a Drupal page or to work around Google's formatting.
In short you get a Google Form on your site and matching your sites theme formatting as only the basic form elements are displayed with which you can style as part of your site.
To my knowledge I have yet to find a module which does any equivalent task
Comments
Comment #1
anthonysomerset commentedforgot to state currently only D6 compat, working on D7 Port now
Comment #2
anthonysomerset commentedand the sandbox url... http://drupal.org/sandbox/anthonysomerset/1072444
Comment #3
anthonysomerset commentedappreciate there is drupalcon and all but is there any chance someone could take a look?
have just chucked this module through the coder module and corrected all formatting bugs and made sure its fully compliant with drupal 6 coding standards (to my knowledge)
Comment #4
a.ross commentedHi, I just had a look at your module. You should use the coder module to see if there are still problems regarding coding standards. I've seen one error, a typo I guess.
Anyway, are you having problems with GIT? Because you said the module was D6 compatible, but the info file in master states it's 7.x
I tried installing your module, but upon enabling I'm getting this error:
DatabaseSchemaObjectExistsException: Table <em class="placeholder">google_form</em> already exists. in DatabaseSchema->createTable() (line 630 of /var/www/d7/includes/database/schema.inc).Upon clicking the new menu entry, I'm getting this error:
Fatal error: Call to undefined function db_fetch_array() in /var/www/d7/sites/all/modules/google_form/google_form.module on line 106Make sure you create branches! You should create a 6.x-1.x branch for the Drupal 6 version, and a 7.x-1.x branch for the Drupal 7 version. Then you just checkout the branch you are going to work on. Right now you just have a master branch, which essentially does nothing, i.e. you can't create releases from the master branch on Drupal.org.
Comment #5
anthonysomerset commentedsorry its meant to be D6 at this stage, it was my fault for forgetting to change local branch before starting on D7 conversion.
added correct branches now
its gone through coder and even on minor it hasnt picked up any issues, can you let me know the typo?
Comment #6
a.ross commentedOk, I've had another look, your module is working (after struggling with simple_html_dom's permissions). I suggest you warn users in your README that the permissions need to be changed on the library.
Furthermore, it's very strange that coder doesn't show any warnings, because I've taken a more thorough look and have found numerous indenting problems. Here's an example:
which should be
Sorry that the coder module can't be of any help on this one (very strange, maybe you should file a bug report).
Furthermore, the @file is missing from your module and info files. To more easily resolve all the indenting problems, you might wanna use an editor like Emacs. Take a look here how to configure Emacs for Drupal's coding standards (note that that isn't perfect either, though).
Comment #7
a.ross commentedComment #8
anthonysomerset commentedtrust me for using coda on mac to not do it right :) fixed the indenting and tabs issue now (i hope) also added the @file info to the module and info file, the module file just missed the @file header, coder still says its all ok again
Comment #9
a.ross commentedYes, I have checked with coder as well, same problem, not using mac.
/me is looking at your code again...
You don't need to use
breakhere, since you are already usingreturn. The parser will therefore never arrive atbreakin the first place. Also, you can ALWAYS omitbreakwhen you have arrived at the lastcase, becausebreaksimply jumps to the end of the switch block, or whatever control structure it's in.There are still a few indenting issues.
This should be:
Format arrays. Note that every line
key => value,should end with a comma, including the last one (for practical reasons). There are a few more, I will list them later on.If it weren't for the
str_replace()you could do this with drupal_query_string_encode(). Also, you ought to sanitize the POST data in$postdata = $_POST;. It might contain special characters.!empty ($results)There shouldn't be a space in this .Some of your functions don't have documentation (it generally doesn't need to be a lot):
The following arrays also don't conform to Drupal's coding standards:
Comments in you .info file should look like
; Insert comments here. It's in the .ini format. My apologies though, there doesn't need to be a @file block in your .info file. My mistake sorry.In some files, you still have CVS $Id$ tags.
CSS code should be formatted according to these rules. It's mostly the same rules as PHP, with a few specific notes. For example, this:
should be:
That's about it, I think once you've resolved these issues, there's probably not a lot left to do.
Comment #10
anthonysomerset commentedthanks for the detailed comments, hopefully blasted the indenting issues once and for all
all the formatting is updated,
all arrays to standards (i think - hooray for peer code review) - the google_formdelete array didnt like the last comma (syntax error) unless i was wrong to try and put one there
cvs tags are gone (coder false positives this it but i suspect they havent updated yet)
break tags removed
css formatting
still to do:
code commenting - shouldnt take long
sanitise post content - will need some help or pointing in the right direction on this one - in fact i am am going to debate the merits of this one as it dont actually get posted to the users server it gets posted direct to google, i have been trying to found out what if any sanitation google do to there form input but at this stage i cant find the info
Comment #11
a.ross commentedJust a quick reply, lots of indenting done correct and the css is good.
But have another look at the .install file and the google_formdelete return statement. The latter is strictly not an array, but a function call with an "array" of arguments. Function calls generally don't like a trailing comma (hence the error), the built-in
array()function being the only exception I know of.You are right that coder is giving a false positive on CVS tags.
Note that with commenting, I only mean a doxygen style comment directly above your functions, described here. You don't need to document every bit of code, a general description of your functions will suffice in most cases.
As for sanitizing post content, I made a wrong presumption I guess. I see it is simply being "reposted" to google, which is the only sane way to go about it, come to think of it :).
In other cases, depending on the situation, you could use check_plain, filter_xss, any of the other *filter_xss* functions, and maybe others that I don't know of yet.
I should apologize once more, I myself am quite new to code reviewing.
Comment #12
anthonysomerset commentedok i think i got the last few bugs squashed
i tried putting the post data through check plain and xss_filter the first just spat out an empty string (not UTF-8) and the second actually messed up form input completely without erroring on the drupal side, but submitted fields ended up getting concatenated - unless i did it wrong, that said all the time i was using the filters or not using them, google was filtering out single quotes so i am led to believe they are doing there own filtering of form input so doing it twice is probably futile and going to cause issues later on down the line.
code commenting done!
Comment #13
a.ross commentedLike I said, input sanitizing not needed in your case. My mistake.
Good job on correcting the indenting issues. However, 3 issues still remain.
should be
No trailing comma in this case, because it will lead to a syntax error.
Don't forget the trailing comma for multi-line arrays.
Then there are two small new issues:
A trailing comma is only needed for multi-line arrays. In this case you can leave it out.
That description is too long:
As for the other descriptions, that exceed 2 lines, I would try to just make the description a bit more concise.
Comment #14
anthonysomerset commentedall the above done :)
its great having a second pair of eyes :)
Comment #15
a.ross commentedGood job, yes 4 eyes generally see more than 2 :)
Looks like only this is remaining:
There is no documentation specific to long function calls, but for consistency we should treat it as an array, except for the trailing comma. Therefore, every argument should be on it's own line, like so:
But like I said, this isn't explicitly laid out in the documentation.
I justed went ahead to install the module again, and coder seems to be doing it's job a bit better now. Still strange that it bailed out like that. Anyway, now it reports trailing spaces in 3 places. You can have a look yourself and correct that. I trust you can fix this minor issue with the next commit, so I'll put this at RTBC.
I'll have a look on IRC to see if anyone with the proper access rights can approve and fix your application. If no result, I advise you to go on IRC #drupal-contribute to ask around for yourself.
Comment #16
a.ross commentedComment #17
anthonysomerset commenteddone and done :) dont particularly know irc well so will let you handle it for moment, i can be patient :)
Comment #18
anthonysomerset commentedComment #19
a.ross commentedYou keep missing this one ;)
Should be:
And there's this (reported as a trailing space):
Should be:
Comment #20
a.ross commentedGuess this can be marked fixed then! Good job and welcome to the developer community :)
Comment #22
PA robot commentedClosing due to lack of activity. Feel free to reopen if you are still working on this application (see also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.