redcap-extras icon indicating copy to clipboard operation
redcap-extras copied to clipboard

Setting Up Hooks

Open samstewart11 opened this issue 10 years ago • 6 comments

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?

samstewart11 avatar Jan 14 '15 20:01 samstewart11

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.

oxbx08 avatar Jan 14 '15 22:01 oxbx08

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 [email protected] 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.

123andy avatar Jan 14 '15 22:01 123andy

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

oxbx08 avatar Jan 15 '15 00:01 oxbx08

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.

samstewart11 avatar Jan 19 '15 20:01 samstewart11

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

-A

On Jan 19, 2015, at 12:23 PM, slammaster [email protected] 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.

123andy avatar Jan 20 '15 04:01 123andy

@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!

ecnav0823 avatar Sep 10 '15 12:09 ecnav0823