📄 messagesnewtemplate.tmpl
字号:
#encoding UTF-8## $Id:$#### Copyright 2006 UNINETT AS#### This file is part of Network Administration Visualized (NAV)#### NAV is free software; you can redistribute it and/or modify## it under the terms of the GNU General Public License as published by## the Free Software Foundation; either version 2 of the License, or## (at your option) any later version.#### NAV is distributed in the hope that it will be useful,## but WITHOUT ANY WARRANTY; without even the implied warranty of## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the## GNU General Public License for more details.#### You should have received a copy of the GNU General Public License## along with NAV; if not, write to the Free Software## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA###### Author: Stein Magnus Jodal <stein.magnus.jodal@uninett.no>###extends MessagesTemplate#import math#import time#block tabcontent## Print form<form action="" method="post">#set $edit_messageid = $getVar('edit_messageid', False)#if $edit_messageid<input type="hidden" name="edit_messageid" value="$edit_messageid" />#end if<table class="vertitable"> <tr> <th>Title *</th> <td><input type="text" name="title" value="$getVar('formtitle', '')" size="72" /></td> </tr> <tr> <th>Description *</th> <td><textarea name="description" cols="72" rows="5">$getVar('description', '')</textarea></td> </tr> <tr> <th>Technical description</th> <td><textarea name="tech_description" cols="72" rows="5">$getVar('tech_description', '')</textarea></td> </tr> <tr> <th>Publish from</th> <td> <select name="start_year">#set $current_year = int(time.strftime('%Y'))#set $selected_year = $getVar('start_year', $current_year)#for $year in xrange($current_year - 1, $current_year + 5) #if $year == $selected_year <option value="$year" selected="selected">$year</option> #else <option value="$year">$year</option> #end if#end for </select> <select name="start_month">#set $current_month = int(time.strftime('%m'))#set $selected_month = $getVar('start_month', $current_month)#for $month in xrange(1, 1 + 12) #if $month == $selected_month <option value="$month" selected="selected">$month</option> #else <option value="$month">$month</option> #end if#end for </select> <select name="start_day">#set $current_day = int(time.strftime('%d'))#set $selected_day =$getVar('start_day', $current_day)#for $day in xrange(1, 1 + 31) #if $day == $selected_day <option value="$day" selected="selected">$day</option> #else <option value="$day">$day</option> #end if#end for </select> at <select name="start_hour">#set $current_hour = int(time.strftime('%H'))#set $selected_hour = $getVar('start_hour', $current_hour)#for $hour in xrange(0, 24) #if $hour == $selected_hour <option value="$hour" selected="selected">$hour</option> #else <option value="$hour">$hour</option> #end if#end for </select> <select name="start_min">#set $current_min = int(math.floor(int(time.strftime('%M')) / 5) * 5)#set $selected_min = $getVar('start_min', $current_min)#set $selected_min = int(math.floor($selected_min / 5) * 5)#for $min in xrange(0, 60, 5) #if $min == $selected_min <option value="$min" selected="selected">$min</option> #else <option value="$min">$min</option> #end if#end for </select> </td> </tr>## Default to one week into the future#set $totime = time.localtime(int(time.time()) + 7*24*60*60) <tr> <th>Publish to</th> <td> <select name="end_year">#set $current_year = int(time.strftime('%Y', $totime))#set $selected_year = $getVar('end_year', $current_year)#for $year in xrange($current_year - 1, $current_year + 5) #if $year == $selected_year <option value="$year" selected="selected">$year</option> #else <option value="$year">$year</option> #end if#end for </select> <select name="end_month">#set $current_month = int(time.strftime('%m', $totime))#set $selected_month = $getVar('end_month', $current_month)#for $month in xrange(1, 1 + 12) #if $month == $selected_month <option value="$month" selected="selected">$month</option> #else <option value="$month">$month</option> #end if#end for </select> <select name="end_day">#set $current_day = int(time.strftime('%d', $totime))#set $selected_day = $getVar('end_day', $current_day)#for $day in xrange(1, 1 + 31) #if $day == $selected_day <option value="$day" selected="selected">$day</option> #else <option value="$day">$day</option> #end if#end for </select> at <select name="end_hour">#set $current_hour = int(time.strftime('%H', $totime))#set $selected_hour = $getVar('end_hour', $current_hour)#for $hour in xrange(0, 24) #if $hour == $selected_hour <option value="$hour" selected="selected">$hour</option> #else <option value="$hour">$hour</option> #end if#end for </select> <select name="end_min">#set $current_min = int(math.floor(int(time.strftime('%M', $totime)) / 5) * 5)#set $selected_min = $getVar('end_min', $current_min)#set $selected_min = int(math.floor($selected_min / 5) * 5)#for $min in xrange(0, 60, 5) #if $min == $selected_min <option value="$min" selected="selected">$min</option> #else <option value="$min">$min</option> #end if#end for </select> (default: one week) </td> </tr> <tr> <th style="white-space: normal;">Select 0..N maintenance tasks for this message<br /> (select multiple with CTRL)</th> <td>#set $maint_tasks = $getVar('maint_tasks', []) <select name="maint_tasks" size="5" multiple="multiple">#if $tasks and $maint_tasks <option value="none">(none)</option>#else <option value="none" selected="selected">(none)</option>#end if#if type($tasks) is not list #set tasks = []#end if#for $task in $tasks #if len($task.description) > 50 #set $desc = $task.description[:50] + '...' #else #set $desc = $task.description #end if #set $date = $task.maint_start.strftime('%Y-%m-%d') #if $maint_tasks.count(str($task.maint_taskid)) <option value="$task.maint_taskid" selected="selected">$date: $desc</option> #else <option value="$task.maint_taskid">$date: $desc</option> #end if#end for </select> </td> </tr>#set $replaces_messageid = $getVar('replaces_messageid', False)#if $replaces_messageid <tr> <th>Replaces message</th> <td> <input type="hidden" name="replaces_messageid" value="$replaces_messageid" /> <a href="view?id=$replaces_messageid">$replaces_message.title</a> from $replaces_message.publish_start.strftime('%Y-%m-%d %H:%M') by $replaces_message.author </td> </tr>#end if <tr> <th></th> <td><input type="submit" name="submit" value="$submittext" /></td> </tr></table></form>#end block tabcontent
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -