29#if __DCL_HAVE_THIS_FILE__
36#define __CLASS(class_name) \
37 __DCL_NAMESPACE_STRING # class_name, class_name::createObject
39const HtmlView::CLASS_INFO HtmlView::__aClasses[] =
74const int HtmlView::__nClassCount
75 =
sizeof(HtmlView::__aClasses) /
sizeof(HtmlView::CLASS_INFO);
85static int __compare(
const void* key,
const void* element)
87 int nClassID = (int)(
size_t)key;
88 const HtmlView::CLASS_INFO* pInfo = (
const HtmlView::CLASS_INFO*)element;
89 return nClassID - pInfo->nClassID;
92const HtmlView::CLASS_INFO* HtmlView::getClassInfo(
int nClassID)
103 return (
const HtmlView::CLASS_INFO*)bsearch(
104 (
void*)(
size_t)nClassID,
107 sizeof(HtmlView::CLASS_INFO),
112const wchar_t* HtmlView::CLASS_INFO::className()
const
119 const CLASS_INFO* pInfo = getClassInfo(nClassID);
121 return pInfo->pszClassName;
123 return L
"Invalid ClassID";
129 const CLASS_INFO* pInfo = getClassInfo(nClassID);
133 pInfo = &__aClasses[0];
136 HtmlView* pNew = pInfo->pfnCreateObject(pPage);
146 if (str.split(L
';', list) > 0) {
147 StringArray::Iterator it = list.begin();
148 for(; it != list.end(); it++) {
150 if ((*it).split(L
'=', pair) == 2) {
151 StringArray::Iterator itPair = pair.begin();
152 String strName = *itPair++;
153 String strValue = *itPair;
171 out << L
"PID : " << getpid() << L
"\n";
180 out << L
"CONTEXT INFO\n";
181 if (ctx.remoteAddr())
182 out << L
"remoteAddr : " << ctx.remoteAddr() << L
"\n";
183 out << L
"remotePort : " << (int)ctx.remotePort() << L
"\n";
185 out << L
"method : " << ctx.method() << L
"\n";
186 out << L
"remoteMethodNo : " << (int)ctx.methodNo() << L
"\n";
188 out << L
"path : " << ctx.path() << L
"\n";
189 if (ctx.queryString())
190 out << L
"queryString : " << ctx.queryString() << L
"\n";
191 if (ctx.contentType())
192 out << L
"contentType : " << ctx.contentType() << L
"\n";
193 out << L
"contentLength: " << ctx.contentLength() << L
"\n";
196 out << L
"CGI VARIABLES\n"
197 << ctx.getCgiVariable((
const wchar_t*)
NULL)
200 out << L
"REQUEST HTTP HEADERS\n"
201 << ctx.getHttpHeader((
const wchar_t*)
NULL)
205 if (!ctx.__cookieMap.isEmpty()) {
206 ListedStringToStringMap::Iterator it = ctx.__cookieMap.begin();
207 for(; it != ctx.__cookieMap.end(); it++) {
208 out << (*it).key << L
":" << (*it).value << L
"\n";
213 out << L
"QUERY_STRING\n";
214 if (!ctx.__queryMap.isEmpty()) {
215 ListedStringToStringArrayMap::Iterator it = ctx.__queryMap.begin();
216 for( ; it != ctx.__queryMap.end(); it++) {
217 out << (*it).key << L
":"
218 << String::join((*it).value, L
',',
true)
224 out << L
"FORM_DATA\n";
225 if (!ctx.__formMap.isEmpty()) {
226 ListedStringToStringArrayMap::Iterator it = ctx.__formMap.begin();
227 for( ; it != ctx.__formMap.end(); it++) {
228 out << (*it).key << L
":"
229 << String::join((*it).value, L
',',
true)
236 if (!ctx.__formFileMap.
isEmpty()) {
237 for(
size_t i = 0; i < ctx.__formFileMap.
size(); i++) {
238 StoredHttpFormData::FileInfoArray& v = ctx.__formFileMap[i];
239 out << v.name() << L
":";
240 for(
size_t j = 0; j < v.size(); j++) {
241 StoredHttpFormData::FileInfo& info = v[j];
242 out << L
"\n\tfilename: " << info.filename
243 << L
"\n\tfilesize: " << info.fileSize
244 << L
"\n\tContent-Type: " << info.contentType
245 << L
"\n\tContent-Transfer-Encoding: " << info.transferEncoding
246 << L
"\n\ttemp filename: " << info.tempFilename
257 const String& strKey)
260 ListedStringToStringArrayMap::ConstIterator it = map.find(strKey);
261 if (it != map.end() && (*it).value.size() > 0)
262 strResult = (*it).value[0];
267 String& strLong, String& strShort)
274 if (field.isNull() || field.dataSize() == 0)
277 strLong = field.asString();
278 size_t nResult = strLong.length();
279 if (nResult > nMbLength)
280 strShort = strLong.left(nMbLength) + L
"...";
289 return L
"page=" + String::valueOf(
__pPage->__nPageID)
295 return String::valueOf(
__nIndex + 1);
301 const String& strSkinDir =
__pPage->site()->strSkinDir;
306 SQLField& fSKIN_FILE = fields.byName(L
"SKIN_FILE");
307 if (!fSKIN_FILE.isNull()) {
308 String filename = strSkinDir + fSKIN_FILE.asString();
317 SQLField& fPARAMS = fields.byName(L
"PARAMETERS");
318 if (!fPARAMS.isNull()) {
319 String strParams = fPARAMS.asString();
321 __strParams = strParams;
324 if (strParams.split(L
';', rList) > 0) {
326 StringArray::Iterator itList = rList.begin();
327 for(; itList != rList.end(); itList++) {
332 (*itList).split(L
'=', rPair);
333 StringArray::Iterator itPair = rPair.begin();
334 if (itPair != rPair.end())
336 if (itPair != rPair.end())
342 if (!strName.isEmpty())
352 assign(L
"_TITLE",
__pPage->__strTitle);
353 assign(L
"_PAGE",
__pPage->__strPageID);
354 assign(L
"VNO",
VNO());
357 String::format(L
"DCL %d.%d / HSE %d.%d / FastPage %d.%d",
365 assign(L
"_PARAMS", __strParams);
368 TextTemplate::printTo(
369 session.__ctx.writer()
395void FormView::onPrint(
Session& session)
400 StringBuilder strNext;
401 ListedStringToStringArrayMap::ConstIterator it = ctx.__queryMap.find(L
"next");
402 if (it != ctx.__queryMap.end() && (*it).value.size() > 0)
407 it = ctx.__queryMap.find(L
"list");
408 if (it != ctx.__queryMap.end())
412 ListedStringToStringArrayMap::ConstIterator itForm = ctx.__formMap.find(L
"REFERER");
413 if (itForm != ctx.__formMap.end() && (*itForm).value.size() > 0)
414 strReferer = (*itForm).value[0];
416 strReferer = ctx.getHttpHeader(L
"Referer");
419 assign(L
"REFERER", strReferer);
422 assign(L
"SELF", SELF());
423 if (!strNext.isEmpty())
424 append(L
"ACTION", strNext);
434 ListedStringToStringArrayMap::ConstIterator it = ctx.__queryMap.find(L
"next");
435 if (it != ctx.__queryMap.end() && (*it).value.size() > 0)
436 strNext = (*it).value[0];
438 it = ctx.__formMap.find(L
"REFERER");
439 if (it != ctx.__formMap.end() && (*it).value.size() > 0)
440 strNext = (*it).value[0];
445 __pPage->refresh(session, strNext);
450ErrorView::ErrorView(
HtmlPage* pPage)
457PermDeniedView::PermDeniedView(
HtmlPage* pPage)
462void PermDeniedView::onPrint(
Session& session)
467 StringBuilder strNext = L
"?";
468 if (ctx.queryString())
469 strNext += ctx.queryString();
483void HeadView::onPrint(
Session& session)
490void HeadView::__onPrint(
HtmlView* pView)
495 const HtmlPage* pPage = pView->page();
497 String strCharset = L
"utf-8";
498 String strEncoding = L
"UTF-8";
499 String strLang = L
"ko";
503 strEncoding = strCharset.toUpperCase();
508 pView->assign(L
"ENCODING", strEncoding);
509 pView->assign(L
"TYPE", pPage->
__strType);
510 pView->assign(L
"CHARSET", strCharset);
511 pView->assign(L
"LANG", strLang);
522void SignForm::onPrint(
Session& session)
525 SignForm::__onPrint(
this, session);
526 FormView::onPrint(session);
529void SignForm::onGet(
Session& session)
532 SignForm::__onGet(
this, session);
535static const wchar_t* P_LOGIN_ID = L
"LOGIN_ID";
536static const wchar_t* P_PASSWORD = L
"PASSWORD";
537void SignForm::onPost(
Session& session)
540 SignForm::__onPost(
this, session);
541 FormView::onPost(session);
550 if (session.isSysGuest())
551 pView->assign(L
"SIGN_IN", SIGN_IN);
553 StringBuilder strUserName = session.__strUserName;
554 if (session.isSysAdmin())
555 strUserName += L
"(" + session.__strRoleName + L
")";
556 SIGN_OUT.assign(L
"USER_NAME", strUserName);
558 SIGN_OUT.assign(L
"SELF", pView->SELF());
559 pView->assign(L
"SIGN_OUT", SIGN_OUT);
566 const HtmlPage* pPage = pView->page();
568 pPage->
refresh(session, L
"?page=", 0);
574 const HtmlPage* pPage = pView->page();
577 ListedStringToStringArrayMap::ConstIterator it =
578 ctx.__formMap.find(P_LOGIN_ID);
579 if (it != ctx.__formMap.end()) {
584 if ((*it).value.size() > 0)
585 strLoginID = (*it).value[0].toLowerCase();
589 if (!strLoginID.isEmpty()) {
590 if (session.login(strLoginID, strPassword)) {
592 L
"LOGIN_ID: %ls, PASSWORD: %ls\n",
609 __strHeight = __strWidth = L
"100%";
618 if (
__mapParams.lookup(L
"WIDTH", rValue) && !rValue.isEmpty())
621 if (
__mapParams.lookup(L
"HEIGHT", rValue) && !rValue.isEmpty())
622 __strHeight = rValue;
625 __strInnerPageID = rValue;
631 assign(L
"PAGE_ID", __strInnerPageID);
632 assign(L
"WIDTH", __strWidth);
633 assign(L
"HEIGHT", __strHeight);
#define __CLASS(class_name)
#define IMPLEMENT_CLASSINFO_EX(class_name, base_class_name)
#define __DCL_TRACE1(fmt, arg1)
#define __DCL_ASSERT(expr)
#define __DCL_TRACE2(fmt, arg1, arg2)
static DateTime getCurrentLocalTime()
DialogWrapper(HtmlPage *pPage)
virtual void init(SQLFields &fields) __DCL_THROWS1(Exception *)
virtual void onPrint(Session &session) __DCL_THROWS1(Exception *)
static String readText(const String &_filename) __DCL_THROWS1(IOException *)
void refresh(Session &session, const String &strURI, unsigned int nAfterSecond=0) const __DCL_THROWS1(Exception *)
virtual void onPost(Session &session) __DCL_THROWS1(Exception *)
HtmlView(HtmlPage *pPage)
virtual void onGet(Session &session) __DCL_THROWS1(Exception *)
StringToStringMap __mapParams
static void dump(Session &session)
virtual void onPrint(Session &session) __DCL_THROWS1(Exception *)
static String getDefault(ListedStringToStringArrayMap &map, const String &strKey)
static HtmlView * createObject(HtmlPage *pPage, int nClassID, int nIndex)
static size_t split(const String &str, StringStringArray &v)
virtual void init(SQLFields &fields) __DCL_THROWS1(Exception *)
static size_t getShortString(SQLField &field, size_t _len, String &strLong, String &strShort)
virtual String toString() const
HttpServletContextEx & __ctx
static ByteString encode(const ByteString &_str)
#define DCL_FASTPAGE_VERSION
#define __VERSION_MINOR(_x)
#define __VERSION_MAJOR(_x)