From cardillo at med.umich.edu Mon May 14 12:09:07 2018 From: cardillo at med.umich.edu (Cardillo, Garry) Date: Mon, 14 May 2018 16:09:07 +0000 Subject: [Loris-dev] incorporating javascript into php instrument forms In-Reply-To: References: , , <542c4675da9140cba886b56a43186a24@med.umich.edu>, Message-ID: Hello All, Hoping you can help me out a little bit more. I am trying to get custom JS and CSS working on our instrument forms. We are on 14.12.1. Here is what I have done: 1. Copied the getJS and getCSS code from NDB_Page on github to NDB_Page in my system (code I pulled is below) 2. Copied NDB_BVL_Instrument.class.inc from /php/libraries to /project/libraries 3. Created folders and files for custom js and css: * /project/instruments/css/css.css * /project/instruments/js/js.js 4. Added getJS and getCSS code into NDB_BVL_Instrument.class.inc and pointed the paths to the locations in #3 (code is below) 5. Checked and verified the instrument forms are extending the NDB_BVL_Instrument.class.inc file from /project/libraries Seems like there is one small piece I'm missing somewhere. I found a file at: /htdocs/bootstrap/css/custom-css.css that has a section "CSS for instrument forms" and code that I've added there is being referenced by our instruments, which would work fine as a work around, but I still want to apply custom javascript as well, AND I want to find out where I went wrong in the process I outlined above. Thanks for any insight you can offer. -Garry CODE ADDED TO NDB_PAGE FROM GITHUB: /** * Returns an ordered list of javascript dependencies that this page depends * on. These will get loaded into the template in order, so that * interdependent files can be included in the correct order. * * @return array of strings with URLs to retrieve JS resources */ function getJSDependencies() { $factory = NDB_Factory::singleton(); $config = $factory->config(); $www = $config->getSetting('www'); $baseurl = $www['url']; $min = ($config->getSetting("sandbox") === '1') ? '' : '.min'; // Currently jquery-ui is required for dialogs and datepickers to work. // In the future release, dialogs should be replaced with bootstrap dialogs // and datepickers only created by modernizr $files = array( $baseurl . '/js/jquery/jquery-1.11.0.min.js', $baseurl . '/js/helpHandler.js', $baseurl . '/js/modernizr/modernizr.min.js', // Only load minified file on production, not sandboxes $baseurl . '/js/polyfills.js', $baseurl . '/js/react/react-with-addons' . $min . '.js', $baseurl . '/js/react/react-dom' . $min . '.js', $baseurl . '/js/jquery/jquery-ui-1.10.4.custom.min.js', $baseurl . '/js/jquery.dynamictable.js', $baseurl . '/js/jquery.fileupload.js', $baseurl . '/bootstrap/js/bootstrap.min.js', $baseurl . '/js/components/Breadcrumbs.js', $baseurl . '/vendor/sweetalert/sweetalert' . $min . '.js', $baseurl . "/js/util/queryString.js", $baseurl . '/js/components/Form.js', $baseurl . '/js/components/Markdown.js', ); return $files; } /** * Returns an ordered list of CSS dependencies that this page depends * on. These will get loaded into the template in order, so that * interdependent files can be included in the correct order. * * @return array of strings with URLs to retrieve CSS resources */ function getCSSDependencies() { $factory = NDB_Factory::singleton(); $config = $factory->config(); $www = $config->getSetting('www'); $baseurl = $www['url']; $files = array( $baseurl . "/bootstrap/css/bootstrap.min.css", $baseurl . "/bootstrap/css/custom-css.css", $baseurl . "/js/jquery/datepicker/datepicker.css", $baseurl . '/vendor/sweetalert/sweetalert.css', ); return $files; } CODE ADDED TO NDB_BVL_INSTRUMENT.CLASS.INC: function getJSDependencies() { $factory = \NDB_Factory::singleton(); $baseURL = $factory->settings()->getBaseURL(); $deps = parent::getJSDependencies(); return array_merge( $deps, array( $baseURL . "/project/instruments/js/js.js", ) ); } function getCSSDependencies() { $factory = \NDB_Factory::singleton(); $baseURL = $factory->settings()->getBaseURL(); $deps = parent::getCSSDependencies(); return array_merge( $deps, [$baseURL . "/project/instruments/css/css.css"] ); } Garry Cardillo [1523292633747_image001.png] Database Analyst/Programmer Intermediate Department of Radiology Functional Neuroimaging, Cognitive and Mobility Laboratory Domino?s Farms Lobby B Suite 1000 24 Frank Lloyd Wright Dr PO BOX 362 Ann Arbor, MI 48106 t: 734-936-0630 f: 734-998-8403 e: cardillo at umich.edu ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues -------------- next part -------------- An HTML attachment was scrubbed... URL: From zvirani.mcin at gmail.com Tue May 15 14:56:11 2018 From: zvirani.mcin at gmail.com (Zain Virani) Date: Tue, 15 May 2018 14:56:11 -0400 Subject: [Loris-dev] incorporating javascript into php instrument forms In-Reply-To: References: <542c4675da9140cba886b56a43186a24@med.umich.edu> Message-ID: Hi Garry, Thanks for reaching out! Firstly, we *strongly recommend* you update your LORIS instance to the newest release version for security purposes and to gain access to our new features. The steps outlined below *may not work on older versions*, but it's worth a shot. For adding CSS and JS to your instruments, because name-spacing and other relevant features have changed so much since v14, I think we should try to keep this as simple as possible until you upgrade LORIS: 1. Start by placing your CSS and JS files in `Loris/htdocs/css/` and `Loris/htdocs/js/` respectively. 2. Edit `Loris/php/libraries/NDB_Page.class.inc` as follows: In the `getCSSDependencies()` function, add `$baseurl . '/css/css.css',` in the `$files` array. In the `getJSDependencies()` function, add `$baseurl . '/js/js.js',` in the `$files` array. This should do the trick, but it is *not* a permanent solution. The code you add to `NDB_Page.class.inc` will be overwritten whenever you upgrade LORIS. By extending the class in a separate file you can ensure your overrides are safe between versions (same goes for the Instrument class). Once you upgrade, the steps outlined by David in your previous email thread will be relevant again and we can troubleshoot more accurately. Each version, along with steps for upgrading, are available here . Note that you will have to follow the steps for each version in between 14.12.1 and 19.1, including applying each major release patch in chronological order. If you need any assistance with this, or have questions about the `Notes for existing Projects` in our release notes, let us know. There are a few reasons why the previous instructions may not have worked. If there are any messages in the error logs or JavaScript console, send those my way and I'll take a look, but it will be easier to troubleshoot a newer version of LORIS. Hope this helps, Zain On Mon, May 14, 2018 at 12:09 PM, Cardillo, Garry wrote: > Hello All, > > > Hoping you can help me out a little bit more. I am trying to get custom > JS and CSS working on our instrument forms. We are on 14.12.1. > > > Here is what I have done: > > > > 1. Copied the getJS and getCSS code from NDB_Page on github to > NDB_Page in my system (code I pulled is below) > 2. Copied NDB_BVL_Instrument.class.inc from /php/libraries to > /project/libraries > 3. Created folders and files for custom js and css: > 1. /project/instruments/css/css.css > 2. /project/instruments/js/js.js > 4. Added getJS and getCSS code into NDB_BVL_Instrument.class.inc and > pointed the paths to the locations in #3 (code is below) > 5. Checked and verified the instrument forms are extending the > NDB_BVL_Instrument.class.inc file from /project/libraries > > > Seems like there is one small piece I'm missing somewhere. > > > I found a file at: /htdocs/bootstrap/css/custom-css.css that has a > section "CSS for instrument forms" and code that I've added there is being > referenced by our instruments, which would work fine as a work around, but > I still want to apply custom javascript as well, AND I want to find out > where I went wrong in the process I outlined above. > > Thanks for any insight you can offer. > > -Garry > > CODE ADDED TO NDB_PAGE FROM GITHUB: > > /** > > * Returns an ordered list of javascript dependencies that this page > depends > > * on. These will get loaded into the template in order, so that > > * interdependent files can be included in the correct order. > > * > > * @return array of strings with URLs to retrieve JS resources > > */ > > function getJSDependencies() > > { > > $factory = NDB_Factory::singleton(); > > $config = $factory->config(); > > $www = $config->getSetting('www'); > > $baseurl = $www['url']; > > $min = ($config->getSetting("sandbox") === '1') ? '' : '.min'; > > // Currently jquery-ui is required for dialogs and datepickers to work. > > // In the future release, dialogs should be replaced with bootstrap > dialogs > > // and datepickers only created by modernizr > > $files = array( > > $baseurl . '/js/jquery/jquery-1.11.0.min.js', > > $baseurl . '/js/helpHandler.js', > > $baseurl . '/js/modernizr/modernizr.min.js', > > // Only load minified file on production, not sandboxes > > $baseurl . '/js/polyfills.js', > > $baseurl . '/js/react/react-with-addons' . $min . '.js', > > $baseurl . '/js/react/react-dom' . $min . '.js', > > $baseurl . '/js/jquery/jquery-ui-1.10.4.custom.min.js', > > $baseurl . '/js/jquery.dynamictable.js', > > $baseurl . '/js/jquery.fileupload.js', > > $baseurl . '/bootstrap/js/bootstrap.min.js', > > $baseurl . '/js/components/Breadcrumbs.js', > > $baseurl . '/vendor/sweetalert/sweetalert' . $min . '.js', > > $baseurl . "/js/util/queryString.js", > > $baseurl . '/js/components/Form.js', > > $baseurl . '/js/components/Markdown.js', > > ); > > return $files; > > } > > > /** > > * Returns an ordered list of CSS dependencies that this page depends > > * on. These will get loaded into the template in order, so that > > * interdependent files can be included in the correct order. > > * > > * @return array of strings with URLs to retrieve CSS resources > > */ > > function getCSSDependencies() > > { > > $factory = NDB_Factory::singleton(); > > $config = $factory->config(); > > $www = $config->getSetting('www'); > > $baseurl = $www['url']; > > $files = array( > > $baseurl . "/bootstrap/css/bootstrap.min.css", > > $baseurl . "/bootstrap/css/custom-css.css", > > $baseurl . "/js/jquery/datepicker/datepicker.css", > > $baseurl . '/vendor/sweetalert/sweetalert.css', > > ); > > return $files; > > } > > > CODE ADDED TO NDB_BVL_INSTRUMENT.CLASS.INC: > > > function getJSDependencies() { > > $factory = \NDB_Factory::singleton(); > > $baseURL = $factory->settings()->getBaseURL(); > > $deps = parent::getJSDependencies(); > > return array_merge( > > $deps, > > array( > > $baseURL . "/project/instruments/js/js.js", > > ) > > ); > > } > > > function getCSSDependencies() > > { > > $factory = \NDB_Factory::singleton(); > > $baseURL = $factory->settings()->getBaseURL(); > > $deps = parent::getCSSDependencies(); > > return array_merge( > > $deps, > > [$baseURL . "/project/instruments/css/css.css"] > > ); > > } > > Garry Cardillo > [image: 1523292633747_image001.png] > > Database Analyst/Programmer Intermediate > > Department of Radiology > > Functional Neuroimaging, Cognitive and Mobility Laboratory > > Domino?s Farms Lobby B Suite 1000 > > 24 Frank Lloyd Wright Dr PO BOX 362 > > Ann Arbor, MI 48106 > > t: 734-936-0630 > > f: 734-998-8403 > > e: cardillo at umich.edu > > ********************************************************** > Electronic Mail is not secure, may not be read every day, and should not > be used for urgent or sensitive issues > > _______________________________________________ > Loris-dev mailing list > Loris-dev at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/loris-dev > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Bonhwang.Koo at childmind.org Thu May 17 15:50:41 2018 From: Bonhwang.Koo at childmind.org (Bonhwang Koo) Date: Thu, 17 May 2018 19:50:41 +0000 Subject: [Loris-dev] Question regarding data query tool Message-ID: <74743BB4-166D-4191-8E5A-C4621A05DD39@childmind.org> Hi all, We noticed in the data query tool that behavioral assessments can only include one entry per ID, which means that when importing some of our assessments with multiple entries per participants, many entries will be overwritten. There are some assessments where we can work around this issue, but not so much for others. Does anyone know of a way to allow multiple entries for each participant? We import our data from .csv?s using a script based on tools/CouchDB_Import_Instruments.php, which I can send in a separate email. Best, -- Bonhwang Koo Research Assistant, CDB Child Mind Institute childmind.org 445 Park Avenue (entrance on 56th Street) New York, NY 10022 E: Bonhwang.Koo at childmind.org p: 646.625.4398 f: 646.625.4348 Facebook: facebook.com/ChildMindInstitute | Follow us on Twitter: twitter.com/ChildMindDotOrg --- This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cardillo at med.umich.edu Tue May 29 14:35:47 2018 From: cardillo at med.umich.edu (Cardillo, Garry) Date: Tue, 29 May 2018 18:35:47 +0000 Subject: [Loris-dev] conditional fields Message-ID: Hello, I'm wondering if anyone has done anything with dynamic conditional fields on instrument forms. i.e. If a user selects "yes" from a drop down list, display a date field (without needing to first submit the form) I know that the Create Timepoint module has this functionality; after you select Subproject, Visit label pops up. I have not been able to figure out how to replicate this functionality within an instrument. Any help would be greatly appreciated! Garry Cardillo [1523292633747_image001.png] Database Analyst/Programmer Intermediate Department of Radiology Functional Neuroimaging, Cognitive and Mobility Laboratory Domino?s Farms Lobby B Suite 1000 24 Frank Lloyd Wright Dr PO BOX 362 Ann Arbor, MI 48106 t: 734-936-0630 f: 734-998-8403 e: cardillo at umich.edu ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues -------------- next part -------------- An HTML attachment was scrubbed... URL: From rolando.acosta at cnbp.ca Wed May 30 10:04:05 2018 From: rolando.acosta at cnbp.ca (Rolando Acosta) Date: Wed, 30 May 2018 10:04:05 -0400 Subject: [Loris-dev] Granular and time expiring permissions on LORIS. Message-ID: Good morning loris-dev, For the project we are working on CHU Sainte-Justine we realize we will need to set (for a given user) access to the system but only for a given time window. We have identify that there is an option to make an user active or inactive checking a Box on the user's permission config. What we are wondering is if there are an easy way for a "DataCenter manager"... let call it this way... to (at the time of creating a user or later on) set for example that it will be only active from May 30 2018 to June 20 2018? I know its a very specific requiriment of our project but if you have already implemented this functionality or can give us any insight of how to do it will be great. Thank you very much, Rolando Acosta (CHU Sainte-Justine) -------------- next part -------------- An HTML attachment was scrubbed... URL: From rida.loris at gmail.com Thu May 31 17:16:16 2018 From: rida.loris at gmail.com (Rida Abou-Haidar) Date: Thu, 31 May 2018 17:16:16 -0400 Subject: [Loris-dev] Granular and time expiring permissions on LORIS. In-Reply-To: References: Message-ID: Hi Rolando, No this functionality does not currently exist in LORIS, you are the first project asking for it from what I can tell. If I was to implement this feature, I would do it the following way: - add 2 columns to the users table in the database (`active_from` DATE, `active_to` DATE) - modify the edit_user form (link https://github.com/aces/Loris/blob/minor/modules/user_accounts/php/edit_user.class.inc) to add 2 new fields - copy the entire module (user_accounts) into your project/modules/ directory - the _process(), _validateEditUser() and setup() functions will need to be modified to add the 2 new fields ('Active Date From', 'Active date To') - modify the template file for edit user (link https://github.com/aces/Loris/blob/minor/modules/user_accounts/templates/form_edit_user.tpl ) - copy the php/libraries/SinglePointLogin.class.inc into the project/libraries/ directory and add a check to verify the date of activity and change the `users`.`active` database field from 'Y' to 'N' if the login attempt is at a date later then `active_to`. This needs to be added at the right line, before the check for the users active flag (link: https://github.com/aces/Loris/blob/minor/php/libraries/SinglePointLogin.class.inc#L316). If done correctly the activity check will fail if the date is passed. At this point with the additions above the system should automatically check the authorized dates, and update the users.active field to represent if a user is authorized or not to access. LORIS's current infrastructure already checks for that flag before allowing login. Note that all/any field names can be named to your liking I just suggested the ones above as examples. If this is implemented correctly (in a non-hacky way) it is welcome to be submitted as a PR to our repo which might be merged into a future release and that would spare you overrides later on (overrides being the module and library file that were moved into the project directory). Best of luck and let us know if you need more details, Rida Abou-Haidar CCNA Software Developer Montreal Neurological Institute McGill University rida.loris at gmail.com On Wed, May 30, 2018 at 10:04 AM Rolando Acosta wrote: > Good morning loris-dev, > > For the project we are working on CHU Sainte-Justine we realize we will > need to set (for a given user) access to the system but only for a given > time window. > > We have identify that there is an option to make an user active or > inactive checking a Box on the user's permission config. > > What we are wondering is if there are an easy way for a "DataCenter > manager"... let call it this way... to (at the time of creating a user or > later on) set for example that it will be only active from May 30 2018 to > June 20 2018? > > I know its a very specific requiriment of our project but if you have > already implemented this functionality or can give us any insight of how to > do it will be great. > > Thank you very much, > Rolando Acosta (CHU Sainte-Justine) > _______________________________________________ > Loris-dev mailing list > Loris-dev at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/loris-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: