if(uicomponent.isNewMode()){
    cancelLink=uicomponent.getCurrentPageURL();
 }else if(uicomponent.isEditTemplate()){
    cancelLink= "javascript:eXo.wiki.UIWikiAjaxRequest.makeNewHash('#SpaceSetting');"
 }else{
   cancelLink="javascript:eXo.wiki.UIWikiAjaxRequest.makeNewHash('#');";
}