'+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('#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(this.listfileparams.divEditFile).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);
}
},
toggleEditVersionView: function(params) {
this.version = params;
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.docparams.groupId+'&action=getfile&type=file&itemid='+this.docparams.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.docparams.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;
jQuery.getJSON(this.docparams.docManURL + '/?group_id=' + this.docparams.groupId + '&action=deleteversion&docid='+this.docparams.id+'&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();
if (jQuery('#sortable_doc_version_table tr').length <= 2) {
jQuery('#version_action_delete').remove();
}
}
}
}, this.delversion));
},
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').text(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(this.listfileparams.divNotifyUsers).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;
}
}
}
};
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');
}
},
};