Skip to content

Instantly share code, notes, and snippets.

@bradrice
bradrice / setsession.vtl
Created August 23, 2011 19:06
Set session in dotcms
#set($ses = $request.getSession(true))
#set($item = $request.getParameter('courseid'))
#set($_dummy = $ses.setMaxInactiveInterval(1800))
#set($myCookie = $request.getCookies())
#foreach($cookie in $myCookie)
#if($cookie.getName().equals("JSESSIONID"))
#set($ck = $cookie)
#set($_dummy = $ck.setMaxAge(1800))
#end
#end
@bradrice
bradrice / cookie.js
Created August 23, 2011 19:49
Set, get and delete a cookie
@bradrice
bradrice / ie8 ggs fix
Created February 20, 2012 16:12
Adding two columns for IE8 GoldenGridSystem
.ie #twoway section.wrapper {
width: 49%;
float: left;
}
@bradrice
bradrice / ua_cool_slide_widget.vtl
Created March 16, 2012 12:12
UA Cool Slide Player widget
#foreach($inode in $category)
#if($velocityCount == 1)
#set($catlist = "+c${inode}c:on")
#else
#set($catlist = "$catlist +c${inode}c:on")
#end
#end
#set($mySlides = $dotcontent.pull("+structureInode:9651b909-b784-4867-bfb8-03049e6269f1 +live:true +deleted:false $catlist", "0", "weightedOrder asc"))
<div class="clear"></div>
<div id="outer_wrap" style="margin-top: 20px;">
@bradrice
bradrice / proxy_pull.php
Created March 16, 2012 12:13
PHP ajax proxy code
<?php
$ch = curl_init($sub_req_url);
$encoded = '';
// include GET as well as POST variables; your needs may vary.
foreach($_GET as $name => $value) {
$encoded .= urlencode($name).'='.urlencode($value).'&';
}
foreach($_POST as $name => $value) {
$encoded .= urlencode($name).'='.urlencode($value).'&';
}
@bradrice
bradrice / ua_cool_detail.vtl
Created March 16, 2012 14:56
UA cool detail ajax page
#set($id = $request.getParameter('coolid'))
#if($UtilMethods.isSet( $request.getParameter('captionPosition')))
#set($captionPosition = $request.getParameter('captionPosition'))
#end
##if($UtilMethods.isSet($request.getParameter('displayCaption')))
#set($displayCaption = $request.getParameter('displayCaption'))
##end
#set($content = $dotcontent.find($id))
#if($captionPosition == "1")
<div class="content" style="height: 300px;">
@bradrice
bradrice / dotcms_get_categories
Created March 23, 2012 18:43
Get Categories
#foreach($inode in $staffAssociation)
#if($velocityCount == 1)
#set($catlist = $categories.getCategoryByInode($inode).getCategoryVelocityVarName())
#else
#set($catlist = "$catlist $categories.getCategoryByInode($inode).getCategoryVelocityVarName()")
#end
#end
@bradrice
bradrice / json_virt_tour.json
Created July 6, 2012 14:06
json for virtual tour
{
"1": {
"id": "5e07e124-fd2f-4d36-b251-0552d1eced57",
"urlmap": "simmons_hall"
},
"2": {
"id": "5e07e124-fd2f-4d36-b251-0552d1eced345",
"urlmap": "student_union"
}
}
@bradrice
bradrice / vel-js.html
Created July 6, 2012 16:30
Velocity to make json
<script type="text/javascript">
#set($left_b = "{")
#set($right_b = "}")
#set($colon = ":")
#set($comma = ",")
#set($ar_size = $my_id_array.size())
#foreach($item in $my_id_array)
#set($a_i = "${quote}$item.cnt${quote}${colon}${left_b}${quote}id${quote}${colon}${quote}${item.id}${quote}${comma}${quote}urlmap${quote}${colon}${quote}${item.urlmap}${quote}${right_b}#if($velocityCount<$ar_size)${comma}#end")
#if($velocityCount == 1)
#set($my_json = "$a_i")
@bradrice
bradrice / select2_curriculumGuide
Created September 25, 2012 14:37
Select 2 dropdown
function build_course_dept_dds(thisCourseCell)
{
selector = (!thisCourseCell)?$('.thisCourseDept'):$('.thisCourseDept',thisCourseCell);
//console.log('build_course_dept_dds');
selector.select2(
{
data:thisCourseDeptData,
placeholder: 'Select Department/Track'
}).bind('change',function(){