Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
cards
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Sergej Lopatin
cards
Commits
adb16283
Commit
adb16283
authored
Aug 27, 2017
by
Curtis Adam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add server setting to disable university management
parent
1fa01639
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
847 additions
and
471 deletions
+847
-471
de.i18n.json
i18n/de.i18n.json
+3
-2
en.i18n.json
i18n/en.i18n.json
+3
-2
cards.js
imports/api/cards.js
+136
-59
cardsets.js
imports/api/cardsets.js
+45
-14
colleges_courses.js
imports/api/colleges_courses.js
+14
-1
learned.js
imports/api/learned.js
+20
-7
registerhelper.js
imports/startup/client/registerhelper.js
+5
-0
admin.html
imports/ui/admin/admin.html
+154
-143
admin_cardset.html
imports/ui/admin/admin_cardsets/admin_cardset.html
+29
-27
admin_cardset.js
imports/ui/admin/admin_cardsets/admin_cardset.js
+123
-56
admin_university.html
imports/ui/admin/admin_university/admin_university.html
+13
-7
admin_university.js
imports/ui/admin/admin_university/admin_university.js
+16
-5
cardset.html
imports/ui/cardset/cardset.html
+31
-26
cardset.js
imports/ui/cardset/cardset.js
+56
-25
cardsets.html
imports/ui/cardsets/cardsets.html
+62
-37
cardsets.js
imports/ui/cardsets/cardsets.js
+56
-24
pool.html
imports/ui/pool/pool.html
+41
-32
leitner.js
server/leitner.js
+8
-1
wordcloud.js
server/wordcloud.js
+22
-1
settings.json
settings.json
+4
-0
settings_test.json
settings_test.json
+4
-0
create-cardset_steps.js
tests/features/create-cardset/create-cardset_steps.js
+2
-2
No files found.
i18n/de.i18n.json
View file @
adb16283
...
...
@@ -637,8 +637,9 @@
"interval"
:
"Lernintervalle einstellen"
,
"notifications"
:
"Benachrichtigungen"
,
"settings"
:
"Einstellungen"
,
"manageS"
:
"Hochschule verwalten"
,
"manage"
:
"Hochschule und Studiengang verwalten"
,
"manageUniversityLong"
:
"Hochschule und Studiengang verwalten"
,
"manageUniversity"
:
"Hochschule verwalten"
,
"manageCourse"
:
"Studiengang verwalten"
,
"see_all"
:
"Alle ansehen"
,
"name"
:
"Name"
,
"kind"
:
"Art"
,
...
...
i18n/en.i18n.json
View file @
adb16283
...
...
@@ -637,13 +637,14 @@
"interval"
:
"Learning period"
,
"notifications"
:
"Notifications"
,
"settings"
:
"Settings"
,
"manage"
:
"Manage college and course"
,
"see_all"
:
"See all"
,
"name"
:
"Name"
,
"kind"
:
"Kind"
,
"front"
:
"Front"
,
"back"
:
"Back"
,
"manageS"
:
"College manager"
,
"manageUniversityLong"
:
"Manage college and course"
,
"manageUniversity"
:
"College manager"
,
"manageCourse"
:
"Course manager"
,
"admin"
:
"Admin"
,
"pro"
:
"Pro"
,
"university"
:
"Edu"
,
...
...
imports/api/cards.js
View file @
adb16283
...
...
@@ -17,70 +17,147 @@ if (Meteor.isServer) {
'
editor
'
,
'
lecturer
'
]))
{
return
Cards
.
find
();
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
Cards
.
find
({
college
:
Meteor
.
settings
.
public
.
university
.
default
});
}
else
{
return
Cards
.
find
();
}
}
else
if
(
Roles
.
userIsInRole
(
this
.
userId
,
'
pro
'
))
{
return
Cards
.
find
({
cardset_id
:
{
$in
:
Cardsets
.
find
({
$or
:
[
{
owner
:
this
.
userId
},
{
visible
:
true
}
]
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
});
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
Cards
.
find
({
cardset_id
:
{
$in
:
Cardsets
.
find
({
$or
:
[
{
owner
:
this
.
userId
},
{
visible
:
true
},
{
college
:
Meteor
.
settings
.
public
.
university
.
default
}
]
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
});
}
else
{
return
Cards
.
find
({
cardset_id
:
{
$in
:
Cardsets
.
find
({
$or
:
[
{
owner
:
this
.
userId
},
{
visible
:
true
}
]
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
});
}
}
else
if
(
Roles
.
userIsInRole
(
this
.
userId
,
'
university
'
))
{
return
Cards
.
find
({
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
,
kind
:
{
$in
:
[
'
free
'
,
'
edu
'
]}
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
});
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
Cards
.
find
({
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
,
college
:
Meteor
.
settings
.
public
.
university
.
default
,
kind
:
{
$in
:
[
'
free
'
,
'
edu
'
]}
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
});
}
else
{
return
Cards
.
find
({
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
,
kind
:
{
$in
:
[
'
free
'
,
'
edu
'
]}
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
});
}
}
else
{
return
Cards
.
find
({
$or
:
[
//is owner
{
cardset_id
:
{
$in
:
Cardsets
.
find
({
owner
:
this
.
userId
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
},
//is visible and is free
{
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
,
kind
:
'
free
'
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
Cards
.
find
({
$or
:
[
//is owner
{
cardset_id
:
{
$in
:
Cardsets
.
find
({
owner
:
this
.
userId
,
college
:
Meteor
.
settings
.
public
.
university
.
default
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
},
//is visible and is free
{
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
,
kind
:
'
free
'
,
college
:
Meteor
.
settings
.
public
.
university
.
default
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
},
//is visible and has bought
{
cardset_id
:
{
$in
:
Paid
.
find
({
user_id
:
this
.
userId
,
college
:
Meteor
.
settings
.
public
.
university
.
default
,
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
}).
map
(
function
(
paid
)
{
return
paid
.
cardset_id
;
})
}
}
},
//is visible and has bought
{
cardset_id
:
{
$in
:
Paid
.
find
({
user_id
:
this
.
userId
,
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
}).
map
(
function
(
paid
)
{
return
paid
.
cardset_id
;
})
]
});
}
else
{
return
Cards
.
find
({
$or
:
[
//is owner
{
cardset_id
:
{
$in
:
Cardsets
.
find
({
owner
:
this
.
userId
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
},
//is visible and is free
{
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
,
kind
:
'
free
'
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
},
//is visible and has bought
{
cardset_id
:
{
$in
:
Paid
.
find
({
user_id
:
this
.
userId
,
cardset_id
:
{
$in
:
Cardsets
.
find
({
visible
:
true
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
})
}
}).
map
(
function
(
paid
)
{
return
paid
.
cardset_id
;
})
}
}
}
]
}
);
]
});
}
}
}
});
...
...
imports/api/cardsets.js
View file @
adb16283
...
...
@@ -16,22 +16,47 @@ if (Meteor.isServer) {
'
admin
'
,
'
editor
'
]))
{
return
Cardsets
.
find
();
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
Cardsets
.
find
({
"
college
"
:
Meteor
.
settings
.
public
.
university
.
default
});
}
else
{
return
Cardsets
.
find
();
}
}
else
if
(
Roles
.
userIsInRole
(
this
.
userId
,
'
lecturer
'
))
{
return
Cardsets
.
find
({
$or
:
[
{
visible
:
true
},
{
request
:
true
},
{
owner
:
this
.
userId
}
]
});
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
Cardsets
.
find
({
"
college
"
:
Meteor
.
settings
.
public
.
university
.
default
,
$or
:
[
{
visible
:
true
},
{
request
:
true
},
{
owner
:
this
.
userId
}
]
});
}
else
{
return
Cardsets
.
find
({
$or
:
[
{
visible
:
true
},
{
request
:
true
},
{
owner
:
this
.
userId
}
]
});
}
}
else
if
(
this
.
userId
&&
!
Roles
.
userIsInRole
(
this
.
userId
,
[
"
firstLogin
"
,
"
blocked
"
]))
{
return
Cardsets
.
find
({
$or
:
[
{
visible
:
true
},
{
owner
:
this
.
userId
}
]
});
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
Cardsets
.
find
({
"
college
"
:
Meteor
.
settings
.
public
.
university
.
default
,
$or
:
[
{
visible
:
true
},
{
owner
:
this
.
userId
}
]
});
}
else
{
return
Cardsets
.
find
({
$or
:
[
{
visible
:
true
},
{
owner
:
this
.
userId
}
]
});
}
}
});
Meteor
.
publish
(
"
tags
"
,
function
()
{
...
...
@@ -182,6 +207,9 @@ Meteor.methods({
* @param {String} course - Assigned university course
*/
addCardset
:
function
(
name
,
description
,
visible
,
ratings
,
kind
,
module
,
moduleShort
,
moduleNum
,
skillLevel
,
college
,
course
)
{
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
college
=
Meteor
.
settings
.
public
.
university
.
default
;
}
check
(
name
,
String
);
check
(
description
,
String
);
check
(
visible
,
Boolean
);
...
...
@@ -389,6 +417,9 @@ Meteor.methods({
* @param {String} course - Assigned university course
*/
updateCardset
:
function
(
id
,
name
,
description
,
module
,
moduleShort
,
moduleNum
,
skillLevel
,
college
,
course
)
{
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
college
=
Meteor
.
settings
.
public
.
university
.
default
;
}
check
(
id
,
String
);
check
(
name
,
String
);
check
(
description
,
String
);
...
...
imports/api/colleges_courses.js
View file @
adb16283
...
...
@@ -7,13 +7,20 @@ export const CollegesCourses = new Mongo.Collection("collegesCourses");
if
(
Meteor
.
isServer
)
{
Meteor
.
publish
(
"
collegesCourses
"
,
function
()
{
if
(
this
.
userId
&&
!
Roles
.
userIsInRole
(
this
.
userId
,
[
"
firstLogin
"
,
"
blocked
"
]))
{
return
CollegesCourses
.
find
();
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
CollegesCourses
.
find
({
"
college
"
:
Meteor
.
settings
.
public
.
university
.
default
});
}
else
{
return
CollegesCourses
.
find
();
}
}
});
}
Meteor
.
methods
({
"
updateCollegesCoursess
"
:
function
(
college
,
course
)
{
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
college
=
Meteor
.
settings
.
public
.
university
.
default
;
}
check
(
college
,
String
);
check
(
course
,
String
);
...
...
@@ -27,6 +34,9 @@ Meteor.methods({
});
},
"
deleteCollegesCourses
"
:
function
(
college
,
course
)
{
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
college
=
Meteor
.
settings
.
public
.
university
.
default
;
}
check
(
college
,
String
);
check
(
course
,
String
);
...
...
@@ -40,6 +50,9 @@ Meteor.methods({
});
},
"
editCollegesCourses
"
:
function
(
college
,
course
,
newCollege
,
newCourse
)
{
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
college
=
Meteor
.
settings
.
public
.
university
.
default
;
}
check
(
college
,
String
);
check
(
course
,
String
);
check
(
newCollege
,
String
);
...
...
imports/api/learned.js
View file @
adb16283
...
...
@@ -8,11 +8,21 @@ export const Learned = new Mongo.Collection("learned");
if
(
Meteor
.
isServer
)
{
Meteor
.
publish
(
"
learned
"
,
function
()
{
if
(
this
.
userId
&&
!
Roles
.
userIsInRole
(
this
.
userId
,
[
"
firstLogin
"
,
"
blocked
"
]))
{
var
cardsetsIds
=
Cardsets
.
find
({
owner
:
this
.
userId
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
});
var
cardsetsIds
;
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
cardsetsIds
=
Cardsets
.
find
({
owner
:
this
.
userId
,
college
:
Meteor
.
settings
.
public
.
university
.
default
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
});
}
else
{
cardsetsIds
=
Cardsets
.
find
({
owner
:
this
.
userId
}).
map
(
function
(
cardset
)
{
return
cardset
.
_id
;
});
}
var
learned
=
Learned
.
find
({
$or
:
[
...
...
@@ -25,8 +35,11 @@ if (Meteor.isServer) {
});
Meteor
.
publish
(
"
allLearned
"
,
function
()
{
if
(
this
.
userId
&&
!
Roles
.
userIsInRole
(
this
.
userId
,
[
"
firstLogin
"
,
"
blocked
"
]))
{
var
learned
=
Learned
.
find
({});
return
learned
;
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
return
Learned
.
find
({
college
:
Meteor
.
settings
.
public
.
university
.
default
});
}
else
{
return
Learned
.
find
({});
}
}
}
);
...
...
imports/startup/client/registerhelper.js
View file @
adb16283
...
...
@@ -40,6 +40,11 @@ Template.registerHelper("isLecturerOrPro", function () {
}
});
// Check if multiple universities are enabled
Template
.
registerHelper
(
"
singleUniversity
"
,
function
()
{
return
Meteor
.
settings
.
public
.
university
.
singleUniversity
;
});
// Returns the number of cards in a carddeck
Template
.
registerHelper
(
"
countCards
"
,
function
(
cardset_id
)
{
return
Cardsets
.
findOne
({
_id
:
cardset_id
}).
quantity
;
...
...
imports/ui/admin/admin.html
View file @
adb16283
This diff is collapsed.
Click to expand it.
imports/ui/admin/admin_cardsets/admin_cardset.html
View file @
adb16283
...
...
@@ -140,34 +140,36 @@
</div>
</div>
</div>
<!-- / skills Dropdown -->
<!-- start college Dropdown -->
<div
class=
"form-group setdetails categories row"
>
<label
id=
"editCardsetCollegeLabelAdmin"
class=
"col-md-3 control-label"
for=
"editCardsetCollegeAdmin"
>
{{_
"modal-dialog.college"}}
</label>
<div
class=
"dropup"
>
<div
class=
"btn-group col-xs-12 col-sm-12 col-md-9"
role=
"group"
>
<button
type=
"button"
id=
"editCardsetCollegeAdmin"
class=
"btn btn-raised editCardsetCollegeDropdownAdmin longButton"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
value=
"{{this.college}}"
>
{{this.college}}
</button>
<button
class=
"btn btn-raised dropdown-toggle editCardsetCollegeDropdownAdmin"
type=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"true"
>
<span
class=
"caret"
></span>
<span
class=
"sr-only"
></span>
</button>
<ul
class=
"dropdown-menu longButton"
>
{{#each getColleges}}
<li
class=
"collegeAdmin"
value=
"{{this.college}}"
data=
"{{this.college}}"
><a
href=
"#"
>
{{this.college}}
</a></li>
{{/each}}
</ul>
<span
id=
"helpEditCardsetCollegeAdmin"
class=
"help-block collegeAdmin"
></span>
{{#unless singleUniversity}}
<!-- start college Dropdown -->
<div
class=
"form-group setdetails categories row"
>
<label
id=
"editCardsetCollegeLabelAdmin"
class=
"col-md-3 control-label"
for=
"editCardsetCollegeAdmin"
>
{{_
"modal-dialog.college"}}
</label>
<div
class=
"dropup"
>
<div
class=
"btn-group col-xs-12 col-sm-12 col-md-9"
role=
"group"
>
<button
type=
"button"
id=
"editCardsetCollegeAdmin"
class=
"btn btn-raised editCardsetCollegeDropdownAdmin longButton"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
value=
"{{this.college}}"
>
{{this.college}}
</button>
<button
class=
"btn btn-raised dropdown-toggle editCardsetCollegeDropdownAdmin"
type=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"true"
>
<span
class=
"caret"
></span>
<span
class=
"sr-only"
></span>
</button>
<ul
class=
"dropdown-menu longButton"
>
{{#each getColleges}}
<li
class=
"collegeAdmin"
value=
"{{this.college}}"
data=
"{{this.college}}"
><a
href=
"#"
>
{{this.college}}
</a></li>
{{/each}}
</ul>
<span
id=
"helpEditCardsetCollegeAdmin"
class=
"help-block collegeAdmin"
></span>
</div>
</div>
</div>
</div>
<!-- / college Dropdown -->
</div>
<!-- / college Dropdown -->
{{/unless}}
<!-- start course Dropdown -->
<div
class=
"form-group setdetails categories row"
>
<label
id=
"editCardsetCourseLabelAdmin"
class=
"col-md-3 control-label"
...
...
imports/ui/admin/admin_cardsets/admin_cardset.js
View file @
adb16283
...
...
@@ -135,11 +135,13 @@ Template.admin_cardset.events({
$
(
'
#helpEditCardsetModuleNumAdmin
'
).
html
(
TAPi18n
.
__
(
'
modal-dialog.moduleNum_required
'
));
$
(
'
#helpEditCardsetModuleNumAdmin
'
).
css
(
'
color
'
,
'
#b94a48
'
);
}
if
(
$
(
'
#editCardsetCollegeAdmin
'
).
val
()
===
""
)
{
$
(
'
#editCardsetCollegeLabelAdmin
'
).
css
(
'
color
'
,
'
#b94a48
'
);
$
(
'
.editCardsetCollegeDropdownAdmin
'
).
css
(
'
border-color
'
,
'
#b94a48
'
);
$
(
'
#helpEditCardsetCollegeAdmin
'
).
html
(
TAPi18n
.
__
(
'
modal-dialog.college_required
'
));
$
(
'
#helpEditCardsetCollegeAdmin
'
).
css
(
'
color
'
,
'
#b94a48
'
);
if
(
!
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
if
(
$
(
'
#editCardsetCollegeAdmin
'
).
val
()
===
""
)
{
$
(
'
#editCardsetCollegeLabelAdmin
'
).
css
(
'
color
'
,
'
#b94a48
'
);
$
(
'
.editCardsetCollegeDropdownAdmin
'
).
css
(
'
border-color
'
,
'
#b94a48
'
);
$
(
'
#helpEditCardsetCollegeAdmin
'
).
html
(
TAPi18n
.
__
(
'
modal-dialog.college_required
'
));
$
(
'
#helpEditCardsetCollegeAdmin
'
).
css
(
'
color
'
,
'
#b94a48
'
);
}
}
if
(
$
(
'
#editCardsetCourseAdmin
'
).
val
()
===
""
)
{
$
(
'
#editCardsetCourseLabelAdmin
'
).
css
(
'
color
'
,
'
#b94a48
'
);
...
...
@@ -158,63 +160,128 @@ Template.admin_cardset.events({
$
(
'
#helpCC-modules-admin
'
).
html
(
TAPi18n
.
__
(
'
admin.cardset.wrongCombination
'
));
$
(
'
#helpCC-modules-admin
'
).
css
(
'
color
'
,
'
#b94a48
'
);
}
if
(
$
(
'
#editCardsetNameAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetDescriptionAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleShortAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleNumAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetSkillLevel
'
).
val
()
!==
""
&&
$
(
'
#editCardsetCollegeAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetCourseAdmin
'
).
val
()
!==
""
&&
(
$
(
"
#kindoption0Admin
"
).
hasClass
(
'
active
'
)
||
(
$
(
"
#kindoption1Admin
"
).
hasClass
(
'
active
'
)
||
$
(
"
#kindoption2Admin
"
).
hasClass
(
'
active
'
)
||
$
(
"
#kindoption3Admin
"
).
hasClass
(
'
active
'
))
&&
this
.
quantity
>=
5
))
{
var
name
=
tmpl
.
find
(
'
#editCardsetNameAdmin
'
).
value
;
var
description
=
tmpl
.
find
(
'
#editCardsetDescriptionAdmin
'
).
value
;
var
module
=
tmpl
.
find
(
'
#editCardsetModuleAdmin
'
).
value
;
var
moduleShort
=
tmpl
.
find
(
'
#editCardsetModuleShortAdmin
'
).
value
;
var
moduleNum
=
tmpl
.
find
(
'
#editCardsetModuleNumAdmin
'
).
value
;
var
skillLevel
=
$
(
'
#editCardsetSkillLevel
'
).
val
();
var
college
=
$
(
'
#editCardsetCollegeAdmin
'
).
text
();
var
course
=
$
(
'
#editCardsetCourseAdmin
'
).
text
();
var
kind
=
tmpl
.
find
(
'
#publishKindAdmin > .active > input
'
).
value
;
var
price
=
0
;
var
visible
=
true
;
var
license
=
[];
if
((
"
#cc-modules-admin
"
).
length
)
{
if
(
$
(
"
#cc-option0-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
by
"
);
}
if
(
$
(
"
#cc-option1-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
nc
"
);
let
name
;
let
description
;
let
module
;
let
moduleShort
;
let
moduleNum
;
let
skillLevel
;
let
college
;
let
course
;
let
kind
;
let
price
;
let
visible
;
let
license
;
if
(
Meteor
.
settings
.
public
.
university
.
singleUniversity
)
{
if
(
$
(
'
#editCardsetNameAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetDescriptionAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleShortAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleNumAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetSkillLevel
'
).
val
()
!==
""
&&
$
(
'
#editCardsetCollegeAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetCourseAdmin
'
).
val
()
!==
""
&&
(
$
(
"
#kindoption0Admin
"
).
hasClass
(
'
active
'
)
||
(
$
(
"
#kindoption1Admin
"
).
hasClass
(
'
active
'
)
||
$
(
"
#kindoption2Admin
"
).
hasClass
(
'
active
'
)
||
$
(
"
#kindoption3Admin
"
).
hasClass
(
'
active
'
))
&&
this
.
quantity
>=
5
))
{
name
=
tmpl
.
find
(
'
#editCardsetNameAdmin
'
).
value
;
description
=
tmpl
.
find
(
'
#editCardsetDescriptionAdmin
'
).
value
;
module
=
tmpl
.
find
(
'
#editCardsetModuleAdmin
'
).
value
;
moduleShort
=
tmpl
.
find
(
'
#editCardsetModuleShortAdmin
'
).
value
;
moduleNum
=
tmpl
.
find
(
'
#editCardsetModuleNumAdmin
'
).
value
;
skillLevel
=
$
(
'
#editCardsetSkillLevel
'
).
val
();
college
=
Meteor
.
settings
.
public
.
university
.
default
;
course
=
$
(
'
#editCardsetCourseAdmin
'
).
text
();
kind
=
tmpl
.
find
(
'
#publishKindAdmin > .active > input
'
).
value
;
price
=
0
;
visible
=
true
;
license
=
[];
if
((
"
#cc-modules-admin
"
).
length
)
{
if
(
$
(
"
#cc-option0-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
by
"
);
}
if
(
$
(
"
#cc-option1-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
nc
"
);
}
if
(
$
(
"
#cc-option2-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
nd
"
);
}
if
(
$
(
"
#cc-option3-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
sa
"
);
}
}
if
(
$
(
"
#cc-option2-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
nd
"
);
Meteor
.
call
(
'
updateLicense
'
,
this
.
_id
,
license
);
if
(
kind
===
'
edu
'
||
kind
===
'
pro
'
)
{
if
(
tmpl
.
find
(
'
#publishPriceAdmin
'
)
!==
null
)
{
price
=
tmpl
.
find
(
'
#publishPriceAdmin
'
).
value
;
}
else
{
price
=
this
.
price
;
}
}
if
(
$
(
"
#cc-option3-admin
"
).
hasClass
(
'
active
'
)
)
{
license
.
push
(
"
sa
"
)
;
if
(
kind
===
'
personal
'
)
{
visible
=
false
;
}
Meteor
.
call
(
"
publishCardset
"
,
this
.
_id
,
kind
,
price
,
visible
);
Meteor
.
call
(
"
updateCardset
"
,
this
.
_id
,
name
,
description
,
module
,
moduleShort
,
moduleNum
,
Number
(
skillLevel
),
college
,
course
);
window
.
history
.
go
(
-
1
);
}
Meteor
.
call
(
'
updateLicense
'
,
this
.
_id
,
license
);
if
(
kind
===
'
edu
'
||
kind
===
'
pro
'
)
{
if
(
tmpl
.
find
(
'
#publishPriceAdmin
'
)
!==
null
)
{
price
=
tmpl
.
find
(
'
#publishPriceAdmin
'
).
value
;
}
else
{
price
=
this
.
price
;
}
else
{
if
(
$
(
'
#editCardsetNameAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetDescriptionAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleShortAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetModuleNumAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetSkillLevel
'
).
val
()
!==
""
&&
$
(
'
#editCardsetCollegeAdmin
'
).
val
()
!==
""
&&
$
(
'
#editCardsetCourseAdmin
'
).
val
()
!==
""
&&
(
$
(
"
#kindoption0Admin
"
).
hasClass
(
'
active
'
)
||
(
$
(
"
#kindoption1Admin
"
).
hasClass
(
'
active
'
)
||
$
(
"
#kindoption2Admin
"
).
hasClass
(
'
active
'
)
||
$
(
"
#kindoption3Admin
"
).
hasClass
(
'
active
'
))
&&
this
.
quantity
>=
5
))
{
name
=
tmpl
.
find
(
'
#editCardsetNameAdmin
'
).
value
;
description
=
tmpl
.
find
(
'
#editCardsetDescriptionAdmin
'
).
value
;
module
=
tmpl
.
find
(
'
#editCardsetModuleAdmin
'
).
value
;
moduleShort
=
tmpl
.
find
(
'
#editCardsetModuleShortAdmin
'
).
value
;
moduleNum
=
tmpl
.
find
(
'
#editCardsetModuleNumAdmin
'
).
value
;
skillLevel
=
$
(
'
#editCardsetSkillLevel
'
).
val
();
college
=
$
(
'
#editCardsetCollegeAdmin
'
).
text
();
course
=
$
(
'
#editCardsetCourseAdmin
'
).
text
();
kind
=
tmpl
.
find
(
'
#publishKindAdmin > .active > input
'
).
value
;
price
=
0
;
visible
=
true
;
license
=
[];
if
((
"
#cc-modules-admin
"
).
length
)
{
if
(
$
(
"
#cc-option0-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
by
"
);
}
if
(
$
(
"
#cc-option1-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
nc
"
);
}
if
(
$
(
"
#cc-option2-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
nd
"
);
}
if
(
$
(
"
#cc-option3-admin
"
).
hasClass
(
'
active
'
))
{
license
.
push
(
"
sa
"
);
}
}
Meteor
.
call
(
'
updateLicense
'
,
this
.
_id
,
license
);
if
(
kind
===
'
edu
'
||
kind
===
'
pro
'
)
{
if
(
tmpl
.
find
(
'
#publishPriceAdmin
'
)
!==
null
)
{
price
=
tmpl
.
find
(
'
#publishPriceAdmin
'
).
value
;
}
else
{
price
=
this
.
price
;
}
}
if
(
kind
===
'
personal
'
)
{
visible
=
false
;
}
Meteor
.
call
(
"
publishCardset
"
,
this
.
_id
,
kind
,
price
,
visible
);
Meteor
.
call
(
"
updateCardset
"
,
this
.
_id
,
name
,
description
,
module
,
moduleShort
,
moduleNum
,
Number
(
skillLevel
),
college
,
course
);
window
.
history
.
go
(
-
1
);
}
if
(
kind
===
'
personal
'
)
{
visible
=
false
;
}
Meteor
.
call
(
"
publishCardset
"
,
this
.
_id
,
kind
,
price
,
visible
);
Meteor
.
call
(
"
updateCardset
"
,
this
.
_id
,
name
,
description
,
module
,
moduleShort
,
moduleNum
,
Number
(
skillLevel
),
college
,
course
);
window
.
history
.
go
(
-
1
);
}
},
'
click #cardsetCancelAdmin
'
:
function
()
{
...
...
imports/ui/admin/admin_university/admin_university.html
View file @
adb16283
<template
name=
"admin_university"
>
<div
class=
"content-header"
>
<h1>
{{
_ "admin.manage"
}}
</h1>
<h1>
{{
#unless singleUniversity}}{{_ "admin.manageUniversityLong"}}{{else}}{{_ "admin.manageCourse"}}{{/unless
}}
</h1>
</div>
<div
class=
"well well-sm"
>
<table
class=
"table table-bordered table-hover table-striped"
id=
"collegeTable"
>
<thead
class=
"set-list"
>
<tr>
<th><span>
{{_ "admin.confirm-form.settings.college"}}
</span>
<!--<a class="collegedown" role="button">⇓</a>