| 1 |
bearsoft |
1.1 |
#include "HomePage.h" |
| 2 |
|
|
#include "../System/System.h" |
| 3 |
|
|
#include "../System/SystemDefine.h" |
| 4 |
|
|
#include "../Array/ObjectArray.h"
|
| 5 |
|
|
|
| 6 |
|
|
HomePage::HomePage(Header *iHeader) |
| 7 |
|
|
{
|
| 8 |
|
|
title=new String();
|
| 9 |
|
|
backGroundColour= new String();
|
| 10 |
|
|
text=null;
|
| 11 |
|
|
link = new String();
|
| 12 |
|
|
vLink = new String();
|
| 13 |
|
|
backGroundPicturePath=null;
|
| 14 |
|
|
header=iHeader;
|
| 15 |
|
|
tableList = new StringLinkedList();
|
| 16 |
|
|
} |
| 17 |
|
|
|
| 18 |
|
|
HomePage::~HomePage() |
| 19 |
|
|
{
|
| 20 |
|
|
if (title!=null)
|
| 21 |
|
|
{
|
| 22 |
|
|
delete title;
|
| 23 |
|
|
}
|
| 24 |
|
|
|
| 25 |
|
|
if (text!=null)
|
| 26 |
|
|
{
|
| 27 |
|
|
delete text;
|
| 28 |
|
|
}
|
| 29 |
|
|
|
| 30 |
|
|
if (link!=null)
|
| 31 |
|
|
{
|
| 32 |
|
|
delete link;
|
| 33 |
|
|
}
|
| 34 |
|
|
|
| 35 |
|
|
if (vLink!=null)
|
| 36 |
|
|
{
|
| 37 |
|
|
delete vLink;
|
| 38 |
|
|
}
|
| 39 |
|
|
|
| 40 |
|
|
if (tableList!=null)
|
| 41 |
|
|
{
|
| 42 |
|
|
delete tableList;
|
| 43 |
|
|
}
|
| 44 |
|
|
}
|
| 45 |
|
|
|
| 46 |
|
|
/*
|
| 47 |
|
|
void HomePage::create()
|
| 48 |
|
|
{
|
| 49 |
|
|
String start="<html><head>";
|
| 50 |
|
|
|
| 51 |
|
|
String endData=start + title + "</head><body";
|
| 52 |
|
|
|
| 53 |
|
|
if (backGroundColour!=null)
|
| 54 |
|
|
{
|
| 55 |
|
|
endData+=" bgcolor=#";
|
| 56 |
|
|
endData+=backGroundColour;
|
| 57 |
|
|
}
|
| 58 |
|
|
|
| 59 |
|
|
if (text!=null)
|
| 60 |
|
|
{
|
| 61 |
|
|
endData+=" text=#";
|
| 62 |
|
|
endData+=text;
|
| 63 |
|
|
}
|
| 64 |
|
|
|
| 65 |
|
|
if (link!=null)
|
| 66 |
|
|
{
|
| 67 |
|
|
endData+=" link=#";
|
| 68 |
|
|
endData+=link;
|
| 69 |
|
|
}
|
| 70 |
|
|
|
| 71 |
|
|
if (vLink!=null)
|
| 72 |
|
|
{
|
| 73 |
|
|
endData+=" vlink=#";
|
| 74 |
|
|
endData+=vLink;
|
| 75 |
|
|
}
|
| 76 |
|
|
|
| 77 |
|
|
if (backGroundPicturePath!=null)
|
| 78 |
|
|
{
|
| 79 |
|
|
endData+=" background='";
|
| 80 |
|
|
endData+=backGroundPicturePath;
|
| 81 |
|
|
endData+="'";
|
| 82 |
|
|
}
|
| 83 |
|
|
}
|
| 84 |
|
|
*/
|
| 85 |
|
|
|
| 86 |
|
|
void HomePage::addTable(Table &table)
|
| 87 |
|
|
{
|
| 88 |
|
|
tableList->addLast(table.data);
|
| 89 |
|
|
}
|
| 90 |
|
|
|
| 91 |
|
|
|
| 92 |
|
|
bool HomePage::send()
|
| 93 |
|
|
{
|
| 94 |
|
|
String tableData;
|
| 95 |
|
|
|
| 96 |
|
|
int size=tableList->size();
|
| 97 |
|
|
|
| 98 |
|
|
for (int i=0; i<size ; i++)
|
| 99 |
|
|
{
|
| 100 |
|
|
tableData+=tableList->getElement(i);
|
| 101 |
|
|
}
|
| 102 |
|
|
|
| 103 |
|
|
String start="<html><head>";
|
| 104 |
|
|
|
| 105 |
|
|
String endData=start + "</head><body";
|
| 106 |
|
|
|
| 107 |
|
|
if (!backGroundColour->isNull())
|
| 108 |
|
|
{
|
| 109 |
|
|
endData+=" bgcolor=#";
|
| 110 |
|
|
endData+=backGroundColour;
|
| 111 |
|
|
}
|
| 112 |
|
|
|
| 113 |
|
|
if (text!=null)
|
| 114 |
|
|
{
|
| 115 |
|
|
endData+=" text=#";
|
| 116 |
|
|
endData+=text;
|
| 117 |
|
|
}
|
| 118 |
|
|
|
| 119 |
|
|
if (!link->isNull())
|
| 120 |
|
|
{
|
| 121 |
|
|
endData+=" link=#";
|
| 122 |
|
|
endData+=link;
|
| 123 |
|
|
}
|
| 124 |
|
|
|
| 125 |
|
|
if (!vLink->isNull())
|
| 126 |
|
|
{
|
| 127 |
|
|
endData+=" vlink=#";
|
| 128 |
|
|
endData+=vLink;
|
| 129 |
|
|
}
|
| 130 |
|
|
|
| 131 |
|
|
if (backGroundPicturePath!=null)
|
| 132 |
|
|
{
|
| 133 |
|
|
endData+=" background='";
|
| 134 |
|
|
endData+=backGroundPicturePath;
|
| 135 |
|
|
endData+="'";
|
| 136 |
|
|
}
|
| 137 |
|
|
|
| 138 |
|
|
endData+="<form>";
|
| 139 |
|
|
|
| 140 |
|
|
String data=endData + tableData + "</form></body></html>";
|
| 141 |
|
|
|
| 142 |
|
|
return header->makeAndSendHeaderWithStringData(data);
|
| 143 |
|
|
}
|
| 144 |
|
|
|
| 145 |
|
|
|
| 146 |
|
|
/*
|
| 147 |
|
|
<TEXTAREA NAME="body" ROWS=25 COLS=62 WRAP="SOFT"></TEXTAREA>
|
| 148 |
|
|
|
| 149 |
|
|
addStyleSheet(styleSheet1);
|
| 150 |
|
|
addStyleSheet(styleSheet2);
|
| 151 |
|
|
|
| 152 |
|
|
|
| 153 |
|
|
Homepage *sida1 = new HomePage(inparameter);
|
| 154 |
|
|
|
| 155 |
|
|
|
| 156 |
|
|
sida1->addTable();
|
| 157 |
|
|
|
| 158 |
|
|
|
| 159 |
|
|
sida->setTitle("sida1");
|
| 160 |
|
|
sida->setBackGroundColour("ffffff");
|
| 161 |
|
|
|
| 162 |
|
|
|
| 163 |
|
|
sida1->send();
|
| 164 |
|
|
|
| 165 |
|
|
delete sida1;
|
| 166 |
|
|
*/
|
| 167 |
|
|
|
| 168 |
|
|
|
| 169 |
|
|
|