Пример #1
0
void CSVSortList::createContent()
{
    int nRow = numRows();
    WTable * pTable = new WTable(elementAt(nRow,0));	
    if(pTable)
    {
        pTable->setCellPadding(0);
        pTable->setCellSpaceing(0);

        WScrollArea * pScrollArea = new WScrollArea(elementAt(nRow,0));
        if(pScrollArea)
        {
            pScrollArea->setStyleClass("t5"); 
            pScrollArea->setWidget(pTable);
        }
        pTable->setStyleClass("t5"); 
        elementAt(nRow, 0)->setStyleClass("t7");

        nRow = pTable->numRows();
        m_pContent = new WTable(pTable->elementAt(nRow,0));
        pTable->elementAt(nRow,0)->setContentAlignment(AlignTop);
    }

    if(m_pContent)
    {
        m_pContent->setStyleClass("t3");
        nRow = m_pContent->numRows();
        new WText(SVResString::getResString("IDS_Name"), m_pContent->elementAt(nRow, 0));
        new WText(SVResString::getResString("IDS_Sort"), m_pContent->elementAt(nRow, 1));
        m_pContent->GetRow(0)->setStyleClass("t3title");
    }
}
Пример #2
0
void SVSEView::createSEList()
{
    int nRow  = numRows();
    SVShowTable * pTable = new SVShowTable((WContainerWidget*)elementAt(nRow, 0));
    if(pTable)
    {
        pTable->setTitle(SVResString::getResString("IDS_SE_List_Title").c_str());
        WTable * pSub = pTable->createSubTable();
        if(pSub)
        {
            int nRow = pSub->numRows();
            m_pSEList = new WTable((WContainerWidget*)pSub->elementAt(nRow, 0));
            if(m_pSEList)
            {
                m_pSEList->setStyleClass("t3");
                //new WText("", (WContainerWidget *)m_pSEList->elementAt(0, 0));
                new WText(SVResString::getResString("IDS_State_Description"), (WContainerWidget *)m_pSEList->elementAt(0, 0));
                new WText(SVResString::getResString("IDS_Name"), (WContainerWidget *)m_pSEList->elementAt(0, 1));
                new WText(SVResString::getResString("IDS_Edit"), (WContainerWidget *)m_pSEList->elementAt(0, 2));
                m_pSEList->setCellPadding(0);
                m_pSEList->setCellSpaceing(0);
                m_pSEList->GetRow(0)->setStyleClass("t3title");

                connect(&m_wNameMapper, SIGNAL(mapped(const std::string)), this, SLOT(enterSVSE(const std::string)));
                connect(&m_wEditMapper, SIGNAL(mapped(const std::string)), this, SLOT(EditSE(const std::string)));
            }
            //createOperate(pSub);
        }
    }
}
Пример #3
0
void SVSEView::createTitle()
{
    int nRow = numRows();
    WTable *pSub = new WTable(elementAt(nRow, 0));
    elementAt(nRow, 0)->setStyleClass("t1title");
    if(pSub)
    {
        pSub->setStyleClass("t3");
        nRow = pSub->numRows();
        WText *pTitle = new WText(SVResString::getResString("IDS_SE_List_Title"), (WContainerWidget*)pSub->elementAt(nRow, 0));
        if(pTitle)
            pTitle->setStyleClass("tgrouptitle2");
        pSub->elementAt(nRow, 0)->setStyleClass("cell_80");
        m_pTime  = new WText("local time", pSub->elementAt(nRow, 1));
        pSub->elementAt(nRow, 1)->setContentAlignment(AlignRight | AlignCenter);
        svutil::TTime ttime = svutil::TTime::GetCurrentTimeEx();
        string curTime = ttime.Format();
        if(m_pTime)
        {
            m_pTime->setStyleClass("tgrouptitle2");
            m_pTime->setText(SVResString::getResString("IDS_Refresh_Time") + curTime);
        }
    }
}
Пример #4
0
//添加栏目内容-->标题、输入控件、帮助、错误信息 (多项怎么办?输入控件怎么定位?帮助、错误信息必须放到统一的数组中?)--->由此函数解决
WContainerWidget * WSVFlexTable::AppendRowsContent(int nRow, string strLabel, string strDes, string strError, bool noBlank)
{
	//取出指定栏目的Table
	WTable * pRowTable = NULL;
	WContainerWidget * pParentCell = NULL;

	//
	if(nRow > m_pListRowTable.size())
	{
		for (unsigned i = nRow; i > m_pListRowTable.size() ; --i)
		{
			AppendRows("");

			//此情况应该无效或不会出现, 暂时先这样处理
		}
	}
	else
	{
		//
	}

	pRowTable = m_pListRowTable[nRow];
	int iLast = pRowTable->numRows();	
	
	//标题 WText
	iLast++;
	if (noBlank)
	{
		strLabel += "<font color=red>*</font>";
	}
	new WText(strLabel, pRowTable->elementAt(iLast, 0));
	strcpy(pRowTable->elementAt(iLast, 0)->contextmenu_,"nowrap");
	pRowTable->elementAt(iLast, 0)->setStyleClass("width120");

	//输入控件
	pParentCell = pRowTable->elementAt(iLast, 1);
	strcpy(pRowTable->elementAt(iLast, 1)->contextmenu_,"nowrap");
	//pRowTable->elementAt(iLast, 1)->setStyleClass("table_gruop_item");
	
	//帮助 WText
	if(strDes != "")
	{
		iLast++;
		
		m_pListHelpText.push_back(new WText(strDes, pRowTable->elementAt(iLast, 1)));
		
		//strcpy(pRowTable->elementAt(iLast, 1)->contextmenu_,"nowrap");
		pRowTable->elementAt(iLast, 1)->setStyleClass("table_data_input_des");		
	}
	
	//错误信息 WText
	if(strError != "")
	{
		iLast++;
		
		m_pListErrorText.push_back(new WText(strError, pRowTable->elementAt(iLast, 1)));
		
		strcpy(pRowTable->elementAt(iLast, 1)->contextmenu_,"nowrap");
		pRowTable->elementAt(iLast, 1)->setStyleClass("table_data_input_error");
	}

	return pParentCell;
}
Пример #5
0
void CSVWholeview::enumSVSE()
{
    if(!m_pContent)
        return;

    PAIRLIST selist;
    string szRootname("");
    int nRow = 0;

    WTable *pTable = m_pContent;
    if(GetIniFileInt("solover","solover",1,"general.ini") == 1)
    {       
        sv_pair svpair;
        svpair.name = "1";
        OBJECT objSE = GetSVSE("1");//, m_szIDCUser, m_szIDCPwd);
        if(objSE != INVALID_VALUE)
        {
            svpair.value = GetSVSELabel(objSE);
            CloseSVSE(objSE);
        }        
        selist.push_back(svpair);
    }
    else
    {
        GetAllSVSEInfo(selist);
        szRootname = GetIniFileString("segroup","name","","general.ini");
        if(szRootname.empty())
            szRootname = "SiteView ECC 7.0";        
        nRow = m_pContent->numRows();
        //WImage *pShow = new WImage("../Images/foldopen.gif", m_pContent->elementAt(nRow, 0));
        //WImage *pHide = new WImage("../Images/foldclose.gif", m_pContent->elementAt(nRow, 0));
        WImage *pShow = new WImage("/Images/cb1-unwrap.gif", m_pContent->elementAt(nRow, 0));
        WImage *pHide = new WImage("/Images/cb1-fold.gif", m_pContent->elementAt(nRow, 0));

		new WText("&nbsp;",m_pContent->elementAt(nRow, 0));

        //new WImage("../Images/home.gif", m_pContent->elementAt(nRow, 1));
		new WImage("/Images/cbb-2main.gif", m_pContent->elementAt(nRow, 1));

		new WText("&nbsp;",m_pContent->elementAt(nRow, 1));

        WText *pName = new WText(szRootname, m_pContent->elementAt(nRow, 2));
        if(pName)
        {
            sprintf(pName->contextmenu_, "style='color:#669;cursor:pointer;' onmouseover='" \
                "this.style.textDecoration=\"underline\"' " \
                "onmouseout='this.style.textDecoration=\"none\"'");
        }
        pTable = new WTable(m_pContent->elementAt(nRow + 1, 2));
		pTable->setStyleClass("widthauto");
        if(!pTable)
            return;
        else
        {
            if(pShow && pHide)
            {
                string szShow = "", szHide = "", szSubTable = "";
                szShow = pHide->formName();
                szHide = pShow->formName();
                szSubTable = pTable->formName();

                string szShowText = "onclick='showsubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='display:none;cursor:pointer'";
                string szHideText = "onclick='hidesubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='cursor:pointer'";
                sprintf(pShow->contextmenu_, szShowText.c_str());
                sprintf(pHide->contextmenu_, szHideText.c_str());            
            }
        }
    }

    PAIRLIST::iterator iSe;
    
    bool bHasRight = true;

    int  nChildCount = 0, nIndex = 0;

    OBJECT objSE = INVALID_VALUE;
    OBJECT objGroup = INVALID_VALUE;
    MAPNODE node = INVALID_VALUE;

    string szSEID(""), szSubGroupID(""), szEntityID("");
    string szName(""), szIndex("");
    string szContext(""), szShow(""), szHide(""), szSubTable("");
    string szShowText(""), szHideText("");

    list<string> lsGroupID;
    list<string> lsDeviceID;
    list<string>::iterator lstItem;

    for(iSe= selist.begin(); iSe!=selist.end(); iSe++)
    {
        szSEID = (*iSe).name;
        bHasRight = true;
        if(m_pSVUser)
            bHasRight = m_pSVUser->haveGroupRight(szSEID, Tree_SE);
        if(bHasRight)
        {
            nRow = pTable->numRows();
            //WImage *pShow = new WImage("../Images/foldopen.gif", pTable->elementAt(nRow, 0));
            //WImage *pHide = new WImage("../Images/foldclose.gif", pTable->elementAt(nRow, 0));
            WImage *pShow = new WImage("/Images/cb1-unwrap.gif", pTable->elementAt(nRow, 0));
            WImage *pHide = new WImage("/Images/cb1-fold.gif", pTable->elementAt(nRow, 0));
           
			new WText("&nbsp;",pTable->elementAt(nRow, 0));

			new WImage("/Images/cbb-2main.gif", pTable->elementAt(nRow, 1));

			new WText("&nbsp;",pTable->elementAt(nRow, 1));

            WText *pName = new WText((*iSe).value, pTable->elementAt(nRow, 2));
            if(pName)
            {
                szContext = "onclick='parent.document.frames(\"left\").location.replace(\"/fcgi-bin/menu.exe?cmd=treeview.exe?svseid=" + szSEID 
                    + "\");' style='color:#669;cursor:pointer;' onmouseover='this.style.textDecoration=\"underline\"'"
                    + "onmouseout='this.style.textDecoration=\"none\"'";
                sprintf(pName->contextmenu_, szContext.c_str());
            }
            WTable *pSubTable = new WTable(pTable->elementAt(nRow + 1, 2));
			pSubTable->setStyleClass("widthauto");
            if(!pSubTable)
                return;
            else
            {
                if(pShow && pHide)
                {                    
                    szShow = pHide->formName();
                    szHide = pShow->formName();
                    szSubTable = pSubTable->formName();

                    szShowText = "onclick='showsubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='display:none;cursor:pointer'";
                    szHideText = "onclick='hidesubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='cursor:pointer'";
                    sprintf(pShow->contextmenu_, szShowText.c_str());
                    sprintf(pHide->contextmenu_, szHideText.c_str());            
                }
            }
            
            objSE = GetSVSE(szSEID);
            if(objSE != INVALID_VALUE)
            {
                lsGroupID.clear();
                if(GetSubGroupsIDBySE(objSE, lsGroupID))
			    {
                    map<int, base_param, less<int> > sortList;
                    map<int, base_param, less<int> >::iterator lsItem;
					map<int, base_param, less<int> >::iterator compItem;

                    base_param group;

                    for(lstItem = lsGroupID.begin(); lstItem != lsGroupID.end(); lstItem ++)
                    {
                        szSubGroupID =(*lstItem);
                        bHasRight = true;
                        if(m_pSVUser)
                            bHasRight = m_pSVUser->haveGroupRight(szSubGroupID, Tree_GROUP);
                        if(bHasRight)
                        {
                            objGroup = GetGroup(szSubGroupID, m_szIDCUser, m_szIDCPwd);
                            if(objGroup != INVALID_VALUE)
                            {
                                node = GetGroupMainAttribNode(objGroup);
                                if(node != INVALID_VALUE)
                                {
                                    FindNodeValue(node, "sv_name", szName);
                                    FindNodeValue(node, "sv_index", szIndex);

                                    if(szIndex.empty())
                                        nIndex = FindIndexByID(szSubGroupID);
                                    else
                                        nIndex = atoi(szIndex.c_str());

                                    group.szIndex = szSubGroupID;
                                    group.szName = szName;

                                    lsItem = sortList.find(nIndex);
                                    while(lsItem != sortList.end())
                                    {
                                        nIndex ++;
                                        lsItem = sortList.find(nIndex);
                                    }
                                    sortList[nIndex] = group;
                                }
                                CloseGroup(objGroup);
                            }
                        }
                    }
                    nChildCount += static_cast<int>(sortList.size());

                    for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++)
                    {
						//PrintDebugString("In first setting ---------" + lsItem->second.szName + "\n");
						//bool bbbb = false;
                        nRow = pSubTable->numRows();
					    WImage *pShow = new WImage("/Images/cb1-unwrap.gif", pSubTable->elementAt(nRow, 0));
					    WImage *pHide = new WImage("/Images/cb1-fold.gif", pSubTable->elementAt(nRow, 0));

						new WText("&nbsp;",pSubTable->elementAt(nRow, 0));

						new WImage("/Images/cbb-3group.gif", pSubTable->elementAt(nRow, 1));

						new WText("&nbsp;",pSubTable->elementAt(nRow, 1));

                        WText *pName = new WText(lsItem->second.szName, pSubTable->elementAt(nRow, 2));
                        if(pName)
                        {
                            string szContext = "onclick='parent.document.frames(\"left\").location.replace(\"/fcgi-bin/menu.exe?cmd=treeview.exe?groupid=" + lsItem->second.szIndex 
                                + "\");' style='color:#669;cursor:pointer;' onmouseover='this.style.textDecoration=\"underline\"'"
                                + "onmouseout='this.style.textDecoration=\"none\"'";
                            sprintf(pName->contextmenu_, szContext.c_str());
                        }
                        WTable * pSub = new WTable(pSubTable->elementAt(nRow + 1, 2));
                        if(pSub)
                        {                        
                            if(pShow && pHide)
                            {
                                szShow = pHide->formName();
                                szHide = pShow->formName();
                                szSubTable = pSub->formName();

                                string szShowText = "onclick='showsubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='display:none;cursor:pointer'";
                                string szHideText = "onclick='hidesubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='cursor:pointer'";
                                sprintf(pShow->contextmenu_, szShowText.c_str());
                                sprintf(pHide->contextmenu_, szHideText.c_str());            
                            }
                            if(!enumGroups(lsItem->second.szIndex, pSub))
							{
								//bbbb = true;
                                //pSubTable->deleteRow(nRow);
								pShow->hide();
								pHide->hide();

							}
                        }
                    }

                }
                lsDeviceID.clear();
                if(GetSubEntitysIDBySE(objSE, lsDeviceID))
                {
                    map<int, base_param, less<int> > sortList;
                    map<int, base_param, less<int> >::iterator lsItem;
                    base_param device;
                    for(lstItem = lsDeviceID.begin(); lstItem != lsDeviceID.end(); lstItem ++)
                    {
                        szEntityID =(*lstItem);
                        bHasRight = true;
                        if(m_pSVUser)
                            bHasRight = m_pSVUser->haveGroupRight(szEntityID, Tree_DEVICE);
                        if(bHasRight)
                        {
                            OBJECT objDevice = GetEntity(szEntityID, m_szIDCUser, m_szIDCPwd);
                            if(objDevice != INVALID_VALUE)
                            {
                                MAPNODE node = GetEntityMainAttribNode(objDevice);
                                if(node != INVALID_VALUE)
                                {
                                    FindNodeValue(node, "sv_name", szName);
                                    FindNodeValue(node, "sv_index", szIndex);
                                    if(szIndex.empty())
                                        nIndex = FindIndexByID(szEntityID);
                                    else
                                        nIndex = atoi(szIndex.c_str());

                                    device.szIndex = szEntityID;
                                    device.szName = szName;

                                    lsItem = sortList.find(nIndex);
                                    while(lsItem != sortList.end())
                                    {
                                        nIndex ++;
                                        lsItem = sortList.find(nIndex);
                                    }
                                    sortList[nIndex] = device;
                                }
                                CloseEntity(objDevice);
                            }
                        }
                    }
                    nChildCount += static_cast<int>(sortList.size());
                    for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++)
                    {
                        nRow = pSubTable->numRows();

						new WText("&nbsp;",pSubTable->elementAt(nRow , 0));

						new WImage("/Images/cbb-4server.gif", pSubTable->elementAt(nRow, 1));

						new WText("&nbsp;",pSubTable->elementAt(nRow , 1));

                        WText *pName = new WText(lsItem->second.szName, pSubTable->elementAt(nRow, 2));
                        if(pName)
                        {
                            szContext = "onclick='parent.document.frames(\"left\").location.replace(\"/fcgi-bin/menu.exe?cmd=treeview.exe?deviceid=" + lsItem->second.szIndex 
                                + "\");' style='color:#669;cursor:pointer;' onmouseover='this.style.textDecoration=\"underline\"'"
                                + "onmouseout='this.style.textDecoration=\"none\"'";
                            sprintf(pName->contextmenu_, szContext.c_str());
                        }
                        if(!enumMonitors(lsItem->second.szIndex, lsItem->second.szName, pSubTable->elementAt(nRow, 2)))
						{
							//pSubTable->deleteRow(nRow);
						}

                    }
                }
                CloseSVSE(objSE);

                if(nChildCount <= 0)
                {
                    new WText(m_szNoChild, pSubTable->elementAt(nRow, 2));
                }
            }
        }
    }
}