Commit cb489d64 authored by Sandeep Kadam's avatar Sandeep Kadam
Browse files

Merge branch 'rt_v5_fix' into 'master'

UI fixes for RT-v5 release

See merge request !3
parents 8ebb271d d17219cb
......@@ -5,7 +5,7 @@
// @match https://helpdesk.ebi.ac.uk/*
// @include https://helpdesk.ebi.ac.uk/*
// @grant GM_xmlhttpRequest
// @version 2.7.3
// @version 2.7.4
// @updateURL https://gitlab.ebi.ac.uk/ebiwd/rthelper/raw/stable/rthelper.user.js
// @downloadURL https://gitlab.ebi.ac.uk/ebiwd/rthelper/raw/stable/rthelper.user.js
// @supportURL https://gitlab.ebi.ac.uk/ebiwd/rthelper/issues
......@@ -119,7 +119,9 @@ function getUserId() {
* @return String, eg "17774"
*/
function getTicketId() {
return getElementText('div.ticket-info-basics tr.id td.value').split('\n',1)[0];
var raw_value = getElementText('div.ticket-info-basics div.id div.value').split('\n',1)[0];
var ticket_id = raw_value.replace(/<\/?span[^>]*>/g,"");
return ticket_id;
}
/**
......@@ -139,7 +141,7 @@ function getName(full) {
* @return String, eg "Web Development"
*/
function getQueue() {
return getElementText('div.ticket-info-basics tr.queue td.value').split('\n')[0];
return getElementText('div.ticket-info-basics div.queue div.value').split('\n')[0];
}
/**
......@@ -147,7 +149,7 @@ function getQueue() {
* @return String, eg
*/
function getOwner() {
var owner=getElementText('div.ticket-info-people tr td.value', 'text').split('\n')[0];
var owner=getElementText('div.ticket-info-people div.value', 'text').split('\n')[0];
if (owner.indexOf('(') !== -1) {
owner=/\((.*)\)/gi.exec(owner)[1];
}
......@@ -159,7 +161,7 @@ function getOwner() {
* @return String
*/
function getCustomField(id) {
return getElementText('div.ticket-info-cfs tr#CF-' + id + '-ShowRow td.value', 'text').split('\n',1)[0];
return getElementText('div.ticket-info-cfs div.custom-field div#CF-' + id + '-ShowRow div.value', 'text').split('\n',1)[0];
}
/**
......@@ -167,7 +169,7 @@ function getCustomField(id) {
* @return String, eg "Open", "Resolved"
*/
function getStatus() {
return getElementText('div.ticket-info-basics tr.status td.value').split('\n',1)[0];
return getElementText('div.ticket-info-basics div.status div.value').split('\n',1)[0];
}
/**
......@@ -278,13 +280,13 @@ function insertLink(container, text, link, prefix, suffix, breakBefore) {
function buildLink(url, done) {
return (
'javascript:(' +
'function(){' +
'jQuery.ajax({' +
'url:\'' + url + '\',' +
'cache:false,' +
'complete:' + done +
'});' +
'}' +
'function(){' +
'jQuery.ajax({' +
'url:\'' + url + '\',' +
'cache:false,' +
'complete:' + done +
'});' +
'}' +
')();'
);
}
......@@ -296,7 +298,7 @@ function buildLink(url, done) {
function refreshElement() {
return (
'function(){' +
'location.reload();' +
'location.reload();' +
'}'
);
}
......@@ -326,6 +328,7 @@ function getStatuses() {
function getCustomFields(cfId) {
var oldValue = '';
// get new values of customField every 5 min
if (getValue('customFields-' + cfId + '-timestamp', 0) < (new Date().getTime()/1000 - 5*60)) {
// refresh list of customFields
......@@ -484,7 +487,7 @@ function init() {
var currentQueue = getQueue();
var queues = getQueues();
var queue;
container = document.querySelector('div.ticket-info-basics tr.queue td.value');
container = document.querySelector('div.ticket-info-basics div.queue div.value');
if (!container) {
return;
}
......@@ -516,7 +519,7 @@ function init() {
var currentStatus = getStatus();
var statuses = getStatuses();
var status;
container = document.querySelector('div.ticket-info-basics tr.status td.value');
container = document.querySelector('div.ticket-info-basics div.status div.value');
if (!container) {
return;
}
......@@ -550,7 +553,7 @@ function init() {
var owner;
var button;
var firstname;
container = document.querySelector('div.ticket-info-people table tr td.value');
container = document.querySelector('div.ticket-info-people div.value');
if (!container) {
return;
}
......@@ -581,7 +584,7 @@ function init() {
return;
}
var customFields = document.querySelectorAll('.ticket-info-cfs tr');
var customFields = document.querySelectorAll('div.ticket-info-cfs div.custom-field');
for (var customField in customFields) {
if (customFields[customField].id) {
......@@ -590,7 +593,7 @@ function init() {
var params = {};
var customFieldValues = getCustomFields(customFieldId);
var customFieldValue;
container = document.querySelector('div.ticket-info-cfs tr#CF-' + customFieldId + '-ShowRow td.value');
container = document.querySelector('div#CF-' + customFieldId + '-ShowRow div.value');
if (!container) {
return;
}
......@@ -622,16 +625,14 @@ function init() {
})();
(function hideCurrentSelection() {
var active = document.querySelectorAll('td .rthelper-active');
var active = document.querySelectorAll('div .rthelper-active');
var i;
for (i=0; i<active.length; i++) {
active[i].parentNode.className += ' hide-first-line';
}
var hides = document.querySelectorAll('.hide-first-line');
for (i=0; i<hides.length; i++) {
// hides[i].innerHTML = hides[i].innerHTML.replace(/^.*\s*<br>\s*<a/, '<a');
}
})();
// add quick link to add cc
......@@ -682,7 +683,7 @@ function init() {
}
for (var type in types) { // change to i<=3 to include AdminCc
container = document.querySelectorAll('div.ticket-info-people tr td.value')[types[type]];
container = document.querySelectorAll('div.ticket-info-people div.value')[types[type]];
if (!container) {
return;
}
......@@ -770,10 +771,10 @@ function init() {
container,
'Report Spam',
"javascript:(function(){" +
"links=document.querySelectorAll('.actions .forward-link');fw=window.open(links[links.length-1].href+'&To=is-spam@labs.sophos.com&Cc=rt-spam@ebi.ac.uk&Content=Reporting+as+spam&Click=Forward','_blank');wait=setInterval(function(){if(fw.document.location.pathname=='/Ticket/Forward.html'&&fw.document.location.search==''){" +
"clearInterval(wait);fw.close();" +
"mod=document.querySelector('a#page-basics').href;jQuery.ajax({url:mod+'&Status=deleted',cache:false,complete:function(){location.reload();}})" +
"}},1000);" +
"links=document.querySelectorAll('.actions .forward-link');fw=window.open(links[links.length-1].href+'&To=is-spam@labs.sophos.com&Cc=rt-spam@ebi.ac.uk&Content=Reporting+as+spam&Click=Forward','_blank');wait=setInterval(function(){if(fw.document.location.pathname=='/Ticket/Forward.html'&&fw.document.location.search==''){" +
"clearInterval(wait);fw.close();" +
"mod=document.querySelector('a#page-basics').href;jQuery.ajax({url:mod+'&Status=deleted',cache:false,complete:function(){location.reload();}})" +
"}},1000);" +
"})()"
);
})();
......@@ -841,7 +842,7 @@ function init() {
}
// get fresh set of quicksearches every time we visit homepage
if (document.location.pathname === info.path + '/' && document.querySelector('table.myrt')) {
if (document.location.pathname === info.path + '/' && document.querySelector('.myrt')) {
quickSearch = '';
links = document.querySelectorAll('.titlebox .left a');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment