OSDN Git Service

modified comments
[opengatem/opengatem.git] / mngsrc / messages.c
index 83a2906..236c2c2 100644 (file)
@@ -1,6 +1,13 @@
 /**************************************************
 OpengateM - MAC address authentication system 
- module for Communication through CGI 
+
+ module for construction of multi-language messages
+
+ To enable the 'msgNo' message, call as 'SetMessage(msgNo)'.
+ (The msgNo and message string is in messagesInJa/messagesInEn)
+ To insert enabled messages, call as 'InsertMessageToPage("ja")'.
+ (At '%%ERRORLIST%%' in html template, 'ja' messages are inserted)
+ To disable all messages, call as 'ResetMessage()'.
 
 Copyright (C) 2011 Opengate Project Team
 Written by Yoshiaki Watanabe
@@ -26,27 +33,32 @@ Programmed by Yoshiaki WATANABE
 
 #include       "opengatemmng.h"
 
-int messageSet[ENDOFLIST]={0};
+int messageSet[ENDOFLIST]={0};  /* to enable a message, set the index true */
 
-/*******************************
- set message
-*******************************/
+/*******************************/
+/* set message                 */
+/* enable the 'msgNo' message  */
+/*******************************/
 void setMessage(int msgNo){
 
   if(msgNo < ENDOFLIST) messageSet[msgNo]=TRUE;
 }
 
-/*******************************
- reset message
-*******************************/
+/*******************************/
+/* reset message               */
+/* disable all messages        */
+/*******************************/
 void resetMessage(void){
   int i;
   for(i=0;i<ENDOFLIST;i++) messageSet[i]=FALSE;
 }
 
-/*******************************
- insert message in multi-lang to page
-*******************************/
+/****************************************/
+/* insert enables messages into page    */
+/* language is 'ja' or 'en' at now.     */
+/* if you want to add other languages,  */
+/* add messagesIn??, and call form this */
+/****************************************/
 void insertMessageToPage(char* language){
   
   char* (*pMessageFunc)(int msgNo);
@@ -69,9 +81,9 @@ void insertMessageToPage(char* language){
   }
 }
 
-/******************************
- error message in english
-******************************/
+/******************************/
+/* message in english         */
+/******************************/
 char* messagesInEn(int msgNo){
   char* messages[ENDOFLIST];
   messages[ExistentMacAddr]="Error: Mac address is already registered. Update it in update page.";
@@ -97,9 +109,9 @@ char* messagesInEn(int msgNo){
   return messages[msgNo];
 }
 
-/******************************
- error message in japanese (utf-8)
-******************************/
+/*************************************/
+/* error message in japanese (utf-8) */
+/*************************************/
 char* messagesInJa(int msgNo){
   char* messages[ENDOFLIST];
   messages[ExistentMacAddr]= "エラー:既登録のMACアドレスです。更新ページで更新してください。";
@@ -124,9 +136,9 @@ char* messagesInJa(int msgNo){
   return messages[msgNo];
 }
 
-/***********************************
-make weekday string for language
-***********************************/
+/************************************/
+/* make weekday string for language */
+/************************************/
 char* weekdayStr(int weekday, char* str, char* language){
 
   char* weekdayStrEn[7]={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};