Exemple #1
0
	def post(self):
		user = self.get_user_type()
		if user == user_type.visitor:
			self.redirect('/')
		elif user == user_type.student:
			self.redirect('/')
		elif user == user_type.tutor:			

			if not 'video_material_id' in self.session:
				self.session['video_material_id'] = None
			if not 'extension' in self.session:
				self.session['extension'] = None
			if not 'size' in self.session:
				self.session['size'] = None
			title = self.request.get('title',None)
			description = self.request.get('description',None)
			level = int(self.request.get('level',None))
			unit_id = self.request.get('unit',None)
			subject = subject_management().get_subject_by_name('Programacion Orientada a Objetos')
			if unit_id:
				unit_id = int(unit_id)
			topic = title
			tags = self.request.get_all('tags',None)				  			
			tutor_key = tutor_management().get_tutor(self.session['user-id']).key()
			video_material_id = self.request.get('video_material_id',None)
			if video_material_id:
				video_material_id = int(video_material_id)
				video_material_instance = video_material_management().get_video_material(video_material_id)
				topic_ins = topic_management().get_topic(video_material_instance.topic.key().id())
				topic_management().modify(subject.key(),topic_ins.key(),topic)								
				video_ins = video_management().get_video(video_material_instance.video.key().id())
				video_management().modify(video_ins.key(),description,video_ins.size)
				video_material_management().modify(video_material_instance.key(),video_ins.key(),level,unit_id,subject.key(),topic_ins.key(),tags,tutor_key)
			else:				
				size = self.session['size']
				self.session['size'] = None
				size = int(size)
				duration = self.request.get('duration',None)
				ext_format = self.session['extension']
				#size = self.request.get('size',None)
				topic_key = topic_management().add(subject.key(),topic)				
				video_id = int(self.session['video-id'])
				self.session['video-id'] = None
				video_instance = video_management().get_video(video_id)	
				video_key = video_management().add(video_instance.key(),description,duration,ext_format,size,0)
				video_material_management().add(video_key,level,unit_id,subject.key(),topic_key,tags,tutor_key)				
			sleep(0.1)
			self.redirect('/admin_video')       	
		else:
			self.redirect('/')
Exemple #2
0
    def get(self):
        user = self.get_user_type()                    
        if user == user_type.visitor:                    
            self.redirect('/')
            return 0
        elif user == user_type.student:                 
			student_instance = student_management().get_student(int(self.session['user-id']))
			tutor = tutor_management().get_all_tutors()[0]            
			subject = subject_management().get_subject_by_name('Programacion Orientada a Objetos')			
			unit_id = self.request.get('unit_id',None)
			if unit_id:
				unit_id = int(unit_id)
			else:
				##id de 1era unidad
				unit_id = 6348855016685568
			page = self.request.get('page',0)
			try:
				int(page)
				page = int(page)-1
			except ValueError:
				page = 0
			if page < 1:
				page = 0
			unit = unit_management().get_unit(unit_id)
			list_list_text_info = []            
			countent = {}
			list_counter = []   
			list_content = []
			listi = []
			list_all_videos = video_material_management().get_all_unit_available_videos(unit.key().id())
			for t in student_instance.tutors_list:
				listi.extend(video_material_management().get_all_videos_material(t,subject.key(),page))       
			self.list_list_vm = video_material_management().get_list_video_material_of_subject(tutor.key(),page)                        
			list_vm = video_material_management().get_unit_available_videos(unit.key().id(),page)     
			
			c=0
			list_videos = []
			total_text = 0
			if list_vm:
				for index in range(len(list_vm)):
					vm = list_vm[index]
					video_instance = video_material_management().get_video(vm)
					vinfo = {}        
					vinfo['id'] = vm.key().id()          
					vinfo['able'] = vm.available
					vinfo['tutor'] = (tutor_management().get_tutor(vm.tutor.key().id())).first
					vinfo['topic'] = (topic_management().get_topic(vm.topic.key().id())).name                    
					vinfo['content'] = video_instance.content                    
					vinfo['number_views'] = video_instance.number_views
					list_videos.append(vinfo)
					index = index + 1

			pages = int(ceil(len(list_all_videos)/10.))
			if pages < 1:
				pages = 1
			list_page = [None] * pages              
			
			html = ''
			template_values={
				"user":"******",
				"header_welcome":"",
				"header_tutor":"",
                "total_pages":len(list_page),
                "current_page":(page+1),
				"list_videos": list_videos,
				"unit_id": unit_id,                
				"pages":list_page,
				"Titulo":"Gestion de Videos",
				"counter":list_counter,
				"html":html,
				"subject":subject.name,
				"student_name": student_instance.first
			}  
			                  
			self.response.write(admin_video_template.render(template_values))  
        	
			return 1

        elif user == user_type.tutor:                                    
			list_list_texts = []
			tutor_id = self.session['user-id']
			tutor_key = tutor_management().get_tutor(tutor_id).key()
			tutor_instance = tutor_management().get_tutor(tutor_id)
			subject = subject_management().get_subject_by_name('Programacion Orientada a Objetos')
			page = self.request.get('page',0)
			try:
				int(page)
				page = int(page)-1
			except ValueError:
				page = 0
			if page < 1:
				page = 0
			index = 0
			list_list_text_info = []            
			countent = {}
			list_counter = []   
			list_content = []         
			#self.list_list_vm = text_material_management().get_list_text_material_of_subject(tutor_key,pages) 

			listi = video_material_management().get_all_videos_material(tutor_key,subject,page)     
			list_vm = video_material_management().get_list_video_material_of_one_subject(tutor_key,subject.key(),page)
			c=0
			list_videos = []
			total_text = 0
			if list_vm:
				for index in range(len(list_vm)):
					vm = list_vm[index]
					video_instance = video_material_management().get_video(vm)
					vinfo = {}        
					vinfo['id'] = vm.key().id()          
					vinfo['able'] = vm.available
					vinfo['tutor'] = (tutor_management().get_tutor(vm.tutor.key().id())).first
					vinfo['topic'] = (topic_management().get_topic(vm.topic.key().id())).name                    
					vinfo['content'] = video_instance.content                    
					vinfo['number_views'] = video_instance.number_views
					list_videos.append(vinfo)
					index = index + 1
			
			pages = int(ceil(len(listi)/10.))
		
			if pages < 1:
				pages = 1
			list_page = [None] * pages              
			
			template_values={
				"user":"******",
				"header_welcome":"",
				"header_tutor":"",
				"list_videos": list_videos,  
                "total_pages":len(list_page),
                "current_page":(page+1),
				"pages":list_page,
				"Titulo":"Gestion de Videos",
				"counter":list_counter,			
				"subject":subject.name,
				"tutor_name": tutor_instance.first
			}  
			                  
			self.response.write(admin_video_template.render(template_values))  
			return 2                    
        else:                        
            
            admi_text_template_values = {

            }
            self.response.write(admi_text_template.render(template_values))                        
            return 3
