CVS edit link for markoshust

I believe the admin interface for Drupal can be confusing to end-users or client-users, and wanted way to simplify the interface. A lof of my clients do not use the publishing, comment, path, etc. settings, so I thought the easiest way to deal with the semi-cluttered interface was to remove these from view. This is a very simply module which will simplify the node create/delete pages, and will eventually evolve into other sections possibly being simplified for a more friendly client interface. This was built specifically for Drupal 7 as the pending release is coming up very soon.

Comments

markshust’s picture

StatusFileSize
new1.18 KB

I am attaching the simplify module. It is fairly basic and it's main functionality is to show/hide the tabs on the node create and edit pages. It's made solely for Drupal 7. Please let me know if you have any questions.

markshust’s picture

Status: Postponed (maintainer needs more info) » Needs review
avpaderno’s picture

Issue tags: +Module review

Hello, and thank you for applying for a CVS account. I am adding the review tags, and some volunteers will review the code, pointing out what it needs to be changed.

markshust’s picture

It's been about a week; just wanted to check in. This is a very simple module - I don't foresee there being any review probs. Let me know if you need any additional info.

Thanks,
Mark

Scyther’s picture

Status: Needs review » Needs work

1. Menu descriptions and titles, schema descriptions are not passed to t().

2. You are strongly encouraged to always use curly braces even in situations where they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added. http://drupal.org/coding-standards

function simplify_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case "page_node_form":
      if (!variable_get('simplify_node_menu'))
        unset($form['menu']);
      if (!variable_get('simplify_node_revision_information'))
        unset($form['revision_information']);
      if (!variable_get('simplify_node_path'))
        unset($form['path']);
      if (!variable_get('simplify_node_comment_settings'))
        unset($form['comment_settings']);
      if (!variable_get('simplify_node_author'))
        unset($form['author']);
      if (!variable_get('simplify_node_options'))
        unset($form['options']);
  }
}
markshust’s picture

Status: Needs work » Needs review
StatusFileSize
new1.5 KB

Thank you for the review. I have attached an updated version of the module with some changes. I was already translating menu descriptions and titles in my first attachment of the module. I have updated the if statements to contain curly brackets. I have also made a bug fix and some enhancements to the if checking. Please let me know if there is anything else.

Thanks,
Mark

markshust’s picture

StatusFileSize
new1.5 KB

Oops, I forgot to take out a die from testing in the last attachment. Please use this one.

markshust’s picture

StatusFileSize
new1.48 KB

Somehow that last one didn't zip correctly. Use this one.

Scyther’s picture

Status: Needs review » Needs work

Coder found 1 projects, 2 files, 2 normal warnings, 2 minor warnings.

simplify.module

    *
      severity: normalLine 41: Menu item titles and descriptions should NOT be enclosed within t(). (Drupal Docs)

          'title' => t('Simplify'),

    *
      severity: normalLine 42: Menu item titles and descriptions should NOT be enclosed within t(). (Drupal Docs)

          'description' => t('Adjust Simplify configuration options.'),

Hide sites/all/modules/simplify/simplify.install
simplify.install

    *
      severity: minorLine 11: There should be no trailing spaces

       * 

    *
      severity: minorLine 25: There should be no trailing spaces

       * 

Please use Coder and correct the warnings.

Tested this module on Drupal 7, and it seems to work.

---------

But I don't really see the use of this. It removes this options ONLY for page nodes and for every user, even the admin user (uid 1). If a users that creates any types of nodes shouldn't see this options, it can be done with Permissions.

      // Unset specified form items if and only if variable is 0 (false).
      if (0 === variable_get('simplify_node_menu')) {
        unset($form['menu']);
      }
      if (0 === variable_get('simplify_node_revision_information')) {
        unset($form['revision_information']);
      }
      if (0 === variable_get('simplify_node_path')) {
        unset($form['path']);
      }
      if (0 === variable_get('simplify_node_comment_settings')) {
        unset($form['comment_settings']);
      }
      if (0 === variable_get('simplify_node_author')) {
        unset($form['author']);
      }
      if (0 === variable_get('simplify_node_options')) {
        unset($form['options']);
      }

By reading your description about the module above and when I saw this code I got very confused. I get this feeling that if simplify_node_options is true (1) then the $form['options'] will be unset, part by the description you gave and by the variable name. But when I read "Show publishing options" as the title for the checkbox it came clear to me. This might only be me, but this was not easy to understand. More comments or new variable names, or change from "Show" to "Hide publishing options" would make this code better. But as I said, this might only be me that think like this, so this is only a suggestion from my side.

avpaderno’s picture

if (0 === variable_get('simplify_node_options')) {
        unset($form['options']);
      }

I would expect too that the code should be, basing on the name of the variable:

if (variable_get('simplify_node_options')) {
        unset($form['options']);
      }

