class UpdateModel(form.Form): """update model table row data """ implements(IPublishTraverse) grok.context(Iormfolder) grok.name('update_model') grok.require('emc.kb.input_db') label = _(u"update model data") fields = field.Fields(IModel).omit('modelId', 'xhdm') ignoreContext = True xhdm = None #receive url parameters def publishTraverse(self, request, name): if self.xhdm is None: self.xhdm = name return self else: raise NotFound() def update(self): self.request.set('disable_border', True) # Get the model table query funcations # locator = getUtility(IModelLocator) # to do # fetch first record as sample data # self.screening = locator.screeningById(self.screeningId) # Let z3c.form do its magic super(UpdateModel, self).update() @button.buttonAndHandler(_(u"Submit")) def submit(self, action): """Update model recorder """ data, errors = self.extractData() if errors: self.status = self.formErrorsMessage return funcations = getUtility(IModelLocator) # import pdb # pdb.set_trace() try: funcations.updateByCode(xhdm=self.xhdm, xhmc=data['xhmc']) except InputError, e: IStatusMessage(self.request).add(str(e), type='error') self.request.response.redirect(self.context.absolute_url() + '/model_listings') confirm = _(u"Thank you! Your data will be update in back end DB.") IStatusMessage(self.request).add(confirm, type='info') self.request.response.redirect(self.context.absolute_url() + '/model_listings')
class IModel(Interface): """编号number 记录表 """ modelId = schema.Int(title=_(u"model table primary key"), ) # 型号代码 xhdm = schema.TextLine(title=_(u"model code"), ) #型号名称 xhmc = schema.TextLine(title=_(u"model name"), )
class ICeshishysh(Interface): """测试实验室 """ id = schema.Int(title=_(u"talbe primary key")) name = schema.TextLine(title=_(u"ming cheng")) unit = schema.TextLine(title=_(u"dan wei")) level1 = schema.TextLine(title=_(u"ji bie")) survey = schema.TextLine(title=_(u"gai kuang"))
class DeleteModel(form.Form): "delete the specify model recorder" implements(IPublishTraverse) grok.context(Iormfolder) grok.name('delete_model') grok.require('emc.kb.input_db') label = _(u"delete model data") fields = field.Fields(IModel).omit('modelId', 'xhdm', 'xhmc') ignoreContext = True xhdm = None #receive url parameters def publishTraverse(self, request, name): if self.xhdm is None: self.xhdm = name return self else: raise NotFound() def update(self): self.request.set('disable_border', True) # Get the model table query funcations locator = getUtility(IModelLocator) #to do #fetch the pending deleting record self.model = locator.getModelByCode(self.xhdm) #Let z3c.form do its magic super(DeleteModel, self).update() @button.buttonAndHandler(_(u"Delete")) def submit(self, action): """Delete model recorder """ data, errors = self.extractData() if errors: self.status = self.formErrorsMessage return funcations = getUtility(IModelLocator) try: funcations.DeleteByCode(self.xhdm) except InputError, e: IStatusMessage(self.request).add(str(e), type='error') self.request.response.redirect(self.context.absolute_url() + '/model_listings') confirm = _(u"Your data has been deleted.") IStatusMessage(self.request).add(confirm, type='info') self.request.response.redirect(self.context.absolute_url() + '/model_listings')
class LogSettingsEditForm(controlpanel.RegistryEditForm): schema = ILogSettings label = _(u"Log settings") description = _(u"Please enter details of log") def updateFields(self): super(LogSettingsEditForm, self).updateFields() self.fields['timeout'].widgetFactory = TextLinesFieldWidget self.fields['max'].widgetFactory = TextLinesFieldWidget self.fields['percentage'].widgetFactory = TextLinesFieldWidget self.fields['bsize'].widgetFactory = TextLinesFieldWidget
class IBachang(Interface): """靶场 """ id = schema.Int(title=_(u"talbe primary key")) name = schema.TextLine(title=_(u"ba chang ming cheng")) bcdm = schema.TextLine(title=_(u"ba chang dai ma")) location = schema.TextLine(title=_(u"ba chang wei zhi")) length = schema.Float(title=_(u"ba chang chang du")) width = schema.Float(title=_(u"ba chang kuan du")) wk = schema.Int(title=_(u"zhe dang wu ge shu")) ti = schema.Int(title=_(u"gu you fa she ji shu")) landform = schema.TextLine(title=_(u"ba chang di xing tiao jian")) xh = schema.TextLine(title=_(u"ba chang shi he xing hao"))
class ILvboq(Interface): """滤波器 """ id = schema.Int(title=_(u"table primary key"), ) cssbdm = schema.TextLine(title=_(u"cong shu she bei dai ma"), ) cssbmc = schema.TextLine(title=_(u"lv bo qi ming cheng"), ) pcdm = schema.TextLine(title=_(u"zhuang tai pi ci dai ma"), ) location = schema.TextLine(title=_(u"wei zhi"), ) freq = schema.Float(title=_(u"gong zuo pin lv"), ) f_upper = schema.Float(title=_(u"shang bian pin"), ) f_lower = schema.Float(title=_(u"xia bian pin"), ) order1 = schema.Float(title=_(u"lv bo qi ji shu"), ) s21 = schema.Float(title=_(u"lv bo qi cha sun"), )
class IJieshoutx(Interface): """接收天线 """ id = schema.Int(title=_(u"table primary key"), ) cssbdm = schema.TextLine(title=_(u"cong shu she bei dai ma"), ) cssbmc = schema.TextLine(title=_(u"jie shou tian xian ming cheng"), ) pcdm = schema.TextLine(title=_(u"zhuang tai pi ci dai ma"), ) location = schema.TextLine(title=_(u"wei zhi"), ) gain = schema.Float(title=_(u"zeng yi"), ) polarization = schema.TextLine(title=_(u"ji hua"), ) fwbskd = schema.Float(title=_(u"fang wei bo su dai kuan"), ) fybskd = schema.Float(title=_(u"fu yang bo su dai kuan"), ) txzxj = schema.Float(title=_(u"tian xian zhi xiang jiao"), )
class InputModel(form.Form): """input db model table data """ # implements(IPublishTraverse) grok.context(Iormfolder) grok.name('input_model') grok.require('emc.kb.input_db') label = _(u"Input model data") fields = field.Fields(IModel).omit('modelId') ignoreContext = True def update(self): self.request.set('disable_border', True) # Get the model table query funcations # locator = getUtility(IModelLocator) # to do # fetch first record as sample data # self.screening = locator.screeningById(self.screeningId) # Let z3c.form do its magic super(InputModel, self).update() @button.buttonAndHandler(_(u"Submit")) def submit(self, action): """Submit model recorder """ data, errors = self.extractData() if errors: self.status = self.formErrorsMessage return funcations = getUtility(IModelLocator) try: funcations.addModel(xhdm=data['xhdm'], xhmc=data['xhmc']) except InputError, e: IStatusMessage(self.request).add(str(e), type='error') self.request.response.redirect(self.context.absolute_url() + '/model_listings') confirm = _(u"Thank you! Your data will be update in back end DB.") IStatusMessage(self.request).add(confirm, type='info') self.request.response.redirect(self.context.absolute_url() + '/model_listings')
class ILogSettings(Interface): """A utility used to set log system 's timeout and max limit. """ timeout = schema.Int( title=_(u"timeout"), description=_(u"how many days that log at least will be reserved"), default=180, required=False, ) max = schema.Int( title=_(u"max recorders"), description=_(u"How many recorders that log at least will be reserved" " before the log dumped."), default=10000, required=False, ) percentage = schema.Float( title=_(u"Percentage"), description=_( u"when log numbers reach at some Percentage,send warning message"), default=0.9, required=False, ) bsize = schema.Int( title=_(u"batch size"), description=_( u"How many log recorders will be deleted when every log dumped"), default=2000, required=False, )
def getSignature(self): member = self.membership.getAuthenticatedMember() department = member.getProperty('description') if len(department): return department return _(u"non signature")
def cancel(self, action): """Cancel the data input """ confirm = _(u"Input cancelled.") IStatusMessage(self.request).add(confirm, type='info') self.request.response.redirect(self.context.absolute_url() + '/model_listings')
class ICeshiry(Interface): """测试人员 """ id = schema.Int(title=_(u"talbe primary key")) name = schema.TextLine(title=_(u"xing ming")) sex = schema.TextLine(title=_(u"xing bie")) age = schema.Int(title=_(u"nian ling")) edu_level = schema.TextLine(title=_(u"xue li")) post = schema.TextLine(title=_(u"zhi cheng")) certificate_code = schema.TextLine(title=_(u"zheng shu bian hao")) unit = schema.TextLine(title=_(u"dan wei"))
class IAdminLog(Interface): """管理员操作日志 """ id = schema.Int(title=_(u"the table's primary key"), ) # 主体 adminid = schema.TextLine(title=_(u"administrator's user id"), ) #客体 userid = schema.TextLine(title=_( u"the user id of user which had been processed by administrator"), ) #操作时间 datetime = schema.TextLine(title=_(u"operation time"), ) ip = schema.TextLine(title=_(u"the client's ip address"), ) type = schema.Int(title=_(u"type of the operation"), ) operlevel = schema.Int(title=_(u"level of the operation"), ) description = schema.Text(title=_(u"the operation's detail description"), ) result = schema.Int(title=_(u"result of the operation"), )
def validate(self, value): # Perform the standard validation first super(ValidateSchemaLength, self).validate(value) # import pdb # pdb.set_trace() context = self.context try: des = context.description length = len(context.description) if length > 300: raise Invalid(_(u"the max-length of the description is 300")) except: pass
class ICeshixm(Interface): """测试项目 """ id = schema.Int(title=_(u"talbe primary key")) device = schema.TextLine(title=_(u"bei ce jian")) name = schema.TextLine(title=_(u"xiang mu ming cheng")) # diagram = schema.TextLine( # title=_(u"shi yi tu") # ) t_remark = schema.TextLine(title=_(u"ce shi shuo ming")) t_strument = schema.TextLine(title=_(u"ce shi yi qi")) t_value = schema.TextLine(title=_(u"ce shi shu ju")) t_result = schema.TextLine(title=_(u"ce shi jie guo"))
class ICeshiff(Interface): """测试方法 """ id = schema.Int(title=_(u"talbe primary key")) m_id = schema.TextLine(title=_(u"fang fa bian hao")) m_title = schema.TextLine(title=_(u"fang fa biao ti")) range1 = schema.TextLine(title=_(u"shi yong fan wei")) device = schema.TextLine(title=_(u"yi qi she bei")) # diagram = schema.TextLine( # title=_(u"ce shi kuang tu") # ) step = schema.TextLine(title=_(u"ce shi bu zhou")) annotation = schema.TextLine(title=_(u"fu zhu"))
class IBranch(Interface): """分系统表 branch """ branchId = schema.Int(title=_(u"branch table primary key"), ) model = schema.Object( title=_(u"Model record"), schema=IModel, ) modelId = schema.Int(title=_(u"branch table foreign key"), ) # 分系统代码 fxtdm = schema.TextLine(title=_(u"branch code"), ) #分系统名称 fxtmc = schema.TextLine(title=_(u"branch name"), ) #分系统类别 fxtlb = schema.TextLine(title=_(u"branch category"), )
class IJieshouj(Interface): """接收机 """ id = schema.Int(title=_(u"table primary key"), ) sbdm = schema.TextLine(title=_(u"she bei dai ma"), ) sbmc = schema.TextLine(title=_(u"jie shou ji ming cheng"), ) pcdm = schema.TextLine(title=_(u"zhuang tai pi ci dai ma"), ) location = schema.TextLine(title=_(u"wei zhi"), ) fb_upper = schema.Float(title=_(u"pin duan shang xian"), ) fb_lower = schema.Float(title=_(u"pin duan xia xian"), ) freq = schema.Float(title=_(u"gongzuo pinlv"), ) f_upper = schema.Float(title=_(u"shang bian pin"), ) f_lower = schema.Float(title=_(u"xia bian pin"), ) bw_receiver = schema.Float(title=_(u"jie shou ji dai kuan"), ) sen_receiver = schema.Float(title=_(u"jie shou ji lin ming du"), ) mf_freq_sign = schema.TextLine(title=_(u"zhong pin fu hao"), ) mf_freq = schema.Float(title=_(u"zhong pin pin lv"), ) lo_freq = schema.Float(title=_(u"ben zhen pin lv"), )
class IDianxingtxzyzk(Interface): """典型天线增益子库 """ id = schema.Int(title=_(u"table primary key"), ) type_antennas = schema.TextLine(title=_(u"tian xian lei xing"), ) gain = schema.Int(title=_(u"zeng yi"), )
class IFashejzk(Interface): """发射机子库 """ id = schema.Int(title=_(u"table primary key"), ) lib_code = schema.TextLine(title=_(u"zi ku dai ma"), ) lib_name = schema.TextLine(title=_(u"zi ku ming cheng"), )
class IFashej(Interface): """发射机 """ id = schema.Int(title=_(u"table primary key"), ) sbdm = schema.TextLine(title=_(u"she bei dai ma"), ) sbmc = schema.TextLine(title=_(u"fa she ji ming cheng"), ) # 分系统代码 pcdm = schema.TextLine(title=_(u"zhuang tai pi ci dai ma"), ) #分系统名称 location = schema.TextLine(title=_(u"wei zhi"), ) #分系统类别 freq = schema.Float(title=_(u"gongzuo pinlv"), ) pd_upper = schema.Float(title=_(u"shang bian pin"), ) pd_lower = schema.Float(title=_(u"xia bian pin"), ) num = schema.Int(title=_(u"pinlv dian shu"), ) freq_upper = schema.Float(title=_(u"pinlv shang xian"), ) freq_lower = schema.Float(title=_(u"pinlv xia xian"), ) bw = schema.Float(title=_(u"fashe dai kuan"), ) base_power = schema.Float(title=_(u"ji pin gong lv"), ) tzlx = schema.TextLine(title=_(u"tiao zhi lei xing"), ) bzf = schema.Float(title=_(u"ben zhen pin lv"), ) mid_freq = schema.Float(title=_(u"zhong pin"), ) comment1 = schema.TextLine(title=_(u"bei zhu"), )
funcations = getUtility(IModelLocator) try: funcations.DeleteByCode(self.xhdm) except InputError, e: IStatusMessage(self.request).add(str(e), type='error') self.request.response.redirect(self.context.absolute_url() + '/model_listings') confirm = _(u"Your data has been deleted.") IStatusMessage(self.request).add(confirm, type='info') self.request.response.redirect(self.context.absolute_url() + '/model_listings') @button.buttonAndHandler(_(u"Cancel")) def cancel(self, action): """Cancel the data delete """ confirm = _(u"Delete cancelled.") IStatusMessage(self.request).add(confirm, type='info') self.request.response.redirect(self.context.absolute_url() + '/model_listings') class InputModel(form.Form): """input db model table data """ # implements(IPublishTraverse)
from emc.kb.contents.answer import Ianswer from emc.kb.utility import topicdate from zope.interface import Interface from plone.app.layout.navigation.interfaces import INavigationRoot from AccessControl.SecurityManagement import getSecurityManager from Products.CMFCore.utils import getToolByName #from zope.i18n.interfaces import ITranslationDomain #from zope.component import queryUtility from zope.i18n import translate from zope.i18nmessageid import Message from zope.component import getMultiAdapter from emc.kb import _ ALL_DAY = _( u"all day", default=u"all day" ) class Ihotanswer(Interface): """ hotanswer view interface """ def todayDate(): """返回今天的日期,年月日格式""" def weekagoDate(): """返回一周前的日期,年月日格式""" def monthagoDate(): """返回一个月前的日期,年月日格式"""
class ICeshibg(Interface): """测试报告 """ id = schema.Int(title=_(u"talbe primary key")) t_id = schema.TextLine(title=_(u"ce shi zheng shu bian hao")) bailor = schema.TextLine(title=_(u"wei tuo fang")) address = schema.TextLine(title=_(u"wei tuo fang di zhi")) device = schema.TextLine(title=_(u"bei ce jian")) eut_id = schema.TextLine(title=_(u"EUT bian hao")) eut_type = schema.TextLine(title=_(u"EUT xing hao")) manufacturor = schema.TextLine(title=_(u"zhi zao shang")) t_date = schema.Date(title=_(u"ce shi ri qi")) t_address = schema.TextLine(title=_(u"ce shi di dian")) t_device = schema.TextLine(title=_(u"ce shi she bei")) t_device_type = schema.TextLine(title=_(u"ce shi she bei xing hao")) t_device_id = schema.TextLine(title=_(u"ce shi she bei bian hao")) reference = schema.TextLine(title=_(u"ce shi yi ju")) temp = schema.Float(title=_(u"wen du")) huminitily = schema.Float(title=_(u"shi du")) t_man = schema.TextLine(title=_(u"ce shi ren yuan")) signer = schema.TextLine(title=_(u"qian fa ren")) assessor = schema.TextLine(title=_(u"shen he ren")) t_result = schema.TextLine(title=_(u"ce shi jie guo"))
def getDepartment(self): member = self.membership.getAuthenticatedMember() department = member.getProperty('department') if len(department): return department return _(u"not fill department")
class IBachangfshj(Interface): """靶场发射机 """ id = schema.Int(title=_(u"talbe primary key")) bcdm = schema.Int(title=_(u"ba chang dai ma")) sbmc = schema.TextLine(title=_(u"fa she ji ming cheng")) fsno = schema.Int(title=_(u"fa she ji xu hao")) x = schema.Float(title=_(u"ba chang x zuo biao")) y = schema.Float(title=_(u"ba chang y zuo biao")) z = schema.Float(title=_(u"ba chang z zuo biao")) ft = schema.TextLine(title=_(u"gong zuo pin lv")) pd_u = schema.Float(title=_(u"shang bian pin")) pd_l = schema.Float(title=_(u"xia bian pin")) num = schema.Int(title=_(u"pin lv dian shu")) fu = schema.Float(title=_(u"pin duan shang xian")) fl = schema.Float(title=_(u"pin duan xia xian")) bt = schema.Float(title=_(u"fa she dai kuan")) pt = schema.Float(title=_(u"ji pin gong lv")) tzlx = schema.TextLine(title=_(u"tiao zhi lei xing")) bzf = schema.Float(title=_(u"ben zheng pin lv")) zp = schema.Float(title=_(u"zhong pin")) bz = schema.TextLine(title=_(u"bei zhu"))
from emc.kb.contents.questionfolder import Iquestionfolder from emc.kb.contents.topicfolder import Itopicfolder from plone.memoize.instance import memoize from emc.kb import _ from zope.i18n import translate from zope.i18nmessageid import Message import time from time import mktime from datetime import datetime JUST_NOW = _( u"just now", default=u"just now" ) MINUTES_AGO = _( u"minutes ago", default=u"minutes ago" ) HOURS_AGO = _( u"hours ago", default=u"hours ago" ) DAYS_AGO = _( u"days ago", default=u"days ago" ) A_WEEK_AGO = _( u"a week ago",
def title(self): return _(u"User portlet")
def getPosition(self): member = self.membership.getAuthenticatedMember() position = member.getProperty('position') if len(position): return position return _(u"not fill position")
def title(self): return _(u"Related Information")
class IBachangzhdw(Interface): """靶场遮挡物 """ id = schema.Int(title=_(u"talbe primary key")) bcdm = schema.TextLine(title=_(u"ba chang dai ma")) shelter_name = schema.TextLine(title=_(u"zhe dang wu ming cheng")) # zdno = schema.Int( # title=_(u"xiang mu ming cheng") # ) lu_x = schema.Float(title=_(u"zuo shang x zuo biao")) lu_y = schema.Float(title=_(u"zuo shang y zuo biao")) lu_z = schema.Float(title=_(u"zuo shang z zuo biao")) ld_x = schema.Float(title=_(u"zuo xia x zuo biao")) ld_y = schema.Float(title=_(u"zuo xia y zuo biao")) ld_z = schema.Float(title=_(u"zuo xia z zuo biao")) ru_x = schema.Float(title=_(u"you shang x zuo biao")) ru_y = schema.Float(title=_(u"you shang y zuo biao")) ru_z = schema.Float(title=_(u"you shang z zuo biao")) rd_x = schema.Float(title=_(u"you xia x zuo biao")) rd_y = schema.Float(title=_(u"you xia x zuo biao")) rd_z = schema.Float(title=_(u"you xia x zuo biao"))