Exemple #3
0
    def get(self):
        user = self.get_user_type()
        if user == user_type.visitor:
            self.redirect('/')
        elif user == user_type.student:
            video_material_id = self.request.get('video_material_id',None)
            if not video_material_id:
                self.redirect('/explorer')
            video_instance = None        
            video_material_instance = None
            video_material_id = int(video_material_id)
            if video_material_id:                
                video_material_instance = video_material_management().get_video_material(video_material_id)
            if not video_material_instance:
                self.redirect('/explorer')                
            else:             
            	student_instance = student_management().find_key(self.session['user-id'])
                video_instance = video_material_management().get_video(video_material_instance)                        
                video_management().update_number_views(video_instance)
                list_tag_video_supported = ['mkv','mp4']
                list_tag_embedded_supported = ['wmv','mov','mpg','avi']
                #list_tag_object_supported = ['swf'] 
                vformat = video_instance.ext_format                
                vinfo = {}
                vinfo['format'] = vformat
                vinfo['tutor'] = (tutor_management().get_tutor(video_material_instance.tutor.key().id())).first
                vinfo['topic'] = (topic_management().get_topic(video_material_instance.topic.key().id())).name                    
                vinfo['content'] = video_instance.content
                vinfo['subject'] = (subject_management().get_subject(video_material_instance.subject.key().id())).name
                vinfo['description'] = video_instance.description
                vinfo['tags'] = video_material_instance.tags
                template_values={
                    "user":"******",   
                    "header_welcome":"",
                    "header_tutor":"",                
                    "vinfo":vinfo,            
                    'embbeded_supported':list_tag_embedded_supported,
                    'video_supported':list_tag_video_supported,
                    "student_name":student_instance.first
                    #"object_supported":list_tag_object_supported
                }                                           
                self.response.write(viewvideo_template.render(template_values))            
        elif user == user_type.tutor:
            video_material_id = int(self.request.get('video_material_id', None))
            video_instance = None        
            video_material_instance = None
            if video_material_id:                
                video_material_instance = video_material_management().get_video_material(video_material_id)
            if not video_material_instance:
                self.redirect('/home')                
            else:
				tutor_id = self.session['user-id']
				tutor_key = tutor_management().get_tutor(tutor_id).key()
				tutor_instance = tutor_management().get_tutor(tutor_id)
				video_instance = video_material_management().get_video(video_material_instance)                                                
				list_video_supported = ['mp4','wmv','mkv','ogg','webm']
				vformat = video_instance.ext_format            
				#list_tag_object_supported = ['swf']
				vinfo = {}
				vinfo['format'] = vformat
				vinfo['tutor'] = (tutor_management().get_tutor(video_material_instance.tutor.key().id())).first
				vinfo['topic'] = (topic_management().get_topic(video_material_instance.topic.key().id())).name                    
				vinfo['content'] = video_instance.content
				vinfo['subject'] = (subject_management().get_subject(video_material_instance.subject.key().id())).name
				vinfo['description'] = video_instance.description
				vinfo['tags'] = video_material_instance.tags
				#blob_info = BlobInfo.get(video_instance.content.key())
				template_values={
					"user":"******",   
					"header_welcome":"",
					"header_tutor":"",                
					"vinfo":vinfo,                                
					"tutor_name": tutor_instance.first,					
					#"object_supported":list_tag_object_supported
				}         
				#self.response.headers['Content-Type'] = 'video/avi'
				self.response.write(viewvideo_template.render(template_values))            
        else:
            self.redirect('/home')
