[ UP ] update cgi. add display percentege bar icons.
[archserver.git] / cgi / lib.sh
blobb156786675813dd8376f204817c6073082ab87c1
1 #!/bin/sh
3 rootdir=$(pwd)
5 global_nav_active=`echo $this_page|cut -d. -f1`
6 sub_nav_active=`echo $this_page|cut -d. -f2`
8 # Global navigation viriables chinese name
9 global_navs="status system volumes shares"
10 #global_navs="status accounts system volumes quota shares services "
11 zh_status="系统信息"
12 zh_system="系统管理"
13 zh_volumes="磁盘管理"
14 zh_quota="磁盘配额"
15 zh_shares="共享管理"
16 zh_services="服务"
17 zh_accounts="账户管理"
19 # Sub navigation: [ shares ]
20 sub_nav_shares="share_info manager_user list_connects "
21 sub_nav_shares_title="共享设置"
22 zh_share_info="共享管理"
23 zh_list_users="所有用户"
24 zh_list_shares="所有共享"
25 zh_list_connects="连接状态"
26 zh_manager_user="用户管理"
27 zh_edit_share="编辑共享"
29 # Sub navigation: [ volumes ]
30 sub_nav_volumes="create_sharelv create_raid vstatus "
31 sub_nav_volumes_title="磁盘管理"
32 zh_create_sharelv="共享卷管理"
33 zh_create_raid="磁盘阵列管理"
34 zh_vstatus="查看系统磁盘"
36 # Sub navigation: [ System ]
37 sub_nav_system="hostname network time shutdown"
38 sub_nav_system_title="系统管理"
39 zh_hostname="设置主机名"
40 zh_network="设置网络"
41 zh_time="设置系统时间"
42 zh_shutdown="重启系统/关机"
44 # Sub navigation: [ Status ]
45 sub_nav_status="sysinfo"
46 sub_nav_status_title="系统状态"
47 zh_sysinfo="系统信息"
50 function h_header () {
51 echo -e '
52 <html>
53 <head>
54 <meta http-equiv="Content-Type" content=text/html; charset="utf-8">
55 <link rel=stylesheet href="css.css">
56 </head>
57 <body>
59 <!--Top -->
60 <div id="logodiv" class="openfiler-logo">
61 <div id="globalButtons">
62 <ul>
63 <li class="logout"><a href="/account/logout.html">退出</a></li>
64 <li class="status"><a href="status.cgi">系统信息</a></li>
65 <li class="shutdown"><a href="system_shutdown.cgi">关机</a></li>
66 </ul>
67 </div>
68 </div>
70 <div id="slidercontainer"><div id="slideDownDiv"><div class="show" id="slidingpaneldiv"></div></div></div>
71 <p> </p>
74 <br>
76 <table cellpadding="20" cellspacing="0" border="0" width="100%">
77 <tr>
78 <td valign="top">
79 <div align="center" class="container">
81 <!-- global_nav start -------------------------------------------------->
82 <table cellpadding="0" cellspacing="0" border="0" width="100%">
83 <tr>
84 <td><div id="global_nav" class="global_nav"><ul>
87 for nav in `echo $global_navs`
89 zh_name=$(eval echo "$""zh_"$nav)
90 if [ "$global_nav_active" = "$nav" ]; then
91 echo -e "
92 <li class=\"active\"><span class=\"$nav\">&nbsp;</span><span style=\"display: block; float: left;\"> <a class=\"selected\" href=\"$nav.cgi\">$zh_name</a></span></li>\n"
93 else
94 printf "<li><span class=\"%s\">&nbsp;</span><a href=\"%s.cgi\">%s</a></li>\n" $nav $nav $zh_name
97 done
99 echo -e '
100 </ul></div>
101 </td>
102 </tr>
103 </table>
104 <!-- global_nav end-------------------------------------------------->
105 <table cellpadding="5" cellspacing="1" border="0" width="100%">
106 <tr>
107 <!--body left start td valign="top" ------------------------------------------------------------------>
109 <td valign="top">
110 <div class="shadow">
111 <div class="shadow_tr">
112 <div class="shadow_bl">
113 <div class="shadow_tl">
114 <div style="padding-bottom: 20px; padding-left: 5px; padding-right: 5px; min-height: 1%;">
115 <div><p>&nbsp;</p></div>
116 <div align="center">
122 # Function footer(global_nav_active, sub_nav_active)
125 function h_footer() {
126 cat << EOB_footer1
127 </div></div></div></div></div>
128 </td>
129 <!--body left end ------------------------------------------------------------------>
131 <!--sub nav & support nav start ------------------------------------------------------------------>
132 <td valign="top" style="width: 200px;"> <!-- nav links -->
133 <div class="shadow"><div class="shadow_tr"><div class="shadow_bl"><div class="shadow_tl">
134 <div style="padding-bottom: 10px; padding-left: 5px; padding-right: 5px; padding-top: 5px; min-height: 1%;">
135 <div id="sub_nav"><div class="sub_nav_title">$(eval echo "$""sub_nav_"$global_nav_active"_title")</div>
136 <ul>
137 EOB_footer1
138 __t=$(eval echo "$""sub_nav_"$global_nav_active)
139 for nav in `echo $__t`
141 # eg: "system_hostname.cgi -> system/hostname.cgi"
142 tcgi="href=\"$global_nav_active""_$nav.cgi\""
143 #[ ! -f $tcgi ] && tcgi="href=\"$global_nav_active/$nav.cgi\""
145 [ "$nav" = "$sub_nav_active" ] && tcgi="class=\"selected\" $tcgi"
146 cat << EOB_footer_t
147 <li class=$nav><a $tcgi>$(eval echo "$""zh_"$nav)</a></li>
148 EOB_footer_t
149 done
151 # <li class="system_network"><a class="selected" href="/admin/system.html">Network Setup</a></li>
152 # <li class="system_ha_cluster"><a href="/admin/system_cluster.html">HA Cluster Setup</a></li>
153 # <li class="system_clock"><a href="/admin/system_clock.html">Clock Setup</a></li>
154 # <li class="system_ups"><a href="/admin/system_ups.html">UPS Management</a></li>
155 # <li class="system_shutdown"><a href="/admin/system_shutdown.html">Shutdown/Reboot</a></li>
156 # <li class="system_notification"><a href="/admin/system_info.html">Notification</a></li>
157 # <li class="system_update"><a href="/admin/system_view_update.html">System Update</a></li>
158 # <li class="system_backup"><a href="/admin/system_backup.html">Backup/Restore</a></li>
159 # <li class="system_console"><a href="/admin/system_shell.html">Secure Console</a></li>
160 echo " </ul>
161 </div></div></div></div></div></div>"
163 # <div class="shadow"><div class="shadow_tr"><div class="shadow_bl"><div class="shadow_tl">
164 # <div style="padding-bottom: 10px; padding-left: 5px; padding-right: 5px; padding-top: 5px; min-height: 1%;">
165 # <div id="support_nav"><div class="sub_nav_title">Support resources</div><ul>
166 # <li class="support_bug"><a href="javascript:popupPage('/admin/support.html?page=support_report');">Report bug</a></li>
167 # <li class="support_get"><a href="javascript:popupPage('/admin/support.html?page=support_get');">Get support</a></li>
168 # <li class="support_forums"><a href="javascript:popupPage('/admin/support.html?page=support_forums');">Forums</a></li>
169 # <li class="support_admin_guide"><a href="javascript:popupPage('/admin/support.html?page=support_admin_guide');">Admin Guide</a></li></ul>
170 # </div></div></div></div></div></div>
172 cat << EOB_footer2
173 </td>
174 <!--sub nav & support nav start ------------------------------------------------------------------>
177 </tr>
178 </table>
181 </div>
182 </td>
183 </tr>
184 </table>
186 <hr>
187 <p align="center">
188 &copy; 2007 - 2008 <a href="http://www.****.com/">***科技</a>. 保留一切权力.<br />
189 </p>
190 </body>
191 </html>
192 EOB_footer2
193 #<a href="/">Home</a> &middot; <a href="http://www.openfiler.com/buy/administrator-guide">Documentation</a> &middot; <a href="http://www.openfiler.com/support/">Support</a> &middot; <a href="http://www.openfiler.com/">Website</a> &middot; <a href="http://www.openfiler.com/about/license">License</a> &middot; <a href="/account/logout.html">Log Out</a>
196 function h_err_quit () {
197 cat << EOB
198 <div class="messageblock messageblock-error">
199 <div class="messageblock-internal">
200 <p><ul><strong>出现了下面的错误</strong><li> $@</li><ul></p>
201 </div></div>
203 h_footer
204 exit
207 function h_error() {
208 cat << EOB
209 <div class="messageblock messageblock-error">
210 <div class="messageblock-internal">
211 <p><ul><strong>出现了下面的错误</strong><li>$@</li><ul></p>
212 </div></div>
214 exit