CVS edit link for vgarvardt

I created new module for Drupal that improves OpenID usability.

Here is my blog post about this module that describes motivation for creating this module and module functionality http://itskrig.com/blog/openid-usability-drupal

Here is project page, where module is available for downloading (I don't give direct link because I'm updating code sometimes and my VCS is not available over Internet) http://itskrig.com/project/openid-exensions

Here is 2 demo sites I created to show module (2 themes) in action:
http://openid-dropdown.demo.itskrig.com/
http://openid-accordion.demo.itskrig.com/

Comments

vgarvardt’s picture

Component: Miscellaneous » Code
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new19.3 KB

Here is my module for review.

avpaderno’s picture

Component: Code » Miscellaneous
Issue tags: +Module review
avpaderno’s picture

Status: Needs review » Needs work

See the Drupal coding standards to understand how a module code should be written.

vgarvardt’s picture

Status: Needs work » Needs review
StatusFileSize
new19.87 KB

Sorry for this omission.
Fixed all code formatting and added some comments.
Also checked module with coder module - it shown no warnings.

Uploading updated code.

evlad’s picture

very interesting project.
go go go!

subscribing

*привет с Хабра

avpaderno’s picture

Status: Needs review » Needs work
  1.   if (!isset($form[$key])) return;
    

    That is not how the coding standards say to write the code.

  2.     $options = array();
        foreach ($form['provider']['#options'] as $pname => $title) {
          $attrs = array();
          if ($pname == $def_prv) $attrs['selected'] = 'selected';
          if (isset($providers[$pname]['icon']) && is_file($providers[$pname]['icon'])) {
            $attrs['class'] = 'with-icon ' . $pname;
            $styles['.with-icon'] = 'background-repeat:no-repeat;padding-left:17px;';
            $styles['.' . $pname] = 'background-image:url(' . $base_url . '/' . $providers[$pname]['icon'] . ');';
            $settings[$pname]['icon'] = $providers[$pname]['icon'];
          }
          if (isset($providers[$pname]['input'])) {
            $settings[$pname]['title'] = $providers[$pname]['input'] . ': ';
          }
          $options[] = '<option value="' . check_plain($pname) . '"' . drupal_attributes($attrs) . '>' . check_plain($title) . '</option>';
        }
    
        $select = array(
          '#prefix' => '<select name="provider" class="form-select" id="edit-provider" >',
          '#value' => implode('', $options),
          '#suffix' => '</select>',
        );
        $form['provider'] = array(
          '#type' => 'item',
          '#value' => drupal_render($select),
        );
    

    I think that the FAPI allows to create a select form field.

  3. Referring to the previously reported code, why isn't the code using some theme functions?
  4. version = "6.x-0.6.2"
    

    That string should be removed.

  5. function openid_ext_install() {
      // module should have greater weight than OpenID does to remove some form additions
      $weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'openid' AND type = 'module'"));
      db_query("UPDATE {system} SET weight = %d + 1 WHERE name = 'openid_ext' AND type = 'module'", $weight);
    }
    

    Considering that by default, all modules have a weight set to 0, the code could be simpler.

  6.   // remove all variables for this module
      db_query("DELETE FROM {variable} WHERE name LIKE 'openid_ext_%'");
    

    It is preferable to use variable_del() to remove Drupal variables.

vgarvardt’s picture

I think that the FAPI allows to create a select form field.

I need to do this manually because I'm adding class attribute to every option and FAPI does not allow this.

All another issues will be fixed today.

vgarvardt’s picture

Status: Needs work » Needs review
StatusFileSize
new22.08 KB

Fixed all notices except the 2nd one - please see comment above.
Moved part of html code generation to template and added theme that utilizes this template.

Here is updated module version.

avpaderno’s picture

Not using the form API to built the form field would probably render it differently from the form field as generated from the FAPI.

To make an exemple, the form field Component shown for below Post new comment is rendered by the following HTML code:

<div class="form-item" id="edit-project-info-component-wrapper">
  <label for="edit-project-info-component">Component:
   <span class="form-required" title="This field is required.">*
   </span>
  </label>
  <select name="project_info[component]" class="form-select required" id="edit-project-info-component" >
    <option value="Code">Code</option>
    <option value="Documentation">Documentation</option>
    <option value="Miscellaneous" selected="selected">Miscellaneous</option>
    <option value="User interface">User interface</option>
  </select>
</div>

I am not sure if being able to set different HTML attributes for each select option is worth the fact the form field could not be rendered differently from the other form fields of the same type rendered through the form API.

vgarvardt’s picture

This element should be simple select form element and takes all styles that current Drupal theme applies to select elements.

If user is going to override theme_select with something that is not html select (e.g. some JS component that behaves like html select) then my component behavior can be broken (if it will be overriden with something that behaves like html select, but it's not real html select). If my component will have completely different look'n'feel than user's theme, then developer can implement new block theme and plug it in to my module (it has hooks for plugging in new providers and themes).

avpaderno’s picture

This element should be simple select form element and takes all styles that current Drupal theme applies to select elements.

That depends from the theme being used; the form field select created from the form API has the CSS class form-class, and it is contained in a tag DIV with CSS class form-item.

vgarvardt’s picture

StatusFileSize
new22.42 KB

Here is updated module. I added here one more theme called Default and set it as default theme. This theme almost the same as Dropdown theme but uses FAPI to create all form fields. As FAPI can't add attributes to option elements there are no icons in select for this theme.

Also refactored code a little to move some repeating code to functions.

avpaderno’s picture

Status: Needs review » Needs work
function openid_ext_provider_livejournal($input_value) {
  return 'http://' . check_plain($input_value) . '.livejournal.com';
}

check_plain() is not thought to be used with a domain name; if you want to be sure the input passes is a true domain name, then you need to use a different function.

vgarvardt’s picture

Status: Needs work » Needs review
StatusFileSize
new23.43 KB

- removed check_plain() from LiveJournal OpenID URL generation
- added validation for LJ OpenID URL, so now Drupal handles user input validation with valid_url()
- added support for myOpenID provider

avpaderno’s picture

Status: Needs review » Needs work

There is already a module for the same purpose: http://drupal.org/project/comfortid.

vgarvardt’s picture

Status: Needs work » Needs review

comfortid module:
- no public releases
- last commit was more than a year ago (August 11, 2008)
- only 1 dev version released more than a year ago (August 11, 2008)
- code does not match Drupal coding standards

avpaderno’s picture

Those are still no reasons to create a duplicate of a module that already exists in Drupal.org.

vgarvardt’s picture

Thank you for your time. It was great experience for me for contributing a Drupal module.

For the last month I refactored lots of code, added some features to the module and finally stuck because of unsupported module "duplication". There is a good proverb in Russia about this situation. I don't know how to translate it without loosing its meaning, but the main idea is - if you are The First One everything else does not matter at all.

As I don't see any prospect for this module on drupal.org so you may decline my CVS application and close this issue.

PS: maybe you should change your review stages order and start from finding duplicates - it will take much less time both for you and modules authors and will not require code review.

PPS: I wonder how much time it takes for reviewing really big modules of the same "weight category" as Views and CCK.

avpaderno’s picture

Status: Needs review » Closed (won't fix)

As per previous comment, I am marking the report as won't fix.

esteewhy’s picture

It's pity to see Your work is not on drupal.org still. Anyway, could You please host it on Google Code or elsewhere?

vgarvardt’s picture

If someone is interested - module is hosted on GitHub now http://github.com/vgarvardt/Extenal-Login

openid_ext branch is for the v1.0 of the module I tried to post here.
master branch is for v2.0 - Facebook and VKontakte is going to be added there.

jenesis’s picture

Status: Closed (won't fix) » Needs review

It Supports vkontakte (the biggest russian social network) and "Comfortable OpenID Login Box" doesnt.

"Comfortable OpenID" is abandoned its clear that nobody will use it.

avpaderno’s picture

Status: Needs review » Closed (won't fix)

There is nothing to review; see the comments from #15 to #18.

nleo’s picture

Status: Closed (won't fix) » Reviewed & tested by the community

http://drupal.org/project/comfortid

Maintenance status: Abandoned

Opposite vgarvardt have begun develop in Oct 2009. Latest release have date July 05, 2010

Don't understand why you not allow this module. marasmus

avpaderno’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

See comment #18, and previous ones.

avpaderno’s picture