$(document) .ready( function() { if ($('.listelement .element').find('.dispnone').length >= 1) { $('.listelement .element') .find('.dispnone') .parent() .find('.title') .css('cursor', 'pointer') .prepend( " ") .data('toggle', '0'); $('.listelement .title').click( function() { $(this).siblings('.dispnone').toggle(); if ($(this).data('toggle') == '0') { $(this).data('toggle', '1'); $(this).find('.toggler img').attr( 'src', '/media/img/down.png') } else { $(this).data('toggle', '0'); $(this).find('.toggler img').attr( 'src', '/media/img/right.png') } }); } $('.helpericon').click( function() { $('.infobox').slideToggle('fast'); if ($(this).data('info') == '1') { $(this).data('info', '0').attr('src', '/media/img/bulb_off.png'); } else { $(this).data('info', '1').attr('src', '/media/img/bulb_on.png'); } }); path = window.location.pathname.split('/'); if (path[2] == 'person' && (path[3] == 'owndetails' || path[3] == 'edit' || path[3] == 'request') && path[4] != 'personID') { mypath = '/' + path[1] + '/' + path[2] + '/owndetails'; } else if (path[2] == 'group' && (path[3] == 'show' || path[3] == 'edit') && path[4] != 'groupID') { mypath = '/' + path[1] + '/' + path[2] + '/show'; } else { mypath = '/' + path[1] + '/' + path[2]; } $('.portletNavigationTree a').each(function() { if ($(this).attr('href') == mypath) { /* console.log($(this).parent()); */ $(this).addClass('navTreeCurrentNode'); $(this).addClass('navTreeCurrentItem'); } }); }); function setElementVisible(name) { $('#' + name).show(); } function setElementInvisible(name) { $('#' + name).hide(); } function setElementAttribute(name, attributeName, attributeValue) { $('#' + name).attr(attributeName, attributeValue); } function removeElementAttribute(name, attributeName) { $('#' + name).removeAttr(attributeName); } function getElementAttribute(name, attributeName) { return $('#' + name).attr(attributeName); } function getElementValue(name) { return $('#' + name).val(); } function disableElement(name) { setElementAttribute(name, 'disabled', 'disabled'); } function enableElement(name) { removeElementAttribute(name, 'disabled'); } function repeatChanged(name) { if (getElementAttribute(name, 'checked')) { setElementVisible("repeatEnd-label"); setElementVisible("repeatEnd-element"); enableElement('repeatEnd'); } else { setElementInvisible("repeatEnd-label"); setElementInvisible("repeatEnd-element"); disableElement('repeatEnd'); } } function eventcategoryfieldChanged(name) { option = $('#' + name + ' option[value="' + getElementValue(name) + '"]'); label = option.attr('label'); startLabel = $('#start-label'); if (label == 'Boot' || label == 'Shutdown') { setElementInvisible("end-label"); setElementInvisible("end-element"); disableElement('end'); removeElementAttribute('repeat', 'checked'); startLabel.children().text('Date (mm/dd/yyyy H:min):'); } else if (label == 'Lecture') { setElementVisible("end-label"); setElementVisible("end-element"); enableElement('end'); setElementAttribute('repeat', 'checked', 'checked'); startLabel.children().text('Start (mm/dd/yyyy H:min):'); } else { setElementVisible("end-label"); setElementVisible("end-element"); enableElement('end'); removeElementAttribute('repeat', 'checked'); startLabel.children().text('Start (mm/dd/yyyy H:min):'); } repeatChanged('repeat'); }