Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

FelForm.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003  Anders Hedstrom
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #include <stdio.h>
00020 #include <stdlib.h>
00021 #include <mysql/mysql.h>
00022 #include <libsql++.h>
00023 #include <string>
00024 using std::string;
00025 #include <libcgi++.h>
00026 #include <libwolfshade.h>
00027 
00028 #include "BaseForm.h"
00029 #include "WolfshadeWeb.h"
00030 //#include "CMemoryAllocator.h"
00031 //#include "MyString.h"
00032 #include "FelForm.h"
00033 
00034 
00035 namespace cgi
00036 {
00037 
00038 
00039 FelForm::FelForm(Web *web)
00040 :BaseForm(web, "felform")
00041 ,m_edit(0)
00042 ,m_error(false)
00043 {
00044 }
00045 
00046 
00047 FelForm::~FelForm()
00048 {
00049 }
00050 
00051 
00052 void FelForm::Process()
00053 {
00054         char action[200];
00055         
00056         if (GetForm() -> getvalue("felform",action,200))
00057         {
00058         }
00059 }
00060 
00061 
00062 void FelForm::Select(const string &)
00063 {
00064 }
00065 
00066 
00067 void FelForm::List()
00068 {
00069 }
00070 
00071 
00072 void FelForm::Display(long)
00073 {
00074 //      WolfshadeWeb *web = static_cast<WolfshadeWeb *>(GetWeb());
00075         Database *db = GetDatabase();
00076         Query q(db);
00077         int opposite[] = {2,3,0,1,5,4};
00078         char sql[200];
00079 
00080         q.get_result("select * from room_door order by room");
00081         {
00082                 Table tbl("#000000", 3, "&nbsp;Exits with no link back (might be ok)");
00083 
00084                 printf("<tr bgcolor=#ffffff>");
00085                 printf("<th>From Room</th>");
00086                 printf("<th>Direction</th>");
00087                 printf("<th>To Room</th>");
00088                 printf("</tr>");
00089                 while (q.fetch_row())
00090                 {
00091                         db::Room_door x(db,&q);
00092                         db::Room_dir dir(db,x.direction);
00093                         sprintf(sql,"select * from room_door where room=%ld and direction=%d and toroom=%ld",
00094                                 x.toroom,opposite[x.direction],x.room);
00095                         db::Room_door y(db,sql);
00096                         if (!y.num)
00097                         {
00098                                 db::Room room1(db,x.room);
00099                                 db::Room room2(db,x.toroom);
00100                                 if (room2.num)
00101                                 {
00102                                         printf("<tr bgcolor=#808080>");
00103                                         ShowRoom(room1,true,true);
00104                                         printf("<td bgcolor=#c0c0c0 align=middle>&nbsp;%s&nbsp;</td>",dir.name);
00105                                         ShowRoom(room2,true,true);
00106                                         printf("</tr>");
00107                                 }
00108                         }
00109                 }
00110         }
00111         q.free_result();
00112 }
00113 
00114 
00115 } // namespace cgi
00116 
00117 
00118 /*
00119 INSERT INTO room_dir VALUES (0,'NORTH',1);
00120 INSERT INTO room_dir VALUES (1,'EAST',3);
00121 INSERT INTO room_dir VALUES (2,'SOUTH',2);
00122 INSERT INTO room_dir VALUES (3,'WEST',4);
00123 INSERT INTO room_dir VALUES (4,'UP',5);
00124 INSERT INTO room_dir VALUES (5,'DOWN',6);
00125 */
00126 

Generated for Wolfshade by doxygen 1.3.6

Page, code, and content Copyright (C) 2004 by Anders Hedström