コード例 #1
0
 def toggleLock(self, param):
     if not config.ParentalControl.configured.value:
         return (False, "Parent Control is not activated.")
     sRef = None
     if "sRef" in param:
         if param["sRef"] is not None:
             sRef = param["sRef"]
     if sRef is None:
         return (False, "No service given!")
     if config.ParentalControl.setuppinactive.value:
         password = None
         if "password" in param:
             if param["password"] is not None:
                 password = param["password"]
         if password is None:
             return (False, "No Parent Control Setup Pin given!")
         else:
             if password.isdigit():
                 if int(password) != config.ParentalControl.setuppin.value:
                     return (False, "Parent Control Setup Pin is wrong!")
             else:
                 return (False, "Parent Control Setup Pin is wrong!")
     cur_ref = eServiceReference(sRef)
     protection = parentalControl.getProtectionType(
         cur_ref.toCompareString())
     if protection[0]:
         parentalControl.unProtectService(cur_ref.toCompareString())
     else:
         parentalControl.protectService(cur_ref.toCompareString())
     protection = parentalControl.getProtectionType(
         cur_ref.toCompareString())
     if cur_ref.flags & eServiceReference.mustDescent:
         serviceType = "Bouquet"
     else:
         serviceType = "Service"
     protectionText = "%s %s is unlocked." % (serviceType,
                                              self.getName(cur_ref))
     if protection[0]:
         if protection[1] == IMG_BLACKSERVICE:
             protectionText = "Service %s is locked." % self.getName(
                 cur_ref)
         elif protection[1] == IMG_BLACKBOUQUET:
             #(locked -B-)
             protectionText = "Bouquet %s is locked." % self.getName(
                 cur_ref)
         elif protection[1] == "":
             # (locked)
             protectionText = "%s %s is locked." % (serviceType,
                                                    self.getName(cur_ref))
     else:
         if protection[1] == IMG_WHITESERVICE:
             #(unlocked -S-)
             protectionText = "Service %s is unlocked." % self.getName(
                 cur_ref)
         elif protection[1] == IMG_WHITEBOUQUET:
             #(unlocked -B-)
             protectionText = "Bouquet %s is unlocked." % self.getName(
                 cur_ref)
     return (True, protectionText)
コード例 #2
0
	def toggleSelectedLock(self):
		print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
		print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
		self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]);
		if self.l.getCurrentSelection()[0][2]:
			parentalControl.protectService(self.l.getCurrentSelection()[0][0])
		else:
			parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])	
		self.l.setList(self.list)
コード例 #3
0
	def toggleSelectedLock(self):
		print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
		print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
		self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]);
		if self.l.getCurrentSelection()[0][2]:
			parentalControl.protectService(self.l.getCurrentSelection()[0][0])
		else:
			parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])	
		self.l.setList(self.list)
コード例 #4
0
 def toggleLock(self, param):
     if not config.ParentalControl.configured.value:
         return (False, _("Parent Control is not activated."))
     sRef = None
     if "sRef" in param:
         if param["sRef"] is not None:
             sRef = param["sRef"]
     if sRef is None:
         return (False, _("No service given!"))
     if "setuppinactive" in config.ParentalControl.dict().keys(
     ) and config.ParentalControl.setuppinactive.value:
         password = None
         if "password" in param:
             if param["password"] is not None:
                 password = param["password"]
         if password is None:
             return (False, _("No Parent Control Setup Pin given!"))
         else:
             if password.isdigit():
                 if int(password) != config.ParentalControl.setuppin.value:
                     return (False, _("Parent Control Setup Pin is wrong!"))
             else:
                 return (False, _("Parent Control Setup Pin is wrong!"))
     cur_ref = eServiceReference(sRef)
     protection = parentalControl.getProtectionLevel(
         cur_ref.toCompareString())
     if protection:
         parentalControl.unProtectService(cur_ref.toCompareString())
     else:
         parentalControl.protectService(cur_ref.toCompareString())
     if cur_ref.flags & eServiceReference.mustDescent:
         serviceType = "Bouquet"
     else:
         serviceType = "Service"
     if protection:
         if config.ParentalControl.type.value == "blacklist":
             if parentalControl.blacklist.has_key(sref):
                 if "SERVICE" in parentalControl.blacklist.has_key(sref):
                     protectionText = _(
                         "Service %s is locked.") % self.getName(cur_ref)
                 elif "BOUQUET" in parentalControl.blacklist.has_key(sref):
                     protectionText = _(
                         "Bouquet %s is locked.") % self.getName(cur_ref)
                 else:
                     protectionText = _("%s %s is locked.") % (
                         serviceType, self.getName(cur_ref))
         else:
             if hasattr(ParentalControl, "whitelist"
                        ) and parentalControl.whitelist.has_key(sref):
                 if "SERVICE" in parentalControl.whitelist.has_key(sref):
                     protectionText = _(
                         "Service %s is unlocked.") % self.getName(cur_ref)
                 elif "BOUQUET" in parentalControl.whitelist.has_key(sref):
                     protectionText = _(
                         "Bouquet %s is unlocked.") % self.getName(cur_ref)
     return (True, protectionText)
コード例 #5
0
	def toggleSelectedLock(self):
		print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
		print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
		curSel = self.l.getCurrentSelection()
		if curSel[0][2]:
			parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
		else:
			parentalControl.protectService(self.l.getCurrentSelection()[0][0])	
		#Instead of just negating the locked- flag, now I call the getProtectionType every time...
		self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0]))
		self.l.setList(self.list)
コード例 #6
0
ファイル: ParentalControlList.py プロジェクト: vuteam/bbh
	def toggleSelectedLock(self):
		from Components.ParentalControl import parentalControl
		print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
		print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
		curSel = self.l.getCurrentSelection()
		if curSel[0][2]:
			parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
		else:
			parentalControl.protectService(self.l.getCurrentSelection()[0][0])
		#Instead of just negating the locked- flag, now I call the getProtectionType every time...
		self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0]))
		self.l.setList(self.list)
コード例 #7
0
	def toggleLock(self, param):
		if not config.ParentalControl.configured.value:
			return (False, "Parent Control is not activated.")
		sRef = None
		if "sRef" in param:
			if param["sRef"] is not None:
				sRef =param["sRef"]
		if sRef is None:
			return (False, "No service given!")
		if config.ParentalControl.setuppinactive.value:
			password = None
			if "password" in param:
				if param["password"] is not None:
					password =param["password"]
			if password is None:
				return (False, "No Parent Control Setup Pin given!")
			else:
				if password.isdigit():
					if int(password) != config.ParentalControl.setuppin.value:
						return (False, "Parent Control Setup Pin is wrong!")
				else:
					return (False, "Parent Control Setup Pin is wrong!")
		cur_ref = eServiceReference(sRef)
		protection = parentalControl.getProtectionType(cur_ref.toCompareString())
		if protection[0]:
			parentalControl.unProtectService(cur_ref.toCompareString())
		else:
			parentalControl.protectService(cur_ref.toCompareString())
		protection = parentalControl.getProtectionType(cur_ref.toCompareString())
		if cur_ref.flags & eServiceReference.mustDescent:
			serviceType = "Bouquet"
		else:
			serviceType = "Service"
		protectionText = "%s %s is unlocked." % (serviceType, self.getName(cur_ref))
		if protection[0]:
			if protection[1] == IMG_BLACKSERVICE:
				protectionText = "Service %s is locked." % self.getName(cur_ref)
			elif protection[1] == IMG_BLACKBOUQUET:
				#(locked -B-)
				protectionText = "Bouquet %s is locked." % self.getName(cur_ref)
			elif protection[1] == "":
				# (locked)
				protectionText = "%s %s is locked." % (serviceType, self.getName(cur_ref))
		else:
			if protection[1] == IMG_WHITESERVICE:
				#(unlocked -S-)
				protectionText = "Service %s is unlocked."  % self.getName(cur_ref)
			elif protection[1] == IMG_WHITEBOUQUET:
				#(unlocked -B-)
				protectionText = "Bouquet %s is unlocked."  % self.getName(cur_ref)
		return (True, protectionText)
コード例 #8
0
 def toggleLock(self, param):
     if not config.ParentalControl.configured.value:
         return (False, "Parent Control is not activated.")
     sRef = None
     if "sRef" in param:
         if param["sRef"] is not None:
             sRef = param["sRef"]
     if sRef is None:
         return (False, "No service given!")
     if "setuppinactive" in config.ParentalControl.dict().keys() and config.ParentalControl.setuppinactive.value:
         password = None
         if "password" in param:
             if param["password"] is not None:
                 password = param["password"]
         if password is None:
             return (False, "No Parent Control Setup Pin given!")
         else:
             if password.isdigit():
                 if int(password) != config.ParentalControl.setuppin.value:
                     return (False, "Parent Control Setup Pin is wrong!")
             else:
                 return (False, "Parent Control Setup Pin is wrong!")
     cur_ref = eServiceReference(sRef)
     protection = parentalControl.getProtectionLevel(cur_ref.toCompareString())
     if protection:
         parentalControl.unProtectService(cur_ref.toCompareString())
     else:
         parentalControl.protectService(cur_ref.toCompareString())
     if cur_ref.flags & eServiceReference.mustDescent:
         serviceType = "Bouquet"
     else:
         serviceType = "Service"
     if protection:
         if config.ParentalControl.type.value == "blacklist":
             if parentalControl.blacklist.has_key(sref):
                 if "SERVICE" in parentalControl.blacklist.has_key(sref):
                     protectionText = "Service %s is locked." % self.getName(cur_ref)
                 elif "BOUQUET" in parentalControl.blacklist.has_key(sref):
                     protectionText = "Bouquet %s is locked." % self.getName(cur_ref)
                 else:
                     protectionText = "%s %s is locked." % (serviceType, self.getName(cur_ref))
         else:
             if hasattr(ParentalControl, "whitelist") and parentalControl.whitelist.has_key(sref):
                 if "SERVICE" in parentalControl.whitelist.has_key(sref):
                     protectionText = "Service %s is unlocked." % self.getName(cur_ref)
                 elif "BOUQUET" in parentalControl.whitelist.has_key(sref):
                     protectionText = "Bouquet %s is unlocked." % self.getName(cur_ref)
     return (True, protectionText)
コード例 #9
0
	def toggleSelectedLock(self):
		from Components.ParentalControl import parentalControl
		print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
		print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
# [iq - problem with many channels
		if self.l.getCurrentSelection() is None or self.l.getCurrentSelectionIndex() is None:
			return
# iq]
		curSel = self.l.getCurrentSelection()
		if curSel[0][2]:
			parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
		else:
			parentalControl.protectService(self.l.getCurrentSelection()[0][0])
		#Instead of just negating the locked- flag, now I call the getProtectionType every time...
		self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0]))
		self.l.setList(self.list)
コード例 #10
0
	def addParentalProtection(self, service):
		parentalControl.protectService(service.toCompareString())
		self.close()