Permalink
Browse files

老师添加

  • Loading branch information...
1 parent 7245500 commit 16bfcba21b1c5c1228636f0e88ef22ed49bb38d8 @mouse-lin committed Mar 24, 2012
View
@@ -92,18 +92,12 @@ GEM
rd_searchlogic (3.0.1)
activerecord (>= 3.0.0)
rmagick (2.13.1)
-<<<<<<< HEAD
roo (1.3.11)
GData (>= 0.0.4)
hpricot (>= 0.6)
libxml-ruby (>= 1.1.3)
rubyzip (>= 0.9.1)
spreadsheet (>= 0.6.4)
- ruby-ole (1.2.11.1)
- rubyzip (0.9.4)
- spreadsheet (0.6.5.7)
- ruby-ole (>= 1.0)
-=======
ruby-debug-base19 (0.11.25)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
@@ -112,9 +106,12 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
+ ruby-ole (1.2.11.1)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
->>>>>>> 添加成绩修改
+ rubyzip (0.9.4)
+ spreadsheet (0.6.5.7)
+ ruby-ole (>= 1.0)
thor (0.14.6)
treetop (1.4.10)
polyglot
@@ -136,8 +133,5 @@ DEPENDENCIES
rake (= 0.8.7)
rd_searchlogic (= 3.0.1)
rmagick
-<<<<<<< HEAD
roo (= 1.3.11)
-=======
ruby-debug19
->>>>>>> 添加成绩修改
@@ -2,8 +2,8 @@ class StudentsController < ApplicationController
layout"application", :except => [ :print ]
#获取学生信息
def get_all_students
- students = Student.all.collect &fields_provider
- render_json students
+ people = Person.all.collect &fields_provider
+ render_json people
end
def update_student_comment
@@ -21,7 +21,7 @@ def student_total_score
#删除学生
def destroy_student
- Student.find(params[:id]).delete
+ Person.find(params[:id]).delete
render_json "success"
end
@@ -36,7 +36,11 @@ def update_student
:classes_id => params["classes_id"]
}
data["image"] = params["photo"] if(params["photo"])
- params["id"] == "save"? Student.create(data) : Student.find(params["id"]).update_attributes!(data)
+ if params["id"] == "save"
+ params[:type] == "Student"? Student.create(data) : Teacher.create(data)
+ else
+ Person.find(params["id"]).update_attributes!(data)
+ end
render_json "success", "text/html"
rescue => e
render_error e.message,'text/html'
@@ -7,9 +7,13 @@ Pf.settings.homeIndex = {
grid.store.load();
grid.on('cellclick', function(grid, rowIndex){
var record = grid.store.getAt(rowIndex);
- studentScoreGrid.store.load({ params: { s_id: record.data.id }});
+ if(record.data.type == "Student")
+ studentScoreGrid.store.load({ params: { s_id: record.data.id }});
+ else
+ studentScoreGrid.store.removeAll();
studentDetailFormPanel.getForm().loadRecord(record);
$("#image img").attr("src",record.data["image/url(:thumb)"] );
+ Ext.getCmp("identityType").disable();
});
var panel = new Ext.TabPanel({
@@ -75,7 +79,7 @@ Pf.settings.homeIndex = {
store: studentScoreStore,
loadMask: true,
cm: cm,
- height: 250,
+ height: 230,
region: "south",
tbar: [{
iconCls:"add", text:"成绩录入",handler: function(){ alert("niaho") }
@@ -102,7 +106,7 @@ Pf.settings.homeIndex = {
}
}
}],
- bbar : new Pf.util.Bbar({ store : studentScoreStore }),
+ //bbar : new Pf.util.Bbar({ store : studentScoreStore }),
});
return grid;
},
@@ -125,6 +129,25 @@ Pf.settings.homeIndex = {
})
});
+ var typeData = [['Student','学生'],['Teacher','教师']];
+ var typeCombo = new Ext.form.ComboBox({
+ hiddenName: 'type',
+ valueField: 'type',
+ fieldLabel: "身份",
+ id: "identityType",
+ triggerAction: 'all',
+ name: 'type',
+ displayField: 'name',
+ width: 180,
+ mode: 'local',
+ editable : false,
+ store: new Ext.data.SimpleStore({
+ fields: ['type', 'name'],
+ data: typeData,
+ })
+ });
+
+
var classCombox = new Ext.form.ComboBox({
hiddenName: "classes_id",
fieldLabel: "班级",
@@ -173,6 +196,7 @@ Pf.settings.homeIndex = {
{ text: "重置", handler: function(){
Ext.getCmp("studentDetailFormPanel").getForm().reset()
$("#image img").attr("src","/images/Temp.png" );
+ Ext.getCmp("identityType").enable();
}}
],
items: [{
@@ -197,7 +221,7 @@ Pf.settings.homeIndex = {
layout: "form",
items: [
{
- fieldLabel: "学号",
+ fieldLabel: "学号(编号)",
name: "number",
id: "studentNumber",
allowBlank: false,
@@ -223,6 +247,7 @@ Pf.settings.homeIndex = {
fieldLabel: "住址",
name: "home"
},
+ typeCombo,
{
xtype: 'fileuploadfield',
allowBlank : true,
@@ -32,6 +32,7 @@ Pf.classes.student = Ext.extend(Ext.grid.EditorGridPanel,{
"home",
"classes_id",
"classes/name",
+ "type",
"image/url(:thumb)",
],
root: 'root',
@@ -41,11 +42,15 @@ Pf.classes.student = Ext.extend(Ext.grid.EditorGridPanel,{
},
initCm: function(){
+ function changeType(value, metaData){
+ return value == "Student"? "学生" : "教师"
+ };
var cm = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{ header: '学号', sortable: true, dataIndex: 'number'},
{ header: '姓名', sortable: true, dataIndex: 'name'},
{ header: '班级', sortable: true, dataIndex: 'classes/name'},
+ { header: '身份', sortable: true, dataIndex: 'type', renderer: changeType},
{ header: '性别', sortable: true, dataIndex: 'sex'},
{ header: '联系电话', sortable: true, dataIndex: 'phone'},
{ header: '住址', sortable: true, dataIndex: 'home'},
@@ -56,11 +61,11 @@ Pf.classes.student = Ext.extend(Ext.grid.EditorGridPanel,{
initStudentTbar: function(){
var _this = this;
var tbar = [
- {
- iconCls: "add",
- text: "添加",
- handler: function(){ _this.addSingleStudent().show() }
- },
+ // {
+ // iconCls: "add",
+ // text: "添加",
+ // handler: function(){ _this.addSingleStudent().show() }
+ // },
new Pf.util.ImportXlsBtn({ actionName : 'student', store : _this.store }),
{
iconCls: "delete",

0 comments on commit 16bfcba

Please sign in to comment.