예제 #1
0
	def __init__(self, req,createContent=True,parent=None):
		self._alerts = []
		self._splitAlerts = 1
		self._extraSheets = []
		self._exportTable = None

		# used in psp
		self.injectedContent = ''
		self.content = None
		self.overrideContent = None
		self.inputHidden = True
		self.inputBox = None

		InputController.__init__(self,req,parent=parent)

		if isinstance(parent,BaseController):
			# safe time and increase consistency
			self.now = self.parent.now
			self.weekago = self.parent.weekago
			self.yesterday = self.parent.yesterday
			self.today = self.parent.today
			self.testAlerts = self.parent.testAlerts
			self.debugAlerts = self.parent.debugAlerts
		else:
			self.now = datetime.datetime.now()
			self.today = datetime.datetime( *self.now.timetuple()[0:3] )
			self.weekago = self.today-datetime.timedelta(days=7)
			self.yesterday = self.today-datetime.timedelta(days=1)
			self.today = self.today
			self.testAlerts = StringToBool(self.getField('testAlerts'))
			self.debugAlerts = StringToBool(self.getField('debugAlerts'))
			BytesToText.setFixed(StringToBool(self.getField('fixedUnit'),default=None,empty=None,none=None))
			BytesToText.setShowUnit(StringToBool(self.getField('showUnit',True),default=True,none=None))
			BytesToText.setBase(self.getField('baseUnit'))
			BytesToText.setPrecision(self.getField('precisionUnit'))
			try: self.testAlerts = int(self.testAlerts)
			except: pass
			homePrefix = self.getHomePrefix()
			baselayout = self.getBaseLayout()
			self.addStyleSheet(homePrefix+'css/outer-baselayout.css','outer','baselayout','screen',active=baselayout=='outer')
			self.addStyleSheet(homePrefix+'css/inner-baselayout.css','inner','baselayout','screen',active=baselayout=='inner')
			self.addStyleSheet(homePrefix+'css/print-baselayout.css','print','baselayout','print')

			self.addStyleSheet(homePrefix+'css/core.css','std','core')

			theme = self.getColorTheme()
			for name,file in _themes:
				self.addStyleSheet(homePrefix+file,name,'color-theme',active=theme==name)

			shadows = self.getShadows()
			if shadows:
				self.addStyleSheet(homePrefix+'css/half-shadows.css','half','shadows',active=shadows=='half')
				self.addStyleSheet(homePrefix+'css/full-shadows.css','full','shadows',active=shadows=='full')
				StandardController._noshadowdops = False
			else:
				StandardController._noshadowdops = True

		if not createContent: return

		self.preCreate()
		self.createContent()
		self.postCreate()