'+val.version.substr(1)+currenttdcontent+' | '+filenametdcontent[0].outerHTML+' | '+val.title+' | '+val.description+' | '+val.vcomment+' | '+val.created_by_username+' | '+val.lastdate+' | '+val.filesize_readable+' | '+versionactiontdcontent+' |
'
jQuery('#sortable_doc_version_table > tbody:last-child').append(htmlString);
});
}
}, this));
jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + docid_groupid + '&action=getassociations&docid='+ this.docparams.id, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#tabbereditfile-association > .feedback').remove();
jQuery('#tabbereditfile-association > .error').remove();
jQuery('#tabbereditfile-association > .warning_msg').remove();
jQuery('#tabbereditfile-association > .information').remove();
jQuery('#tabbereditfile-association > table').remove();
jQuery('#tabbereditfile-association > span').remove();
jQuery('#tabbereditfile-association > p').remove();
jQuery('#tabbereditfile-association').prepend(data.html);
}
if (typeof data.htmltab != 'undefined') {
jQuery('#associationtab').text(data.htmltab);
}
}, this));
jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + docid_groupid + '&action=getdocreviews&docid='+ this.docparams.id, jQuery.proxy(function(data){
if (typeof data.html != 'undefined') {
jQuery('#tabbereditfile-review > .feedback').remove();
jQuery('#tabbereditfile-review > .error').remove();
jQuery('#tabbereditfile-review > .warning_msg').remove();
jQuery('#tabbereditfile-review > .information').remove();
jQuery('#tabbereditfile-review > table').remove();
jQuery('#tabbereditfile-review > span').remove();
jQuery('#tabbereditfile-review > p').remove();
jQuery('#editfile-createreview').remove();
jQuery('#doc_review_addbutton').remove();
jQuery('#tabbereditfile-review').prepend(data.html);
jQuery('#doc_review_addbutton').button();
}
if (typeof data.htmltab != 'undefined') {
jQuery('#reviewtab').text(data.htmltab);
}
jQuery('#review-select-mandatory-users').gentleSelect({columns: 3, itemWidth: 150});
jQuery('#review-select-optional-users').gentleSelect({columns: 3, itemWidth: 150});
}, this));
jQuery('#editdocdata').attr('action', this.docparams.action);
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.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);
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');
return false;
},
toggleAddVersionView: function() {
jQuery('#title').val('');
jQuery('#description').val('');
jQuery(':file').val('');
jQuery('#edit_version').val('');
jQuery('#defaulteditzone').text();
jQuery('#current_version').prop('checked', false);
jQuery('#current_version').attr('onclick', 'return true');
if (!this.listfileparams.tableAddVersion.is(':visible')) {
jQuery('#new_version').val(1);
this.listfileparams.tableAddVersion.show();
} else {
this.listfileparams.tableAddVersion.hide();
jQuery('#new_version').val(0);
}
},
toggleAddReviewView: function() {
jQuery('#review-title').val('');
jQuery('#review-description').val('');
jQuery('#datepicker_end_review_date').val('');
jQuery('#review-serialid').val();
jQuery('[class^=gentle]').remove();
jQuery('#review-select-mandatory-users').val('');
jQuery('#review-select-optional-users').val('');
jQuery('#review-select-mandatory-users').gentleSelect({columns: 3, itemWidth: 150});
jQuery('#review-select-optional-users').gentleSelect({columns: 3, itemWidth: 150});
jQuery('#editfile-userstatusreview').empty();
jQuery('#editfile-completedreview').empty();
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();
}
},
toggleEditReviewView: function(params) {
this.review = params;
if (jQuery('#editfile-createreview').is(':visible')) {
jQuery('#editfile-createreview').hide();
jQuery('#new_review').val(0);
jQuery('#review_id').val(0);
jQuery('#review_complete').val(0);
jQuery('#editfile-userstatusreview').empty();
jQuery('#editfile-completedreview').empty();
} else {
jQuery('#review_id').val(this.review.review);
jQuery('#review-title').val(this.review.title);
jQuery('#review-description').val(this.review.description);
jQuery('#datepicker_end_review_date').val(this.review.endreviewdate);
jQuery('#review-serialid').val(this.review.serialid);
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){
if (typeof data.html != 'undefined') {
jQuery('#editfile-completedreview').prepend(data.html);
}
}, this.review));
} else {
jQuery('#tr-mandatory-reviewers').show();
jQuery('#tr-optional-reviewers').show();
jQuery('[class^=gentle]').remove();
jQuery('#review-select-mandatory-users').val(this.review.mandatoryusers);
jQuery('#review-select-optional-users').val(this.review.optionalusers);
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){
if (typeof data.html != 'undefined') {
jQuery('#editfile-userstatusreview').prepend(data.html);
}
}, this.review));
jQuery('#new_review').val(0);
jQuery('#editfile-createreview').show();
}
},
toggleEditVersionView: function(params) {
this.version = params;
jQuery('#new_version').val(0);
if (this.version.isHtml) {
jQuery('#defaulteditfiletype').val('text/html');
}
if (this.version.isText && !this.version.isHtml) {
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){
if (data) {
jQuery('#defaulteditzone').text(data.body);
}
}, this));
}
if (!this.listfileparams.tableAddVersion.is(':visible')) {
if (this.version.isURL) {
jQuery('#uploadnewroweditfile').hide();
jQuery('#fileurlroweditfile').show();
jQuery('#fileurlroweditfile').find('input').attr('required', 'required').prop('required', true);
jQuery('#fileurlroweditfile').find('input').val(this.version.filename);
jQuery('#editonlineroweditfile').hide();
jQuery('#editor').attr('disabled', true);
jQuery('#editButtonUrl').prop('checked', true);
} else if (this.listfileparams.useCreateOnline && this.version.isText){
jQuery('#fileurlroweditfile').hide();
jQuery('#uploadnewroweditfile').hide();
jQuery('#editonlineroweditfile').show();
jQuery('#editor').removeAttr('disabled');
jQuery('#editButtonEditor').prop('checked', true);
} else {
jQuery('#onlineroweditfile').hide();
jQuery('#editor').attr('disabled', true);
jQuery('#fileurlroweditfile').hide();
jQuery('#uploadnewroweditfile').show();
jQuery('#editButtonFile').prop('checked', true);
}
jQuery('#title').val(this.version.title);
jQuery('#description').val(this.version.description);
jQuery('#vcomment').val(this.version.vcomment);
jQuery('#edit_version').val(this.version.version);
if (this.version.current_version == 1) {
jQuery('#current_version').attr('checked', 'checked').prop('checked', true);
jQuery('#current_version').attr('onclick', 'return false');
}
this.listfileparams.tableAddVersion.show();
} else {
this.listfileparams.tableAddVersion.hide();
jQuery('#title').val('');
jQuery('#description').val('');
jQuery('#vcomment').val('');
jQuery(':file').val('');
jQuery('#edit_version').val('');
jQuery('#current_version').removeAttr('checked');
jQuery('#current_version').attr('onclick', 'return true');
jQuery('#fileurlroweditfile').find('input').val('');
jQuery('#fileurlroweditfile').find('input').removeAttr('required');
jQuery('#fileurlroweditfile').hide();
jQuery('#uploadnewroweditfile').hide();
jQuery('#editonlineroweditfile').hide();
jQuery('#defaulteditzone').text('');
}
},
deleteVersion: function(params) {
this.delversion = params;
console.log(this);
jQuery.getJSON(this.listfileparams.docManURL + '/?group_id=' + this.delversion.groupId + '&action=deleteversion&docid='+this.delversion.docid+'&version='+this.delversion.version , 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);
}
if (typeof data.status != 'undefined') {
if (data.status == 1) {
jQuery('#docversion'+this.version).remove();
//adjust review tab & version tab number?
if (jQuery('#docversionreview'+this.version) != 'undefined') {
jQuery('#docversionreview'+this.version).parent.remove();
}
if (jQuery('#sortable_doc_version_table tr').length <= 2) {
jQuery('#version_action_delete').remove();
}
}
}
}, this.delversion));
},
deleteReview: function(params) {
this.delreview = params;
jQuery('#editfile-createreview').hide();
jQuery('#new_review').val(0);
jQuery('#review_id').val(0);
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){
if (typeof data.html != 'undefined') {
jQuery('#editFile > .feedback').remove();
jQuery('#editFile > .error').remove();
jQuery('#editFile > .warning_msg').remove();
jQuery('#editFile').prepend(data.html);
}
if (typeof data.status != 'undefined') {
if (data.status == 1) {
jQuery('#docreview'+this.review).remove();
//adjust review tab number?
}
}
}, this.delreview));
},
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));
},
toggleMoveFileView: function() {
if (!this.listfileparams.divMoveFile.is(':visible')) {
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);
}
}
return CheckedBoxes;
});
} else {
this.listfileparams.divMoveFile.hide();
}
},
toggleNotifyUserView: function(params) {
this.notifyparams = params;
jQuery('#notifytitle').text(this.notifyparams.title);
jQuery('#notifydescription').html(this.notifyparams.description);
jQuery('#notifydocid').val(this.notifyparams.id);
jQuery('#notifyfilelink').text(this.notifyparams.filename);
if (this.notifyparams.statusId != 2) {
if (this.notifyparams.isURL) {
jQuery('#notifyfilelink').attr('href', this.notifyparams.filename);
} else {
jQuery('#notifyfilelink').attr('href', this.notifyparams.docManURL+'/view.php/'+this.notifyparams.groupId+'/'+this.notifyparams.id);
}
}
jQuery('#notifyusersdoc').attr('action', this.notifyparams.action);
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.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);
jQuery('#notify-userids').gentleSelect({columns: 2, itemWidth: 120});
jQuery(this.listfileparams.divNotifyUsers).dialog('option', 'title', '[D'+this.notifyparams.id+'] '+this.listfileparams.divNotifyTitle).dialog('open');
return false;
},
/*! build list of id, comma separated
*/
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);
}
}
return CheckedBoxes;
},
checkAll: function(id, type) {
if (jQuery('#checkall'+type).is(':checked')) {
jQuery('.'+id).each(function() {
jQuery(this).prop('checked', true);
});
jQuery('#massaction'+type).show();
} else {
jQuery('.'+id).each(function() {
jQuery(this).prop('checked', false);
});
jQuery('#massaction'+type).hide();
}
},
checkgeneral: function(id) {
if (jQuery(this).attr('checked', false)) {
jQuery('#checkall'+id).prop('checked', false);
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)) {
jQuery('#massaction'+id).show();
break;
}
}
},
setRequiredInputs: function(id) {
if (id.attr('id') == 'reviewtab') {
jQuery('#tabbereditfile-version :input').not(':input[type=hidden], :input[type=button]').prop('disabled', true);
jQuery('#tabbereditfile-association').prop('disabled', true);
jQuery('#tabbereditfile-review :input').removeAttr('disabled');
jQuery('#subaction').val('review');
} else if (id.attr('id') == 'associationtab') {
jQuery('#tabbereditfile-version :input').not(':input[type=hidden], :input[type=button]').prop('disabled', true);
jQuery('#tabbereditfile-association').removeAttr('disabled');
jQuery('#tabbereditfile-review :input').prop('disabled', true);
jQuery('#subaction').val('association');
} else if (id.attr('id') == 'versiontab') {
jQuery('#tabbereditfile-version :input').not(':input[type=hidden], :input[type=button]').removeAttr('disabled');
jQuery('#tabbereditfile-association').prop('disabled', true);
jQuery('#tabbereditfile-review :input').prop('disabled', true);
jQuery('#subaction').val('version');
}
}
};
DocManAddItemController.prototype =
{
/*! Binds the controls to the actions
*/
bindControls: function() {
this.additemparams.submitZip.click(jQuery.proxy(this, "submitFormZip"));
},
submitFormZip: function() {
this.additemparams.injectZip.submit();
this.additemparams.submitZip.attr('disabled', true);
}
};
DocManAddFileController.prototype =
{
/*! Binds the controls to the actions
*/
bindControls: function() {
this.addfileparams.buttonFile.click(jQuery.proxy(this, "toggleFileRowView"));
this.addfileparams.buttonUrl.click(jQuery.proxy(this, "toggleUrlRowView"));
if (typeof(this.addfileparams.buttonManualUpload) != 'undefined') {
this.addfileparams.buttonManualUpload.click(jQuery.proxy(this, "toggleManualUploadView"));
}
if (typeof(this.addfileparams.buttonEditor) != 'undefined') {
this.addfileparams.buttonEditor.click(jQuery.proxy(this, "toggleEditorView"));
}
},
toggleFileRowView: function() {
this.addfileparams.fileRow.show();
this.addfileparams.fileRow.find('input').attr("required", "required");
this.addfileparams.urlRow.hide();
this.addfileparams.urlRow.find('input').removeAttr("required");
this.addfileparams.pathRow.hide();
this.addfileparams.pathRow.find('input').removeAttr("required");
this.addfileparams.editRow.hide();
this.addfileparams.editNameRow.hide();
},
toggleUrlRowView: function() {
this.addfileparams.fileRow.hide();
this.addfileparams.fileRow.find('input').removeAttr("required");
this.addfileparams.urlRow.show();
this.addfileparams.urlRow.find('input').attr("required", "required");
this.addfileparams.pathRow.hide();
this.addfileparams.pathRow.find('input').removeAttr("required");
this.addfileparams.editRow.hide();
this.addfileparams.editNameRow.hide();
},
toggleManualUploadView: function() {
this.addfileparams.fileRow.hide();
this.addfileparams.fileRow.find('input').removeAttr("required");
this.addfileparams.urlRow.hide();
this.addfileparams.urlRow.find('input').removeAttr("required");
this.addfileparams.pathRow.show();
this.addfileparams.pathRow.find('input').attr("required", "required");
this.addfileparams.editRow.hide();
this.addfileparams.editNameRow.hide();
},
toggleEditorView: function() {
this.addfileparams.fileRow.hide();
this.addfileparams.fileRow.find('input').removeAttr("required");
this.addfileparams.urlRow.hide();
this.addfileparams.urlRow.find('input').removeAttr("required");
this.addfileparams.pathRow.hide();
this.addfileparams.pathRow.find('input').removeAttr("required");
this.addfileparams.editRow.show();
this.addfileparams.editNameRow.show();
}
};
DocManSearchController.prototype =
{
/*! Binds the controls to the actions
*/
bindControls: function() {
this.searchparams.buttonStartDate.click(jQuery.proxy(this, 'setStartDate'));
this.searchparams.buttonEndDate.click(jQuery.proxy(this, 'setEndDate'));
},
setStartDate: function() {
if (this.searchparams.buttonStartDate.is(':checked')) {
this.searchparams.datePickerStartDate.removeAttr('disabled');
this.searchparams.datePickerStartDate.attr('required', 'required');
} else {
this.searchparams.datePickerStartDate.attr('disabled', 'disabled');
this.searchparams.datePickerStartDate.removeAttr('required');
}
},
setEndDate: function() {
if (this.searchparams.buttonEndDate.is(':checked')) {
this.searchparams.datePickerEndDate.removeAttr('disabled');
this.searchparams.datePickerEndDate.attr('required', 'required');
} else {
this.searchparams.datePickerEndDate.attr('disabled', 'disabled');
this.searchparams.datePickerEndDate.removeAttr('required');
}
},
};