Skip to content

Instantly share code, notes, and snippets.

@andyxmas
Last active August 29, 2015 14:04

Revisions

  1. andyxmas revised this gist Aug 27, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion pgr-projects-adt
    Original file line number Diff line number Diff line change
    @@ -299,6 +299,7 @@ $(document).ready(function() {
    </script>

    <style type="text/css">

    .dataTables_filter{padding-left: 8px;}
    .aui .dataTables_filter input {margin: 10px;}
    .aui .dataTables_filter label {margin-bottom: 0;}
    @@ -339,7 +340,7 @@ $(document).ready(function() {
    .aui .table thead th{vertical-align: middle;}

    /*no results*/
    .no-results a:link{
    .no-results a{
    text-decoration: underline;
    color: #1a658d!important;
    }
  2. andyxmas revised this gist Aug 27, 2014. 1 changed file with 20 additions and 29 deletions.
    49 changes: 20 additions & 29 deletions pgr-projects-adt
    Original file line number Diff line number Diff line change
    @@ -72,35 +72,26 @@

    <#else>
    <div class="no-results">
    <div class="alert alert-info">No research led opportunities were returned in this list.</div>

    <p>View a list of all the <a href="">research led opportunities at UEA</a>.</p>

    <p>
    Find information about applicant led opportunities and Professional Doctorates at the relevant Faculty's Graduate School:
    <ul>
    <li>
    <a href="https://www.uea.ac.uk/hum/gradschool">Arts &amp; Humanities</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/medicine-health-sciences/graduate-school">Medicine and Health Sciences</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/sci/gradschool">Science</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/social-sciences/graduate-school">Social Sciences</a>
    </li>
    </ul>

    .no-results a:link{
    text-decoration: underline;
    color: #1a658d!important;
    }

    .no-results a:hover {
    color: #535455!important;
    }
    <div class="alert alert-info">No research led opportunities were returned in this list.</div>

    <p>View a list of all the <a href="">research led opportunities at UEA</a>.</p>

    <p>
    Find information about applicant led opportunities and Professional Doctorates at the relevant Faculty's Graduate School:
    <ul>
    <li>
    <a href="https://www.uea.ac.uk/hum/gradschool">Arts &amp; Humanities</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/medicine-health-sciences/graduate-school">Medicine and Health Sciences</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/sci/gradschool">Science</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/social-sciences/graduate-school">Social Sciences</a>
    </li>
    </ul>
    </div>
    </#if>

  3. andyxmas revised this gist Aug 27, 2014. 1 changed file with 41 additions and 3 deletions.
    44 changes: 41 additions & 3 deletions pgr-projects-adt
    Original file line number Diff line number Diff line change
    @@ -72,8 +72,35 @@

    <#else>
    <div class="no-results">
    <p>There are currently no Research Led Opportunities here.</p>
    <a href="https://testwww.uea.ac.uk/pgrprojects" class="btn btn-primary">View all Research Led Opportunities</a>
    <div class="alert alert-info">No research led opportunities were returned in this list.</div>

    <p>View a list of all the <a href="">research led opportunities at UEA</a>.</p>

    <p>
    Find information about applicant led opportunities and Professional Doctorates at the relevant Faculty's Graduate School:
    <ul>
    <li>
    <a href="https://www.uea.ac.uk/hum/gradschool">Arts &amp; Humanities</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/medicine-health-sciences/graduate-school">Medicine and Health Sciences</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/sci/gradschool">Science</a>
    </li>
    <li>
    <a href="https://www.uea.ac.uk/social-sciences/graduate-school">Social Sciences</a>
    </li>
    </ul>

    .no-results a:link{
    text-decoration: underline;
    color: #1a658d!important;
    }

    .no-results a:hover {
    color: #535455!important;
    }
    </div>
    </#if>

    @@ -316,8 +343,19 @@ $(document).ready(function() {
    background: #00597f!important;
    }

    /*basic styles*/
    /*portlet + basic table styles*/
    .portlet-boundary_101_{margin: 0;}
    .aui .table thead th{vertical-align: middle;}

    /*no results*/
    .no-results a:link{
    text-decoration: underline;
    color: #1a658d!important;
    }

    .no-results a:hover {
    color: #535455!important;
    }


    </style>
  4. andyxmas revised this gist Aug 27, 2014. 1 changed file with 235 additions and 45 deletions.
    280 changes: 235 additions & 45 deletions pgr-projects-adt
    Original file line number Diff line number Diff line change
    @@ -1,58 +1,239 @@
    #if (!$entries.isEmpty())
    <#if entries?has_content>

    <table class="pgrList table table-striped table-bordered table-hover">
    <#assign liferay_ui = taglibLiferayHash["/WEB-INF/tld/liferay-ui.tld"] />

    <table class="pgrList table table-striped table-bordered table-hover">
    <thead>
    <tr>
    <th>Opportunity Title</th>
    <th>Title</th>
    <th>Primary Supervisor</th>
    <th>Application Deadline</th>
    <th>Funding Type</th>
    <th>Subject Area</th>

    </tr>
    </thead>
    <tbody>
    #foreach ($curEntry in $entries)
    #set($renderer = $curEntry.getAssetRenderer() )
    #set($className = $renderer.getClassName() )

    #if( $className == "com.liferay.portlet.journal.model.JournalArticle" )
    #set( $journalArticle = $renderer.getArticle() )
    #set( $document = $saxReaderUtil.read($journalArticle.getContent()) )
    #set( $rootElement = $document.getRootElement() )

    #foreach( $dynamicElement in $rootElement.elements() )
    #if( "supervisor_name" == $dynamicElement.attributeValue("name") )
    #set( $primarySupervisor = $dynamicElement.element("dynamic-content").getText() )
    #end
    #if( "deadline" == $dynamicElement.attributeValue("name") )
    #set( $deadline = $dynamicElement.element("dynamic-content").getData() )
    #set( $date_DateObj = $dateUtil.newDate($getterUtil.getLong($deadline)))
    #end
    #end
    #end

    <tr class="pgritem">
    <td class="pgrTitle"><a href='$assetPublisherHelper.getAssetViewURL($renderRequest, $renderResponse, $curEntry)'>$curEntry.getTitle($locale)</a></td>
    <td class="primarySupervisor">$primarySupervisor</td>
    <td class="deadline"><span class="hidden">$dateUtil.getDate($date_DateObj, "yyyy-M-d", $locale)</span>$dateUtil.getDate($date_DateObj, "dd MMM yyyy", $locale)</td>
    </tr>

    #end
    </tbody>
    </table>

    #else

    <#list entries as entry>
    <#assign entry = entry />

    <#assign assetRenderer = entry.getAssetRenderer() />

    <#assign entryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) />

    <#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry) />

    <#if assetLinkBehavior != "showFullContent">
    <#assign viewURL = assetRenderer.getURLViewInContext(renderRequest, renderResponse, viewURL) />
    </#if>

    <#assign className = assetRenderer.getClassName />

    <#assign journalArticle = assetRenderer.getArticle() />
    <#assign document = saxReaderUtil.read(journalArticle.getContent()) />
    <#assign rootElement = document.getRootElement() />

    <#list rootElement.elements() as dynamicElement>
    <#if "supervisor_name" == dynamicElement.attributeValue("name")>
    <#assign primarySupervisor = dynamicElement.element("dynamic-content").getText() />
    </#if>
    <#if "funding_status" == dynamicElement.attributeValue("name")>
    <#assign funding_status = dynamicElement.element("dynamic-content").getText() />
    </#if>
    <#if "deadline" == dynamicElement.attributeValue("name")>
    <#assign deadline = dynamicElement.element("dynamic-content").getData() />
    <#assign date_DateObj = dateUtil.newDate(getterUtil.getLong(deadline)) />
    </#if>
    </#list>

    <tr>
    <td><a href="${viewURL}">${entryTitle}</a>
    </td>
    <td>${primarySupervisor}</td>
    <td class="deadline"><span class="hidden">${dateUtil.getDate(date_DateObj, "yyyy-M-d", locale)}</span>${dateUtil.getDate(date_DateObj, "dd MMM yyyy", locale)}</td>
    <td>

    <#if funding_status == "SelfFundedStudentsOnly">
    PGR Opportunity
    <#else>
    Funded Studentship
    </#if>

    </td>
    <td><@getMetadataField fieldName="tags" /></td>



    </#list>

    </tbody>
    </table>

    <#else>
    <div class="no-results">
    <p>There are no currently no Research Led Opportunities available here.</p>
    <p>There are currently no Research Led Opportunities here.</p>
    <a href="https://testwww.uea.ac.uk/pgrprojects" class="btn btn-primary">View all Research Led Opportunities</a>
    <a href="https://testwww.uea.ac.uk/" class="btn btn-primary">View all Applicant Led Opportunities</a>
    </div>
    #end
    </#if>

    <#macro getDiscussion>
    <#if validator.isNotNull(assetRenderer.getDiscussionPath()) && (enableComments == "true")>
    <br />

    <#assign discussionURL = renderResponse.createActionURL() />

    ${discussionURL.setParameter("struts_action", "/asset_publisher/" + assetRenderer.getDiscussionPath())}

    <@liferay_ui["discussion"]
    className=entry.getClassName()
    classPK=entry.getClassPK()
    formAction=discussionURL?string
    formName="fm" + entry.getClassPK()
    ratingsEnabled=enableCommentRatings == "true"
    redirect=portalUtil.getCurrentURL(request)
    userId=assetRenderer.getUserId()
    />
    </#if>
    </#macro>

    <#macro getEditIcon>
    <#if assetRenderer.hasEditPermission(themeDisplay.getPermissionChecker())>
    <#assign redirectURL = renderResponse.createRenderURL() />

    ${redirectURL.setParameter("struts_action", "/asset_publisher/add_asset_redirect")}
    ${redirectURL.setWindowState("pop_up")}

    <#assign editPortletURL = assetRenderer.getURLEdit(renderRequest, renderResponse, windowStateFactory.getWindowState("pop_up"), redirectURL)!"" />

    <#if validator.isNotNull(editPortletURL)>
    <#assign title = languageUtil.format(locale, "edit-x", entryTitle) />

    <@liferay_ui["icon"]
    image="edit"
    message=title
    url="javascript:Liferay.Util.openWindow({dialog: {width: 960}, id:'" + renderResponse.getNamespace() + "editAsset', title: '" + title + "', uri:'" + htmlUtil.escapeURL(editPortletURL.toString()) + "'});"
    />
    </#if>
    </#if>
    </#macro>

    <#macro getFlagsIcon>
    <#if enableFlags == "true">
    <@liferay_ui["flags"]
    className=entry.getClassName()
    classPK=entry.getClassPK()
    contentTitle=entry.getTitle(locale)
    label=false
    reportedUserId=entry.getUserId()
    />
    </#if>
    </#macro>

    <#macro getMetadataField
    fieldName
    >
    <#if stringUtil.split(metadataFields)?seq_contains(fieldName)>
    <span class="metadata-entry metadata-"${fieldName}">
    <#assign dateFormat = "dd MMM yyyy - HH:mm:ss" />

    <#if fieldName == "author">
    <@liferay.language key="by" /> ${portalUtil.getUserName(assetRenderer.getUserId(), assetRenderer.getUserName())}
    <#elseif fieldName == "categories">
    <@liferay_ui["asset-categories-summary"]
    className=entry.getClassName()
    classPK=entry.getClassPK()
    portletURL=renderResponse.createRenderURL()
    />
    <#elseif fieldName == "create-date">
    ${dateUtil.getDate(entry.getCreateDate(), dateFormat, locale)}
    <#elseif fieldName == "expiration-date">
    ${dateUtil.getDate(entry.getExpirationDate(), dateFormat, locale)}
    <#elseif fieldName == "modified-date">
    ${dateUtil.getDate(entry.getModifiedDate(), dateFormat, locale)}
    <#elseif fieldName == "priority">
    ${entry.getPriority()}
    <#elseif fieldName == "publish-date">
    ${dateUtil.getDate(entry.getPublishDate(), dateFormat, locale)}
    <#elseif fieldName == "tags">
    <@liferay_ui["asset-tags-summary"]
    className=entry.getClassName()
    classPK=entry.getClassPK()
    portletURL=renderResponse.createRenderURL()
    />
    <#elseif fieldName == "view-count">
    <@liferay_ui["icon"]
    image="history"
    />

    ${entry.getViewCount()} <@liferay.language key="views" />
    </#if>
    </span>
    </#if>
    </#macro>

    <#macro getPrintIcon>
    <#if enablePrint == "true" >
    <#assign printURL = renderResponse.createRenderURL() />

    ${printURL.setParameter("struts_action", "/asset_publisher/view_content")}
    ${printURL.setParameter("assetEntryId", entry.getEntryId()?string)}
    ${printURL.setParameter("viewMode", "print")}
    ${printURL.setParameter("type", entry.getAssetRendererFactory().getType())}

    <#if (validator.isNotNull(assetRenderer.getUrlTitle()))>
    <#if (assetRenderer.getGroupId() != themeDisplay.getScopeGroupId())>
    ${printURL.setParameter("groupId", assetRenderer.getGroupId()?string)}
    </#if>

    ${printURL.setParameter("urlTitle", assetRenderer.getUrlTitle())}
    </#if>

    ${printURL.setWindowState("pop_up")}

    <@liferay_ui["icon"]
    image="print"
    message="print"
    url="javascript:Liferay.Util.openWindow({id:'" + renderResponse.getNamespace() + "printAsset', title: '" + languageUtil.format(locale, "print-x-x", ["hide-accessible", entryTitle]) + "', uri: '" + htmlUtil.escapeURL(printURL.toString()) + "'});"
    />
    </#if>
    </#macro>

    <#macro getRatings>
    <#if (enableRatings == "true")>
    <div class="asset-ratings">
    <@liferay_ui["ratings"]
    className=entry.getClassName()
    classPK=entry.getClassPK()
    />
    </div>
    </#if>
    </#macro>

    <#macro getRelatedAssets>
    <#if enableRelatedAssets == "true">
    <@liferay_ui["asset-links"]
    assetEntryId=entry.getEntryId()
    />
    </#if>
    </#macro>

    <#macro getSocialBookmarks>
    <#if enableSocialBookmarks == "true">
    <@liferay_ui["social-bookmarks"]
    displayStyle="${socialBookmarksDisplayStyle}"
    target="_blank"
    title=entry.getTitle(locale)
    url=viewURL
    />
    </#if>
    </#macro>


    <script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
    ##<script type="text/javascript" src="//cdn.datatables.net/plug-ins/be7019ee387/integration/bootstrap/3/dataTables.bootstrap.js"></script>

    <link rel="stylesheet" type="text/css" src="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css" />
    ##<link rel="stylesheet" type="text/css" src="//cdn.datatables.net/plug-ins/be7019ee387/integration/bootstrap/3/dataTables.bootstrap.css" />

    <script type="text/javascript">
    $(document).ready(function() {
    @@ -73,18 +254,22 @@ $(document).ready(function() {
    if (search_param === null){
    $('.pgrList').dataTable({
    "paging": false,
    "columns": [ { "width": "55%" },
    { "width": "29%", "orderable": false },
    { "width": "15%" } ]
    "columns": [ { "width": "45%" },
    { "width": "24%", "orderable": false },
    { "width": "15%", "searchable": false },
    { "width": "15%", "searchable": false, "orderable": false },
    { "visible": false} ],
    });
    }

    else{
    $('.pgrList').dataTable({
    "paging": false,
    "columns": [ { "width": "55%" },
    { "width": "29%", "orderable": false },
    { "width": "15%" } ],
    "columns": [ { "width": "45%" },
    { "width": "24%", "orderable": false },
    { "width": "15%", "searchable": false },
    { "width": "15%", "searchable": false, "orderable": false },
    { "visible": false} ],
    "search": {"search": search_param }
    });
    }
    @@ -130,4 +315,9 @@ $(document).ready(function() {
    .aui table.dataTable thead .sorting_disabled {
    background: #00597f!important;
    }

    /*basic styles*/
    .portlet-boundary_101_{margin: 0;}
    .aui .table thead th{vertical-align: middle;}

    </style>
  5. andyxmas created this gist Jul 15, 2014.
    133 changes: 133 additions & 0 deletions pgr-projects-adt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,133 @@
    #if (!$entries.isEmpty())

    <table class="pgrList table table-striped table-bordered table-hover">
    <thead>
    <tr>
    <th>Opportunity Title</th>
    <th>Primary Supervisor</th>
    <th>Application Deadline</th>
    </tr>
    </thead>
    <tbody>
    #foreach ($curEntry in $entries)
    #set($renderer = $curEntry.getAssetRenderer() )
    #set($className = $renderer.getClassName() )

    #if( $className == "com.liferay.portlet.journal.model.JournalArticle" )
    #set( $journalArticle = $renderer.getArticle() )
    #set( $document = $saxReaderUtil.read($journalArticle.getContent()) )
    #set( $rootElement = $document.getRootElement() )

    #foreach( $dynamicElement in $rootElement.elements() )
    #if( "supervisor_name" == $dynamicElement.attributeValue("name") )
    #set( $primarySupervisor = $dynamicElement.element("dynamic-content").getText() )
    #end
    #if( "deadline" == $dynamicElement.attributeValue("name") )
    #set( $deadline = $dynamicElement.element("dynamic-content").getData() )
    #set( $date_DateObj = $dateUtil.newDate($getterUtil.getLong($deadline)))
    #end
    #end
    #end

    <tr class="pgritem">
    <td class="pgrTitle"><a href='$assetPublisherHelper.getAssetViewURL($renderRequest, $renderResponse, $curEntry)'>$curEntry.getTitle($locale)</a></td>
    <td class="primarySupervisor">$primarySupervisor</td>
    <td class="deadline"><span class="hidden">$dateUtil.getDate($date_DateObj, "yyyy-M-d", $locale)</span>$dateUtil.getDate($date_DateObj, "dd MMM yyyy", $locale)</td>
    </tr>

    #end
    </tbody>
    </table>

    #else
    <div class="no-results">
    <p>There are no currently no Research Led Opportunities available here.</p>
    <a href="https://testwww.uea.ac.uk/pgrprojects" class="btn btn-primary">View all Research Led Opportunities</a>
    <a href="https://testwww.uea.ac.uk/" class="btn btn-primary">View all Applicant Led Opportunities</a>
    </div>
    #end

    <script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
    ##<script type="text/javascript" src="//cdn.datatables.net/plug-ins/be7019ee387/integration/bootstrap/3/dataTables.bootstrap.js"></script>

    <link rel="stylesheet" type="text/css" src="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css" />
    ##<link rel="stylesheet" type="text/css" src="//cdn.datatables.net/plug-ins/be7019ee387/integration/bootstrap/3/dataTables.bootstrap.css" />

    <script type="text/javascript">
    $(document).ready(function() {
    function gup( name )
    {
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
    return null;
    else
    return results[1];
    };

    var search_param = gup( 'courseSearchString' );

    if (search_param === null){
    $('.pgrList').dataTable({
    "paging": false,
    "columns": [ { "width": "55%" },
    { "width": "29%", "orderable": false },
    { "width": "15%" } ]
    });
    }

    else{
    $('.pgrList').dataTable({
    "paging": false,
    "columns": [ { "width": "55%" },
    { "width": "29%", "orderable": false },
    { "width": "15%" } ],
    "search": {"search": search_param }
    });
    }

    /*add bootstrap classes*/
    $('#DataTables_Table_0_filter input').addClass('input-medium search-query');

    } );
    </script>

    <style type="text/css">
    .dataTables_filter{padding-left: 8px;}
    .aui .dataTables_filter input {margin: 10px;}
    .aui .dataTables_filter label {margin-bottom: 0;}
    .aui table.dataTable{margin-bottom:0;}
    .aui div.dataTables_info {margin: 10px 0 10px 8px;}
    .no-results{padding:10px;}

    /*Styles copied from http://cdn.datatables.net/1.10.0/css/jquery.dataTables.css and edited to override uea stlyes*/
    .aui table.dataTable thead .sorting_asc,
    .aui table.dataTable thead .sorting_desc,
    .aui table.dataTable thead .sorting {
    cursor: pointer;
    *cursor: hand;
    padding-right:15px!important;
    }
    .aui table.dataTable thead .sorting {
    background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_both.png") no-repeat center right!important;
    }
    .aui table.dataTable thead .sorting_asc {
    background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_asc.png") no-repeat center right!important;
    }
    .aui table.dataTable thead .sorting_desc {
    background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_desc.png") no-repeat center right!important;
    }
    .aui table.dataTable thead .sorting_asc_disabled {
    background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_asc_disabled.png") no-repeat center right!important;
    }
    .aui table.dataTable thead .sorting_desc_disabled {
    background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_desc_disabled.png") no-repeat center right!important;
    }

    .aui table.dataTable thead .sorting_disabled {
    background: #00597f!important;
    }
    </style>