controllers

package
v0.0.0-...-b7062c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2017 License: LGPL-3.0-or-later Imports: 36 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// TPage - template page
	TPage = iota
	// TJson - ajax json request
	TJson
)

Variables

This section is empty.

Functions

func Ajax

func Ajax(w http.ResponseWriter, r *http.Request)

Ajax is a common handle function for ajax requests

func App

func App(w http.ResponseWriter, r *http.Request)

App is a controller for application install template page

func CallController

func CallController(c *Controller, name string) (string, error)

CallController calls the method with this name

func CallJSON

func CallJSON(c *Controller, name string) []byte

CallJSON calls the ajax controller

func CallMethod

func CallMethod(i interface{}, methodName string) (string, error)

CallMethod calls the method

func CallPage

func CallPage(c *Controller, name string) string

CallPage calls the page controller

func CheckInputData

func CheckInputData(data map[string]string) error

CheckInputData calls utils.CheckInputData for the each item of the map

func CheckLang

func CheckLang(lang int) bool

CheckLang checks if there is a language with such id If some muck was sent in the lang

func ConfigInit

func ConfigInit()

ConfigInit reads ini file

func Content

func Content(w http.ResponseWriter, r *http.Request)

Content is the main controller

func GetBtc

func GetBtc() string

func GetChain

func GetChain()

GetChain updates information about transactions

func GetLang

func GetLang(w http.ResponseWriter, r *http.Request, parameters map[string]string) int

GetLang returns the user's language

func GetSessCitizenID

func GetSessCitizenID(sess session.SessionStore) int64

GetSessCitizenID returns session's citizen id

func GetSessInt64

func GetSessInt64(sessName string, sess session.SessionStore) int64

GetSessInt64 returns the integer value of the session key

func GetSessPublicKey

func GetSessPublicKey(sess session.SessionStore) string

GetSessPublicKey returns the session public key

func GetSessString

func GetSessString(sess session.SessionStore, name string) string

GetSessString returns the string value of the session key

func GetSessWalletID

func GetSessWalletID(sess session.SessionStore) int64

GetSessWalletID returns session's wallet id

func Index

func Index(w http.ResponseWriter, r *http.Request)

Index is a control for index page

func IsPassValid

func IsPassValid(pass, psw string) bool

IsPassValid checks password and update passwords list

func SessInit

func SessInit()

SessInit initializes sessions

func SetLang

func SetLang(w http.ResponseWriter, r *http.Request, lang int)

SetLang sets lang cookie

func Template

func Template(w http.ResponseWriter, r *http.Request)

Template is a handle function for the template page

func WsBlockchain

func WsBlockchain(w http.ResponseWriter, r *http.Request)

WsBlockchain is a handle function for WebSocket

Types

type AccountInfo

type AccountInfo struct {
	AccountID int64  `json:"account_id"`
	Address   string `json:"address"`
	Amount    string `json:"amount"`
}

AccountInfo is a structure for the list of the accounts

type AddressJSON

type AddressJSON struct {
	Address []string `json:"address"`
	Error   string   `json:"error"`
}

AddressJSON is a structure of the ajax_adresses ajax request

type AppInfo

type AppInfo struct {
	Name  string
	Title string
	Desc  string
	Img   string
	Done  int
}

AppInfo is a structure with information about the application

type AppProcess

type AppProcess struct {
	Error string `json:"error"`
}

AppProcess is a structure of the ajax_app_process ajax request

type AppsList

type AppsList []AppInfo

AppsList is a type for a slice of AppInfo

func (AppsList) Len

func (a AppsList) Len() int

func (AppsList) Less

func (a AppsList) Less(i, j int) bool

func (AppsList) Swap

func (a AppsList) Swap(i, j int)

type ChainInfo

type ChainInfo struct {
	ID int64 `json:"id"`
	//	Hash    string `json:"hash"`
	//	Wallet  int64  `json:"wallet_id"`
	Address string `json:"wallet_address"`
	//	State   int64  `json:"state_id"`
	Time string `json:"time"`
	Tx   string `json:"tx"`
}

ChainInfo contains infromation about transaction

type ChainMsg

type ChainMsg struct {
	Data   []ChainInfo `json:"data"`
	Latest int64       `json:"latest"`
}

ChainMsg contains latest transactions

func UpdateChain

func UpdateChain(latest int64) (answer ChainMsg)

UpdateChain returns the latest transactions

type CitizenFieldsJSON

type CitizenFieldsJSON struct {
	Fields   string `json:"fields"`
	Price    int64  `json:"price"`
	Valid    bool   `json:"valid"`
	Approved int64  `json:"approved"`
	Error    string `json:"error"`
}

CitizenFieldsJSON is a structure for the answer of ajax_citizen_fields ajax request

type CitizenInfoJSON

type CitizenInfoJSON struct {
	Result bool   `json:"result"`
	Error  string `json:"error"`
}

CitizenInfoJSON is a structure for the answer of ajax_citizen_info ajax request

type CommonPage

type CommonPage struct {
	//Lang   map[string]string
	Address   string
	WalletId  int64
	CitizenId int64
	StateId   int64
	StateName string
}

CommonPage is a structure with common information about the user and state

type ContractField

type ContractField struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Tags string `json:"tags"`
}

TxSignJSON is a structure for additional signs of transaction

type ContractInfo

type ContractInfo struct {
	Fields []ContractField `json:"fields"`
	ID     uint32          `json:"id"`
	Name   string          `json:"name"`
	Error  string          `json:"error"`
}

ContractInfo is a structure for the answer of ajax_contract_info ajax request

type Controller

type Controller struct {
	*utils.DCDB

	Lang             map[string]string
	TplName          string
	LangInt          int64
	ContentInc       bool
	Periods          map[int64]string
	Alert            string
	SessStateID      int64
	StateName        string
	StateID          int64
	StateIDStr       string
	SessCitizenID    int64
	SessWalletID     int64
	SessAddress      string
	MyNotice         map[string]string
	Parameters       map[string]string
	TimeFormat       string
	NodeAdmin        bool
	NodeConfig       map[string]string
	CurrencyList     map[int64]string
	ConfirmedBlockID int64
	Data             *CommonPage
	// contains filtered or unexported fields
}

Controller is the main controller's structure

func (*Controller) Accounts

func (c *Controller) Accounts() (string, error)

Accounts is a controller for accounts page

func (*Controller) AjaxAddresses

func (c *Controller) AjaxAddresses() interface{}

AjaxAddresses is a controller of ajax_adresses request

func (*Controller) AjaxAppProcess

func (c *Controller) AjaxAppProcess() interface{}

AjaxAppProcess is a controller of ajax_app_process request

func (*Controller) AjaxCitizenFields

func (c *Controller) AjaxCitizenFields() interface{}

AjaxCitizenFields is a controller of ajax_citizen_fields request

func (*Controller) AjaxCitizenInfo

func (c *Controller) AjaxCitizenInfo() interface{}

AjaxCitizenInfo is a controller of ajax_citizen_info request

func (*Controller) AjaxContractInfo

func (c *Controller) AjaxContractInfo() interface{}

AjaxContractInfo returns fields of the contract

func (*Controller) AjaxEncryptKey

func (c *Controller) AjaxEncryptKey() interface{}

AjaxEncryptKey is a controller of ajax_encrypt_key request

func (*Controller) AjaxExplorer

func (c *Controller) AjaxExplorer() interface{}

AjaxExplorer is a controller of ajax_explorer request

func (*Controller) AjaxGenKeys

func (c *Controller) AjaxGenKeys() interface{}

AjaxGenKeys is a controller of ajax_gen_keys request

func (*Controller) AjaxGenWallet

func (c *Controller) AjaxGenWallet() interface{}

func (*Controller) AjaxGetCnt

func (c *Controller) AjaxGetCnt() interface{}

AjaxGetCnt is a controller of ajax_get_cnt request

func (*Controller) AjaxGetMenu

func (c *Controller) AjaxGetMenu() interface{}

AjaxGetMenu is a controller of ajax_get_menu

func (*Controller) AjaxGetMenuHtml

func (c *Controller) AjaxGetMenuHtml() (string, error)

AjaxGetMenuHtml is a controller for AjaxGetMenuHtml

func (*Controller) AjaxGetUid

func (c *Controller) AjaxGetUid() interface{}

AjaxGetUid is a controller of ajax_get_uid request

func (*Controller) AjaxHistory

func (c *Controller) AjaxHistory() interface{}

AjaxHistory is a controller of ajax_history request

func (*Controller) AjaxNewKey

func (c *Controller) AjaxNewKey() interface{}

AjaxNewKey is a controller of ajax_new_key request

func (*Controller) AjaxNewState

func (c *Controller) AjaxNewState() interface{}

AjaxNewState is a controller of ajax_new_state request

func (*Controller) AjaxPrepareTx

func (c *Controller) AjaxPrepareTx() interface{}

AjaxPrepareTx is a controller of ajax_prepare_tx request

func (*Controller) AjaxSendTx

func (c *Controller) AjaxSendTx() interface{}

AjaxSendTx is a controller of ajax_send_tx request

func (*Controller) AjaxSignIn

func (c *Controller) AjaxSignIn() interface{}

AjaxSignIn checks signed uid

func (*Controller) AjaxSmartFields

func (c *Controller) AjaxSmartFields() interface{}

AjaxSmartFields is a controller of ajax_smart_fields request

func (*Controller) AjaxStateCoords

func (c *Controller) AjaxStateCoords() interface{}

AjaxStateCoords is a controller of ajax_state_coords request

func (*Controller) AjaxStatesList

func (c *Controller) AjaxStatesList() (string, error)

AjaxStatesList returns the list of states

func (*Controller) AjaxStorage

func (c *Controller) AjaxStorage() interface{}

AjaxStorage is a controller of ajax_storage request

func (*Controller) AlertMessage

func (c *Controller) AlertMessage() (string, error)

AlertMessage is reserved function

func (*Controller) AnonymMoneyTransfer

func (c *Controller) AnonymMoneyTransfer() (string, error)

AnonymMoneyTransfer is a controller of the money transfer template page

func (*Controller) AppCatalog

func (c *Controller) AppCatalog() (string, error)

AppCatalog is a controller of the application list template page

func (*Controller) Backup

func (c *Controller) Backup() (string, error)

Backup is a controller for backup template page

func (*Controller) BlockExplorer

func (c *Controller) BlockExplorer() (string, error)

BlockExplorer is a controller for block explorer template page

func (*Controller) ChangeNodeKey

func (c *Controller) ChangeNodeKey() (string, error)

ChangeNodeKey is a controller which changes a node key

func (*Controller) ChangeStateSmartLaws

func (c *Controller) ChangeStateSmartLaws() (string, error)

ChangeStateSmartLaws is a controller which shows state parameters

func (*Controller) CheckCitizenStatus

func (c *Controller) CheckCitizenStatus() (string, error)

CheckCitizenStatus is controller for changing citizen status

func (*Controller) Contracts

func (c *Controller) Contracts() (string, error)

Contracts is a handle function for showing the list of contracts

func (*Controller) DashboardAnonym

func (c *Controller) DashboardAnonym() (string, error)

DashboardAnonym is a handle function for the default dashboard page

func (*Controller) EditColumn

func (c *Controller) EditColumn() (string, error)

EditColumn is a handle function for editing columns

func (*Controller) EditContract

func (c *Controller) EditContract() (string, error)

EditContract is a handler function for editing contracts

func (*Controller) EditLanguage

func (c *Controller) EditLanguage() (string, error)

EditLanguage is a controller which edits language resources

func (*Controller) EditMenu

func (c *Controller) EditMenu() (string, error)

EditMenu is a controller for editing menu

func (*Controller) EditPage

func (c *Controller) EditPage() (string, error)

EditPage is a controller for editing pages

func (*Controller) EditSignature

func (c *Controller) EditSignature() (string, error)

EditSignature is a controller fo editing additional signatures

func (*Controller) EditStateParameters

func (c *Controller) EditStateParameters() (string, error)

EditStateParameters is a handle function for changing state parameters

func (*Controller) EditTable

func (c *Controller) EditTable() (string, error)

EditTable is a controller for editing table

func (*Controller) EditWallet

func (c *Controller) EditWallet() (string, error)

EditWallet is a controller for editing state's wallets

func (*Controller) ExportTpl

func (c *Controller) ExportTpl() (string, error)

ExportTpl is a handle function which can export different information

func (*Controller) Forging

func (c *Controller) Forging() (string, error)

Forging is a controller for DLTChangeHostVote transaction

func (*Controller) GenCitizen

func (c *Controller) GenCitizen() (string, error)

GenCitizen is a control for creating a new citizen

func (*Controller) GenKeys

func (c *Controller) GenKeys() (string, error)

GenKeys show information about generated and available keys

func (*Controller) GenWallets

func (c *Controller) GenWallets() (string, error)

AnonymMoneyTransfer is a controller of the money transfer template page

func (*Controller) GenerateNewNodeKey

func (c *Controller) GenerateNewNodeKey() (string, error)

GenerateNewNodeKey generates a new node private and public key

func (*Controller) Generator

func (c *Controller) Generator() (string, error)

GenCitizen is a control for creating a new citizen

func (*Controller) GetParameters

func (c *Controller) GetParameters() (map[string]string, error)

GetParameters returns the map of parameters

func (*Controller) GetServerTime

func (c *Controller) GetServerTime() (string, error)

GetServerTime returns the current server time

func (*Controller) History

func (c *Controller) History() (string, error)

History is a controller for history page

func (*Controller) Home

func (c *Controller) Home() (string, error)

Home is a controller for homepage

func (*Controller) Install

func (c *Controller) Install() (string, error)

Install is a controller for the installation

func (*Controller) InstallStep0

func (c *Controller) InstallStep0() (string, error)

InstallStep0 is a controller for the first step of the installation Step 1, select either standard settings (sqlite and blockchain from the server) or extended settings pg/mysql and upload from the nodes

func (*Controller) InstallStep1

func (c *Controller) InstallStep1() (string, error)

InstallStep1 is a controller for the second step of the installation

func (*Controller) Interface

func (c *Controller) Interface() (string, error)

Interface is a controller for editing pages and menu

func (*Controller) Languages

func (c *Controller) Languages() (string, error)

Languages is a controller for displaying language resources

func (*Controller) ListOfTables

func (c *Controller) ListOfTables() (string, error)

ListOfTables show the list of custom tables

func (*Controller) LoginECDSA

func (c *Controller) LoginECDSA() (string, error)

LoginECDSA is a control for the login page

func (*Controller) Logout

func (c *Controller) Logout() (string, error)

Logout logouts the user

func (*Controller) Menu

func (c *Controller) Menu() (string, error)

Menu is controller for displaying the left menu

func (*Controller) ModalAnonym

func (c *Controller) ModalAnonym() (string, error)

ModalAnonym shows QR code of the wallet

func (*Controller) NewColumn

func (c *Controller) NewColumn() (string, error)

NewColumn shows the form for creating new column

func (*Controller) NewContract

func (c *Controller) NewContract() (string, error)

NewContract is a handle function for creating contracts

func (*Controller) NewMenu

func (c *Controller) NewMenu() (string, error)

NewMenu is a controller for creating a new menu

func (*Controller) NewPage

func (c *Controller) NewPage() (string, error)

NewPage creates a new page

func (*Controller) NewState

func (c *Controller) NewState() (string, error)

NewState creates a new state

func (*Controller) NewStateParameters

func (c *Controller) NewStateParameters() (string, error)

NewStateParameters is a handle function for createing state parameters

func (*Controller) NewTable

func (c *Controller) NewTable() (string, error)

NewTable creates a new table

func (*Controller) RestoreAccess

func (c *Controller) RestoreAccess() (string, error)

RestoreAccess is a restore access control

func (*Controller) RowHistory

func (c *Controller) RowHistory() (string, error)

RowHistory returns rollback data of the table

func (*Controller) SaveQueue

func (c *Controller) SaveQueue() (string, error)

SaveQueue write a transaction in the queue of transactions

func (*Controller) SetState

func (c *Controller) SetState() interface{}

SetState changes the state in the browser

func (*Controller) ShowTable

func (c *Controller) ShowTable() (string, error)

ShowTable shows data of the table

func (*Controller) Signatures

func (c *Controller) Signatures() (string, error)

Signatures shows the list of the additional signatures

func (*Controller) SmartRequestCitizen

func (c *Controller) SmartRequestCitizen() (string, error)

SmartRequestCitizen is a control for requesting the citizenship

func (*Controller) StateLaws

func (c *Controller) StateLaws() (string, error)

StateLaws shows as state parameters

func (*Controller) StateParameters

func (c *Controller) StateParameters() (string, error)

StateParameters is a controller for the list of state parameters

func (*Controller) SynchronizationBlockchain

func (c *Controller) SynchronizationBlockchain() (string, error)

SynchronizationBlockchain synchronizes the blockchain

func (*Controller) SystemInfo

func (c *Controller) SystemInfo() (string, error)

SystemInfo shows the system information about the blockchain

func (*Controller) TxStatus

func (c *Controller) TxStatus() (string, error)

TxStatus return the status of the transaction

func (*Controller) UpdatingBlockchain

func (c *Controller) UpdatingBlockchain() (string, error)

UpdatingBlockchain is a controller which displays information about updating blockchain

func (*Controller) Upgrade

func (c *Controller) Upgrade() (string, error)

Upgrade is a controller for update page

func (*Controller) WalletHistory

func (c *Controller) WalletHistory() (string, error)

WalletHistory is a controller for displaying wallet's history

type EncryptKey

type EncryptKey struct {
	Encrypted string `json:"encrypted"` //hex
	Public    string `json:"public"`    //hex
	WalletID  int64  `json:"wallet_id"`
	Address   string `json:"address"`
	Error     string `json:"error"`
}

EncryptKey is a structure for the answer of ajax_encrypt_key ajax request

func EncryptNewKey

func EncryptNewKey(walletID string) (result EncryptKey)

EncryptNewKey creates a shared key, generates and crypts a new private key

type ExpContract

type ExpContract struct {
	Contract string
	Global   int
	Name     string
}

ExpContract contains information about a contract

type ExpSlice

type ExpSlice []ExpContract

ExpSlice is a slice of ExpContract

func (ExpSlice) Len

func (a ExpSlice) Len() int

func (ExpSlice) Less

func (a ExpSlice) Less(i, j int) bool

func (ExpSlice) Swap

func (a ExpSlice) Swap(i, j int)

type ExplorerJSON

type ExplorerJSON struct {
	Data   []map[string]string `json:"data"`
	Latest int64               `json:"latest"`
}

ExplorerJSON is a structure for the answer of ajax_explorer ajax request

type GenKeys

type GenKeys struct {
	Generated int64  `json:"generated"`
	Used      int64  `json:"used"`
	Available int64  `json:"available"`
	Error     string `json:"error"`
}

GenKeys is a structure for the answer of ajax_gen_keys ajax request

type GenWallet

type GenWallet struct {
	Address string `json:"address"`
	Public  string `json:"public"`
	Time    string `json:"time"`
	Error   string `json:"error"`
}

type GetCntJSON

type GetCntJSON struct {
	Name  string `json:"name"`
	Error string `json:"error"`
}

GetCntJSON is a structure for the answer of ajax_citizen_fields ajax request

type GetUIDJSON

type GetUIDJSON struct {
	UID   string `json:"uid"`
	Error string `json:"error"`
}

GetUIDJSON is a structure for the answer of ajax_get_uid ajax request

type HistoryJSON

type HistoryJSON struct {
	Draw     int                 `json:"draw"`
	Total    int                 `json:"recordsTotal"`
	Filtered int                 `json:"recordsFiltered"`
	Data     []map[string]string `json:"data"`
	Error    string              `json:"error"`
}

HistoryJSON is a structure for the answer of ajax_history ajax request

type InterfaceMenu

type InterfaceMenu struct {
	Name       string `json:"name"`
	Value      string `json:"value"`
	Conditions string `json:"conditions"`
}

InterfaceMenu is a structure for ajax_get_menu ajax request

type LangInfo

type LangInfo struct {
	Title string
	Code  string
}

LangInfo is a structure for language name and code

type LangRes

type LangRes struct {
	Lang string
	Text string
}

LangRes contains the language resource

type ListLangRes

type ListLangRes []LangRes

ListLangRes is a slice of LangRes structures

func (ListLangRes) Len

func (a ListLangRes) Len() int

func (ListLangRes) Less

func (a ListLangRes) Less(i, j int) bool

func (ListLangRes) Swap

func (a ListLangRes) Swap(i, j int)

type LocStorage

type LocStorage struct {
	Accounts string `json:"accounts"`
	Error    string `json:"error"`
}

LocStorage is a structure for answer of ajax_storage request

type NewKey

type NewKey struct {
	//	Address string `json:"address"`
	Private string `json:"private"`
	Seed    string `json:"seed"`
	Error   string `json:"error"`
}

NewKey is a structure for the answer of ajax_new_key ajax request

type NewState

type NewState struct {
	Error string `json:"error"`
}

NewState is a structure for the answer of ajax_new_state ajax request

type PrepareTxJSON

type PrepareTxJSON struct {
	ForSign string            `json:"forsign"`
	Signs   []TxSignJSON      `json:"signs"`
	Values  map[string]string `json:"values"`
	Time    uint32            `json:"time"`
	Error   string            `json:"error"`
}

PrepareTxJSON is a structure for the answer of ajax_prepare_tx ajax request

type SendTxJSON

type SendTxJSON struct {
	Error string `json:"error"`
	Hash  string `json:"hash"`
}

SendTxJSON is a structure for the answer of ajax_send_tx ajax request

type SignInJSON

type SignInJSON struct {
	Address string `json:"address"`
	Result  bool   `json:"result"`
	Error   string `json:"error"`
}

SignInJSON is a structure for the result of the sign in request

type SignRes

type SignRes struct {
	Param string `json:"name"`
	Text  string `json:"text"`
}

SignRes contains the data of the signature

type SmartFieldsJSON

type SmartFieldsJSON struct {
	Fields   string `json:"fields"`
	Price    int64  `json:"price"`
	Valid    bool   `json:"valid"`
	Approved int64  `json:"approved"`
	Error    string `json:"error"`
}

SmartFieldsJSON is a structure for the answer of ajax_smart_fields ajax request

type StateDetails

type StateDetails struct {
	Coords string `json:"coords"`
}

StateDetails is a structure for the answer of ajax_state_coords ajax request

type TxSignJSON

type TxSignJSON struct {
	ForSign string    `json:"forsign"`
	Field   string    `json:"field"`
	Title   string    `json:"title"`
	Params  []SignRes `json:"params"`
}

TxSignJSON is a structure for additional signs of transaction

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL