예제 #1
0
def reload_visits(inst_id):
    conn, cursor = config.connect_to_database()
    sql_visits = "select VisitID,PersonID,VisitedTime,HowManyTimes from profile_visit where ProfileID='%s'" % (
        inst_id)
    try:
        cursor.execute(sql_visits)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("Profile visits(0)")
        else:
            for row in results:
                divid = row[0]
                personid = row[1]
                time = row[2]
                howmanytimes = row[3]
                obj_cand = candidate_details.candidate()
                obj_cand.candidate_details(conn, cursor, personid)
                cand_id = obj_cand.cand_id
                cand_name = obj_cand.cand_name
                cand_image = obj_cand.cand_image
                cand_email = obj_cand.cand_email
                cand_contact = obj_cand.cand_contact
                filename = obj_cand.filename
                print(
                    """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;">
					<div class="row" style=""><div class="col-md-9"></div><div class="col-md-3 pull-right">%s</div></div>
						<hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
							<div class="row"><div class="col-md-9"><div class="media"><div class="media-left"><img class="img-circle" style="height:60px;" src="%s" /></div><div class="media-body" style="line-height: 25px;"><div id='%s' class='cand_id'><strong>%s</strong> visited <span class="badge">%s</span> times</div></div></div></div><div class="col-md-3"><a href="#" onclick='delete_visit("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div></div><br/>"""
                    %
                    (time, filename, cand_id, cand_name, howmanytimes, divid))
    except:
        conn.rollback()
        print("Server is taking too load...")
    conn.close()
예제 #2
0
def reload_history(c_id1):
    conn, cursor = config.connect_to_database()
    sql = "SELECT ID,`Time`,Field FROM History where UserID='%s' and role='Institute' ORDER BY Time DESC" % (
        c_id1)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("History(0)")
        else:
            for row in results:
                divid = row[0]
                time = row[1]
                datetime = time.strftime('%H : %M')
                field = row[2]
                fdiv = "You have updated <strong> %s</strong> at %s" % (
                    field, datetime)
                print(
                    """<div id="%s"  class="alert alert-info alert-dismissable fade in" ><a href="#" onclick='delete_hist("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a> %s </div><br/>"""
                    % (divid, divid, fdiv))
    except:
        conn.rollback()
        print("Try again !")
    conn.close()
def reload_all(inst_id, role_div):
    conn, cursor = config.connect_to_database()
    sql = "Select ID,role,Time,ToUserID,Text,FromUser from chat where %s ORDER BY Time DESC" % (
        role_div)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("Inbox(0)")
        else:
            for row in results:
                role = row[1]
                divid = row[0]
                time = row[2]
                datetime = time.strftime('%H : %M')
                if role == "Offer" or role == "Accepted":
                    fromuser = row[3]
                    jobid = row[4]
                    obj_cand = candidate_details.candidate()
                    obj_cand.candidate_details(conn, cursor, fromuser)
                    obj_job = institute_and_job.institute_and_job()
                    obj_job.job_details(conn, cursor, jobid)
                    if role == "Offer":
                        status_header = "<span style='color:#FFAE00;'><strong><h4>Job Sent</h4></strong></span>"
                        status_div = """<h4>Job <span class='job_id' id='%s'><b>%s</b> offer sent to <span style='cursor:pointer;' class="show_candidate_link"><span id='%s' class='cand_id'><b>%s</b></span></span></span></h4>""" % (
                            obj_job.job_id, obj_job.job_name, obj_cand.cand_id,
                            obj_cand.cand_name)
                    elif role == "Accepted":
                        status_header = "<span style='color:green;'><strong><h4>Job Accepted</h4></strong></span>"
                        status_div = """<h4>Job <span class='job_id' id='%s'><b>%s</b> accepted by <span style='cursor:pointer;' class="show_candidate"><span id='%s' class='cand_id'><b>%s</b></span></span></span></h4>""" % (
                            obj_job.job_id, obj_job.job_name, obj_cand.cand_id,
                            obj_cand.cand_name)
                    print(
                        """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;">
					<div class="row" style=""><div class="col-md-9">%s</div><div class="col-md-3 pull-right">%s</div></div>
						<hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
							<div class="row"><div class="col-md-9"><div class="media"><div class="media-left"><img class="img-circle" style="height:60px;" src="%s" /></div><div class="media-body" style="line-height: 25px;"><div id='status_div'>%s</div></div></div></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div></div><br/>"""
                        % (status_header, time, obj_cand.filename, status_div,
                           divid))
                else:
                    fromuser = row[5]
                    text = row[4]
                    if fromuser == "Admin":
                        if text == "verified":
                            print(
                                """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;"><div class="row"><div class="col-md-9"><h4>Verification <span class="glyphicon glyphicon-ok-sign" style="color:green;"><span></h4></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
					<div class="row" style="margin-bottom:20px;"><div class="col-md-9"><div id="%s"  class="alert-dismissable fade in"><strong>%s </strong> : Hurray!!Your profile is varified successfully.</div></div><div class="col-md-3 pull-right">%s</div></div></div><br/>"""
                                % (divid, divid, fromuser, time))
                        elif text == "rejected":
                            print(
                                """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;"><div class="row"><div class="col-md-9"><h4>Verification <span class="glyphicon glyphicon-remove" style="color:red;"><span></h4></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
					<div class="row" style="margin-bottom:20px;"><div class="col-md-9"><div id="%s"  class="alert-dismissable fade in"><strong>%s </strong> : We are sorry!!Your profile is rejected.</div></div><div class="col-md-3 pull-right">%s</div></div></div><br/>"""
                                % (divid, divid, fromuser, time))
    except:
        conn.rollback()
        print("Try again !")
    print('<script type="text/javascript" src="js/show_cand.js"></script>')
    conn.close()
