YAHOO.namespace('POTISCOM');

(function() {
	
	var jsPath = 'libs/potiscomapp/js/';

	YAHOO.POTISCOM.addModulesToLoader = function(loader) {
		
        // === STRUCTURE ===============================================================================================
		loader.addModule({
			name: 'POTISCOM.Tools',
			type: 'js',
			requires: ['selector', 'container', 'OLD.MooToolsMinimal'],
			fullpath: jsPath+'Tools.js'
		});
		
        loader.addModule({
            name: 'POTISCOM.components.structure.ApplicationModule',
            type: 'js',
            requires: ['POTISCOM.components.structure.Module', 'POTISCOM.Tools', 'POTISCOM.components.dragdrop.GenericDraggable', 'container'],
            fullpath: jsPath+'components/structure/ApplicationModule.js'
        });

		loader.addModule({
			name: 'POTISCOM.components.structure.Module',
			type: 'js',
			requires: [],
			fullpath: jsPath+'components/structure/Module.js'
		});

		loader.addModule({
			name: 'POTISCOM.components.structure.Plugin',
			type: 'js',
			requires: [],
			fullpath: jsPath+'components/structure/Plugin.js'
		});



        // === DRAG & DROP =============================================================================================
		loader.addModule({
			name: 'POTISCOM.components.dragdrop.DragDropManager',
			type: 'js',
			requires: ['dragdrop'],
			fullpath: jsPath+'components/dragdrop/DragDropManager.js'
		});

		loader.addModule({
			name: 'POTISCOM.components.dragdrop.GenericDraggable',
			type: 'js',
			requires: ['POTISCOM.components.dragdrop.DragDropManager'],
			fullpath: jsPath+'components/dragdrop/GenericDraggable.js'
		});



        // === STRUCTURE PLUGINS =======================================================================================
		loader.addModule({
			name: 'POTISCOM.components.structure.plugins.MainMenuPlugin',
			type: 'js',
			requires: ['menu', 'POTISCOM.components.structure.Plugin'],
			fullpath: jsPath+'components/structure/plugins/MainMenuPlugin.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.structure.plugins.InsiteEditorPlugin',
			type: 'js',
			requires: ['POTISCOM.components.structure.Plugin'],
			fullpath: jsPath+'components/structure/plugins/InsiteEditorPlugin.js'
		});

		loader.addModule({
			name: 'POTISCOM.components.datastructures.Tree',
			type: 'js',
			requires: ['POTISCOM.components.dragdrop.GenericDraggable'],
			fullpath: jsPath+'components/datastructures/Tree.js'
		});



        // === INSITEEDITOR PLUGINS ====================================================================================
		loader.addModule({
			name: 'POTISCOM.components.insiteeditors.AbstractPlugin',
			type: 'js',
			requires: [],
			fullpath: jsPath+'components/insiteeditors/AbstractPlugin.js'
		});

        loader.addModule({
            name: 'POTISCOM.components.insiteeditors.GenericStringPlugin',
            type: 'js',
            requires: ['POTISCOM.components.insiteeditors.AbstractPlugin'],
            fullpath: jsPath+'components/insiteeditors/GenericStringPlugin.js'
        });

        loader.addModule({
            name: 'POTISCOM.components.insiteeditors.GenericRichTextPlugin',
            type: 'js',
            requires: ['POTISCOM.components.insiteeditors.AbstractPlugin'],
            fullpath: jsPath+'components/insiteeditors/GenericRichTextPlugin.js'
        });


        // seems like these are still needed for opening the filemanager and selecting the resource
        loader.addModule({
            name: 'POTISCOM.components.insiteeditors.ImagePlugin',
            type: 'js',
            requires: ['POTISCOM.components.insiteeditors.AbstractPlugin'],
            fullpath: jsPath+'components/insiteeditors/ImagePlugin.js'
        });

        loader.addModule({
            name: 'POTISCOM.components.insiteeditors.SwfPlugin',
            type: 'js',
            requires: ['POTISCOM.components.insiteeditors.AbstractPlugin'],
            fullpath: jsPath+'components/insiteeditors/SwfPlugin.js'
        });



        // === FILE MANAGER ============================================================================================
		loader.addModule({
			name: 'POTISCOM.components.filemanager.Dialog',
			type: 'js',
			requires: ['POTISCOM.components.genericdialogs.AbstractDialog', 'POTISCOM.components.filemanager.FolderTree', 'layout', 'button', 'datatable', 'datasource', 'uploader'],
			fullpath: jsPath+'components/filemanager/Dialog.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.filemanager.FolderTree',
			type: 'js',
			requires: ['treeview', 'POTISCOM.components.filemanager.FolderTreeNode'],
			fullpath: jsPath+'components/filemanager/FolderTree.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.filemanager.FolderTreeNode',
			type: 'js',
			requires: ['treeview'],
			fullpath: jsPath+'components/filemanager/FolderTreeNode.js'
		});
		
        loader.addModule({
            name: 'POTISCOM.components.filemanager.Uploader',
            type: 'js',
            requires: ['uploader', 'OLD.MooToolsMinimal'],
            fullpath: jsPath+'components/filemanager/Uploader.js'
        });



        // === RICH TEXT EDITOR ========================================================================================
		loader.addModule({
			name: 'POTISCOM.components.richtexteditor.Editor',
			type: 'js',
			requires: ['editor', 'tabview'],
			fullpath: jsPath+'components/richtexteditor/Editor.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.richtexteditor.plugins.SimpleImagePlugin',
			type: 'js',
			requires: ['POTISCOM.components.richtexteditor.Editor'],
			fullpath: jsPath+'components/richtexteditor/plugins/SimpleImagePlugin.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.richtexteditor.plugins.ImagePlugin',
			type: 'js',
			requires: ['POTISCOM.components.richtexteditor.plugins.SimpleImagePlugin'],
			fullpath: jsPath+'components/richtexteditor/plugins/ImagePlugin.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.richtexteditor.plugins.PasteCleanPlugin',
			type: 'js',
			requires: ['POTISCOM.components.richtexteditor.Editor'],
			fullpath: jsPath+'components/richtexteditor/plugins/PasteCleanPlugin.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.richtexteditor.plugins.HrPlugin',
			type: 'js',
			requires: ['POTISCOM.components.richtexteditor.Editor'],
			fullpath: jsPath+'components/richtexteditor/plugins/HrPlugin.js'
		});



        // === GENERIC DIALOGS =========================================================================================
		loader.addModule({
			name: 'POTISCOM.components.genericdialogs.AbstractDialog',
			type: 'js',
			requires: ['container', 'button', 'layout', 'resize'],
			fullpath: jsPath+'components/genericdialogs/AbstractDialog.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.genericdialogs.ConfirmDialog',
			type: 'js',
			requires: ['POTISCOM.components.genericdialogs.AbstractDialog'],
			fullpath: jsPath+'components/genericdialogs/ConfirmDialog.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.genericdialogs.MessageDialog',
			type: 'js',
			requires: ['POTISCOM.components.genericdialogs.ConfirmDialog'],
			fullpath: jsPath+'components/genericdialogs/MessageDialog.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.genericdialogs.PromptDialog',
			type: 'js',
			requires: ['POTISCOM.components.genericdialogs.ConfirmDialog'],
			fullpath: jsPath+'components/genericdialogs/PromptDialog.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.genericdialogs.AutocompletingPromptDialog',
			type: 'js',
			requires: ['POTISCOM.components.genericdialogs.PromptDialog', 'autocomplete'],
			fullpath: jsPath+'components/genericdialogs/AutocompletingPromptDialog.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.genericdialogs.PlainTextEditor',
			type: 'js',
			requires: ['POTISCOM.components.genericdialogs.PromptDialog', 'autocomplete'],
			fullpath: jsPath+'components/genericdialogs/PlainTextEditor.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.genericdialogs.AbstractCustomDialog',
			type: 'js',
			requires: ['POTISCOM.components.genericdialogs.AbstractResizableDialog'],
			fullpath: jsPath+'components/genericdialogs/AbstractCustomDialog.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.richtexteditor.Dialog',
			type: 'js',
			requires: ['POTISCOM.components.genericdialogs.AbstractResizableDialog', 'POTISCOM.components.richtexteditor.Editor'],
			fullpath: jsPath+'components/richtexteditor/Dialog.js'
		});
		
		loader.addModule({
			name: 'POTISCOM.components.richtexteditor.InlineDialog',
			type: 'js',
			requires: ['container', 'POTISCOM.components.richtexteditor.Editor'],
			fullpath: jsPath+'components/richtexteditor/InlineDialog.js'
		});



        // === COMPLEX DIALOGS =========================================================================================
        loader.addModule({
            name: 'POTISCOM.components.dialogs.UsersDialog',
            type: 'js',
            requires: ['POTISCOM.components.genericdialogs.AbstractDialog'],
            fullpath: jsPath+'components/dialogs/UsersDialog.js'
        });



        // === MULTIMEDIA ==============================================================================================
		loader.addModule({
			name: 'POTISCOM.components.multimedia.Slideshow',
			type: 'js',
			requires: ['container', 'selector'],
			fullpath: jsPath+'components/multimedia/Slideshow.js'
		});



        // === YE OLDE =================================================================================================
        loader.addModule({
            name: 'OLD.MooToolsMinimal',
            type: 'js',
            requires: [],
            fullpath: jsPath+'mootools-1.2-minimal.js'
        });

	};
	
})();

