| 1 |
bearsoft |
1.1 |
#include "HomePageHandler.h" |
| 2 |
|
|
#include "../../String/StringInput.h" |
| 3 |
|
|
#include "../../System/System.h" |
| 4 |
|
|
#include "../../DateTime/DateTime.h" |
| 5 |
|
|
#include "../../System/SystemDefine.h" |
| 6 |
|
|
#include "../../Html/Table.h"
|
| 7 |
|
|
#include "../../Html/Link.h"
|
| 8 |
|
|
#include "../../Html/Picture.h"
|
| 9 |
|
|
#include "../../Html/HomePage.h"
|
| 10 |
|
|
#include "../../Files/FileHandler.h"
|
| 11 |
|
|
#include "../../Files/FileInfo.h"
|
| 12 |
|
|
|
| 13 |
|
|
|
| 14 |
|
|
HomePageHandler::HomePageHandler(Header *iHeader) |
| 15 |
|
|
{
|
| 16 |
|
|
header=iHeader;
|
| 17 |
|
|
} |
| 18 |
|
|
|
| 19 |
|
|
HomePageHandler::~HomePageHandler() |
| 20 |
|
|
{
|
| 21 |
|
|
|
| 22 |
|
|
} |
| 23 |
|
|
|
| 24 |
|
|
bool HomePageHandler::check()
|
| 25 |
|
|
{
|
| 26 |
|
|
String filePath=header->filePath;
|
| 27 |
|
|
|
| 28 |
|
|
//part 1
|
| 29 |
|
|
|
| 30 |
|
|
if (filePath.isBackPartEqualTo("/?test"))
|
| 31 |
|
|
{
|
| 32 |
|
|
init();
|
| 33 |
|
|
return true;
|
| 34 |
|
|
}
|
| 35 |
|
|
|
| 36 |
|
|
return false;
|
| 37 |
|
|
}
|
| 38 |
|
|
|
| 39 |
|
|
bool HomePageHandler::init()
|
| 40 |
|
|
{
|
| 41 |
|
|
bool connectionStatus=true;
|
| 42 |
|
|
|
| 43 |
|
|
String start=" ";
|
| 44 |
|
|
|
| 45 |
|
|
HtmlMatrisList<String> *testMatris = new HtmlMatrisList<String>(1);
|
| 46 |
|
|
|
| 47 |
|
|
Picture picture;
|
| 48 |
|
|
|
| 49 |
|
|
picture.filePath->setString("tmb/pictures/elkmenyStart.jpg");
|
| 50 |
|
|
picture.info->setString("Meny");
|
| 51 |
|
|
picture.create();
|
| 52 |
|
|
|
| 53 |
|
|
testMatris->addColumnInRow(picture, 314, 0);
|
| 54 |
|
|
testMatris->addRow();
|
| 55 |
|
|
|
| 56 |
|
|
Link link;
|
| 57 |
|
|
link.filePath->setString("?meny1");
|
| 58 |
|
|
link.info->setString("menyLink1");
|
| 59 |
|
|
link.picturePath->setString("tmb/pictures/elkmenyMain.jpg");
|
| 60 |
|
|
link.create();
|
| 61 |
|
|
|
| 62 |
|
|
testMatris->addColumnInRow(link, 31, 0);
|
| 63 |
|
|
testMatris->addRow();
|
| 64 |
|
|
|
| 65 |
|
|
link.filePath->setString("?meny2");
|
| 66 |
|
|
link.info->setString("menyLink2");
|
| 67 |
|
|
link.picturePath->setString("tmb/pictures/elkmenyNews.jpg");
|
| 68 |
|
|
link.create();
|
| 69 |
|
|
|
| 70 |
|
|
testMatris->addColumnInRow(link, 27, 0);
|
| 71 |
|
|
testMatris->addRow();
|
| 72 |
|
|
|
| 73 |
|
|
link.filePath->setString("?meny3");
|
| 74 |
|
|
link.info->setString("menyLink3");
|
| 75 |
|
|
link.picturePath->setString("tmb/pictures/elkmenyMembers.jpg");
|
| 76 |
|
|
link.create();
|
| 77 |
|
|
|
| 78 |
|
|
testMatris->addColumnInRow(link, 26, 0);
|
| 79 |
|
|
testMatris->addRow();
|
| 80 |
|
|
|
| 81 |
|
|
link.filePath->setString("?meny4");
|
| 82 |
|
|
link.info->setString("menyLink4");
|
| 83 |
|
|
link.picturePath->setString("tmb/pictures/elkmenyProductions.jpg");
|
| 84 |
|
|
link.create();
|
| 85 |
|
|
|
| 86 |
|
|
testMatris->addColumnInRow(link, 27, 0);
|
| 87 |
|
|
testMatris->addRow();
|
| 88 |
|
|
|
| 89 |
|
|
picture.filePath->setString("tmb/pictures/elkmenyEnd.jpg");
|
| 90 |
|
|
picture.info->setString("Meny");
|
| 91 |
|
|
picture.create();
|
| 92 |
|
|
|
| 93 |
|
|
testMatris->addColumnInRow(picture, 48, 0);
|
| 94 |
|
|
testMatris->addRow();
|
| 95 |
|
|
|
| 96 |
|
|
Table table;
|
| 97 |
|
|
table.border=0;
|
| 98 |
|
|
table.width=312;
|
| 99 |
|
|
table.createMatris(testMatris,0);
|
| 100 |
|
|
table.create();
|
| 101 |
|
|
|
| 102 |
|
|
HtmlMatrisList<String> *testMatris2 = new HtmlMatrisList<String>(1);
|
| 103 |
|
|
|
| 104 |
|
|
picture.filePath->setString("tmb/pictures/elklogo.jpg");
|
| 105 |
|
|
picture.info->setString("logo");
|
| 106 |
|
|
picture.create();
|
| 107 |
|
|
|
| 108 |
|
|
testMatris2->addColumnInRow(picture, 314, 0);
|
| 109 |
|
|
testMatris2->addRow();
|
| 110 |
|
|
|
| 111 |
|
|
testMatris2->addColumnInRow("leftPresentation", 471-314, 0);
|
| 112 |
|
|
testMatris2->addRow();
|
| 113 |
|
|
|
| 114 |
|
|
Table table2;
|
| 115 |
|
|
table2.border=1;
|
| 116 |
|
|
table2.width=640-312;
|
| 117 |
|
|
table2.createMatris(testMatris2,0);
|
| 118 |
|
|
table2.create();
|
| 119 |
|
|
|
| 120 |
|
|
delete testMatris;
|
| 121 |
|
|
delete testMatris2;
|
| 122 |
|
|
|
| 123 |
|
|
HomePage *homePage = new HomePage(header);
|
| 124 |
|
|
|
| 125 |
|
|
homePage->backGroundColour->setString("000000");
|
| 126 |
|
|
homePage->link->setString("ffff00");
|
| 127 |
|
|
homePage->vLink->setString("ff0000");
|
| 128 |
|
|
|
| 129 |
|
|
// String data=start + "<html><body><form>" + table.data + table2.data + "</form></body></html>";
|
| 130 |
|
|
// System::println(data);
|
| 131 |
|
|
|
| 132 |
|
|
homePage->addTable(table);
|
| 133 |
|
|
homePage->addTable(table2);
|
| 134 |
|
|
|
| 135 |
|
|
homePage->send();
|
| 136 |
|
|
|
| 137 |
|
|
delete homePage;
|
| 138 |
|
|
|
| 139 |
|
|
// connectionStatus=header->makeAndSendHeaderWithStringData(data);
|
| 140 |
|
|
|
| 141 |
|
|
return connectionStatus;
|
| 142 |
|
|
} |