def update_filter_panel(skillarr1,candid):
	conn,cursor=config.connect_to_database()
	skillarr=list()
	if type(skillarr1) is str:
		skillarr.append(skillarr1)
	else:
		skillarr=skillarr1
	flag=0
	arr_id=[]
	sql="SELECT Subjects,Total_num,ID FROM Tests"
	try:
		cursor.execute(sql)
		results = cursor.fetchall()
		for row in results:
			subjects=row[0]
			num_que=row[1]
			num_que=int(num_que)
			subarr=subjects.split("|")
			for i in subarr:
				i=i.strip()
				i=i.lower()
				for j in skillarr:
					j=j.strip()
					j=j.lower()
					if i.find(j)!=-1:
						flag+=1
						testid=row[2]
						sql_result="Select * from results where CandID='%s' AND TestID='%s'"%(candid,testid)
						testid=int(testid)
						try:
							cursor.execute(sql_result)
							results_num=cursor.rowcount
							if results_num==0 and testid not in arr_id and num_que!=0:
								arr_id.append(testid)
							else:
								flag-=1
						except:
							conn.rollback()
							print("-1")
		status="all"
		if flag==0 or len(arr_id)==0:
			no_found.no_found("Tests(0)")
		else:
			print_on_screen_test(conn,cursor,arr_id,status)
	except:
		conn.rollback()
		print("-1")
	conn.close()
