/* ** Copyright (c) 2007 D. Richard Hipp ** Copyright (c) 2008 Stephan Beal ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License as published by the Free Software Foundation; either ** version 2 of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** Implementation of the Tag View page */ #include #include "config.h" #include "my_page.h" /** Renders a logout button. */ static void mypage_logout_button() { if( g.zLogin ){ @

@ Logout (or "log out", if you prefer):
@
@

To log off the system (and delete your login cookie) @ press the following button:
@

@
} } /** Renders a password changer. */ static void mypage_password_changer() { if( g.okPassword ){ @

@ Change Password:
@

To change your password, enter your old password and your @ new password twice below then press the "Change Password" @ button.

@
@ @ @ @ @ @ @ @ @ @ @
Old Password:
New Password:
Repeat New Password:
@
} } /** Default page rendered for /my. */ static void mypage_page_default() { int uid = g.userUid; char * sql = mprintf( "SELECT login,cap,info FROM user WHERE uid=%d", uid ); Stmt st; char const *uname; char const *ucap; char const *uinfo; db_prepare( &st, sql ); free( sql ); db_step(&st); uname = db_column_text( &st, 0 ); ucap = db_column_text( &st, 1 ); uinfo = db_column_text( &st, 2 ); @

Welcome, %s(uname)!

@ Your user ID is: %d(uid)
@ Your Fossil permissions are: [%s(ucap)] @ [TODO: explain these]
if( g.okAdmin ){ @ You are an admin.
} @ Your additional info: [%s(uinfo)] @ [TODO: make this editable]
mypage_logout_button(); @
@

Your artifacts:

@ mypage_password_changer(); @

TODOs:

db_finalize( &st ); } /* ** WEBPAGE: /my */ void mypage_page(void){ const char *name; login_check_credentials(); if( !g.okRdWiki ){ login_needed(); } style_header("Your Home"); name = P("name"); if( name ) { if( 0 == strcmp(name,"tickets") ) { @ TODO: Tickets page. } else { @ TODO: handle /my/%s(name) } } else { mypage_page_default(); } style_footer(); }