DCL 3.7.6
Loading...
Searching...
No Matches
HtmlView Class Reference

#include <HtmlView.h>

Inheritance diagram for HtmlView:
TextTemplate Object ClassListView DataSourceDetailView DataSourceListView DialogWrapper ErrorView FormView GroupDetailView GroupListView HeadView MenuView MessageView PageDetailView PageListView PermDeniedView UserActivityView UserDetailView UserListView ZipCodeListView

Public Member Functions

const HtmlPage * page () const
String SELF () const
String VNO () const
virtual void init (SQLFields &fields) __DCL_THROWS1(Exception *)
virtual void onPrint (Session &session) __DCL_THROWS1(Exception *)
virtual void onGet (Session &session) __DCL_THROWS1(Exception *)
virtual void onPost (Session &session) __DCL_THROWS1(Exception *)
Public Member Functions inherited from Object
virtual String toString () const
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Static Public Member Functions

static HtmlView * createObject (HtmlPage *pPage, int nClassID, int nIndex)

Protected Member Functions

 HtmlView (HtmlPage *pPage)
Protected Member Functions inherited from TextTemplate
virtual String onSQLFieldValue (_CONST SQLField &_field, const String &_fieldIsNullValue)
void parseHelper (const char_t *_begin, const char_t *_end)
void parse (const char_t *_begin, const char_t *_end)
int append (const char_t *_name, const String &_value, bool _clearExists)
int append (const char_t *_name, const TextTemplate &_template, bool _clearExists)
int append (const StringStringArray &_nameToValues, bool _clearExists)
int append (_CONST SQLFields &_fields, const String &_fieldIsNullValue, bool _clearExists)
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Static Protected Member Functions

static size_t split (const String &str, StringStringArray &v)
static void dump (Session &session)
static String getDefault (ListedStringToStringArrayMap &map, const String &strKey)
static size_t getShortString (SQLField &field, size_t _len, String &strLong, String &strShort)

Protected Attributes

HtmlPage * __pPage
int __nIndex
int __nClassID
StringToStringMap __mapParams
Protected Attributes inherited from TextTemplate
void * __textList
void * __subTemplateMap

Detailed Description

Definition at line 44 of file HtmlView.h.

Constructor & Destructor Documentation

◆ HtmlView()

HtmlView::HtmlView ( HtmlPage * pPage)
protected

Member Function Documentation

◆ createObject()

HtmlView * HtmlView::createObject ( HtmlPage * pPage,
int nClassID,
int nIndex )
static

Definition at line 126 of file HtmlView.cpp.

128{
129 const CLASS_INFO* pInfo = getClassInfo(nClassID);
130 if (!pInfo) {
131 // invalid nClassID
132 __DCL_TRACE1(L"nClassID: %d\n", nClassID);
133 pInfo = &__aClasses[0];
134 }
135
136 HtmlView* pNew = pInfo->pfnCreateObject(pPage);
137 pNew->__nClassID = nClassID;
138 pNew->__nIndex = nIndex;
139
140 return pNew;
141}
#define __DCL_TRACE1(fmt, arg1)
Definition Object.h:401
HtmlView(HtmlPage *pPage)
int __nClassID
Definition HtmlView.h:110
int __nIndex
Definition HtmlView.h:109

◆ dump()

void HtmlView::dump ( Session & session)
staticprotected

Definition at line 164 of file HtmlView.cpp.

165{
166 HttpServletContextEx& ctx = session.__ctx;
167 Writer& out = ctx.writer();
168
169 out << L"<pre>\n";
170
171 out << L"PID : " << getpid() << L"\n";
172
173/*
174 out << L"SERVER CONFIG\n";
175 out << L"fileName : " << session.__pServlet->__strFileName << L"\n";
176 out << L"configDir : " << session.__pServlet->__strConfigDir << L"\n";
177 out << L"tempDir : " << session.__pServlet->__strTempDir << L"\n";
178 out << L"\n\n";
179*/
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";
184 if (ctx.method())
185 out << L"method : " << ctx.method() << L"\n";
186 out << L"remoteMethodNo : " << (int)ctx.methodNo() << L"\n";
187 if (ctx.path())
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";
194 out << L"\n\n";
195
196 out << L"CGI VARIABLES\n"
197 << ctx.getCgiVariable((const wchar_t*)NULL)
198 << L"\n\n";
199
200 out << L"REQUEST HTTP HEADERS\n"
201 << ctx.getHttpHeader((const wchar_t*)NULL)
202 << L"\n\n";
203
204 out << L"COOKIES\n";
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";
209 }
210 }
211 out << L"\n\n";
212
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)
219 << L"\n";
220 }
221 }
222 out << L"\n\n";
223
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)
230 << L"\n";
231 }
232 }
233 out << L"\n\n";
234
235 out << L"FILES\n";
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
247 << L"\n";
248 }
249 }
250 }
251 out << L"\n\n";
252
253 out << L"</pre>\n";
254}
#define NULL
Definition Config.h:316
StringWriter & writer()
HttpServletContextEx & __ctx
Definition Session.h:41

◆ getDefault()

String HtmlView::getDefault ( ListedStringToStringArrayMap & map,
const String & strKey )
staticprotected

Definition at line 256 of file HtmlView.cpp.

258{
259 String strResult;
260 ListedStringToStringArrayMap::ConstIterator it = map.find(strKey);
261 if (it != map.end() && (*it).value.size() > 0)
262 strResult = (*it).value[0];
263 return strResult;
264}

◆ getShortString()

size_t HtmlView::getShortString ( SQLField & field,
size_t _len,
String & strLong,
String & strShort )
staticprotected

Definition at line 266 of file HtmlView.cpp.

268{
269 __DCL_ASSERT(nMbLength > 0);
270 __DCL_ASSERT(field.dataType() == SQL::typeText
271 || field.dataType() == SQL::typeLongText
272 || field.dataType() == SQL::typeClob);
273
274 if (field.isNull() || field.dataSize() == 0)
275 return 0;
276
277 strLong = field.asString();
278 size_t nResult = strLong.length();
279 if (nResult > nMbLength)
280 strShort = strLong.left(nMbLength) + L"...";
281 else
282 strShort = strLong;
283
284 return nResult;
285}
#define __DCL_ASSERT(expr)
Definition Object.h:396
@ typeClob
Definition SQLCore.h:77
@ typeText
Definition SQLCore.h:73
@ typeLongText
Definition SQLCore.h:75

◆ init()

void HtmlView::init ( SQLFields & fields)
virtual

Reimplemented in DialogWrapper, MessageDetailView, MessageView, MessageWriteForm, PageDetailView, PageListView, and PageWriteForm.

Definition at line 298 of file HtmlView.cpp.

300{
301 const String& strSkinDir = __pPage->site()->strSkinDir;
302
303#ifdef __DCL_DEBUG
304 DateTime dtStart = DateTime::getCurrentLocalTime();
305#endif
306 SQLField& fSKIN_FILE = fields.byName(L"SKIN_FILE");
307 if (!fSKIN_FILE.isNull()) {
308 String filename = strSkinDir + fSKIN_FILE.asString();
309 UTF8Decoder dec;
310 TextTemplate::parse(Files::readText(filename, dec));
311 }
312 __DCL_TRACE2(L"skin:%d: %ls\n", __nIndex, (DateTime::getCurrentLocalTime() - dtStart).toString().data());
313
314#ifdef __DCL_DEBUG
315 __strParams.clear();
316#endif
317 SQLField& fPARAMS = fields.byName(L"PARAMETERS");
318 if (!fPARAMS.isNull()) {
319 String strParams = fPARAMS.asString();
320#ifdef __DCL_DEBUG
321 __strParams = strParams;
322#endif
323 StringArray rList;
324 if (strParams.split(L';', rList) > 0) {
325// __mapParams.initBuckets(rList.size());
326 StringArray::Iterator itList = rList.begin();
327 for(; itList != rList.end(); itList++) {
328 String strName;
329 String strValue;
330
331 StringArray rPair;
332 (*itList).split(L'=', rPair);
333 StringArray::Iterator itPair = rPair.begin();
334 if (itPair != rPair.end())
335 strName = *itPair++;
336 if (itPair != rPair.end())
337 strValue = *itPair;
338
339 strName.trim();
340 strValue.trim();
341
342 if (!strName.isEmpty())
343 __mapParams[strName.toUpperCase()] = strValue;
344 }
345 }
346 }
347}
#define __DCL_TRACE2(fmt, arg1, arg2)
Definition Object.h:402
static DateTime getCurrentLocalTime()
Definition DateTime.cpp:954
static String readText(const String &_filename) __DCL_THROWS1(IOException *)
Definition Files.cpp:435
StringToStringMap __mapParams
Definition HtmlView.h:112
HtmlPage * __pPage
Definition HtmlView.h:108
virtual String toString() const
Definition Object.cpp:187
_CONST SQLField & byName(const wchar_t *_name) _CONST __DCL_THROWS1(InvalidIndexException *)
Definition SQLQuery.cpp:77

◆ onGet()

void HtmlView::onGet ( Session & session)
virtual

Reimplemented in MessageDetailView.

Definition at line 373 of file HtmlView.cpp.

375{
376 // 파생된 클래스에서 오버라이드 하지 않았다.
377 session.__ctx.setStatusCode(HTTP_STATUS_NOT_FOUND);
378}
@ HTTP_STATUS_NOT_FOUND

◆ onPost()

void HtmlView::onPost ( Session & session)
virtual

Reimplemented in MessageWriteForm, PageCategoryForm, and PageWriteForm.

Definition at line 381 of file HtmlView.cpp.

383{
384 // 파생된 클래스에서 오버라이드 하지 않았다.
385 session.__ctx.setStatusCode(HTTP_STATUS_NOT_FOUND);
386}

◆ onPrint()

void HtmlView::onPrint ( Session & session)
virtual

Reimplemented in DialogWrapper, MessageDetailView, MessageView, MessageWriteForm, PageCategoryForm, PageDetailView, PageListView, and PageWriteForm.

Definition at line 349 of file HtmlView.cpp.

351{
352 assign(L"_TITLE", __pPage->__strTitle);
353 assign(L"_PAGE", __pPage->__strPageID);
354 assign(L"VNO", VNO());
355
356 assign(L"VERSION",
357 String::format(L"DCL %d.%d / HSE %d.%d / FastPage %d.%d",
361 )
362 );
363#ifdef __DCL_DEBUG
364 assign(L"_CLASS", Object::className());
365 assign(L"_PARAMS", __strParams);
366#endif
367
368 TextTemplate::printTo(
369 session.__ctx.writer()
370 );
371}
String VNO() const
Definition HtmlView.cpp:293
String className() const
Definition Object.cpp:163
#define DCL_FASTPAGE_VERSION
#define DCL_HTTP_VERSION
#define __VERSION_MINOR(_x)
#define __VERSION_MAJOR(_x)
#define DCL_VERSION

◆ page()

const HtmlPage * HtmlView::page ( ) const
inline

Definition at line 118 of file HtmlView.h.

118{ return __pPage; }

◆ SELF()

String HtmlView::SELF ( ) const

Definition at line 287 of file HtmlView.cpp.

288{
289 return L"page=" + String::valueOf(__pPage->__nPageID)
290 + L"&view=" + VNO();
291}

◆ split()

size_t HtmlView::split ( const String & str,
StringStringArray & v )
staticprotected

Definition at line 143 of file HtmlView.cpp.

144{
145 StringArray list;
146 if (str.split(L';', list) > 0) {
147 StringArray::Iterator it = list.begin();
148 for(; it != list.end(); it++) {
149 StringArray pair;
150 if ((*it).split(L'=', pair) == 2) {
151 StringArray::Iterator itPair = pair.begin();
152 String strName = *itPair++;
153 String strValue = *itPair;
154
155 strName.trim();
156 strValue.trim();
157 v.add(StringString(strName, strValue));
158 }
159 }
160 }
161 return v.size();
162}

◆ VNO()

String HtmlView::VNO ( ) const

Definition at line 293 of file HtmlView.cpp.

294{
295 return String::valueOf(__nIndex + 1);
296}

Member Data Documentation

◆ __mapParams

StringToStringMap HtmlView::__mapParams
protected

Definition at line 112 of file HtmlView.h.

◆ __nClassID

int HtmlView::__nClassID
protected

Definition at line 110 of file HtmlView.h.

◆ __nIndex

int HtmlView::__nIndex
protected

Definition at line 109 of file HtmlView.h.

◆ __pPage

HtmlPage* HtmlView::__pPage
protected

Definition at line 108 of file HtmlView.h.


The documentation for this class was generated from the following files: