A fully functional WIKI in T2 with authentication, page attachments
and comments (check out last line). Can be customized via stylesheet.
views optional...

###  FILE: models/db.py
from applications.plugin_t2.modules.t2 import T2
db=SQLDB('sqlite://strorage.db')
t2=T2(request,response,session,cache,T,db)
# make a start welcome page if db is empty
if not db(db.t2_wiki.id>0).count():
    db.t2_wiki.insert(title="Welcome",body="My first wiki page")

### FILE: controllers/default.py
response.menu=t2.wiki_menu()
response.menu.append(['search',request.function=='index',t2.action
('index')])
if not t2.logged_in:
    response.menu.append(['login',request.function=='login',t2.action
('login')])
    response.menu.append
(['register',request.function=='register',t2.action('register')])
else:
    response.menu.append(['...',request.vars.edit,t2.action
('wiki',vars={'edit':True})])
    response.menu.append(['logout',False,t2.action('logout')])
    response.menu.append
(['profile',request.function=='profile',t2.action('profile')])

def index(): return dict(search=t2.wiki_nav())

def error(): t2.redirect('index',flash="not authorized to edit or
comment")

def download(): return t2.download()

def login(): return dict(form=t2.login())

def register(): return dict(form=t2.register(verification=False))

def profile(): return dict(form=t2.profile())

def logout(): return t2.logout()

def wiki():
    return dict(page=DIV(t2.wiki
(writable=t2.logged_in,mode='markdown'),
        H2('Attachments'),t2.attachments(writable=t2.logged_in),
        H2('Comments'),t2.comments(writable=t2.logged_in)))

requires latest T2:
http://mdp.cti.depaul.edu/examples/static/web2py.app.plugin_t2.tar

works best with T2 layout because of a page title of "parent/child"
makes child submenu of parent page.

Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to