Skip to end of metadata
Go to start of metadata

The easiest way to get your own portlet runnig is to copy the example portlet and change what's necessary.
The Example Portlet features the basics features:

  • Userbased configuration
  • Caching
  • Use of Javascript inside the Portlet
1. Copy the Example Portlet

Make a copy of the Folder called "exampleportlet" located at "/PICOKROOT/localinc/portlets/". The Foldername must be the name of your portlet

2. Change the Folder- and Filenames

You'll have to Change the Foldername and the Filename of the JS File

3. Edit the SQL

As our Portlets need Data from the SQL you'll have to Edit fixtures.sql:

SET @type = 'YOURPORTLETNAME';
SET @subtype = '';
SET @pos = (SELECT COALESCE(MAX(pos), -1)+1 FROM portlets);

INSERT INTO portlets (type, subtype, pos, icon, url, auto_refresh, is_config_open, is_label_editable)
VALUES (@type, @subtype, @pos, 'YOURPORTLETICONNAME', '', 0, 0, 0);

INSERT INTO portlets_trans (type, subtype, lang, label) VALUES (@type, @subtype, 'de', 'PORTLETNAME_IN_GERMAN');
INSERT INTO portlets_trans (type, subtype, lang, label) VALUES (@type, @subtype, 'fr', 'PORTLETNAME_IN_FRENCH');
INSERT INTO portlets_trans (type, subtype, lang, label) VALUES (@type, @subtype, 'it', 'PORTLETNAME_IN_ITALIAN');
INSERT INTO portlets_trans (type, subtype, lang, label) VALUES (@type, @subtype, 'en', 'PORTLETNAME_IN_ENGLISH');

After you made all your modifications to the SQL, execute it in the Picok Database. I recommend Sequel Pro for OS X or PHPMyAdmin for other Operating Systems.

4. Change the Classname/Namespace of the Portlet

Before youre portlet will work you'll have to Change the Classname in core.php to the name of your portlet. The OKAPI Framework will search the classes by its position in the Filesystem.
Example:

<?php
class portlets_yourportletname_core extends picok_portlet
// is located at /localinc/portlets/yourportletname/core.php
?>

You also have to change the namespace and the functionname in exampleportlet.js.

YAHOO.namespace('viewportApp.yourportletname');

YAHOO.viewportApp.yourportletname = {
/**

  • Is called when a portlet is added or refreshed
  • Call needed methods for initialization of portlet
    *
    */
    init : function()
    Unknown macro: { #Initialisation JS goes HERE }
    }
After you did that you can execute your Javascript functions with:
*YAHOO.viewportApp.yourportletname.functionname(param1,param2);*

Now you're Demo Portlet should be up and running.

Afterwards you can start Customising

If you want to install the portlet via the admin tool. Zip the entire portlet and include the version name:

cd /localinc/portlets/yourportletname
zip -r9 yourportletname_1.0.0.zip *