Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31496

Database Fields inline CSS

    XMLWordPrintable

    Details

    • Database:
      Any
    • Testing Instructions:
      Hide
      1. Go to a course and create a database activity
      2. Add fields of this types: checkbox, menu, multimenu, radiobutton. In the add form, the size of the textarea SHOULD be the one specified in the class 'optionstextarea' (you can check it with a code inspector - applied styles)
      3. Add one 'textarea' field; In the add form, the size of the width and height elements should be the specified in the class 'textareafieldsize'
      4. Add one 'picture' field; In the add form, the size of the size elements should be the specified in the class 'picturefieldsize'
      5. Add a 'number' and a 'text' field
      6. Add a 'latlong' field selecting one of the multiselect elements
      7. Go to 'Add entry', the input element of the number and text fields SHOULD NOT have inline styles and the 'basefieldinput' class styles SHOULD be applied
      8. Fill the 'Add entry' form and go to 'view list' or 'view single', the latlong field values SHOULD respect the default template style (it SHOULD be displayed like any other field, not centered)
      9. Go to the 'View list' tab
      10. In the lower part of the page you SHOULD see the basic search fields: entries per page, search, sort by
      11. In the same basic select search fields, if you check 'advanced search' the 'search' text input SHOULD be hidden and there SHOULD appear a lot of fields below (a lot = one for each database field + author fields)
      12. Go to the 'search' tab the 'search' text input SHOULD be hidden and there SHOULD appear a lot of fields (a lot = one for each database field + author fields)
      13. Go to the 'templates' tab and navigate through the different templates
      14. The heading SHOULD be centered
      15. Try to edit the templates and check the corresponding associated pages, the template styles SHOULD be respected
      Show
      Go to a course and create a database activity Add fields of this types: checkbox, menu, multimenu, radiobutton. In the add form, the size of the textarea SHOULD be the one specified in the class 'optionstextarea' (you can check it with a code inspector - applied styles) Add one 'textarea' field; In the add form, the size of the width and height elements should be the specified in the class 'textareafieldsize' Add one 'picture' field; In the add form, the size of the size elements should be the specified in the class 'picturefieldsize' Add a 'number' and a 'text' field Add a 'latlong' field selecting one of the multiselect elements Go to 'Add entry', the input element of the number and text fields SHOULD NOT have inline styles and the 'basefieldinput' class styles SHOULD be applied Fill the 'Add entry' form and go to 'view list' or 'view single', the latlong field values SHOULD respect the default template style (it SHOULD be displayed like any other field, not centered) Go to the 'View list' tab In the lower part of the page you SHOULD see the basic search fields: entries per page, search, sort by In the same basic select search fields, if you check 'advanced search' the 'search' text input SHOULD be hidden and there SHOULD appear a lot of fields below (a lot = one for each database field + author fields) Go to the 'search' tab the 'search' text input SHOULD be hidden and there SHOULD appear a lot of fields (a lot = one for each database field + author fields) Go to the 'templates' tab and navigate through the different templates The heading SHOULD be centered Try to edit the templates and check the corresponding associated pages, the template styles SHOULD be respected
    • Workaround:
      Hide

      For this we should modify /mod/data/lib.php arround de line 246:

      OLD:
      $str .= '<input style="width:300px;" type="text" name="field_'.$this->field->id.'" id="field_'.$this->field->id.'" value="'.s($content).'" />';

      New:
      $str .= '<input type="text" name="field_'.$this->field->id.'" id="field_'.$this->field->id.'" value="'.s($content).'" />';

      Show
      For this we should modify /mod/data/lib.php arround de line 246: OLD: $str .= '<input style="width:300px;" type="text" name="field_'.$this->field->id.'" id="field_'.$this->field->id.'" value="'.s($content).'" />'; New: $str .= '<input type="text" name="field_'.$this->field->id.'" id="field_'.$this->field->id.'" value="'.s($content).'" />';
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-31496_master

      Description

      The problem is that certain database activity module fields are printed with inline CSS(width=300px. That doesn't let us modify the style of that fields.
      The fields with that behaviour are those that haven't got redefined the display_add_field method (For example: number field class /mod/data/field/number/field.class.php). So the best option would be to modify the method of the parent class (data_field_base) and then if its necesary each field should have its own display_add_field redefined.

        Attachments

          Activity

            People

            Assignee:
            dmonllao David Monllaó
            Reporter:
            fbotti Federico Botti
            Peer reviewer:
            Andrew Davis
            Integrator:
            Sam Hemelryk
            Tester:
            Ankit Agarwal
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Sep/12