예제 #5
0
def reload_certificate(c_id):
    conn, cursor = config.connect_to_database()
    sql = "SELECT ID,Updated_time,TestID,Rightt,Total,Attained FROM Results where CandID='%s' ORDER BY Updated_time DESC" % (
        c_id)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("Certificates(0)")
        else:
            for row in results:
                divid = row[0]
                time = row[1]
                datetime = time.strftime('%H : %M')
                testid = row[2]
                right = row[3]
                total_que = row[4]
                total_que = int(total_que)
                right = int(right)
                right_perc = ((right) / total_que) * 100
                solved = row[5]
                solved = int(solved)
                solved_perc = (solved / total_que) * 100
                timedate = row[1]
                obj = test_details.test()
                obj.test_details(conn, cursor, testid)
                title = obj.title
                course = obj.course
                postedby = obj.postedby
                sub_string = obj.sub_string
                solved_width = "width:%s%%" % solved_perc
                right_width = "width:%s%%" % right_perc
                formid = "Form%s" % divid
                process_solved = """<div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="%s" aria-valuemin="0" aria-valuemax="100" style="%s">%.2f%%</div></div>""" % (
                    solved_perc, solved_width, solved_perc)
                process_right = """<div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="%s" aria-valuemin="0" aria-valuemax="100" style="%s">%.2f%%</div></div>""" % (
                    right_perc, right_width, right_perc)
                print(
                    """<br/><div id="%s" class="alert alert-info" style="padding:30px;"><div class="row"><div class="col-md-8"><h3><span class="glyphicon glyphicon-certificate"></span> Certificate <small>approved by %s</small></h3></div><div class="col-md-4">%s</div></div><div class="row"><div class="col-lg-6"><table class="myTable"><tr><td>Test name</td><td>%s</td></tr><tr><td>Course</td><td>%s</td></tr><tr><td>Subjects</td><td>%s</td></tr></table></div><div class="col-lg-6"><div class="row">Right Questions :%s</div><div class="row">Total attained Questions :%s</div></div></div><br/><div class="row"><form method="post" name="%s" id="%s" action="take_test.php"><input type='hidden' name="test_id" value="%s" /><input type='hidden' name="retest" value="01" /><button type="button" id="get_test_btn" onclick="get_test_fun('%s')" class="btn btn-primary" >Get again!</button></form></div></div><hr/>"""
                    % (divid, postedby, timedate, title, course, sub_string,
                       process_right, process_solved, formid, formid, testid,
                       formid))
    except:
        conn.rollback()
        print("Server is taking load...")
    conn.close()
def reload_history(c_id1):
    conn, cursor = config.connect_to_database()
    sql = "SELECT ID,`Time`,Field,role FROM History where UserID='%s' ORDER BY `Time` DESC" % (
        c_id1)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("History(0)")
        else:
            for row in results:
                divid = row[0]
                time = row[1]
                datetime = time.strftime('%H : %M')
                field = row[2]
                role = row[3]
                if role == "Accepted":
                    obj_inst = institute_and_job.institute_and_job()
                    obj_inst.institute_details(conn, cursor, field)
                    inst_name = obj_inst.inst_name
                    field_link = """<a id='inst_profile_link' style="cursor:pointer;" onclick="get_institute_profile(%s)" class='div_link'>%s</a>""" % (
                        field, inst_name)
                    fdiv = "You have <strong>acccepted offer from %s</strong> at %s" % (
                        field_link, datetime)
                elif role == "Deny_offer":
                    obj_inst = institute_and_job.institute_and_job()
                    obj_inst.institute_details(conn, cursor, field)
                    inst_name = obj_inst.inst_name
                    field_link = """<a id='inst_profile_link' style="cursor:pointer;" onclick="get_institute_profile(%s)" class='div_link'>%s</a>""" % (
                        field, inst_name)
                    fdiv = "You have <strong>denied offer from %s</strong> at %s" % (
                        field_link, datetime)
                else:
                    fdiv = "You have updated <strong> %s</strong> at %s" % (
                        field, datetime)
                print(
                    """<div id="%s"  class="alert alert-info alert-dismissable fade in" ><a href="#" onclick='delete_hist("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a> %s </div><br/>"""
                    % (divid, divid, fdiv))
    except:
        conn.rollback()
        print("Try again !")
    conn.close()
