⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pgadmin.c

📁 vt6528芯片交换机API函数和文档运行程序
💻 C
字号:
/*
 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
 * All rights reserved.
 *
 * This software is copyrighted by and is the sole property of
 * VIA Networking Technologies, Inc. This software may only be used
 * in accordance with the corresponding license agreement. Any unauthorized
 * use, duplication, transmission, distribution, or disclosure of this
 * software is expressly forbidden.
 *
 * This software is provided by VIA Networking Technologies, Inc. "as is"
 * and any express or implied warranties, including, but not limited to, the
 * implied warranties of merchantability and fitness for a particular purpose
 * are disclaimed. In no event shall VIA Networking Technologies, Inc.
 * be liable for any direct, indirect, incidental, special, exemplary, or
 * consequential damages.
 *
 *
 * File:    admindef.c
 *
 * Purpose: Password setting module UI definitions
 *
 * Author:  Jenda Jao
 *
 * Date:    Jan 08, 2002
 *
 * Functions:
 *
 * Revision History:
 *
 */


#include "tty.h"
#include "engine.h"
#include "eng_act.h"
#include "eng_io.h"
#include "allpages.h"
#include "pigencfg.h"
#include "pgadmin.h"
#include "cfgstr.h"
#include "gen_act.h"
#include "pimsg.h"

#include "str.h"
#include "piadmin.h"
#include "pigencfg.h"




#define ADMIN_DUMMY_STR_NUM  10

// assign label
SFixLabel aSFixLabelAdmin[] = {
    {{2,32}, g_strPasswdSet, 0},
    {{3,32}, "=", 16},
    {{7,25}, "Password Protection :", 0},
    {{24,2}, g_strHelpMsg, 0},
    {{9 ,25}, "User Name           :", 0},
    {{11,25}, "New Password        :", 0},
    {{13,25}, "Password Again      :", 0}
};


// assign item
SItemListbox SIPasswdProtect = {
    &g_UCfgBuf.SPageCfg_Admin.byLoginEn,
    0, 7, 0,
    g_aszEnDisCfg, 2
};

char astrNewUsername[ADMIN_DUMMY_STR_NUM*(USERNAME_STR_LEN+1)];

SItemString SIStringUsername = {
    (char*)astrNewUsername,
    USERNAME_STR_LEN
};
SItemPasswd SIStringPasswdNew = {
    g_UCfgBuf.SPageCfg_Admin.strNewPasswd,
    USERNAME_STR_LEN
};
SItemPasswd SIStringPasswdAgain = {
    g_UCfgBuf.SPageCfg_Admin.strAgainPasswd,
    USERNAME_STR_LEN
};


// all items
SItem aSItemAdmin[] = {
    {{7 , 47}, &SIPasswdProtect,     g_strChgModeMsg, ITEM_LISTBOX,  REPEAT_TYPE_NONE, LINK_TYPE_LISTBOX},
    {{9 , 47}, &SIStringUsername,    " ", ITEM_STRING,   REPEAT_TYPE_NONE, LINK_TYPE_NONE},
    {{11, 47}, &SIStringPasswdNew,   "", ITEM_PASSWORD, REPEAT_TYPE_NONE, LINK_TYPE_NONE},
    {{13, 47}, &SIStringPasswdAgain, " ", ITEM_PASSWORD, REPEAT_TYPE_NONE, LINK_TYPE_NONE},
};


// action
SActItem aSActionAdmin[] = {
    {{22, 12}, g_strActionQuit, PAACT_bQuit},
    {{22, 22}, g_strActionEdit, PAADM_bEditAdminCfg},
    {{22, 32}, g_strActionSave, PAADM_bSaveAdminCfg},
};


// assign page
SPage g_SPageAdminEn = {
    aSFixLabelAdmin, 7,
    NULL, 0,
    aSItemAdmin, 4,
    aSActionAdmin, 3,
    PAADM_bLoadAdminCfg
};
// assign page
SPage g_SPageAdminDis = {
    aSFixLabelAdmin, 4,
    NULL, 0,
    aSItemAdmin, 1,
    aSActionAdmin, 3,
    PAADM_bLoadAdminCfg
};

////////////////////////////////////////////////////////////////////




static UINT8 sg_abyAdmPageID[] = {PAGE_ADMIN_DIS, PAGE_ADMIN_EBL};

BOOL PAADM_bChangePage(void)
{
    if (g_byCurPageID != sg_abyAdmPageID[g_pSAdmPageCfg->byLoginEn])
    {
        g_byCurPageID = sg_abyAdmPageID[g_pSAdmPageCfg->byLoginEn];
        return RELOAD_PAGE;
    }
    return DONT_RELOAD_PAGE;
}


BOOL PAADM_bLoadAdminCfg(void)
{
    PIADM_vInitPage(g_pSAdmPageCfg);

    //load string to ui string array
    STR_iStrcpy(astrNewUsername, g_UCfgBuf.SPageCfg_Admin.strNewUsername);

    PAADM_bChangePage();

    return DONT_RELOAD_PAGE;
}


BOOL PAADM_bEditAdminCfg(void)
{
    if (PAACT_bEdit())
        return RELOAD_PAGE;

    // deal with dynamic page
    if (PAADM_bChangePage())
        ENGvPrintPage();        // in this page, changing page may not reload config, just re-print page only

    return DONT_RELOAD_PAGE;
}


BOOL PAADM_bSaveAdminCfg(void)
{
    //load ui string array to string
    STR_iStrcpy(g_pSAdmPageCfg->strNewUsername, astrNewUsername);    

    PIMSG_vPutMsgThenPause(PIbyADM_SavePage(g_pSAdmPageCfg));
    g_bDataDirty = 0;
    return DONT_RELOAD_PAGE;    // reload
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -