susom / redcap-extras

Custom plugins, hooks, DET, and API examples
Apache License 2.0
16 stars 17 forks source link

Setting Up Hooks #4

Open samstewart11 opened 9 years ago

samstewart11 commented 9 years ago

I'm trying to use the imagemaps hook for my project. I can get it to work for a survey, but not for a data entry tool. I THINK that is because there is a "redcap_survey_page.php" in the global directory, but there is not a "redcap_data_entry_form.php" file in it (which the redcap_hooks.php refers to).

Would copying the redcap_survey_page.php to redcap_data_entry_form.php be sufficient? That would be my first instinct, but I don't have write access to the server at the moment, so I can't be sure. If that is not the solution then what should go into the redcap_data_entry_form.php file to make imagemap available in a data entry tool?

oxbx08 commented 9 years ago

Hey,

So I was literally just looking at this all earlier today. I just did a brief glance over it all but I didn't see anything in redcap_survey_page.php which would limit it's search to just surveys. And in fact it appears as though most of the rendering is happening on /resources/imagemap/imagemap.js Specifically within imagemap.js are some lines about removing the input fields before loading the imagemap only happening on pages with a url of surveys/index.php. That may be a better place to focus your search but I'm basing this off a cursory glance at your question.

That said Andy will probably be the best person to provide an answer as it's his work.

123andy commented 9 years ago

Hi there,

Yes - I think you could copy the code into the data_entry_form hooks and it should mostly work… I haven’t really tested it all that much. There might be a few relics from when it was inserted int the surveys/index.php page…

There could probably be a more elegant solution than having to keep the code in two places…

You could, for example, just include the actual code from the resources folder into each trigger? Dunno…

-Andy

On Jan 14, 2015, at 2:43 PM, oxbx08 notifications@github.com wrote:

Hey,

So I was literally just looking at this all earlier today. I just did a brief glance over it all but I didn't see anything in redcap_survey_page.php which would limit it's search to just surveys. And in fact it appears as though most of the rendering is happening on /resources/imagemap/imagemap.js Specifically within imagemap.js are some lines about removing the input fields before loading the imagemap only happening on pages with a url of surveys/index.php. That may be a better place to focus your search but I'm basing this off a cursory glance at your question.

That said Andy will probably be the best person to provide an answer as it's his work.

— Reply to this email directly or view it on GitHub https://github.com/susom/redcap-extras/issues/4#issuecomment-70007667.

oxbx08 commented 9 years ago

So I just tested it. You were right. Only other thing I had to do to get it to work was remove/change lines 120-124 on imagemap.js to allow you to select areas on the image which is currently prevented on Data Entry pages.

image

samstewart11 commented 9 years ago

Thanks very much to both of you. I've got it working now, and actually managed to implement my own map of a musculoskeletal exam:

image

If you want I can upload the PNG and HTML code for the model.

123andy commented 9 years ago

Kind of looks like Sonny from I-Robot on some funky roller blades… :-)

-A

On Jan 19, 2015, at 12:23 PM, slammaster notifications@github.com wrote:

Thanks very much to both of you. I've got it working now, and actually managed to implement my own map of a musculoskeletal exam:

https://cloud.githubusercontent.com/assets/1071976/5807212/946a29ac-9fe6-11e4-97e2-bf32ccf933bb.png If you want I can upload the PNG and HTML code for the model.

— Reply to this email directly or view it on GitHub https://github.com/susom/redcap-extras/issues/4#issuecomment-70554647.

ecnav0823 commented 9 years ago

@oxbx08 and @slammaster - I am very late to this thread, but I stumbled upon it while searching for how-tos. I'm relatively new to advanced Redcap database building, so i'm hoping anyone can share the code(s) for getting the imagemap to show on the data entry screen as well as the code for the musculoskeletal image. Thanks in advance for ANY info!