Exemple #4
0
    def get(self):
        user = self.get_user_type()                    
        if user == user_type.visitor:                                    
			self.redirect('/')
			return 0
        elif user == user_type.student:                    	
			#self.response.headers['Content-Type'] = 'text/html'
			classification = self.request.get('classification',None)
			student_instance = student_management().find_key(self.session['user-id'])
			page = 1            
			list_list_texts = []
			index = 0
			list_list_text_info = []            
			list_list_counter = []
			countent = {}
			list_counter = []   
			list_content = []         
			i = 0
			list_list_tm = text_material_management().get_subjects_available_texts(page)
			for index in range(len(list_list_tm)):
				list_texts = []
				counter = {}                
				content = {}
				if list_list_tm[index]:	
					counter['tutorid'] = ''
					counter['class'] = 'subject'
					counter['title'] = (subject_management().get_subject(list_list_tm[index][0].subject.key().id())).name                    
					counter['total-text'] = text_material_management().get_all_subject_available_texts(list_list_tm[index][0].subject.key(),page)
					for subindex in range(len(list_list_tm[index])):                    
						tm = list_list_tm[index][subindex]
						text_instance = text_material_management().get_text(tm)
						tinfo = {}        
						tinfo['id'] = tm.key().id()          
						if tm.available == True:
							tinfo['able'] = 'Deshabilitar'
						else:
							tinfo['able'] = 'Habilitar'
						tinfo['tutor'] = (tutor_management().get_tutor(tm.tutor.key().id())).first
						tinfo['topic'] = (topic_management().get_topic(tm.topic.key().id())).name                    
						tinfo['content'] = text_instance.content                    
						tinfo['number_views'] = text_instance.number_views
						list_texts.append(tinfo)
					index = index + 1
					counter['index'] = index
					list_counter.append(copy.deepcopy(counter))
					list_list_text_info.append(list_texts)
			list_list_tm = text_material_management().get_tutors_available_texts(page)        		
			x = 2
			for index in range(len(list_list_tm)):
				list_texts = []
				counter = {}                
				content = {}
				if list_list_tm[index]:			
					counter['tutorid'] = list_list_tm[index][0].tutor.key().id()
					counter['class'] = 'tutor'		
					counter['title'] = (tutor_management().find_key(list_list_tm[index][0].tutor.key().id())).first                    
					counter['total-text'] = text_material_management().get_all_tutor_available_texts(list_list_tm[index][0].tutor.key(),page)
					for subindex in range(len(list_list_tm[index])):                    
						tm = list_list_tm[index][subindex]
						text_instance = text_material_management().get_text(tm)
						tinfo = {}        
						tinfo['id'] = tm.key().id()          
						if tm.available == True:
							tinfo['able'] = 'Deshabilitar'
						else:
							tinfo['able'] = 'Habilitar'
						tinfo['tutor'] = (tutor_management().get_tutor(tm.tutor.key().id())).first
						tinfo['topic'] = (topic_management().get_topic(tm.topic.key().id())).name                    
						tinfo['content'] = text_instance.content                    
						tinfo['number_views'] = text_instance.number_views
						list_texts.append(tinfo)
					index = index + 1
					counter['index'] = index
					list_counter.append(copy.deepcopy(counter))
					list_list_text_info.append(list_texts)				

			new_list_counter = []
			l = []
			c = 0
			for i in range(len(list_counter)):
				c = 0
				l = list_counter[i]['total-text']
				new_counter = {}
				for j in range(len(l)):
					if l[j].available:
						c+=1
				# for j in range(len(list_counter[i])):
				# 	if list_counter[i][j]['total-text'].available:
				# 		c += 1
				new_counter['num_texts'] = c
				new_list_counter.append(copy.deepcopy(new_counter))

			html = ''			
			for i in range(len(list_list_text_info)):                
				if  x==2:
					html += '<div class="block '+str(list_counter[i]['class'])+'" data-tutor-id="'+str(list_counter[i]['tutorid'])+'" id="num'+str(i)+'"><div class="head"><i class="fa fa-book"></i> <span class="subject">'+str(list_counter[i]['title'])+'</span><small> ('+str(new_list_counter[i]['num_texts'])+' texts)</small><span class="toggle"><i class="fa fa-caret-square-o-up"></i> Ocultar Materia</span></div>'
				else:
					html += '<div class="block '+str(list_counter[i]['class'])+'" id="num'+str(i)+'"><div class="head"><i class="fa fa-book"></i> <span class="subject">'+str(list_counter[i]['title'])+'</span><small> (# texts)</small><span class="toggle"><i class="fa fa-caret-square-o-up"></i> Ocultar Materia</span></div>'					
				for j in range(len(list_list_text_info[i])):
					html +='\
					<a class="textr" href="view_text?text_material_id='+str(list_list_text_info[i][j]['id'])+'" alt="'+str(list_list_text_info[i][j]['topic'])+'">\
					<div class="text" id="'+str(list_list_text_info[i][j]['id'])+'">\
					<div class="bimg" style="background:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS67YRkacb2A7x0mniuG1SUXllu22UOKOGYfJwARDWeZl8SyZQpfg);background-size:cover;background-position:center;">\
					<div class="views">\
					<i class="fa fa-eye"></i> '+str(list_list_text_info[i][j]['number_views'])+'\
					</div>\
					</div>\
					<div class="about">\
					<h2>'+str(list_list_text_info[i][j]['topic'])+'</h2>\
					<small>por '+str(list_list_text_info[i][j]['tutor'])+'</small>\
					</div>\
			 		</div>\
			 		</a>  '
			 	# if len(list_counter[i]['total-text']) > 6:
			 	if new_list_counter[i]['num_texts'] > 6:
			 		html += '<div class="more"><i class="fa fa-refresh"></i> Mostrar mas</div>'                    
			 	html += '</div>'           

			template_values={
				"user":"******",
				"header_welcome":"",
				"header_tutor":"",
				"list_list_texts": list_list_text_info,                
				"counter":list_counter,
				"html":html,
				"student_name":student_instance.first
			}
			self.response.write(explorer_template.render(template_values)) 
			return 1
        elif user == user_type.tutor:                      	        
			self.redirect('/home')            
			return 2                    
        else:          	        
			self.redirect('/home')                                         
			return 3
Exemple #5
0
    def post(self):
    	user = self.get_user_type()                    
        if user == user_type.visitor:                    
			self.redirect('/')			               
			return 0
        elif user == user_type.student:
			page = self.request.get('tm_page',None)   
			tutor_id = self.request.get('tm_tutor',None)
			subject_name = self.request.get('tm_subject')
			list_list_texts = []			
			index = 0
			list_texts = []                  
			enter = False
			if tutor_id:
				tutor_id = int(tutor_id)
				tutor_key = tutor_management().get_tutor(tutor_id).key()
				list_tm = text_material_management().get_tutor_available_texts(tutor_key,page)       
				enter = True
			elif subject_name:
				subject_instance = subject_management().find_name(subject_name)
				list_tm = text_material_management().get_subject_available_texts(subject_instance.key(),page)
				enter = True

			if enter == True:
				for index in range(len(list_tm)):                    
					tm = list_tm[index]
					text_instance = text_material_management().get_text(tm)
					tinfo = {}        
					tinfo['id'] = tm.key().id()          
					if tm.available == True:
						tinfo['able'] = 'Deshabilitar'
					else:
						tinfo['able'] = 'Habilitar'
					tinfo['tutor'] = (tutor_management().get_tutor(tm.tutor.key().id())).first
					tinfo['topic'] = (topic_management().get_topic(tm.topic.key().id())).name                    
					tinfo['content'] = text_instance.content                    
					tinfo['number_views'] = text_instance.number_views
					list_texts.append(tinfo)                      

				html = ''
				for i in range(len(list_texts)):                
					html +='\
					\
					<a class="textr" href="view_text?text_material_id='+str(list_texts[i]['id'])+'" alt="'+str(list_texts[i]['topic'])+'">\
					<div class="text" id="'+str(list_texts[i]['id'])+'">\
					<div class="bimg" style="background:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS67YRkacb2A7x0mniuG1SUXllu22UOKOGYfJwARDWeZl8SyZQpfg);background-size:cover;background-position:center;">\
					<div class="views">\
					<i class="fa fa-eye"></i> '+str(list_texts[i]['number_views'])+'\
					</div>\
					</div>\
					<div class="about">\
					<h2>'+str(list_texts[i]['topic'])+'</h2>\
					<small>por '+str(list_texts[i]['tutor'])+'</small>\
					</div>\
					</div>\
					</a>  '												
				self.response.write(html)
			
			return 1
        elif user == user_type.tutor:              
            self.redirect('/home')
            return 2                    
        else:                   
			self.redirect('/home')                                         
			return 3
Exemple #6
0
    def post(self):
    	user = self.get_user_type()                    
        if user == user_type.visitor:                    
			self.redirect('/')			               
			return 0
        elif user == user_type.student:
			page = self.request.get('vm_page',None)   
			tutor_id = self.request.get('vm_tutor',None)
			subject_name = self.request.get('vm_subject')
			list_list_videos = []			
			index = 0
			list_videos = []                  
			enter = False
			if tutor_id:
				tutor_id = int(tutor_id)
				tutor_key = tutor_management().get_tutor(tutor_id).key()
				list_vm = video_material_management().get_tutor_available_videos(tutor_key,page)       
				enter = True
			elif subject_name:
				subject_instance = subject_management().find_name(subject_name)
				list_vm = video_material_management().get_subject_available_videos(subject_instance.key(),page)
				enter = True

			if enter == True:
				for index in range(len(list_vm)):                    
					vm = list_vm[index]
					video_instance = video_material_management().get_video(vm)
					vinfo = {}        
					vinfo['id'] = vm.key().id()          
					if vm.available == True:
						vinfo['able'] = 'Deshabilitar'
					else:
						vinfo['able'] = 'Habilitar'
					vinfo['tutor'] = (tutor_management().get_tutor(vm.tutor.key().id())).first
					vinfo['topic'] = (topic_management().get_topic(vm.topic.key().id())).name                    
					vinfo['content'] = video_instance.content                    
					vinfo['number_views'] = video_instance.number_views
					list_videos.append(vinfo)                      

				html = ''
				for i in range(len(list_videos)):                
					html +='\
					\
					<a class="videor" href="view_video?video_material_id='+str(list_videos[i]['id'])+'" alt="'+str(list_videos[i]['topic'])+'">\
					<div class="video" id="'+str(list_videos[i]['id'])+'">\
					<div class="bimg" style="background:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS67YRkacb2A7x0mniuG1SUXllu22UOKOGYfJwARDWeZl8SyZQpfg);background-size:cover;background-position:center;">\
					<div class="views">\
					<i class="fa fa-eye"></i> '+str(list_videos[i]['number_views'])+'\
					</div>\
					</div>\
					<div class="about">\
					<h2>'+str(list_videos[i]['topic'])+'</h2>\
					<small>por '+str(list_videos[i]['tutor'])+'</small>\
					</div>\
					</div>\
					</a>  '												
				self.response.write(html)
			
			return 1
        elif user == user_type.tutor:              
            self.redirect('/home')
            return 2                    
        else:                   
			self.redirect('/home')                                         
			return 3
Exemple #7
0
 def get(self):
     user = self.get_user_type()
     if user == user_type.visitor:
         self.redirect('/')
     elif user == user_type.student:
         video_material_id = self.request.get('video_material_id', None)
         if not video_material_id:
             self.redirect('/explorer')
         video_instance = None
         video_material_instance = None
         video_material_id = int(video_material_id)
         if video_material_id:
             video_material_instance = video_material_management(
             ).get_video_material(video_material_id)
         if not video_material_instance:
             self.redirect('/explorer')
         else:
             student_instance = student_management().find_key(
                 self.session['user-id'])
             video_instance = video_material_management().get_video(
                 video_material_instance)
             video_management().update_number_views(video_instance)
             list_tag_video_supported = ['mkv', 'mp4']
             list_tag_embedded_supported = ['wmv', 'mov', 'mpg', 'avi']
             #list_tag_object_supported = ['swf']
             vformat = video_instance.ext_format
             vinfo = {}
             vinfo['format'] = vformat
             vinfo['tutor'] = (tutor_management().get_tutor(
                 video_material_instance.tutor.key().id())).first
             vinfo['topic'] = (topic_management().get_topic(
                 video_material_instance.topic.key().id())).name
             vinfo['content'] = video_instance.content
             vinfo['subject'] = (subject_management().get_subject(
                 video_material_instance.subject.key().id())).name
             vinfo['description'] = video_instance.description
             vinfo['tags'] = video_material_instance.tags
             template_values = {
                 "user": "******",
                 "header_welcome": "",
                 "header_tutor": "",
                 "vinfo": vinfo,
                 'embbeded_supported': list_tag_embedded_supported,
                 'video_supported': list_tag_video_supported,
                 "student_name": student_instance.first
                 #"object_supported":list_tag_object_supported
             }
             self.response.write(viewvideo_template.render(template_values))
     elif user == user_type.tutor:
         video_material_id = int(self.request.get('video_material_id',
                                                  None))
         video_instance = None
         video_material_instance = None
         if video_material_id:
             video_material_instance = video_material_management(
             ).get_video_material(video_material_id)
         if not video_material_instance:
             self.redirect('/home')
         else:
             tutor_id = self.session['user-id']
             tutor_key = tutor_management().get_tutor(tutor_id).key()
             tutor_instance = tutor_management().get_tutor(tutor_id)
             video_instance = video_material_management().get_video(
                 video_material_instance)
             list_video_supported = ['mp4', 'wmv', 'mkv', 'ogg', 'webm']
             vformat = video_instance.ext_format
             #list_tag_object_supported = ['swf']
             vinfo = {}
             vinfo['format'] = vformat
             vinfo['tutor'] = (tutor_management().get_tutor(
                 video_material_instance.tutor.key().id())).first
             vinfo['topic'] = (topic_management().get_topic(
                 video_material_instance.topic.key().id())).name
             vinfo['content'] = video_instance.content
             vinfo['subject'] = (subject_management().get_subject(
                 video_material_instance.subject.key().id())).name
             vinfo['description'] = video_instance.description
             vinfo['tags'] = video_material_instance.tags
             #blob_info = BlobInfo.get(video_instance.content.key())
             template_values = {
                 "user": "******",
                 "header_welcome": "",
                 "header_tutor": "",
                 "vinfo": vinfo,
                 "tutor_name": tutor_instance.first,
                 #"object_supported":list_tag_object_supported
             }
             #self.response.headers['Content-Type'] = 'video/avi'
             self.response.write(viewvideo_template.render(template_values))
     else:
         self.redirect('/home')
