* Copyright 2010, Antoine Mercadal - Capgemini
* Copyright 2010-2011, Franck Villaume - Capgemini
* Copyright 2011, Alain Peyrat
- * Copyright 2011-2016, Franck Villaume - TrivialDev
+ * Copyright 2011-2017,2021, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
/*! ListFileController
* @param groupId the current FusionForge groupID
*/
-DocManListFileController = function(params)
+var DocManListFileController = function(params)
{
this.lockInterval = [];
this.listfileparams = params;
this.initModelNotifyWindow();
};
-DocManAddItemController = function(params)
+var DocManAddItemController = function(params)
{
this.additemparams = params;
this.bindControls();
};
-DocManAddFileController = function(params)
+var DocManAddFileController = function(params)
{
this.addfileparams = params;
this.bindControls();
};
-DocManSearchController = function(params)
+var DocManSearchController = function(params)
{
this.searchparams = params;
this.bindControls();
resizableDiv: function() {
var splitterPosition = '30%';
var mainwidth = jQuery('#maindiv').innerWidth();
+ var mainheight;
if (jQuery.Storage.get('splitterStyle') !== undefined) {
var storedSplitterPosition = jQuery.Storage.get('splitterStyle').replace(/px;?/g, '').replace(/left: /g, '');
splitterPosition = Math.round(storedSplitterPosition * 100 / mainwidth )+'%';
(this.listfileparams.divLeft.outerHeight() > this.listfileparams.divRight.outerHeight()) ? mainheight = this.listfileparams.divLeft.outerHeight() : mainheight = this.listfileparams.divRight.outerHeight();
} else {
var fixwidth = -40;
+ var useRightHeight;
if (jQuery('#editFile').length >= 1) {
fixwidth += jQuery('#editFile').outerHeight() - jQuery('[aria-describedby="editFile"]').outerHeight();
}
});
totalRightHeight -= fixwidth;
(this.listfileparams.divRight.outerHeight() - fixwidth < 0) ? useRightHeight = this.listfileparams.divRight.outerHeight() : useRightHeight = this.listfileparams.divRight.outerHeight() - fixwidth;
- (useRightHeight < totalRightHeight) ? useRightHeight = totalRightHeight : useRightHeight ;
+ if (useRightHeight < totalRightHeight) {
+ useRightHeight = totalRightHeight;
+ }
(this.listfileparams.divLeft.outerHeight() + 30 > this.listfileparams.divRight.outerHeight()) ? mainheight = this.listfileparams.divLeft.outerHeight() + 30 : mainheight = useRightHeight;
}
jQuery('#views').height(mainheight)
initModalEditWindow: function() {
var modalId = this.listfileparams.divEditFile;
+ this.listfileparams.nocache = new Date().getTime();
jQuery(modalId).dialog({
autoOpen: false,
width: 1000,
lock: 0,
itemid: id,
type: 'file',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
jQuery.get(this.listfileparams.docManURL+'/', {
group_id: this.listfileparams.groupId,
lock: 0,
itemid: this.listfileparams.docgroupId,
type: 'dir',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
clearInterval(this.lockInterval[id]);
clearInterval(this.lockInterval[this.listfileparams.docgroupId]);
lock: 0,
itemid: id,
type: 'file',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
jQuery.get(this.listfileparams.docManURL+'/', {
group_id: this.listfileparams.groupId,
lock: 0,
itemid: this.listfileparams.docgroupId,
type: 'dir',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
clearInterval(this.lockInterval[id]);
clearInterval(this.lockInterval[this.listfileparams.docgroupId]);
lock: 0,
itemid: id,
type: 'file',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
jQuery.get(this.listfileparams.docManURL+'/', {
group_id: this.listfileparams.groupId,
lock: 0,
itemid: this.listfileparams.docgroupId,
type: 'dir',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
clearInterval(this.lockInterval[id]);
clearInterval(this.lockInterval[this.listfileparams.docgroupId]);
+ jQuery('#editfile-userstatusreview').remove();
+ jQuery('#editfile-completedreview').remove();
+ jQuery('#editfile-datepickerreview-script').remove();
+ jQuery('#editfile-commentreview').remove();
}, this));
},
initModelNotifyWindow: function() {
var modalId = this.listfileparams.divNotifyUsers;
+ this.listfileparams.nocache = new Date().getTime();
jQuery(modalId).dialog({
autoOpen: false,
width: 600,
lock: 0,
itemid: id,
type: 'file',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
jQuery.get(this.listfileparams.docManURL+'/', {
group_id: this.listfileparams.groupId,
lock: 0,
itemid: this.listfileparams.docgroupId,
type: 'dir',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
clearInterval(this.lockInterval[id]);
clearInterval(this.lockInterval[this.listfileparams.docgroupId]);
lock: 0,
itemid: id,
type: 'file',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
jQuery.get(this.listfileparams.docManURL+'/', {
group_id: this.listfileparams.groupId,
lock: 0,
itemid: this.listfileparams.docgroupId,
type: 'dir',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
clearInterval(this.lockInterval[id]);
clearInterval(this.lockInterval[this.listfileparams.docgroupId]);
lock: 0,
itemid: id,
type: 'file',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
jQuery.get(this.listfileparams.docManURL+'/', {
group_id: this.listfileparams.groupId,
lock: 0,
itemid: this.listfileparams.docgroupId,
type: 'dir',
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
clearInterval(this.lockInterval[id]);
clearInterval(this.lockInterval[this.listfileparams.docgroupId]);
/*! toggle edit group view div visibility
*/
toggleEditDirectoryView: function() {
+ this.listfileparams.nocache = new Date().getTime();
+ var computeHeight;
+ var currentLeftHeight;
if (!this.listfileparams.divEditDirectory.is(":visible")) {
- jQuery.getJSON(this.listfileparams.docManURL + '/?group_id='+this.listfileparams.groupId+'&action=lock&json=1&type=dir&itemid='+this.listfileparams.docgroupId+'&childgroup_id='+this.listfileparams.childGroupId, jQuery.proxy(function(data){
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id='+this.listfileparams.groupId+'&action=lock&json=1&type=dir&itemid='+this.listfileparams.docgroupId+'&childgroup_id='+this.listfileparams.childGroupId+'&rqd='+this.listfileparams.nocache, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#maindiv > .feedback').remove();
jQuery('#maindiv > .error').remove();
lock: 1,
type: 'dir',
itemid: this.listfileparams.docgroupId,
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
- this.lockInterval[this.listfileparams.docgroupId] = setInterval("jQuery.get('" + this.listfileparams.docManURL + "/', {group_id:"+this.listfileparams.groupId+", action:'lock', lock:1, type:'dir', itemid:"+this.listfileparams.docgroupId+", childgroup_id:"+this.listfileparams.childGroupId+"})", this.listfileparams.lockIntervalDelay);
+ this.lockInterval[this.listfileparams.docgroupId] = setInterval("jQuery.get('" + this.listfileparams.docManURL + "/', {group_id:"+this.listfileparams.groupId+", action:'lock', lock:1, type:'dir', itemid:"+this.listfileparams.docgroupId+", childgroup_id:"+this.listfileparams.childGroupId+", rqd:"+this.listfileparams.nocache+"})", this.listfileparams.lockIntervalDelay);
if (typeof(this.listfileparams.divLeft) != 'undefined' && typeof(this.listfileparams.divRight) != 'undefined') {
if (this.listfileparams.divLeft.outerHeight() > computeHeight) {
jQuery('#views').height(this.listfileparams.divLeft.outerHeight());
}
}
}
- }, this));
+ }, this)).fail(function(jqXHR, textStatus, errorThrown) {
+ let error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#maindiv').prepend(error_msg);
+ });
} else {
this.listfileparams.divEditDirectory.hide();
computeHeight = this.listfileparams.divRight.outerHeight() - this.listfileparams.divEditDirectory.outerHeight();
lock: 0,
type: 'dir',
itemid: this.listfileparams.docgroupId,
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
clearInterval(this.lockInterval[this.listfileparams.docgroupId]);
if (typeof(this.listfileparams.divLeft) != 'undefined' && typeof(this.listfileparams.divRight) != 'undefined') {
/*! toggle add item view div visibility
*/
toggleAddItemView: function() {
+ this.listfileparams.nocache = new Date().getTime();
+ var computeHeight;
+ var currentLeftHeight;
if (!this.listfileparams.divAddItem.is(":visible")) {
- jQuery.getJSON(this.listfileparams.docManURL + '/?group_id='+this.listfileparams.groupId+'&action=lock&json=1&type=dir&itemid='+this.listfileparams.docgroupId+'&childgroup_id='+this.listfileparams.childGroupId, jQuery.proxy(function(data){
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id='+this.listfileparams.groupId+'&action=lock&json=1&type=dir&itemid='+this.listfileparams.docgroupId+'&childgroup_id='+this.listfileparams.childGroupId+'&rqd='+this.listfileparams.nocache, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#maindiv > .feedback').remove();
jQuery('#maindiv > .error').remove();
itemid: this.listfileparams.docgroupId,
childgroup_id: this.listfileparams.childGroupId
});
- this.lockInterval[this.listfileparams.docgroupId] = setInterval("jQuery.get('"+this.listfileparams.docManURL+"/', {group_id:"+this.listfileparams.groupId+", action:'lock', lock:1, type:'dir', itemid:"+this.listfileparams.docgroupId+", childgroup_id:"+this.listfileparams.childGroupId+"})", this.listfileparams.lockIntervalDelay);
+ this.lockInterval[this.listfileparams.docgroupId] = setInterval("jQuery.get('"+this.listfileparams.docManURL+"/', {group_id:"+this.listfileparams.groupId+", action:'lock', lock:1, type:'dir', itemid:"+this.listfileparams.docgroupId+", childgroup_id:"+this.listfileparams.childGroupId+", rqd:"+this.listfileparams.nocache+"})", this.listfileparams.lockIntervalDelay);
this.listfileparams.divAddItem.show();
this.listfileparams.divEditDirectory.hide();
computeHeight = this.listfileparams.divRight.outerHeight() + jQuery(this.listfileparams.divAddItem).outerHeight();
}
}
}
- }, this));
+ }, this)).fail(function(jqXHR, textStatus, errorThrown) {
+ let error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#maindiv').prepend(error_msg);
+ });
} else {
jQuery.get(this.listfileparams.docManURL+'/', {
group_id: this.listfileparams.groupId,
lock: 0,
type: 'dir',
itemid: this.listfileparams.docgroupId,
- childgroup_id: this.listfileparams.childGroupId
+ childgroup_id: this.listfileparams.childGroupId,
+ rqd: this.listfileparams.nocache
});
clearInterval(this.lockInterval[this.listfileparams.docgroupId]);
this.listfileparams.divAddItem.hide();
this.docparams = params;
this.listfileparams.tableAddVersion.hide();
jQuery('#doc_group').empty();
- for (var i = 0; i < this.docparams.docgroupDict.length; i++) {
- jQuery('#doc_group').append(jQuery('<option>').text(this.docparams.docgroupDict[i][1]).attr('value', this.docparams.docgroupDict[i][0]));
- };
+ jQuery('#editfile-userstatusreview').empty();
+ jQuery('#editfile-completedreview').empty();
+ jQuery('#editfile-commentreview').empty();
+ for (let dictentry of this.docparams.docgroupDict) {
+ jQuery('#doc_group').append(jQuery('<option>').text(dictentry[1]).attr('value', dictentry[0]));
+ }
jQuery('#doc_group option[value='+this.docparams.docgroupId+']').attr('selected', 'selected');
jQuery('#stateid').empty();
jQuery.each(this.docparams.statusDict, function(key, value) {
if (this.listfileparams.childGroupId != 0) {
docid_groupid = this.listfileparams.childGroupId;
}
- jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + docid_groupid + '&action=getdocversions&docid='+ this.docparams.id, jQuery.proxy(function(data){
+ var nocache = new Date().getTime();
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + docid_groupid + '&action=getdocversions&docid='+ this.docparams.id+'&rqd='+nocache, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#editFile > .feedback').remove();
jQuery('#editFile > .error').remove();
jQuery('#sortable_doc_version_table > tbody').children().remove();
jQuery('#sortable_doc_version_table > tbody').css('max-height', '400px').css('overflow-y', 'auto').css('display', 'block');
jQuery('#sortable_doc_version_table > thead > tr').css('display', 'block');
- eachdocparams = this.docparams;
- jQuery.each(data, function (i, val) {
+ let eachdocparams = this.docparams;
+ jQuery.each(data, function (x, val) {
//_('ID (x)'), _('Filename'), _('Title'), _('Description'), _('Comment'), _('Author'), _('Last Time'), _('Size'), _('Actions'));
- currenttdcontent = '';
+ let currenttdcontent = '';
if (val.current_version == 1) {
currenttdcontent += ' (x)';
}
+ let filenametdcontent;
if (eachdocparams.statusId != 2) {
filenametdcontent = jQuery('<a>'+val.filename+'</a>');
if (val.filetype == 'URL') {
} else {
filenametdcontent = jQuery('<span>'+val.filename+'</span>');
}
- versionactiontdcontent = '';
- versionActionsArrayLength = val.versionactions.length;
- for (var i = 0; i < versionActionsArrayLength; i++) {
+ let versionactiontdcontent = '';
+ let versionActionsArrayLength = val.versionactions.length;
+ for (let i = 0; i < versionActionsArrayLength; i++) {
versionactiontdcontent += val.versionactions[i];
}
// please sync with the editfile.php widths if you change it here.
- var htmlString = '<tr id="docversion'+val.version.substr(1)+'" ><td style="width: 60px">'+val.version.substr(1)+currenttdcontent+'</td><td style="width: 150px">'+filenametdcontent[0].outerHTML+'</td><td style="width: 150px">'+val.title+'</td><td style="width: 150px">'+val.description+'</td><td style="width: 110px">'+val.vcomment+'</td><td style="width: 100px">'+val.created_by_username+'</td><td style="width: 100px">'+val.lastdate+'</td><td style="width: 50px">'+val.filesize_readable+'</td><td style="width: 50px">'+versionactiontdcontent+'</td></tr>'
+ var htmlString = '<tr id="docversion'+val.version.substr(1)+'" ><td style="width: 60px">'+val.version.substr(1)+currenttdcontent+'</td><td style="width: 150px">'+filenametdcontent[0].outerHTML+'</td><td style="width: 150px">'+val.title+'</td><td style="width: 150px">'+val.new_description.replace(/\\n/g, '<br />')+'</td><td style="width: 110px">'+val.vcomment.replace(/\\n/g, '<br />')+'</td><td style="width: 100px">'+val.created_by_username+'</td><td style="width: 100px">'+val.lastdate+'</td><td style="width: 50px">'+val.filesize_readable+'</td><td style="width: 50px">'+versionactiontdcontent+'</td></tr>'
jQuery('#sortable_doc_version_table > tbody:last-child').append(htmlString);
});
}
- }, this));
+ }, this)).fail(function(jqXHR, textStatus, errorThrown) {
+ let error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#editFile').prepend(error_msg);
+ });
- jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + docid_groupid + '&action=getassociations&docid='+ this.docparams.id, jQuery.proxy(function(data){
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + docid_groupid + '&action=getassociations&docid='+ this.docparams.id+'&rqd='+nocache, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#tabbereditfile-association > .feedback').remove();
jQuery('#tabbereditfile-association > .error').remove();
if (typeof data.htmltab != 'undefined') {
jQuery('#associationtab').text(data.htmltab);
}
- }, this));
+ }, this)).fail(function(jqXHR, textStatus, errorThrown) {
+ error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#tabbereditfile-association').prepend(error_msg);
+ });
- jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + docid_groupid + '&action=getdocreviews&docid='+ this.docparams.id, jQuery.proxy(function(data){
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + docid_groupid + '&action=getdocreviews&docid='+ this.docparams.id+'&rqd='+nocache, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#tabbereditfile-review > .feedback').remove();
jQuery('#tabbereditfile-review > .error').remove();
}
jQuery('#review-select-mandatory-users').gentleSelect({columns: 3, itemWidth: 150});
jQuery('#review-select-optional-users').gentleSelect({columns: 3, itemWidth: 150});
- }, this));
+ }, this)).fail(function(jqXHR, textStatus, errorThrown) {
+ error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#tabbereditfile-association').prepend(error_msg);
+ });
jQuery('#editdocdata').attr('action', this.docparams.action);
lock: 1,
type: 'dir',
itemid: this.docparams.docgroupId,
- childgroup_id: this.docparams.childGroupId
+ childgroup_id: this.docparams.childGroupId,
+ rqd: nocache
});
- this.lockInterval[this.docparams.id] = setInterval("jQuery.get('" + this.docparams.docManURL + "/', {group_id:"+this.docparams.groupId+", action:'lock', lock:1, type:'file', itemid:"+this.docparams.id+", childgroup_id:"+this.docparams.childGroupId+"})", this.docparams.lockIntervalDelay);
- this.lockInterval[this.docparams.docgroupId] = setInterval("jQuery.get('" + this.docparams.docManURL + "/', {group_id:"+this.docparams.groupId+", action:'lock', lock:1, type: 'dir', itemid:"+this.docparams.docgroupId+", childgroup_id:"+this.docparams.childGroupId+"})", this.docparams.lockIntervalDelay);
+ this.lockInterval[this.docparams.id] = setInterval("jQuery.get('" + this.docparams.docManURL + "/', {group_id:"+this.docparams.groupId+", action:'lock', lock:1, type:'file', itemid:"+this.docparams.id+", childgroup_id:"+this.docparams.childGroupId+", rqd:"+nocache+"})", this.docparams.lockIntervalDelay);
+ this.lockInterval[this.docparams.docgroupId] = setInterval("jQuery.get('" + this.docparams.docManURL + "/', {group_id:"+this.docparams.groupId+", action:'lock', lock:1, type: 'dir', itemid:"+this.docparams.docgroupId+", childgroup_id:"+this.docparams.childGroupId+", rqd:"+nocache+"})", this.docparams.lockIntervalDelay);
jQuery('#tabbereditfile').tabs("option", "active", 0);
this.setRequiredInputs(jQuery('#versiontab'));
jQuery(this.listfileparams.divEditFile).dialog('option', 'title', '[D'+this.docparams.id+'] '+this.listfileparams.divEditTitle).dialog('open');
},
toggleAddReviewView: function() {
+ jQuery('#review_newcomment').val(0);
jQuery('#review-title').val('');
jQuery('#review-description').val('');
+ jQuery('#review-notificationcomment').val('');
jQuery('#datepicker_end_review_date').val('');
jQuery('#review-serialid').val();
jQuery('[class^=gentle]').remove();
jQuery('#review-select-optional-users').gentleSelect({columns: 3, itemWidth: 150});
jQuery('#editfile-userstatusreview').empty();
jQuery('#editfile-completedreview').empty();
+ jQuery('#editfile-commentreview').empty();
+ jQuery('#editfile-remindernotification').hide();
+ jQuery('#review-remindernotification').val('');
if (jQuery('#editfile-createreview').is(':visible')) {
jQuery('#editfile-createreview').hide();
jQuery('#new_review').val(0);
} else {
jQuery('#new_review').val(1);
jQuery('#editfile-createreview').show();
+ jQuery('#review-notificationcomment-row').show();
}
},
toggleEditReviewView: function(params) {
this.review = params;
+ jQuery('#editfile-commentreview').empty();
+ jQuery('#review_newcomment').val(0);
+ jQuery('#editfile-remindernotification').hide();
+ jQuery('#review-remindernotification').val('');
if (jQuery('#editfile-createreview').is(':visible')) {
jQuery('#editfile-createreview').hide();
jQuery('#new_review').val(0);
} else {
jQuery('#review_id').val(this.review.review);
jQuery('#review-title').val(this.review.title);
- jQuery('#review-description').val(this.review.description);
+ jQuery('#review-description').val(this.review.description.replace(/\\n/g, String.fromCharCode(13,10)));
jQuery('#datepicker_end_review_date').val(this.review.endreviewdate);
jQuery('#review-serialid').val(this.review.serialid);
+ var nocache = new Date().getTime();
if (this.review.complete) {
jQuery('#tr-mandatory-reviewers').hide();
jQuery('#tr-optional-reviewers').hide();
jQuery('#review_complete').val(1);
- jQuery.getJSON(this.docparams.docManURL + '/?group_id=' + this.docparams.groupId + '&action=getdocreviewcompleteform&docid='+this.docparams.id+'&revid='+this.review.review , jQuery.proxy(function(data){
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + this.review.groupId + '&action=getdocreviewcompleteform&docid='+this.review.docid+'&revid='+this.review.review+'&rqd='+nocache, jQuery.proxy(function(data){
+ jQuery('#editfile-completedreview').empty();
if (typeof data.html != 'undefined') {
jQuery('#editfile-completedreview').prepend(data.html);
}
- }, this.review));
+ }, this.review)).fail(function(jqXHR, textStatus, errorThrown) {
+ error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#editfile-completedreview').prepend(error_msg);
+ });
} else {
jQuery('#tr-mandatory-reviewers').show();
jQuery('#tr-optional-reviewers').show();
jQuery('#review-select-mandatory-users').gentleSelect({columns: 3, itemWidth: 150});
jQuery('#review-select-optional-users').gentleSelect({columns: 3, itemWidth: 150});
}
- jQuery.getJSON(this.docparams.docManURL + '/?group_id=' + this.docparams.groupId + '&action=getdocreviewuserstatus&docid='+this.docparams.id+'&revid='+this.review.review , jQuery.proxy(function(data){
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + this.review.groupId + '&action=getdocreviewuserstatus&docid='+this.review.docid+'&revid='+this.review.review+'&rqd='+nocache, jQuery.proxy(function(data){
+ jQuery('#editfile-userstatusreview').empty();
if (typeof data.html != 'undefined') {
jQuery('#editfile-userstatusreview').prepend(data.html);
}
- }, this.review));
+ }, this.review)).fail(function(jqXHR, textStatus, errorThrown) {
+ error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#editfile-userstatusreview').prepend(error_msg);
+ });
jQuery('#new_review').val(0);
jQuery('#editfile-createreview').show();
+ jQuery('#review-notificationcomment-row').hide();
}
},
+ toggleCommentReviewView: function(params) {
+ this.comment = params;
+ jQuery('#editfile-createreview').hide();
+ jQuery('#new_review').val(0);
+ jQuery('#review_id').val(0);
+ jQuery('#review_complete').val(0);
+ jQuery('#review_newcomment').val(1);
+ jQuery('#review_id').val(this.comment.review);
+ jQuery('#editfile-userstatusreview').empty();
+ jQuery('#editfile-completedreview').empty();
+ jQuery('#editfile-remindernotification').hide();
+ jQuery('#review-remindernotification').val('');
+ var nocache = new Date().getTime();
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + this.comment.groupId + '&action=getdocreviewcomments&docid='+this.comment.docid+'&revid='+this.comment.review+'&rqd='+nocache, jQuery.proxy(function(data){
+ jQuery('#editfile-commentreview').empty();
+ if (typeof data.html != 'undefined') {
+ jQuery('#editfile-commentreview').prepend(data.html);
+ }
+ }, this.comment)).fail(function(jqXHR, textStatus, errorThrown) {
+ error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#editfile-commentreview').prepend(error_msg);
+ });
+ },
+
toggleEditVersionView: function(params) {
this.version = params;
jQuery('#new_version').val(0);
jQuery('#defaulteditfiletype').val('text/plain');
}
if (this.version.isText) {
- jQuery.getJSON(this.listfileparams.docManURL+'/?group_id='+this.version.groupId+'&action=getfile&type=file&itemid='+this.version.id+'&version='+this.version.version, jQuery.proxy(function(data){
+ var nocache = new Date().getTime();
+ jQuery.getJSON(this.listfileparams.docManURL+'/?group_id='+this.version.groupId+'&action=getfile&type=file&itemid='+this.version.id+'&version='+this.version.version+'&rqd='+nocache, jQuery.proxy(function(data){
if (data) {
jQuery('#defaulteditzone').text(data.body);
}
- }, this));
+ }, this)).fail(function(jqXHR, textStatus, errorThrown) {
+ error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#defaulteditzone').prepend(error_msg);
+ });
}
if (!this.listfileparams.tableAddVersion.is(':visible')) {
jQuery('#editButtonFile').prop('checked', true);
}
jQuery('#title').val(this.version.title);
- jQuery('#description').val(this.version.description);
- jQuery('#vcomment').val(this.version.vcomment);
+ jQuery('#description').val(this.version.description.replace(/\\n/g, String.fromCharCode(13,10)));
+ jQuery('#vcomment').val(this.version.vcomment.replace(/\\n/g, String.fromCharCode(13,10)));
jQuery('#edit_version').val(this.version.version);
if (this.version.current_version == 1) {
jQuery('#current_version').attr('checked', 'checked').prop('checked', true);
deleteVersion: function(params) {
this.delversion = params;
- jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + this.delversion.groupId + '&action=deleteversion&docid='+this.delversion.docid+'&version='+this.delversion.version , jQuery.proxy(function(data){
+ var nocache = new Date().getTime();
+ jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + this.delversion.groupId + '&action=deleteversion&docid='+this.delversion.docid+'&version='+this.delversion.version+'&rqd='+nocache, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#editFile > .feedback').remove();
jQuery('#editFile > .error').remove();
}
}
}
- }, this.delversion));
+ }, this.delversion)).fail(function(jqXHR, textStatus, errorThrown) {
+ error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#editFile').prepend(error_msg);
+ });
},
deleteReview: function(params) {
jQuery('#review_complete').val(0);
jQuery('#editfile-userstatusreview').empty();
jQuery('#editfile-completedreview').empty();
- jQuery.getJSON(this.docparams.docManURL + '/?group_id=' + this.docparams.groupId + '&action=deletereview&docid='+this.docparams.id+'&review='+this.delreview.review , jQuery.proxy(function(data){
+ jQuery('#editfile-remindernotification').hide();
+ jQuery('#review-remindernotification').val('');
+ var nocache = new Date().getTime();
+ jQuery.getJSON(this.docparams.docManURL + '/?group_id=' + this.docparams.groupId + '&action=deletereview&docid='+this.docparams.id+'&review='+this.delreview.review+'&rqd='+nocache, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#editFile > .feedback').remove();
jQuery('#editFile > .error').remove();
//adjust review tab number?
}
}
- }, this.delreview));
+ }, this.delreview)).fail(function(jqXHR, textStatus, errorThrown) {
+ error_msg = jQuery('<p class="error">'+textStatus+': Unable to contact server.</p>');
+ jQuery('#editFile').prepend(error_msg);
+ });
},
reminderReview: function(params) {
this.reminderreview = params;
- jQuery.getJSON(this.docparams.docManURL + '/?group_id=' + this.docparams.groupId + '&action=reminderreview&docid='+this.docparams.id+'&review='+this.reminderreview.review , jQuery.proxy(function(data){
- if (typeof data.html != 'undefined') {
- jQuery('#editFile > .feedback').remove();
- jQuery('#editFile > .error').remove();
- jQuery('#editFile > .warning_msg').remove();
- jQuery('#editFile').prepend(data.html);
- }
- }, this.reminderreview));
+ if (jQuery('#editfile-remindernotification').is(':visible')) {
+ jQuery('#editfile-remindernotification').hide();
+ jQuery('#review-remindernotification').val('');
+ } else {
+ jQuery('#new_review').val(2);
+ jQuery('#review_id').val(this.reminderreview.review);
+ jQuery('#editfile-createreview').hide();
+ jQuery('#editfile-commentreview').empty();
+ jQuery('#editfile-userstatusreview').empty();
+ jQuery('#editfile-completedreview').empty();
+ jQuery('#editfile-remindernotification').show();
+ }
},
toggleMoveFileView: function() {
this.listfileparams.divMoveFile.show();
jQuery('#movefileinput').val(function() {
var CheckedBoxes = new Array();
- for (var h = 0; h < jQuery('input:checked').length; h++) {
- if (typeof(jQuery('input:checked')[h].className) != 'undefined' && jQuery('input:checked')[h].className.match('checkeddocidactive')) {
- CheckedBoxes.push(jQuery('input:checked')[h].value);
+ for (let h of jQuery('input:checked')) {
+ if (typeof(h.className) != 'undefined' && h.className.match('checkeddocidactive')) {
+ CheckedBoxes.push(h.value);
}
}
return CheckedBoxes;
toggleNotifyUserView: function(params) {
this.notifyparams = params;
+ var nocache = new Date().getTime();
jQuery('#notifytitle').text(this.notifyparams.title);
- jQuery('#notifydescription').html(this.notifyparams.description);
+ jQuery('#notifydescription').text(this.notifyparams.description);
jQuery('#notifydocid').val(this.notifyparams.id);
jQuery('#notifyfilelink').text(this.notifyparams.filename);
if (this.notifyparams.statusId != 2) {
lock: 1,
type: 'dir',
itemid: this.notifyparams.docgroupId,
- childgroup_id: this.notifyparams.childGroupId
+ childgroup_id: this.notifyparams.childGroupId,
+ rqd: nocache
});
- this.lockInterval[this.notifyparams.id] = setInterval("jQuery.get('" + this.notifyparams.docManURL + "/', {group_id:"+this.notifyparams.groupId+",action:'lock',lock:1,type:'file',itemid:"+this.notifyparams.id+",childgroup_id:"+this.notifyparams.childGroupId+"})", this.notifyparams.lockIntervalDelay);
- this.lockInterval[this.notifyparams.docgroupId] = setInterval("jQuery.get('" + this.notifyparams.docManURL + "/', {group_id:"+this.notifyparams.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.notifyparams.docgroupId+",childgroup_id:"+this.notifyparams.childGroupId+"})", this.notifyparams.lockIntervalDelay);
+ this.lockInterval[this.notifyparams.id] = setInterval("jQuery.get('" + this.notifyparams.docManURL + "/', {group_id:"+this.notifyparams.groupId+",action:'lock',lock:1,type:'file',itemid:"+this.notifyparams.id+",childgroup_id:"+this.notifyparams.childGroupId+", rqd:"+nocache+"})", this.notifyparams.lockIntervalDelay);
+ this.lockInterval[this.notifyparams.docgroupId] = setInterval("jQuery.get('" + this.notifyparams.docManURL + "/', {group_id:"+this.notifyparams.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.notifyparams.docgroupId+",childgroup_id:"+this.notifyparams.childGroupId+", rqd:"+nocache+"})", this.notifyparams.lockIntervalDelay);
jQuery('#notify-userids').gentleSelect({columns: 2, itemWidth: 120});
jQuery(this.listfileparams.divNotifyUsers).dialog('option', 'title', '[D'+this.notifyparams.id+'] '+this.listfileparams.divNotifyTitle).dialog('open');
*/
buildUrlByCheckbox: function(id) {
var CheckedBoxes = new Array();
- for (var h = 0; h < jQuery('input:checked').length; h++) {
- if (typeof(jQuery('input:checked')[h].className) != 'undefined' && jQuery('input:checked')[h].className.match('checkeddocid'+id)) {
- CheckedBoxes.push(jQuery('input:checked')[h].value);
+ for (let h of jQuery('input:checked')) {
+ if (typeof(h.className) != 'undefined' && h.className.match('checkeddocid'+id)) {
+ CheckedBoxes.push(h.value);
}
}
return CheckedBoxes;
jQuery('#massaction'+id).hide();
jQuery('#movefile').hide();
}
- for (var h = 0; h < jQuery('input:checked').length; h++) {
- if (typeof(jQuery('input:checked')[h].className) != 'undefined' && jQuery('input:checked')[h].className.match('checkeddocid'+id)) {
+ for (let h of jQuery('input:checked')) {
+ if (typeof(h.className) != 'undefined' && h.className.match('checkeddocid'+id)) {
jQuery('#massaction'+id).show();
break;
}