Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,52 @@ | ||
jQuery(document).ready(function($) { | ||
|
||
//get User info | ||
function saveUser(id, entry, ajaxURL){ | ||
$.ajax({ | ||
method: 'GET', | ||
url: ajaxURL, | ||
data: { | ||
id: id, | ||
entry: parseInt(entry) | ||
} | ||
}) | ||
} | ||
|
||
//get info | ||
id = parseInt($('#session li').eq(0).find('a').attr('href').match(/\/([^\/]+)\/?$/)[1]); | ||
name = $('#session li').eq(0).find('a').text(); | ||
// name = $('#session li').eq(0).find('a').text(); | ||
entry = document.URL.match(/\/([^\/]+)\/?$/)[1]; | ||
ajaxURL = Symphony.Context.get('symphony') + '/extension/multi_user_edit/multi_user/'; | ||
|
||
|
||
//send User info | ||
console.log('test'); | ||
|
||
var ajaxURL = Symphony.Context.get('symphony') + '/extension/multi_user_edit/multi_user/'; | ||
|
||
//Check if the entry is being used by another author | ||
$.ajax({ | ||
method: 'GET', | ||
url: ajaxURL, | ||
data: { | ||
id: id, | ||
name: name, | ||
entry: parseInt(entry) | ||
}, | ||
success: function(response){ | ||
response = $(response); | ||
if(response.hasClass('locked')){ | ||
//if locked, get difference in minutes | ||
$diff = response.find('#diff').text(); | ||
if($diff > 5){ | ||
//Gain access to the article as author is taking too long. | ||
console.log('Exceeded 5 minutes; Updated log.') | ||
saveUser(id, entry, ajaxURL); | ||
} | ||
else{ | ||
console.log(response.find('.show').text()); | ||
console.log((5 - $diff).toFixed(2) + ' minute/s to go.'); | ||
} | ||
} | ||
else{ | ||
//Save User info | ||
saveUser(id, entry, ajaxURL); | ||
} | ||
} | ||
}).done(function(response){ // after the request has been loaded... | ||
$('#results').html(response); // put the response in the div | ||
}).done(function(response){ | ||
//code.. | ||
}); | ||
|
||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters