Plugins-en

From TheWebMind.org Docs

Jump to: navigation, search

A IDE do Mind2.0 tem suporte a plugins.

Contents

Doanloading Plugins

We can find plugins through the menu "Plugins>Find Plugins"

Note: Page currently underconstruction.

Managing Plugins

We manage our instaled plugins using the menu "Manage>Plugins", with which we see the list of plugins, being able to disable or enable or uninstall then anytime we want.

Different kinds of Plugins

Plugins may open in three different ways:

Modal
Window
Tab

Some plugins can also use an icon, in the top of the interface, right to your menus.

Creating your own Plugin

To create your own plugin, it's enough to create a directory in your plugins directory (you can contribute to theWebMind by submiting your plugins) with the name of your plugin. Inside this folder, you will use this structure:

conf.xml
info.xml
data: the directory where will be the extra files, to be used by the module
data/face.php

conf.xml

There, you will set the configuration your pluygin has.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<root>
	<version value='1.0'/>
	<extraconffile value='conf_file.php'/>
	<openas value='tab' />
	<runAt value='none' />
	<useicon value='notes.png' />
	<dependsonproject value='true'/>
</root>

Understanding:

version: your plugin's version
extraconffile: an address to set a different config file. This will be accessed inside your data directory
openas: expresses the way your plugin will be called(opens the file with the same name, inside your data directory)
   has the followinf options:
       none: will not open (executed as background, only)
       modal: a model is opened with the file with the same name inside your data directory
       window: loads the content into a window inside theWebMind IDE
       tab: a tab will be added to the output panel, with the content (reloaded everytime the tab is focused)
runAt: indica o momento em que o metodo Run do seu plugin deverá ser chamado
   accepts the following options:
       none: the Run method will never be called by theWebMind, although, it still can be called from the plugin itself
       load: the Run method will be called when the plugin is loaded (usualy, when mind's IDE is started)
       run: everytime a project is runned
       open: when a project is loaded
       report: when any error is catched (either in PHP or JavaScript, or in any treated exception)
useicon: use "false" or the url of an icon iside the data directory of your plugin
   Is openAs is  "tab", it calls the RUN method, othewise, a model or window will be opened
dependsonproject: true or false, tells theWebMind if this plugins should work only when a project is opened

.js

This file must have the SAME name your plugin has (completely equal) .js, inside the data directory of your plugin. This file MUST obey this pattern:

Mind.Plugins.mNotes= {
	/* needed methods */
	Run: function(){
		//this.Save(, );
	},
	Load: function(){
		
	},
   /* any other methods you want, can be written here */
}

FrameWork

Your plugin inherits some methods from theWebMind. You will not create this methods except if you want to overwrite them. Here they are, detailed:

Save, Unlink, MkDir, List and LoadFile

As they are aggregated to your plugin automaticaly, you can access then this way:

this.Unlink(url);

Let's see their signatures:

	function Save(file_pach, content [, flag]):boolean;
	Return: true if successed, false if any error happens
	Parameters:
		file_path: the address. If the directory of dile doesn't exist, it will be created
		content: the content to be saved into the file
		flag: use true to concatenate its content, false to overwrite the file if it exists
	
	function Unlink(file_pach):boolean;
	Return: true in case of success, false otherwise
	Parameters:
		file_path: the address, including the directory of the file, will be deleted
		
	function MkDir(dir_pach):boolean;
	Return: true in case of success, false otherwise
	Parameters:
		dir_pach: the address, including the parent directory, where to create the new directory
		
	function List(dir_pach):ObjectCollection;
	Return: ObjectCollection[
				    Object[
						name:the name of file or directory,
						type:directory or file,
						address:the absolute address of the file
					  ]
				  ]
	Parameters:
		dir_pach: address of the parent directory to list the files
 	
	function LoadFile(file_pach):Object;
	Return: Object[
				name:the name of the file,
				address:full path of the file,
				size:files's size,
				content:the file content,
				lastChange:time of the last change
 		       ]
	Parameters:
		file_path: the address of the file to be loaded
 	
	function Post(file_pach, post_data):String;
	Return: the content loaded from the posted page
	Parameters:
		file_path: the address of the file to be posted
               post_data: Object with name and value of each data to be posted,
       Example:
               yourPluginName.Post(
                                      'user.php',
		                       {name:'Felipe', age:24}
             		           );
Personal tools