예제 #7
0
def provides_requests():
    conn, cursor = config.connect_to_database()
    sql = "select * from requests ORDER BY created_time DESC"
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        num_row = int(cursor.rowcount)
        if num_row != 0:
            i = 0
            requests = """<div class="row" style="margin:20px;"><caption><h2>Requests <button class="btn btn-primary" id="request_refresh"><span class="glyphicon glyphicon-refresh"></span></button></h2></caption><table class='customerTable table-striped'><tr><td><b>Index no.</b></td><td><b>Account Number</b></td><td><b>Account Name</b></td><td><b>Requesting</b></td><td><b>Time</b></td></tr>"""
            for row in results:
                r_id = row[0]
                acc_id = row[1]
                acc_no = customer_details.get_account_by_acc_id(
                    acc_id, "acc_no")
                acc_name = customer_details.get_account_by_acc_id(
                    acc_id, "acc_name")
                c_id = customer_details.get_account_by_acc_id(acc_id, "c_id")
                req = row[2]
                status = row[3]
                time = row[4]
                i += 1
                profile_link = """<a class='btn btn-link' id='profile_link'>%s</a>""" % acc_name
                requests += """<tr class='clickable-row' id='%s' style="cursor:pointer;"><td>%s</td><td id='%s' class='c_id'>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>""" % (
                    r_id, i, c_id, acc_no, profile_link, req, time)
            requests += "</table></div>"
            requests += """<script>
			var get_table_of_details=function(flag)
			{
				$.ajax({
		     		type: 'POST',
					url: 'admin_interface.py',
		           	data: 'flag='+flag,
		         	success  : function (data)
		         	{
						$("#show_here").empty();
						$("#show_here").html(data);
		         	}
					});
			};
			$("#request_refresh").click(function(){
				get_table_of_details("new_requests");
			});
			$(".clickable-row").click(function() {
			var r_id=$(this).attr("id");
			var c_id=$(this).children("td.c_id").attr("id");
			$(this).append("<form action='customer_profile.php' id='show_customer' method='post'><input type='hidden' name='request_id' value='"+r_id+"' /><input type='hidden' name='customer_id' value='"+c_id+"' /></form>");
			$("#show_customer").submit();
			});
			</script>"""
        else:
            requests = no_found.no_found("We have not got any feedbacks, yet.")
        return requests
    except:
        return "-99"
def update_filter_visited(candid):
	conn,cursor=config.connect_to_database()
	sql_visit="select TestID from visited_test where CandID='%s'"%candid
	status="visited"
	try:
		cursor.execute(sql_visit)
		results=cursor.fetchall()
		arr_id=[]
		flag=0
		for row in results:
			testid=row[0]
			flag+=1
			if testid not in arr_id:
				arr_id.append(testid)
			else:
				flag-=1
		if flag==0 or len(arr_id)==0:
			no_found.no_found("Please select your skills to proceed...")
		else:
			print_on_screen_test(conn,cursor,arr_id,status)
	except:
		return "-99"
예제 #9
0
def provides_feedbacks():
    conn, cursor = config.connect_to_database()
    sql = "select * from feedbacks"
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        num_row = int(cursor.rowcount)
        if num_row != 0:
            i = 0
            feedbacks = """<div class="row" style="margin:20px;"><caption><h2>Feedbacks <button class="btn btn-primary" id="feedback_refresh"><span class="glyphicon glyphicon-refresh"></span></button></h2></caption><table class='customerTable table-striped'><tr><td><b>Index no.</b></td><td><b>Email</b></td><td><b>Feedbacks</b></td><td><b>Time</b></td></tr>"""
            for row in results:
                f_id = row[0]
                email = row[1]
                f_text = row[2]
                time = row[3]
                i += 1
                feedbacks += """<tr id='%s' style="cursor:pointer;"><td>%s</td><td><a class='btn btn-link' href='mailto:%s'>%s</a></td><td>%s</td><td>%s</td></tr>""" % (
                    f_id, i, email, email, f_text, time)
            feedbacks += """</table></div>
			<script>
			var get_table_of_details=function(flag)
			{
				$.ajax({
		     		type: 'POST',
					url: 'admin_interface.py',
		           	data: 'flag='+flag,
		         	success  : function (data)
		         	{
						$("#show_here").empty();
						$("#show_here").html(data);
		         	}
					});
			};
			$("#feedback_refresh").click(function(){
				get_table_of_details("new_feedbacks");
			});
			</script>"""
        else:
            feedbacks = no_found.no_found(
                "We have not got any feedbacks, yet.")
        return feedbacks
    except:
        return "-99"
def show_customers(bit):
    conn, cursor = config.connect_to_database()
    sql = "select * from customers where hasAcc='%s'" % bit
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        row_num = cursor.rowcount
        bit = int(bit)
        if bit == 0:
            flag = "New customers"
            cust_id = "new_customers"
            refresh_btn = "new_customers_refresh"
        elif bit == 1:
            flag = "Approved customers"
            cust_id = "approved_customers"
            refresh_btn = "approved_customers_refresh"
        elif bit == -1:
            flag = "Rejected customers"
            cust_id = "rejected_customers"
            refresh_btn = "rejected_customers_refresh"
        else:
            flag = "New customers"
            cust_id = "new_customers"
            refresh_btn = "new_customers_refresh"
        if int(row_num) == 0:
            cust = no_found.no_found("No " + flag)
        else:
            cust = """<div class="row" style="margin:20px;"><caption><h3>%s <button class="btn btn-primary" id="%s"><span class="glyphicon glyphicon-refresh"></span></button></h3></caption><table class="customerTable table-striped"><tr><td align="left">Index no.</td><td align="left">Username</td><td align="left">Full Name</td><td align="left">Email</td><td align="left">Contact no.</td></tr>""" % (
                flag, refresh_btn)
            i = 1
            for row in results:
                cid = str(row[0])
                username = row[1]
                fname = row[2].capitalize()
                lname = row[3].capitalize()
                middle_name = row[12].capitalize()
                email = row[4]
                contact = row[6]
                full_name = "%s %s %s" % (fname, middle_name, lname)
                cust += """<div><tr class='clickable-row' id='%s' style="cursor:pointer;"><td align="left">%s</td><td align="left">%s</td><td align="left">%s</td><td align="left">%s</td><td align="left">%s</td></tr></div>""" % (
                    cid, i, username, full_name, email, contact)
                i += 1
            cust += "</table></div>"
            cust += """<script>
			var get_table_of_details=function(flag)
			{
				$.ajax({
		     		type: 'POST',
					url: 'admin_interface.py',
		           	data: 'flag='+flag,
		         	success  : function (data)
		         	{
						$("#show_here").empty();
						$("#show_here").html(data);
		         	}
					});
			};
			$("#%s").click(function(){
				get_table_of_details("%s");
			});
			$(".clickable-row").click(function() {
			var c_id=$(this).attr("id");
			$(this).append("<form action='customer_profile.php' id='show_customer' method='post'><input type='text' name='customer_id' value='"+c_id+"' /></form>");$("#show_customer").submit();
			});
			</script>""" % (refresh_btn, cust_id)
        return cust
    except:
        return "-1"
예제 #11
0
def reload_cand_certificates(c_id):
    conn, cursor = config.connect_to_database()
    numrow = certificate_total_count(cursor, conn, c_id)
    print(numrow)
    if numrow > 0:
        sql = "SELECT ID,Updated_time,TestID,Rightt,Total,Attained FROM Results where CandID='%s' ORDER BY Updated_time DESC" % (
            c_id)
        try:
            cursor.execute(sql)
            results = cursor.fetchall()
            for row in results:
                divid = row[0]
                time = row[1]
                datetime = time.strftime('%H : %M')
                testid = row[2]
                right = row[3]
                total_que = row[4]
                total_que = int(total_que)
                right = int(right)
                right_perc = ((right) / total_que) * 100
                solved = row[5]
                solved = int(solved)
                solved_perc = (solved / total_que) * 100
                sql2 = "SELECT Title,Course,Subjects,Postedby FROM Tests where ID='%s'" % (
                    testid)
                try:
                    cursor.execute(sql2)
                    result_of_test = cursor.fetchone()
                    title = result_of_test[0]
                    course = result_of_test[1]
                    str_sub = result_of_test[2]
                    postedby = result_of_test[3]
                    if postedby == "-99":
                        postedby = "CareerHub"
                    subjects = str_sub.split("|")
                    if len(subjects) == 1:
                        sub_string = str_sub.strip()
                    else:
                        sub_string = ""
                        j = 0
                        for i in subjects:
                            if j == 0:
                                sub_string += i.strip()
                            else:
                                sub_string += ", " + i.strip()
                            j += 1
                        sub_string += ""
                    solved_width = "width:%s%%" % solved_perc
                    right_width = "width:%s%%" % right_perc
                    formid = "Form%s" % divid
                    process_solved = """<div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="%s" aria-valuemin="0" aria-valuemax="100" style="%s">%.2f%%</div></div>""" % (
                        solved_perc, solved_width, solved_perc)
                    process_right = """<div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="%s" aria-valuemin="0" aria-valuemax="100" style="%s">%.2f%%</div></div>""" % (
                        right_perc, right_width, right_perc)
                    print(
                        """<br/><div id="%s" class="alert alert-info" style="padding:30px;"><div class="row"><h3><span class="glyphicon glyphicon-certificate"></span> Certificate <small>approved by %s</small></h3></div><div class="row"><div class="col-lg-6"><table class="myTable"><tr><td>Test name</td><td>%s</td></tr><tr><td>Course</td><td>%s</td></tr><tr><td>Subjects</td><td>%s</td></tr></table></div><div class="col-lg-6"><div class="row">Right Questions :%s</div><div class="row">Total attained Questions :%s</div></div></div><br/></div><hr/>"""
                        % (divid, postedby, title, course, sub_string,
                           process_right, process_solved))
                except:
                    conn.rollback()
                    print("Server is taking load...")
        except:
            conn.rollback()
            print("Server is taking load...")
        conn.close()
    else:
        no_found.no_found("Certificates(0)")
def reload_all(c_id1, role_div):
    conn, cursor = config.connect_to_database()
    c_id1 = int(c_id1)
    role_div = str(role_div)
    sql_mess = "select Type,ID,ToUserID,FromUser,Time,Text,role from(select 'chat' as Type,ID,ToUserID,FromUser,Time,Text,role from chat where ToUserID='%s' and %s UNION ALL select 'application' as Type,application_id,candidate_id,institute_id,apply_datetime,job_id,status_bit from applications where candidate_id='%s') as Messages ORDER BY Time DESC" % (
        c_id1, role_div, c_id1)
    try:
        cursor.execute(sql_mess)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("Inbox(0)")
        else:
            for row in results:
                c_id2 = row[2]
                role = row[6]
                divid = row[1]
                time = row[4]
                type_id = row[0]
                datetime = time.strftime('%d-%m-%Y %H : %M %a')
                if role == "Offer" and type_id == 'chat':
                    fromuser = row[3]
                    jobid = row[5]
                    obj = institute_and_job.institute_and_job()
                    obj.institute_details(conn, cursor, fromuser)
                    obj.job_details(conn, cursor, jobid)
                    print(
                        """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;"><div class="row"><div class="col-md-9"><h4><b>Job offer</b></h4></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/><a  class="div_link show_institute" style="cursor:pointer;"><div class="row" style="margin-bottom:20px;"><div class="col-md-9"><div id="%s" class="alert-dismissable fade in inst_id"><div class="media role_type" id='%s'><div class="media-left"><img class="img-circle" style="height:150px;" src="%s" /></div><div class="media-body" style="line-height: 25px;"><h4 class="media-heading"><b>Institute name : </b>%s</h4><div class="row"><div class="col-xs-6"><h5><b>Job Title : </b>%s</h5><h5 class="description_first"><b>Institute description : </b>%s</h5></div><div class="col-xs-6 job_id" id="%s"> <h5><b>Institute Type: </b>%s</h5> <h5><b>Business Email: </b>%s</h5> <h5><b>Business Contact: </b>%s</h5> <h5><b>Institute Address: </b>%s</h5> <h5><b>Country: </b>%s</h5> <h5><b>ZIP: </b>%s</h5></div></div></div></div></div></div><div class="col-md-3 pull-right">%s</div></div></a></div><br/>"""
                        %
                        (divid, obj.inst_id, role, obj.filename, obj.inst_name,
                         obj.job_name, obj.institute_descr, obj.job_id,
                         obj.institute_type, obj.institute_bemail,
                         obj.institute_contact, obj.institute_address,
                         obj.institute_country, obj.institute_zip, datetime))
                elif type_id == "application" and role_div != "role='Offer'":
                    fromuser = row[3]
                    jobid = row[5]
                    obj = institute_and_job.institute_and_job()
                    obj.institute_details(conn, cursor, fromuser)
                    obj.job_details(conn, cursor, jobid)
                    if role == "1":
                        status_div = "<div class='row alert alert-success'><center><h4>Congratulation, You have got this job.</h4></center></div>"
                    elif role == "0":
                        status_div = "<div class='row alert alert-danger'><center><h4>Rejected</h4></center></div>"
                    elif role == "-99":
                        status_div = "<div class='row alert alert-warning'><center><h4>Pending..</h4></center></div>"
                    print(
                        """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;"><div class="row"><div class="col-md-9"><h4><b>Request sent</b></h4></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>%s<a  class="div_link show_institute" style="cursor:pointer;"><div class="row" style="margin-bottom:20px;"><div class="col-md-9"><div id="%s" class="alert-dismissable fade in inst_id"><div class="media role_type" id='%s'><div class="media-left"><img class="img-circle" style="height:150px;" src="%s" /></div><div class="media-body" style="line-height: 25px;"><h4 class="media-heading"><b>Institute name : </b>%s</h4><div class="row"><div class="col-xs-6"><h5><b>Job Title : </b>%s</h5><h5 class="description_first"><b>Institute description : </b>%s</h5></div><div class="col-xs-6 job_id" id="%s"> <h5><b>Institute Type: </b>%s</h5> <h5><b>Business Email: </b>%s</h5> <h5><b>Business Contact: </b>%s</h5> <h5><b>Institute Address: </b>%s</h5><h5><b>Country: </b>%s</h5><h5><b>ZIP: </b>%s</h5></div></div></div></div></div></div><div class="col-md-3 pull-right">%s</div></div></a></div><br/>"""
                        %
                        (divid, status_div, obj.inst_id, role, obj.filename,
                         obj.inst_name, obj.job_name, obj.institute_descr,
                         obj.job_id, obj.institute_type, obj.institute_bemail,
                         obj.institute_contact, obj.institute_address,
                         obj.institute_country, obj.institute_zip, datetime))
                else:
                    fromuser = row[3]
                    text = row[5]
                    if fromuser == "Admin":
                        if text == "verified":
                            print(
                                """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;"><div class="row"><div class="col-md-9"><h4>Verification <span class="glyphicon glyphicon-ok-sign" style="color:green;"><span></h4></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
					<div class="row" style="margin-bottom:20px;"><div class="col-md-9"><div id="%s"  class="alert-dismissable fade in"><strong>%s </strong> : Hurray!!Your profile is varified successfully.</div></div><div class="col-md-3 pull-right">%s</div></div></div><br/>"""
                                % (divid, divid, fromuser, datetime))
                        elif text == "rejected":
                            print(
                                """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;"><div class="row"><div class="col-md-9"><h4>Verification <span class="glyphicon glyphicon-remove" style="color:red;"><span></h4></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
					<div class="row" style="margin-bottom:20px;"><div class="col-md-9"><div id="%s"  class="alert-dismissable fade in"><strong>%s </strong> : We are sorry!!Your profile is rejected.</div></div><div class="col-md-3 pull-right">%s</div></div></div><br/>"""
                                % (divid, divid, fromuser, datetime))
    except:
        conn.rollback()
        print("Try again !2")
    print('<script type="text/javascript" src="js/read_more.js"></script>')
    print('<script type="text/javascript" src="js/show_inst.js"></script>')
    conn.close()
예제 #13
0
#!/usr/bin/python
import cgi, cgitb
import sys
import security
import admin_show_customers
import no_found
import customer_details
import admin_control

print("Content-type:text/html;Content-type: image/jpeg\r\n\r\n")
cgitb.enable(display=0, logdir="/path/to/logdir")
form = cgi.FieldStorage()
if form.getvalue('flag'):
    flag = form.getvalue("flag")
    info = no_found.no_found("No new requests")
    if flag == "approved_customers":
        info = admin_show_customers.show_customers(1)
    elif flag == "rejected_customers":
        info = admin_show_customers.show_customers(-1)
    elif flag == "new_customers":
        info = admin_show_customers.show_customers(0)
    elif flag == "new_requests":
        info = admin_control.provides_requests()
    elif flag == "new_feedbacks":
        info = admin_control.provides_feedbacks()
    print("%s" % info)
if form.getvalue('get_data'):
    user = security.protect_data(form.getvalue('user'))
    get_data = security.protect_data(form.getvalue('get_data'))
    got_it = customer_details.get_any_value(user, get_data)
    print("%s" % got_it)