bidding system...

This commit is contained in:
Christoph Haas 2012-11-11 18:18:23 +00:00
parent ea1a60743d
commit d0544409ec
4 changed files with 155 additions and 87 deletions

View File

@ -0,0 +1,41 @@
Ext.namespace("Zarafa.plugins.calendarimporter.dialogs");
/**
* @class Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel
* @extends Zarafa.core.ui.ContentPanel
*
* The content panel which shows the hierarchy tree of Owncloud account files.
* @xtype calendarimportercontentpanel
*/
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
/**
* @constructor
* @param config Configuration structure
*/
constructor : function(config)
{
config = config || {};
Ext.applyIf(config, {
layout : 'fit',
title : _('Import Calendar File'),
closeOnSave : true,
width : 400,
height : 300,
//Add panel
items : [/*
{
xtype : 'owncloudrcvattachment.folderpanel',
ref : 'treePanel',
response : config.record
}*/
]
});
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel.superclass.constructor.call(this, config);
}
});
Ext.reg('calendarimportercontentpanel' ,Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel);

View File

@ -130,88 +130,4 @@ Zarafa.plugins.calendarimporter.ImportPanel = Ext.extend(Ext.form.FormPanel, {
}
}
});
Zarafa.core.ui.Dialog.register(Zarafa.plugins.calendarimporter.ImportPanel, "calendarimporter.ImportPanel");
/*############################################################################################################################
* IMPORT DIALOG
*############################################################################################################################*/
Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace
Zarafa.plugins.calendarimporter.ImportDialog = Ext.extend(Zarafa.core.ui.Dialog, {
constructor: function (a) {
a = a || {};
Ext.applyIf(a, {
layout: "",
title: _("Calender Import"),
alwaysUseDefaultTitle: true,
useShadowStore: false,
closeOnSave: true,
width : 500,
height : 300,
items: [{
xtype: "calendarimporter.ImportPanel"
}]
});
Zarafa.plugins.calendarimporter.ImportDialog.superclass.constructor.call(this, a)
}
});
Zarafa.core.ui.Dialog.register(Zarafa.plugins.calendarimporter.ImportDialog, "calendarimporter.ImportDialog");
/*############################################################################################################################
* IMPORT BUTTON
*############################################################################################################################*/
Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace
Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
/**
* @constructor
* @param {Object} config Configuration object
*
*/
constructor: function (config) {
config = config || {};
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.constructor.call(this, config);
this.init();
},
/**
* Called after constructor.
* Registers insertion point for import button.
* @private
*/
init: function () {
this.registerInsertionPoint("navigation.south", this.createButton, this)
},
/**
* Creates the button
*
* @return {Object} Configuration object for a {@link Ext.Button button}
* @private
*/
createButton: function () { // eine Button definition
return {
xtype: "button",
text: _("Import Calendar"),
iconCls: "icon_calendarimporter_button",
navigationContext: container.getContextByName("calendar"),
handler: this.onImportButtonClick,
scope: this
}
},
/**
* Clickhandler for the button
*/
onImportButtonClick: function () {
Zarafa.plugins.calendarimporter.ImportDialog.create()
}
});
/*############################################################################################################################
* STARTUP
*############################################################################################################################*/
Zarafa.onReady(function() {
if(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/enable") === true) {
container.registerPlugin(new Zarafa.plugins.calendarimporter.ImportPlugin)
}
});
Zarafa.core.ui.Dialog.register(Zarafa.plugins.calendarimporter.ImportPanel, "calendarimporter.ImportPanel");

View File

@ -0,0 +1,106 @@
Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace
Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
/**
* @constructor
* @param {Object} config Configuration object
*
*/
constructor: function (config) {
config = config || {};
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.constructor.call(this, config);
Zarafa.core.data.SharedComponentType.addProperty('plugins.calendarimporter.dialogs.importevents');
},
/**
* initialises insertion point for plugin
* @protected
*/
initPlugin : function()
{
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.initPlugin.apply(this, arguments);
/* add import button to south navigation */
this.registerInsertionPoint("navigation.south", this.createImportButton, this);
},
/**
* Creates the button
*
* @return {Object} Configuration object for a {@link Ext.Button button}
* @private
*/
createImportButton: function () { // eine Button definition
return {
xtype : "button",
text : _("Import Calendar"),
iconCls : "icon_calendarimporter_button",
navigationContext : container.getContextByName("calendar"),
handler : this.onImportButtonClick,
scope : this
}
},
/**
* Clickhandler for the button
*/
onImportButtonClick: function () {
Zarafa.core.data.UIFactory.openCreateRecord(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents'], undefined, {
manager : Ext.WindowMgr
});
},
/**
* Bid for the type of shared component
* and the given record.
* This will bid on calendar.dialogs.importevents
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
* @param {Ext.data.Record} record Optionally passed record.
* @return {Number} The bid for the shared component
*/
bidSharedComponent : function(type, record)
{
var bid = -1;
console.log(type);
console.log(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']);
switch(type)
{
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
bid = 2;
break;
}
return bid;
},
/**
* Will return the reference to the shared component.
* Based on the type of component requested a component is returned.
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
* @param {Ext.data.Record} record Optionally passed record.
* @return {Ext.Component} Component
*/
getSharedComponent : function(type, record)
{
var component;
switch(type)
{
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
component = Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel;
break;
}
return component;
}
});
/*############################################################################################################################
* STARTUP
*############################################################################################################################*/
Zarafa.onReady(function() {
if(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/enable") === true) {
container.registerPlugin(new Zarafa.plugins.calendarimporter.ImportPlugin)
}
});

View File

@ -19,11 +19,16 @@
<serverfile>php/plugin.calendarimporter.php</serverfile>
</server>
<client>
<clientfile load="release">js/calendarimporter.js</clientfile>
<clientfile load="debug">js/calendarimporter.js</clientfile>
<clientfile load="release">js/plugin.calendarimporter.js</clientfile>
<clientfile load="release">js/dialogs/ImportContentPanel.js</clientfile>
<clientfile load="debug">js/plugin.calendarimporter.js</clientfile>
<clientfile load="debug">js/dialogs/ImportContentPanel.js</clientfile>
</client>
<resources>
<resourcefile load="release">resources/css/calendarimporter.css</resourcefile>
<resourcefile load="debug">resources/css/calendarimporter.css</resourcefile>
</resources>
</files>
</component>