The website assignment correction function has been rewritten. record it.

Source: Internet
Author: User

Since it is a rewrite, it is much better than the previous one.

Originally, the assignment was not assigned to anyone. If there were two courses on operating system and embedded system principle, an operating system was selected, however, he can also submit jobs based on embedded principles. Of course, there is no loss to the students, but it hurts when the teacher approves the assignment. You have to remove the assignments of students who have not chosen this course.

In addition, I also handled the assignment page. Although there was only one pop-up box, I spent the whole afternoon, including not very familiar with JS and CSS, it's about asynchronous loading of kindeditor (I checked the official example later)

Assignment interface: this function is used by only one teacher, so I am too lazy to write JavaScript to check the validity of the date.

This interface is actually a pop-up box for div simulation. I personally prefer this effect, and a translucent mask is added to the back, which looks better.

From the drop-down menu, the instructor can select the course for this assignment. If you want to add a new subject for the first semester, you can select "other ":

As mentioned above, this is just half a day. It is not an exaggeration, because you did not know the pop-up window prompt ("enter the name of the course to be added ","");

Various messy keywords in Baidu:

JS pop-up box

In the JS pop-up box, enter

......

Later, I had to go to w3cshcool and check Js.

Open the box to confirm the assignment, and use Ajax (of course, jquery is used, and JS is not used)

I don't know if my level is jquery?

Ajax has used only $. Post (), $. Get (), load ()

Normally, only the simplest toggle (), show (), hide () fade ()...

Animate () has never been used, PS: It may be wrong ~

Previously, only $ ("# ID") is used "). val () or $ (". class "). val () value. Today, a $ ("input [name = title]") is generated. val ()

CSS:

1) I never knew how to make the pop-up Div absolutely positioned and centered. I checked it online and saw a lot of code. I really didn't want to copy it directly. I suddenly thought of using jquery. The Code is as follows:

W = Document. Body. scrollwidth;

Box.css ("Left", (W-700)/2); // 700 is the width of the pop-up box. It is best to use jquery to obtain it.

2) I have never known how to keep the pop-up Div unchanged (that is, even if I pull the scroll bar, the DIV remains unchanged from the screen)

It turns out to be like this:

Div {

Position: fixed;

}

Previously, only position can have relative and absolute.

Attaches a kindeditor code for loading the editor asynchronously.

$.getScript('/os/editor/kindeditor.js', function() {KindEditor.basePath = '/os/editor/';editor = KindEditor.create("#editor", {height:300, width:700});});

Hibernate:

Object Persistence and transient

Public Boolean save (homework) {Boolean flag = true; try {session = hibernatesessionfactory. getsession (); transaction Tx = session. begintransaction (); Session. save (homework); homework. seturl ("showhomework. action? Id = "+ homework. gethid (); // set urltx based on the primary key. commit (); Session. close ();} catch (exception e) {e. printstacktrace (); flag = false;} return flag ;}

Because the URL contains the primary key hid, while the hid is auto-incrementing, you only need to save the object and then update the object.

Because homework is persistent after session. Save (homework), it is time to update homework to the database.

How did we do this before:

Homeworkserviceimpl. Java:

Ave (homework );

Homework = get (homework );

Homework. seturl ()

Update (homework)

Now it's ridiculous.

No more.

End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.