Minor fixing select see #1791

skala
Julio Montoya 13 years ago
parent 6b24ba7a45
commit 0a24a50f26
  1. 88
      main/template/default/skill/skill_wheel.js.tpl
  2. 1
      main/template/default/skill/skill_wheel.tpl
  3. 2
      main/template/default/skill/skill_wheel_student.tpl

@ -1,3 +1,5 @@
{# topbar #}
{% include "default/layout/topbar.tpl" %}
<script> <script>
/* Skill wheel settings */ /* Skill wheel settings */
@ -17,9 +19,13 @@ var my_domain = [1,2,3,4,5,6,7,8,9];
var col = 9; var col = 9;
var color_patterns = []; var color_patterns = [];
/*
See colorbrewer documentation
color_patterns[1] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Blues[col]); color_patterns[1] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Blues[col]);
color_patterns[2] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Purples[col]); color_patterns[2] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Purples[col]);
//color_patterns[2] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Blues[6]); color_patterns[2] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Blues[6]);
color_patterns[3] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Greens[col]); color_patterns[3] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Greens[col]);
color_patterns[4] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Reds[col]); color_patterns[4] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Reds[col]);
color_patterns[5] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Oranges[col]); color_patterns[5] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Oranges[col]);
@ -35,7 +41,7 @@ color_patterns[13] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.BuPu
color_patterns[14] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.RdPu[col]); color_patterns[14] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.RdPu[col]);
color_patterns[15] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.PuRd[col]); color_patterns[15] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.PuRd[col]);
color_patterns[16] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.OrRd[col]); color_patterns[16] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.OrRd[col]);
color_patterns[17] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.YlOrRd[col]); color_patterns[17] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.YlOrRd[col]);*/
//Too make the gray tones lighter //Too make the gray tones lighter
col = 3; col = 3;
@ -62,18 +68,19 @@ for (i= 0; i < color_loops; i++) {
colors = $.merge(colors, temp_color_array); colors = $.merge(colors, temp_color_array);
} }
function is_multiline(word) { /* The partiton name will have 1 or 2 lines? */
function is_multiline(word) {
if (word) { if (word) {
if (word.length > max_size_text_length) { if (word.length > max_size_text_length) {
return (word).split(" ").length > 1; return (word).split(" ").length > 1;
} }
} }
return false; return false;
} }
/* Interpolate the scales! */ /* Interpolate the scales! */
function arcTween(d, arc, x, y, r) { function arcTween(d, arc, x, y, r) {
var my = maxY(d), var my = maxY(d),
xd = d3.interpolate(x.domain(), [d.x, d.x + d.dx]), xd = d3.interpolate(x.domain(), [d.x, d.x + d.dx]),
yd = d3.interpolate(y.domain(), [d.y, my]), yd = d3.interpolate(y.domain(), [d.y, my]),
@ -85,23 +92,23 @@ for (i= 0; i < color_loops; i++) {
return arc(d); return arc(d);
}; };
}; };
} }
/* Calculate maxY */ /* Calculate maxY */
function maxY(d) { function maxY(d) {
return d.children ? Math.max.apply(Math, d.children.map(maxY)) : d.y + d.dy; return d.children ? Math.max.apply(Math, d.children.map(maxY)) : d.y + d.dy;
} }
/* Use a formula for contrasting colour /* Use a formula for contrasting colour
http://www.w3.org/WAI/ER/WD-AERT/#color-contrast http://www.w3.org/WAI/ER/WD-AERT/#color-contrast
*/ */
function brightness(rgb) { function brightness(rgb) {
return rgb.r * .299 + rgb.g * .587 + rgb.b * .114; return rgb.r * .299 + rgb.g * .587 + rgb.b * .114;
} }
/* Returns whether p is parent of c */ /* Returns whether p is parent of c */
function isParentOf(p, c) { function isParentOf(p, c) {
if (p === c) return true; if (p === c) return true;
if (p.children) { if (p.children) {
return p.children.some(function(d) { return p.children.some(function(d) {
@ -109,9 +116,9 @@ for (i= 0; i < color_loops; i++) {
}); });
} }
return false; return false;
} }
function get_color(d) { function get_color(d) {
depth = d.depth; depth = d.depth;
if (d.family_id) { if (d.family_id) {
/*var p = color_patterns[d.family_id]; /*var p = color_patterns[d.family_id];
@ -132,20 +139,20 @@ for (i= 0; i < color_loops; i++) {
} }
color = '#fefefe'; color = '#fefefe';
return color; //missing colors return color; //missing colors
} }
/*
gray tones for all skills that have no particular property ("Basic skills wheel" view)
yellow tones for skills that are provided by courses in Chamilo ("Teachable skills" view)
bright blue tones for personal skills already acquired by the student currently looking at the weel ("My skills" view)
dark blue tones for skills already acquired by a series of students, when looking at the will in the "Owned skills" view.
bright green for skills looked for by a HR director ("Profile search" view)
dark green for skills most searched for, summed up from the different saved searches from HR directors ("Most wanted skills")
bright red for missing skills, in the "Required skills" view for a student when looking at the "Most wanted skills" (or later, when we will have developed that, for the "Matching position" view)
*/
/* Manage the partition colors */ /*
function set_skill_style(d, attribute, searched_skill_id) { gray tones for all skills that have no particular property ("Basic skills wheel" view)
yellow tones for skills that are provided by courses in Chamilo ("Teachable skills" view)
bright blue tones for personal skills already acquired by the student currently looking at the weel ("My skills" view)
dark blue tones for skills already acquired by a series of students, when looking at the will in the "Owned skills" view.
bright green for skills looked for by a HR director ("Profile search" view)
dark green for skills most searched for, summed up from the different saved searches from HR directors ("Most wanted skills")
bright red for missing skills, in the "Required skills" view for a student when looking at the "Most wanted skills" (or later, when we will have developed that, for the "Matching position" view)
*/
/* Manage the partition colors */
function set_skill_style(d, attribute, searched_skill_id) {
//Default stroke //Default stroke
return_stroke = 'black'; return_stroke = 'black';
@ -187,10 +194,10 @@ for (i= 0; i < color_loops; i++) {
return return_stroke; return return_stroke;
break; break;
} }
} }
/* When you click a skill partition */ /* When you click a skill partition */
function click_partition(d, path, text, icon, arc, x, y, r, p, vis) { function click_partition(d, path, text, icon, arc, x, y, r, p, vis) {
//console.log(d.depth); //console.log(d.depth);
if (debug) { if (debug) {
console.log('Clicking a partition skill id: '+d.id); console.log('Clicking a partition skill id: '+d.id);
@ -288,12 +295,12 @@ for (i= 0; i < color_loops; i++) {
.each("end", function(e) { .each("end", function(e) {
//d3.select(this).style("visibility", isParentOf(d, e) ? null : "hidden"); //d3.select(this).style("visibility", isParentOf(d, e) ? null : "hidden");
});*/ });*/
} }
/* /*
Open a popup in order to modify the skill Open a popup in order to modify the skill
*/ */
function open_popup(skill_id, parent_id) { function open_popup(skill_id, parent_id) {
//Cleaning selects //Cleaning selects
$("#gradebook_id").find('option').remove(); $("#gradebook_id").find('option').remove();
$("#parent_id").find('option').remove(); $("#parent_id").find('option').remove();
@ -340,7 +347,6 @@ for (i= 0; i < color_loops; i++) {
},*/ },*/
"{{ "CreateChildSkill"|get_lang }}" : function() { "{{ "CreateChildSkill"|get_lang }}" : function() {
open_popup(0, skill.id); open_popup(0, skill.id);
}, },
"{{ "AddSkillToProfileSearch"|get_lang }}" : function() { "{{ "AddSkillToProfileSearch"|get_lang }}" : function() {
add_skill_in_profile_list(skill.id, skill.name); add_skill_in_profile_list(skill.id, skill.name);
@ -390,10 +396,10 @@ for (i= 0; i < color_loops; i++) {
}); });
$("#dialog-form").dialog("open"); $("#dialog-form").dialog("open");
} }
} }
/* Handles mouse clicks */ /* Handles mouse clicks */
function handle_mousedown_event(d, path, text, icon, arc, x, y, r, padding, vis) { function handle_mousedown_event(d, path, text, icon, arc, x, y, r, padding, vis) {
switch (d3.event.which) { switch (d3.event.which) {
case 1: case 1:
//alert('Left mouse button pressed'); //alert('Left mouse button pressed');

@ -205,7 +205,6 @@ function submit_profile_search_form() {
//return skill; //return skill;
} }
function add_skill_in_profile_list(skill_id, skill_name) { function add_skill_in_profile_list(skill_id, skill_name) {
if ($('#profile_match_item_'+skill_id).length == 0 ) { if ($('#profile_match_item_'+skill_id).length == 0 ) {
$('#profile_search').append('<li class="bit-box" id="profile_match_item_'+skill_id+'">'+skill_name+' <a rel="'+skill_id+'" class="closebutton" href="#"></a> </li>'); $('#profile_search').append('<li class="bit-box" id="profile_match_item_'+skill_id+'">'+skill_name+' <a rel="'+skill_id+'" class="closebutton" href="#"></a> </li>');

@ -53,7 +53,7 @@ function fill_skill_search_li(skill_id, skill_name, checked) {
if (checked == 1) { if (checked == 1) {
checked_condition = 'checked=checked'; checked_condition = 'checked=checked';
} }
return '<li><a href="#" class="load_wheel" rel="'+skill_id+'">'+skill_name+'</a></li>'; return '<li><a id="skill_to_select_id_'+skill_id+'" href="#" class="load_wheel" rel="'+skill_id+'">'+skill_name+'</a></li>';
} }
function load_skill_info(skill_id) { function load_skill_info(skill_id) {

Loading…
Cancel
Save