Created
October 2, 2008 15:05
-
-
Save mauritslamers/14369 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========================================================================== | |
// Education | |
// ========================================================================== | |
require('core'); | |
require('orion_fw'); | |
/** @class | |
(Document your class here) | |
@extends SC.Record | |
@author AuthorName | |
@version 0.1 | |
*/ | |
OrionFw.Course = SC.Record.extend( | |
/** @scope Education.prototype */ { | |
// TODO: Add your own code here. | |
//dataSource: SC.Server.create({ prefix: [""], urlFormat: "?%@&%@" }), | |
//dataStore: SC.Server.create({ prefix: [""], urlFormat: "?%@&%@" }), | |
dataStore: OrionFw.server, // maybe Contacts.server? | |
dataSource: OrionFw.server, | |
//modules: SC.Record.hasMany('OrionFw.Module'), | |
/* | |
define the URL for this Record type. | |
- updates will be POSTed to '/ajaxcom/contact/update' | |
- new records will be POSTed to '/ajaxcom/contact/create' | |
- and existing records will be fetched (GET) from | |
'/ajacom/contact/show/23' (if the record has guid=23 and | |
only one record is fetched) | |
*/ | |
resourceURL: [OrionFw.standardResource + 'education'], | |
// this list of properties will be used when talking to the server | |
// backend. If you don't define this only 'guid' will be used. | |
properties: ['id','name','code'], | |
educationName: function() { | |
return [this.get('name'), this.get('code')].compact().join('-'); | |
}.property('name', 'code'), | |
modEdu: SC.Record.hasMany('OrionFw.ModEdu','educationId') | |
//modules: function(){ | |
//var tmpId = this.get('guid'); | |
// var tmpCollection = this.get('modEdu'); | |
// return tmpCollection.get('records').get('moduleId'); | |
//} | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========================================================================== | |
// Module | |
// ========================================================================== | |
require('core'); | |
require('orion_fw'); | |
/** @class | |
(Document your class here) | |
@extends SC.Record | |
@author AuthorName | |
@version 0.1 | |
*/ | |
OrionFw.Subject = SC.Record.extend( | |
/** @scope Module.prototype */ { | |
// TODO: Add your own code here. | |
//dataSource: SC.Server.create({ prefix: [""], urlFormat: "?%@&%@" }), | |
//dataStore: SC.Server.create({ prefix: [""], urlFormat: "?%@&%@" }), | |
dataStore: OrionFw.server, // maybe Contacts.server? | |
dataSource: OrionFw.server, | |
/* | |
define the URL for this Record type. | |
- updates will be POSTed to '/ajaxcom/contact/update' | |
- new records will be POSTed to '/ajaxcom/contact/create' | |
- and existing records will be fetched (GET) from | |
'/ajacom/contact/show/23' (if the record has guid=23 and | |
only one record is fetched) | |
*/ | |
resourceURL: [OrionFw.standardResource + 'module'], | |
// this list of properties will be used when talking to the server | |
// backend. If you don't define this only 'guid' will be used. | |
properties: ['id','name','nameEn','collegeyear','consecutivelessonseries','serialnumber','OSIRISId'], | |
_moduleName: null, // cached name | |
moduleName: function() { | |
if(this._moduleName == null){ | |
var tmpname = [this.get('name'), this.get('serialnumber')].compact().join(' ') + " "; | |
tmpname =[tmpname, this.get('collegeyear')].compact().join('[') + "]"; | |
this._moduleName = tmpname; | |
return tmpname; | |
} else { | |
return this._moduleName; | |
} | |
}.property('name', 'serialnumber','collegeyear'), | |
_moduleNameAndOSIRISid: null, | |
moduleNameAndOSIRISid: function() { | |
// introducing the property of _moduleNameAndOSIRISid is intended to improve speed. | |
// TODO: find out whether it is actually necessary. | |
/* if(this._moduleNameAndOSIRISid == null){ | |
var tmpname = [this.get('name'), this.get('serialnumber')].compact().join(' ') + " "; | |
var tmpcollegeyear = this.get('collegeyear'); | |
var tmpOSIRISid = this.get('OSIRISId'); | |
if(tmpcollegeyear != ""){ | |
tmpname =[tmpname, this.get('collegeyear')].compact().join('[') + "] "; | |
} | |
if(tmpOSIRISid != ""){ | |
tmpname = [tmpname, this.get('OSIRISId')].compact().join('(') + ")"; | |
} | |
this._moduleNameAndOSIRISid = tmpname; | |
return tmpname; | |
} else { | |
return this._moduleNameAndOSIRISid; | |
} | |
*/ | |
// test for multiple items per row | |
// return an array | |
return [ this.get('name'), this.get('serialnumber') ]; | |
}.property('name', 'serialnumber','collegeyear','OSIRISId'), | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment