Changeset 479


Ignore:
Timestamp:
May 26, 2010, 4:53:45 PM (9 years ago)
Author:
roberth
Message:

Created an interface to PubMed? for searching publications. This is intended to be used in the study creation wizard. See publication/add method

Location:
trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/PublicationController.groovy

    r437 r479  
    1414    def index = {
    1515        redirect(action: "list", params: params)
     16    }
     17
     18    /**
     19     * Shows a form to add a new publication by searching pubmed
     20     */
     21    def add = {}
     22
     23    /**
     24     * Adds publication selected from pubmed
     25     */
     26    def createFromPubmed = {
     27        // instantiate term with parameters
     28        def publication = new Publication(
     29            title: params.get( 'publication-title' ),
     30            authorsList: params.get( 'publication-authorsList' ),
     31            pubMedID: params.get( 'publication-pubMedID' ),
     32            DOI: params.get( 'publication-doi' )
     33        )
     34
     35        def message;
     36        def errors = '';
     37
     38        // validate term
     39        if (publication.validate()) {
     40            println "Publication validated correctly"
     41            publication.save()
     42            message = "Publication added to the system"
     43        } else {
     44            println "Publication validation failed"
     45            println "errors:"
     46            publication.errors.getAllErrors().each() {
     47                println it
     48            }
     49            errors = publications.errors.getAllErrors.join( ', ' );
     50            message = "Publication addition failed"
     51        }
     52
     53        render( 'view': 'add', model:[ message: message, errors: errors ] );
    1654    }
    1755
  • trunk/grails-app/views/publication/show.gsp

    r437 r479  
    5050                            <td valign="top" class="name"><g:message code="publication.DOI.label" default="DOI" /></td>
    5151
    52                             <td valign="top" class="value">${fieldValue(bean: publicationInstance, field: "DOI")}</td>
     52                            <td valign="top" class="value">
     53                              <g:if test="${publicationInstance.DOI}">
     54                                <a href="http://dx.doi.org/${fieldValue(bean: publicationInstance, field: "DOI")}">
     55                                  ${fieldValue(bean: publicationInstance, field: "DOI")}
     56                                </a>
     57                              </g:if>
     58                            </td>
    5359
    5460                        </tr>
Note: See TracChangeset for help on using the changeset viewer.