In all that code lines is not necessary to strictly compare the variable value with 0 (or 1).

markshust’s picture

I initially thought about setting this in the reverse option as discussed (making boxes unchecked by default and checking to hide), but thought it would be easier for the user to understand the module by using it the other way around. Based on the couple initial feedback's I will definitely change it back as I guess my reasoning for changing it was not ideal.

Thanks for the coder link, last time I used it, it was not functional for d7. I obviously missed the "not" in the menu notation, I'll correct.

I was planning on adding in permissions functions after the initial release. The more I think about it, the more I agree with you that this would probably be a requirement for a 1.0 release. I'll add this in and submit the new code.

markshust’s picture

Status: Needs work » Needs review
StatusFileSize
new1.46 KB

All set. I updated the variable names, switched the logic around, and ran it through coder. I also added a new 'simplify node hide settings' role that will hide the fields only if the user is assigned to that role and is not the administrator. Please let me know how it all looks now.

Thanks,
Mark

Scyther’s picture

Status: Needs review » Needs work

1.
package = Other
This is default, not needed.

2.
version = 7.x-1.0
This is added by the CVS, so remove it.

3.

  $form['simplify'] = array(
    '#type' => 'fieldset',
    '#title' => t('Nodes'),
  );

Think the title 'Nodes' are misleading, because your module only effects on the content type 'page'.

-----

There is no documentation about that this module only effects content type 'page', only in your first post here. I would like to see a note in a readme file or in the settingpage for this module.

markshust’s picture

Status: Needs work » Needs review
StatusFileSize
new1.76 KB

Regarding item #1 & #2, I have removed these from the info file.

Regarding #3/documentation, I have added in the ability to either hide boxes for All nodes or just the Page node content type, and added verbose descriptions of each on the Settings page. I think this will help people using it more clearly understand what is going on and give the user managing these settings more flexibility.

Thanks,
Mark

Scyther’s picture

1. Use drupal_substr in line 84 in .module

2. Why declare global $user; two times in function simplify_form_alter, why not put it in the begining in the function instead?

3. Why do you first use a switch for only one case, and after a if in simplify_form_alter? Why not combind those two to a switch or if/else if/else?

4. What if the content type 'page' dose not exists, then I think there should be no settings for that type. Or what do you think?

Scyther’s picture

Status: Needs review » Needs work

Sry, the link was to D6, and this module is D7, but think you got it.

Forgot to change status too.

markshust’s picture

1. I am now using the drupal_substr module.
2. I declared it twice (within the if tags), because if I put it at the beginning of the function the global $user; will be called on every single page request drupal makes; even those which I am not modifying. I thought it was better to declare it twice and use them each time then to declare them on every single form drupal requests and not use them at all. Forms may exist which may never be content types, and the global $user will be called every time for no reason. Does this make sense?
3. I have modified the switch statement and got rid of the if statement.
4. I agree with this. How can I check if the 'page' content type exists?

markshust’s picture

Status: Needs work » Needs review

I will upload the new version as soon as I get some feedback on my last posting. Thanks

Scyther’s picture

Status: Needs review » Needs work

1. Good.

2. It make sence, yes ;). I might have writen it to fast, because there is no right or wrong way to do that, what I know. But you will save lines of code with only declare it ones or you will save a microsecond or so if you put it in the if or switch. So do it the way you want.

3. Good.

4. You can use node_get_types() to get a list of content types and check.

markshust’s picture

Status: Needs work » Needs review
StatusFileSize
new1.82 KB

Thank you - attached is the revised module. I think the changes definitely have benefitted this module.

The node_get_types function is deprecated in d7, so I just used the _node_types_build function. Works just fine.

Please let me know if there is anything else. I will be actively updating this module on a regular basis with new features and capabilities once it is released.

Thanks,
Mark

markshust’s picture

Just wanted to check in to see if there were any other updates.

Thanks,
Mark

markshust’s picture

Anything? Been a couple weeks.

Thanks,
Mark

Scyther’s picture

Status: Needs review » Needs work

1. Use this function instead, node_type_get_types(). Know that thoose are (almost) equal, but this it the one to use.

I will be actively updating this module on a regular basis with new features and capabilities once it is released.

Have you made any updates since your last attachment?

markshust’s picture

Status: Needs work » Needs review
StatusFileSize
new1.81 KB

Attached is an updated module.

The key phrase in that quote is "once it is released". I don't want to devote my time and energy into this module if it never gets approved/released. It's a waste of my time and the reviewing team's time.

Scyther’s picture

Status: Needs review » Reviewed & tested by the community

Okey. The modules code looks ok and it seems to do what it should do.

markshust’s picture

Just checking back to see when the CVS account is coming, I would really like to get this out in time for D7.

avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for your contribution! I am going to update your account.

These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes