/home/khai/ST_project/Assignment_submission/assignment_submission_try.c File Reference

#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <gtk/gtksignal.h>
#include <gtk/gtktable.h>
#include <gtk/gtktogglebutton.h>
#include "connect.h"
#include <mysql/mysql.h>

Go to the source code of this file.

Defines

#define BUFFER   4096
#define MAX_FORMAT_SIZE   100

Functions

gint close_application (GtkWidget *widget, gpointer data)
 It is called when user close/quit window using window manager.
void button_Cancel (GtkWidget *widget, gpointer data)
 It is called when user click button cancel to exit from the system.
void button_ok_login ()
 This function is called when student or admin choose to login to the system using login_interface and if login success will make the student access to the assignment_interface while admin access to the admin_interface.
void button_Logout ()
 It is called when student or admin choose to logout from the system.
void button_Back ()
 It is called when student choose to back to the main page.
void msg_dialog1 ()
 Message dialog to give any feedback to the student's or admin's action.
void msg_dialog2 ()
 Message dialog to give any feedback to the student's or admin's action.
void msg_dialog3 ()
 Message dialog to give any feedback to the student's or admin's action.
void msg_dialog4 ()
 Message dialog to give any feedback to the student's or admin's action.
void msg_dialog5 ()
 Message dialog to give any feedback to the student's or admin's action.
void msg_dialog6 ()
 Message dialog to give any feedback to the student's or admin's action.
void add_records (GtkWidget *widget, gpointer data)
 This function is called when the student choose to submit their answers to the database system and this function will connect to the database and inserting student's answers to the table submission in the database.
void add_records1 (GtkWidget *widget, gpointer data)
 This function is called when the admin choose to submit their questions to the database system and this function will connect to the database and inserting admin's questions to the table assignmnt in the database.
void fetch_records (GtkWidget *widget, GdkEventKey *event, GtkWidget *label1)
 This function is called when the student choose to view current assignment's questions from the database system and this function will connect to the database and select qNo and listQuestions from the table submission in the database and display it to the student.
void fetch_records1 (GtkWidget *widget, GdkEventKey *event, GtkWidget *label1)
 This function is called when the student choose to view current assignment's number from the database system that available in the system currently and this function will connect to the database.
void fetch_records2 (GtkWidget *widget, GdkEventKey *event, GtkWidget *label1)
 This function is called when the student choose to view their previous answers from the database system and this function will connect to the database and the system will select assigNo and answers from the table submission in the database and display it to the student.
void fetch_records3 (GtkWidget *widget, GdkEventKey *event, GtkWidget *label1)
 This function is called when the student choose to view current assignment's questions from the database system that available in the system currently and this function will connect to the database.
void fetch_records4 (GtkWidget *widget, GdkEventKey *event, GtkWidget *label1)
 This function is called when admin choose to display the number of students that already submitted their assignment to the system and this function will connect to the database and the system will select student based on their email from the table submission in the database and display it to admin.
void fetch_records5 (GtkWidget *widget, GdkEventKey *event, GtkWidget *label1)
 This function is called when admin choose to display the number of students that already submitted their assignment to the system and this function will connect to the database and the system will select student based on their email from the table submissionFile in the database and display it to admin.
void fetch_records6 (GtkWidget *widget, GdkEventKey *event, GtkWidget *label1)
 This function is called when the student choose to view their previous file answers from the database system and this function will connect to the database and the system will select assigNo and answers from the table submission in the database and display it to the student.
void modify_records ()
 This function is called when admin choose to save the questions that they already edited from the system and this function will connect to the database and the system will modify the questions that currently in the database.
void display_row ()
 This function is called from fetch_records function to display the row data from the database.
void display_row1 ()
 This function is called from fetch_records function to display the row data from the database.
void display_row2 ()
 This function is called from fetch_records function to display the row data from the database.
void display_row3 ()
 This function is called from fetch_records function to display the row data from the database.
void display_row4 ()
 This function is called from fetch_records function to display the row data from the database.
void display_row5 ()
 This function is called from fetch_records function to display the row data from the database.
void clear ()
 This function is called to clear text from the entry field and text view field.
void clear1 ()
 This function is called to clear text from the entry field and text view field.
void clear2 ()
 This function is called to clear text from the entry field and text view field.
void editable ()
 This function is called to set TRUE or FALSE editable on text view field.
void editable1 ()
 This function is called to set TRUE or FALSE editable on text view field.
void editable3 ()
 This function is called to set TRUE or FALSE editable on text view field.
void signup (GtkWidget *widget, gpointer data)
 This function is called to display register_interface page.
void viewAnswer (GtkWidget *widget, gpointer data)
 This function is called to display viewAnswers_interface page.
void button_ok_register (GtkWidget *widget, gpointer data)
 This function is called when new student choose to register to the system using register_interface and this function will connect to the database and inserting student's information to the register table and store that information.
void button_cancel_register (GtkWidget *widget, gpointer data)
 It is called when user click button cancel in the register interface and will allow the student to go back to the login interface.
void msg_dialog ()
 Message dialog to give any feedback to the student's or admin's action.
void save ()
 It is called when user click button save in the assignment interface and will save all the student's answers to the external file in the hardisk before they submit their final answers to the database.
void browse ()
 It is called when user click button browse in the assignment interface and student can browse a file that contain the answer for the assignment before upload the file path to the database.
void upload ()
 It is called when user click button upload in the assignment interface and student will upload the file path to the database and system will inserting the file path into table submissionFile.
void viewAnswers_interface (int argc, char *argv[])
 This is a function to create view answer interface which allow student to view their previous answers.
void admin_interface (int argc, char *argv[])
 This is a function to create admin interface which allow admin to create questions, view and edit the assignment's questions and display list of students that submitted the assignment.
void assignment_interface (int argc, char *argv[])
 This is a function to create assignment interface which allow student to view questions, type answers, save to the external file, and submit it to the database system.
void register_interface (int argc, char *argv[])
 This is a function to create register interface which allow admin and new student to register to the system.
int main (int argc, char *argv[])
 Main page for login interface.

Variables

MYSQL * connection1
MYSQL_RES * result
MYSQL_ROW sqlrow
GtkWidget * view
GtkWidget * view1
GtkWidget * view2
GtkWidget * viewQuest
GtkWidget * viewQuest1
GtkWidget * viewStudent
GtkWidget * buttonSubmit
GtkTextBuffer * buffer
GtkTextBuffer * buffer1
GtkTextBuffer * buffer2
GtkTextBuffer * buffer3
GtkTextIter iter
GtkToggleButton * button
GtkWidget * window1
GtkWidget * window2
GtkWidget * window3
GtkWidget * parent_window
GtkEntry * name_entry
GtkEntry * name_entry1
GtkEntry * assig_no
GtkEntry * assig_no1
GtkEntry * assig_no2
GtkEntry * quest_no
GtkEntry * username_entry
GtkEntry * password_entry
GtkEntry * email_entry
GtkEntry * rollNo_entry
GtkEntry * username_entry1
GtkEntry * password_entry1
GtkEntry * email_entry1
GtkEntry * rollNo_entry1
GtkWidget * label_D

Define Documentation

#define BUFFER   4096

Definition at line 27 of file assignment_submission_try.c.

#define MAX_FORMAT_SIZE   100

Definition at line 28 of file assignment_submission_try.c.


Function Documentation

void add_records ( GtkWidget *  widget,
gpointer  data 
)

This function is called when the student choose to submit their answers to the database system and this function will connect to the database and inserting student's answers to the table submission in the database.

Parameters:
widget Widget which generated the event
data any additional data passed while generating signal

Definition at line 233 of file assignment_submission_try.c.

References BUFFER, buffer, connection1, msg_dialog1(), msg_dialog3(), name_entry, username_entry, and view.

void add_records1 ( GtkWidget *  widget,
gpointer  data 
)

This function is called when the admin choose to submit their questions to the database system and this function will connect to the database and inserting admin's questions to the table assignmnt in the database.

Parameters:
widget Widget which generated the event
data any additional data passed while generating signal

Definition at line 298 of file assignment_submission_try.c.

References assig_no, BUFFER, buffer, connection1, msg_dialog3(), msg_dialog4(), quest_no, and viewQuest.

void admin_interface ( int  argc,
char *  argv[] 
)

This is a function to create admin interface which allow admin to create questions, view and edit the assignment's questions and display list of students that submitted the assignment.

Parameters:
argc Number of arguments passed.
argv NULL terminated array of command line arguments.

Definition at line 1269 of file assignment_submission_try.c.

References add_records1(), assig_no, assig_no1, assig_no2, button_Logout(), buttonSubmit, clear(), clear1(), clear2(), editable3(), fetch_records3(), fetch_records4(), fetch_records5(), label_D, modify_records(), quest_no, viewQuest, viewQuest1, viewStudent, and window1.

void assignment_interface ( int  argc,
char *  argv[] 
)

This is a function to create assignment interface which allow student to view questions, type answers, save to the external file, and submit it to the database system.

Parameters:
argc Number of arguments passed.
argv NULL terminated array of command line arguments.

Definition at line 1434 of file assignment_submission_try.c.

References add_records(), browse(), button_Logout(), buttonSubmit, clear(), editable(), editable1(), fetch_records(), fetch_records1(), name_entry, name_entry1, save(), upload(), view, view1, viewAnswer(), and window1.

void browse (  ) 

It is called when user click button browse in the assignment interface and student can browse a file that contain the answer for the assignment before upload the file path to the database.

Definition at line 1141 of file assignment_submission_try.c.

References name_entry1, and parent_window.

void button_Back (  ) 

It is called when student choose to back to the main page.

Definition at line 151 of file assignment_submission_try.c.

References window3.

void button_Cancel ( GtkWidget *  widget,
gpointer  data 
)

It is called when user click button cancel to exit from the system.

Parameters:
widget Widget which generated the event
data any additional data passed while generating signal

Definition at line 74 of file assignment_submission_try.c.

void button_cancel_register ( GtkWidget *  widget,
gpointer  data 
)

It is called when user click button cancel in the register interface and will allow the student to go back to the login interface.

Parameters:
widget Widget which generated the event
data any additional data passed while generating signal

Definition at line 1085 of file assignment_submission_try.c.

References window2.

void button_Logout (  ) 

It is called when student or admin choose to logout from the system.

Definition at line 145 of file assignment_submission_try.c.

References window1.

void button_ok_login (  ) 

This function is called when student or admin choose to login to the system using login_interface and if login success will make the student access to the assignment_interface while admin access to the admin_interface.

This function will connect to the database and access register table to match the correct user.

Definition at line 84 of file assignment_submission_try.c.

References admin_interface(), assignment_interface(), BUFFER, connection1, display_row3(), password_entry, result, sqlrow, and username_entry.

void button_ok_register ( GtkWidget *  widget,
gpointer  data 
)

This function is called when new student choose to register to the system using register_interface and this function will connect to the database and inserting student's information to the register table and store that information.

Parameters:
widget Widget which generated the event
data any additional data passed while generating signal

Definition at line 1038 of file assignment_submission_try.c.

References BUFFER, connection1, email_entry1, msg_dialog2(), msg_dialog6(), password_entry1, result, rollNo_entry1, and username_entry1.

void clear (  ) 

This function is called to clear text from the entry field and text view field.

Definition at line 956 of file assignment_submission_try.c.

References assig_no, buffer, buffer1, buffer2, buffer3, quest_no, view, view1, view2, and viewQuest.

void clear1 (  ) 

This function is called to clear text from the entry field and text view field.

Definition at line 976 of file assignment_submission_try.c.

References assig_no1, buffer, and viewQuest1.

void clear2 (  ) 

This function is called to clear text from the entry field and text view field.

Definition at line 986 of file assignment_submission_try.c.

References assig_no2, buffer, and viewStudent.

gint close_application ( GtkWidget *  widget,
gpointer  data 
)

It is called when user close/quit window using window manager.

We will always enable closing of window using window manager.

Parameters:
widget Widget which generated the event
data any additional data passed while generating signal
Returns:
FALSE if you want to closing, TRUE otherwise

Definition at line 63 of file assignment_submission_try.c.

void display_row (  ) 

This function is called from fetch_records function to display the row data from the database.

Definition at line 822 of file assignment_submission_try.c.

References buffer, connection1, iter, sqlrow, and view1.

void display_row1 (  ) 

This function is called from fetch_records function to display the row data from the database.

Definition at line 846 of file assignment_submission_try.c.

References connection1, name_entry, and sqlrow.

void display_row2 (  ) 

This function is called from fetch_records function to display the row data from the database.

Definition at line 866 of file assignment_submission_try.c.

References buffer, connection1, iter, sqlrow, and viewQuest.

void display_row3 (  ) 

This function is called from fetch_records function to display the row data from the database.

Definition at line 888 of file assignment_submission_try.c.

References connection1, and sqlrow.

void display_row4 (  ) 

This function is called from fetch_records function to display the row data from the database.

Definition at line 909 of file assignment_submission_try.c.

References buffer, connection1, iter, sqlrow, and viewQuest1.

void display_row5 (  ) 

This function is called from fetch_records function to display the row data from the database.

Definition at line 933 of file assignment_submission_try.c.

References buffer, connection1, iter, sqlrow, and viewStudent.

void editable (  ) 

This function is called to set TRUE or FALSE editable on text view field.

Definition at line 996 of file assignment_submission_try.c.

References view.

void editable1 (  ) 

This function is called to set TRUE or FALSE editable on text view field.

Definition at line 1003 of file assignment_submission_try.c.

References view.

void editable3 (  ) 

This function is called to set TRUE or FALSE editable on text view field.

Definition at line 1010 of file assignment_submission_try.c.

References viewQuest1.

void fetch_records ( GtkWidget *  widget,
GdkEventKey *  event,
GtkWidget *  label1 
)

This function is called when the student choose to view current assignment's questions from the database system and this function will connect to the database and select qNo and listQuestions from the table submission in the database and display it to the student.

Parameters:
widget Widget which generated the event

Definition at line 363 of file assignment_submission_try.c.

References BUFFER, connection1, display_row(), name_entry, result, and sqlrow.

void fetch_records1 ( GtkWidget *  widget,
GdkEventKey *  event,
GtkWidget *  label1 
)

This function is called when the student choose to view current assignment's number from the database system that available in the system currently and this function will connect to the database.

and the system will select assigNo from the table assignmnt in the database and display it to the student.

Parameters:
widget Widget which generated the event

Definition at line 420 of file assignment_submission_try.c.

References BUFFER, connection1, display_row1(), result, and sqlrow.

void fetch_records2 ( GtkWidget *  widget,
GdkEventKey *  event,
GtkWidget *  label1 
)

This function is called when the student choose to view their previous answers from the database system and this function will connect to the database and the system will select assigNo and answers from the table submission in the database and display it to the student.

Parameters:
widget Widget which generated the event

Definition at line 475 of file assignment_submission_try.c.

References BUFFER, connection1, display_row2(), result, sqlrow, and username_entry.

void fetch_records3 ( GtkWidget *  widget,
GdkEventKey *  event,
GtkWidget *  label1 
)

This function is called when the student choose to view current assignment's questions from the database system that available in the system currently and this function will connect to the database.

and the system will select qNo and listQuestions from the table assignmnt in the database and display it to the student.

Parameters:
widget Widget which generated the event

Definition at line 532 of file assignment_submission_try.c.

References assig_no1, BUFFER, connection1, display_row4(), result, and sqlrow.

void fetch_records4 ( GtkWidget *  widget,
GdkEventKey *  event,
GtkWidget *  label1 
)

This function is called when admin choose to display the number of students that already submitted their assignment to the system and this function will connect to the database and the system will select student based on their email from the table submission in the database and display it to admin.

Parameters:
widget Widget which generated the event

Definition at line 591 of file assignment_submission_try.c.

References assig_no2, BUFFER, connection1, display_row5(), result, and sqlrow.

void fetch_records5 ( GtkWidget *  widget,
GdkEventKey *  event,
GtkWidget *  label1 
)

This function is called when admin choose to display the number of students that already submitted their assignment to the system and this function will connect to the database and the system will select student based on their email from the table submissionFile in the database and display it to admin.

Parameters:
widget Widget which generated the event

Definition at line 649 of file assignment_submission_try.c.

References assig_no2, BUFFER, connection1, display_row5(), result, and sqlrow.

void fetch_records6 ( GtkWidget *  widget,
GdkEventKey *  event,
GtkWidget *  label1 
)

This function is called when the student choose to view their previous file answers from the database system and this function will connect to the database and the system will select assigNo and answers from the table submission in the database and display it to the student.

Parameters:
widget Widget which generated the event

Definition at line 706 of file assignment_submission_try.c.

References BUFFER, connection1, display_row2(), result, sqlrow, and username_entry.

int main ( int  argc,
char *  argv[] 
)

Main page for login interface.

Parameters:
argc Number of arguments passed.
argv NULL terminated array of command line arguments.

Definition at line 1688 of file assignment_submission_try.c.

References button_Cancel(), button_ok_login(), label_D, password_entry, signup(), and username_entry.

void modify_records (  ) 

This function is called when admin choose to save the questions that they already edited from the system and this function will connect to the database and the system will modify the questions that currently in the database.

Definition at line 761 of file assignment_submission_try.c.

References assig_no1, buffer, BUFFER, connection1, msg_dialog5(), and viewQuest1.

void msg_dialog (  ) 

Message dialog to give any feedback to the student's or admin's action.

Definition at line 1091 of file assignment_submission_try.c.

void msg_dialog1 (  ) 

Message dialog to give any feedback to the student's or admin's action.

Definition at line 157 of file assignment_submission_try.c.

void msg_dialog2 (  ) 

Message dialog to give any feedback to the student's or admin's action.

Definition at line 169 of file assignment_submission_try.c.

void msg_dialog3 (  ) 

Message dialog to give any feedback to the student's or admin's action.

Definition at line 181 of file assignment_submission_try.c.

void msg_dialog4 (  ) 

Message dialog to give any feedback to the student's or admin's action.

Definition at line 193 of file assignment_submission_try.c.

void msg_dialog5 (  ) 

Message dialog to give any feedback to the student's or admin's action.

Definition at line 205 of file assignment_submission_try.c.

void msg_dialog6 (  ) 

Message dialog to give any feedback to the student's or admin's action.

Definition at line 217 of file assignment_submission_try.c.

void register_interface ( int  argc,
char *  argv[] 
)

This is a function to create register interface which allow admin and new student to register to the system.

Parameters:
argc Number of arguments passed.
argv NULL terminated array of command line arguments.

Definition at line 1613 of file assignment_submission_try.c.

References button_cancel_register(), button_ok_register(), email_entry1, password_entry1, rollNo_entry1, username_entry1, and window2.

void save (  ) 

It is called when user click button save in the assignment interface and will save all the student's answers to the external file in the hardisk before they submit their final answers to the database.

Definition at line 1106 of file assignment_submission_try.c.

References buffer, msg_dialog(), and view.

void signup ( GtkWidget *  widget,
gpointer  data 
)

This function is called to display register_interface page.

Parameters:
widget Widget which generated the event
data any additional data passed while generating signal

Definition at line 1019 of file assignment_submission_try.c.

References register_interface().

void upload (  ) 

It is called when user click button upload in the assignment interface and student will upload the file path to the database and system will inserting the file path into table submissionFile.

Definition at line 1165 of file assignment_submission_try.c.

References BUFFER, connection1, msg_dialog1(), msg_dialog3(), name_entry, name_entry1, and username_entry.

void viewAnswer ( GtkWidget *  widget,
gpointer  data 
)

This function is called to display viewAnswers_interface page.

Parameters:
widget Widget which generated the event
data any additional data passed while generating signal

Definition at line 1027 of file assignment_submission_try.c.

References viewAnswers_interface().

void viewAnswers_interface ( int  argc,
char *  argv[] 
)

This is a function to create view answer interface which allow student to view their previous answers.

Parameters:
argc Number of arguments passed.
argv NULL terminated array of command line arguments.

Definition at line 1213 of file assignment_submission_try.c.

References button_Back(), fetch_records2(), fetch_records6(), viewQuest, window1, and window3.


Variable Documentation

GtkEntry* assig_no

Definition at line 49 of file assignment_submission_try.c.

GtkEntry* assig_no1

Definition at line 50 of file assignment_submission_try.c.

GtkEntry* assig_no2

Definition at line 51 of file assignment_submission_try.c.

GtkTextBuffer* buffer

Definition at line 37 of file assignment_submission_try.c.

GtkTextBuffer* buffer1

Definition at line 38 of file assignment_submission_try.c.

GtkTextBuffer* buffer2

Definition at line 39 of file assignment_submission_try.c.

GtkTextBuffer* buffer3

Definition at line 40 of file assignment_submission_try.c.

GtkToggleButton* button

Definition at line 42 of file assignment_submission_try.c.

GtkWidget* buttonSubmit

Definition at line 36 of file assignment_submission_try.c.

MYSQL* connection1

Definition at line 23 of file assignment_submission_try.c.

GtkEntry * email_entry

Definition at line 53 of file assignment_submission_try.c.

GtkEntry * email_entry1

Definition at line 54 of file assignment_submission_try.c.

GtkTextIter iter

Definition at line 41 of file assignment_submission_try.c.

GtkWidget* label_D

Definition at line 55 of file assignment_submission_try.c.

GtkEntry* name_entry

Definition at line 47 of file assignment_submission_try.c.

GtkEntry* name_entry1

Definition at line 48 of file assignment_submission_try.c.

GtkWidget* parent_window

Definition at line 46 of file assignment_submission_try.c.

GtkEntry * password_entry

Definition at line 53 of file assignment_submission_try.c.

GtkEntry * password_entry1

Definition at line 54 of file assignment_submission_try.c.

GtkEntry* quest_no

Definition at line 52 of file assignment_submission_try.c.

MYSQL_RES* result

Definition at line 24 of file assignment_submission_try.c.

GtkEntry * rollNo_entry

Definition at line 53 of file assignment_submission_try.c.

GtkEntry * rollNo_entry1

Definition at line 54 of file assignment_submission_try.c.

MYSQL_ROW sqlrow

Definition at line 25 of file assignment_submission_try.c.

GtkEntry* username_entry

Definition at line 53 of file assignment_submission_try.c.

GtkEntry* username_entry1

Definition at line 54 of file assignment_submission_try.c.

GtkWidget* view

Definition at line 30 of file assignment_submission_try.c.

GtkWidget* view1

Definition at line 31 of file assignment_submission_try.c.

GtkWidget* view2

Definition at line 32 of file assignment_submission_try.c.

GtkWidget* viewQuest

Definition at line 33 of file assignment_submission_try.c.

GtkWidget* viewQuest1

Definition at line 34 of file assignment_submission_try.c.

GtkWidget* viewStudent

Definition at line 35 of file assignment_submission_try.c.

GtkWidget* window1

Definition at line 43 of file assignment_submission_try.c.

GtkWidget* window2

Definition at line 44 of file assignment_submission_try.c.

GtkWidget* window3

Definition at line 45 of file assignment_submission_try.c.


Generated on Thu Apr 7 15:46:59 2011 for AssignmentSubmissionSystem by  doxygen 1.6.1