/*!
* ngReMaCs Documents
*
* @package ngReMaCs
* @author Jens Raabe <jens@raabe-berlin.de>
* @version $Id$
*
* @copyright Copyright (c) 2012, Jens Raabe
* license: MIT-style license, see jrcms.js
*/
var NGReMaCs_Doc = new Class({
_SubPortioninfo: {
name: "NGReMaCs_Doc",
version: "1.0.0", //Release.Version.Minor
revision: "@$Revision$@", //Revision set by cvs
developer: "Jens Raabe",
developer_url: "http://www.raabe-berlin.de",
license: "MIT",
classId: 3600 // classId of NGReMaCs
}
});
(function(){
NGReMaCs_Doc.implement({
Implements: [Options, JRCmsApi]
,initialize: function(options, instanceName){
this.setOptions(options);
this.refactorNgReMaCs();
//register methods external usable (ajax history pool)
this.registerFunctions({instance: ($defined(instanceName)?instanceName:'ngReMaCs'),
classId:this._SubPortioninfo.classId,
functions:[{
functionName:'getPrintDialog', methodId: 50, functionType: 'ajax' } //3650
//,{functionName:'xyz', methodId: 61, functionType: 'ajax' } //3651
]});
}
,refactorNgReMaCs: function(){
window['NGReMaCs'] = Class.refactor(NGReMaCs, {
// ==============================================================================
// Documents items
// ID-Range: 50..59 for AJAX routines
// ==============================================================================
/**
* @methodId: 50
*/
getPrintDialog: function(p, el){
var p = p || new Object();
p._div = this.options.jr_divMain;
$(this.options.jr_divMain).empty();
var endFloating = new Element('br', {'class': 'nf'});
var dialogWrapper = new Element('div', {id: 'divPrintDialog','class': 'fll'});
dialogWrapper.inject($(this.options.jr_divMain));
endFloating.inject($(this.options.jr_divMain));
this.processRequest({
requestType: 'xol',
url: this.options.jr_pluginsUrl+this.options.jr_phpSRC,
data: Object.merge(p, { a: 'getPrintDialog'
,dlgopt: {
'dlgContent' : 'divPrintDialog'
,'dlgText': this.getLangItemSet()
,'dlgUrl': this.options.jr_pluginsUrl
,'dlgSrc': this.options.jr_phpSRC
,'dlgSaveAtOnce': true
,'dlgUseFieldset': true
}
}),
onSuccess: function(resp, xml, xol){
this.processXolContainer(xol);
}.bind(this)
});
}
/**
*
* @methodId: not needed
*/
,printDocument: function(p, el){
p = p || new Object();
p.a = 'printDocument';
p.regid = $('regid').get('value');
p._div = this.options.jr_divMain;
if($('_beginRennfolge').selectedIndex > 0) {
p._beginRennfolge = $('_beginRennfolge').options[$('_beginRennfolge').selectedIndex].value;
if($('_endRennfolge').selectedIndex > 0) {
p._endRennfolge = $('_endRennfolge').options[$('_endRennfolge').selectedIndex].value;
} else {
p._endRennfolge = $('_beginRennfolge').options[$('_beginRennfolge').selectedIndex].value;
}
}
if($('_documentToPrint').selectedIndex > 0) {
p._documentToPrint = $('_documentToPrint').options[$('_documentToPrint').selectedIndex].value;
} else {
alert('Keine Dokument!');
return false;
}
//OPTIONAL Parameter
if($defined($('_layoutVariant'))) p._layoutVariant = $('_layoutVariant').get('value');
if($defined($('_contentOnly'))) p._contentOnly = $('_contentOnly').get('value');
if($defined($('_withAbt'))) p._withAbt = $('_withAbt').get('value');
if($defined($('_id')) && $('_id').get('value').length > 0) p._id = $('_id').get('value');
this.processRequest({
requestType: 'xol',
url: this.options.jr_pluginsUrl+this.options.jr_phpSRC,
data: p
});
}
/**
*
* @methodId: not needed
*/
,printMeldeergebnis: function(p, el){
p = p || new Object();
p._div = this.options.jr_divMain;
this.processRequest({
requestType: 'xol',
url: this.options.jr_pluginsUrl+this.options.jr_phpSRC,
data: Object.merge(p, {a:'printMeldeergebnis'}),
});
}
/**
*
* @methodId: not needed
*/
,printProgramBrochure: function(p, el){
p = p || new Object();
p._div = this.options.jr_divMain;
this.processRequest({
requestType: 'xol',
url: this.options.jr_pluginsUrl+this.options.jr_phpSRC,
data: Object.merge(p, {a:'printProgramBrochure'}),
});
}
/**
*
* @methodId: not needed
*/
,printFinishProtocol: function(p, el){
p = p || new Object();
p._div = this.options.jr_divMain;
this.processRequest({
requestType: 'html',
url: this.options.jr_pluginsUrl+this.options.jr_phpSRC,
data: Object.merge(p, {a:'printRaceResult'}),
onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript){
;
}
});
}
/**
*
* @methodId: not needed
*/
,printVereinRegattaInvoice: function(p, el){
p = p || new Object();
p._div = this.options.jr_divMain;
this.processRequest({
requestType: 'html',
url: this.options.jr_pluginsUrl+this.options.jr_phpSRC,
data: Object.merge(p, {a:'printClubBill'}),
onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript){
;
}
});
}
/***********************************************
* AUTOCOMPLETE AND DIALOG FUNCTIONS *
***********************************************/
,documentToPrint: function() {
var p = {a:'getSupportedPrintTasks',
regid: $('regid').get('value')};
var list = this.getDialogParameter(p).docTypes;
var opt = new Array();
if(list.length > 0 )
Array.from(list).each(function(listitm, index){
opt.push({idx: listitm.idx, value: listitm.value});
}, this);
return opt;
}
,documentTypSelect: function(event) {
//stop event propagation
if (event.stopPropagation) {
event.stopPropagation(); // W3C model
} else {
event.cancelBubble = true; // IE model
}
var idx = event.target.selectedIndex;
switch ($('_documentToPrint').options[idx].value) {
case 'printRennInfoComplete':
$('_layoutVariant').set('value',1);
$('_contentOnly').set('value',1);
$('_withAbt').set('value',1);
break;
default:
$('_layoutVariant').set('value',1);
$('_contentOnly').set('value',0);
$('_withAbt').set('value',0);
break;
}
}
,processDialogValue: function(el, valueName, value){
switch (valueName) {
case '_documentToPrint':
el.addEvent('change',this.documentTypSelect.bind(this));
return this.elOptions( el, valueName, value, this.documentToPrint.bind(this));
break;
default:
break;
}
return this.previous(el, valueName, value);
}
});
}
}); //implements end
})();
var ngReMaCs_Doc = new NGReMaCs_Doc(window.jrCmsInit.options);