# Preamble

As you know T2 and T3 are deprecated. Some time ago I started a
reimplementation of T3 called cube9. I got stuck. I now re-factored it
completely

-----
   http://code.google.com/p/cube9/ (requires web2py trunk)
-----

It uses markmin:

-----
   http://web2py.com/examples/static/markmin.html
-----

cube9 is not completely finished by it works and it already much much
better than T2/T3.

# What is cube9?

Cube 9 is a possible replacement for the welcome app. It is identical
to welcome except that

- has a different layout
- contains a plugin called plugin_wiki (a plugin on steroids)
- use a JS menu

## What is plugin_wiki?

Plugin_wiki allows a developed (auth.user_id==1 or anybody member of
group 'editor') to create dynamic pages on the fly by visiting

``http://127.0.0.1:8000/cube9/plugin_wiki/page/my-new-page-slug``

In fact you do not need cube9 to run plugin_wiki, you can use it for
any web2py app. You can use it to add help pages. You can use to allow
your users to edit pages.

Pages are edited using markmin (via a modified markitup JS editor to
support markmin).
This email is written using markmin syntax.

## Why plugin_wiki is a plugin on steroids?

Because it includes under one name (plugin_wiki) other plugins as
embeddable widgets (mediaplyer, comments, tags, multiselect, and more)
and there is a way to access them using the markmin  syntax.

## A first example

For example to include a youtube video in a page you do

``
name: youtube
code: x1w8hKTJ2Co
``:widget

- The double reversed quotes tell markmin to deal with content in a
special way.
- The :widget tells plugin_wiki to override default behavior and treat
this as an embedded widget
- the content is treated as parameters (youtube being the name of the
widget and x1w8hKTJ2Co being the name of the youtube video you want to
embed).

There are MANY widgets you can already embed.

## More examples

### Tagging

``
name: tags
``:widget

### jqGrid list users

``
name: jqgrid
table: auth_user
``:widget

### Enbedding a form

``
name: create
table: auth_user
``:widget

### Embedding template code

``
counting... {{for i in range(10):}}{{=i}}{{pass}}
``:template


## Inner workings

For a list of widgets look into the static methods of
PluginWikiWidgets in models/plugin_wiki.py. The arguments of the
methods translate into variables. For example

``
class PluginWikiWidgets: # in models/plugin_wiki
    @staticmethod
    def abd(x,y=6): ....
``:code_python

is called by

``
name: abc
x=5
``:widget

(y is optional because y has a default, 6).

### List of Widgets

Here is a list of widgets as of today:

``
    def read(table,record_id=None): ...
    def
create(table,message='',next='',readonly_fields='',hidden_fields='',default_fields=''):
 ...
    def
update(table,record_id='',message='',next='',readonly_fields='',
                     hidden_fields='',default_fields=''): ...
    def select(table,query_field='',query_value='',fields=''): ...
    def search(table,fields=''): ...
    def jqgrid(table,fieldname=None,fieldvalue=None,col_widths='',
 
_id=None,fields='',col_width=80,width=700,height=300): ...
    def pie_chart(data,names,width=300,height=150,align='center'): ...
    def bar_chart(data,names,width=300,height=150,align='center'): ...
    def youtube(code,width=400,height=250): ...
    def vimeo(code,width=400,height=250): ...
    def mediaplayer(src,width=400,height=250): ...
    def comments(table='None',record_id=None): ...
    def tags(table='None',record_id=None): ...
    def tag_cloud(): ...
``:code_python

### Global variables

there are two important globals variables:

+ plugin_wiki_editor = True # or false to disable the wiki
+ plugin_wiki_level = 3 # for everything, 2 for wiki+widgets, 1 for
normal wiki (no code, widgets)

## Conclusions:

There is more to this already implemented and there is more to come.
For start you can run everything on GAE. Some pages with slug meta-*
have special meaning and can be used to edit header, footer, menu,
sidebar of cube9 layout. meta-code can be used to define new tables,
procedures and services.

For security reasons code and widgets can be disabled.

I will make a video about this as soon as I have the time (and free up
enough memory).

Please test it and send me comments. Enjoy!

Massimo


P.S. I apologize for these names.

Reply via email to