DCL 3.7.4
Loading...
Searching...
No Matches
PageDetailView Class Reference

#include <Page.h>

Inheritance diagram for PageDetailView:
HtmlView TextTemplate Object

Public Member Functions

 PageDetailView (HtmlPage *pPage)
virtual void init (SQLFields &fields) __DCL_THROWS1(Exception *)
virtual void onPrint (Session &session) __DCL_THROWS1(Exception *)
Public Member Functions inherited from HtmlView
const HtmlPagepage () const
String SELF () const
String VNO () const
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

Additional Inherited Members

Static Public Member Functions inherited from HtmlView
static HtmlViewcreateObject (HtmlPage *pPage, int nClassID, int nIndex)
Protected Member Functions inherited from HtmlView
 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 inherited from HtmlView
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 inherited from HtmlView
HtmlPage__pPage
int __nIndex
int __nClassID
StringToStringMap __mapParams
Protected Attributes inherited from TextTemplate
void * __textList
void * __subTemplateMap

Detailed Description

Definition at line 74 of file Page.h.

Constructor & Destructor Documentation

◆ PageDetailView()

PageDetailView::PageDetailView ( HtmlPage * pPage)

Member Function Documentation

◆ init()

void PageDetailView::init ( SQLFields & fields)
virtual

Reimplemented from HtmlView.

Definition at line 622 of file Page.cpp.

624{
625 HtmlView::init(fields);
626
627 __mapParams.lookup(L"LIST", __strListPage);
628 __mapParams.lookup(L"WRITE", __strWritePage);
629}
StringToStringMap __mapParams
Definition HtmlView.h:112
virtual void init(SQLFields &fields) __DCL_THROWS1(Exception *)
Definition HtmlView.cpp:298

◆ onPrint()

void PageDetailView::onPrint ( Session & session)
virtual

Reimplemented from HtmlView.

Definition at line 631 of file Page.cpp.

633{
634 ListedStringToStringArrayMap& mapQuery = session.__ctx.__queryMap;
635 SQLQuery& q = session.__query;
636
637 String strListPage = getDefault(mapQuery, L"list");
638 String strListPageEnc;
639 String strWritePage = __strWritePage;
640 String strPageIDs = String::join(mapQuery[L"_page"], L',', false);
641
642 if (strListPage.isEmpty())
643 strListPage = __strListPage;
644
645 strListPageEnc = URLEncoder::encode(strListPage);
646
647 assign(L"LIST", strListPage);
648 assign(L"_LIST", strListPageEnc);
649 assign(L"WRITE", strWritePage);
650
651 TextTemplate& PAGE = (*this)[L"PAGE"];
652 TextTemplate& EMPTY = (*this)[L"EMPTY"];
653
654 if (strPageIDs.isEmpty()) {
655 EMPTY.assign(L"LIST", strListPage);
656 assign(L"EMPTY", EMPTY);
657 HtmlView::onPrint(session);
658 return;
659 }
660
661 q.execute(L""
662 "SELECT P.PAGE_ID, P.TYPE, P.CHARSET, P.LANGUAGE,"
663 " P.TITLE, P.COMMENT, P.UPDATE_TIME, C.CATEGORY_NAME, R.ROLE_NAME"
664 "\n FROM DCL_PAGE AS P"
665 "\n INNER JOIN DCL_PAGE_CATEGORY AS C ON (P.CATEGORY_ID = C.CATEGORY_ID)"
666 "\n INNER JOIN DCL_ROLE AS R ON (P.PERM_ID = R.ROLE_ID)"
667 "\n WHERE P.PAGE_ID IN (" + strPageIDs + L")"
668 "\n ORDER BY P.PAGE_ID ASC"
669 );
670
671 q.fetch();
672 if (q.eof())
673 assign(L"EMPTY", EMPTY);
674 else {
675 TextTemplate& VIEW = PAGE[L"VIEW"];
676 TextTemplate& V_EMPTY = PAGE[L"EMPTY"];
677 SQLQuery qV(q.connection());
678 qV.prepare(L""
679 "SELECT V.NO, V.CLASS_ID, V.USER_ID, V.DS_ID, V.SKIN_FILE"
680 ", V.PARAMETERS, D.DS_TYPE, D.DS_NAME"
681 "\n FROM DCL_VIEW AS V"
682 "\n INNER JOIN DCL_DATA_SOURCE AS D"
683 "\n ON(V.USER_ID = D.USER_ID AND V.DS_ID = D.DS_ID)"
684 "\n WHERE V.PAGE_ID = :PAGE_ID"
685 "\n ORDER BY V.NO"
686 );
687
688 while(!q.eof())
689 {
690 PAGE.assign(q.fields(), L"&nbsp;");
691 PAGE.assign(L"LIST", strListPage);
692 PAGE.assign(L"_LIST", strListPageEnc);
693 PAGE.assign(L"WRITE", strWritePage);
694
695 StringBuilder strContentType = q.fields().byName(L"TYPE").asString();
696 if (!q.fields().byName(L"CHARSET").isNull()) {
697 strContentType += L"; charset=";
698 strContentType += q.fields().byName(L"CHARSET").asString();
699 }
700 PAGE.assign(L"CONTENT_TYPE", strContentType);
701
702 qV.params()[0].setValue(q.fields().byName(L"PAGE_ID").asInteger());
703 qV.execute();
704 qV.fetch();
705 if (qV.eof())
706 PAGE.assign(L"EMPTY", V_EMPTY);
707 else {
708 while(!qV.eof()) {
709 VIEW.assign(qV.fields(), L"&nbsp;");
710 VIEW.assign(L"CLASS_NAME", HtmlView::className(
711 qV.fields().byName(L"CLASS_ID").asInteger()
712 )
713 );
714 PAGE.append(L"EMPTY", VIEW);
715 qV.fetch();
716 }
717
718 }
719 append(L"EMPTY", PAGE);
720 PAGE.reset();
721 q.fetch();
722 }
723 }
724
725 HtmlView::onPrint(session);
726}
virtual void onPrint(Session &session) __DCL_THROWS1(Exception *)
Definition HtmlView.cpp:349
static String getDefault(ListedStringToStringArrayMap &map, const String &strKey)
Definition HtmlView.cpp:256
String className() const
Definition Object.cpp:163
_CONST SQLField & byName(const wchar_t *_name) _CONST __DCL_THROWS1(InvalidIndexException *)
Definition SQLQuery.cpp:77
_CONST SQLFields & fields() _CONST
Definition SQL.inl:101
void execute() __DCL_THROWS1(SQLException *)
Definition SQLQuery.cpp:316
bool eof() const
Definition SQL.inl:91
SQLConnection * connection() const
Definition SQL.inl:116
void fetch() __DCL_THROWS1(SQLException *)
Definition SQLQuery.cpp:336
HttpServletContextEx & __ctx
Definition Session.h:41
SQLQuery & __query
Definition Session.h:42
static ByteString encode(const ByteString &_str)
Definition URI.cpp:82

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