Exemple #8
0
 def get(self):
     user = self.get_user_type()
     if user == user_type.visitor:
         self.redirect('/')
     elif user == user_type.student:
         text_material_id = self.request.get('text_material_id', None)
         if not text_material_id:
             self.redirect('/explorer')
         text_instance = None
         text_material_instance = None
         text_material_id = int(text_material_id)
         if text_material_id:
             text_material_instance = text_material_management(
             ).get_text_material(text_material_id)
         if not text_material_instance:
             self.redirect('/explorer')
         else:
             student_instance = student_management().find_key(
                 self.session['user-id'])
             text_instance = text_material_management().get_text(
                 text_material_instance)
             text_management().update_number_views(text_instance)
             list_tag_text_supported = ['pdf']
             list_tag_embedded_supported = ['pdf']
             #list_tag_object_supported = ['swf']
             tformat = text_instance.ext_format
             tinfo = {}
             tinfo['format'] = tformat
             tinfo['tutor'] = (tutor_management().get_tutor(
                 text_material_instance.tutor.key().id())).first
             tinfo['topic'] = (topic_management().get_topic(
                 text_material_instance.topic.key().id())).name
             tinfo['content'] = text_instance.content
             tinfo['subject'] = (subject_management().get_subject(
                 text_material_instance.subject.key().id())).name
             tinfo['description'] = text_instance.description
             tinfo['tags'] = text_material_instance.tags
             template_values = {
                 "user": "******",
                 "header_welcome": "",
                 "header_tutor": "",
                 "tinfo": tinfo,
                 'embbeded_supported': list_tag_embedded_supported,
                 'text_supported': list_tag_text_supported,
                 "student_name": student_instance.first
                 #"object_supported":list_tag_object_supported
             }
             self.response.write(viewtext_template.render(template_values))
     elif user == user_type.tutor:
         text_material_id = int(self.request.get('text_material_id'))
         text_instance = None
         text_material_instance = None
         if text_material_id:
             text_material_instance = text_material_management(
             ).get_text_material(text_material_id)
         if not text_material_instance:
             self.redirect('/home')
         else:
             tutor_id = self.session['user-id']
             tutor_key = tutor_management().get_tutor(tutor_id).key()
             tutor_instance = tutor_management().get_tutor(tutor_id)
             text_instance = text_material_management().get_text(
                 text_material_instance)
             list_text_supported = ['pdf']
             tformat = text_instance.ext_format
             #list_tag_object_supported = ['swf']
             tinfo = {}
             tinfo['format'] = tformat
             tinfo['tutor'] = (tutor_management().get_tutor(
                 text_material_instance.tutor.key().id())).first
             tinfo['topic'] = (topic_management().get_topic(
                 text_material_instance.topic.key().id())).name
             tinfo['content'] = text_instance.content
             tinfo['subject'] = (subject_management().get_subject(
                 text_material_instance.subject.key().id())).name
             tinfo['description'] = text_instance.description
             tinfo['tags'] = text_material_instance.tags
             #blob_info = BlobInfo.get(text_instance.content.key())
             template_values = {
                 "user": "******",
                 "header_welcome": "",
                 "header_tutor": "",
                 "tinfo": tinfo,
                 "tutor_name": tutor_instance.first,
                 #"object_supported":list_tag_object_supported
             }
             #self.response.headers['Content-Type'] = 'video/avi'
             self.response.write(viewtext_template.render(template_values))
     else:
         self.redirect('/home')
Exemple #9
0
    def get(self):
        user = self.get_user_type()
        if user == user_type.visitor:
            self.redirect('/')
            return 0
        elif user == user_type.student:

            self.redirect('/explorer')
            return 1

        elif user == user_type.tutor:
            page = 1
            list_list_texts = []
            tutor_id = self.session['user-id']
            tutor_key = tutor_management().get_tutor(tutor_id).key()
            tutor_instance = tutor_management().get_tutor(tutor_id)
            index = 0
            list_list_text_info = []
            countent = {}
            list_counter = []
            list_content = []
            self.list_list_vm = text_material_management(
            ).get_list_text_material_of_subject(tutor_key, page)
            for index in range(len(self.list_list_vm)):
                list_texts = []
                counter = {}
                content = {}
                if self.list_list_vm[index]:
                    counter['subject'] = (subject_management().get_subject(
                        self.list_list_vm[index][0].subject.key().id())).name
                    counter['total-text'] = text_material_management(
                    ).get_all_texts_material(
                        tutor_key, self.list_list_vm[index][0].subject.key(),
                        page)
                    for subindex in range(len(self.list_list_vm[index])):
                        vm = self.list_list_vm[index][subindex]
                        text_instance = text_material_management().get_text(vm)
                        vinfo = {}
                        vinfo['id'] = vm.key().id()
                        if vm.available == True:
                            vinfo[
                                'able'] = '<i class="fa fa-pencil-square-o"></i> Deshabilitar'
                        else:
                            vinfo[
                                'able'] = '<i class="fa fa-pencil-square-o"></i> Habilitar'
                        vinfo['tutor'] = (tutor_management().get_tutor(
                            vm.tutor.key().id())).first
                        vinfo['topic'] = (topic_management().get_topic(
                            vm.topic.key().id())).name
                        vinfo['content'] = text_instance.content
                        vinfo['number_views'] = text_instance.number_views
                        list_texts.append(vinfo)
                    index = index + 1
                    counter['index'] = index
                    list_counter.append(copy.deepcopy(counter))
                    list_list_text_info.append(list_texts)

            self.response.write(self.list_list_vm)

            html = ''
            for i in range(len(list_list_text_info)):
                html += '<div class="block" id="num' + str(
                    i
                ) + '"><div class="head"><i class="fa fa-book"></i> <span class="subject">' + str(
                    list_counter[i]['subject']
                ) + '</span><small> (' + str(
                    len(list_counter[i]['total-text'])
                ) + ' texts)</small><span class="toggle"><i class="fa fa-caret-square-o-up"></i> Ocultar Materia</span></div>'
                for j in range(len(list_list_text_info[i])):
                    html += '\
					\
					<a class="videor" href="view_text?text_material_id=' + str(
                        list_list_text_info[i][j]['id']) + '" alt="' + str(
                            list_list_text_info[i][j]['topic']) + '">\
					<div class="video" id="' + str(list_list_text_info[i][j]['id']) + '">\
					<div class="bimg" style="background:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS67YRkacb2A7x0mniuG1SUXllu22UOKOGYfJwARDWeZl8SyZQpfg);background-size:cover;background-position:center;">\
					<div class="remove" id="' + str(
                                list_list_text_info[i][j]['id']) + '">' + str(
                                    list_list_text_info[i][j]
                                    ['able']) + '</div>\
					<div class="views">\
					<i class="fa fa-eye"></i> ' + str(list_list_text_info[i][j]
                                       ['number_views']) + '\
					</div>\
					</div>\
					<div class="about">\
					<h2>' + str(list_list_text_info[i][j]['topic']) + '</h2>\
					<small>por ' + str(list_list_text_info[i][j]['tutor']) + '</small>\
					</div>\
					</div>\
					</a>  '

                if len(list_counter[i]['total-text']) > 6:
                    html += '<div class="more"><i class="fa fa-refresh"></i> Mostrar mas</div>'
                html += '</div>'
            template_values = {
                "user": "******",
                "header_welcome": "",
                "header_tutor": "",
                "list_list_texts": list_list_text_info,
                "counter": list_counter,
                "html": html,
                "tutor_name": tutor_instance.first
            }

            self.response.write(template.render(template_values))
            return 2
        else:

            template_values = {}
            self.response.write(template.render(template_values))
            return 3
Exemple #10
0
    def post(self):

        user = self.get_user_type()
        if user == user_type.visitor:

            return 0
        elif user == user_type.student:
            return 1
        elif user == user_type.tutor:
            available = self.request.get('available', None)
            page = self.request.get('vm_page', None)
            if available:
                vm_id = self.request.get('vm_id', None)
                text_material_management().make_available(int(vm_id))
            if page:
                page = int(page)
                list_list_texts = []
                tutor_id = self.session['user-id']
                tutor_key = tutor_management().get_tutor(tutor_id).key()
                subject_instance = subject_management().find_name(
                    self.request.get('vm_subject'))
                index = 0
                list_texts = []
                list_vm = text_material_management().get_list_text_material(
                    tutor_key, subject_instance.key(), page)
                if list_vm:
                    for index in range(len(list_vm)):
                        vm = list_vm[index]
                        text_instance = text_material_management().get_text(vm)
                        vinfo = {}
                        vinfo['id'] = vm.key().id()
                        if vm.available == True:
                            vinfo[
                                'able'] = '<i class="fa fa-pencil-square-o"></i> Deshabilitar'
                        else:
                            vinfo[
                                'able'] = '<i class="fa fa-pencil-square-o"></i> Habilitar'
                        vinfo['tutor'] = (tutor_management().get_tutor(
                            vm.tutor.key().id())).first
                        vinfo['topic'] = (topic_management().get_topic(
                            vm.topic.key().id())).name
                        vinfo['content'] = text_instance.content
                        vinfo['number_views'] = text_instance.number_views
                        list_texts.append(vinfo)
                        html = ""

                        for v in list_texts:
                            html += '\
							\
							<a class="textr" href="view_text?text_material_id=' + str(
                                v['id']) + '" alt="' + str(v['topic']) + '">\
							<div class="text" id="' + str(v['id']) + '">\
							<div class="bimg" style="background:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS67YRkacb2A7x0mniuG1SUXllu22UOKOGYfJwARDWeZl8SyZQpfg);background-size:cover;background-position:center;">\
							<div class="remove" id="' + str(v['id']) + '">' + str(
                                    v['able']) + '</div>\
							<div class="views">\
							<i class="fa fa-eye"></i> ' + str(v['number_views']) + '\
							</div>\
							</div>\
							<div class="about">\
							<h2>' + str(v['topic']) + '</h2>\
							<small>por ' + str(v['tutor']) + '</small>\
							</div>\
							</div>\
							</a>  '

                self.response.write(html)
            return 2
        else:
            return 3
Exemple #11
0
	def post(self):

		user = self.get_user_type()                    
		if user == user_type.visitor:                    
                
			return 0
		elif user == user_type.student:                   
			return 1
		elif user == user_type.tutor:
			available = self.request.get('available',None)  
			page = self.request.get('vm_page',None)
			if available:
				vm_id = self.request.get('vm_id',None)                
				video_material_management().make_available(int(vm_id))                        
			if page:                
				page = int(page)
				list_list_videos = []
				tutor_id = self.session['user-id']
				tutor_key = tutor_management().get_tutor(tutor_id).key()
				subject_instance = subject_management().find_name(self.request.get('vm_subject'))
				index = 0
				list_videos = []
				list_vm = video_material_management().get_list_video_material(tutor_key,subject_instance.key(),page)                
				if list_vm:
					for index in range(len(list_vm)):                    
						vm = list_vm[index]
						video_instance = video_material_management().get_video(vm)
						vinfo = {}        
						vinfo['id'] = vm.key().id()          
						if vm.available == True:
							vinfo['able'] = '<i class="fa fa-pencil-square-o"></i> Deshabilitar'
						else:
							vinfo['able'] = '<i class="fa fa-pencil-square-o"></i> Habilitar'
						vinfo['tutor'] = (tutor_management().get_tutor(vm.tutor.key().id())).first
						vinfo['topic'] = (topic_management().get_topic(vm.topic.key().id())).name                    
						vinfo['content'] = video_instance.content                    
						vinfo['number_views'] = video_instance.number_views
						list_videos.append(vinfo)                
						html = ""

						for v in list_videos:
							html += '\
							\
							<a class="videor" href="view_video?video_material_id='+str(v['id'])+'" alt="'+str(v['topic'])+'">\
							<div class="video" id="'+str(v['id'])+'">\
							<div class="bimg" style="background:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS67YRkacb2A7x0mniuG1SUXllu22UOKOGYfJwARDWeZl8SyZQpfg);background-size:cover;background-position:center;">\
							<div class="remove" id="'+str(v['id'])+'">'+str(v['able'])+'</div>\
							<div class="views">\
							<i class="fa fa-eye"></i> '+str(v['number_views'])+'\
							</div>\
							</div>\
							<div class="about">\
							<h2>'+str(v['topic'])+'</h2>\
							<small>por '+str(v['tutor'])+'</small>\
							</div>\
							</div>\
							</a>  '
				self.response.write(html)
			return 2
		else:
			return 3
Exemple #12
0
    def get(self):
        user = self.get_user_type()
        if user == user_type.visitor:
            self.redirect('/')
        elif user == user_type.student:
            text_material_id = self.request.get('text_material_id',None)
            if not text_material_id:
                self.redirect('/explorer')
            text_instance = None        
            text_material_instance = None
            text_material_id = int(text_material_id)
            if text_material_id:                
                text_material_instance = text_material_management().get_text_material(text_material_id)
            if not text_material_instance:
                self.redirect('/explorer')                
            else:             
            	student_instance = student_management().find_key(self.session['user-id'])
                text_instance = text_material_management().get_text(text_material_instance)                        
                text_management().update_number_views(text_instance)
                list_tag_text_supported = ['pdf']
                list_tag_embedded_supported = ['pdf']
                #list_tag_object_supported = ['swf'] 
                tformat = text_instance.ext_format                
                tinfo = {}
                tinfo['format'] = tformat
                tinfo['tutor'] = (tutor_management().get_tutor(text_material_instance.tutor.key().id())).first
                tinfo['topic'] = (topic_management().get_topic(text_material_instance.topic.key().id())).name                    
                tinfo['content'] = text_instance.content
                tinfo['subject'] = (subject_management().get_subject(text_material_instance.subject.key().id())).name
                tinfo['description'] = text_instance.description
                tinfo['tags'] = text_material_instance.tags
                template_values={
                    "user":"******",   
                    "header_welcome":"",
                    "header_tutor":"",                
                    "tinfo":tinfo,            
                    'embbeded_supported':list_tag_embedded_supported,
                    'text_supported':list_tag_text_supported,
                    "student_name":student_instance.first
                    #"object_supported":list_tag_object_supported
                }                                           
                self.response.write(viewtext_template.render(template_values))            
        elif user == user_type.tutor:
            text_material_id = int(self.request.get('text_material_id'))
            text_instance = None        
            text_material_instance = None
            if text_material_id:                
                text_material_instance = text_material_management().get_text_material(text_material_id)
            if not text_material_instance:
                self.redirect('/home')                
            else:
				tutor_id = self.session['user-id']
				tutor_key = tutor_management().get_tutor(tutor_id).key()
				tutor_instance = tutor_management().get_tutor(tutor_id)
				text_instance = text_material_management().get_text(text_material_instance)                                                
				list_text_supported = ['pdf']
				tformat = text_instance.ext_format            
				#list_tag_object_supported = ['swf']
				tinfo = {}
				tinfo['format'] = tformat
				tinfo['tutor'] = (tutor_management().get_tutor(text_material_instance.tutor.key().id())).first
				tinfo['topic'] = (topic_management().get_topic(text_material_instance.topic.key().id())).name                    
				tinfo['content'] = text_instance.content
				tinfo['subject'] = (subject_management().get_subject(text_material_instance.subject.key().id())).name
				tinfo['description'] = text_instance.description
				tinfo['tags'] = text_material_instance.tags
				#blob_info = BlobInfo.get(text_instance.content.key())
				template_values={
					"user":"******",   
					"header_welcome":"",
					"header_tutor":"",                
					"tinfo":tinfo,                                
					"tutor_name": tutor_instance.first,					
					#"object_supported":list_tag_object_supported
				}         
				#self.response.headers['Content-Type'] = 'video/avi'
				self.response.write(viewtext_template.render(template_values))            
        else:
            self.redirect('/home')
Exemple #13
0
    def get(self):
        user = self.get_user_type()
        if user == user_type.visitor:
            self.redirect('/')
            return 0
        elif user == user_type.student:
            #self.response.headers['Content-Type'] = 'text/html'
            classification = self.request.get('classification', None)
            student_instance = student_management().find_key(
                self.session['user-id'])
            page = 1
            list_list_texts = []
            index = 0
            list_list_text_info = []
            list_list_counter = []
            countent = {}
            list_counter = []
            list_content = []
            i = 0
            list_list_tm = text_material_management(
            ).get_subjects_available_texts(page)
            for index in range(len(list_list_tm)):
                list_texts = []
                counter = {}
                content = {}
                if list_list_tm[index]:
                    counter['tutorid'] = ''
                    counter['class'] = 'subject'
                    counter['title'] = (subject_management().get_subject(
                        list_list_tm[index][0].subject.key().id())).name
                    counter['total-text'] = text_material_management(
                    ).get_all_subject_available_texts(
                        list_list_tm[index][0].subject.key(), page)
                    for subindex in range(len(list_list_tm[index])):
                        tm = list_list_tm[index][subindex]
                        text_instance = text_material_management().get_text(tm)
                        tinfo = {}
                        tinfo['id'] = tm.key().id()
                        if tm.available == True:
                            tinfo['able'] = 'Deshabilitar'
                        else:
                            tinfo['able'] = 'Habilitar'
                        tinfo['tutor'] = (tutor_management().get_tutor(
                            tm.tutor.key().id())).first
                        tinfo['topic'] = (topic_management().get_topic(
                            tm.topic.key().id())).name
                        tinfo['content'] = text_instance.content
                        tinfo['number_views'] = text_instance.number_views
                        list_texts.append(tinfo)
                    index = index + 1
                    counter['index'] = index
                    list_counter.append(copy.deepcopy(counter))
                    list_list_text_info.append(list_texts)
            list_list_tm = text_material_management(
            ).get_tutors_available_texts(page)
            x = 2
            for index in range(len(list_list_tm)):
                list_texts = []
                counter = {}
                content = {}
                if list_list_tm[index]:
                    counter['tutorid'] = list_list_tm[index][0].tutor.key().id(
                    )
                    counter['class'] = 'tutor'
                    counter['title'] = (tutor_management().find_key(
                        list_list_tm[index][0].tutor.key().id())).first
                    counter['total-text'] = text_material_management(
                    ).get_all_tutor_available_texts(
                        list_list_tm[index][0].tutor.key(), page)
                    for subindex in range(len(list_list_tm[index])):
                        tm = list_list_tm[index][subindex]
                        text_instance = text_material_management().get_text(tm)
                        tinfo = {}
                        tinfo['id'] = tm.key().id()
                        if tm.available == True:
                            tinfo['able'] = 'Deshabilitar'
                        else:
                            tinfo['able'] = 'Habilitar'
                        tinfo['tutor'] = (tutor_management().get_tutor(
                            tm.tutor.key().id())).first
                        tinfo['topic'] = (topic_management().get_topic(
                            tm.topic.key().id())).name
                        tinfo['content'] = text_instance.content
                        tinfo['number_views'] = text_instance.number_views
                        list_texts.append(tinfo)
                    index = index + 1
                    counter['index'] = index
                    list_counter.append(copy.deepcopy(counter))
                    list_list_text_info.append(list_texts)

            new_list_counter = []
            l = []
            c = 0
            for i in range(len(list_counter)):
                c = 0
                l = list_counter[i]['total-text']
                new_counter = {}
                for j in range(len(l)):
                    if l[j].available:
                        c += 1
                # for j in range(len(list_counter[i])):
                # 	if list_counter[i][j]['total-text'].available:
                # 		c += 1
                new_counter['num_texts'] = c
                new_list_counter.append(copy.deepcopy(new_counter))

            html = ''
            for i in range(len(list_list_text_info)):
                if x == 2:
                    html += '<div class="block ' + str(
                        list_counter[i]['class']
                    ) + '" data-tutor-id="' + str(
                        list_counter[i]['tutorid']
                    ) + '" id="num' + str(
                        i
                    ) + '"><div class="head"><i class="fa fa-book"></i> <span class="subject">' + str(
                        list_counter[i]['title']
                    ) + '</span><small> (' + str(
                        new_list_counter[i]['num_texts']
                    ) + ' texts)</small><span class="toggle"><i class="fa fa-caret-square-o-up"></i> Ocultar Materia</span></div>'
                else:
                    html += '<div class="block ' + str(
                        list_counter[i]['class']
                    ) + '" id="num' + str(
                        i
                    ) + '"><div class="head"><i class="fa fa-book"></i> <span class="subject">' + str(
                        list_counter[i]['title']
                    ) + '</span><small> (# texts)</small><span class="toggle"><i class="fa fa-caret-square-o-up"></i> Ocultar Materia</span></div>'
                for j in range(len(list_list_text_info[i])):
                    html += '\
					<a class="textr" href="view_text?text_material_id=' + str(
                        list_list_text_info[i][j]['id']) + '" alt="' + str(
                            list_list_text_info[i][j]['topic']) + '">\
					<div class="text" id="' + str(list_list_text_info[i][j]['id']) + '">\
					<div class="bimg" style="background:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS67YRkacb2A7x0mniuG1SUXllu22UOKOGYfJwARDWeZl8SyZQpfg);background-size:cover;background-position:center;">\
					<div class="views">\
					<i class="fa fa-eye"></i> ' + str(
                                list_list_text_info[i][j]['number_views']) + '\
					</div>\
					</div>\
					<div class="about">\
					<h2>' + str(list_list_text_info[i][j]['topic']) + '</h2>\
					<small>por ' + str(list_list_text_info[i][j]['tutor']) + '</small>\
					</div>\
			 		</div>\
			 		</a>  '

            # if len(list_counter[i]['total-text']) > 6:
                if new_list_counter[i]['num_texts'] > 6:
                    html += '<div class="more"><i class="fa fa-refresh"></i> Mostrar mas</div>'
                html += '</div>'

            template_values = {
                "user": "******",
                "header_welcome": "",
                "header_tutor": "",
                "list_list_texts": list_list_text_info,
                "counter": list_counter,
                "html": html,
                "student_name": student_instance.first
            }
            self.response.write(explorer_template.render(template_values))
            return 1
        elif user == user_type.tutor:
            self.redirect('/home')
            return 2
        else:
            self.redirect('/home')
            return 3
