Moodle
  1. Moodle
  2. MDL-36906

Latitude and Longitude database activity error

    Details

    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      Testing instructions.

      1. Add a database activity to a course.
      2. Create a new Latitude/longitude field (choose Google Earth) in the Link-out services to display.
      3. Add entry [31.9545°N, 115.8770°E].
      4. Select Template Tab. Save Template.
      5. Select View list/View single (either one doesn't really matter).
      6. Select the entry we created.
        • Check that no errors are thrown and that a download file dialogue is displayed.
      Show
      Testing instructions. Add a database activity to a course. Create a new Latitude/longitude field (choose Google Earth) in the Link-out services to display. Add entry [31.9545°N, 115.8770°E] . Select Template Tab. Save Template. Select View list/View single (either one doesn't really matter). Select the entry we created. Check that no errors are thrown and that a download file dialogue is displayed.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-36906-master
    • Rank:
      46441

      Description

      Steps to reproduce:

      1. Add database activity to course
      2. Create a new Latitude/longitude field (choose Google Earth) in the Link-out services to display
      3. Add entry [31.9545°N, 115.8770°E]
      4. Select Template Tab. Save Template.
      5. Select View list/View single (either one doesn't really matter)
      6. Select the entry we created

      Expected:
      The kml gets downloaded

      Actual:
      Error gets displayed

        Activity

        Hide
        Marcus Boon added a comment -

        Changing $context to get_context_instance(CONTEXT_MODULE, $cm->id)) seems to fix it

        Show
        Marcus Boon added a comment - Changing $context to get_context_instance(CONTEXT_MODULE, $cm->id)) seems to fix it
        Hide
        Adrian Greeve added a comment -

        Thanks Marcus for the report and the patch.

        I made a slight alteration to your fix to use the current api for getting the context.

        Submitting for peer review.

        Show
        Adrian Greeve added a comment - Thanks Marcus for the report and the patch. I made a slight alteration to your fix to use the current api for getting the context. Submitting for peer review.
        Hide
        Ankit Agarwal added a comment - - edited

        Hi Adrian, Marcus

        The patch looks good. However it might be a good idea to fetch the context somewhere around L78 and use that in this check as well:-

        if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities',context_module::instance($cm->id))) {
        

        Will save a DB call. Feel free to push for integration after the change.

        Thanks

        Show
        Ankit Agarwal added a comment - - edited Hi Adrian, Marcus The patch looks good. However it might be a good idea to fetch the context somewhere around L78 and use that in this check as well:- if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities',context_module::instance($cm->id))) { Will save a DB call. Feel free to push for integration after the change. Thanks
        Hide
        Adrian Greeve added a comment -

        Thanks Ankit for the review and spotting the other has_capability check.

        I've made those changes, submitting for integration review.

        Show
        Adrian Greeve added a comment - Thanks Ankit for the review and spotting the other has_capability check. I've made those changes, submitting for integration review.
        Hide
        Sam Hemelryk added a comment -

        Thanks Adrian, integrated now

        Show
        Sam Hemelryk added a comment - Thanks Adrian, integrated now
        Hide
        David Monllaó added a comment -

        Hi, I've found a little strict standards notice in MOODLE_22_STABLE when adding an entry, I've commented it with Adrian.

        Attaching quick fix on top of integration 22:

        • git://github.com/dmonllao/moodle.git
        • branch: MDL-36906_22-strictstandardsfix
        • commit hash: 52fe1ad856922ceb8a93e54e48a67905d0bc4ad4
        Show
        David Monllaó added a comment - Hi, I've found a little strict standards notice in MOODLE_22_STABLE when adding an entry, I've commented it with Adrian. Attaching quick fix on top of integration 22: git://github.com/dmonllao/moodle.git branch: MDL-36906 _22-strictstandardsfix commit hash: 52fe1ad856922ceb8a93e54e48a67905d0bc4ad4
        Hide
        David Monllaó added a comment -

        Passing it after talking with Dan, Moodle 2.2 is not E_STRICT compliant, forget about my last comment

        Show
        David Monllaó added a comment - Passing it after talking with Dan, Moodle 2.2 is not E_STRICT compliant, forget about my last comment
        Hide
        Dan Poltawski added a comment -

        Just commented in the dev chat, in 2.2 we are not E_STRICT compliant, so this is OK. See MDL-31004

        Show
        Dan Poltawski added a comment - Just commented in the dev chat, in 2.2 we are not E_STRICT compliant, so this is OK. See MDL-31004
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now!

        Closing, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now! Closing, ciao

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: