Ejemplo n.º 1
0
    def __init__(self):
        try:
            self.__check = int(request.values["check"])
        except:
            pass
        try:
            self.__isText = int(request.values["profilecode_isText"])
        except:
            pass
        try:
            self.__isToProfile = int(request.values["profilecode_isToProfile"])
        except:
            pass
        try:
            self.__text = str(request.values["profilecode_text"])
        except:
            pass
        try:
            self.__alert = str(request.values["profilecode_alert"])
        except:
            pass

        if self.__isText:
            self.__inputPart = 'type="submit" value="%s" class="forminput"' % self.__text
        else:
            self.__inputPart = 'type="image" src="%s" style="border: 0;"' % self.__text
        self.__input = (
            """<input %s onclick="alert('Grazie del supporto! Ricordati di registrare le modifiche una volta aperta la pagina del tuo profilo personale!')">"""
            % self.__inputPart
        )
        self.__userCode = self.__isToProfile and "1" or "22"

        if self.__check == 1:
            if self.__text == "":
                self.__action = "error"
                if self.__isText:
                    self.__error = errors.error("001", "Non hai specificato un testo per il bottone")
                else:
                    self.__error = errors.error("001", "Non hai specificato il link dell'immagine")
            elif (not self.__isText) and (not errors.urlMatch(self.__text)):
                self.__action = "error"
                self.__error = errors.error(
                    "002", "Il link dell'immagine deve iniziare con http:// e finire con un'estensione valida"
                )
            elif self.__alert == "":
                self.__action = "error"
                self.__error = errors.error("001", "Devi specificare un codice da aggiungere!")
            else:
                self.__action = "code"
                self.__script = self.__load()
        else:
            self.__action = "form"
Ejemplo n.º 2
0
    def __init__(self):
        try:
            self.__check = int(request.values["check"])
        except:
            pass
        try:
            self.__isText = int(request.values["support_isText"])
        except:
            pass
        try:
            self.__alert = str(request.values["support_text"])
        except:
            pass
        try:
            self.__id = str(request.values["support_id"])
        except:
            pass
        try:
            self.__json = str(request.values["json"])
        except:
            pass

        self.__inputText = self.__isText and '<input type="submit" value="%s" class="forminput">\n' % self.__alert or ""
        self.__inputImage = (
            (not int(self.__isText)) and '<input type="image" src="%s" style="border: 0;">\n' % self.__alert or ""
        )

        if self.__check == 1:
            if self.__alert == "":
                self.__action = "error"
                self.__error = errors.error("001", "Devi inserire un testo per il bottone")
            if self.__id == "":
                self.__action = "error"
                self.__error = errors.error("001", "Devi inserire un ID")
            if not self.__id.isdigit():
                self.__action = "error"
                self.__error = errors.error("002", "L'ID deve essere un numero!")
            if not self.__error:
                if self.__json:
                    self.__action = "json"
                    self.__json_dict["script"] = self.__load()
                    self.__json_dict["error"] = self.__error
                else:
                    self.__action = "code"
                    self.__script = self.__load()
        else:
            self.__action = "form"
Ejemplo n.º 3
0
	def __init__(self):
		try:
			self.__check = int(request.values['check'])
		except:
			pass
		try:
			self.__isText = int(request.values['support_isText'])
		except:
			pass
		try:
			self.__alert = str(request.values['support_text'])
		except:
			pass
		try:
			self.__id = str(request.values['support_id'])
		except:
			pass
			
		self.__inputText = self.__isText and '<input type="submit" value="%s" class="forminput">\n' % self.__alert or ''
		self.__inputImage = (not self.__isText) and '<input type="image" src="%s" style="border: 0;">\n' % self.__alert or ''

		if self.__check == 1:
			if self.__alert == '':
				self.__action = 'error'
				self.__error = errors.error('001', 'Devi inserire un testo per il bottone')
			elif self.__id == '':
				self.__action = 'error'
				self.__error = errors.error('001', "Devi inserire un ID")
			elif (not self.__isText) and (not errors.urlMatch(self.__alert)):
				self.__action = 'error'
				self.__error = errors.error('002', "Il link dell'immagine deve iniziare con http:// e finire con un'estensione valida")
			elif not self.__id.isdigit():
				self.__action = 'error'
				self.__error = errors.error('002', "L'ID deve essere un numero!")
			else:
				self.__action = 'code'
				self.__script = self.__load()
		else:
			self.__action = 'form'
Ejemplo n.º 4
0
	def __init__(self):
		try:
			self.__check = int(request.values['check'])
		except:
			pass
		try:
			self.__text = str(request.values['mousetrailer_text'])
		except:
			pass
		try:
			self.__speed = str(request.values['mousetrailer_speed'])
		except:
			pass
		try:
			self.__speedPers = str(request.values['mousetrailer_speedPers'])
		except:
			pass
		try:
			self.__distance = str(request.values['mousetrailer_distance'])
		except:
			pass
		try:
			self.__color = str(request.values['mousetrailer_color'])
		except:
			pass
		try:
			self.__size = str(request.values['mousetrailer_size'])
		except:
			pass
		try:
			self.__sizeType = str(request.values['mousetrailer_sizeType'])
		except:
			pass
		try:
			self.__isBold = int(request.values['mousetrailer_isBold'])
		except:
			pass
		try:
			self.__isItalic = int(request.values['mousetrailer_isItalic'])
		except:
			pass
		try:
			self.__isBlink = int(request.values['mousetrailer_isBlink'])
		except:
			pass
			
		if self.__isBold:
			self.__bold = 'font-weight: bold; '
		if self.__isItalic:
			self.__italic = 'font-style: italic; '
		if self.__isBlink:
			self.__blink = 'text-decoration: blink; '
		if self.__color:
			self.__color = 'color: %s; ' % self.__color
		else:
			self.__color = ''
		if self.__size:
			self.__size = 'font-size: %s%s; ' % (self.__size, self.__sizeType)
		else:
			self.__size = ''
		if not self.__speed:
			self.__speed = 'medium'
		if self.__speed == 'pers':
			self.__speed = self.__speedPers
		
		self.__array = str(wrap(self.__text, 1))
		self.__array = self.__array.replace('[', 'new Array(')
		self.__array = self.__array.replace(']', ')')
		self.__styles = '%s%s%s%s%s' % (self.__size, self.__color, self.__bold, self.__italic, self.__blink)


		if self.__check == 1:
			if self.__text == '':
				self.__action = 'error'
				self.__error = errors.error('001', 'Devi inserire un messaggio valido!')
			elif not self.__distance.isdigit():
				self.__action = 'error'
				self.__error = errors.error('002', 'La distanza deve essere un numero!')
			elif self.__size and not self.__size.isdigit():
				self.__action = 'error'
				self.__error = errors.error('002', 'La dimensione deve essere un numero')
			elif (self.__speed == 'pers') and (not self.__speedPers.isdigit()):
				self.__action = 'error'
				self.__error = errors.error('001', "La velocita' deve essere espressa sotto forma di numero")
			else:
				self.__action = 'code'
				self.__script = self.__load()
		else:
			self.__action = 'form'