Exemple #14
0
    def get(self):
        user = self.get_user_type()                    
        if user == user_type.visitor:                    
            self.redirect('/')
            return 0
        elif user == user_type.student:       

			self.redirect('/explorer')        	
			return 1

        elif user == user_type.tutor:                          
			page = 1            
			list_list_texts = []
			tutor_id = self.session['user-id']
			tutor_key = tutor_management().get_tutor(tutor_id).key()
			tutor_instance = tutor_management().get_tutor(tutor_id)
			index = 0
			list_list_text_info = []            
			countent = {}
			list_counter = []   
			list_content = []         
			self.list_list_vm = text_material_management().get_list_text_material_of_subject(tutor_key,page)                        
			for index in range(len(self.list_list_vm)):
				list_texts = []
				counter = {}                
				content = {}
				if self.list_list_vm[index]:					
					counter['subject'] = (subject_management().get_subject(self.list_list_vm[index][0].subject.key().id())).name                    
					counter['total-text'] = text_material_management().get_all_texts_material(tutor_key,self.list_list_vm[index][0].subject.key(),page)
					for subindex in range(len(self.list_list_vm[index])):                    
						vm = self.list_list_vm[index][subindex]
						text_instance = text_material_management().get_text(vm)
						vinfo = {}        
						vinfo['id'] = vm.key().id()          
						if vm.available == True:
							vinfo['able'] = '<i class="fa fa-pencil-square-o"></i> Deshabilitar'
						else:
							vinfo['able'] = '<i class="fa fa-pencil-square-o"></i> Habilitar'
						vinfo['tutor'] = (tutor_management().get_tutor(vm.tutor.key().id())).first
						vinfo['topic'] = (topic_management().get_topic(vm.topic.key().id())).name                    
						vinfo['content'] = text_instance.content                    
						vinfo['number_views'] = text_instance.number_views
						list_texts.append(vinfo)
					index = index + 1
					counter['index'] = index
					list_counter.append(copy.deepcopy(counter))
					list_list_text_info.append(list_texts)

			self.response.write(self.list_list_vm)

			html = ''
			for i in range(len(list_list_text_info)):                
				html += '<div class="block" id="num'+str(i)+'"><div class="head"><i class="fa fa-book"></i> <span class="subject">'+str(list_counter[i]['subject'])+'</span><small> ('+str(len(list_counter[i]['total-text']))+' texts)</small><span class="toggle"><i class="fa fa-caret-square-o-up"></i> Ocultar Materia</span></div>'
				for j in range(len(list_list_text_info[i])):
					html +='\
					\
					<a class="videor" href="view_text?text_material_id='+str(list_list_text_info[i][j]['id'])+'" alt="'+str(list_list_text_info[i][j]['topic'])+'">\
					<div class="video" id="'+str(list_list_text_info[i][j]['id'])+'">\
					<div class="bimg" style="background:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS67YRkacb2A7x0mniuG1SUXllu22UOKOGYfJwARDWeZl8SyZQpfg);background-size:cover;background-position:center;">\
					<div class="remove" id="'+str(list_list_text_info[i][j]['id'])+'">'+str(list_list_text_info[i][j]['able'])+'</div>\
					<div class="views">\
					<i class="fa fa-eye"></i> '+str(list_list_text_info[i][j]['number_views'])+'\
					</div>\
					</div>\
					<div class="about">\
					<h2>'+str(list_list_text_info[i][j]['topic'])+'</h2>\
					<small>por '+str(list_list_text_info[i][j]['tutor'])+'</small>\
					</div>\
					</div>\
					</a>  '
				if len(list_counter[i]['total-text']) > 6:
					html += '<div class="more"><i class="fa fa-refresh"></i> Mostrar mas</div>'                    
				html += '</div>'                    
			template_values={
				"user":"******",
				"header_welcome":"",
				"header_tutor":"",
				"list_list_texts": list_list_text_info,                
				"counter":list_counter,
				"html":html,
				"tutor_name": tutor_instance.first
			}  
			                  
			self.response.write(template.render(template_values))  
			return 2                    
        else:                        
            
            template_values = {

            }
            self.response.write(template.render(template_values))                        
            return 3