def home(HttpRequest): M=GetCommunicationFnx().getNCommunicationsbyPageIndex("NEWS", n=3)[0] if(M==-5): return render_to_response('index.html',{'HappeningsFlag':False,'title':'Home', },context_instance=RequestContext(HttpRequest)) else: list2=[] for i in M: list1=[] list1.append(loads(i.Title.decode("base64").decode("zip"))) list1.append(i.Timestamp) list1.append(i.User) content=loads(i.Content.decode("base64").decode("zip")) content=replaceContentUrls(content) preview=content.split(" ") preview=preview[:40] preview.append(".....") preview= " ".join(preview) list1.append(preview) list1.append(content) list1.append(i.id) list2.append(list1) list1=zip(list2) return render_to_response('index.html',{'HappeningsFlag':True,'Happenings':list1,'title':'Home', },context_instance=RequestContext(HttpRequest))
def newsIndex(HttpRequest,token): res=GetCommunicationFnx().getNCommunicationsbyPageIndex("NEWS", index=int(token)) if(res[0]==-1 ): return HttpResponse("OOPS PAGE REQUESTED DOESNOT EXIST") elif(res[0]==-5): return HttpResponse("OOPS!!!! Something went wrong....Please Try sometime later, while we try to fix it") else: list2=[] for i in res[0]: list1=[] list1.append(loads(i.Title.decode("base64").decode("zip"))) list1.append(i.Timestamp) list1.append(i.User) content=loads(i.Content.decode("base64").decode("zip")) content=replaceContentUrls(content) preview=content.split(" ") preview=preview[:40] preview.append(".....") preview= " ".join(preview) list1.append(preview) list1.append(content) list1.append(i.id) list2.append(list1) list1=zip(list2) return render_to_response("Communication/User/ViewNews.html",{'pagerange':res[3],'next':res[1],'next_p':int(token)+1,'prev_p':int(token)-1,'prev':res[2],'list':list1,'title':"Happenings@UIET"},context_instance=RequestContext(HttpRequest))
def home(HttpRequest): M = GetCommunicationFnx().getNCommunicationsbyPageIndex("NEWS", n=3)[0] if (M == -5): return render_to_response('index.html', { 'HappeningsFlag': False, 'title': 'Home', }, context_instance=RequestContext(HttpRequest)) else: list2 = [] for i in M: list1 = [] list1.append(loads(i.Title.decode("base64").decode("zip"))) list1.append(i.Timestamp) list1.append(i.User) content = loads(i.Content.decode("base64").decode("zip")) content = replaceContentUrls(content) preview = content.split(" ") preview = preview[:40] preview.append(".....") preview = " ".join(preview) list1.append(preview) list1.append(content) list1.append(i.id) list2.append(list1) list1 = zip(list2) return render_to_response('index.html', { 'HappeningsFlag': True, 'Happenings': list1, 'title': 'Home', }, context_instance=RequestContext(HttpRequest))
def noticeIndex(HttpRequest, token): msglist = AppendMessageList(HttpRequest) logindetails = GetLoginDetails(HttpRequest) if (logindetails["userid"] == -1): msglist.append('Please Login to continue') HttpRequest.session[SESSION_MESSAGE] = msglist #return render_to_response("TwoColumnMaster.html",{'type':['NOTICE'],'title':"Notices"},context_instance=RequestContext(HttpRequest)) return HttpResponseRedirect('/user/login/') else: res = GetCommunicationFnx().getNCommunicationsbyPageIndex( "NOTICES", index=int(token)) if (res[0] == -1): return HttpResponse("OOPS PAGE REQUESTED DOESNOT EXIST") elif (res[0] == -5): return HttpResponse( "OOPS!!!! Something went wrong....Please Try sometime later, while we try to fix it" ) else: list2 = [] for i in res[0]: list1 = [] list1.append(loads(i.Title.decode("base64").decode("zip"))) list1.append(i.Timestamp) list1.append(i.User) content = loads(i.Content.decode("base64").decode("zip")) content = replaceContentUrls(content) preview = content.split(" ") preview = preview[:40] preview.append(".....") preview = " ".join(preview) list1.append(preview) list1.append(content) list1.append(i.id) list2.append(list1) list1 = zip(list2) return render_to_response("Communication/User/ViewNotices.html", { 'pagerange': res[3], 'next': res[1], 'next_p': int(token) + 1, 'prev_p': int(token) - 1, 'prev': res[2], 'list': list1, 'title': "Notices" }, context_instance=RequestContext(HttpRequest))
def newsIndex(HttpRequest, token): res = GetCommunicationFnx().getNCommunicationsbyPageIndex("NEWS", index=int(token)) if (res[0] == -1): return HttpResponse("OOPS PAGE REQUESTED DOESNOT EXIST") elif (res[0] == -5): return HttpResponse( "OOPS!!!! Something went wrong....Please Try sometime later, while we try to fix it" ) else: list2 = [] for i in res[0]: list1 = [] list1.append(loads(i.Title.decode("base64").decode("zip"))) list1.append(i.Timestamp) list1.append(i.User) content = loads(i.Content.decode("base64").decode("zip")) content = replaceContentUrls(content) preview = content.split(" ") preview = preview[:40] preview.append(".....") preview = " ".join(preview) list1.append(preview) list1.append(content) list1.append(i.id) list2.append(list1) list1 = zip(list2) return render_to_response("Communication/User/ViewNews.html", { 'pagerange': res[3], 'next': res[1], 'next_p': int(token) + 1, 'prev_p': int(token) - 1, 'prev': res[2], 'list': list1, 'title': "Happenings@UIET" }, context_instance=RequestContext(HttpRequest))
def noticeIndex(HttpRequest,token): msglist = AppendMessageList(HttpRequest) logindetails = GetLoginDetails(HttpRequest) if( logindetails["userid"] == -1): msglist.append('Please Login to continue') HttpRequest.session[SESSION_MESSAGE] = msglist #return render_to_response("TwoColumnMaster.html",{'type':['NOTICE'],'title':"Notices"},context_instance=RequestContext(HttpRequest)) return HttpResponseRedirect('/user/login/') else: res=GetCommunicationFnx().getNCommunicationsbyPageIndex("NOTICES", index=int(token)) if(res[0]==-1 ): return HttpResponse("OOPS PAGE REQUESTED DOESNOT EXIST") elif(res[0]==-5): return HttpResponse("OOPS!!!! Something went wrong....Please Try sometime later, while we try to fix it") else: list2=[] for i in res[0]: list1=[] list1.append(loads(i.Title.decode("base64").decode("zip"))) list1.append(i.Timestamp) list1.append(i.User) content=loads(i.Content.decode("base64").decode("zip")) content=replaceContentUrls(content) preview=content.split(" ") preview=preview[:40] preview.append(".....") preview= " ".join(preview) list1.append(preview) list1.append(content) list1.append(i.id) list2.append(list1) list1=zip(list2) return render_to_response("Communication/User/ViewNotices.html",{'pagerange':res[3],'next':res[1],'next_p':int(token)+1,'prev_p':int(token)-1,'prev':res[2],'list':list1,'title':"Notices"},context_instance=RequestContext(HttpRequest))