Beispiel #1
0
    def doProcessRender(self, request):
        args = {'title': 'Administration'}

        self.setApplicationLayout('registered/base.html', args)
        self.addPageletBinding('navBar', NavBarPagelet())
        self.addPageletBinding('center-1', WorkbenchPagelet())
        self.addPageletBinding('footer', FooterPagelet())
Beispiel #2
0
    def doProcessRender(self, request):
        args = {'title': 'Tag/GeneLink Manager'}

        self.setApplicationLayout('registered/base.html', args)
        self.addPageletBinding('navBar', NavBarPagelet())
        self.addPageletBinding('center-1', TGManagerPagelet())
        self.addPageletBinding('footer', FooterPagelet())
Beispiel #3
0
    def doProcessRender(self, request):
        args = {'title': 'Advanced Search'}

        self.setApplicationLayout('public/base.html', args)

        self.addPageletBinding('navBar', NavBarPagelet())
        self.addPageletBinding('center-1', AdvancedSearchPagelet())
        self.addPageletBinding('footer', FooterPagelet())
Beispiel #4
0
	def doProcessRender(self, request):
		args = {
			'title' : 'Homepage'
		}
		self.setApplicationLayout('public/base.html', args)
		#self.addPageletBinding('navBar', NavBarPagelet(addHelpButton=True))
		self.addPageletBinding('navBar', NavBarPagelet(addHelpButton=True, isHomePage=True))
		self.addPageletBinding('center-1', HomePagelet())
		self.addPageletBinding('footer', FooterPagelet())
Beispiel #5
0
    def doProcessRender(self, request):
        self.addPageletBinding('navBar', NavBarPagelet())

        numSearch = 0
        searchImageDesc = str(request.GET.get('searchImageDesc',
                                              '')).lower() == "true"
        searchImageNotes = str(request.GET.get('searchImageNotes',
                                               '')).lower() == "true"
        searchGeneName = str(request.GET.get('searchGeneName',
                                             '')).lower() == "true"
        searchGeneSymbol = str(request.GET.get('searchGeneSymbol',
                                               '')).lower() == "true"
        searchGeneID = str(request.GET.get('searchGeneID',
                                           '')).lower() == "true"
        query = Util.getDelimitedList(request.GET, 'query')

        #print searchImageDesc
        #print searchImageNotes
        #print searchGeneName
        #print searchGeneSymbol
        #print searchGeneID

        candidate_cat = []

        if searchImageDesc:
            query = Util.getDelimitedList(request.GET, 'query')
            print query
            print len(query)
            candidates_ImgDesc = []
            candidate_cat.append('Image Description')

            if query:
                pictures = Picture.objects.filter(
                    description__icontains=query[0])
                print pictures
                candidates_ImgDesc.append(pictures)

            formatQuery = ""
            if query:
                formatQuery += 'General Query: "' + ", ".join(query) + '"'

        search = {
            'candidate_cat': candidate_cat,
            'candidates_ImgDesc': candidates_ImgDesc,
            'query': formatQuery
        }

        #if searchImageDesc:
        numSearch += 1
        self.addPageletBinding('center-' + str(numSearch),
                               ImageSearchPagelet().setSearchParams(search))

        args = {'title': 'Search', 'numPagelets': numSearch}
        self.setApplicationLayout('public/search.html', args)

        self.addPageletBinding('footer', FooterPagelet())
Beispiel #6
0
    def doProcessRender(self, request):
        args = {}
        self.addPageletBinding('navBar', NavBarPagelet(addHelpButton=True))

        if (request.user.is_authenticated() and request.user.is_staff):
            args['title'] = 'Image Editor'
            self.addPageletBinding('center-1', AdminPagelet())
        else:
            args['title'] = 'Image Viewer'
            self.addPageletBinding('center-1', PublicPagelet())

        self.setApplicationLayout('public/base.html', args)

        self.addPageletBinding('footer', FooterPagelet())
Beispiel #7
0
    def doProcessRender(self, request):
        self.addPageletBinding('navBar', NavBarPagelet(addHelpButton=True))

        numSearch = 0
        searchCats = list('00000')
        searchImageDesc = str(request.GET.get('searchImageDesc',
                                              '')).lower() == "true"
        searchImageNotes = str(request.GET.get('searchImageNotes',
                                               '')).lower() == "true"
        searchGeneName = str(request.GET.get('searchGeneName',
                                             '')).lower() == "true"
        searchGeneSymbol = str(request.GET.get('searchGeneSymbol',
                                               '')).lower() == "true"
        searchGeneID = str(request.GET.get('searchGeneID',
                                           '')).lower() == "true"
        query = Util.getDelimitedList(request.GET, 'query')
        if not query:
            query = list()
            query.append('')

        #candidates = [['Image Description'], ['Image Notes'], ['Gene Name'], ['Gene Symbol'], ['Gene ID']]
        candidates = [['0'], ['1'], ['2'], ['3'], ['4']]

        if searchImageDesc:
            candidates[0][0] = 'Image Description'
            searchCats[0] = '1'
            pictures = Picture.objects.filter(description__icontains=query[0])
            for picture in pictures:
                candidates[0].append(picture)

        if searchImageNotes:
            candidates[1][0] = 'Image Notes'
            searchCats[1] = '1'
            pNotes = PictureNotes.objects.filter(notes__icontains=query[0])
            pictureIDs = []
            for note in pNotes:
                pictureID = note.picture.pk
                if not pictureID in pictureIDs:
                    pictureIDs.append(pictureID)
                    candidates[1].append(pictureID)

        if searchGeneName:
            candidates[2][0] = 'Gene Name'
            searchCats[2] = '1'
            pictureIDs = []
            pMgdbs = PictureMgdb.objects.filter(
                locus_full_name__icontains=query[0])
            for pMgdb in pMgdbs:
                pictureID = pMgdb.picture.pk
                if not pictureID in pictureIDs:
                    pictureIDs.append(pictureID)
                    candidates[2].append(pictureID)

        if searchGeneSymbol:
            candidates[3][0] = 'Gene Symbol'
            searchCats[3] = '1'
            pictureIDs = []
            pMgdbs = PictureMgdb.objects.filter(locus_name__icontains=query[0])
            for pMgdb in pMgdbs:
                pictureID = pMgdb.picture.pk
                if not pictureID in pictureIDs:
                    pictureIDs.append(pictureID)
                    candidates[3].append(pictureID)

        if searchGeneID:
            candidates[4][0] = 'Gene ID'
            searchCats[4] = '1'
            pictureIDs = []
            pIDs = PictureGeneID.objects.filter(gene_id__icontains=query[0])
            for pID in pIDs:
                pictureID = pID.picture.pk
                if pictureID not in pictureIDs:
                    pictureIDs.append(pictureID)
                    candidates[4].append(pictureID)

        # Store searching keyword
        if str(request.user) != 'AnonymousUser':
            catSettings = ''.join(searchCats)
            newKeyword, created = iSearchHistory.objects.get_or_create(
                keyword=query[0], user=request.user)
            if created:
                updateKeyword = iSearchHistory.objects.get(
                    pk__exact=newKeyword.pk)
                updateKeyword.catSettings = catSettings
                updateKeyword.save()
            else:
                newKeyword.catSettings = catSettings
                newKeyword.save()

        formatQuery = ""
        if query:
            formatQuery += 'General Query: "' + ", ".join(query) + '"'

        search = {'candidates': candidates, 'query': query[0]}

        numSearch += 1
        self.addPageletBinding('center-' + str(numSearch),
                               iSearchPagelet().setSearchParams(search))

        args = {'title': 'Image search', 'numPagelets': numSearch}
        self.setApplicationLayout('public/iSearch.html', args)

        self.addPageletBinding('footer', FooterPagelet())
Beispiel #8
0
	def doProcessRender(self, request):
		self.addPageletBinding('navBar', NavBarPagelet())
		
		numSearch = 0
		searchImages = str(request.GET.get('searchImages', '')).lower() == "true"
		searchGenomes = str(request.GET.get('searchGenomes', '')).lower() == "true"
		
		if searchImages or searchGenomes:
			query = Util.getDelimitedList(request.GET,'query')
			organismId = Util.getDelimitedList(request.GET, 'organismId')
			candidates = []
			
			if organismId:
				organisms = Organism.objects.filter(pk__in=organismId)
				candidates.append(organisms)
			if query:
				for subquery in query:
					splitQuery = subquery.strip().split(' ')
					
					if (len(splitQuery) == 1):
						if organismId:
							candidate = Organism.objects.filter(species=splitQuery[0]).exclude(organism_id__in=organismId)
						else:
							candidate = Organism.objects.filter(species=splitQuery[0])
						candidates.append(candidate)
					elif(len(splitQuery) == 2):
						if organismId:
							candidate = Organism.objects.filter(Q(species=splitQuery[1]) & Q(genus=splitQuery[0])).exclude(organism_id__in=organismId)
						else:
							candidate = Organism.objects.filter(Q(species=splitQuery[1]) & Q(genus=splitQuery[0]))
						candidates.append(candidate)
					else:
						if organismId:
							candidate = Organism.objects.filter(common_name=subquery).exclude(organism_id__in=organismId)
						else:
							candidate = Organism.objects.filter(common_name=subquery)
						candidates.append(candidate)
			
			formatQuery = ""
			if query:
				formatQuery += 'General Query: "' + ", ".join(query) + '"'
			if organismId:
				amp = " & " if query else ""
				formatQuery += amp + 'Organism Id Query: "' + ", ".join(organismId) + '"'
			
			search = {
				'candidates' : candidates,
				'query' : formatQuery
			}
			
			if searchImages:
				numSearch += 1
				self.addPageletBinding('center-' + str(numSearch), ImageSearchPagelet().setSearchParams(search))
			
			if searchGenomes:
				numSearch += 1
				self.addPageletBinding('center-' + str(numSearch), GBrowseSearchPagelet().setSearchParams(search))
		
		args = {
			'title' : 'Search',
			'numPagelets' : numSearch
		}
		self.setApplicationLayout('public/search.html', args)
		
		self.addPageletBinding('footer', FooterPagelet())