Compare commits
76 Commits
old_versio
...
master
Author | SHA1 | Date |
---|---|---|
邱博亞 | 5acc13d76d | |
邱博亞 | 0fdbf08f9e | |
邱博亞 | be5b892aee | |
邱博亞 | d2b3464359 | |
邱博亞 | 64626817e9 | |
邱博亞 | 2cb22f4f6f | |
邱博亞 | e03e27dc17 | |
BoHung Chiu | 93ef387b68 | |
BoHung Chiu | f8264413f0 | |
BoHung Chiu | 586f83142d | |
BoHung Chiu | 5ffa34b151 | |
BoHung Chiu | dbbe675584 | |
BoHung Chiu | 2f7135e146 | |
BoHung Chiu | 19daac4173 | |
BoHung Chiu | 5206181fed | |
BoHung Chiu | 0ebff5a9e5 | |
BoHung Chiu | 543b5cf42f | |
BoHung Chiu | ca4a48cb51 | |
BoHung Chiu | 40d4b889fd | |
BoHung Chiu | 163805f8c1 | |
BoHung Chiu | f897f12ef5 | |
BoHung Chiu | e3c123e5aa | |
BoHung Chiu | dd52046c16 | |
BoHung Chiu | 5bf740d454 | |
BoHung Chiu | 742adb814d | |
BoHung Chiu | 7724fd5769 | |
BoHung Chiu | ca5c47d7f5 | |
BoHung Chiu | 6a1cac01aa | |
BoHung Chiu | 4b4c960d14 | |
BoHung Chiu | 137e13ad1b | |
BOHUNG | 9f3f337dec | |
BOHUNG | 846024ac51 | |
BOHUNG | f93a11d638 | |
BOHUNG | 9428475124 | |
BOHUNG | e116f69577 | |
BOHUNG | db59135626 | |
BOHUNG | 817ecf0377 | |
BOHUNG | 38e35fb560 | |
BOHUNG | da1eed7786 | |
BOHUNG | 19b2afcab1 | |
BOHUNG | 65b96b9fdc | |
BOHUNG | 25e3ae7fde | |
BOHUNG | 4620557e72 | |
BOHUNG | cf9bec7a61 | |
BOHUNG | 893fe1e33b | |
BOHUNG | 8f7a0ce704 | |
BOHUNG | 52a197a68d | |
BOHUNG | 5962eed8a0 | |
BOHUNG | 9aba9a3f0b | |
BOHUNG | 456ce12222 | |
BOHUNG | 4b8fed7e52 | |
BOHUNG | 77e92b7297 | |
BOHUNG | 0101f3bef0 | |
BOHUNG | e2bc83ec2e | |
BOHUNG | 74fff06818 | |
BOHUNG | 190752a275 | |
BOHUNG | 24d14e2b3b | |
BOHUNG | 788f495c29 | |
chiu | 7982622ca8 | |
BOHUNG | 1e41d84353 | |
chiu | f5af46731e | |
BOHUNG | 63bfb834ac | |
BOHUNG | 98738db5d1 | |
BOHUNG | 8945e3b64a | |
BOHUNG | 32bd2ffac5 | |
BOHUNG | 2e00a82db4 | |
BOHUNG | 6b1d72e54a | |
BOHUNG | c1a2927e1e | |
BOHUNG | d8d02fb590 | |
BOHUNG | 296e19929c | |
BOHUNG | 3353d1595b | |
BOHUNG | be9c1f3d05 | |
BOHUNG | 741d440631 | |
BOHUNG | 88b5a9bbed | |
chiu | d9be851646 | |
chiu | d4afee639d |
Binary file not shown.
After Width: | Height: | Size: 992 B |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
|
@ -0,0 +1,887 @@
|
||||||
|
Array.prototype.get_nearest_value = function(goal){
|
||||||
|
var nearest_value = this.reduce(function(prev, curr) {
|
||||||
|
return (Math.abs(curr - goal) < Math.abs(prev - goal) ? curr : prev);
|
||||||
|
});
|
||||||
|
return nearest_value;
|
||||||
|
}
|
||||||
|
function change_object_variables(obj1,obj2,operator="-",target="new"){
|
||||||
|
var obj_new = {};
|
||||||
|
var obj_keys = Object.keys(obj1);
|
||||||
|
obj_keys.forEach(function(k){
|
||||||
|
if(obj2[k] == undefined){
|
||||||
|
if( target == "new"){
|
||||||
|
obj_new[k] = obj1[k];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(operator == "-"){
|
||||||
|
if( target == "new"){
|
||||||
|
obj_new[k] = obj1[k] - obj2[k];
|
||||||
|
}else{
|
||||||
|
obj1[k] = obj1[k] - obj2[k];
|
||||||
|
}
|
||||||
|
}else if(operator == "+"){
|
||||||
|
if( target == "new"){
|
||||||
|
obj_new[k] = obj1[k] + obj2[k];
|
||||||
|
}else{
|
||||||
|
obj1[k] = obj1[k] + obj2[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if( target == "new"){
|
||||||
|
return obj_new;
|
||||||
|
}else{
|
||||||
|
return obj1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$(document).ready(function(){
|
||||||
|
var head_data = $.post("/cancerpredictResult",{"header":1,locale:I18n.locale});
|
||||||
|
var data = {};
|
||||||
|
if(I18n.locale == 'en'){
|
||||||
|
var window_width = $(window).width();
|
||||||
|
if(window_width < 520){
|
||||||
|
$('#cancer_table .cencer_table_name').css('max-width','');
|
||||||
|
}else if(window_width < 768){
|
||||||
|
$('#cancer_table .cencer_table_name').css({'max-width':'','width':'11em'});
|
||||||
|
}else if(window_width < 860){
|
||||||
|
$('#cancer_table .cencer_table_name').css('max-width','30%');
|
||||||
|
}else if(window_width < 1130){
|
||||||
|
$('#cancer_table .cencer_table_name').css('max-width','33%');
|
||||||
|
}else{
|
||||||
|
$('#cancer_table .cencer_table_name').css('max-width','39%');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
function round(num,Digit=0){
|
||||||
|
return Math.round(Number(num)*(10**Digit))/(10**Digit);
|
||||||
|
};
|
||||||
|
head_data.done(function(){
|
||||||
|
if(head_data.responseJSON['head_images'] != ''){
|
||||||
|
$('.header-nav').html(head_data.responseJSON['head_images']);
|
||||||
|
}
|
||||||
|
if(head_data.responseJSON['title'] != ''){
|
||||||
|
$('.navbar-brand').html(head_data.responseJSON['title']);
|
||||||
|
}
|
||||||
|
data['danger_texts'] = head_data.responseJSON['danger_texts'];
|
||||||
|
$('head title').text(head_data.responseJSON['page_title'])
|
||||||
|
});
|
||||||
|
var mapping_data = $.post("/cancerpredictResult",{"get_mapping_data_from_csv":1,locale:I18n.locale});
|
||||||
|
mapping_data.done(function(){
|
||||||
|
// $('.header-nav').html(head_images.responseJSON['head_images']);
|
||||||
|
// $('.navbar-brand').html(head_images.responseJSON['title'])
|
||||||
|
window.mapping_data_from_csv = mapping_data.responseJSON['mapping_data_from_csv'];
|
||||||
|
});
|
||||||
|
Array.prototype.remove_item_from_array = function(){
|
||||||
|
var result_array = this;
|
||||||
|
for(var i=0;i<arguments.length;i++){
|
||||||
|
if(Array.isArray(arguments[i])){
|
||||||
|
for(var j=0;j<arguments.length;j++){
|
||||||
|
var index = result_array.indexOf(arguments[i][j]);
|
||||||
|
if(index == -1)
|
||||||
|
continue;
|
||||||
|
else{
|
||||||
|
result_array = result_array.slice(0, index).concat(result_array.slice(index + 1, result_array.length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var index = result_array.indexOf(arguments[i]);
|
||||||
|
if(index == -1)
|
||||||
|
continue;
|
||||||
|
else{
|
||||||
|
result_array = result_array.slice(0, index).concat(result_array.slice(index + 1, result_array.length));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
result_array.push = this.push;
|
||||||
|
result_array.remove_item_from_array = this.remove_item_from_array;
|
||||||
|
return result_array;
|
||||||
|
};
|
||||||
|
$('input#lymph_nodes_examined').data('range_new' , $('input#lymph_nodes_examined').data('range'));
|
||||||
|
$('input#lymph_nodes_positive').data('range_new' , $('input#lymph_nodes_positive').data('range'));
|
||||||
|
$('.num_only').on('input', function() {
|
||||||
|
$(this).siblings('.num_only_value').val($(this).val());
|
||||||
|
if( Number($(this).val()) < $(this).data('range')[0] || $(this).val() == "" || (Number($(this).val()) > $(this).data('range')[1] && $(this).data('range')[1] != undefined) ){
|
||||||
|
$(this).css('color','#f24a69');
|
||||||
|
$(this).addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$(this).css('color','#333');
|
||||||
|
$(this).removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('input#lymph_nodes_positive').off('input').on('input',function(){
|
||||||
|
$(this).siblings('.num_only_value').val($(this).val());
|
||||||
|
if( Number($(this).val()) < $(this).data('range_new')[0] || $(this).val() == "" || (Number($(this).val()) > $(this).data('range_new')[1] && $(this).data('range_new')[1] != undefined) ){
|
||||||
|
$(this).css('color','#f24a69');
|
||||||
|
$(this).addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$(this).css('color','#333');
|
||||||
|
$(this).removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('input#lymph_nodes_examined').off('input').on('input',function(){
|
||||||
|
$(this).siblings('.num_only_value').val($(this).val());
|
||||||
|
if( Number($(this).val()) < $(this).data('range_new')[0] || $(this).val() == "" || (Number($(this).val()) > $(this).data('range_new')[1] && $(this).data('range_new')[1] != undefined) ){
|
||||||
|
$(this).css('color','#f24a69');
|
||||||
|
$(this).addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$(this).css('color','#333');
|
||||||
|
$(this).removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('.cancer_help_btn').off("click").on('click',function(){
|
||||||
|
var modal_head = "";
|
||||||
|
try{ modal_head = $(this).parent().find(">label").html()}catch(e){};
|
||||||
|
var modal_body = "";
|
||||||
|
try{ modal_body = $(this).parent().find(">input.help_texts").attr('value')}catch(e){};
|
||||||
|
$('#show_help_modal').html("<div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' aria-hidden='true' class='close'>×</button><h4 class='modal-title'>"+modal_head+"</h4>"+
|
||||||
|
"</div><div class='modal-body'>"+modal_body+"</div><div class='modal-footer'><button type='button' class='btn btn-default'>Close</button></div></div></div>")
|
||||||
|
$('#show_help_modal').modal('show');
|
||||||
|
$('#show_help_modal .close').off("click").on('click',function(){
|
||||||
|
$('#show_help_modal').modal('hide');
|
||||||
|
});
|
||||||
|
$('#show_help_modal .modal-footer button').off("click").on('click',function(){
|
||||||
|
$('#show_help_modal').modal('hide');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('.btn-add').click(function(){
|
||||||
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
||||||
|
if($(this).parent().find('.num_only').val()!=""){
|
||||||
|
var input_value = Number($(this).parent().find('.num_only').val());
|
||||||
|
if(Array.isArray($(this).parent().find('.num_only').data('range'))){
|
||||||
|
var compare_value = $(this).parent().find('.num_only').data('range')[1];
|
||||||
|
if(compare_value != undefined){
|
||||||
|
if(input_value+1 <= Number(compare_value))
|
||||||
|
$(this).parent().find('.num_only').val(input_value+1);
|
||||||
|
else{
|
||||||
|
input_value = $(this).parent().find('.num_only').data('range')[0];
|
||||||
|
if(input_value != undefined)
|
||||||
|
$(this).parent().find('.num_only').val(input_value);
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
$(this).parent().find('.num_only').val(input_value+1);
|
||||||
|
};
|
||||||
|
compare_value = $(this).parent().find('.num_only').data('range')[0];
|
||||||
|
if(compare_value != undefined){
|
||||||
|
if($(this).parent().find('.num_only').val() >= compare_value){
|
||||||
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).parent().find('.num_only').css('color','#333');
|
||||||
|
};
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).parent().find('.num_only').css('color','#333');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
try{
|
||||||
|
var input_value = $(this).parent().find('.num_only').data('range')[0];
|
||||||
|
if(input_value != undefined)
|
||||||
|
$(this).parent().find('.num_only').val(input_value);
|
||||||
|
}catch(e){
|
||||||
|
$(this).parent().find('.num_only').val(0);
|
||||||
|
};
|
||||||
|
if($(this).parent().find('.num_only').val() != ""){
|
||||||
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).parent().find('.num_only').css('color','#333');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('.btn-sub').click(function(){
|
||||||
|
if($(this).parent().find('.num_only').val()!=""){
|
||||||
|
var input_value = Number($(this).parent().find('.num_only').val());
|
||||||
|
if(Array.isArray($(this).parent().find('.num_only').data('range'))){
|
||||||
|
var compare_value = $(this).parent().find('.num_only').data('range')[0];
|
||||||
|
if(compare_value != undefined){
|
||||||
|
if(input_value-1 >= Number(compare_value))
|
||||||
|
$(this).parent().find('.num_only').val(input_value-1);
|
||||||
|
else{
|
||||||
|
input_value = $(this).parent().find('.num_only').data('range')[1];
|
||||||
|
if(input_value != undefined)
|
||||||
|
$(this).parent().find('.num_only').val(input_value);
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
$(this).parent().find('.num_only').val(input_value-1);
|
||||||
|
};
|
||||||
|
compare_value = $(this).parent().find('.num_only').data('range')[1];
|
||||||
|
if(compare_value != undefined){
|
||||||
|
if($(this).parent().find('.num_only').val() <= compare_value){
|
||||||
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).parent().find('.num_only').css('color','#333');
|
||||||
|
};
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).parent().find('.num_only').css('color','#333');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
try{
|
||||||
|
var input_value = $(this).parent().find('.num_only').data('range')[1];
|
||||||
|
if(input_value != undefined){
|
||||||
|
$(this).parent().find('.num_only').val(input_value);
|
||||||
|
}else{
|
||||||
|
input_value = $(this).parent().find('.num_only').data('range')[0];
|
||||||
|
if(input_value != undefined)
|
||||||
|
$(this).parent().find('.num_only').val(input_value);
|
||||||
|
}
|
||||||
|
}catch(e){
|
||||||
|
$(this).parent().find('.num_only').val(0);
|
||||||
|
};
|
||||||
|
if($(this).parent().find('.num_only').val() != ""){
|
||||||
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).parent().find('.num_only').css('color','#333');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('.cancer_table_btn').off('click').on('click',function(){
|
||||||
|
var index = $(this).index()/2;
|
||||||
|
try{
|
||||||
|
$(this).parent().find('>input').attr('value',0);
|
||||||
|
$(this).parent().find('>input').eq(index).attr('value',1);
|
||||||
|
$(this).parent().find('>button').removeClass('active');
|
||||||
|
$(this).parent().removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
}catch(e){};
|
||||||
|
$(this).addClass('active');
|
||||||
|
});
|
||||||
|
$('#cancer_table_reset').click(function(){
|
||||||
|
$('.cancer_table_btn').removeClass('active');
|
||||||
|
$('.cancer-btn-group input').attr('value',0);
|
||||||
|
$('.num_only').val('');
|
||||||
|
$('.num_only_value').val('');
|
||||||
|
$('#cancer_table .cancer_form_field').removeClass('cancertable_empty');
|
||||||
|
$('#cancer_predict_result_block').css('display','none');
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
$('select.select_num').val('');
|
||||||
|
});
|
||||||
|
function get_input_data(){
|
||||||
|
var flag;
|
||||||
|
flag = 1;
|
||||||
|
for(var i = 0;i < $('#cancer_table .cancer_form_field').length;i++){
|
||||||
|
if($('#cancer_table .cancer_form_field').eq(i).hasClass('num_only')){
|
||||||
|
if($('#cancer_table .cancer_form_field').eq(i).val()==""){
|
||||||
|
flag = 0;
|
||||||
|
$('#cancer_table .cancer_form_field').eq(i).addClass('cancertable_empty');
|
||||||
|
}else if($('#cancer_table .cancer_form_field').eq(i).val() != "" && !$('#cancer_table .cancer_form_field').eq(i).hasClass('cancertable_empty')){
|
||||||
|
$('#cancer_table .cancer_form_field').eq(i).removeClass('cancertable_empty');
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
if($('#cancer_table .cancer_form_field').eq(i).find('[value="1"]').length == 0){
|
||||||
|
flag = 0;
|
||||||
|
$('#cancer_table .cancer_form_field').eq(i).addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$('#cancer_table .cancer_form_field').eq(i).removeClass('cancertable_empty');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if( Number($('input#lymph_nodes_examined').siblings('.num_only_value').val()) < Number($('input#lymph_nodes_positive').siblings('.num_only_value').val())){
|
||||||
|
$('input#lymph_nodes_positive').addClass('cancertable_empty');
|
||||||
|
$('input#lymph_nodes_positive').css('color','rgb(242, 74, 105)');
|
||||||
|
};
|
||||||
|
if($('.cancertable_empty').length != 0){
|
||||||
|
flag = 0;
|
||||||
|
($('#danger_texts').length == 0) ? $('#cancer_table_submit').parent().before('<a id="danger_texts" style="color:red;">'+data['danger_texts']+'</a>') : null;
|
||||||
|
$('#danger_texts').css('margin-left',$(window).width()/2-$('#danger_texts').width()/2);
|
||||||
|
}else{
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
if(flag == 1){
|
||||||
|
var post_json= {};
|
||||||
|
for(var i = 0;i < $('#cancer_table .cancer_form_field').length;i++){
|
||||||
|
var name = $('#cancer_table .cancer_form_field').eq(i).attr('id')
|
||||||
|
if($('#cancer_table .cancer_form_field').eq(i).hasClass('num_only'))
|
||||||
|
post_json[name] = Number($('#cancer_table .cancer_form_field').eq(i).siblings('.num_only_value').val());
|
||||||
|
else{
|
||||||
|
var index = ($('#cancer_table .cancer_form_field').eq(i).find('[value="1"]').index()+1)/2;
|
||||||
|
post_json[name] = index;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if( post_json["ER_status"] == 2 && post_json["PR_status"] == 2 ){
|
||||||
|
$('#hormone_therapy .cancer_table_btn').attr('disabled','disabled');
|
||||||
|
$('[for="hormone_therapy"]').css('color','rgb(204, 204, 204)');
|
||||||
|
}else{
|
||||||
|
$('#hormone_therapy .cancer_table_btn').removeAttr('disabled');
|
||||||
|
$('[for="hormone_therapy"]').css('color','');
|
||||||
|
};
|
||||||
|
/*disable_condition start*/
|
||||||
|
if(post_json["ER_status"] == 2 && post_json["PR_status"] == 2){
|
||||||
|
$('#hormone_therapy .cancer_table_btn').attr('disabled','disabled');
|
||||||
|
$('[for="hormone_therapy"]').css('color','rgb(204, 204, 204)');
|
||||||
|
}else{
|
||||||
|
$('#hormone_therapy .cancer_table_btn').removeAttr('disabled');
|
||||||
|
$('[for="hormone_therapy"]').css('color','');
|
||||||
|
}
|
||||||
|
if(post_json["HER2_status"] != 1){
|
||||||
|
$('#Targeted_therapy .cancer_table_btn').attr('disabled','disabled');
|
||||||
|
$('[for="Targeted_therapy"]').css('color','rgb(204, 204, 204)');
|
||||||
|
}else{
|
||||||
|
$('#Targeted_therapy .cancer_table_btn').removeAttr('disabled');
|
||||||
|
$('[for="Targeted_therapy"]').css('color','');
|
||||||
|
}
|
||||||
|
/*disable_condition end*/
|
||||||
|
return post_json;
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function set_result(result){
|
||||||
|
if(result.responseJSON.lpv != "error"){
|
||||||
|
$('#choice_fields .cancer_table_btn').removeClass('active');
|
||||||
|
var load_heml = $('#result_table_content').html(result.responseJSON.table);
|
||||||
|
load_heml.ready(function(){
|
||||||
|
$('#result_table_content .cancer_years').eq(-1).addClass('active');
|
||||||
|
for(var i = 0;i < $('#result_table_content .cancer_years').length;i++){
|
||||||
|
$('#result_table_content .cancer_years').eq(i).attr('index',i)
|
||||||
|
};
|
||||||
|
$('#result_table_content .cancer_years').off('click').on('click',function(){
|
||||||
|
try{
|
||||||
|
$(this).parent().find('.cancer_years').removeClass('active');
|
||||||
|
}catch(e){};
|
||||||
|
$(this).addClass('active');
|
||||||
|
$('#current_year').attr('index',$(this).attr('index'));
|
||||||
|
$('#current_year').attr('value',$(this).html());
|
||||||
|
$('#current_year').change();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
load_heml = $('#result_text_content').html(result.responseJSON.texts);
|
||||||
|
load_heml.ready(function(){
|
||||||
|
$('#result_text_content .cancer_years').eq(-1).addClass('active');
|
||||||
|
for(var i = 0;i < $('#result_text_content .cancer_years').length;i++){
|
||||||
|
$('#result_text_content .cancer_years').eq(i).attr('index',i)
|
||||||
|
};
|
||||||
|
$('#current_year').off('change');
|
||||||
|
$('#result_text_content .cancer_years').off('click')
|
||||||
|
$('#result_text_content .cancer_years').click(function(){
|
||||||
|
try{
|
||||||
|
$(this).parent().find('.cancer_years').removeClass('active');
|
||||||
|
}catch(e){};
|
||||||
|
$(this).addClass('active');
|
||||||
|
$('#current_year').attr('value',$(this).html());
|
||||||
|
$('#current_year').attr('index',$(this).attr('index'));
|
||||||
|
$('.surgery_year').html($(this).html());
|
||||||
|
$('#current_year').change();
|
||||||
|
});
|
||||||
|
$('#cancer_table_right_result .cancer-btn-group .cancer_table_btn').removeClass('active');
|
||||||
|
$('#cancer_table_right_result .cancer-btn-group >input').attr('value',"0");
|
||||||
|
for(var i = 0;i < $('#cancer_table_left_result .cancer-btn-group').length;i++){
|
||||||
|
$('#cancer_table_left_result .cancer-btn-group').eq(i).find('.cancer_table_btn').eq(0).addClass('active');
|
||||||
|
$('#cancer_table_left_result .cancer-btn-group').eq(i).find('>input').eq(0).attr('value',"1");
|
||||||
|
};
|
||||||
|
for(var i = 0;i < $('#cancer_table_right_result .cancer-btn-group').length;i++){
|
||||||
|
$('#cancer_table_right_result .cancer-btn-group').eq(i).find('.cancer_table_btn').eq(0).addClass('active');
|
||||||
|
$('#cancer_table_right_result .cancer-btn-group').eq(i).find('>input').eq(0).attr('value',"1");
|
||||||
|
};
|
||||||
|
var treatment_method = result.responseJSON.treatment_method;
|
||||||
|
var treatment_method_active_indices = result.responseJSON.treatment_method_active_indices;
|
||||||
|
$('tr.'+treatment_method[0]).addClass('tr_show');
|
||||||
|
var servive_ratio_arr = [result.responseJSON.servive_ratio]
|
||||||
|
var yes = (I18n.locale=="zh_tw") ? "是" : "yes";
|
||||||
|
var year = $('#current_year').attr('value');
|
||||||
|
var active_treatment = ['Surgery_only'];
|
||||||
|
$('tr.'+active_treatment[0]+' .Overall_Survival').html(servive_ratio_arr[0]+'%');
|
||||||
|
$('span.'+active_treatment[0]+'.Overall_Survival').html(Math.round(servive_ratio_arr[0]));
|
||||||
|
$('#cancer_predict_result_block').css('display','block');
|
||||||
|
var lpv_real = [result.responseJSON['lpv_variable']];
|
||||||
|
var lpv = /*therapy_lpv start*/[0, -0.8397, -0.4147, -0.3203, -0.4687];/*therapy_lpv end*/;
|
||||||
|
var lpv_dict={};
|
||||||
|
var lpv_calc=/*lpv_calc_formula_start*/{"1":"Math.exp(-0.001476145)**( Math.exp(lpv_current) )","3":"Math.exp(-0.01261639)**( Math.exp(lpv_current) )","5":"Math.exp(-0.02519608)**( Math.exp(lpv_current) )"};/*lpv_calc_formula_end*/
|
||||||
|
active_treatment.push = function() {
|
||||||
|
if(arguments.length == 1){
|
||||||
|
var year = $('#current_year').attr('value');
|
||||||
|
console.log(lpv_real);
|
||||||
|
console.log(lpv_dict[arguments[0]])
|
||||||
|
var lpv_current = change_object_variables(lpv_real[lpv_real.length-1],{"lpv": lpv_dict[arguments[0]]},'+');
|
||||||
|
lpv_real.push(lpv_current);
|
||||||
|
lpv_current = lpv_current['lpv'];
|
||||||
|
var servive_ratio = round(eval(lpv_calc[year])*100,2);
|
||||||
|
var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length - 1];
|
||||||
|
servive_ratio_arr.push(servive_ratio);
|
||||||
|
$('tr.'+arguments[0]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||||
|
$('tr.'+arguments[0]+' td.Additional_Benefit').html(round(benefit,2)+'%');
|
||||||
|
$('tr.'+arguments[0]).css('display','table-row');
|
||||||
|
$('tr.tr_show').eq(-1).after($('tr.'+arguments[0]));
|
||||||
|
$('tr.'+arguments[0]).addClass('tr_show');
|
||||||
|
if(this.length == 1){
|
||||||
|
$('.addition').css('display','inline-block');
|
||||||
|
$('#result_text_content .extra-text').css('display','inline-block');
|
||||||
|
}
|
||||||
|
var add_choices = this.slice(1,this.length);
|
||||||
|
add_choices.push(arguments[0]);
|
||||||
|
var add_choices_transform = [];
|
||||||
|
for(var i = 0;i<add_choices.length;i++){
|
||||||
|
add_choices_transform.push($('[for="'+add_choices[i]+'"]').html())
|
||||||
|
};
|
||||||
|
var add_choices_str = (I18n.locale == 'en' ? add_choices_transform.slice(0,add_choices_transform.length-1).join(', ') : add_choices_transform.slice(0,add_choices_transform.length-1).join('、'));
|
||||||
|
if(add_choices_transform.length >= 2)
|
||||||
|
add_choices_str += ((I18n.locale == 'en' ? ', and ': '以及')+add_choices_transform[add_choices_transform.length-1])
|
||||||
|
else
|
||||||
|
add_choices_str = add_choices_transform[0];
|
||||||
|
var extra_therapy_texts = result.responseJSON['extra_therapy_texts'];
|
||||||
|
extra_therapy_texts = extra_therapy_texts.replace('{{extra_therapy}}','</span><span class="'+arguments[0]+' choices">'+add_choices_str+'</span><span>');
|
||||||
|
extra_therapy_texts = extra_therapy_texts.replace('{{survival_num}}','</span><span class="'+arguments[0]+' Overall_Survival">'+Math.round(servive_ratio)+'</span><span>');
|
||||||
|
extra_therapy_texts = extra_therapy_texts.replace('{{surgery_year}}','</span><span class="surgery_year">'+year+'</span><span>');
|
||||||
|
extra_therapy_texts = extra_therapy_texts.replace('{{Additional_Benefit}}','</span><span class="'+arguments[0]+' Additional_Benefit">'+Math.round(benefit)+'</span><span>');
|
||||||
|
var new_text = '<p class="texts_show"><span>';
|
||||||
|
new_text += (extra_therapy_texts+'</span></p>');
|
||||||
|
$('#result_text_content .extra-text .texts_show').eq(-1).after(new_text)
|
||||||
|
return Array.prototype.push.apply(this, arguments);
|
||||||
|
}else{
|
||||||
|
return Array.prototype.push.apply(this, arguments);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
active_treatment.remove_item_from_array = function(){
|
||||||
|
if(arguments.length == 1 && !Array.isArray(arguments[0])){
|
||||||
|
var index = this.indexOf(arguments[0])
|
||||||
|
var year = $('#current_year').attr('value');
|
||||||
|
if(index < this.length - 1){
|
||||||
|
for(var i = index + 1;i < this.length; i++){
|
||||||
|
change_object_variables(lpv_real[i] , {"lpv": lpv_dict[arguments[0]]} , '-' , 'self');
|
||||||
|
var lpv_current = lpv_real[i];
|
||||||
|
lpv_current = lpv_current['lpv'];
|
||||||
|
var servive_ratio = round(eval(lpv_calc[year])*100,2);
|
||||||
|
servive_ratio_arr[i] = servive_ratio;
|
||||||
|
var benefit = servive_ratio - ((i == index+1) ? servive_ratio_arr[index - 1] : servive_ratio_arr[i - 1]);
|
||||||
|
$('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||||
|
$('.'+active_treatment[i]+'.Overall_Survival').html(Math.round(servive_ratio));
|
||||||
|
$('tr.'+active_treatment[i]+' td.Additional_Benefit').html(round(benefit,2)+'%');
|
||||||
|
$('.'+active_treatment[i]+'.Additional_Benefit').html(Math.round(benefit));
|
||||||
|
};
|
||||||
|
var add_choices = [];
|
||||||
|
for(var i = 1;i < this.length; i++){
|
||||||
|
if(i != index){
|
||||||
|
add_choices.push(this[i]);
|
||||||
|
var add_choices_transform = [];
|
||||||
|
for(var j = 0;j<add_choices.length;j++){
|
||||||
|
add_choices_transform.push($('[for="'+add_choices[j]+'"]').html())
|
||||||
|
};
|
||||||
|
var add_choices_str = (I18n.locale == 'en' ? add_choices_transform.slice(0,add_choices_transform.length-1).join(', ') : add_choices_transform.slice(0,add_choices_transform.length-1).join('、'));
|
||||||
|
if(add_choices_transform.length >= 2)
|
||||||
|
add_choices_str += ((I18n.locale == 'en' ? ', and ': '以及')+add_choices_transform[add_choices_transform.length-1])
|
||||||
|
else
|
||||||
|
add_choices_str = add_choices_transform[0];
|
||||||
|
$('.'+active_treatment[i]+'.choices').html(add_choices_str);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
$('tr.'+arguments[0]+' td.Overall_Survival').html('-');
|
||||||
|
$('tr.'+arguments[0]+' td.Additional_Benefit').html('-');
|
||||||
|
$('tr.'+arguments[0]).css('display','none');
|
||||||
|
$('tr.'+arguments[0]).removeClass('tr_show');
|
||||||
|
$('span.'+arguments[0]).eq(0).parent().remove();
|
||||||
|
lpv_real = lpv_real.remove_item_from_array(lpv_real[index]);
|
||||||
|
servive_ratio_arr = servive_ratio_arr.remove_item_from_array(servive_ratio_arr[index]);
|
||||||
|
if(this.length == 2){
|
||||||
|
$('.addition').css('display','none');
|
||||||
|
$('#result_text_content .extra-text').css('display','none');
|
||||||
|
};
|
||||||
|
return Array.prototype.remove_item_from_array.apply(this, arguments);
|
||||||
|
}else{
|
||||||
|
return Array.prototype.remove_item_from_array.apply(this, arguments);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
for(var i = 0;i<treatment_method.length;i++){
|
||||||
|
lpv_dict[treatment_method[i]] = lpv[i];
|
||||||
|
var click_flag=false;
|
||||||
|
$('#'+treatment_method[i]+' .cancer_table_btn').off('click').click(function(){
|
||||||
|
var index = $(this).index()/2;
|
||||||
|
try{
|
||||||
|
$(this).parent().find('>input').attr('value',0);
|
||||||
|
$(this).parent().find('>input').eq(index).attr('value',1);
|
||||||
|
$(this).parent().find('>button').removeClass('active');
|
||||||
|
$(this).parent().removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
}catch(e){};
|
||||||
|
$(this).addClass('active');
|
||||||
|
if(!click_flag){
|
||||||
|
if(active_treatment.includes($(this).parent().attr('id'))){
|
||||||
|
click_flag = true;
|
||||||
|
active_treatment = active_treatment.remove_item_from_array($(this).parent().attr('id'));
|
||||||
|
click_flag = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('#'+treatment_method[i]+' .cancer_table_btn').eq(treatment_method_active_indices[i]).off('click').click(function(){
|
||||||
|
var index = $(this).index()/2;
|
||||||
|
try{
|
||||||
|
$(this).parent().find('>input').attr('value',0);
|
||||||
|
$(this).parent().find('>input').eq(index).attr('value',1);
|
||||||
|
$(this).parent().find('>button').removeClass('active');
|
||||||
|
$(this).parent().removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
}catch(e){};
|
||||||
|
$(this).addClass('active');
|
||||||
|
if(!click_flag){
|
||||||
|
if(!active_treatment.includes($(this).parent().attr('id'))){
|
||||||
|
click_flag = true;
|
||||||
|
active_treatment.push($(this).parent().attr('id'));
|
||||||
|
click_flag = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$('#current_year').change(function(){
|
||||||
|
year = $(this).attr('value');
|
||||||
|
$('.surgery_year').html(year);
|
||||||
|
$('.cancer_years').removeClass('active');
|
||||||
|
$('#result_text_content .cancer_years').eq($(this).attr("index")).addClass('active');
|
||||||
|
$('#result_table_content .cancer_years').eq($(this).attr("index")).addClass('active');
|
||||||
|
var obj = {"servive_ratio_arr":servive_ratio_arr,"active_treatment":active_treatment,"lpv_real":lpv_real,"lpv_calc":lpv_calc,"year":year}
|
||||||
|
calculate_and_change_result_value(obj);
|
||||||
|
servive_ratio_arr = obj.servive_ratio_arr;
|
||||||
|
active_treatment = obj.active_treatment;
|
||||||
|
lpv_real = obj.lpv_real;
|
||||||
|
lpv_calc = obj.lpv_calc;
|
||||||
|
year = obj.year;
|
||||||
|
});
|
||||||
|
$('#cancer_table .cancer_form_field').off('change').on('change',function(){
|
||||||
|
var obj = {"servive_ratio_arr":servive_ratio_arr,"active_treatment":active_treatment,"lpv_real":lpv_real,"lpv_calc":lpv_calc,"year":year}
|
||||||
|
after_submit_change_func(obj);
|
||||||
|
servive_ratio_arr = obj.servive_ratio_arr;
|
||||||
|
active_treatment = obj.active_treatment;
|
||||||
|
lpv_real = obj.lpv_real;
|
||||||
|
lpv_calc = obj.lpv_calc;
|
||||||
|
year = obj.year;
|
||||||
|
});
|
||||||
|
$('#cancer_table .cancer_form_field').click(function(){
|
||||||
|
$(this).change();
|
||||||
|
});
|
||||||
|
$('select.select_num').off('click').on('click',function(){
|
||||||
|
$(this).change();
|
||||||
|
var obj = {"servive_ratio_arr":servive_ratio_arr,"active_treatment":active_treatment,"lpv_real":lpv_real,"lpv_calc":lpv_calc,"year":year}
|
||||||
|
after_submit_change_func(obj);
|
||||||
|
servive_ratio_arr = obj.servive_ratio_arr;
|
||||||
|
active_treatment = obj.active_treatment;
|
||||||
|
lpv_real = obj.lpv_real;
|
||||||
|
lpv_calc = obj.lpv_calc;
|
||||||
|
year = obj.year;
|
||||||
|
});
|
||||||
|
$('.num_only').on('input', function() {
|
||||||
|
if( Number($(this).val()) < $(this).data('range')[0] || $(this).val() == "" || (Number($(this).val()) > $(this).data('range')[1] && $(this).data('range')[1] != undefined) ){
|
||||||
|
$(this).css('color','#f24a69');
|
||||||
|
$(this).addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$(this).css('color','#333');
|
||||||
|
$(this).removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
var obj = {"servive_ratio_arr":servive_ratio_arr,"active_treatment":active_treatment,"lpv_real":lpv_real,"lpv_calc":lpv_calc,"year":year};
|
||||||
|
after_submit_change_func(obj);
|
||||||
|
servive_ratio_arr = obj.servive_ratio_arr;
|
||||||
|
active_treatment = obj.active_treatment;
|
||||||
|
lpv_real = obj.lpv_real;
|
||||||
|
lpv_calc = obj.lpv_calc;
|
||||||
|
year = obj.year;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
function after_submit_change_func(obj){
|
||||||
|
var post_json = get_input_data();
|
||||||
|
if(post_json != null){
|
||||||
|
var new_lpv = calculate_first_lpv(post_json)['lpv_variable'];
|
||||||
|
var old_lpv = obj.lpv_real[0];
|
||||||
|
obj.lpv_real = obj.lpv_real.map(original_value=>(change_object_variables(original_value,change_object_variables(new_lpv,old_lpv,'-'),'+')));
|
||||||
|
calculate_and_change_result_value(obj);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/* auto add start */
|
||||||
|
function calculate_first_lpv(result_json){
|
||||||
|
result = {};
|
||||||
|
var map_values , mapping_hash , temp_index ,temp_value , index , closest_value;
|
||||||
|
result['age'] = Number(result_json['age']);
|
||||||
|
result['size'] = Number(result_json['size']);
|
||||||
|
result['lymph_nodes_examined'] = Number(result_json['lymph_nodes_examined']);
|
||||||
|
result['lymph_nodes_positive'] = Number(result_json['lymph_nodes_positive']);
|
||||||
|
result['grade'] = Number(result_json['grade']);
|
||||||
|
result['ER_status'] = Number(result_json['ER_status']);
|
||||||
|
result['PR_status'] = Number(result_json['PR_status']);
|
||||||
|
result['HER2_status'] = Number(result_json['HER2_status']);
|
||||||
|
result['Distant_Metastasis'] = Number(result_json['Distant_Metastasis']);
|
||||||
|
result['micrometastasis'] = Number(result_json['micrometastasis']);
|
||||||
|
result['tumor_direct_extension'] = Number(result_json['tumor_direct_extension']);
|
||||||
|
result['lvi'] = Number(result_json['lvi']);
|
||||||
|
result['hormone_therapy'] = Number(result_json['hormone_therapy']);
|
||||||
|
result['Chemotherapy'] = Number(result_json['Chemotherapy']);
|
||||||
|
result['Radiotherapy'] = Number(result_json['Radiotherapy']);
|
||||||
|
result['Targeted_therapy'] = Number(result_json['Targeted_therapy']);
|
||||||
|
|
||||||
|
Object.keys(result).forEach(function(k){
|
||||||
|
if(Number.isNaN(result[k])){
|
||||||
|
result[k] = 0;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
age1 = (result["age"] / 100.0) ** (0.5);
|
||||||
|
age2 = age1 * Math.log(result["age"] / 100.0);
|
||||||
|
size1 = Math.log(result["size"] / 10.0);
|
||||||
|
ratio = (result["lymph_nodes_examined"] == 0 ? 0 : (1.0 * result["lymph_nodes_positive"] / result["lymph_nodes_examined"]));
|
||||||
|
ratio = (ratio > 1 ? 1 : ratio);
|
||||||
|
T4 = (result["tumor_direct_extension"] == 1);
|
||||||
|
T1 = !T4 && (result["size"] <= 20);
|
||||||
|
T2 = !T4 && !T1 && (result["size"] > 20 && result["size"] <= 50);
|
||||||
|
T = (T4 ? 'T4' : (T1 ? 'T1' : (T2 ? 'T2' : 'T3')));
|
||||||
|
N0 = (result["lymph_nodes_positive"] == 0);
|
||||||
|
N1_or_N1mi = !N0 && (result["lymph_nodes_positive"] >= 1 && result["lymph_nodes_positive"] <= 3);
|
||||||
|
N1 = N1_or_N1mi && result["micrometastasis"] != 1;
|
||||||
|
N1mi = N1_or_N1mi && result["micrometastasis"] == 1;
|
||||||
|
N2 = !N0 && !N1_or_N1mi && (result["lymph_nodes_positive"] <= 9);
|
||||||
|
N = (N0 ? 'N0' : (N1 ? 'N1' : (N1mi ? 'N1mi' : (N2 ? 'N2' : 'N3'))));
|
||||||
|
M = (result["Distant_Metastasis"] != 1) ? 'M0' : 'M1';
|
||||||
|
pstage = (M == 'M1' ? 4 : ((T == 'T1' && (N == 'N0' || N == 'N1mi')) ? 1 : (((T == 'T2' || T == 'T3') && (N == 'N0')) || ((T == 'T1' || T == 'T2') && (N == 'N1')) ? 2 : 3)) );
|
||||||
|
nposit = ((ratio + 0.1) / 0.1) ** 0.5;
|
||||||
|
grade_2 = (result["grade"] == 2 || result["grade"] == 4) ? 1 : 0;
|
||||||
|
grade_3 = (result["grade"] == 3) ? 1 : 0;
|
||||||
|
subtype_1 = (result["ER_status"] != 2 || result["PR_status"] != 2) && (result["HER2_status"] != 1);
|
||||||
|
subtype_2 = !subtype_1 && (result["HER2_status"] == 1);
|
||||||
|
subtype_3 = !subtype_1 && !subtype_2 && (result["ER_status"] == 2 && result["PR_status"] == 2 && result["HER2_status"] != 1);
|
||||||
|
subtype_HER2 = subtype_2 ? 1 : 0;
|
||||||
|
subtype_triple = subtype_3 ? 1 : 0;
|
||||||
|
pstage_2 = (pstage == 2) ? 1 : 0;
|
||||||
|
pstage_3 = (pstage == 3) ? 1 : 0;
|
||||||
|
pstage_4 = (pstage == 4) ? 1 : 0;
|
||||||
|
lvi_yes = (result["lvi"] == 1) ? 1 : 0;
|
||||||
|
chemo = (result["Chemotherapy"] == 2) ? 1 : 0;
|
||||||
|
radio = (result["Radiotherapy"] == 2) ? 1 : 0;
|
||||||
|
hormone = (result["hormone_therapy"] == 2) ? 1 : 0;
|
||||||
|
target = (result["Targeted_therapy"] == 2) ? 1 : 0;
|
||||||
|
try{
|
||||||
|
lpv = ((age1-0.7276655)*(-10.87)+(age2+0.4540707)*8.968+(size1-0.643632)*0.7678+(nposit-1.346932)*0.5339+ grade_2*0.4795+grade_3*0.818+subtype_HER2*0.1806+subtype_triple*0.6457+pstage_2*0.5311+ pstage_3*1.134+pstage_4*2.172+lvi_yes*0.3321-0.04+chemo*(-0.4147)+radio*(-0.3203)+hormone*(-0.8397)+target*(-0.4687)
|
||||||
|
)
|
||||||
|
}catch(e){console.log(e)};
|
||||||
|
result['lpv_variable'] = {};
|
||||||
|
result['lpv_variable']['lpv'] = lpv;
|
||||||
|
result['lpv'] = lpv;
|
||||||
|
result['lpv_variable']['lpv'] = result['lpv'];
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
function calculate_and_change_result_value(obj){
|
||||||
|
obj.servive_ratio_arr = [];
|
||||||
|
for(var i = 0;i<obj.active_treatment.length;i++){
|
||||||
|
var servive_ratio = round(calculate_servive_ratio(obj.year,obj.lpv_real[i])*100,2);
|
||||||
|
var benefit = servive_ratio - obj.servive_ratio_arr[obj.servive_ratio_arr.length-1];
|
||||||
|
obj.servive_ratio_arr.push(servive_ratio);
|
||||||
|
$('tr.'+obj.active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||||
|
$('.'+obj.active_treatment[i]+'.Overall_Survival').html(Math.round(servive_ratio));
|
||||||
|
if(i != 0){
|
||||||
|
$('tr.'+obj.active_treatment[i]+' td.Additional_Benefit').html(round(benefit,2)+'%');
|
||||||
|
$('.'+obj.active_treatment[i]+'.Additional_Benefit').html(Math.round(benefit));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//$('.'+obj.active_treatment[0]+'.Overall_Survival').html(Math.round(obj.servive_ratio_arr[0]));
|
||||||
|
};
|
||||||
|
|
||||||
|
function calculate_servive_ratio(year,obj){
|
||||||
|
var servive_ratio;
|
||||||
|
var lpv = obj['lpv'];
|
||||||
|
switch(year) {
|
||||||
|
case '1':
|
||||||
|
servive_ratio = Math.exp(-0.001476145)**( Math.exp(lpv) );
|
||||||
|
break;
|
||||||
|
case '3':
|
||||||
|
servive_ratio = Math.exp(-0.01261639)**( Math.exp(lpv) );
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
|
servive_ratio = Math.exp(-0.02519608)**( Math.exp(lpv) );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log('not found year.');
|
||||||
|
}
|
||||||
|
return servive_ratio;
|
||||||
|
}
|
||||||
|
/* auto add end */
|
||||||
|
function submit_fcn(){
|
||||||
|
var post_json = get_input_data();
|
||||||
|
if(post_json != null){
|
||||||
|
post_json['locale'] = I18n.locale;
|
||||||
|
var result = $.post("/cancerpredictResult",{"data":post_json});
|
||||||
|
result.done(function(){
|
||||||
|
console.log(result.responseJSON);
|
||||||
|
set_result(result);
|
||||||
|
window.location.hash = '';
|
||||||
|
window.location.hash = '#cancer_predict_result_block';
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
$('#cancer_table_submit').click(function(){
|
||||||
|
submit_fcn();
|
||||||
|
});
|
||||||
|
for(var i = 0;i < $('.result_tab').length;i++){
|
||||||
|
$('.result_tab').eq(i).attr('index',i)
|
||||||
|
};
|
||||||
|
for(var i = 0;i < $('.result_content').length;i++){
|
||||||
|
$('.result_content').eq(i).attr('index',i)
|
||||||
|
};
|
||||||
|
$('.result_tab').click(function(){
|
||||||
|
var index = $(this).attr('index');
|
||||||
|
$('.result_tab').removeClass('active');
|
||||||
|
$(this).addClass('active');
|
||||||
|
$('.result_content').css('display','none');
|
||||||
|
$('.result_content[index="'+index+'"]').css('display','block');
|
||||||
|
})
|
||||||
|
$('.num_only').keypress(function(event){
|
||||||
|
return event.keyCode>=48&&event.keyCode<=57||(this.value.indexOf('.')<0?event.keyCode==46:false);
|
||||||
|
});
|
||||||
|
$('.float_num').off('keyup').on('keyup',function(){
|
||||||
|
this.value = this.value.replace(/[^\d.]/g,'');
|
||||||
|
});
|
||||||
|
$('.num_only').blur(function() {
|
||||||
|
if( Number($(this).val()) < $(this).data('range')[0] || $(this).val() == "" || (Number($(this).val()) > $(this).data('range')[1] && $(this).data('range')[1] != undefined) ){
|
||||||
|
$(this).css('color','#f24a69');
|
||||||
|
$(this).addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$(this).css('color','#333');
|
||||||
|
$(this).removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('select.select_num').off('click').on('click',function(){
|
||||||
|
$(this).change();
|
||||||
|
});
|
||||||
|
$('select.select_num').change(function(){
|
||||||
|
if(this.selectedIndex != 0){
|
||||||
|
$(this).siblings('input.num_only').val($(this).find('option').eq(this.selectedIndex).text());
|
||||||
|
$(this).siblings('input.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).siblings('input.num_only').css('color','#333');
|
||||||
|
}else{
|
||||||
|
$(this).siblings('input.num_only').addClass('cancertable_empty');
|
||||||
|
$(this).siblings('input.num_only').css('color','rgb(242, 74, 105)');
|
||||||
|
$(this).siblings('input.num_only').val($(this).val());
|
||||||
|
}
|
||||||
|
$(this).siblings('input.num_only_value').val($(this).val());
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('input#lymph_nodes_examined').siblings('select.select_num').off('change').on('change',function(){
|
||||||
|
var range = $('input#lymph_nodes_positive').data('range');
|
||||||
|
range[1] = Number($(this).val());
|
||||||
|
$('input#lymph_nodes_positive').data('range_new', range);
|
||||||
|
if(this.selectedIndex != 0){
|
||||||
|
$(this).siblings('input.num_only').val($(this).find('option').eq(this.selectedIndex).text());
|
||||||
|
$(this).siblings('input.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).siblings('input.num_only').css('color','#333');
|
||||||
|
}else{
|
||||||
|
$(this).siblings('input.num_only').addClass('cancertable_empty');
|
||||||
|
$(this).siblings('input.num_only').css('color','rgb(242, 74, 105)');
|
||||||
|
$(this).siblings('input.num_only').val($(this).val());
|
||||||
|
}
|
||||||
|
$(this).siblings('input.num_only_value').val($(this).val());
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
$(this).siblings('.num_only_value').val($(this).val());
|
||||||
|
if( Number($('input#lymph_nodes_positive').siblings('.num_only_value').val()) <= Number($(this).val()) ){
|
||||||
|
$('input#lymph_nodes_positive').css('color','#333');
|
||||||
|
$('input#lymph_nodes_positive').removeClass('cancertable_empty');
|
||||||
|
};
|
||||||
|
if( Number($(this).val()) < $(this).siblings('.num_only').data('range_new')[0] || $(this).val() == "" || (Number($(this).val()) > $(this).siblings('.num_only').data('range_new')[1] && $(this).siblings('.num_only').data('range_new')[1] != undefined) ){
|
||||||
|
$(this).siblings('.num_only').css('color','#f24a69');
|
||||||
|
$(this).siblings('.num_only').addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$(this).siblings('.num_only').css('color','#333');
|
||||||
|
$(this).siblings('.num_only').removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('input#lymph_nodes_positive').siblings('select.select_num').off('change').on('change',function(){
|
||||||
|
var range = $('input#lymph_nodes_examined').data('range');
|
||||||
|
range[0] = Number($(this).val());
|
||||||
|
$('input#lymph_nodes_examined').data('range_new', range);
|
||||||
|
if(this.selectedIndex != 0){
|
||||||
|
$(this).siblings('input.num_only').val($(this).find('option').eq(this.selectedIndex).text());
|
||||||
|
$(this).siblings('input.num_only').removeClass('cancertable_empty');
|
||||||
|
$(this).siblings('input.num_only').css('color','#333');
|
||||||
|
}else{
|
||||||
|
$(this).siblings('input.num_only').addClass('cancertable_empty');
|
||||||
|
$(this).siblings('input.num_only').css('color','rgb(242, 74, 105)');
|
||||||
|
$(this).siblings('input.num_only').val($(this).val());
|
||||||
|
}
|
||||||
|
$(this).siblings('input.num_only_value').val($(this).val());
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
$(this).siblings('.num_only_value').val($(this).val());
|
||||||
|
if( Number($('input#lymph_nodes_examined').siblings('.num_only_value').val()) >= Number($(this).val()) ){
|
||||||
|
$('input#lymph_nodes_examined').css('color','#333');
|
||||||
|
$('input#lymph_nodes_examined').removeClass('cancertable_empty');
|
||||||
|
};
|
||||||
|
if( Number($(this).val()) < $(this).siblings('.num_only').data('range_new')[0] || $(this).val() == "" || (Number($(this).val()) > $(this).siblings('.num_only').data('range_new')[1] && $(this).siblings('.num_only').data('range_new')[1] != undefined) ){
|
||||||
|
$(this).siblings('.num_only').css('color','#f24a69');
|
||||||
|
$(this).siblings('.num_only').addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$(this).siblings('.num_only').css('color','#333');
|
||||||
|
$(this).siblings('.num_only').removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$('select.select_num').blur(function() {
|
||||||
|
if( Number($(this).siblings('.num_only_value').val()) < $(this).siblings('.num_only').data('range')[0] || $(this).siblings('.num_only_value').val() == "" || (Number($(this).siblings('.num_only_value').val()) > $(this).siblings('.num_only').data('range')[1] && $(this).siblings('.num_only').data('range')[1] != undefined) ){
|
||||||
|
$(this).siblings('.num_only').css('color','#f24a69');
|
||||||
|
$(this).siblings('.num_only').addClass('cancertable_empty');
|
||||||
|
}else{
|
||||||
|
$(this).siblings('.num_only').css('color','#333');
|
||||||
|
$(this).siblings('.num_only').removeClass('cancertable_empty');
|
||||||
|
if($('.cancertable_empty').length == 0){
|
||||||
|
$('#danger_texts').remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if($(window).width() < 768)
|
||||||
|
$('#cancer_predict_result').attr('style','');
|
||||||
|
});
|
||||||
|
$(window).resize(function(){
|
||||||
|
if($(window).width() > 768){
|
||||||
|
if($('.cancer_table_right_result').length != 0)
|
||||||
|
$('#cancer_predict_result').css('float','right');
|
||||||
|
}else{
|
||||||
|
$('#cancer_predict_result').attr('style','');
|
||||||
|
};
|
||||||
|
if(I18n.locale == 'en'){
|
||||||
|
var window_width = $(window).width();
|
||||||
|
if(window_width < 520){
|
||||||
|
$('#cancer_table .cencer_table_name').css('max-width','');
|
||||||
|
}else if(window_width < 768){
|
||||||
|
$('#cancer_table .cencer_table_name').css({'max-width':'','width':'11em'});
|
||||||
|
}else if(window_width < 860){
|
||||||
|
$('#cancer_table .cencer_table_name').css('max-width','30%');
|
||||||
|
}else if(window_width < 1130){
|
||||||
|
$('#cancer_table .cencer_table_name').css('max-width','33%');
|
||||||
|
}else{
|
||||||
|
$('#cancer_table .cencer_table_name').css('max-width','39%');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
|
@ -9,7 +9,6 @@ if (typeof Math.imul == "undefined" || (Math.imul(0xffffffff, 5) == 0)) {
|
||||||
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
|
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* React v15.3.1
|
* React v15.3.1
|
||||||
*
|
*
|
||||||
|
@ -3105,7 +3104,7 @@ if (typeof Math.imul == "undefined" || (Math.imul(0xffffffff, 5) == 0)) {
|
||||||
null), React.createElement("p", null, "Which ", React.createElement("strong", null, "result tab"), " should appear first?"), Y(OQ(NB))), React.createElement("div", { className: "modal-footer" }, React.createElement("button", { type: "button", onClick: function () { return $("#settingsModal").modal("hide") }, className: "btn btn-default" }, "Close")))))
|
null), React.createElement("p", null, "Which ", React.createElement("strong", null, "result tab"), " should appear first?"), Y(OQ(NB))), React.createElement("div", { className: "modal-footer" }, React.createElement("button", { type: "button", onClick: function () { return $("#settingsModal").modal("hide") }, className: "btn btn-default" }, "Close")))))
|
||||||
}, new R(null, 1, 5, S, [aH], null), "settings-modal"); var $W = QG(function () { return Y(p(bH(FQ)) ? function () { sU("tool-postamble"); return new R(null, 4, 5, S, [gB, new m(null, 4, [ps, "button", nu, function () { return zQ.ma(null, "print") }, lC, function (a) { return B.h("Enter", a.nativeEvent.code) ? zQ.ma(null, "print") : null }, Ru, ni([Bn, Do, cp, dr, Fr, xt, $t, Gx, jy, xz, Uz], ["#ffffff", 16, 300, "#444466", 70, 10, 10, .5, "0.9375em 5px 0.9375em 5px", -1, "fixed"])], null), function () { var a = new m(null, 1, [Qm, DF], null); return XQ.h ? XQ.h(a, "print") : XQ.call(null, a, "print") }(), " Print"], null) }() : null) }, new R(null,
|
}, new R(null, 1, 5, S, [aH], null), "settings-modal"); var $W = QG(function () { return Y(p(bH(FQ)) ? function () { sU("tool-postamble"); return new R(null, 4, 5, S, [gB, new m(null, 4, [ps, "button", nu, function () { return zQ.ma(null, "print") }, lC, function (a) { return B.h("Enter", a.nativeEvent.code) ? zQ.ma(null, "print") : null }, Ru, ni([Bn, Do, cp, dr, Fr, xt, $t, Gx, jy, xz, Uz], ["#ffffff", 16, 300, "#444466", 70, 10, 10, .5, "0.9375em 5px 0.9375em 5px", -1, "fixed"])], null), function () { var a = new m(null, 1, [Qm, DF], null); return XQ.h ? XQ.h(a, "print") : XQ.call(null, a, "print") }(), " Print"], null) }() : null) }, new R(null,
|
||||||
1, 5, S, [aH], null), "results-footer"),is_submit={flag: true , submit_func: function(){var a = bH(FQ);return (cc(E(a)) || null == a)}} , aX = QG(function () {
|
1, 5, S, [aH], null), "results-footer"),is_submit={flag: true , submit_func: function(){var a = bH(FQ);return (cc(E(a)) || null == a)}} , aX = QG(function () {
|
||||||
var a = bH(FQ); console.log(cc(E(a)) || null == a);return is_submit.flag ? React.createElement("div", { className: "row" }, React.createElement("div", { className: "col-sm-10 col-sm-offset-1 col-xs-12" }, React.createElement("div", { style: { backgroundColor: "#d3e7fd", padding: "0.625em 0.625em 3px 0.625em", marginBottom: 20 } }, React.createElement("div", { style: { color: "#002e5d", fontSize: "1.25em" } }, React.createElement("p", { style: { paddingBottom: 0 } }, Y(function () {
|
var a = bH(FQ); /*important it's result*/return cc(E(a)) || null == a ? React.createElement("div", { className: "row" }, React.createElement("div", { className: "col-sm-10 col-sm-offset-1 col-xs-12" }, React.createElement("div", { style: { backgroundColor: "#d3e7fd", padding: "0.625em 0.625em 3px 0.625em", marginBottom: 20 } }, React.createElement("div", { style: { color: "#002e5d", fontSize: "1.25em" } }, React.createElement("p", { style: { paddingBottom: 0 } }, Y(function () {
|
||||||
var a = new m(null, 2, [Qm, DF, Ru, new m(null, 2, [Do, 35, iu, 8],
|
var a = new m(null, 2, [Qm, DF, Ru, new m(null, 2, [Do, 35, iu, 8],
|
||||||
null)], null); return XQ.h ? XQ.h(a, "info-circle") : XQ.call(null, a, "info-circle")
|
null)], null); return XQ.h ? XQ.h(a, "info-circle") : XQ.call(null, a, "info-circle")
|
||||||
}()), " Treatment options and results will appear here when you have filled in all the information needed above."))))) : React.createElement("div", null, React.createElement("div", { className: "row" }, React.createElement("div", { className: "col-md-6 clearfix" }, React.createElement("h3", null, "Treatment Options"), Y(VW.l ? VW.l() : VW.call(null))), function () {
|
}()), " Treatment options and results will appear here when you have filled in all the information needed above."))))) : React.createElement("div", null, React.createElement("div", { className: "row" }, React.createElement("div", { className: "col-md-6 clearfix" }, React.createElement("h3", null, "Treatment Options"), Y(VW.l ? VW.l() : VW.call(null))), function () {
|
||||||
|
|
|
@ -2,6 +2,87 @@
|
||||||
Place all the styles related to the matching controller here.
|
Place all the styles related to the matching controller here.
|
||||||
They will automatically be included in application.css.
|
They will automatically be included in application.css.
|
||||||
*/
|
*/
|
||||||
.table .expired{
|
thead > tr > th{
|
||||||
color: #BE2E2E;
|
border:1px solid;
|
||||||
|
background: bisque;
|
||||||
|
}
|
||||||
|
tbody{
|
||||||
|
background:white;
|
||||||
|
}
|
||||||
|
tbody > tr > td{
|
||||||
|
border:1px solid;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.show_li,.show_li *{
|
||||||
|
list-style:none;
|
||||||
|
color:balck;
|
||||||
|
}
|
||||||
|
.show_li ul{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
#clicktosee{
|
||||||
|
color:blue;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
table .checkbox{
|
||||||
|
left: 50%;
|
||||||
|
position: absolute;
|
||||||
|
transform: translate(-50%, -50%) !important;
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
#updatebtn{
|
||||||
|
margin-top: 1em;
|
||||||
|
right: 1em;
|
||||||
|
background-color: #0088cc;
|
||||||
|
color: white;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
}
|
||||||
|
.show_span{
|
||||||
|
margin: 1em;
|
||||||
|
float: left;
|
||||||
|
background-color: rgb(210, 105, 0);
|
||||||
|
color: white;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
.label_left{
|
||||||
|
float: left;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
}
|
||||||
|
.PageDetails {
|
||||||
|
padding-top: 0.1875em;
|
||||||
|
padding-bottom: 0.1875em;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.875em;
|
||||||
|
border-bottom: 0.0625em solid #ddd;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: right;
|
||||||
|
color: black;
|
||||||
|
font-size: 1.3em;
|
||||||
|
}
|
||||||
|
.PageList {
|
||||||
|
margin: 0em 0em 0 0.5em;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.875em;
|
||||||
|
overflow: hidden;
|
||||||
|
list-style: none;
|
||||||
|
display: inline;
|
||||||
|
background: none;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
ol {
|
||||||
|
margin: 0 0 0.5em 0;
|
||||||
|
min-height: 0.625em;
|
||||||
|
height: auto !important;
|
||||||
|
height: 0.625em;
|
||||||
|
padding: 0;
|
||||||
|
clear: both;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.PageList li {
|
||||||
|
display: inline;
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,392 @@
|
||||||
|
#cancer_table *[data-key]{
|
||||||
|
padding: 0.375em 0;
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.head_logo{
|
||||||
|
height: 4em;
|
||||||
|
}
|
||||||
|
.texts_under_result{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-top: 1em;
|
||||||
|
color: #5d7ca2;
|
||||||
|
}
|
||||||
|
th.cancer_th.Treatment {
|
||||||
|
width: 39%;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 48em){
|
||||||
|
.navbar-brand{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.num_group{
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
width: 5.125em;
|
||||||
|
height: 2.25em;
|
||||||
|
margin-left: 1.125em;
|
||||||
|
}
|
||||||
|
@media screen and (min-width: 93.75em){
|
||||||
|
.navbar-brand>img.head_logo{
|
||||||
|
width: 50%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (min-width: 48.125em) and (max-width: 93.625em){
|
||||||
|
.navbar-brand>img.head_logo{
|
||||||
|
width: 70%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.header-nav{
|
||||||
|
top:0 !important;
|
||||||
|
}
|
||||||
|
.title_texts{
|
||||||
|
color:rgb(210, 106, 2);
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.cencer_table_name{
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
color:#5d7ca2;
|
||||||
|
}
|
||||||
|
@media screen and (min-width: 71.125em){
|
||||||
|
#cancer_table .cencer_table_name{
|
||||||
|
width: 16.25em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (min-width: 28.375em) and (max-width: 71em){
|
||||||
|
#cancer_table .cencer_table_name{
|
||||||
|
width: 12.25em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 28.25em){
|
||||||
|
#cancer_table .cencer_table_name{
|
||||||
|
width: 7em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#cancer_predict_result_block .cencer_table_name{
|
||||||
|
width: 5em;
|
||||||
|
}
|
||||||
|
.cancer_table_btn{
|
||||||
|
margin-right: 0.5em;
|
||||||
|
color:#5d7ca2;
|
||||||
|
border-color: #5d7ca2;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.cancer_table_btn::last-of-type{
|
||||||
|
margin-right:auto;
|
||||||
|
}
|
||||||
|
#cancer_table{
|
||||||
|
font-size:0.825em;
|
||||||
|
color:#5d7ca2;
|
||||||
|
}
|
||||||
|
#cancer_table_top{
|
||||||
|
padding-bottom: 4em;
|
||||||
|
}
|
||||||
|
#font_texts{
|
||||||
|
padding-right: 0.5em;
|
||||||
|
}
|
||||||
|
#text_describe{
|
||||||
|
font-weight: bold;
|
||||||
|
float: left;
|
||||||
|
max-width: 75%;
|
||||||
|
padding-bottom: 3em;
|
||||||
|
}
|
||||||
|
#font_size_choices{
|
||||||
|
font-weight: bold;
|
||||||
|
float: right;
|
||||||
|
max-width: 50%;
|
||||||
|
padding-left:1em;
|
||||||
|
}
|
||||||
|
form.for_num{
|
||||||
|
position: relative;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
select.select_num{
|
||||||
|
position: absolute;
|
||||||
|
width: 4.3em;
|
||||||
|
height: 1.75em;
|
||||||
|
left: 0em;
|
||||||
|
clip: rect(0.25em, 4.3em, 1.5em,3.3em);
|
||||||
|
border:none;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
input.num_only{
|
||||||
|
margin-left: 0;
|
||||||
|
color: black;
|
||||||
|
border-top: 0.125em solid rgb(221, 221, 221);
|
||||||
|
width: 5.125em;
|
||||||
|
padding: 0em 0em 0.25em;
|
||||||
|
border-left: 0.125em solid rgb(221, 221, 221);
|
||||||
|
text-align: center;
|
||||||
|
font-size: 0.875em;
|
||||||
|
background-color: rgb(255, 255, 255);
|
||||||
|
height: 2.25em;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
input.float_num{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
#cancer_table_left{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
#cancer_table_right{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
#cancer_table_submit{
|
||||||
|
margin-left: 1em;
|
||||||
|
float: right;
|
||||||
|
background-color: rgb(210, 105, 0);
|
||||||
|
color: white;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
font-size: 1.25em;
|
||||||
|
}
|
||||||
|
#cancer_table_reset{
|
||||||
|
float: right;
|
||||||
|
background-color: rgb(210, 105, 0);
|
||||||
|
color: white;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
font-size: 1.25em;
|
||||||
|
}
|
||||||
|
.btn-sub{
|
||||||
|
background:url("/assets/cancerpredict/triangle_sub.png") no-repeat top transparent;
|
||||||
|
position: relative;
|
||||||
|
width: 1.875em;
|
||||||
|
border: 0;
|
||||||
|
height: 1.875em;
|
||||||
|
background-size: contain;
|
||||||
|
top:1em;
|
||||||
|
bottom: -0.7em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.btn-add{
|
||||||
|
background:url("/assets/cancerpredict/triangle_add.png") no-repeat top transparent;
|
||||||
|
position: relative;
|
||||||
|
width: 1.875em;
|
||||||
|
border: 0;
|
||||||
|
height: 1.875em;
|
||||||
|
background-size: contain;
|
||||||
|
right: 1.815em;
|
||||||
|
top: -0.3em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.cancer_table_btn:focus{
|
||||||
|
color: #5d7ca2 !important;
|
||||||
|
background-color: #9dc3e6 !important;
|
||||||
|
border-color: #8c8c8c !important;
|
||||||
|
}
|
||||||
|
.cancer_table_btn:hover{
|
||||||
|
color: #5d7ca2 !important;
|
||||||
|
background-color: #9dc3e6 !important;
|
||||||
|
border-color: #8c8c8c !important;
|
||||||
|
}
|
||||||
|
.cancer_table_btn.active{
|
||||||
|
color: #5d7ca2;
|
||||||
|
background-color: #9dc3e6;
|
||||||
|
border-color: #8c8c8c;
|
||||||
|
}
|
||||||
|
.cancertable_empty{
|
||||||
|
border: 0.25em solid pink !important;
|
||||||
|
border-radius: 0.5em !important;
|
||||||
|
padding: 0.125em !important;
|
||||||
|
}
|
||||||
|
.result_title{
|
||||||
|
background-color: rgb(210, 105, 0);
|
||||||
|
color: white;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
font-size: 1.25em;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.result_tab{
|
||||||
|
background: #023d79;
|
||||||
|
background: linear-gradient(135deg, transparent 0.3em, #023d79 0);
|
||||||
|
border: none;
|
||||||
|
float:right;
|
||||||
|
padding: 0.5em 0.125em 0.5em 0.5em;
|
||||||
|
margin-top: 0.5em;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
#cancer_table a:hover{
|
||||||
|
text-decoration: none;
|
||||||
|
color: #5d7ca2;
|
||||||
|
}
|
||||||
|
#result_contents{
|
||||||
|
padding-top: 1em;
|
||||||
|
}
|
||||||
|
#choice_fields{
|
||||||
|
padding: 2em 0 0 calc(20% - 1.625em);
|
||||||
|
}
|
||||||
|
.result_tab:hover{
|
||||||
|
background: #d16801;
|
||||||
|
background: linear-gradient(135deg, transparent 0.3em, #d16801 0);
|
||||||
|
padding: 0.8em 0.125em 0.5em 1em;
|
||||||
|
margin-left: -0.5em;
|
||||||
|
}
|
||||||
|
.result_tab.active{
|
||||||
|
background: #d16801;
|
||||||
|
background: linear-gradient(135deg, transparent 0.3em, #d16801 0);
|
||||||
|
padding: 0.8em 0.125em 0.5em 1em;
|
||||||
|
margin-left: -0.5em;
|
||||||
|
}
|
||||||
|
.result_tab > a{
|
||||||
|
writing-mode: vertical-lr;
|
||||||
|
-webkit-writing-mode: vertical-lr;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.result_tab_group{
|
||||||
|
width: 15%;
|
||||||
|
margin: 0;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.result_content_group{
|
||||||
|
width: 85%;
|
||||||
|
margin: 0;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.result_content{
|
||||||
|
display: none;
|
||||||
|
min-height: 25em;
|
||||||
|
border: 0.125em solid #c0cbdd;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
.result_content:first-of-type{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.result_content a{
|
||||||
|
color: #5d7ca2;
|
||||||
|
}
|
||||||
|
.result_content p{
|
||||||
|
color: #5d7ca2;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.cancer_years{
|
||||||
|
float:left;
|
||||||
|
color: #5d7ca2;
|
||||||
|
background-color: #fff;
|
||||||
|
border-color: #5d7ca2;
|
||||||
|
border-width: 0.125em;
|
||||||
|
margin: 0em;
|
||||||
|
}
|
||||||
|
.cancer_years:first-of-type{
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
.cancer_years:last-of-type{
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
.cancer_form_field{
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
#result_table_content a{
|
||||||
|
float:left;
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
.result_content span{
|
||||||
|
color: #5d7ca2;
|
||||||
|
}
|
||||||
|
.hint-texts{
|
||||||
|
color: rgb(104, 104, 104);
|
||||||
|
font-size: 0.75em;
|
||||||
|
clear: both;
|
||||||
|
padding: 0.5em 0;
|
||||||
|
}
|
||||||
|
#result_text_content a{
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
#result_table_content table{
|
||||||
|
clear: both;
|
||||||
|
width:100%;
|
||||||
|
table-layout: fixed;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
#result_table_content table tbody tr{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#result_table_content table tbody tr:first-of-type{
|
||||||
|
display: table-row;
|
||||||
|
}
|
||||||
|
.white_text,.white_text:link,.white_text:visited{
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
.cancer_th{
|
||||||
|
color: white;
|
||||||
|
background-color: #003d79;
|
||||||
|
border-right: 0.375em solid white;
|
||||||
|
border-top: 0.375em solid white;
|
||||||
|
}
|
||||||
|
.cancer_td {
|
||||||
|
background-color: #e9eaf5;
|
||||||
|
border-right: 0.375em solid white;
|
||||||
|
border-top: 0.375em solid white;
|
||||||
|
}
|
||||||
|
#cancer_predict_result_block{
|
||||||
|
display:none;
|
||||||
|
font-size: 0.825em;
|
||||||
|
margin-top: 3em;
|
||||||
|
border-top: #666 solid;
|
||||||
|
padding-top: 2em;
|
||||||
|
}
|
||||||
|
p.texts_show{
|
||||||
|
display: list-item;
|
||||||
|
margin-left: 1.5em;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
div.texts_show{
|
||||||
|
display: block;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
.addition{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#cancer_table_right_result .cancer_table_btn{
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
}
|
||||||
|
#cancer_table_left_result .cancer_table_btn{
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
}
|
||||||
|
.modal-dialog {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%) !important;
|
||||||
|
overflow: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
#cancer_predict_result{
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
@media screen and (min-width: 48em) {
|
||||||
|
#cancer_table_right{
|
||||||
|
float:right;
|
||||||
|
width:50%;
|
||||||
|
}
|
||||||
|
#cancer_table_left{
|
||||||
|
float:left;
|
||||||
|
width:50%;
|
||||||
|
}
|
||||||
|
#cancer_table_right_result{
|
||||||
|
width: 50%;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#cancer_table_left_result{
|
||||||
|
width: 50%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
#cancer_predict_result{
|
||||||
|
width: 50%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.result_title{
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.print_only{
|
||||||
|
display: none;
|
||||||
|
}
|
|
@ -0,0 +1,402 @@
|
||||||
|
@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css);
|
||||||
|
button, input, optgroup, select, textarea {
|
||||||
|
margin: 0;
|
||||||
|
font: inherit;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
.fa {
|
||||||
|
display: inline-block;
|
||||||
|
font: normal normal normal 14px/1 FontAwesome;
|
||||||
|
font-size: inherit;
|
||||||
|
text-rendering: auto;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
transform: translate(0, 0);
|
||||||
|
}
|
||||||
|
.fa-question:before {
|
||||||
|
content: "\f128";
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
button, input, select, textarea {
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
#cancer_table *[data-key]{
|
||||||
|
padding: 0.375em 0;
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.head_logo{
|
||||||
|
height: 4em;
|
||||||
|
}
|
||||||
|
.texts_under_result{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-top: 1em;
|
||||||
|
color: #5d7ca2;
|
||||||
|
}
|
||||||
|
th.cancer_th.Treatment {
|
||||||
|
width: 39%;
|
||||||
|
}
|
||||||
|
div.num_group{
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
width: 5.125em;
|
||||||
|
height: 2.25em;
|
||||||
|
margin-left: 1.125em;
|
||||||
|
}
|
||||||
|
.navbar-brand>img.head_logo{
|
||||||
|
width: 70%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.header-nav{
|
||||||
|
top:0 !important;
|
||||||
|
}
|
||||||
|
.title_texts{
|
||||||
|
color:rgb(210, 106, 2);
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.cencer_table_name{
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
color:#5d7ca2 !important;
|
||||||
|
}
|
||||||
|
#cancer_table .cencer_table_name{
|
||||||
|
width: 16.25em;
|
||||||
|
}
|
||||||
|
#cancer_predict_result_block .cencer_table_name{
|
||||||
|
width: 5em;
|
||||||
|
}
|
||||||
|
.cancer_help_btn{
|
||||||
|
background-color: rgb(210, 106, 2) !important;
|
||||||
|
border-color: rgb(210, 106, 2) !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
.cancer_help_btn i:before {
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
.cancer_table_btn{
|
||||||
|
margin-right: 0.5em;
|
||||||
|
color:#5d7ca2 !important;
|
||||||
|
border-color: #5d7ca2 !important;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.cancer_table_btn::last-of-type{
|
||||||
|
margin-right:auto;
|
||||||
|
}
|
||||||
|
#cancer_table{
|
||||||
|
font-size:0.825em;
|
||||||
|
color:#5d7ca2;
|
||||||
|
}
|
||||||
|
@media print{
|
||||||
|
#cancer_table_top{
|
||||||
|
padding-bottom: 4em;
|
||||||
|
}
|
||||||
|
#font_texts{
|
||||||
|
padding-right: 0.5em;
|
||||||
|
}
|
||||||
|
#text_describe{
|
||||||
|
font-weight: bold;
|
||||||
|
float: left;
|
||||||
|
max-width: 75%;
|
||||||
|
padding-bottom: 3em;
|
||||||
|
}
|
||||||
|
#font_size_choices{
|
||||||
|
font-weight: bold;
|
||||||
|
float: right;
|
||||||
|
max-width: 50%;
|
||||||
|
padding-left:1em;
|
||||||
|
}
|
||||||
|
form.for_num{
|
||||||
|
position: relative;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
select.select_num{
|
||||||
|
position: absolute;
|
||||||
|
width: 4.3em;
|
||||||
|
height: 1.75em;
|
||||||
|
left: 0em;
|
||||||
|
clip: rect(0.25em, 4.3em, 1.5em,3.3em);
|
||||||
|
border:none;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
input.num_only{
|
||||||
|
margin-left: 0;
|
||||||
|
color: black;
|
||||||
|
border-top: 0.125em solid rgb(221, 221, 221);
|
||||||
|
width: 5.125em;
|
||||||
|
padding: 0em 0em 0.25em;
|
||||||
|
border-left: 0.125em solid rgb(221, 221, 221);
|
||||||
|
text-align: center;
|
||||||
|
font-size: 0.875em;
|
||||||
|
background-color: rgb(255, 255, 255) !important;
|
||||||
|
height: 2.25em;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
input.float_num{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
#cancer_table_left{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
#cancer_table_right{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
#cancer_table_submit{
|
||||||
|
margin-left: 1em;
|
||||||
|
float: right;
|
||||||
|
background-color: rgb(210, 105, 0) !important;
|
||||||
|
color: white !important;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
font-size: 1.25em;
|
||||||
|
}
|
||||||
|
#cancer_table_reset{
|
||||||
|
float: right;
|
||||||
|
background-color: rgb(210, 105, 0) !important;
|
||||||
|
color: white !important;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
font-size: 1.25em;
|
||||||
|
}
|
||||||
|
.btn-sub{
|
||||||
|
background:url("/assets/cancerpredict/triangle_sub.png") no-repeat top transparent;
|
||||||
|
position: relative;
|
||||||
|
width: 1.875em;
|
||||||
|
border: 0;
|
||||||
|
height: 1.875em;
|
||||||
|
background-size: contain;
|
||||||
|
top:1em;
|
||||||
|
bottom: -0.7em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.btn-add{
|
||||||
|
background:url("/assets/cancerpredict/triangle_add.png") no-repeat top transparent;
|
||||||
|
position: relative;
|
||||||
|
width: 1.875em;
|
||||||
|
border: 0;
|
||||||
|
height: 1.875em;
|
||||||
|
background-size: contain;
|
||||||
|
right: 1.815em;
|
||||||
|
top: -0.3em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.cancer_table_btn:focus{
|
||||||
|
color: #5d7ca2 !important;
|
||||||
|
background-color: #9dc3e6 !important;
|
||||||
|
border-color: #8c8c8c !important;
|
||||||
|
}
|
||||||
|
.cancer_table_btn:hover{
|
||||||
|
color: #5d7ca2 !important;
|
||||||
|
background-color: #9dc3e6 !important;
|
||||||
|
border-color: #8c8c8c !important;
|
||||||
|
}
|
||||||
|
.cancer_table_btn.active{
|
||||||
|
color: #5d7ca2 !important;
|
||||||
|
background-color: #9dc3e6 !important;
|
||||||
|
border-color: #8c8c8c !important;
|
||||||
|
}
|
||||||
|
.cancertable_empty{
|
||||||
|
border: 0.25em solid pink !important;
|
||||||
|
border-radius: 0.5em !important;
|
||||||
|
padding: 0.125em !important;
|
||||||
|
}
|
||||||
|
.result_title{
|
||||||
|
background-color: rgb(210, 105, 0) !important;
|
||||||
|
color: white !important;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
font-size: 1.25em;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.result_tab{
|
||||||
|
background: #023d79 !important;
|
||||||
|
background: linear-gradient(135deg, transparent 0.3em, #023d79 0) !important;
|
||||||
|
border: none;
|
||||||
|
float:right;
|
||||||
|
padding: 0.5em 0.125em 0.5em 0.5em;
|
||||||
|
margin-top: 0.5em;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
#cancer_table a:hover{
|
||||||
|
text-decoration: none;
|
||||||
|
color: #5d7ca2;
|
||||||
|
}
|
||||||
|
#result_contents{
|
||||||
|
padding-top: 1em;
|
||||||
|
}
|
||||||
|
#choice_fields{
|
||||||
|
padding: 2em 0 0 calc(20% - 1.625em);
|
||||||
|
}
|
||||||
|
.result_tab:hover{
|
||||||
|
background: #d16801;
|
||||||
|
background: linear-gradient(135deg, transparent 0.3em, #d16801 0);
|
||||||
|
padding: 0.8em 0.125em 0.5em 1em;
|
||||||
|
margin-left: -0.5em;
|
||||||
|
}
|
||||||
|
.result_tab.active{
|
||||||
|
background: #d16801 !important;
|
||||||
|
background: linear-gradient(135deg, transparent 0.3em, #d16801 0) !important;
|
||||||
|
padding: 0.8em 0.125em 0.5em 1em;
|
||||||
|
margin-left: -0.5em;
|
||||||
|
}
|
||||||
|
.result_tab > a{
|
||||||
|
writing-mode: vertical-lr !important;
|
||||||
|
-webkit-writing-mode: vertical-lr !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
.result_tab_group{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.result_content_group{
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
.result_content{
|
||||||
|
display: block;
|
||||||
|
min-height: 25em;
|
||||||
|
border: 0.125em solid #c0cbdd !important;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
.result_content:first-of-type{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.result_content a{
|
||||||
|
color: #5d7ca2;
|
||||||
|
}
|
||||||
|
.result_content span{
|
||||||
|
color: #5d7ca2;
|
||||||
|
}
|
||||||
|
.result_content p{
|
||||||
|
color: #5d7ca2;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.cancer_years{
|
||||||
|
float:left;
|
||||||
|
color: #5d7ca2;
|
||||||
|
background-color: #fff;
|
||||||
|
border-color: #5d7ca2;
|
||||||
|
border-width: 0.125em;
|
||||||
|
margin: 0em;
|
||||||
|
}
|
||||||
|
.cancer_years:first-of-type{
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
.cancer_years:last-of-type{
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
.cancer_form_field{
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
#result_table_content a{
|
||||||
|
float:left;
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
.hint-texts{
|
||||||
|
color: rgb(104, 104, 104);
|
||||||
|
font-size: 0.75em;
|
||||||
|
clear: both;
|
||||||
|
padding: 0.5em 0;
|
||||||
|
}
|
||||||
|
#result_text_content a{
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
#result_table_content table{
|
||||||
|
clear: both;
|
||||||
|
width:100%;
|
||||||
|
table-layout: fixed;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
#result_table_content table tbody tr{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#result_table_content table tbody tr:first-of-type{
|
||||||
|
display: table-row;
|
||||||
|
}
|
||||||
|
.white_text,.white_text:link,.white_text:visited{
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
.cancer_th{
|
||||||
|
color: white !important;
|
||||||
|
background-color: #003d79 !important;
|
||||||
|
border-right: 0.375em solid white;
|
||||||
|
border-top: 0.375em solid white;
|
||||||
|
}
|
||||||
|
.cancer_td {
|
||||||
|
background-color: #e9eaf5 !important;
|
||||||
|
border-right: 0.375em solid white;
|
||||||
|
border-top: 0.375em solid white;
|
||||||
|
}
|
||||||
|
#cancer_predict_result_block{
|
||||||
|
display:none;
|
||||||
|
font-size: 0.825em;
|
||||||
|
margin-top: 3em;
|
||||||
|
border-top: #666 solid;
|
||||||
|
padding-top: 2em;
|
||||||
|
}
|
||||||
|
p.texts_show{
|
||||||
|
display: list-item;
|
||||||
|
margin-left: 1.5em;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
div.texts_show{
|
||||||
|
display: block;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
.addition{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#cancer_table_right_result .cancer_table_btn{
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
}
|
||||||
|
#cancer_table_left_result .cancer_table_btn{
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
}
|
||||||
|
.modal-dialog {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%) !important;
|
||||||
|
overflow: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
#cancer_predict_result{
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
#cancer_table_right{
|
||||||
|
float:right;
|
||||||
|
width:50%;
|
||||||
|
}
|
||||||
|
#cancer_table_left{
|
||||||
|
float:left;
|
||||||
|
width:50%;
|
||||||
|
}
|
||||||
|
#cancer_table_right_result{
|
||||||
|
width: 50%;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#cancer_table_left_result{
|
||||||
|
width: 50%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
#cancer_predict_result{
|
||||||
|
width: 50%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.result_title{
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
* {
|
||||||
|
-webkit-print-color-adjust: exact !important;
|
||||||
|
}
|
||||||
|
.layout-content{
|
||||||
|
background: #fff !important;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,21 +1,718 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require 'rubyXL'
|
|
||||||
class Admin::CancerpredictsController < OrbitAdminController
|
class Admin::CancerpredictsController < OrbitAdminController
|
||||||
|
require "spreadsheet"
|
||||||
|
require "rubyXL"
|
||||||
|
require "fileutils"
|
||||||
|
require "axlsx"
|
||||||
|
require "csv"
|
||||||
#include Admin::CancerpredictsHelper
|
#include Admin::CancerpredictsHelper
|
||||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||||
|
before_action :create_first_field
|
||||||
|
helper Admin::CancerpredictsHelper
|
||||||
#before_action :load_access_levels
|
#before_action :load_access_levels
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@app_title = "cancerpredict"
|
@app_title = "cancerpredict"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def yaml_load(v)
|
||||||
|
YAML.load(v)
|
||||||
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@tags = @module_app.tags
|
@tags = @module_app.tags
|
||||||
@categories = @module_app.categories.enabled
|
@categories = @module_app.categories.enabled
|
||||||
@filter_fields = filter_fields(@categories, @tags)
|
@filter_fields = filter_fields(@categories, @tags)
|
||||||
@table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified]
|
@table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified]
|
||||||
if request.xhr?
|
@head_images_id = @form_to_show.head_images_id
|
||||||
render :partial => "index"
|
@title_images_id = @form_to_show.title_images_id
|
||||||
|
@head_images = []
|
||||||
|
@title_images = []
|
||||||
|
@head_images_id.each { |image_id| @head_images.push Headimages.find_by(:id => image_id.to_s) } rescue nil
|
||||||
|
@title_images_id.each { |image_id| @title_images.push Headimages.find_by(:id => image_id.to_s) } rescue nil
|
||||||
|
@head_new_image = Headimages.new(:cancerpredictfields_id => @form_to_show.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
other_in_use_locales = Site.first.in_use_locales.map { |l| l.to_s }
|
||||||
|
other_in_use_locales.delete(params[:locale])
|
||||||
|
if !(params["cancerpredictfields"].nil?)
|
||||||
|
if !(params["cancerpredictfields"]["form_show"].nil?)
|
||||||
|
params["cancerpredictfields"]["form_show"].each do |num, property|
|
||||||
|
property.each do |key, value|
|
||||||
|
if key.include?("_file") && (!value[:temp_file].blank? rescue false)
|
||||||
|
if value[:id].nil?
|
||||||
|
mapping_file = CancerPredictMappingFile.create(value)
|
||||||
|
else
|
||||||
|
mapping_file = CancerPredictMappingFile.find(value[:id])
|
||||||
|
mapping_file.temp_file = value[:temp_file]
|
||||||
|
mapping_file.save
|
||||||
|
end
|
||||||
|
@form_to_show.form_show[num.to_s][key.to_s] = mapping_file.id
|
||||||
|
elsif key.include?("_file")
|
||||||
|
if value[:_destroy] == "1"
|
||||||
|
mapping_file = CancerPredictMappingFile.find(value[:id])
|
||||||
|
mapping_file.destroy
|
||||||
|
@form_to_show.form_show[num.to_s][key.to_s] = ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
next if key.include?("_file")
|
||||||
|
if (key != "old_num")
|
||||||
|
if key != params[:locale]
|
||||||
|
@form_to_show.form_show[num.to_s] = {} if @form_to_show.form_show[num.to_s].nil?
|
||||||
|
type = Cancerpredictfields::FIELDINFO[key.to_s]
|
||||||
|
if type && Cancerpredictfields::Field_relations[type]
|
||||||
|
type = Cancerpredictfields::Field_relations[type]
|
||||||
|
end
|
||||||
|
type = type.constantize rescue String
|
||||||
|
if type != Array
|
||||||
|
if type == Fixnum
|
||||||
|
@form_to_show.form_show[num.to_s][key.to_s] = value.to_i rescue 0
|
||||||
|
elsif type == Float
|
||||||
|
@form_to_show.form_show[num.to_s][key.to_s] = value.to_f rescue 0.0
|
||||||
|
else
|
||||||
|
@form_to_show.form_show[num.to_s][key.to_s] = value
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if value.length > 2
|
||||||
|
@form_to_show.form_show[num.to_s][key.to_s] = yaml_load(value)
|
||||||
|
else
|
||||||
|
@form_to_show.form_show[num.to_s][key.to_s] = []
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
value.each do |sub_property, sub_value|
|
||||||
|
type = Cancerpredictfields::FIELDINFO[sub_property.to_s]
|
||||||
|
if type && Cancerpredictfields::Field_relations[type]
|
||||||
|
type = Cancerpredictfields::Field_relations[type]
|
||||||
|
end
|
||||||
|
type = type.constantize rescue String
|
||||||
|
@form_to_show.form_show[num.to_s][sub_property] = {} if @form_to_show.form_show[num.to_s][sub_property].nil?
|
||||||
|
if type != Array
|
||||||
|
if type == Fixnum
|
||||||
|
@form_to_show.form_show[num.to_s][sub_property][params[:locale].to_s] = sub_value.to_i rescue 0
|
||||||
|
elsif type == Float
|
||||||
|
@form_to_show.form_show[num.to_s][sub_property][params[:locale].to_s] = sub_value.to_f rescue 0.0
|
||||||
|
else
|
||||||
|
@form_to_show.form_show[num.to_s][sub_property][params[:locale].to_s] = sub_value
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if sub_value.length > 2
|
||||||
|
@form_to_show.form_show[num.to_s][sub_property][params[:locale].to_s] = yaml_load(sub_value)
|
||||||
|
else
|
||||||
|
@form_to_show.form_show[num.to_s][sub_property][params[:locale].to_s] = []
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (property["old_num"].present? && property["old_num"] != num.to_s)
|
||||||
|
other_in_use_locales.each do |locale|
|
||||||
|
@form_to_show.form_show[num.to_s][sub_property][locale] = @form_to_show.form_show_was[property["old_num"]][sub_property][locale]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
org_nums = @form_to_show.form_show_was.keys
|
||||||
|
remain_org_nums = params["cancerpredictfields"]["form_show"].values.map { |property| property["old_num"] }.select { |n| n.present? }
|
||||||
|
delete_nums = org_nums - remain_org_nums
|
||||||
|
if !delete_nums.blank?
|
||||||
|
delete_nums.each do |delete_num|
|
||||||
|
@form_to_show.form_show.delete(delete_num)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@form_to_show.form_show = @form_to_show.form_show.values.map.with_index { |v, i| [i.to_s, v] }.to_h
|
||||||
|
else
|
||||||
|
@form_to_show.form_show = {}
|
||||||
|
end
|
||||||
|
if !params["cancerpredictfields"]["form_show_in_result"].nil?
|
||||||
|
params["cancerpredictfields"]["form_show_in_result"].each do |num, property|
|
||||||
|
property.each do |key, value|
|
||||||
|
if key.include?("_file") && (!value[:temp_file].blank? rescue false)
|
||||||
|
if value[:id].nil?
|
||||||
|
mapping_file = CancerPredictMappingFile.create(value)
|
||||||
|
else
|
||||||
|
mapping_file = CancerPredictMappingFile.find(value[:id])
|
||||||
|
mapping_file.temp_file = value[:temp_file]
|
||||||
|
mapping_file.save
|
||||||
|
end
|
||||||
|
@form_to_show.form_show[num.to_s][key.to_s] = mapping_file.id
|
||||||
|
elsif key.include?("_file")
|
||||||
|
if value[:_destroy] == "1"
|
||||||
|
mapping_file = CancerPredictMappingFile.find(value[:id])
|
||||||
|
mapping_file.destroy
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][key.to_s] = ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
next if key.include?("_file")
|
||||||
|
if (key != "old_num")
|
||||||
|
if key != params[:locale]
|
||||||
|
@form_to_show.form_show_in_result[num.to_s] = {} if @form_to_show.form_show_in_result[num.to_s].nil?
|
||||||
|
type = Cancerpredictfields::FIELDINFO[key.to_s]
|
||||||
|
if type && Cancerpredictfields::Field_relations[type]
|
||||||
|
type = Cancerpredictfields::Field_relations[type]
|
||||||
|
end
|
||||||
|
type = type.constantize rescue String
|
||||||
|
if type != Array
|
||||||
|
if type == Fixnum
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value.to_i rescue 0
|
||||||
|
elsif type == Float
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value.to_f rescue 0.0
|
||||||
|
else
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if value.length > 2
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][key.to_s] = yaml_load(value)
|
||||||
|
else
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][key.to_s] = []
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
value.each do |sub_property, sub_value|
|
||||||
|
type = Cancerpredictfields::FIELDINFO[sub_property.to_s]
|
||||||
|
if type && Cancerpredictfields::Field_relations[type]
|
||||||
|
type = Cancerpredictfields::Field_relations[type]
|
||||||
|
end
|
||||||
|
type = type.constantize rescue String
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][sub_property] = {} if @form_to_show.form_show_in_result[num.to_s][sub_property].nil?
|
||||||
|
if type != Array
|
||||||
|
if type == Fixnum
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][sub_property][params[:locale].to_s] = sub_value.to_i rescue 0
|
||||||
|
elsif type == Float
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][sub_property][params[:locale].to_s] = sub_value.to_f rescue 0.0
|
||||||
|
else
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][sub_property][params[:locale].to_s] = sub_value
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if sub_value.length > 2
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][sub_property][params[:locale].to_s] = yaml_load(sub_value)
|
||||||
|
else
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][sub_property][params[:locale].to_s] = []
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (property["old_num"].present? && property["old_num"] != num.to_s)
|
||||||
|
other_in_use_locales.each do |locale|
|
||||||
|
@form_to_show.form_show_in_result[num.to_s][sub_property][locale] = @form_to_show.form_show_was[property["old_num"]][sub_property][locale]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
org_nums = @form_to_show.form_show_in_result_was.keys
|
||||||
|
remain_org_nums = params["cancerpredictfields"]["form_show_in_result"].values.map { |property| property["old_num"] }.select { |n| n.present? }
|
||||||
|
delete_nums = org_nums - remain_org_nums
|
||||||
|
if !delete_nums.blank?
|
||||||
|
delete_nums.each do |delete_num|
|
||||||
|
@form_to_show.form_show_in_result.delete(delete_num)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@form_to_show.form_show_in_result = @form_to_show.form_show_in_result.values.map.with_index { |v, i| [i.to_s, v] }.to_h
|
||||||
|
else
|
||||||
|
@form_to_show.form_show_in_result = {}
|
||||||
|
end
|
||||||
|
@create_items = ["title_texts", "form_result_is_right", "text_descibe", "years", "table_above_texts", "text_above_texts", "surgery_only_texts", "extra_texts", "extra_therapy_texts", "danger_texts", "texts_between_Result_and_result_block", "prediction_formula", "hidden_variables", "advance_mode", "years_settings"]
|
||||||
|
params_cancer = params.require("cancerpredictfields").permit!
|
||||||
|
@create_items.each do |item|
|
||||||
|
if (@form_to_show[item].class == BSON::Document) || (@form_to_show.send(item).class == Hash)
|
||||||
|
item_hash = @form_to_show[item]
|
||||||
|
item_hash = item_hash.merge(params_cancer[item])
|
||||||
|
@form_to_show[item] = item_hash
|
||||||
|
elsif @form_to_show[item].class == Array
|
||||||
|
if params_cancer[item].class != Array
|
||||||
|
@form_to_show[item] = yaml_load(params_cancer[item]) rescue []
|
||||||
|
else
|
||||||
|
@form_to_show[item] = params_cancer[item]
|
||||||
|
end
|
||||||
|
@form_to_show[item] = [] if @form_to_show[item].class != Array
|
||||||
|
else
|
||||||
|
@form_to_show[item] = params_cancer[item]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@size = ["small", "medium", "large"]
|
||||||
|
@size.each { |size| @form_to_show[size] = params["cancerpredictfields"][size].to_h }
|
||||||
|
@file_path = Rails.root.to_s + "/app/assets/images/predict_tool"
|
||||||
|
if !Dir.exist? @file_path
|
||||||
|
FileUtils.mkdir_p @file_path
|
||||||
|
end
|
||||||
|
@images = params["cancerpredictfields"]["head_images"]
|
||||||
|
@head_images_id = @form_to_show.head_images_id
|
||||||
|
@delete_index = []
|
||||||
|
if !@images.nil?
|
||||||
|
@images.each do |num, image|
|
||||||
|
if num.to_i < @head_images_id.length && @head_images_id.length != 0
|
||||||
|
if image["remove_image"] == "1"
|
||||||
|
@delete_index.push num.to_i
|
||||||
|
else
|
||||||
|
@image_id = @head_images_id[num.to_i]
|
||||||
|
@image = Headimages.find_by(:id => @image_id.to_s)
|
||||||
|
if !image["sort_number"].nil?
|
||||||
|
@image.sort_number = image["sort_number"].to_i
|
||||||
|
@image.save
|
||||||
|
end
|
||||||
|
next if image["temp_file"] == nil
|
||||||
|
@file_name = image["temp_file"].original_filename.gsub("(", "_").gsub(")", "_").gsub(" ", "_") rescue next
|
||||||
|
@image.sort_number = image["sort_number"].to_i
|
||||||
|
@image.temp_file = image["temp_file"]
|
||||||
|
@image.save
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@file_name = image["temp_file"].original_filename.gsub("(", "_").gsub(")", "_").gsub(" ", "_") rescue next
|
||||||
|
@headimages = Headimages.new(:cancerpredictfields_id => @form_to_show.id, :title => @app_title + "head_images")
|
||||||
|
@headimages.temp_file = image["temp_file"]
|
||||||
|
@headimages.sort_number = image["sort_number"].to_i if !image["sort_number"].nil?
|
||||||
|
@headimages.save
|
||||||
|
@form_to_show.head_images_id.push @headimages.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@delete_index.reverse!
|
||||||
|
@delete_index.each do |i|
|
||||||
|
@image_id = @head_images_id[i.to_i]
|
||||||
|
Headimages.find_by(:id => @image_id).destroy rescue next
|
||||||
|
@form_to_show.head_images_id.delete(@image_id)
|
||||||
|
end
|
||||||
|
@images = params["cancerpredictfields"]["title_images"]
|
||||||
|
@title_images_id = @form_to_show.title_images_id
|
||||||
|
@delete_index = []
|
||||||
|
if !@images.nil?
|
||||||
|
@images.each do |num, image|
|
||||||
|
if num.to_i < @title_images_id.length && @title_images_id.length != 0
|
||||||
|
if image["remove_image"] == "1"
|
||||||
|
@delete_index.push num.to_i
|
||||||
|
else
|
||||||
|
@image_id = @title_images_id[num.to_i]
|
||||||
|
@image = Headimages.find_by(:id => @image_id.to_s)
|
||||||
|
if !image["sort_number"].nil?
|
||||||
|
@image.sort_number = image["sort_number"].to_i
|
||||||
|
@image.save
|
||||||
|
end
|
||||||
|
next if image["temp_file"] == nil
|
||||||
|
@file_name = image["temp_file"].original_filename.gsub("(", "_").gsub(")", "_").gsub(" ", "_") rescue next
|
||||||
|
@image.sort_number = image["sort_number"].to_i
|
||||||
|
@image.temp_file = image["temp_file"]
|
||||||
|
@image.save
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@file_name = image["temp_file"].original_filename.gsub("(", "_").gsub(")", "_").gsub(" ", "_") rescue next
|
||||||
|
@headimages = Headimages.new(:cancerpredictfields_id => @form_to_show.id, :title => @app_title + "title_images")
|
||||||
|
@headimages.temp_file = image["temp_file"]
|
||||||
|
@headimages.sort_number = image["sort_number"].to_i if !image["sort_number"].nil?
|
||||||
|
@headimages.save
|
||||||
|
@form_to_show.title_images_id.push @headimages.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@delete_index.reverse!
|
||||||
|
@delete_index.each do |i|
|
||||||
|
@image_id = @title_images_id[i.to_i]
|
||||||
|
Headimages.find_by(:id => @image_id).destroy rescue next
|
||||||
|
@form_to_show.title_images_id.delete(@image_id)
|
||||||
|
end
|
||||||
|
file_ids = (@form_to_show.form_show.values + @form_to_show.form_show_in_result.values).map { |property| [property[:variable], property[:cancer_predict_mapping_file]] }.select { |k, f| f.present? }.to_h
|
||||||
|
mapping_data_from_csv = {}
|
||||||
|
if !file_ids.blank?
|
||||||
|
file_ids.each do |k, v|
|
||||||
|
mapping_data_from_csv[k] = read_mapping_file(v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@form_to_show.mapping_data_from_csv = mapping_data_from_csv.to_json
|
||||||
|
@form_to_show.save
|
||||||
|
fork do
|
||||||
|
@form_to_show.auto_write_predict_js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@site_locales = Site.last.in_use_locales.each do |locale|
|
||||||
|
I18n.with_locale(locale) do
|
||||||
|
File.open(Cancerpredictfields::ToolTableMap[I18n.locale], "w") do |f|
|
||||||
|
tmp_table_texts = create_table(locale)
|
||||||
|
f.write(tmp_table_texts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
idx = 0
|
||||||
|
while File.exist?("public/cancerfield_back#{idx}.txt")
|
||||||
|
idx += 1
|
||||||
|
end
|
||||||
|
File.open("public/cancerfield_back#{idx}.txt", "w") do |f|
|
||||||
|
f.write(@form_to_show.attributes)
|
||||||
|
end
|
||||||
|
File.open("public/cancerfield_org#{idx}.txt", "w") do |f|
|
||||||
|
f.write(Cancerpredictfields.where("title" => @app_title + "_back").first.attributes)
|
||||||
|
end
|
||||||
|
redirect_to admin_cancerpredicts_path
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_table(current_locale)
|
||||||
|
create_first_field
|
||||||
|
current_site = Site.last
|
||||||
|
@size = {}
|
||||||
|
@size_name = ["small", "medium", "large"]
|
||||||
|
@size_name.each { |name| @size[name] = @form_to_show[name]["font_size"] }
|
||||||
|
@size_active_size = ""
|
||||||
|
@size.each { |size_key, size_value| (@form_to_show[size_key]["active"].to_i == 1) ? (@size_active_size = size_value) : nil }
|
||||||
|
@table_str = '<div id="cancer_table" style="font-size:' + @size_active_size + ';"><div id="show_help_modal" class="modal fade"></div>'
|
||||||
|
@table_str += '<div id="cancer_table_top"><div id="text_describe">' + @form_to_show.text_descibe[current_locale] + "</div>"
|
||||||
|
@table_str += '<div id="font_size_choices">' + '<label id="font_texts">' + t("cancerpredict.font_size").titleize + ":</label>"
|
||||||
|
@size.each { |size_key, size_value| @table_str += ('<button class="cancer_table_btn ' + ((@form_to_show[size_key]["active"].to_i == 1) ? "active" : "") + ' btn btn-default btn-sm" onclick="document.getElementById(\'cancer_table\').style[\'font-size\']=\'' + size_value + '\';document.getElementById(\'cancer_predict_result_block\').style[\'font-size\']=\'' + size_value + '\';">' + t("cancerpredict." + size_key).titleize + "</button>") }
|
||||||
|
@table_str += '</div></div><div style="clear:both;"></div>'
|
||||||
|
@table_str_left = '<div id="cancer_table_left">'
|
||||||
|
@table_str_right = '<div id="cancer_table_right">'
|
||||||
|
@form_to_show.form_show.each do |num, property|
|
||||||
|
@field_property = {}
|
||||||
|
property.each do |key, value|
|
||||||
|
@value = value
|
||||||
|
@disp_value
|
||||||
|
if @value.class == BSON::Document || @value.class == Hash
|
||||||
|
@disp_value = @value[current_locale] rescue ""
|
||||||
|
else
|
||||||
|
@disp_value = @value
|
||||||
|
end
|
||||||
|
@disp_value = "" if @disp_value.nil?
|
||||||
|
@field_property[key] = @disp_value
|
||||||
|
end
|
||||||
|
if @field_property["right"] == 0
|
||||||
|
next if @field_property["name"].blank?
|
||||||
|
@table_str_left += "<div data-key=" + num.to_s + ">"
|
||||||
|
@table_str_left += '<label for="' + @field_property["variable"] + '" style="float:left;' + (@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "") + '" class="cencer_table_name">'
|
||||||
|
@table_str_left += @field_property["name"]
|
||||||
|
@table_str_left += "</label>"
|
||||||
|
if @field_property["comment_text"].present?
|
||||||
|
@table_str_left += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||||
|
@table_str_left += '<input class="help_texts" type="hidden" value="' + @field_property["comment_text"] + '" name=' + @field_property["variable"] + "/>"
|
||||||
|
else
|
||||||
|
@site_locales = current_site.in_use_locales
|
||||||
|
@site_locales.delete(current_locale)
|
||||||
|
@site_locales.each do |locale|
|
||||||
|
next if property["comment_text"][locale.to_s].blank?
|
||||||
|
@field_property["comment_text"] = property["comment_text"][locale.to_s]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if @field_property["comment_text"].present?
|
||||||
|
@table_str_left += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||||
|
@table_str_left += '<input class="help_texts" type="hidden" value="' + @field_property["comment_text"] + '" name=' + @field_property["variable"] + "/>"
|
||||||
|
else
|
||||||
|
@table_str_left += '<div style="margin-right: 2.125em;float: left;"></div>'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if @field_property["is_num"] == 1
|
||||||
|
if @field_property["is_float"] == 1
|
||||||
|
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '"/><input class="num_only_value" type="hidden" /></div>'
|
||||||
|
else
|
||||||
|
if @field_property["range"] == []
|
||||||
|
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '"/></div>'
|
||||||
|
else
|
||||||
|
@table_str_left += '<div class="num_group"><form class="for_num">'
|
||||||
|
@table_str_left += '<input class="num_only cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '" onkeyup="value=value.replace(/[^\d]/g,\'\') "onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\d]/g,\'\'))"/>'
|
||||||
|
@table_str_left += '<input class="num_only_value" type="hidden" value="0"/>'
|
||||||
|
@please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice"
|
||||||
|
@table_str_left += '<select class="select_num"><option value="">' + @please_choice + "</option>"
|
||||||
|
if @field_property["choice_fields"] != []
|
||||||
|
@field_property["choice_fields"].each do |choice|
|
||||||
|
@table_str_left += ('<option value="0">' + choice.to_s.titleize + "</option>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for @num in @field_property["range"][0]..@field_property["range"][1]
|
||||||
|
@table_str_left += ('<option value="' + @num.to_s + '">' + @num.to_s + "</option>")
|
||||||
|
end
|
||||||
|
@table_str_left += "</select></form></div>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@table_str_left += '<div class= "cancer-btn-group cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;">'
|
||||||
|
@field_property["choice_fields"].each do |create_choice|
|
||||||
|
@table_str_left += '<button class="cancer_table_btn btn btn-default btn-sm">' + create_choice.to_s.titleize + "</button>"
|
||||||
|
@table_str_left += '<input type="hidden" value="0" name="' + create_choice.to_s + '"/>'
|
||||||
|
end
|
||||||
|
@table_str_left += "</div>"
|
||||||
|
end
|
||||||
|
if @field_property["hint"].to_s != ""
|
||||||
|
@table_str_left += '<div style="color: rgb(104, 104, 104);font-size:0.75em;clear:both;">' + @field_property["hint"] + "</div>"
|
||||||
|
end
|
||||||
|
@table_str_left += '</div><div style="clear:both;"></div>'
|
||||||
|
else
|
||||||
|
@table_str_right += "<div data-key=" + num.to_s + ">"
|
||||||
|
break if @field_property["name"] == ""
|
||||||
|
@table_str_right += '<label for="' + @field_property["variable"] + '" style="float:left;' + (@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "") + '" class="cencer_table_name">'
|
||||||
|
@table_str_right += @field_property["name"]
|
||||||
|
@table_str_right += "</label>"
|
||||||
|
if @field_property["comment_text"].present?
|
||||||
|
@table_str_right += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||||
|
@table_str_right += '<input class="help_texts" type="hidden" value="' + @field_property["comment_text"] + '" name=' + @field_property["variable"] + "/>"
|
||||||
|
else
|
||||||
|
@site_locales = current_site.in_use_locales
|
||||||
|
@site_locales.delete(current_locale)
|
||||||
|
@site_locales.each do |locale|
|
||||||
|
next if property["comment_text"][locale.to_s].blank?
|
||||||
|
@field_property["comment_text"] = property["comment_text"][locale.to_s]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if @field_property["comment_text"].present?
|
||||||
|
@table_str_right += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||||
|
@table_str_right += '<input class="help_texts" type="hidden" value="' + @field_property["comment_text"] + '" name=' + @field_property["variable"] + "/>"
|
||||||
|
else
|
||||||
|
@table_str_right += '<div style="margin-right: 2.125em;float: left;"></div>'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if @field_property["is_num"] == 1
|
||||||
|
if @field_property["is_float"] == 1
|
||||||
|
@table_str_right += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '"/><input class="num_only_value" type="hidden" /></div>'
|
||||||
|
else
|
||||||
|
if @field_property["range"] == []
|
||||||
|
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '"/></div>'
|
||||||
|
else
|
||||||
|
@table_str_right += '<div class="num_group"><form class="for_num">'
|
||||||
|
@table_str_right += '<input class="num_only cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '" onkeyup="value=value.replace(/[^\d]/g,\'\') "onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\d]/g,\'\'))"/>'
|
||||||
|
@table_str_right += '<input class="num_only_value" type="hidden" value="0"/>'
|
||||||
|
@please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice"
|
||||||
|
@table_str_right += '<select class="select_num"><option value="">' + @please_choice + "</option>"
|
||||||
|
if @field_property["choice_fields"] != []
|
||||||
|
@field_property["choice_fields"].each do |choice|
|
||||||
|
@table_str_right += ('<option value="0">' + choice.to_s.titleize + "</option>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for @num in @field_property["range"][0]..@field_property["range"][1]
|
||||||
|
@table_str_right += ('<option value="' + @num.to_s + '">' + @num.to_s + "</option>")
|
||||||
|
end
|
||||||
|
@table_str_right += "</select></form></div>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@table_str_right += '<div class= "cancer-btn-group cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;">'
|
||||||
|
@field_property["choice_fields"].each do |create_choice|
|
||||||
|
@table_str_right += '<button class="cancer_table_btn btn btn-default btn-sm">' + create_choice.to_s.titleize + "</button>"
|
||||||
|
@table_str_right += '<input type="hidden" value="0" name="' + create_choice.to_s + '"/>'
|
||||||
|
end
|
||||||
|
@table_str_right += "</div>"
|
||||||
|
end
|
||||||
|
if @field_property["hint"].to_s != ""
|
||||||
|
@table_str_right += '<div class="hint-texts">' + @field_property["hint"] + "</div>"
|
||||||
|
end
|
||||||
|
@table_str_right += '</div><div style="clear:both;"></div>'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@table_str_left += "</div>"
|
||||||
|
@table_str_right += "</div>"
|
||||||
|
@table_str += (@table_str_left + @table_str_right)
|
||||||
|
@table_str += '<div style="clear:both;"></div>'
|
||||||
|
@table_result_str = '<div id="cancer_predict_result" style="' + ((@form_to_show.form_result_is_right == 0) ? "float:right;" : "") + '"><span class="result_title">' + t("cancerpredict.table.result").to_s + '</span><div style="clear:both;"></div>'
|
||||||
|
@tab_name = ["table", "text"]
|
||||||
|
@table_result_str += '<div class="texts_under_result">' + @form_to_show.texts_between_Result_and_result_block[current_locale] + "</div>"
|
||||||
|
@table_result_str += '<div id="result_contents"><div class="result_tab_group">'
|
||||||
|
@tab_name.each_with_index { |name, index| @table_result_str += ('<div id="result_' + name + '_tab" class="result_tab' + ((index != 0) ? "" : " active") + '"><a>' + t("cancerpredict.table." + name).to_s + '</a></div><div style="clear:both;"></div>') }
|
||||||
|
@table_result_str += '</div><div class="result_content_group">'
|
||||||
|
@tab_name.each { |name| @table_result_str += '<div id="result_' + name + '_content" class="result_content"><a>' + "no content" + "</a></div>" }
|
||||||
|
@table_result_str += "</div></div></div>"
|
||||||
|
@table_button = '<div id="cancer_table_button_group">'
|
||||||
|
@submit_btn_str = '<button id="cancer_table_submit">' + t("cancerpredict.table.Submit").to_s + "</button>"
|
||||||
|
@reset_btn_str = '<button id="cancer_table_reset">' + t("cancerpredict.table.Reset").to_s + "</button>"
|
||||||
|
@table_button += (@submit_btn_str + @reset_btn_str + '<div style="clear:both;"></div></div></div>')
|
||||||
|
@table_result_choice_fileds = '<div id="cancer_table_right_result">' if @form_to_show.form_result_is_right == 1
|
||||||
|
@table_result_choice_fileds = '<div id="cancer_table_left_result">' if @form_to_show.form_result_is_right == 0
|
||||||
|
@table_result_choice_fileds += '<span class="result_title">' + t("cancerpredict.table.Therapy_choice").to_s + '</span><div style="clear:both;"></div>'
|
||||||
|
@table_result_choice_fileds += '<div id="choice_fields">'
|
||||||
|
@form_to_show.form_show_in_result.each do |num, property|
|
||||||
|
@field_property = {}
|
||||||
|
property.each do |key, value|
|
||||||
|
@value = value
|
||||||
|
if @value.class == BSON::Document || @value.class == Hash
|
||||||
|
@disp_value = @value[current_locale.to_s] rescue ""
|
||||||
|
else
|
||||||
|
@disp_value = @value
|
||||||
|
end
|
||||||
|
@disp_value = "" if @disp_value.nil?
|
||||||
|
@field_property[key] = @disp_value
|
||||||
|
end
|
||||||
|
@table_result_choice_fileds += "<div data-key=" + num.to_s + ">"
|
||||||
|
break if @field_property["name"] == ""
|
||||||
|
@table_result_choice_fileds += '<label for="' + @field_property["variable"] + '" style="float:left;' + (@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "") + '" class="cencer_table_name">'
|
||||||
|
@table_result_choice_fileds += @field_property["name"]
|
||||||
|
@table_result_choice_fileds += "</label>"
|
||||||
|
if @field_property["comment_text"].present?
|
||||||
|
@table_result_choice_fileds += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||||
|
@table_result_choice_fileds += '<input class="help_texts" type="hidden" value="' + @field_property["comment_text"] + '" name=' + @field_property["variable"] + "></input>"
|
||||||
|
else
|
||||||
|
@site_locales = current_site.in_use_locales
|
||||||
|
@site_locales.delete(current_locale)
|
||||||
|
@site_locales.each do |locale|
|
||||||
|
next if property["comment_text"][locale.to_s].blank?
|
||||||
|
@field_property["comment_text"] = property["comment_text"][locale.to_s]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if @field_property["comment_text"].present?
|
||||||
|
@table_result_choice_fileds += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
|
||||||
|
@table_result_choice_fileds += '<input class="help_texts" type="hidden" value="' + @field_property["comment_text"] + '" name=' + @field_property["variable"] + "/>"
|
||||||
|
else
|
||||||
|
@table_result_choice_fileds += '<div style="margin-right: 2.125em;float: left;"></div>'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if @field_property["is_num"] == 1
|
||||||
|
if @field_property["is_float"] == 1
|
||||||
|
@table_result_choice_fileds += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '"/><input class="num_only_value" type="hidden" /></button>'
|
||||||
|
else
|
||||||
|
if @field_property["range"] == []
|
||||||
|
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '"/></div>'
|
||||||
|
else
|
||||||
|
@table_result_choice_fileds += '<div class="num_group"><form class="for_num">'
|
||||||
|
@table_result_choice_fileds += '<input class="num_only cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;" data-range="' + @field_property["range"].to_s + '" onkeyup="value=value.replace(/[^\d]/g,\'\') "onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\d]/g,\'\'))"/><button class="btn-sub"></button><button class="btn-add"></button></div>'
|
||||||
|
@table_str_left += '<input class="num_only_value" type="hidden" value="0"/>'
|
||||||
|
@please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice"
|
||||||
|
@table_result_choice_fileds += '<select class="select_num"><option value="">' + @please_choice + "</option>"
|
||||||
|
if @field_property["choice_fields"] != []
|
||||||
|
@field_property["choice_fields"].each do |choice|
|
||||||
|
@table_result_choice_fileds += ('<option value="0">' + choice.to_s.titleize + "</option>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for @num in @field_property["range"][0]..@field_property["range"][1]
|
||||||
|
@table_result_choice_fileds += ('<option value="' + @num.to_s + '">' + @num.to_s + "</option>")
|
||||||
|
end
|
||||||
|
@table_result_choice_fileds += "</select></form></div>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@table_result_choice_fileds += '<div class= "cancer-btn-group cancer_form_field" id="' + @field_property["variable"] + '" style="float:left;clear:right;">'
|
||||||
|
@field_property["choice_fields"].each do |create_choice|
|
||||||
|
@table_result_choice_fileds += '<button class="cancer_table_btn btn btn-default btn-sm">' + create_choice.to_s.titleize + "</button>"
|
||||||
|
@table_result_choice_fileds += '<input type="hidden" value="0" name="' + create_choice.to_s + '"></input>'
|
||||||
|
end
|
||||||
|
@table_result_choice_fileds += "</div>"
|
||||||
|
end
|
||||||
|
if @field_property["hint"].to_s != ""
|
||||||
|
@table_result_choice_fileds += '<div class="hint-texts">' + @field_property["hint"] + "</div>"
|
||||||
|
end
|
||||||
|
@table_result_choice_fileds += '</div><div style="clear:both;"></div>'
|
||||||
|
end
|
||||||
|
@table_result_choice_fileds += "</div></div>"
|
||||||
|
@table_str += (@table_button + '<div id="cancer_predict_result_block" style="font-size:' + @size_active_size + ';">' + @table_result_str + @table_result_choice_fileds + "</div>" + '<div style="clear:both;"></div>')
|
||||||
|
return @table_str
|
||||||
|
end
|
||||||
|
|
||||||
|
def showSubmit
|
||||||
|
@page_num = params[:page] || 1
|
||||||
|
@results = Cancerpredictrecord.where("title" => @app_title).desc(:id).page(@page_num).per(10)
|
||||||
|
@variables = []
|
||||||
|
@names = []
|
||||||
|
@form_to_show.form_show.each do |num, property|
|
||||||
|
property.each do |key, value|
|
||||||
|
if key == "variable"
|
||||||
|
@variables.push value
|
||||||
|
elsif key == "name"
|
||||||
|
@names.push value[I18n.locale.to_s]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@result_variables = []
|
||||||
|
@result_names = []
|
||||||
|
@indexs = []
|
||||||
|
@choicenames = []
|
||||||
|
if @results.length != 0
|
||||||
|
@results[0].result.each { |key, value| @result_variables.push key } rescue nil
|
||||||
|
@result_variables.each do |variable|
|
||||||
|
@index = @variables.index(variable.to_s)
|
||||||
|
@result_names.push @names[@index] if !@index.nil?
|
||||||
|
@indexs.push @index if !@index.nil?
|
||||||
|
end
|
||||||
|
@indexs.each do |index|
|
||||||
|
if @form_to_show.form_show[index.to_s]["is_num"] == 1 || @form_to_show.form_show[index.to_s]["is_float"] == 1
|
||||||
|
@choicenames.push ""
|
||||||
|
else
|
||||||
|
@choicenames.push @form_to_show.form_show[index.to_s]["choice_fields"][I18n.locale.to_s]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@pagination = create_pagination(@page_num.to_i)
|
||||||
|
end
|
||||||
|
|
||||||
|
def export_cancer_tool_record
|
||||||
|
cancer_records = Cancerpredictrecord.where("title" => @app_title).desc(:id)
|
||||||
|
dir_path = "tmp/cancer_tool/"
|
||||||
|
#FileUtils.rm_r(dir_path, :force => true) if Dir.exist?(dir_path)
|
||||||
|
FileUtils.mkdir dir_path if !Dir.exist?(dir_path) #create dir for storing tmp_file if dir doesn't exist
|
||||||
|
@filename = ("#{Time.now.year}_%02s_%02s_export_cancer_tool_record.xlsx" % [Time.now.month, Time.now.day]).gsub(" ", "0")
|
||||||
|
File.open("#{dir_path}#{@filename}", "w") do |f|
|
||||||
|
f.write render_to_string(:handlers => [:axlsx], :formats => [:xlsx], :partial => "export_cancer_tool_record.xlsx", :locals => { :results => cancer_records })
|
||||||
|
end
|
||||||
|
tmp_filename_data = File.read("#{dir_path}#{@filename}")
|
||||||
|
send_data(tmp_filename_data, type: "application/xlsx", disposition: "attachment", filename: @filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_first_field
|
||||||
|
if Cancerpredictfields.where("title" => (@app_title + "_back")).take_while { true }.count == 0
|
||||||
|
@form_to_show = Cancerpredictfields.new()
|
||||||
|
@form_to_show.title = @app_title + "_back"
|
||||||
|
@form_to_show.save
|
||||||
|
end
|
||||||
|
@form_to_show
|
||||||
|
if Cancerpredictfields.where("title" => @app_title).take_while { true }.count == 0
|
||||||
|
@form_to_show = Cancerpredictfields.new()
|
||||||
|
@form_to_show.title = @app_title
|
||||||
|
@form_to_show.save
|
||||||
|
@form_to_show = Cancerpredictfields.where("title" => @app_title).first
|
||||||
|
@site_locales = Site.last.in_use_locales.each do |locale|
|
||||||
|
File.open(Cancerpredictfields::ToolTableMap[I18n.locale], "w") do |f|
|
||||||
|
tmp_table_texts = create_table(locale)
|
||||||
|
f.write(tmp_table_texts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@form_to_show = Cancerpredictfields.where("title" => @app_title).first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_pagination(page = 1, fields = Cancerpredictrecord.all, extra_params = "")
|
||||||
|
page = 1 if page == 0
|
||||||
|
per_page_num = 10.0
|
||||||
|
all_page_num = (fields.count / per_page_num).ceil
|
||||||
|
all_page_num = 1 if all_page_num == 0
|
||||||
|
pagination = '<div class="PageDetails">' + ((I18n.locale.to_s == "zh_tw") ? "第 #{page} 頁" : "page #{page}") + "/" + ((I18n.locale.to_s == "zh_tw") ? "共 #{all_page_num} 頁" : "Total #{all_page_num} page(s)") + '<ol class="PageList">' +
|
||||||
|
((page == 1) ? "<li>[" + I18n.t("cancerpredict.prev_page") + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + (page - 1).to_s + '"> [' + I18n.t("cancerpredict.prev_page") + "] </a></li>")
|
||||||
|
if all_page_num > 7
|
||||||
|
if page <= (all_page_num / 2)
|
||||||
|
if page <= 7
|
||||||
|
(1..page).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
else
|
||||||
|
(1..3).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
pagination += "<li>...</li>"
|
||||||
|
(page - 3..page).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
end
|
||||||
|
(page + 1..page + 3).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
pagination += "<li>...</li>"
|
||||||
|
(all_page_num - 2..all_page_num).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
else
|
||||||
|
(1..3).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
pagination += "<li>...</li>"
|
||||||
|
(page - 3..page).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
if all_page_num - page <= 7
|
||||||
|
(page + 1..all_page_num).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
else
|
||||||
|
(page + 1..page + 3).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
pagination += "<li>...</li>"
|
||||||
|
(all_page_num - 2..all_page_num).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
(1..all_page_num).to_a.each { |page_num| pagination += ((page_num == page) ? "<li>[" + page_num.to_s + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + page_num.to_s + '"> ' + page_num.to_s + " </a></li>") }
|
||||||
|
end
|
||||||
|
pagination += (((page == all_page_num) ? "<li>[" + I18n.t("cancerpredict.next_page") + "]</li>" : '<li><a href="' + (extra_params.blank? ? "?" : "?#{extra_params}&") + "page=" + (page + 1).to_s + '"> [' + I18n.t("cancerpredict.next_page") + "] </a></li>") + "</ol></div>")
|
||||||
|
end
|
||||||
|
|
||||||
|
def read_mapping_file(mapping_file_id)
|
||||||
|
mapping_file = CancerPredictMappingFile.find(mapping_file_id) rescue nil
|
||||||
|
if !mapping_file.nil?
|
||||||
|
csv_rows = CSV.read(mapping_file.temp_file.file.path)
|
||||||
|
titles = csv_rows[0]
|
||||||
|
infos = {}
|
||||||
|
titles.each_with_index do |title, i|
|
||||||
|
infos[title] = []
|
||||||
|
csv_rows[1..-1].each do |row|
|
||||||
|
infos[title] << row[i].to_f
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return infos
|
||||||
|
else
|
||||||
|
return {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,24 +0,0 @@
|
||||||
# encoding: utf-8
|
|
||||||
require 'rubyXL'
|
|
||||||
class CancerpredictsController < ApplicationController
|
|
||||||
before_filter :set_I18n
|
|
||||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
|
||||||
#before_action :load_access_levels
|
|
||||||
def initialize
|
|
||||||
super
|
|
||||||
@app_title = "cancerpredict"
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
|
||||||
@tags = @module_app.tags
|
|
||||||
@categories = @module_app.categories.enabled
|
|
||||||
@filter_fields = filter_fields(@categories, @tags)
|
|
||||||
@table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified]
|
|
||||||
if request.xhr?
|
|
||||||
render :partial => "index"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
def set_I18n
|
|
||||||
I18n.locale = params[:lang] if params[:lang].present?
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,27 +1,227 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require 'rubyXL'
|
require "rubyXL"
|
||||||
|
require "json"
|
||||||
|
|
||||||
class CancerpredictsController < ApplicationController
|
class CancerpredictsController < ApplicationController
|
||||||
before_filter :set_I18n
|
|
||||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
|
||||||
#before_action :load_access_levels
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@app_title = "cancerpredict"
|
@app_title = "cancerpredict"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def calculate
|
||||||
|
create_first_field
|
||||||
|
if params["header"].to_i == 1
|
||||||
|
locale = params["locale"].to_s rescue "zh_tw"
|
||||||
|
locale = "zh_tw" if locale == "zh_cn"
|
||||||
|
result = {}
|
||||||
|
@head_images = {}
|
||||||
|
@form_to_show.head_images_id.each do |image_id|
|
||||||
|
next if image_id.to_s == ""
|
||||||
|
@image = Headimages.find_by(:id => image_id.to_s)
|
||||||
|
@url = @image.temp_file.to_s
|
||||||
|
@head_images[@image.sort_number.to_i] = ('<img class="head_logo" alt ="' + Pathname.new(@image.temp_file.file.file).basename.to_s + '" src="' + @url + '"/>')
|
||||||
|
end
|
||||||
|
result["head_images"] = Hash[@head_images.sort].values.join("")
|
||||||
|
@head_images = {}
|
||||||
|
@form_to_show.title_images_id.each do |image_id|
|
||||||
|
next if image_id.to_s == ""
|
||||||
|
@image = Headimages.find_by(:id => image_id.to_s)
|
||||||
|
@url = @image.temp_file.to_s
|
||||||
|
@head_images[@image.sort_number.to_i] = ('<img class="head_logo" alt ="' + Pathname.new(@image.temp_file.file.file).basename.to_s + '" src="' + @url + '"/>')
|
||||||
|
end
|
||||||
|
result["danger_texts"] = (@form_to_show.danger_texts[locale] rescue "")
|
||||||
|
result["title"] = Hash[@head_images.sort].values.join("")
|
||||||
|
result["page_title"] = @form_to_show.title_texts[params[:locale]]
|
||||||
|
elsif params["get_mapping_data_from_csv"].to_i == 1
|
||||||
|
result = {}
|
||||||
|
result["mapping_data_from_csv"] = JSON.parse(@form_to_show.mapping_data_from_csv) rescue {}
|
||||||
|
else
|
||||||
|
@record = Cancerpredictrecord.new
|
||||||
|
@record.title = @app_title
|
||||||
|
@choice_keys = []
|
||||||
|
@choice_values = []
|
||||||
|
@choice_names = []
|
||||||
|
@form_to_show.form_show.values.each { |choice| @choice_keys.push choice[:variable] }
|
||||||
|
@form_to_show.form_show.values.each { |choice| @choice_values.push ((choice[:is_num] == 1) ? [] : choice[:choice_fields]) }
|
||||||
|
@form_to_show.form_show.values.each { |choice| @choice_names.push choice[:name] }
|
||||||
|
@choice_keys.each_with_index { |key, i| @record.names[key] = @choice_names[i] }
|
||||||
|
@choice_keys.each_with_index { |key, i| @record.values[key] = @choice_values[i] }
|
||||||
|
params["data"].each do |rec_key, rec_value|
|
||||||
|
@record.result[rec_key] = rec_value
|
||||||
|
end
|
||||||
|
@record.submit_time = Time.now.to_s
|
||||||
|
@record.save
|
||||||
|
locale = params["data"]["locale"].to_s rescue "zh_tw"
|
||||||
|
locale = "zh_tw" if locale == "zh_cn"
|
||||||
|
result = {}
|
||||||
|
mapping_data_from_csv = JSON.parse(@form_to_show.mapping_data_from_csv) rescue {}
|
||||||
|
@form_to_show.all_variables.each do |v|
|
||||||
|
result[v] = 0
|
||||||
|
end
|
||||||
|
@form_to_show.form_show.each do |num, property|
|
||||||
|
@variable = property[:variable]
|
||||||
|
if @variable.present?
|
||||||
|
if property[:is_num] == 1
|
||||||
|
if property[:is_float] == 1
|
||||||
|
result[@variable] = params["data"][@variable].to_f rescue 0.0
|
||||||
|
else
|
||||||
|
result[@variable] = params["data"][@variable].to_i rescue 0
|
||||||
|
end
|
||||||
|
elsif property[:choice_fields].present?
|
||||||
|
if !(@form_to_show.advance_mode)
|
||||||
|
result[@variable] = params["data"][@variable].to_i rescue 0
|
||||||
|
else
|
||||||
|
if property[:need_map_values] == 1
|
||||||
|
result[@variable] = property[:map_values][params["data"][@variable].to_i - 1]
|
||||||
|
else
|
||||||
|
if property[:revert_value] != 1
|
||||||
|
result[@variable] = params["data"][@variable].to_i - 1
|
||||||
|
else
|
||||||
|
result[@variable] = ((property[:choice_fields].length - params["data"][@variable].to_i) rescue params["data"][@variable].to_i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if @form_to_show.advance_mode && property[:cancer_predict_mapping_file].present?
|
||||||
|
if (mapping_data_from_csv != {})
|
||||||
|
mapping_hash = mapping_data_from_csv[@variable]
|
||||||
|
temp_index = 0
|
||||||
|
temp_value = result[@variable]
|
||||||
|
mapping_hash.each_with_index do |(k, v), i|
|
||||||
|
if i == 0
|
||||||
|
index_val = v.index(temp_value) rescue nil
|
||||||
|
if !index_val.nil?
|
||||||
|
temp_index = index_val
|
||||||
|
else
|
||||||
|
closest_value = v.min_by { |x| (temp_value - x).abs }
|
||||||
|
temp_index = v.index(closest_value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result[k] = v[temp_index]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
formula_variables = @form_to_show.tmp_lpv_variables
|
||||||
|
begin
|
||||||
|
eval_hidden_variables(result)
|
||||||
|
rescue => e
|
||||||
|
@form_to_show.generate_eval_formula
|
||||||
|
eval_hidden_variables(result)
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
eval_formula(result)
|
||||||
|
rescue => e
|
||||||
|
@form_to_show.generate_eval_formula
|
||||||
|
eval_formula(result)
|
||||||
|
end
|
||||||
|
result["lpv"] = result[formula_variables.last]
|
||||||
|
result["lpv_variable"] = {}
|
||||||
|
formula_variables.each do |variable_name|
|
||||||
|
result["lpv_variable"]["#{variable_name}"] = result[variable_name]
|
||||||
|
end
|
||||||
|
@years = @form_to_show.years
|
||||||
|
result["years"] = @years
|
||||||
|
@therapy_choices = [I18n.t("cancerpredict.table.Surgeryonly")]
|
||||||
|
@form_to_show.form_show_in_result.values.each { |choice| @therapy_choices.push choice["name"][locale] }
|
||||||
|
@therapy_names = @form_to_show.treatment_method
|
||||||
|
result["treatment_method"] = @therapy_names
|
||||||
|
result["treatment_method_active_indices"] = @form_to_show.treatment_method_active_indices
|
||||||
|
result["table"] = @form_to_show.result_table_translations[locale]
|
||||||
|
year = params["data"]["year"] rescue nil
|
||||||
|
if year.nil?
|
||||||
|
year = @years.last.to_f
|
||||||
|
else
|
||||||
|
year = year.to_f
|
||||||
|
end
|
||||||
|
year_index = @years.index(year)
|
||||||
|
@servive_ratio = eval(@form_to_show.tmp_years_settings_for_ruby[year_index])
|
||||||
|
@servive_ratio = (@servive_ratio * 100).round(2)
|
||||||
|
result["texts"] = @form_to_show.result_text_translations[locale]
|
||||||
|
result["extra_therapy_texts"] = @form_to_show.extra_therapy_texts[locale] rescue @form_to_show.extra_therapy_texts["zh_tw"]
|
||||||
|
result["servive_ratio"] = @servive_ratio
|
||||||
|
end
|
||||||
|
result = result.merge(params)
|
||||||
|
render :json => result
|
||||||
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
uid = OrbitHelper.params[:uid] rescue ""
|
uid = OrbitHelper.params[:uid] rescue ""
|
||||||
tags = OrbitHelper.widget_tags
|
tags = OrbitHelper.widget_tags
|
||||||
categories = OrbitHelper.widget_categories || []
|
categories = OrbitHelper.widget_categories || []
|
||||||
locale = OrbitHelper.get_site_locale.to_s
|
@table_str = File.read(Cancerpredictfields::ToolTableMap[I18n.locale])
|
||||||
|
preidct_js_url = "/assets/#{Cancerpredictfields::JS}"
|
||||||
|
if File.exist?(Cancerpredictfields::JSFileName)
|
||||||
|
js_filename = File.read(Cancerpredictfields::JSFileName)
|
||||||
|
if js_filename.include?(Cancerpredictfields::JS)
|
||||||
|
asset = Rails.application.assets[js_filename]
|
||||||
|
preidct_js_url = "#{Rails.application.config.assets.prefix}/#{asset.digest_path}"
|
||||||
|
else
|
||||||
|
preidct_js_url = "#{Rails.application.config.assets.prefix}/#{File.basename(js_filename)}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
{
|
||||||
|
"cancerpredict" => [],
|
||||||
|
"extras" => { "table" => @table_str, "preidct_js_url" => preidct_js_url },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def widget
|
def widget
|
||||||
uid = OrbitHelper.params[:uid] rescue ""
|
uid = OrbitHelper.params[:uid] rescue ""
|
||||||
tags = OrbitHelper.widget_tags
|
tags = OrbitHelper.widget_tags
|
||||||
categories = OrbitHelper.widget_categories || []
|
categories = OrbitHelper.widget_categories || []
|
||||||
locale = OrbitHelper.get_site_locale.to_s
|
@table_str = File.read(Cancerpredictfields::ToolTableMap[I18n.locale])
|
||||||
end
|
preidct_js_url = "/assets/#{Cancerpredictfields::JS}"
|
||||||
def set_I18n
|
if File.exist?(Cancerpredictfields::JSFileName)
|
||||||
I18n.locale = params[:lang] if params[:lang].present?
|
js_filename = File.read(Cancerpredictfields::JSFileName)
|
||||||
|
if js_filename.include?(Cancerpredictfields::JS)
|
||||||
|
asset = Rails.application.assets[js_filename]
|
||||||
|
preidct_js_url = "#{Rails.application.config.assets.prefix}/#{asset.digest_path}"
|
||||||
|
else
|
||||||
|
preidct_js_url = "#{Rails.application.config.assets.prefix}/#{File.basename(js_filename)}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
{
|
||||||
|
"cancerpredict" => [],
|
||||||
|
"extras" => { "table" => @table_str, "preidct_js_url" => preidct_js_url },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_first_field
|
||||||
|
if Cancerpredictfields.where("title" => (@app_title + "_back")).count == 0
|
||||||
|
@form_to_show = Cancerpredictfields.new()
|
||||||
|
@form_to_show.title = @app_title + "_back"
|
||||||
|
@form_to_show.save
|
||||||
|
end
|
||||||
|
@form_to_show
|
||||||
|
if Cancerpredictfields.where("title" => @app_title).count == 0
|
||||||
|
@form_to_show = Cancerpredictfields.new()
|
||||||
|
@form_to_show.title = @app_title
|
||||||
|
@form_to_show.save
|
||||||
|
@form_to_show = Cancerpredictfields.where("title" => @app_title).first
|
||||||
|
else
|
||||||
|
@form_to_show = Cancerpredictfields.where("title" => @app_title).first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def read_mapping_file(mapping_file)
|
||||||
|
if mapping_file.class != CancerPredictMappingFile
|
||||||
|
mapping_file = CancerPredictMappingFile.find(mapping_file_id) rescue nil
|
||||||
|
end
|
||||||
|
if !mapping_file.nil?
|
||||||
|
csv_rows = CSV.read(mapping_file.temp_file.file.path)
|
||||||
|
titles = csv_rows[0]
|
||||||
|
infos = {}
|
||||||
|
titles.each_with_index do |title, i|
|
||||||
|
infos[title] = []
|
||||||
|
csv_rows[1..-1].each do |row|
|
||||||
|
infos[title] << row[i].to_f
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return infos
|
||||||
|
else
|
||||||
|
return {}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,7 +1,46 @@
|
||||||
require "net/http"
|
|
||||||
require "uri"
|
|
||||||
require 'json'
|
|
||||||
|
|
||||||
module Admin::CancerpredictsHelper
|
module Admin::CancerpredictsHelper
|
||||||
|
def bc_yaml_dump(arr)
|
||||||
|
if arr.blank?
|
||||||
|
'[]'
|
||||||
|
elsif arr.class != String
|
||||||
|
'[' + arr.map{|s| (s.is_a?(String) && !(s.is_i?) && s.include?(' ')) ? "\"#{s}\"" : s}.join(', ') + ']'
|
||||||
|
else
|
||||||
|
arr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def create_pagination(page=1,fields=Cancerpredictrecord.all,extra_params="")
|
||||||
|
page = 1 if page == 0
|
||||||
|
per_page_num = 10.0
|
||||||
|
all_page_num = (fields.count / per_page_num).ceil
|
||||||
|
pagination = '<div class="PageDetails">'+((I18n.locale.to_s == 'zh_tw') ? "第 #{page} 頁" : "page #{page}") +'/'+ ((I18n.locale.to_s == 'zh_tw') ? "共 #{all_page_num} 頁" : "Total #{all_page_num} page(s)")+'<ol class="PageList">'+
|
||||||
|
((page == 1) ? '<li>['+I18n.t('cancerpredict.prev_page')+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+(page-1).to_s+'"> ['+I18n.t('cancerpredict.prev_page')+'] </a></li>')
|
||||||
|
if all_page_num > 7
|
||||||
|
if page <= (all_page_num / 2)
|
||||||
|
if page <= 7
|
||||||
|
(1..page).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
else
|
||||||
|
(1..3).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
pagination +='<li>...</li>'
|
||||||
|
(page-3..page).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
end
|
||||||
|
(page+1..page+3).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
pagination +='<li>...</li>'
|
||||||
|
(all_page_num-2..all_page_num).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
else
|
||||||
|
(1..3).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
pagination +='<li>...</li>'
|
||||||
|
(page-3..page).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
if all_page_num - page <= 7
|
||||||
|
(page+1..all_page_num).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
else
|
||||||
|
(page+1..page+3).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
pagination +='<li>...</li>'
|
||||||
|
(all_page_num-2..all_page_num).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
(1..all_page_num).to_a.each{|page_num| pagination += ((page_num == page) ? '<li>['+page_num.to_s+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+page_num.to_s+'"> '+page_num.to_s+' </a></li>')}
|
||||||
|
end
|
||||||
|
pagination += (((page==all_page_num) ? '<li>['+I18n.t('cancerpredict.next_page')+']</li>' : '<li><a href="'+(extra_params.blank? ? '?' : "?#{extra_params}&")+'page='+(page+1).to_s+'"> ['+I18n.t('cancerpredict.next_page')+'] </a></li>')+'</ol></div>')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
class CancerPredictMappingFile
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
mount_uploader :temp_file, HeadImagesUploader
|
||||||
|
|
||||||
|
def file_identifier
|
||||||
|
filename = self.temp_file.file.original_filename rescue ""
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,64 +1,507 @@
|
||||||
class Cancerpredictfields
|
class Cancerpredictfields
|
||||||
|
require "pathname"
|
||||||
|
require 'json'
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
include OrbitModel::Status
|
Field_relations = {"number_field"=>"Fixnum","text_area"=>"String"}
|
||||||
include OrbitModel::Impression
|
FIELDINFO = {"variable"=>"String","name"=>"String","is_num"=>"Fixnum","hint"=>"String","comment_text"=>"String","choice_fields"=>"Array","range"=>"Array","right"=>"Fixnum","is_float"=>"Fixnum","revert_value"=>"Fixnum","map_values"=>"Array","cancer_predict_mapping_file"=>"String","lpv_impact"=>"Float","active_choice"=>"number_field","disable_condition"=>"text_area"}
|
||||||
# encoding: utf-8
|
NonLoclaized = ["variable","is_num","range","right","is_float","revert_value","map_values","cancer_predict_mapping_file","lpv_impact","active_choice","disable_condition"]
|
||||||
include OrbitTag::Taggable
|
AdvanceFields = ["revert_value","map_values","cancer_predict_mapping_file"]
|
||||||
include OrbitCategory::Categorizable
|
TherapyFields = ["variable","name","hint","comment_text","choice_fields","lpv_impact","active_choice","disable_condition"]
|
||||||
field :font_array , :type => Hash, default:{}
|
TherapyOnly = ["lpv_impact","active_choice","disable_condition"]
|
||||||
field :new_add_font, type: String, default:""
|
JSFileName = "public/cancer_tool_js_filename.txt".freeze
|
||||||
field :delete_font, type: String, default:""
|
ModuleAppPath = Pathname.new(File.expand_path(__dir__)).dirname.dirname.to_s.freeze
|
||||||
field :used_font , :type => Array, default:[]
|
JS = "cancer_predict.js"
|
||||||
field :un_used_font , :type => Array, default:[]
|
ToolTableMap = I18n.available_locales.map do |locale|
|
||||||
|
[locale, "public/cancer_tool_table_tmp_#{locale}.txt".freeze]
|
||||||
|
end.to_h
|
||||||
field :title ,type:String ,default:""
|
field :title ,type:String ,default:""
|
||||||
field :subtitle, localize: true
|
field :advance_mode, type: Boolean, default: false
|
||||||
field :text, localize: true
|
field :form_show , :type=> Hash ,default:{
|
||||||
# before_destroy :destroy_email
|
"0"=>{"variable"=>"age", "name"=>{"zh_tw"=>"年齡<br/>(Age)", "en"=>"Age"}, "is_num"=>1, "hint"=>{"zh_tw"=>"從 18 歲(含)開始至 93 歲", "en"=>"Age must be between 18 and 93"}, "comment_text"=>{"zh_tw"=>"年齡為該婦女於確診罹患乳癌時之年齡", "en"=>"Age at diagnosis"}, "choice_fields"=>{"zh_tw"=>[], "en"=>[]}, "range"=>[18, 93], "right"=>0, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])}
|
"1"=>{"variable"=>"size", "name"=>{"zh_tw"=>"腫瘤大小(單位:mm)<br/>(Tumor size)", "en"=>"Tumor size"}, "is_num"=>1, "hint"=>{"zh_tw"=>"", "en"=>"The unit of tumor size is millimeter (mm)"}, "comment_text"=>{"zh_tw"=>"若有多個原發腫瘤,請輸入最大尺寸之原發腫瘤", "en"=>"If there was more than one primary tumor, please enter the size of the largest one."}, "choice_fields"=>{"zh_tw"=>[], "en"=>[]}, "range"=>[1, 300], "right"=>0, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
scope :is_approved, ->{where(:approved => true)}
|
"2"=>{"variable"=>"lymph_nodes_examined", "name"=>{"zh_tw"=>"區域淋巴結檢查數目<br/>(Regional lymph nodes examined)", "en"=>"Regional lymph nodes examined"}, "is_num"=>1, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["未知"], "en"=>["unknown"]}, "range"=>[0, 90], "right"=>0, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
before_create :delete_empty_font ,:get_font_to_store,:set_un_used_font , :set_used_font
|
"3"=>{"variable"=>"lymph_nodes_positive", "name"=>{"zh_tw"=>"區域淋巴結侵犯數目<br/>(Regional lymph nodes positive)", "en"=>"Regional lymph nodes positive"}, "is_num"=>1, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"此變項為預測重要變數,若無此資訊預測容易失真。", "en"=>"Regional lymph nodes positive is a key predictive variable. If this information is omitted, the prediction result would be biased."}, "choice_fields"=>{"zh_tw"=>["未知"], "en"=>["unknown"]}, "range"=>[0, 90], "right"=>0, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
before_update :delete_empty_font ,:get_font_to_store,:set_un_used_font , :set_used_font
|
"4"=>{"variable"=>"grade", "name"=>{"zh_tw"=>"腫瘤分化程度<br/>(Tumor grade)", "en"=>"Tumor grade"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"腫瘤級數代表腫瘤組織與正常組織間的分化程度,若無分化級數資訊,請選擇“未知”選項,將以級數 2 進行預測。", "en"=>"The grade refers to how different the cancer cells are from normal cells. Please select “unknown” if there is no information about grade. The prediction model would use “grade 2” as the alternative variable."}, "choice_fields"=>{"zh_tw"=>["1", "2", "3", "未知"], "en"=>["1", "2", "3", "unknown"]}, "range"=>[], "right"=>0, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
before_save :delete_empty_font ,:get_font_to_store,:set_un_used_font , :set_used_font
|
"5"=>{"variable"=>"ER_status", "name"=>{"zh_tw"=>"ER 狀態<br/>(ER status)", "en"=>"ER status"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"ER:雌激素受體,若無 ER 資訊請選擇未知,將以佔多數比例陽 性作為後續預測。", "en"=>"ER status describes the status of estrogen receptor. Please select “unknown” if there is no information about ER status. The prediction model would use “Positive” (the majority class) as the alternative variable."}, "choice_fields"=>{"zh_tw"=>["陽性", "陰性", "未知"], "en"=>["positive", "negative", "unknown"]}, "range"=>[], "right"=>0, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
after_update :set_config
|
"6"=>{"variable"=>"PR_status", "name"=>{"zh_tw"=>"PR 狀態<br/>(PR status)", "en"=>"PR status"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"PR:黃體素受體, 若無 PR 資訊請選擇未知,將以佔多數比例陽性作為後續預測。", "en"=>"PR status describes the status of progesterone receptor. Please select “unknown” if there is no information about PR status. The prediction model would use “Positive” (the majority class) as the alternative variable."}, "choice_fields"=>{"zh_tw"=>["陽性", "陰性", "未知"], "en"=>["positive", "negative", "unknown"]}, "range"=>[], "right"=>1, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
after_save :set_config
|
"7"=>{"variable"=>"HER2_status", "name"=>{"zh_tw"=>"HER2 狀態<br/>(HER2 status)", "en"=>"HER2 status"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"HER2:第二型人類上皮成長因子接受器蛋白,若無 HER2 資訊請選擇未知,將以佔多數比例陰性作為後續預測。", "en"=>"HER2 status describes the status of human epidermal growth factor receptor 2. Please select “unknown” if there is no information about HER2 status. The prediction model would use “Negative” (the majority class) as the alternative variable."}, "choice_fields"=>{"zh_tw"=>["陽性", "陰性", "未知"], "en"=>["positive", "negative", "unknown"]}, "range"=>[], "right"=>1, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
|
"8"=>{"variable"=>"Distant_Metastasis", "name"=>{"zh_tw"=>"遠端轉移<br/>(Distant Metastasis)", "en"=>"Distant Metastasis"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"若無遠端轉移資訊請選擇未知,將以佔多數比例未遠端轉移作為後續預測。", "en"=>"Please select “unknown” if there is no information about distant Metastasis. The prediction model would use “No” (the majority class) as the alternative variable."}, "choice_fields"=>{"zh_tw"=>["是", "否", "未知"], "en"=>["yes", "no", "unknown"]}, "range"=>[], "right"=>1, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
|
"9"=>{"variable"=>"micrometastasis", "name"=>{"zh_tw"=>"淋巴結顯微轉移<br/>(Lymph nodes micrometastasis)", "en"=>"Micrometastasis"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"若無顯微移資訊請選擇未知,將以無顯微轉移作為後續預測。", "en"=>"Please select “unknown” if there is no information about lymph nodes micrometastasis. The prediction model would use “No” as the alternative variable."}, "choice_fields"=>{"zh_tw"=>["是", "否", "未知"], "en"=>["yes", "no", "unknown"]}, "range"=>[], "right"=>1, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
|
"10"=>{"variable"=>"tumor_direct_extension", "name"=>{"zh_tw"=>"腫瘤浸潤至胸壁和/或皮膚<br/>(Tumor direct extension to the chest wall and/or to the skin)", "en"=>"Tumor direct extension to the chest wall and/or to the skin"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"若無腫瘤浸潤至胸壁或皮膚資訊請選擇未知,將以佔多數比例無腫瘤浸潤至胸壁作為後續預測。", "en"=>"Please select “unknown” if there is no information about tumor direct extension to the chest wall and/or to the skin. The prediction model would use “No” (the majority class) as the alternative variable"}, "choice_fields"=>{"zh_tw"=>["是", "否", "未知"], "en"=>["yes", "no", "unknown"]}, "range"=>[], "right"=>1, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]},
|
||||||
|
"11"=>{"variable"=>"lvi", "name"=>{"zh_tw"=>"淋巴管或血管侵犯<br/>(Lymph vessel or vascular invasion, LVI)", "en"=>"Lymph vessel or vascular invasion, LVI"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>"Lymph vessel or vascular invasion"}, "comment_text"=>{"zh_tw"=>"若無淋巴管或血管侵犯資訊,請選擇“未知”選項,將以佔多數比例的淋巴管或血管未侵犯進行預測", "en"=>"Please select “unknown” if there is no information about Lymph vessel or vascular invasion. The prediction model would use “No” (the majority class) as the alternative variable."}, "choice_fields"=>{"zh_tw"=>["是", "否", "未知"], "en"=>["yes", "no", "unknown"]}, "range"=>[], "right"=>1, "is_float"=>0, "need_map_values"=>0, "revert_value"=>0, "map_values"=>[]}
|
||||||
|
}
|
||||||
|
field :form_show_in_result , :type=> Hash ,default: {
|
||||||
|
"0"=>{"variable"=>"hormone_therapy", "name"=>{"zh_tw"=>"賀爾蒙治療", "en"=>"Hormone/Steroid therapy"}, "is_num"=>0, "hint"=>{"zh_tw"=>"適用賀爾蒙受體陽性病人", "en"=>"Hormone/ steroid therapy is available when ER status is positive"}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["否", "是"], "en"=>["No", "Yes"]}, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>0, "map_values"=>"", "active_choice"=>2, "disable_condition"=>"ER_status == 2 && PR_status == 2", "lpv_impact"=>-0.8397},
|
||||||
|
"1"=>{"variable"=>"Chemotherapy", "name"=>{"zh_tw"=>"化學治療", "en"=>"Chemotherapy"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["否", "是"], "en"=>["No", "Yes"]}, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>0, "map_values"=>"", "active_choice"=>2, "disable_condition"=>"", "lpv_impact"=>-0.4147},
|
||||||
|
"2"=>{"variable"=>"Radiotherapy", "name"=>{"zh_tw"=>"放射治療", "en"=>"Radiotherapy"}, "is_num"=>0, "hint"=>{"zh_tw"=>"", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["否", "是"], "en"=>["No", "Yes"]}, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>0, "map_values"=>"", "active_choice"=>2, "disable_condition"=>"", "lpv_impact"=>-0.3203},
|
||||||
|
"3"=>{"variable"=>"Targeted_therapy", "name"=>{"zh_tw"=>"標靶治療", "en"=>"Targeted therapy"}, "is_num"=>0, "hint"=>{"zh_tw"=>"抗HER2治療", "en"=>""}, "comment_text"=>{"zh_tw"=>"", "en"=>""}, "choice_fields"=>{"zh_tw"=>["否", "是"], "en"=>["No", "Yes"]}, "range"=>[], "right"=>0, "is_float"=>0, "revert_value"=>0, "map_values"=>"", "active_choice"=>2, "disable_condition"=>"HER2_status != 1", "lpv_impact"=>-0.4687}
|
||||||
|
}
|
||||||
|
field :form_result_is_right , :type=> Integer ,default: 0
|
||||||
|
field :text_descibe ,type:Hash ,default: {
|
||||||
|
"zh_tw"=>"歡迎使用台灣準備乳癌預後系統!<br />\r\n本預測系統由台灣癌症登記資料庫2011至2015年間共20,997位乳癌病人所建立<br />\r\n並驗證美國流行病學癌症資料庫59,271位病人所建立 。<br />\r\n若要開始 請在下方選擇相關資訊",
|
||||||
|
"en"=>"Welcome to the Taiwan Breast Cancer Prediction System!<br />\r\nThe prediction system is constructed using clinical data from 90,841 breast cancer patients in the Taiwan Cancer Registry database between 2011 to 2015, and validated using clinical data from 49,374 breast cancer patients in the U.S.-based Surveillance, Epidemiology and End Results (SEER) database.<br />\r\nTo start, please select the information below."
|
||||||
|
}
|
||||||
|
field :small ,type:Hash ,default:{'font_size'=>"0.825em",'active'=>0}
|
||||||
|
field :medium ,type:Hash ,default:{'font_size'=>"1em",'active'=>1}
|
||||||
|
field :large ,type:Hash ,default:{'font_size'=>"1.25em",'active'=>0}
|
||||||
|
field :head_images_id ,type:Array , default: [BSON::ObjectId('5df62cfc8cd8924e79000009'), BSON::ObjectId('5df745a58cd8924491000006'), BSON::ObjectId('5e7848c98cd8924f8d00004a'), BSON::ObjectId('5ea8f3e48cd892760b000011')]
|
||||||
|
field :title_images_id ,type:Array , default: [BSON::ObjectId('5df87cd88cd8924491000036')]
|
||||||
|
field :title_texts ,type:Hash ,default: {"zh_tw"=>"華人癌症存活預測", "en"=>"Asian breast cancer prediction"}
|
||||||
|
field :table_above_texts ,type:Hash ,default: {"zh_tw"=>"下表之分析為針對手術後病人,根據選定的術後治療,分別估計在第1年、3 及5年的存活率。", "en"=>"The analysis is for women who had undergone surgery.The table shows the 1-, 3- and 5-year survival rates,based on the treatment you have selected."}
|
||||||
|
field :text_above_texts ,type:Hash ,default: {"zh_tw"=>"此研究分析來自已接受根除性手術後之婦女所得之結果,根據您所輸入的資訊以及治療方式,在術後<br/>第{{years}}年,", "en"=>"The analysis is for women who had undergone surgery. Base on the information and the treatment you have selected, the predictions of survival status<br/>{{years}}"}
|
||||||
|
field :surgery_only_texts ,type:Hash ,default: {"zh_tw"=>"100 位只接受根除性手術的婦女中,有{{Surgery_only}}位婦女,術後{{surgery_year}}年仍為存活", "en"=>"after surgery are as follows:<br/>{{Surgery_only}} out of 100 women treated with surgery only are alive at {{surgery_year}} years."}
|
||||||
|
field :extra_texts ,type:Hash ,default: {"zh_tw"=>",此外", "en"=>""}
|
||||||
|
field :extra_therapy_texts ,type:Hash ,default: {"zh_tw"=>"100 位在術後有接受{{extra_therapy}}的婦女中,有{{survival_num}}位婦女,術後{{surgery_year}}年仍為存活(多了{{Additional_Benefit}}位)", "en"=>"{{survival_num}} out of 100 women treated with {{extra_therapy}} are alive (an extra {{Additional_Benefit}})"}
|
||||||
|
field :danger_texts ,type:Hash ,default: {"zh_tw"=>"請注意紅框的輸入資料是否符合要求!", "en"=>"Please check whether input data in red blocks are correct!"}
|
||||||
|
field :years ,type:Array ,default:[1,3,5]
|
||||||
|
field :texts_between_Result_and_result_block ,type:Hash ,default: {"zh_tw"=>"如果欲將預測結果應用於臨床上,請務必與您的主治醫師討論後再做最後決定。", "en"=>"Please note that the patients need to consult with their medical doctors before making any decision."}
|
||||||
|
#field :image_uploader ,type:Object
|
||||||
|
field :prediction_formula , type: String ,default: "lpv = ((age1-0.7276655)*(-10.87)+(age2+0.4540707)*8.968+(size1-0.643632)*0.7678+(nposit-1.346932)*0.5339+
|
||||||
|
grade_2*0.4795+grade_3*0.818+subtype_HER2*0.1806+subtype_triple*0.6457+pstage_2*0.5311+
|
||||||
|
pstage_3*1.134+pstage_4*2.172+lvi_yes*0.3321-0.04+chemo*(-0.4147)+radio*(-0.3203)+hormone*(-0.8397)+target*(0.3321)
|
||||||
|
)"
|
||||||
|
field :years_settings , type: Array , default: ["exp(-0.001476145)^( exp(lpv) )","exp(-0.01261639)^( exp(lpv) )","exp(-0.02519608)^( exp(lpv) )"]
|
||||||
|
field :tmp_years_settings , type: Array , default: []
|
||||||
|
field :tmp_years_settings_for_ruby , type: Array , default: []
|
||||||
|
field :hidden_variables, type: String, default: "age1 = (age / 100.0) ^ (0.5)
|
||||||
|
age2 = age1 * log(age / 100.0)
|
||||||
|
size1 = log(size / 10.0)
|
||||||
|
ratio = (lymph_nodes_examined == 0 ? 0 : (1.0 * lymph_nodes_positive / lymph_nodes_examined))
|
||||||
|
ratio = (ratio > 1 ? 1 : ratio)
|
||||||
|
T4 = (tumor_direct_extension == 1)
|
||||||
|
T1 = !T4 && (size <= 20)
|
||||||
|
T2 = !T4 && !T1 && (size > 20 && size <= 50)
|
||||||
|
T = (T4 ? 'T4' : (T1 ? 'T1' : (T2 ? 'T2' : 'T3')))
|
||||||
|
N0 = (lymph_nodes_positive == 0)
|
||||||
|
N1_or_N1mi = !N0 && (lymph_nodes_positive >= 1 && lymph_nodes_positive <= 3)
|
||||||
|
N1 = N1_or_N1mi && micrometastasis != 1
|
||||||
|
N1mi = N1_or_N1mi && micrometastasis == 1
|
||||||
|
N2 = !N0 && !N1_or_N1mi && (lymph_nodes_positive <= 9)
|
||||||
|
N = (N0 ? 'N0' : (N1 ? 'N1' : (N1mi ? 'N1mi' : (N2 ? 'N2' : 'N3'))))
|
||||||
|
M = (Distant_Metastasis != 1) ? 'M0' : 'M1'
|
||||||
|
pstage = (M == 'M1' ? 4 : ((T == 'T1' && (N == 'N0' || N == 'N1mi')) ? 1 : (((T == 'T2' || T == 'T3') && (N == 'N0')) || ((T == 'T1' || T == 'T2') && (N == 'N1')) ? 2 : 3)) )
|
||||||
|
nposit = ((ratio + 0.1) / 0.1) ^ 0.5
|
||||||
|
grade_2 = (grade == 2 || grade == 4) ? 1 : 0
|
||||||
|
grade_3 = (grade == 3) ? 1 : 0
|
||||||
|
subtype_1 = (ER_status != 2 || PR_status != 2) && (HER2_status != 1)
|
||||||
|
subtype_2 = !subtype_1 && (HER2_status == 1)
|
||||||
|
subtype_3 = !subtype_1 && !subtype_2 && (ER_status == 2 && PR_status == 2 && HER2_status != 1)
|
||||||
|
subtype_HER2 = subtype_2 ? 1 : 0
|
||||||
|
subtype_triple = subtype_3 ? 1 : 0
|
||||||
|
pstage_2 = (pstage == 2) ? 1 : 0
|
||||||
|
pstage_3 = (pstage == 3) ? 1 : 0
|
||||||
|
pstage_4 = (pstage == 4) ? 1 : 0
|
||||||
|
lvi_yes = (lvi == 1) ? 1 : 0
|
||||||
|
chemo = (Chemotherapy == 2) ? 1 : 0
|
||||||
|
radio = (Radiotherapy == 2) ? 1 : 0
|
||||||
|
hormone = (hormone_therapy == 2) ? 1 : 0
|
||||||
|
target = (Targeted_therapy == 2) ? 1 : 0
|
||||||
|
"
|
||||||
|
field :fix_hidden_variables, type: Array, default: []
|
||||||
|
field :tmp_hidden_variables_for_ruby, type: String, default: ""
|
||||||
|
field :tmp_hidden_variables_for_js, type: String, default: ""
|
||||||
|
field :lpv_calc, type: Hash, default: {} #for js code
|
||||||
|
field :tmp_lpv_ruby_code, type: String, default: ""
|
||||||
|
field :tmp_lpv_variables, type: Array, default: []
|
||||||
|
field :mapping_data_from_csv , type: String ,default: ""
|
||||||
|
field :all_variables, type: Array, default: []
|
||||||
|
field :treatment_method, type: Array, default: ['Surgery_only']
|
||||||
|
field :treatment_method_active_indices, type: Array, default: [1]
|
||||||
|
field :result_table, type: String, default: "", localize: true
|
||||||
|
field :result_text, type: String, default: "", localize: true
|
||||||
|
field :therapy_lpv, type: Array, default: [0]
|
||||||
#before_create :set_expire
|
#before_create :set_expire
|
||||||
def delete_empty_font
|
before_save do
|
||||||
self.font_array.each do |font,istrue|
|
self.form_show.each do |num,property|
|
||||||
if font.strip == ""
|
property[:need_map_values] = (property[:map_values].class == Array && property[:choice_fields].class == Array && property[:map_values].length == property[:choice_fields].length) ? 1 : 0
|
||||||
self.font_array.delete(font)
|
end
|
||||||
|
result_keys = []
|
||||||
|
self.form_show.each do |num,property|
|
||||||
|
variable_name = property[:variable]
|
||||||
|
if variable_name.present?
|
||||||
|
result_keys << variable_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.form_show_in_result.each do |num,property|
|
||||||
|
variable_name = property[:variable]
|
||||||
|
if variable_name.present?
|
||||||
|
result_keys << variable_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
mapping_data = JSON.parse(self.mapping_data_from_csv) rescue {}
|
||||||
|
if self.advance_mode && mapping_data.present?
|
||||||
|
mapping_data.each do |k,v|
|
||||||
|
result_keys += (v.keys rescue [])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result_keys = result_keys.uniq
|
||||||
|
self.all_variables = result_keys
|
||||||
|
formula = text_to_math(self.prediction_formula)
|
||||||
|
tmp_hidden_variables = text_to_math(self.hidden_variables)
|
||||||
|
result_keys.each do |k|
|
||||||
|
formula = formula.gsub(/(\A|[^\w])#{k}($|[^\w])/){|f| "#{$1}result[\"#{k.strip}\"]#{$2}" }
|
||||||
|
tmp_hidden_variables = tmp_hidden_variables.gsub(/(\A|[^\w])#{k}($|[^\w])/){|f| "#{$1}result[\"#{k.strip}\"]#{$2}" }
|
||||||
|
end
|
||||||
|
self.tmp_hidden_variables_for_js = tmp_hidden_variables.rstrip.gsub(/\n\s+/,"\n ").gsub("\n",";\n") + ";"
|
||||||
|
self.fix_hidden_variables = []
|
||||||
|
self.tmp_hidden_variables_for_ruby = tmp_hidden_variables.split(/^([^=!]+)=([^=!])/).select{|s| s.present?}.each_slice(2).map do |a,b|
|
||||||
|
a = a.strip
|
||||||
|
self.fix_hidden_variables << a
|
||||||
|
if b
|
||||||
|
("result[\"#{a}\"]=" + b.gsub("\n",""))
|
||||||
|
else
|
||||||
|
a
|
||||||
|
end
|
||||||
|
end.join("\n")
|
||||||
|
self.fix_hidden_variables = self.fix_hidden_variables.uniq
|
||||||
|
formula = formula.split(/^([^=!]+)=([^=!])/).select{|s| s.present?}.each_slice(2).map do |a,b|
|
||||||
|
a = a.strip
|
||||||
|
if b
|
||||||
|
("result[\"#{a}\"]=" + b.gsub("\n",""))
|
||||||
|
else
|
||||||
|
a
|
||||||
|
end
|
||||||
|
end.join("\n")
|
||||||
|
self.fix_hidden_variables.each do |v|
|
||||||
|
formula = formula.gsub(/(\A|[^\w\"])#{v}($|[^\w])/){|f| "#{$1}result[\"#{v.strip}\"]#{$2}"}
|
||||||
|
self.tmp_hidden_variables_for_ruby = self.tmp_hidden_variables_for_ruby.gsub(/(\A|[^\w\"])#{v}($|[^\w])/){|f| "#{$1}result[\"#{v.strip}\"]#{$2}"}
|
||||||
|
end
|
||||||
|
self.tmp_lpv_ruby_code = formula
|
||||||
|
formula_variables = formula.enum_for(:scan,/([^\=\(\)]+)?=[^=]/).map {|x| x[-1] }.compact.map{|s| s.strip[8..-3]}
|
||||||
|
self.tmp_lpv_variables = formula_variables
|
||||||
|
self.tmp_years_settings = self.years_settings.map do |s|
|
||||||
|
text_to_math(s)
|
||||||
|
end
|
||||||
|
self.tmp_years_settings_for_ruby = self.tmp_years_settings.clone
|
||||||
|
formula_variables.each do |variable_name|
|
||||||
|
self.tmp_years_settings_for_ruby = self.tmp_years_settings_for_ruby.map do |y|
|
||||||
|
y.gsub(variable_name,"result[\"#{variable_name}\"]")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.treatment_method = ['Surgery_only']
|
||||||
|
self.form_show_in_result.values.each do |choice|
|
||||||
|
variable = choice["variable"]
|
||||||
|
if variable.present?
|
||||||
|
self.treatment_method << variable
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tmp_table_translations = {}
|
||||||
|
tmp_text_translations = {}
|
||||||
|
@years = self.years
|
||||||
|
@head_name = ['Treatment','Additional_Benefit','Overall_Survival']
|
||||||
|
# @head_name = ['Treatment','Overall_Survival']
|
||||||
|
@therapy_names = self.treatment_method
|
||||||
|
I18n.available_locales.each do |locale|
|
||||||
|
I18n.with_locale(locale) do
|
||||||
|
@table_head = @head_name.map{|name| I18n.t('cancerpredict.table.'+name)}
|
||||||
|
@therapy_choices = [I18n.t('cancerpredict.table.Surgeryonly')]
|
||||||
|
self.form_show_in_result.values.each{|choice| @therapy_choices.push choice["name"][locale].to_s}
|
||||||
|
tmp_table = "<span class=\"result_title print_only\">#{I18n.t("cancerpredict.table.table")}</span><div style=\"clear: both\"></div>"
|
||||||
|
tmp_table += '<input id="current_year" type="hidden" value="'+@years[-1].to_s+'" index="0"/><p id="cancer_table_texts">'+self.table_above_texts[locale].to_s+'</p>'
|
||||||
|
tmp_table += ('<a style="display: inline-block;">'+(locale.to_s == 'zh_tw' ? '第' : '')+'</a><a style="display: inline-block;">')
|
||||||
|
@years.each{|year| tmp_table += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm">'+year.to_s+'</button>')}
|
||||||
|
tmp_table += ('</a><a style="display: inline-block;">'+(locale == 'zh_tw' ? '年' : '')+'</a>')
|
||||||
|
tmp_table += '<table><thead><tr>'
|
||||||
|
@table_head.each_with_index{|head,index| tmp_table += ('<th class="cancer_th '+@head_name[index]+'">' + head + '</th>')}
|
||||||
|
tmp_table += '</tr></thead><tbody>'
|
||||||
|
@therapy_choices.each_with_index do |choice,i|
|
||||||
|
tmp_table += '<tr class="'+@therapy_names[i].to_s+'">'
|
||||||
|
@table_head.each_with_index do |head,index|
|
||||||
|
tmp_table += ('<td class="cancer_td '+ @head_name[index]+'">' + ((index == 0) ? (((i==0)? '' : '+') + choice) : '-') + '</td>')
|
||||||
|
end
|
||||||
|
tmp_table += '</tr>'
|
||||||
|
end
|
||||||
|
tmp_table_translations[locale] = tmp_table
|
||||||
|
@texts = self.text_above_texts[locale].to_s.gsub('<br/>','</span><br/><span>').gsub('{{Surgery_only}}','<span class="'+@therapy_names[0]+' Overall_Survival"></span>')
|
||||||
|
@texts = @texts.split('{{years}}')
|
||||||
|
@texts.delete('')
|
||||||
|
tmp_text = "<span class=\"result_title print_only\">#{I18n.t("cancerpredict.table.text")}</span><div style=\"clear: both\"></div>"
|
||||||
|
tmp_text += ('<span>'+@texts[0].to_s)
|
||||||
|
@years.each{|year| tmp_text += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm" style="float:none;">'+year.to_s+'</button>')}
|
||||||
|
if @texts.count > 1
|
||||||
|
tmp_text += (@texts[1]+'</span>') if @texts.count > 1
|
||||||
|
else
|
||||||
|
tmp_text += '</span>'
|
||||||
|
end
|
||||||
|
if !self.surgery_only_texts[locale].blank?
|
||||||
|
@surgery_only_texts = self.surgery_only_texts[locale]
|
||||||
|
@surgery_only_texts.insert(0,'<p class="show"><span>')
|
||||||
|
@surgery_only_texts = @surgery_only_texts.gsub('{{Surgery_only}}','<span class="'+@therapy_names[0]+' Overall_Survival"></span><span>')
|
||||||
|
@surgery_only_texts = @surgery_only_texts.gsub('{{surgery_year}}','</span><span class="surgery_year">'+@years[-1].to_s+'</span><span>')
|
||||||
|
@surgery_only_texts += '</span>'
|
||||||
|
else
|
||||||
|
@surgery_only_texts = ''
|
||||||
|
end
|
||||||
|
tmp_text += @surgery_only_texts
|
||||||
|
tmp_text += '<span class="addition">'+(self.extra_texts[locale].to_s rescue '')+'</span><div class="extra-text" style="display:none;"><div class="texts_show" style="clear:both;"></div></div></p>'
|
||||||
|
tmp_text_translations[locale] = tmp_text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.result_table_translations = tmp_table_translations
|
||||||
|
self.result_text_translations = tmp_text_translations
|
||||||
|
self.treatment_method_active_indices = [1]
|
||||||
|
self.form_show_in_result.each do |num, property|
|
||||||
|
v = property[:active_choice]
|
||||||
|
if v.present?
|
||||||
|
self.treatment_method_active_indices << (v - 1)
|
||||||
|
else
|
||||||
|
self.treatment_method_active_indices << 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.lpv_calc = get_years_settings_dict
|
||||||
|
self.generate_eval_formula
|
||||||
|
end
|
||||||
|
def reload_any_asset(path, type=nil, force_reload=false)
|
||||||
|
env = Rails.application.assets
|
||||||
|
new_env = Sprockets::Environment.new(Rails.root.to_s) do |env|
|
||||||
|
env.version = ::Rails.env
|
||||||
|
tmp_path = "#{Rails.application.config.root}/tmp/cache/assets/#{::Rails.env}"
|
||||||
|
env.cache = ::Sprockets::Cache::FileStore.new(tmp_path)
|
||||||
|
env.context_class.class_eval do
|
||||||
|
include ::Sprockets::Rails::Helper
|
||||||
|
end
|
||||||
|
end
|
||||||
|
new_env.config = env.config
|
||||||
|
stats = env.cached.instance_variable_get(:@stats)
|
||||||
|
new_path = path.sub(/\.erb$/,'')
|
||||||
|
if force_reload || (stats && stats[path]) #Need reload asset
|
||||||
|
if type.nil?
|
||||||
|
ext = File.extname(new_path)
|
||||||
|
env.mime_types.each do |t, h|
|
||||||
|
if h[:extensions].include?(ext)
|
||||||
|
type = t
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def update_user
|
if type
|
||||||
User.find(update_user_id) rescue nil
|
full_path = 'file://'+path+'?type='+type
|
||||||
|
uris = env.cached.instance_variable_get(:@uris)
|
||||||
|
keys = uris.keys.select{|k| k.include?(full_path)}
|
||||||
|
asset = new_env.load(full_path)
|
||||||
|
if keys.count != 0
|
||||||
|
keys.each do |k|
|
||||||
|
uris[k] = asset
|
||||||
end
|
end
|
||||||
def update_user=(user)
|
|
||||||
self.update_user_id = user.id
|
|
||||||
end
|
end
|
||||||
def email_members
|
new_path = new_path.sub(/\.[^.]+$/){|ext| '-' + asset.digest + ext}
|
||||||
MemberProfile.find(self.email_member_ids) rescue []
|
File.binwrite(new_path, asset.to_s)
|
||||||
end
|
yield new_path if block_given?
|
||||||
def email_addresses
|
|
||||||
addresses = self.email_members.collect{|member| member.email} rescue []
|
|
||||||
addresses = addresses +[self.other_mailaddress] if !self.other_mailaddress.blank?
|
|
||||||
addresses.flatten
|
|
||||||
end
|
|
||||||
def email
|
|
||||||
mail = Email.find(self.email_id) rescue nil
|
|
||||||
end
|
|
||||||
def expired?
|
|
||||||
(self.deadline < Time.now) rescue false
|
|
||||||
end
|
|
||||||
def destroy_email
|
|
||||||
mail = Email.find(self.email_id) rescue nil
|
|
||||||
mail.destroy if !mail.nil?
|
|
||||||
end
|
|
||||||
def self.remove_expired_status
|
|
||||||
self.where(:is_top => true, :top_end_date.ne => nil, :top_end_date.lt => Time.now).each do |b|
|
|
||||||
b.is_top = false
|
|
||||||
b.top_end_date = nil
|
|
||||||
b.save
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def reload_js_asset(path, force_reload=false)
|
||||||
|
reload_any_asset(path, 'application/javascript', force_reload) do |new_path|
|
||||||
|
File.open(JSFileName, 'w+'){|f| f.write(new_path)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def generate_eval_formula
|
||||||
|
eval_hidden_variables = "def eval_hidden_variables(result); #{self.tmp_hidden_variables_for_ruby}; end"
|
||||||
|
CancerpredictsController.module_eval(eval_hidden_variables)
|
||||||
|
eval_formula = "def eval_formula(result); #{self.tmp_lpv_ruby_code}; end"
|
||||||
|
CancerpredictsController.module_eval(eval_formula)
|
||||||
|
end
|
||||||
|
def generate_jscode
|
||||||
|
js_code = "var map_values , mapping_hash , temp_index ,temp_value , index , closest_value;\r\n"
|
||||||
|
mapping_data_from_csv = JSON.parse(self.mapping_data_from_csv) rescue {}
|
||||||
|
tmp_hash = self.form_show.values + self.form_show_in_result.values
|
||||||
|
tmp_hash.each do |property|
|
||||||
|
@variable = property[:variable]
|
||||||
|
if @variable.present?
|
||||||
|
if property[:is_num] == 1
|
||||||
|
js_code += " result['#{@variable}'] = Number(result_json['#{@variable}']);\r\n"
|
||||||
|
elsif property[:choice_fields].present?
|
||||||
|
if !(self.advance_mode)
|
||||||
|
js_code += " result['#{@variable}'] = Number(result_json['#{@variable}']);\r\n"
|
||||||
|
else
|
||||||
|
if property[:need_map_values] == 1
|
||||||
|
js_code += " map_values = #{property[:map_values]};\r\n"
|
||||||
|
js_code += " result['#{@variable}'] = map_values[Number(result_json['#{@variable}'']) - 1];\r\n"
|
||||||
|
else
|
||||||
|
if property[:revert_value] != 1
|
||||||
|
js_code += " result['#{@variable}'] = Number(result_json['#{@variable}']) - 1;\r\n"
|
||||||
|
else
|
||||||
|
js_code += " result['#{@variable}'] = (#{property[:choice_fields].length} - Number(result_json['#{@variable}']));\r\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.advance_mode && property[:cancer_predict_mapping_file].present?
|
||||||
|
if (mapping_data_from_csv != {} && !mapping_data_from_csv[@variable].blank?)
|
||||||
|
js_code += " mapping_hash = mapping_data_from_csv['#{@variable}'];\r\n"
|
||||||
|
js_code += " temp_index = 0;\r\n"
|
||||||
|
js_code += " temp_value = result['#{@variable}'];\r\n"
|
||||||
|
js_code += " index = 0;
|
||||||
|
$.each(mapping_hash,function(k,v){
|
||||||
|
if( index == 0 ){
|
||||||
|
var index_val = v.indexOf(temp_value);
|
||||||
|
if( index_val != -1 ){
|
||||||
|
temp_index = index_val;
|
||||||
|
}else{
|
||||||
|
closest_value = v.get_nearest_value(temp_value);
|
||||||
|
temp_index = v.indexOf(closest_value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result[k] = v[temp_index];
|
||||||
|
index++;
|
||||||
|
});\r\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
js_code += "\n Object.keys(result).forEach(function(k){
|
||||||
|
if(Number.isNaN(result[k])){
|
||||||
|
result[k] = 0;
|
||||||
|
}
|
||||||
|
})"
|
||||||
|
js_code += "\n #{self.tmp_hidden_variables_for_js}"
|
||||||
|
formula = text_to_math(self.prediction_formula)
|
||||||
|
self.all_variables.each do |k|
|
||||||
|
formula = formula.gsub(/(\A|[^\w])#{k}($|[^\w])/){|f| "#{$1}result[\"#{k.strip}\"]#{$2}" }
|
||||||
|
end
|
||||||
|
formula_variables = self.tmp_lpv_variables.map{|v| v}
|
||||||
|
js_code = "\n function calculate_first_lpv(result_json){
|
||||||
|
result = {};
|
||||||
|
#{js_code}
|
||||||
|
try{
|
||||||
|
#{formula.gsub(/\s{2,10}/," ").gsub("\n","\n ")}
|
||||||
|
}catch(e){console.log(e)};
|
||||||
|
result['lpv_variable'] = {};
|
||||||
|
#{formula_variables.map{|v| "result['lpv_variable']['#{v}'] = #{v};"}.join("\n ") }
|
||||||
|
result['lpv'] = #{formula_variables.count == 0 ? 0 : formula_variables.last};
|
||||||
|
result['lpv_variable']['lpv'] = result['lpv'];
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
function calculate_and_change_result_value(obj){
|
||||||
|
obj.servive_ratio_arr = [];
|
||||||
|
for(var i = 0;i<obj.active_treatment.length;i++){
|
||||||
|
var servive_ratio = round(calculate_servive_ratio(obj.year,obj.lpv_real[i])*100,2);
|
||||||
|
var benefit = servive_ratio - obj.servive_ratio_arr[obj.servive_ratio_arr.length-1];
|
||||||
|
obj.servive_ratio_arr.push(servive_ratio);
|
||||||
|
$('tr.'+obj.active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||||
|
$('.'+obj.active_treatment[i]+'.Overall_Survival').html(Math.round(servive_ratio));
|
||||||
|
if(i != 0){
|
||||||
|
$('tr.'+obj.active_treatment[i]+' td.Additional_Benefit').html(round(benefit,2)+'%');
|
||||||
|
$('.'+obj.active_treatment[i]+'.Additional_Benefit').html(Math.round(benefit));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//$('.'+obj.active_treatment[0]+'.Overall_Survival').html(Math.round(obj.servive_ratio_arr[0]));
|
||||||
|
};"
|
||||||
|
@years = self.years
|
||||||
|
switch_texts = "
|
||||||
|
#{formula_variables.map{|v| "var #{v} = obj['#{v}'];"}.join("\n ")}
|
||||||
|
switch(year) {"
|
||||||
|
@years.each do |year|
|
||||||
|
year_index = @years.index(year)
|
||||||
|
switch_texts +=
|
||||||
|
"
|
||||||
|
case '#{year}':
|
||||||
|
servive_ratio = #{text_to_math(self.years_settings[year_index])};
|
||||||
|
break;"
|
||||||
|
end
|
||||||
|
switch_texts += "
|
||||||
|
default:
|
||||||
|
console.log('not found year.');
|
||||||
|
}"
|
||||||
|
js_code = js_code +"
|
||||||
|
|
||||||
|
function calculate_servive_ratio(year,obj){
|
||||||
|
var servive_ratio;#{switch_texts}
|
||||||
|
return servive_ratio;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
return js_code
|
||||||
|
end
|
||||||
|
def text_to_math(text)
|
||||||
|
text.gsub("\r\n","\n").gsub('^','**').gsub('exp','Math.exp').gsub('log','Math.log')
|
||||||
|
end
|
||||||
|
def replace_str_with_idx(org_str,st, ed, replace_str)
|
||||||
|
org_str.slice!(st, ed - st + 1)
|
||||||
|
org_str.insert(st, replace_str)
|
||||||
|
org_str
|
||||||
|
end
|
||||||
|
def auto_write_predict_js(force_reload=true)
|
||||||
|
js_codes = generate_jscode
|
||||||
|
save_path = "#{ModuleAppPath}/app/assets/javascripts/#{JS}"
|
||||||
|
file_texts = File.read(save_path)
|
||||||
|
need_write = false
|
||||||
|
str1 = "/* auto add start */"
|
||||||
|
index1 = file_texts.index(str1)
|
||||||
|
str2 = "/* auto add end */"
|
||||||
|
index2 = file_texts.index(str2)
|
||||||
|
if (!index1.nil? && !index2.nil?)
|
||||||
|
file_texts = replace_str_with_idx(file_texts, index1 + str1.length, index2 - 1, js_codes)
|
||||||
|
need_write = true
|
||||||
|
end
|
||||||
|
str3 = "/*lpv_calc_formula_start*/"
|
||||||
|
index3 = file_texts.index(str3)
|
||||||
|
str4 = "/*lpv_calc_formula_end*/"
|
||||||
|
index4 = file_texts.index(str4)
|
||||||
|
if (!index3.nil? && !index4.nil?)
|
||||||
|
file_texts = replace_str_with_idx(file_texts, index3 + str3.length, index4 - 1, self.lpv_calc.to_json.gsub("@",".") + ';')
|
||||||
|
need_write = true
|
||||||
|
end
|
||||||
|
tmp_disable_jscodes = ""
|
||||||
|
str5 = "/*disable_condition start*/"
|
||||||
|
index5 = file_texts.index(str5)
|
||||||
|
str6 = "/*disable_condition end*/"
|
||||||
|
index6 = file_texts.index(str6)
|
||||||
|
self.form_show_in_result.each do |num,property|
|
||||||
|
if property[:disable_condition].present?
|
||||||
|
tmp = property[:disable_condition].clone
|
||||||
|
self.all_variables.each do |k|
|
||||||
|
tmp = tmp.gsub(/(\A|[^\w])#{k}($|[^\w])/){|f| "#{$1}post_json[\"#{k}\"]#{$2}" }
|
||||||
|
end
|
||||||
|
variable = property[:variable]
|
||||||
|
tmp_disable_jscodes += "\n if(#{tmp}){
|
||||||
|
$('##{variable} .cancer_table_btn').attr('disabled','disabled');
|
||||||
|
$('[for=\"#{variable}\"]').css('color','rgb(204, 204, 204)');
|
||||||
|
}else{
|
||||||
|
$('##{variable} .cancer_table_btn').removeAttr('disabled');
|
||||||
|
$('[for=\"#{variable}\"]').css('color','');
|
||||||
|
}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (!index5.nil? && !index6.nil?)
|
||||||
|
tmp_disable_jscodes += "\n\t\t\t"
|
||||||
|
file_texts = replace_str_with_idx(file_texts, index5 + str5.length, index6 - 1, tmp_disable_jscodes)
|
||||||
|
need_write = true
|
||||||
|
end
|
||||||
|
str7 = "/*therapy_lpv start*/"
|
||||||
|
index7 = file_texts.index(str7)
|
||||||
|
str8 = "/*therapy_lpv end*/"
|
||||||
|
index8 = file_texts.index(str8)
|
||||||
|
self.therapy_lpv = [0]
|
||||||
|
self.form_show_in_result.each do |num,property|
|
||||||
|
if property[:lpv_impact].present?
|
||||||
|
self.therapy_lpv << property[:lpv_impact]
|
||||||
|
else
|
||||||
|
self.therapy_lpv << 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (!index7.nil? && !index8.nil?)
|
||||||
|
file_texts = replace_str_with_idx(file_texts, index7 + str7.length, index8 - 1, self.therapy_lpv.to_s + ';')
|
||||||
|
need_write = true
|
||||||
|
end
|
||||||
|
if need_write
|
||||||
|
File.write(save_path,file_texts)
|
||||||
|
reload_js_asset(save_path, force_reload)
|
||||||
|
elsif !(File.exist?(JSFileName))
|
||||||
|
File.open(JSFileName, 'w+'){|f| f.write(save_path)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def get_years_settings_dict
|
||||||
|
lpv_variable_name = (prediction_formula.include?("=") ? prediction_formula.split("=")[0].strip : "" rescue "")
|
||||||
|
res = self.years.map.with_index do |y, i|
|
||||||
|
tmp_formula = self.tmp_years_settings[i]
|
||||||
|
if lpv_variable_name.present?
|
||||||
|
tmp_formula = tmp_formula.gsub(lpv_variable_name, "lpv_current")
|
||||||
|
else
|
||||||
|
tmp_formula = tmp_formula.gsub("lpv", "lpv_current")
|
||||||
|
end
|
||||||
|
[y.to_s.sub(".","@"), tmp_formula]
|
||||||
|
end
|
||||||
|
res.to_h
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,25 @@
|
||||||
|
class Cancerpredictrecord
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
include OrbitModel::Status
|
||||||
|
include OrbitModel::Impression
|
||||||
|
# encoding: utf-8
|
||||||
|
include OrbitTag::Taggable
|
||||||
|
include OrbitCategory::Categorizable
|
||||||
|
field :title ,type:String ,default:""
|
||||||
|
field :submit_time ,type:String ,default:""
|
||||||
|
field :result , type:Hash , default:{}
|
||||||
|
field :names , type:Hash , default:{}
|
||||||
|
field :values , type:Hash , default:{}
|
||||||
|
field :submit_numbers , type:Fixnum , default: 1
|
||||||
|
scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])}
|
||||||
|
scope :is_approved, ->{where(:approved => true)}
|
||||||
|
before_save :set_submit_times
|
||||||
|
def set_submit_times
|
||||||
|
self.submit_time = Cancerpredictrecord.all.count + 1
|
||||||
|
end
|
||||||
|
def check_missing_data
|
||||||
|
missing_keys = self.names.keys - self.result.keys rescue []
|
||||||
|
missing_keys.each{|k| self.result[k] = "" }
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
class HeadImagesUploader < CarrierWave::Uploader::Base
|
||||||
|
|
||||||
|
# Include RMagick or ImageScience support:
|
||||||
|
# include CarrierWave::RMagick
|
||||||
|
# include CarrierWave::ImageScience
|
||||||
|
|
||||||
|
# Choose what kind of storage to use for this uploader:
|
||||||
|
# storage :file
|
||||||
|
# storage :s3
|
||||||
|
|
||||||
|
# Override the directory where uploaded files will be stored.
|
||||||
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
|
def store_dir
|
||||||
|
return "uploads/#{model.class.to_s.underscore}/predict_tool"
|
||||||
|
end
|
||||||
|
|
||||||
|
# override
|
||||||
|
def filename
|
||||||
|
@original_filename
|
||||||
|
end
|
||||||
|
|
||||||
|
def cache_dir
|
||||||
|
"#{Rails.root}/tmp/uploads"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
class Headimages
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
include OrbitModel::Status
|
||||||
|
include OrbitModel::Impression
|
||||||
|
# encoding: utf-8
|
||||||
|
include OrbitTag::Taggable
|
||||||
|
include OrbitCategory::Categorizable
|
||||||
|
mount_uploader :temp_file, HeadImagesUploader
|
||||||
|
field :cancerpredictfields_id ,type:String ,default:""
|
||||||
|
field :title ,type:String ,default:""
|
||||||
|
field :sort_number ,type:Integer ,default: 0
|
||||||
|
end
|
|
@ -0,0 +1,38 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
wb = xlsx_package.workbook
|
||||||
|
wb.add_worksheet(name: "cancer_tool") do |sheet|
|
||||||
|
if !results[0].nil?
|
||||||
|
row = []
|
||||||
|
title = sheet.styles.add_style(:bg_color => "FFFF00",:border=>{ :style => :thin, :color => "666666" },:alignment=>{ :horizontal => :center,:vertical => :center ,:wrap_text => true})
|
||||||
|
column = sheet.styles.add_style(:alignment=>{ :horizontal => :center,:vertical => :center ,:wrap_text => true},:border=>{ :style => :thin, :color => "666666" })
|
||||||
|
row << ((I18n.locale=="en") ? 'submit time' : '提交時間')
|
||||||
|
@fields = results.first.names.keys
|
||||||
|
@fields.each do |field_name|
|
||||||
|
row << results.first.names[field_name][I18n.locale.to_s].split('<br/>')[0]
|
||||||
|
end
|
||||||
|
#export data start
|
||||||
|
export_data_rows = []
|
||||||
|
results.each do |result|
|
||||||
|
temp_row = []
|
||||||
|
temp_row << result.created_at.to_s
|
||||||
|
result.result.each do |key,value|
|
||||||
|
if key != "locale"
|
||||||
|
if (result.values[key][I18n.locale.to_s].length == 0 rescue true)
|
||||||
|
temp_row << value
|
||||||
|
else
|
||||||
|
v = result.values[key][I18n.locale.to_s][value.to_i-1] rescue nil
|
||||||
|
temp_row << (v.nil? ? value : v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
export_data_rows << temp_row
|
||||||
|
end
|
||||||
|
|
||||||
|
#export data end
|
||||||
|
sheet.add_row row , :style=> title,:widths => row.map{|cell| (cell.length* 11/ 2).round}
|
||||||
|
export_data_rows.each do |infos_row|
|
||||||
|
sheet.add_row infos_row , :style=> column
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,472 +1,38 @@
|
||||||
<% content_for :page_specific_css do %>
|
<tr>
|
||||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
<td class="remove_div">❌</td>
|
||||||
<%= stylesheet_link_tag "lib/fileupload" %>
|
<td class="sort_div"></td>
|
||||||
<%= stylesheet_link_tag "lib/main-list" %>
|
<% keys.each do |key| %>
|
||||||
<% end %>
|
<td class="<%=key%>">
|
||||||
<% content_for :page_specific_javascript do %>
|
<% if key.include? "_file" %>
|
||||||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
<%= render :partial => 'form_file', :object => (CancerPredictMappingFile.where(:id=> property[key]).first rescue nil), :locals => {:f => make_fields, :key=>key} %>
|
||||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
|
||||||
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
|
||||||
<%= javascript_include_tag "lib/file-type" %>
|
|
||||||
<%= javascript_include_tag "lib/module-area" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- Input Area -->
|
|
||||||
<div class="input-area">
|
|
||||||
|
|
||||||
<!-- Module Tabs -->
|
|
||||||
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
|
||||||
<ul class="nav nav-pills module-nav">
|
|
||||||
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
|
||||||
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
|
|
||||||
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
|
||||||
<li><a href="#imageupload" data-toggle="tab"><%= t(:image) %></a></li>
|
|
||||||
<li><a href="#mail-group" data-toggle="tab"><%= t('announcement.email_reminder')%></a></li>
|
|
||||||
</ul>
|
|
||||||
<!-- Module -->
|
|
||||||
<div class="tab-content module-area">
|
|
||||||
|
|
||||||
<!-- Basic Module -->
|
|
||||||
<div class="tab-pane fade in active" id="basic">
|
|
||||||
|
|
||||||
<!-- Category -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:category) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= select_category(f, @module_app) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Date Time Picker -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:start_date) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @bulletin.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:end_date) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @bulletin.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control-group">
|
|
||||||
<%= f.label :is_external_link, t("announcement.is_external_link"), :class => "control-label muted" %>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.check_box :is_external_link %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control-group" style="display: none;" id="external_link_box">
|
|
||||||
<%= f.label :external_link, t("announcement.external_link"), :class => "control-label muted" %>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field :external_link %>
|
|
||||||
<div class="hint"><%= t("announcement.external_link_hint") %></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Status Module -->
|
|
||||||
<div class="tab-pane fade" id="status">
|
|
||||||
|
|
||||||
<!-- Status -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:status) %></label>
|
|
||||||
<div class="controls" data-toggle="buttons-checkbox">
|
|
||||||
<label class="checkbox inline btn <%= 'active' if @bulletin.is_top? || (!@bulletin.top_end_date.nil? && @bulletin.top_end_date > Time.now) %>">
|
|
||||||
<%= f.check_box :is_top %> <%= t(:top) %>
|
|
||||||
</label>
|
|
||||||
<label class="checkbox inline btn <%= 'active' if @bulletin.is_hot? %>">
|
|
||||||
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
|
||||||
</label>
|
|
||||||
<label class="checkbox inline btn <%= 'active' if @bulletin.is_hidden? %>">
|
|
||||||
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="controls">
|
|
||||||
<% if !@bulletin.is_top? && !AnnouncementSetting.check_limit_for_user((@bulletin.new_record? ? current_user.id : @bulletin.create_user_id)) %>
|
|
||||||
<span>Top limit has been reached. The bulletin wont be marked as top even if you click on it.</span>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="control-group <%= @bulletin.is_top? || (!@bulletin.top_end_date.nil? && @bulletin.top_end_date > Time.now) ? "" : "hide" %>" data-for="is_top">
|
|
||||||
<label for="" class="control-label muted">Top end time</label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.datetime_picker :top_end_date, :no_label => true, :new_record => @bulletin.new_record? %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<%# end %>
|
|
||||||
|
|
||||||
<!-- Tag Module -->
|
|
||||||
<div class="tab-pane fade" id="tag">
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:tags) %></label>
|
|
||||||
<%= select_tags(f, @module_app) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Images Module -->
|
|
||||||
<div class="tab-pane fade" id="imageupload">
|
|
||||||
|
|
||||||
<!-- Images Upload -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:image) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @bulletin.image.file %>" data-provides="fileupload">
|
|
||||||
<div class="fileupload-new thumbnail pull-left">
|
|
||||||
<% if @bulletin.image.file %>
|
|
||||||
<%= image_tag @bulletin.image %>
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
<% value = property[key] %>
|
||||||
|
<% value_type = Cancerpredictfields::FIELDINFO[key] %>
|
||||||
|
<% value = "[]" if property == {} && value_type == 'Array' %>
|
||||||
|
<% is_localized = Cancerpredictfields::NonLoclaized.exclude?(key) %>
|
||||||
|
<% @value= value %>
|
||||||
|
<% if is_localized %>
|
||||||
|
<% @disp_value = @value[I18n.locale.to_s] rescue "" %>
|
||||||
|
<%else%>
|
||||||
|
<% @disp_value = @value %>
|
||||||
<%end%>
|
<%end%>
|
||||||
</div>
|
<% @disp_value = bc_yaml_dump(@disp_value) if value_type == 'Array' %>
|
||||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
<% field_type = ((value_type == 'String' || value_type == 'Array' || value_type == 'Float') ? "text_field" : value_type) %>
|
||||||
<span class="btn btn-file">
|
<% if value_type == 'Fixnum' %>
|
||||||
<span class="fileupload-new"><%= t(:select_image) %></span>
|
<% if @value == 1%>
|
||||||
<span class="fileupload-exists"><%= t(:change) %></span>
|
<%= make_fields.check_box key,{:checked=>true,:class=>"checkbox",:style=>"float:left;"}%>
|
||||||
<%= f.file_field :image %>
|
<% else%>
|
||||||
</span>
|
<%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%>
|
||||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
<%end%>
|
||||||
<div class="controls" data-toggle="buttons-checkbox">
|
<% elsif is_localized %>
|
||||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
<%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%>
|
||||||
<%= f.check_box :remove_image %><%= t(:remove) %>
|
<%= locale_fields.send(field_type, key,{:value=>@disp_value}) %>
|
||||||
</label>
|
<%end%>
|
||||||
</div>
|
<% else %>
|
||||||
</div>
|
<%= make_fields.send(field_type, key,{:value=>@disp_value})%>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% @site_in_use_locales.each do |locale| %>
|
|
||||||
<%= f.fields_for :image_description_translations do |f| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted" for="image_description_<%= locale.to_s %>"><%= t(:description) + " (#{t(locale.to_s)})" %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, value: (@bulletin.image_description_translations[locale.to_s] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<%end%>
|
<%end%>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
</td>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Mail Group Module -->
|
|
||||||
<div class="tab-pane fade" id="mail-group">
|
|
||||||
|
|
||||||
<!-- Mail Group -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t("announcement.email_to") %></label>
|
|
||||||
<div class="controls">
|
|
||||||
|
|
||||||
<label class="checkbox inline">
|
|
||||||
<%= check_box_tag('bulletin[email_sent]', '1', (!@bulletin.email_sent.blank? ? true : false), :id=>'remind-check') %><%= t('announcement.activate_email_reminder')%>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="content-box">
|
|
||||||
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'bulletin[email_member_ids][]', email_members: @bulletin.email_members} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"></label>
|
|
||||||
<div class="controls">
|
|
||||||
<div class="content-box">
|
|
||||||
<span class="help-block"><%= "#{t("announcement.other_mailaddress")}(#{t("announcement.other_mailaddress_note")})"%> </span>
|
|
||||||
<%= f.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content-box">
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t("announcement.email_sentdate") %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.datetime_picker :email_sentdate, :no_label => true %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% if (@bulletin.email.is_sent rescue false) %>
|
|
||||||
<div class="content-box">
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t("announcement.resend_mail") %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<input type="checkbox" name="resend_mail" value="true">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Language Tabs -->
|
|
||||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
|
||||||
<ul class="nav nav-pills language-nav">
|
|
||||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
||||||
<li class="<%= 'active' if i == 0 %>">
|
|
||||||
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!-- Language -->
|
|
||||||
<div class="tab-content language-area">
|
|
||||||
|
|
||||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
||||||
|
|
||||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
|
||||||
|
|
||||||
<!-- Title-->
|
|
||||||
<div class="control-group input-title">
|
|
||||||
<label class="control-label muted"><%= t(:title) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@bulletin.title_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Sub Title -->
|
|
||||||
<div class="control-group input-subtitle">
|
|
||||||
<label class="control-label muted"><%= t(:subtitle) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<div class="textarea">
|
|
||||||
<%= f.fields_for :subtitle_translations do |f| %>
|
|
||||||
<%= f.text_area locale, rows: 2, class: "input-block-level", value: (@bulletin.subtitle_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Content -->
|
|
||||||
<div class="control-group input-content">
|
|
||||||
<label class="control-label muted"><%= t(:content) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<div class="textarea">
|
|
||||||
<%= f.fields_for :text_translations do |f| %>
|
|
||||||
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@bulletin.text_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- Link -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:link) %></label>
|
|
||||||
<div class="controls add-input">
|
|
||||||
|
|
||||||
<!-- Exist -->
|
|
||||||
<% if @bulletin && !@bulletin.bulletin_links.blank? %>
|
|
||||||
<div class="exist">
|
|
||||||
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
|
|
||||||
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
|
|
||||||
<%= render :partial => 'form_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- Add -->
|
|
||||||
<div class="add-target">
|
|
||||||
</div>
|
|
||||||
<p class="add-btn">
|
|
||||||
<%= hidden_field_tag 'bulletin_link_field_count', @bulletin.bulletin_links.count %>
|
|
||||||
<a id="add_link" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- File -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:file_) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
|
|
||||||
<!-- Exist -->
|
|
||||||
<% if @bulletin && !@bulletin.bulletin_files.blank? %>
|
|
||||||
<div class="exist">
|
|
||||||
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
|
|
||||||
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
|
|
||||||
<%= render :partial => 'form_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- Add -->
|
|
||||||
<div class="add-target">
|
|
||||||
</div>
|
|
||||||
<p class="add-btn">
|
|
||||||
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
|
|
||||||
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Form Actions -->
|
|
||||||
<div class="form-actions">
|
|
||||||
<%= get_referer_url[:action] rescue "" %>
|
|
||||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|
||||||
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
|
||||||
<%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %>
|
|
||||||
<%= link_to t('cancel'), admin_announcements_path, :class=>"btn" %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<span id='show_preview'>
|
|
||||||
<div class="modal hide fade in banner-preview" id="">
|
|
||||||
<div class="modal-header">
|
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
|
||||||
<h3><%= t(:preview) %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<iframe id="preview-iframe" src=""></iframe>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
<% if !@module_app.tags.empty? %>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$("form.previewable").on("submit", function(){
|
|
||||||
if(!$("input[name='bulletin[tags][]']").is(":checked")){
|
|
||||||
if(!confirm("You have selected no tag, do you wish to continue?")){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<% end %>
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<script>
|
|
||||||
function Appendzero(obj)
|
|
||||||
{
|
|
||||||
if(obj<10) return "0" +""+ obj;
|
|
||||||
else return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
if (location.pathname.substr(-3)=='new'){
|
|
||||||
var getDate = new Date();
|
|
||||||
var toDay = getDate.getFullYear()+"/"+ (Appendzero(getDate.getMonth()+1))+"/"+Appendzero(getDate.getDate())+" "+Appendzero(getDate.getHours())+":"+Appendzero(getDate.getMinutes());
|
|
||||||
$('input[name="bulletin[postdate]"]').val(toDay);
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#main-wrap").after("");
|
|
||||||
|
|
||||||
$(document).on('click', '#add_link', function(){
|
|
||||||
var new_id = $(this).prev().attr('value');
|
|
||||||
var old_id = new RegExp("new_bulletin_links", "g");
|
|
||||||
var on = $('.language-nav li.active').index();
|
|
||||||
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|
||||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
||||||
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :bulletin_links) %>").replace(old_id, new_id));
|
|
||||||
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|
||||||
formTip();
|
|
||||||
});
|
|
||||||
$(document).on('click', '#add_file', function(){
|
|
||||||
var new_id = $(this).prev().attr('value');
|
|
||||||
var old_id = new RegExp("new_bulletin_files", "g");
|
|
||||||
var on = $('.language-nav li.active').index();
|
|
||||||
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|
||||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
||||||
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :bulletin_files) %>").replace(old_id, new_id));
|
|
||||||
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
|
||||||
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|
||||||
});
|
|
||||||
formTip();
|
|
||||||
});
|
|
||||||
$(document).on('click', '.delete_link', function(){
|
|
||||||
$(this).parents('.input-prepend').remove();
|
|
||||||
});
|
|
||||||
$(document).on('click', '.delete_file', function(){
|
|
||||||
$(this).parents('.input-prepend').remove();
|
|
||||||
});
|
|
||||||
$(document).on('click', '.remove_existing_record', function(){
|
|
||||||
if(confirm("<%= I18n.t(:sure?)%>")){
|
|
||||||
$(this).children('.should_destroy').attr('value', 1);
|
|
||||||
$(this).parents('.start-line').hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
|
|
||||||
$('#remind-check').on('change', function() {
|
|
||||||
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
|
|
||||||
})
|
|
||||||
|
|
||||||
$('#button_for_preview').click(function(){
|
|
||||||
var method = $('.main-forms input[name="_method"]').val();
|
|
||||||
$('.main-forms input[name="_method"]').val("post");
|
|
||||||
|
|
||||||
for ( instance in CKEDITOR.instances )
|
|
||||||
CKEDITOR.instances[instance].updateElement();
|
|
||||||
|
|
||||||
var formData = new FormData( $('.main-forms')[0] );
|
|
||||||
formData.append("preview_type", ( (method==undefined) ? "new" : "edit" ));
|
|
||||||
formData.append("bulletin_id", '<%= @bulletin.id.to_s %>');
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: '<%= admin_announcement_preview_path %>',
|
|
||||||
data : formData,
|
|
||||||
processData: false,
|
|
||||||
contentType: false
|
|
||||||
}).done(function(data){
|
|
||||||
if(window.location.protocol === "https:"){
|
|
||||||
data = data.replace("http:","https:");
|
|
||||||
}
|
|
||||||
$('.modal-body iframe').attr('src',data);
|
|
||||||
$('#show_preview .modal').modal();
|
|
||||||
$('#show_preview .modal').height(function() {
|
|
||||||
return $(window).height() * 0.7;
|
|
||||||
});
|
|
||||||
|
|
||||||
var slug = data.split('/')[(data.split('/').length-1)];
|
|
||||||
// $('#preview-iframe').on('load', function(){
|
|
||||||
// $.get('/admin/announcement/destroy_preview/'+slug,function(data){
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
$('.main-forms input[name="_method"]').val(method);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#bulletin_is_top").parent().on("click",function(){
|
|
||||||
setTimeout(function(){
|
|
||||||
if($("#bulletin_is_top").parent().hasClass("active")){
|
|
||||||
$("div[data-for=is_top]").removeClass("hide");
|
|
||||||
}else{
|
|
||||||
$("div[data-for=is_top]").addClass("hide");
|
|
||||||
$("div[data-for=is_top]").find("input[type=text]").val("");
|
|
||||||
}
|
|
||||||
},100)
|
|
||||||
})
|
|
||||||
|
|
||||||
$("#bulletin_is_external_link").on("click",function(){
|
|
||||||
if($(this).is(":checked")){
|
|
||||||
$("#external_link_box").show();
|
|
||||||
}else{
|
|
||||||
$("#external_link_box").hide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<%end%>
|
<%end%>
|
||||||
|
<td><%= make_fields.hidden_field :old_num,:value=>num.to_s %></td>
|
||||||
|
</tr>
|
|
@ -1,69 +1,33 @@
|
||||||
<% if form_file.new_record? %>
|
<% if form_file.nil? %>
|
||||||
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
|
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
|
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
|
||||||
<% if form_file.file.blank? %>
|
<% if form_file.temp_file.blank? %>
|
||||||
<%= t(:no_file) %>
|
<%= t(:no_file) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
|
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.temp_file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= f.fields_for key do |f|%>
|
||||||
<div class="input-prepend input-append">
|
<div class="input-prepend input-append">
|
||||||
<label>
|
<label>
|
||||||
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
|
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
|
||||||
<i class="icons-paperclip"></i>
|
<i class="icons-paperclip"></i>
|
||||||
<%= f.file_field :file %>
|
<%= f.file_field :temp_file %>
|
||||||
</span>
|
</span>
|
||||||
<div class="uneditable-input input-medium">
|
<div class="uneditable-input input-medium">
|
||||||
<i class="icon-file fileupload-exists"></i>
|
<i class="icon-file fileupload-exists"></i>
|
||||||
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
|
<span class="fileupload-preview"><%= (form_file.nil? || form_file.temp_file.blank?) ? t(:select_file) : t(:change_file) %></span>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
|
|
||||||
<span class="tab-content">
|
|
||||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
||||||
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% if !form_file.nil? %>
|
||||||
</span>
|
|
||||||
<span class="add-on icons-pencil" title='<%= t(:description) %>'></span>
|
|
||||||
<span class="tab-content">
|
|
||||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
||||||
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
|
|
||||||
<%= f.fields_for :description_translations do |f| %>
|
|
||||||
<%= f.text_field locale, :class => "input-medium", placeholder: t(:description), :value => (form_file.description_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span class="add-on btn-group btn" title="<%= t('archive.show_lang') %>">
|
|
||||||
<i class="icons-earth"></i> <span class="caret"></span>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<% @site_in_use_locales.each do |locale| %>
|
|
||||||
<li>
|
|
||||||
<label class="checkbox">
|
|
||||||
<%= check_box_tag "bulletin[bulletin_files_attributes][#{( form_file.new_record? ? 'new_bulletin_files' : "#{i}" )}][choose_lang][]", locale, form_file.choose_lang.include?(locale.to_s) %>
|
|
||||||
<%= t(locale.to_s) %>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<%= hidden_field_tag 'bulletin[bulletin_files_attributes][0][choose_lang][]', '' %>
|
|
||||||
</span>
|
|
||||||
<% if form_file.new_record? %>
|
|
||||||
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
|
|
||||||
<a class="icon-trash"></a>
|
|
||||||
</span>
|
|
||||||
<% else %>
|
|
||||||
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
|
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
|
||||||
<%= f.hidden_field :id %>
|
<%= f.hidden_field :id,:value=>(form_file.id) %>
|
||||||
<a class="icon-remove"></a>
|
<a class="icon-remove"></a>
|
||||||
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<!-- if this page editing please add class "fileupload-edit" -->
|
||||||
|
<div class="fileupload fileupload-new clearfix" data-provides="fileupload">
|
||||||
|
<span class="show_span"><%= t('cancerpredict.sort_num')+': ' %></span>
|
||||||
|
<%= f.text_field 'sort_number',{:class=>'sort_num',:value=>((image_form['sort_number'] == nil) ? i+1 : image_form['sort_number'] ),:style=>'float: left;width: 3em;'} %>
|
||||||
|
<span class="show_span"><%= t('cancerpredict.logo')+': ' %></span>
|
||||||
|
<div class="fileupload-new thumbnail pull-left">
|
||||||
|
<% if image_form.temp_file.file.present? %>
|
||||||
|
<%= image_tag( image_form.temp_file, :size=>"120x120") rescue ''%>
|
||||||
|
<% else %>
|
||||||
|
<%= image_tag "/assets/site-logo.png", :class => "pull-left upload-picture"%>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||||
|
<% if image_form.temp_file.file.present?%>
|
||||||
|
<span class="btn btn-file">
|
||||||
|
<%= f.file_field :temp_file, {:id => "input-upload", :class => 'fileupload-new', :accept=> 'image/png,image/gif,image/jpeg'} %><%= t('preferences.change') %>
|
||||||
|
</span>
|
||||||
|
<%= f.check_box :remove_image,{:checked=>false} %>
|
||||||
|
<%= t(:remove) %> <%= (I18n.locale.to_s == 'en') ? ' this logo' : '該logo' %>
|
||||||
|
<%else%>
|
||||||
|
<span class="btn btn-file">
|
||||||
|
<%= f.file_field :temp_file,{ :id => "input-upload", :class => 'fileupload-new', :accept=> 'image/png,image/gif,image/jpeg'} %><%= t('preferences.select_image') %>
|
||||||
|
</span>
|
||||||
|
<%end%>
|
||||||
|
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,225 +1,489 @@
|
||||||
<div style="clear:both;"></div>
|
<%= stylesheet_link_tag "lib/fileupload"%>
|
||||||
<% @i = 0 %>
|
<%= stylesheet_link_tag "lib/togglebox"%>
|
||||||
<button id="clickall"><%= (I18n.locale.to_s == "zh_tw") ? "全選" : "select all" %></button>
|
<% content_for :page_specific_javascript do %>
|
||||||
<button id="unclickall"><%= (I18n.locale.to_s == "zh_tw") ? "取消全選" : "unselect all" %></button>
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||||
<%=form_for @file_to_show ,:url=>{:controller=>"patchfiles" ,:action=>"edit"} do |file|%>
|
<%#= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||||
<%= file.fields_for :file_show do |filefield|%>
|
<%#= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||||
<div id="fileform">
|
<%= javascript_include_tag "lib/file-type" %>
|
||||||
|
<%= javascript_include_tag "lib/module-area" %>
|
||||||
|
<%= javascript_include_tag "form" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% @file_to_show.file_show.each do |name,property| %>
|
|
||||||
<span style="clear:both;">
|
|
||||||
<%if property[:status].to_i == 1%>
|
|
||||||
<%=filefield.check_box name,{:checked=>true,:id=>"checkbox"+@i.to_s,:class=>"checkbox",:style=>"float:left;"}%>
|
|
||||||
<%else%>
|
|
||||||
<%=filefield.check_box name,{:checked=>false,:id=>"checkbox"+@i.to_s,:class=>"checkbox",:style=>"float:left;"}%>
|
|
||||||
<%end%>
|
|
||||||
<label for="<%="checkbox"+@i.to_s%>" class="checklabel" style="float:left;"><%=name%></label>
|
|
||||||
<div style="clear:both;"></div>
|
|
||||||
<% @i = @i+1 %>
|
|
||||||
<% @j = 0 %>
|
|
||||||
<%= file.fields_for :sub_file_fields do |each_files|%>
|
|
||||||
<%= each_files.fields_for name do |each_file|%>
|
|
||||||
<% property[:files].each do |file_name,sub_property| %>
|
|
||||||
<%if sub_property[:status].to_i == 1%>
|
|
||||||
<%=each_file.check_box file_name,{:checked=>true,:id=>"checkbox"+@i.to_s,:class=>"sub_checkbox",:style=>"float:left;margin-left:1em;",:index=>@j}%>
|
|
||||||
<%else%>
|
|
||||||
<%=each_file.check_box file_name,{:checked=>false,:id=>"checkbox"+@i.to_s,:class=>"sub_checkbox",:style=>"float:left;margin-left:1em;",:index=>@j}%>
|
|
||||||
<%end%>
|
|
||||||
<% file_name = file_name.gsub("@",".") %>
|
|
||||||
<label for="<%="checkbox"+@i.to_s%>" class="sub_checklabel" style="float:left;"><%=file_name%></label>
|
|
||||||
<div style="clear:both;"></div>
|
|
||||||
<% @i = @i+1 %>
|
|
||||||
<% @j = @j+1 %>
|
|
||||||
<% end %>
|
|
||||||
<%end%>
|
|
||||||
<%end%>
|
|
||||||
</span>
|
|
||||||
<%end%>
|
|
||||||
</div>
|
|
||||||
<%end%>
|
|
||||||
<%=file.submit "#{t(:updatefont)}",{:id=>"updatebtn",:onclick=>"return updatefcn()"}%>
|
|
||||||
<%=file.text_field :recovery_btn, {:id=>"hidden-recovery",:type => "hidden",:value=>"false"} %>
|
|
||||||
<%=file.text_field :refresh_btn, {:id=>"hidden-refresh",:type => "hidden",:value=>"false"} %>
|
|
||||||
<button id="seemessage" onclick="return seelogfcn()"><%=(I18n.locale.to_s =="zh_tw") ? "查看上次更新的logs" : "see logs of prev update "%></button>
|
|
||||||
<button id="recoverybtn" onclick="return recoveryfcn()"><%=(I18n.locale.to_s =="zh_tw") ? "復原到上次更新的檔案狀態" : "recovery to prev file status"%></button>
|
|
||||||
<button id="destroy_mongofield" onclick="return destroy_mongofield_fcn()"><%=(I18n.locale.to_s =="zh_tw") ? "刷新可更新的檔案狀態" : "refresh the status of the update files"%></button>
|
|
||||||
<%end%>
|
|
||||||
<a>網站目錄根路徑:<%=Dir.pwd.to_s%></a>
|
|
||||||
<li id ="ckeditorFont" class="show_li">
|
|
||||||
<a title="CKEDITOR現有字形">CKEDITOR現有字形</a>
|
|
||||||
<% @ckicktosee_str = (I18n.locale.to_s == "en") ? "click me to see all font which CKEDITOR have now" : "點擊我來查看編輯器所有目前擁有的字形" %>
|
|
||||||
<a id="clicktosee" title="<%= @ckicktosee_str %>" class="Toggleclass"><%= @ckicktosee_str %></a>
|
|
||||||
<ul>
|
|
||||||
<% @font_array.each do |font|%>
|
|
||||||
<li><a title="<%= font %>"><%= font %></a></li>
|
|
||||||
<%end%>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<a></a>
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.show_li,.show_li *{
|
.sort_div:before{
|
||||||
list-style:none;
|
content: "\e096";
|
||||||
color:balck;
|
font-family: 'entypo';
|
||||||
}
|
|
||||||
.show_li ul{
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
#clicktosee{
|
|
||||||
color:blue;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.sort_div{
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
.sort_table tbody td:last-child{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.remove_div{
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.remove_div:hover{
|
||||||
|
font-size: 1.3em;
|
||||||
|
}
|
||||||
|
<% Cancerpredictfields::AdvanceFields.each do |field| %>
|
||||||
|
table .<%=field%>{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
table.advance_mode .<%=field%>{
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
<% end%>
|
||||||
|
.solid_line_hr{
|
||||||
|
margin: 0.3em;
|
||||||
|
border-top: 0.2em dashed;
|
||||||
|
}
|
||||||
|
.sort_table input, .sort_table textarea{
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
.advance_mode_help_btn{
|
||||||
|
float:left;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0em 0.475em;
|
||||||
|
font-size: 1.25em;
|
||||||
|
border-radius: 1.5em;
|
||||||
|
background-color: rgb(210, 106, 2);
|
||||||
|
border-color: rgb(210, 106, 2);
|
||||||
|
color: white;
|
||||||
|
width: 1.8em;
|
||||||
|
height: 1.8em;
|
||||||
|
line-height: 1em;
|
||||||
|
}
|
||||||
|
#show_advance_mode_modal {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<div id="show_advance_mode_modal" class="modal fade">
|
||||||
|
<div class='modal-dialog'>
|
||||||
|
<div class='modal-content'>
|
||||||
|
<div class='modal-header'>
|
||||||
|
<button type='button' aria-hidden='true' class='close'>×</button>
|
||||||
|
<h4 class='modal-title'>
|
||||||
|
<%= t("cancerpredict.module_mode") %>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<%= t("cancerpredict.advance_mode_hint2").html_safe %>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<%=form_for @form_to_show ,:url=>{:controller=>"cancerpredicts" ,:action=>"edit"} do |form|%>
|
||||||
|
<span class="show_span"><%= t('cancerpredict.title') %></span>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<label class="label_left" for="title_text"><%= t('cancerpredict.title_text')+':' %></label>
|
||||||
|
<%=form.fields_for :title_texts do |locale_fields|%>
|
||||||
|
<%=locale_fields.text_field I18n.locale.to_s ,{:value => @form_to_show.title_texts[I18n.locale.to_s],:id=>"title_text"} %>
|
||||||
|
<% end %>
|
||||||
|
<% if @title_images.length != 0%>
|
||||||
|
<% @title_images.each_with_index do |temp_image,i| %>
|
||||||
|
<%= form.fields_for "title_images" do |image_fields| %>
|
||||||
|
<div class="image_field title_images" value="<%=(i+1).to_s%>">
|
||||||
|
<%= image_fields.fields_for i.to_s do |image_field| %>
|
||||||
|
<%= render :partial => 'image_form', :object => temp_image, :locals => {:f => image_field, :i => i} %>
|
||||||
|
<% if i.to_i == @title_images.length - 1%>
|
||||||
<script>
|
<script>
|
||||||
$('.Toggleclass').off("click").on("click",function(){
|
$(document).on('click', '#add_file.title_images', function(){
|
||||||
$(this).parent().find(">ul").slideToggle();
|
var old_id = $('.image_field.title_images').eq(-1).attr('value');
|
||||||
|
if( old_id == undefined)
|
||||||
|
old_id = 0;
|
||||||
|
else
|
||||||
|
old_id = Number(old_id);
|
||||||
|
var new_id = old_id + 1;
|
||||||
|
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => i}).gsub("\"","\'").html_safe %>"
|
||||||
|
$(this).parent().siblings('.add-target.title_images').before(('<div class="image_field title_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
||||||
|
var name = $('.image_field.title_images').eq(-1).find('[type="file"]').attr('name');
|
||||||
|
$('.image_field.title_images').eq(-1).find('[type="file"]').attr('name',name.replace("<%=i%>",new_id-1));
|
||||||
|
name = $('.image_field.title_images').eq(-1).find('input.sort_num').attr('name');
|
||||||
|
$('.image_field.title_images').eq(-1).find('input.sort_num').attr('name',name.replace("<%=i%>",new_id-1));
|
||||||
|
new_id = $('.image_field.title_images').eq(-2).find('input.sort_num').val();
|
||||||
|
$('.image_field.title_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
||||||
|
formTip();
|
||||||
});
|
});
|
||||||
$('.checkbox').off('click').on('click',function(){
|
</script>
|
||||||
for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){
|
<% end %>
|
||||||
if($(this).is(":checked") == false){
|
<% end %>
|
||||||
if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == true)
|
<% end %>
|
||||||
$(this).parent().find('.sub_checkbox').eq(i).click();
|
<% end %>
|
||||||
}else{
|
<% else %>
|
||||||
if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == false)
|
<%= form.fields_for "title_images" do |image_fields| %>
|
||||||
$(this).parent().find('.sub_checkbox').eq(i).click();
|
<%= image_fields.fields_for "0" do |image_field| %>
|
||||||
};
|
<script>
|
||||||
};
|
$(document).on('click', '#add_file.title_images', function(){
|
||||||
});
|
var old_id = $('.image_field.title_images').eq(-1).attr('value');
|
||||||
$('.sub_checkbox').off('click').on('click',function(){
|
if( old_id == undefined)
|
||||||
var num = 0;
|
old_id = 0;
|
||||||
var index = 0;
|
else
|
||||||
for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){
|
old_id = Number(old_id);
|
||||||
if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == true){
|
var new_id = old_id + 1;
|
||||||
num += 1;
|
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => 0}).gsub("\"","\'").html_safe %>"
|
||||||
};
|
$(this).parent().siblings('.add-target.title_images').before(('<div class="image_field title_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
||||||
};
|
var name = $('.image_field.title_images').eq(-1).find('[type="file"]').attr('name');
|
||||||
if( num == $(this).parent().find('.sub_checkbox').length){
|
$('.image_field.title_images').eq(-1).find('[type="file"]').attr('name',name.replace("0",new_id-1));
|
||||||
if( $(this).parent().find('.checkbox').is(":checked") == false)
|
name = $('.image_field.title_images').eq(-1).find('input.sort_num').attr('name');
|
||||||
$(this).parent().find('.checkbox').click();
|
$('.image_field.title_images').eq(-1).find('input.sort_num').attr('name',name.replace("0",new_id-1));
|
||||||
}else{
|
new_id = $('.image_field.title_images').eq(-2).find('input.sort_num').val();
|
||||||
if( $(this).parent().find('.checkbox').is(":checked") == true){
|
if(new_id != undefined)
|
||||||
$(this).parent().find('.checkbox').click();
|
$('.image_field.title_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
||||||
for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){
|
else
|
||||||
if($(this).parent().find('.sub_checkbox').eq(i).attr('id') != $(this).attr('id'))
|
$('.image_field.title_images').eq(-1).find('input.sort_num').val(1);
|
||||||
$(this).parent().find('.sub_checkbox').eq(i).click();
|
formTip();
|
||||||
}
|
});
|
||||||
};
|
</script>
|
||||||
}
|
<% end %>
|
||||||
});
|
<% end %>
|
||||||
$("#clickall").off("click").on("click",function(){
|
<% end %>
|
||||||
for(var i =0;i<$(".sub_checkbox").length ; i++){
|
<div class="add-target title_images"></div>
|
||||||
if($(".checkbox").eq(i).is(":checked") == false)
|
<p class="add-btn">
|
||||||
$(".checkbox").eq(i).click();
|
<%= hidden_field_tag 'title_images_count', @title_images.count %>
|
||||||
}
|
<a id="add_file" class="title_images trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t('cancerpredict.add_image') %></a>
|
||||||
});
|
</p>
|
||||||
$("#unclickall").off("click").on("click",function(){
|
<span class="show_span"><%= t('cancerpredict.tool_head_pictures') %></span>
|
||||||
for(var i =0;i<$(".sub_checkbox").length ; i++){
|
<div style="clear:both;"></div>
|
||||||
if($(".checkbox").eq(i).is(":checked") == true)
|
<% if @head_images.length != 0%>
|
||||||
$(".checkbox").eq(i).click();
|
<% @head_images.each_with_index do |temp_image,i| %>
|
||||||
}
|
<%= form.fields_for "head_images" do |image_fields| %>
|
||||||
});
|
<div class="head_images image_field" value="<%=(i+1).to_s%>">
|
||||||
function seelogfcn(){
|
<%= image_fields.fields_for i.to_s do |image_field| %>
|
||||||
if($( "#dialog-confirm" ).length != 0)
|
<%= render :partial => 'image_form', :object => temp_image, :locals => {:f => image_field, :i => i} %>
|
||||||
$( "#dialog-confirm" ).remove();
|
<% if i.to_i == @head_images.length - 1%>
|
||||||
if(I18n.locale == "zh_tw"){
|
<script>
|
||||||
$('body').after("<div id='dialog-confirm' title='上次更新的logs'></div>");
|
$(document).on('click', '#add_file.head_images', function(){
|
||||||
}else{
|
var old_id = $('.image_field').eq(-1).attr('value');
|
||||||
$('body').after("<div id='dialog-confirm' title='logs of prev update?'></div>");
|
if( old_id == undefined)
|
||||||
};
|
old_id = 0;
|
||||||
$( "#dialog-confirm" ).append($.parseHTML("<%= @file_to_show.last_message.gsub("\"","\'").html_safe %>"));
|
else
|
||||||
$( "#dialog-confirm" ).dialog({
|
old_id = Number(old_id);
|
||||||
resizable: true,
|
var new_id = old_id + 1;
|
||||||
height:200,
|
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => i}).gsub("\"","\'").html_safe %>"
|
||||||
modal: true,
|
$(this).parent().siblings('.add-target.head_images').before(('<div class="image_field" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
||||||
buttons: {
|
var name = $('.image_field').eq(-1).find('[type="file"]').attr('name');
|
||||||
<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){
|
$('.image_field').eq(-1).find('[type="file"]').attr('name',name.replace("<%=i%>",new_id-1));
|
||||||
$( this ).dialog( "close" );
|
name = $('.image_field').eq(-1).find('input.sort_num').attr('name');
|
||||||
},
|
$('.image_field').eq(-1).find('input.sort_num').attr('name',name.replace("<%=i%>",new_id-1));
|
||||||
<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() {
|
new_id = $('.image_field').eq(-2).find('input.sort_num').val();
|
||||||
$( this ).dialog( "close" );
|
$('.image_field').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
||||||
}
|
formTip();
|
||||||
}
|
});
|
||||||
});
|
</script>
|
||||||
return false;
|
<% end %>
|
||||||
};
|
<% end %>
|
||||||
function updatefcn(){
|
<% end %>
|
||||||
var str="";
|
<% end %>
|
||||||
var num =1;
|
<% else %>
|
||||||
for(var i =0;i<$(".sub_checkbox").length ; i++){
|
<%= form.fields_for "head_images" do |image_fields| %>
|
||||||
if($(".sub_checkbox").eq(i).is(":checked") == true){
|
<%= image_fields.fields_for "0" do |image_field| %>
|
||||||
str += ("</br><i style='color:red;'>"+num+". "+$(".sub_checklabel").eq(i).html()+"</i>");
|
<script>
|
||||||
num += 1;
|
$(document).on('click', '#add_file.head_images', function(){
|
||||||
}
|
var old_id = $('.image_field.head_images').eq(-1).attr('value');
|
||||||
}
|
if( old_id == undefined)
|
||||||
if($( "#dialog-confirm" ).length != 0)
|
old_id = 0;
|
||||||
$( "#dialog-confirm" ).remove();
|
else
|
||||||
if(I18n.locale == "zh_tw"){
|
old_id = Number(old_id);
|
||||||
$('body').after("<div id='dialog-confirm' title='你確定要更新嗎?'>"+
|
var new_id = old_id + 1;
|
||||||
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+
|
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => 0}).gsub("\"","\'").html_safe %>"
|
||||||
"按下確認鍵後,你將更新你所選的檔案。"+str+"</p>"
|
$(this).parent().siblings('.add-target.head_images').before(('<div class="image_field head_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
||||||
+"</div>");
|
var name = $('.image_field.head_images').eq(-1).find('[type="file"]').attr('name');
|
||||||
}else{
|
$('.image_field.head_images').eq(-1).find('[type="file"]').attr('name',name.replace("0",new_id-1));
|
||||||
$('body').after("<div id='dialog-confirm' title='Are you sure to update?'>"+
|
name = $('.image_field.head_images').eq(-1).find('input.sort_num').attr('name');
|
||||||
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+
|
$('.image_field.head_images').eq(-1).find('input.sort_num').attr('name',name.replace("0",new_id-1));
|
||||||
"After click confirm button,you will update the selected file."+str+"</p>"
|
new_id = $('.image_field.head_images').eq(-2).find('input.sort_num').val();
|
||||||
+"</div>");
|
if(new_id != undefined)
|
||||||
};
|
$('.image_field.head_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
||||||
$( "#dialog-confirm" ).dialog({
|
else
|
||||||
resizable: true,
|
$('.image_field.head_images').eq(-1).find('input.sort_num').val(1);
|
||||||
height:200,
|
formTip();
|
||||||
modal: true,
|
});
|
||||||
buttons: {
|
</script>
|
||||||
<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){
|
<% end %>
|
||||||
$( this ).dialog( "close" );
|
<% end %>
|
||||||
$('.edit_filefield').submit();
|
<% end %>
|
||||||
},
|
<div class="add-target head_images"></div>
|
||||||
<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() {
|
<p class="add-btn">
|
||||||
$( this ).dialog( "close" );
|
<%= hidden_field_tag 'head_images_count', @head_images.count %>
|
||||||
}
|
<a id="add_file" class="head_images trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t('cancerpredict.add_image') %></a>
|
||||||
}
|
</p>
|
||||||
});
|
<span class="show_span"><%= t('cancerpredict.text_descibe') %></span>
|
||||||
return false;
|
<div style="clear:both;"></div>
|
||||||
};
|
<textarea class="ckeditor" id="cancerpredictfields_text_descibe_<%=I18n.locale.to_s%>" name="cancerpredictfields[text_descibe][<%=I18n.locale.to_s%>]">
|
||||||
function recoveryfcn(){
|
<%= @form_to_show.text_descibe[I18n.locale.to_s] %>
|
||||||
var str="";
|
</textarea>
|
||||||
var num =1;
|
<span class="show_span"><%= t('cancerpredict.font_size') %></span>
|
||||||
for(var i =0;i<$(".sub_checkbox").length ; i++){
|
<div style="clear:both;"></div>
|
||||||
if($(".sub_checkbox").eq(i).is(":checked") == true){
|
<% @size=['small','medium','large'] %>
|
||||||
str += ("</br><i style='color:red;'>"+num+". "+$(".sub_checklabel").eq(i).html()+"</i>");
|
<% @size.each do |size|%>
|
||||||
num += 1;
|
<%= form.fields_for size do |make_size| %>
|
||||||
}
|
<div><label class="label_left" for=<%='font_'+size%>><%=t('cancerpredict.'+size)+':'%></label><%= make_size.text_field 'font_size',{:value=> @form_to_show[size]['font_size'],:id=>'font_'+size} %>
|
||||||
}
|
<% if @form_to_show[size]['active'].to_i == 1%>
|
||||||
if($( "#dialog-confirm" ).length != 0)
|
<%= make_size.check_box 'active',{:checked=>true,:class=>"checkbox text_choice",:style=>"float:left;"}%></div>
|
||||||
$( "#dialog-confirm" ).remove();
|
<% else%>
|
||||||
if(I18n.locale == "zh_tw"){
|
<%= make_size.check_box 'active',{:checked=>false,:class=>"checkbox text_choice",:style=>"float:left;"}%></div>
|
||||||
$('body').after("<div id='dialog-confirm' title='你確定要還原嗎?'>"+
|
<%end%>
|
||||||
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+
|
<%end%>
|
||||||
"按下確認鍵後,你將還原你所選的檔案。"+str+"</p>"
|
<%end%>
|
||||||
+"</div>");
|
<span class="show_span"><%= t('cancerpredict.module_mode') %></span>
|
||||||
}else{
|
<div style="clear:both;"></div>
|
||||||
$('body').after("<div id='dialog-confirm' title='Are you sure to recover?'>"+
|
<div class="control-group">
|
||||||
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+
|
<label class="control-label" for="advance_mode" style="float: left; line-height: 30px;margin-right: 1em;">
|
||||||
"After click confirm button,you will recover the selected file."+str+"</p>"
|
<span style="float: left;"><%= t('cancerpredict.advance_mode') %></span>
|
||||||
+"</div>");
|
<button type="button" class="advance_mode_help_btn" data-target="#show_advance_mode_modal"><i aria-hidden="true" class="fa fa-question"></i></button>
|
||||||
}
|
</label>
|
||||||
$( "#dialog-confirm" ).dialog({
|
<div class="controls">
|
||||||
resizable: true,
|
<input id="advance_mode" name="<%=form.object_name%>[advance_mode]" type="checkbox" class="toggle-check" data-disabled="<%=!(form.object.advance_mode)%>">
|
||||||
height:200,
|
</div>
|
||||||
modal: true,
|
</div>
|
||||||
buttons: {
|
<div style="clear:both;"></div>
|
||||||
<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){
|
<span class="show_span"><%= t('cancerpredict.Input_fields') %></span>
|
||||||
$('#hidden-recovery').val("true");
|
<div style="clear:both;"></div>
|
||||||
$( this ).dialog( "close" );
|
<table id="fields_table" class="sort_table <%=@form_to_show.advance_mode ? 'advance_mode' : '' %>">
|
||||||
$('.edit_filefield').submit();
|
<% keys = Cancerpredictfields::FIELDINFO.keys - Cancerpredictfields::TherapyOnly %>
|
||||||
},
|
<thead>
|
||||||
<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() {
|
<tr>
|
||||||
$('#hidden-recovery').val("false");
|
<th></th>
|
||||||
$( this ).dialog( "close" );
|
<th></th>
|
||||||
}
|
<% keys.each do |key|%>
|
||||||
}
|
<th class="<%=key%>"><%=t("cancerpredict.table.#{key}")%></th>
|
||||||
});
|
<%end%>
|
||||||
return false;
|
</tr>
|
||||||
};
|
</thead>
|
||||||
function destroy_mongofield_fcn(){
|
<tbody>
|
||||||
$('#hidden-refresh').val('true');
|
<%= form.fields_for :form_show do |formfield|%>
|
||||||
};
|
<% @form_to_show.form_show.each do |num,property| %>
|
||||||
|
<%=formfield.fields_for num.to_s do |make_fields|%>
|
||||||
|
<%= render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>property,:num=>num,:keys => keys} %>
|
||||||
|
<%end%>
|
||||||
|
<%end%>
|
||||||
|
<%end%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<button id="add_field" type="button" class="btn btn-primary"><%= t('cancerpredict.table.add_field') %></button>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<span class="show_span"><%=t('cancerpredict.table.Results')%></span>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<label for="form_result_is_right" style="float: left;"><%= t('cancerpredict.result_is_right') %></label>
|
||||||
|
<% if @form_to_show.form_result_is_right.to_i == 1%>
|
||||||
|
<div><%= form.check_box "form_result_is_right",{:checked=>true,:class=>"checkbox",:style=>"float: left;position: relative;left: 0;transform: none!important;margin-left: 1em;",:id=>"form_result_is_right"}%></div>
|
||||||
|
<% else%>
|
||||||
|
<div><%= form.check_box "form_result_is_right",{:checked=>false,:class=>"checkbox",:style=>"float: left;position: relative;left: 0;transform: none!important;margin-left: 1em;",:id=>"form_result_is_right"}%></div>
|
||||||
|
<%end%>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<% @create_items = ['years','table_above_texts','text_above_texts','surgery_only_texts','extra_texts','extra_therapy_texts','danger_texts','texts_between_Result_and_result_block']
|
||||||
|
array_indices = [0]
|
||||||
|
%>
|
||||||
|
<% @create_items.each_with_index do |item, i|%>
|
||||||
|
<label for="<%=item%>" style="float: left;margin-right:1em;width:11em;"><%= t('cancerpredict.'+item)+':' %></label>
|
||||||
|
<% if @form_to_show[item].class == BSON::Document || @form_to_show[item].class == Hash %>
|
||||||
|
<%= form.fields_for item do |locale_fields|%>
|
||||||
|
<% value = @form_to_show[item][I18n.locale.to_s]
|
||||||
|
if array_indices.include?(i)
|
||||||
|
value = bc_yaml_dump(value)
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<%= locale_fields.text_field I18n.locale.to_s,{:value=> value,:id=> item,:style=>'width:calc(100% - 16em)'} %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<% value = @form_to_show[item]
|
||||||
|
if array_indices.include?(i)
|
||||||
|
value = bc_yaml_dump(value)
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<%= form.text_field item,{:value=> value,:id=> item,:style=>'width:calc(100% - 16em)'} %>
|
||||||
|
<% end %>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<% end %>
|
||||||
|
<table id="therapies_table" class="sort_table <%=@form_to_show.advance_mode ? 'advance_mode' : '' %>">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<% keys = Cancerpredictfields::TherapyFields %>
|
||||||
|
<% keys.each do |key,vlaue|%>
|
||||||
|
<th class="<%=key%>"><%=t("cancerpredict.table.#{key}")%></th>
|
||||||
|
<%end%>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%= form.fields_for :form_show_in_result do |formfield|%>
|
||||||
|
<% @form_to_show.form_show_in_result.each do |num,property| %>
|
||||||
|
<%=formfield.fields_for num.to_s do |make_fields|%>
|
||||||
|
<%= render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>property,:num=>num,:keys => Cancerpredictfields::TherapyFields} %>
|
||||||
|
<%end%>
|
||||||
|
<%end%>
|
||||||
|
<%end%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<button id="add_therapy" type="button" class="btn btn-primary"><%= t('cancerpredict.table.add_therapy') %></button>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<span class="show_span"><%=t('cancerpredict.table.calculate_settings')%></span>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="control-label" style="float: left;margin-right: 1em;width: 11em;">
|
||||||
|
<label><%= t('cancerpredict.hidden_variables') %></label>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<%= form.text_area :hidden_variables, :rows=>"5", :style=> 'width: 100%;font-family: sans-serif;' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="control-label" style="float: left;margin-right: 1em;width: 11em;">
|
||||||
|
<label><%= t('cancerpredict.table.prediction_formula') %></label>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<%= form.text_area :prediction_formula, :rows=>"5", :style=> 'width: 100%;font-family: sans-serif;' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="years_settings">
|
||||||
|
<% years = @form_to_show.years %>
|
||||||
|
<% years.each_with_index do |year,i| %>
|
||||||
|
<div data-year="<%= year.to_s.strip %>">
|
||||||
|
<div class="control-label" style="float: left;margin-right: 1em;width: 13em;">
|
||||||
|
<label style="font-family: sans-serif;"><%=t("cancerpredict.Overall_Survival")%>(t=<%=year%> Year)</label>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<textarea name="<%= form.object_name %>[years_settings][]" style= "width: calc(100% - 16em);" value="<%= @form_to_show.years_settings[i] rescue '' %>"><%= @form_to_show.years_settings[i] rescue '' %></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<%=form.submit "#{t(:updatefont)}",{:id=>"updatebtn"}%>
|
||||||
|
<%end%>
|
||||||
|
<link href="/assets/admin/cancerpredict.css" media="screen" rel="stylesheet">
|
||||||
|
<script>
|
||||||
|
$(".advance_mode_help_btn").click(function(){
|
||||||
|
$("#show_advance_mode_modal").modal();
|
||||||
|
})
|
||||||
|
$("#show_advance_mode_modal button").click(function(){
|
||||||
|
$("#show_advance_mode_modal").modal("hide");
|
||||||
|
})
|
||||||
|
$("#advance_mode").click(function(){
|
||||||
|
if(window.confirm("<%=t('cancerpredict.advance_mode_hint1').gsub("\n","\\n")%>")){
|
||||||
|
$("#fields_table,#therapies_table").toggleClass("advance_mode");
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$('.text_choice').click(function(){
|
||||||
|
$('.text_choice').prop('checked' , false);
|
||||||
|
$(this).prop('checked' , true);
|
||||||
|
});
|
||||||
|
$("#add_field").click(function(){
|
||||||
|
var index = $("#fields_table tbody tr").length.toString();
|
||||||
|
<%= fields_for :cancerpredictfields do |form|%>
|
||||||
|
<%= form.fields_for :form_show do |formfield|%>
|
||||||
|
<%=formfield.fields_for :new_index do |make_fields|%>
|
||||||
|
<% keys = Cancerpredictfields::FIELDINFO.keys - Cancerpredictfields::TherapyOnly %>
|
||||||
|
var html = "<%= "#{render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>{},:num=>'',:keys => keys}}".gsub(/(\r\n|\n)/,"").gsub("\"","\\\"").html_safe %>";
|
||||||
|
$("#fields_table tbody").append(html.replaceAll('new_index',index));
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
$(".remove_div").off("click").on("click",function(){
|
||||||
|
$el = $(this).parent().siblings("tr").not($(this)).eq(0);
|
||||||
|
$(this).parent().remove();
|
||||||
|
update_key($el);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
$("#add_therapy").click(function(){
|
||||||
|
var index = $("#therapies_table tbody tr").length.toString();
|
||||||
|
<%= fields_for :cancerpredictfields do |form|%>
|
||||||
|
<%= form.fields_for :form_show_in_result do |formfield|%>
|
||||||
|
<%=formfield.fields_for :new_index do |make_fields|%>
|
||||||
|
<% keys = Cancerpredictfields::TherapyFields %>
|
||||||
|
var html = "<%= "#{render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>{},:num=>'',:keys => keys}}".gsub(/(\r\n|\n)/,"").gsub("\"","\\\"").html_safe %>";
|
||||||
|
$("#therapies_table tbody").append(html.replaceAll('new_index',index));
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
$(".remove_div").off("click").on("click",function(){
|
||||||
|
$el = $(this).parent().siblings("tr").not($(this)).eq(0);
|
||||||
|
$(this).parent().remove();
|
||||||
|
update_key($el);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
function update_key(ele){
|
||||||
|
console.log($(ele))
|
||||||
|
var ui_child=$(ele).parent().find('> tr');
|
||||||
|
console.log(ui_child);
|
||||||
|
for (var i=0;i<ui_child.length;i++){
|
||||||
|
var now_ele = ui_child.eq(i);
|
||||||
|
var $inputs = now_ele.find('input');
|
||||||
|
$inputs.each(function(input_index,input){
|
||||||
|
var name = input.name;
|
||||||
|
name = $.map(name.split(/(\[|\])/),function(v,ii){
|
||||||
|
var vv = v;
|
||||||
|
var num = Number.parseInt(vv);
|
||||||
|
if(!Number.isNaN(num)){
|
||||||
|
vv = i.toString();
|
||||||
|
}
|
||||||
|
return vv;
|
||||||
|
}).join("");
|
||||||
|
console.log(name)
|
||||||
|
input.name = name;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$( ".sort_table > tbody" ).sortable({
|
||||||
|
axis: "y",
|
||||||
|
revert: true,
|
||||||
|
placeholder: "sortable-placeholder",
|
||||||
|
handle: ".sort_div",
|
||||||
|
update: function(event, ui) {
|
||||||
|
update_key($(ui.item[0]))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(".remove_div").click(function(){
|
||||||
|
$el = $(this).parent().siblings("tr").not($(this)).eq(0);
|
||||||
|
$(this).parent().remove();
|
||||||
|
update_key($el);
|
||||||
|
})
|
||||||
|
$(".remove_existing_record").click(function(){
|
||||||
|
if(window.confirm("Are you sure want to remove this file?")){
|
||||||
|
$(this).find(".should_destroy").val("1");
|
||||||
|
$(this).parent().siblings(".file-link").remove();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$("#years").on('blur',function(){
|
||||||
|
var years = [];
|
||||||
|
try{
|
||||||
|
years = $(this).val().split(/\[|,|\]/).filter(function(aa){return aa !="" && aa != undefined}).map(function(aa){return aa.trim()});
|
||||||
|
}catch(e){};
|
||||||
|
var index = 0;
|
||||||
|
years.forEach(function(year){
|
||||||
|
if($("#years_settings [data-year='"+year+"']").length == 0){
|
||||||
|
var year_text = ('<div data-year="'+year+'">'+
|
||||||
|
'<div class="control-label" style="float: left;margin-right: 1em;width: 13em;">'+
|
||||||
|
'<label style="font-family: sans-serif;"><%=t("cancerpredict.Overall_Survival")%>(t='+year+' Year)</label>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="controls">'+
|
||||||
|
'<textarea name="cancerpredictfields[years_settings][]" style= "width: calc(100% - 16em);"></textarea>'+
|
||||||
|
'</div>'+
|
||||||
|
'</div>');
|
||||||
|
if(index != 0){
|
||||||
|
$("#years_settings [data-year='"+years[index - 1]+"']").after(year_text);
|
||||||
|
}else{
|
||||||
|
$("#years_settings").html(year_text+$("#years_settings").html());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
})
|
||||||
|
var all_years = $("#years_settings [data-year]").map(function(i,aa){return $(aa).attr("data-year").toString().trim() }).toArray();
|
||||||
|
all_years.forEach(function(a_year){
|
||||||
|
if(years.indexOf(a_year) == -1){
|
||||||
|
$("#years_settings [data-year='"+a_year+"']").remove()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
</script>
|
</script>
|
|
@ -0,0 +1,87 @@
|
||||||
|
<link href="/assets/admin/cancerpredict.css" media="print" rel="stylesheet">
|
||||||
|
<link href="/assets/admin/cancerpredict.css" media="screen" rel="stylesheet">
|
||||||
|
<% if !@results[0].nil? %>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><%=((I18n.locale=="en") ? 'submit time' : '提交時間') %></th>
|
||||||
|
<% @results[0].names.each do |key,name|%>
|
||||||
|
<th><%=name[I18n.locale.to_s].to_s.html_safe %></th>
|
||||||
|
<%end%>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @key_len = @results[0].names.length %>
|
||||||
|
<% @results.each do |result| %>
|
||||||
|
<% if result.names.length != @key_len %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><%=((I18n.locale=="en") ? 'submit time' : '提交時間') %></th>
|
||||||
|
<% result.names.each do |key,name|%>
|
||||||
|
<th><%=name[I18n.locale.to_s].to_s.html_safe %></th>
|
||||||
|
<%end%>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<td><%= result.created_at %></td>
|
||||||
|
<% result.result.each do |key,value| %>
|
||||||
|
<% @key_len %>
|
||||||
|
<% if key != "locale" %>
|
||||||
|
<% if (result.values[key][I18n.locale.to_s].length == 0 rescue true) %>
|
||||||
|
<td><%= value.to_s %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><% v = result.values[key][I18n.locale.to_s][value.to_i-1] rescue nil %><%= v.nil? ? value : v %></td>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<%end%>
|
||||||
|
</tr>
|
||||||
|
<%end%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
<%=@pagination.html_safe%>
|
||||||
|
<style type="text/css">
|
||||||
|
thead > tr > th{
|
||||||
|
border:1px solid;
|
||||||
|
background: bisque;
|
||||||
|
}
|
||||||
|
tbody{
|
||||||
|
background:white;
|
||||||
|
}
|
||||||
|
tbody > tr > td{
|
||||||
|
border:1px solid;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.show_li,.show_li *{
|
||||||
|
list-style:none;
|
||||||
|
color:balck;
|
||||||
|
}
|
||||||
|
.show_li ul{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
#clicktosee{
|
||||||
|
color:blue;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.checkbox{
|
||||||
|
left: 50%;
|
||||||
|
position: absolute;
|
||||||
|
transform: translate(-50%, -50%) !important;
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
#updatebtn{
|
||||||
|
margin-top: 1em;
|
||||||
|
position: fixed;
|
||||||
|
right: 1em;
|
||||||
|
background-color: rgb(210, 105, 0);
|
||||||
|
color: white;
|
||||||
|
border: 0em;
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,9 +0,0 @@
|
||||||
<script src="/assets/react.js"></script>
|
|
||||||
<script type="text/javascript" src="/assets/jquery.smartmenus.min.js"></script>
|
|
||||||
<script type="text/javascript" src="/assets/jquery.smartmenus.bootstrap.min.js"></script>
|
|
||||||
<div id="app">
|
|
||||||
<div class="loader-overlay">
|
|
||||||
<div class="loader" id="loader-1"> </div>
|
|
||||||
<div class="loader-text" id="id-loader-text">Loading...</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,18 +1,59 @@
|
||||||
$:.push File.expand_path("../lib", __FILE__)
|
# -*- encoding: utf-8 -*-
|
||||||
|
# stub: cancerpredict 0.0.1 ruby lib
|
||||||
# Maintain your gem's version:
|
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||||||
require "cancerpredict/version"
|
if bundle_update_flag
|
||||||
# Describe your gem and declare its dependencies:
|
insert_flag = 0
|
||||||
|
app_path = File.expand_path(__dir__)
|
||||||
|
template_path = ENV['PWD'] + '/app/templates'
|
||||||
|
all_template = Dir.glob(template_path+'/*/')
|
||||||
|
puts 'copying module'
|
||||||
|
check_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js"%>'
|
||||||
|
edit_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"%>'
|
||||||
|
all_template.each do |folder|
|
||||||
|
if !folder.include?('mobile')
|
||||||
|
begin
|
||||||
|
if folder.split('/')[-1] != 'mobile'
|
||||||
|
begin
|
||||||
|
system ('cp -r '+ app_path + '/modules/. ' + folder+'/modules/.')
|
||||||
|
puts "finish copy module cancerpredict to #{folder}"
|
||||||
|
rescue
|
||||||
|
puts 'error copy'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
texts = File.read(folder+'partial/_head.html.erb')
|
||||||
|
insert_flag = 0
|
||||||
|
if texts.include?(check_texts)
|
||||||
|
texts = texts.gsub(check_texts,edit_texts)
|
||||||
|
insert_flag = 1
|
||||||
|
end
|
||||||
|
if insert_flag == 1
|
||||||
|
puts 'editing _head.html.erb'
|
||||||
|
f = File.open(folder+'partial/_head.html.erb','w')
|
||||||
|
f.write(texts)
|
||||||
|
f.close
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
puts "not found _head.html.erb in #{folder}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "cancerpredict"
|
s.name = "cancerpredict"
|
||||||
s.version = Cancerpredict::VERSION
|
s.version = "0.0.1"
|
||||||
s.authors = ["Ruling Digital"]
|
|
||||||
s.email = ["orbit@rulingcom.com"]
|
|
||||||
s.homepage = "http://www.rulingcom.com"
|
|
||||||
s.summary = "Cancer_Predict for Orbit"
|
|
||||||
s.description = "Cancer_Predict for Orbit"
|
|
||||||
s.license = "MIT"
|
|
||||||
|
|
||||||
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.test_files = Dir["test/**/*"]
|
s.require_paths = ["lib"]
|
||||||
|
s.authors = ["Ruling Digital"]
|
||||||
|
s.date = "2019-12-09"
|
||||||
|
s.description = "Cancer_Predict for Orbit"
|
||||||
|
s.email = ["orbit@rulingcom.com"]
|
||||||
|
s.files = ["MIT-LICENSE", "README.rdoc", "Rakefile", "app/assets/images/cancerpredict", "app/assets/images/cancerpredict/triangle_add.png", "app/assets/images/cancerpredict/triangle_sub.png", "app/assets/javascripts/admin/cancerpredict.js", "app/assets/javascripts/cancer_predict.js", "app/assets/javascripts/jquery.smartmenus.bootstrap.min.js", "app/assets/javascripts/jquery.smartmenus.min.js", "app/assets/javascripts/react.js", "app/assets/stylesheets/admin/cancerpredict.css", "app/assets/stylesheets/cancer_predict.css", "app/controllers/admin/cancerpredicts_controller.rb", "app/controllers/cancerpredicts_controller.rb", "app/helpers/admin/cancerpredicts_helper.rb", "app/models/cancerpredictfields.rb", "app/views/admin/cancerpredicts", "app/views/admin/cancerpredicts/_form.html.erb", "app/views/admin/cancerpredicts/_form_file.html.erb", "app/views/admin/cancerpredicts/_form_link.html.erb", "app/views/admin/cancerpredicts/_index.html.erb", "app/views/admin/cancerpredicts/index.html.erb", "app/views/admin/cancerpredicts/new.html.erb", "app/views/admin/cancerpredicts/settings.html.erb", "app/views/admin/cancerpredicts/update.html.erb", "app/views/cancerpredicts", "app/views/cancerpredicts/index.html.erb", "config/locales/en.yml", "config/locales/zh_tw.yml", "config/routes.rb", "lib/cancerpredict", "lib/cancerpredict.rb", "lib/cancerpredict/engine.rb", "lib/cancerpredict/version.rb", "lib/tasks/cancerpredict_tasks.rake", "test/cancerpredict_test.rb", "test/controllers/admin/cancerpredicts_controller_test.rb", "test/dummy", "test/dummy/README.rdoc", "test/dummy/Rakefile", "test/dummy/app", "test/dummy/app/assets", "test/dummy/app/assets/images", "test/dummy/app/assets/javascripts", "test/dummy/app/assets/javascripts/application.js", "test/dummy/app/assets/stylesheets", "test/dummy/app/assets/stylesheets/application.css", "test/dummy/app/controllers", "test/dummy/app/controllers/application_controller.rb", "test/dummy/app/controllers/concerns", "test/dummy/app/helpers", "test/dummy/app/helpers/application_helper.rb", "test/dummy/app/mailers", "test/dummy/app/models", "test/dummy/app/models/concerns", "test/dummy/app/views", "test/dummy/app/views/layouts", "test/dummy/app/views/layouts/application.html.erb", "test/dummy/bin", "test/dummy/bin/bundle", "test/dummy/bin/rails", "test/dummy/bin/rake", "test/dummy/config", "test/dummy/config.ru", "test/dummy/config/application.rb", "test/dummy/config/boot.rb", "test/dummy/config/environment.rb", "test/dummy/config/environments", "test/dummy/config/environments/development.rb", "test/dummy/config/environments/production.rb", "test/dummy/config/environments/test.rb", "test/dummy/config/initializers", "test/dummy/config/initializers/backtrace_silencers.rb", "test/dummy/config/initializers/cookies_serializer.rb", "test/dummy/config/initializers/filter_parameter_logging.rb", "test/dummy/config/initializers/inflections.rb", "test/dummy/config/initializers/mime_types.rb", "test/dummy/config/initializers/session_store.rb", "test/dummy/config/initializers/wrap_parameters.rb", "test/dummy/config/locales", "test/dummy/config/locales/en.yml", "test/dummy/config/routes.rb", "test/dummy/config/secrets.yml", "test/dummy/lib", "test/dummy/lib/assets", "test/dummy/log", "test/dummy/public", "test/dummy/public/404.html", "test/dummy/public/422.html", "test/dummy/public/500.html", "test/dummy/public/favicon.ico", "test/helpers/admin/cancerpredicts_helper_test.rb", "test/integration/navigation_test.rb", "test/test_helper.rb"]
|
||||||
|
s.homepage = "http://www.rulingcom.com"
|
||||||
|
s.licenses = ["MIT"]
|
||||||
|
s.rubygems_version = "2.2.2"
|
||||||
|
s.summary = "Cancer_Predict for Orbit"
|
||||||
|
s.test_files = ["test/cancerpredict_test.rb", "test/dummy", "test/dummy/README.rdoc", "test/dummy/bin", "test/dummy/bin/bundle", "test/dummy/bin/rake", "test/dummy/bin/rails", "test/dummy/log", "test/dummy/app", "test/dummy/app/assets", "test/dummy/app/assets/javascripts", "test/dummy/app/assets/javascripts/application.js", "test/dummy/app/assets/images", "test/dummy/app/assets/stylesheets", "test/dummy/app/assets/stylesheets/application.css", "test/dummy/app/mailers", "test/dummy/app/helpers", "test/dummy/app/helpers/application_helper.rb", "test/dummy/app/controllers", "test/dummy/app/controllers/application_controller.rb", "test/dummy/app/controllers/concerns", "test/dummy/app/views", "test/dummy/app/views/layouts", "test/dummy/app/views/layouts/application.html.erb", "test/dummy/app/models", "test/dummy/app/models/concerns", "test/dummy/Rakefile", "test/dummy/lib", "test/dummy/lib/assets", "test/dummy/public", "test/dummy/public/422.html", "test/dummy/public/500.html", "test/dummy/public/favicon.ico", "test/dummy/public/404.html", "test/dummy/config.ru", "test/dummy/config", "test/dummy/config/environments", "test/dummy/config/environments/production.rb", "test/dummy/config/environments/development.rb", "test/dummy/config/environments/test.rb", "test/dummy/config/environment.rb", "test/dummy/config/boot.rb", "test/dummy/config/routes.rb", "test/dummy/config/application.rb", "test/dummy/config/secrets.yml", "test/dummy/config/locales", "test/dummy/config/locales/en.yml", "test/dummy/config/initializers", "test/dummy/config/initializers/wrap_parameters.rb", "test/dummy/config/initializers/cookies_serializer.rb", "test/dummy/config/initializers/mime_types.rb", "test/dummy/config/initializers/inflections.rb", "test/dummy/config/initializers/backtrace_silencers.rb", "test/dummy/config/initializers/filter_parameter_logging.rb", "test/dummy/config/initializers/session_store.rb", "test/test_helper.rb", "test/helpers/admin/cancerpredicts_helper_test.rb", "test/controllers/admin/cancerpredicts_controller_test.rb", "test/integration/navigation_test.rb"]
|
||||||
|
|
||||||
|
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,39 @@
|
||||||
en:
|
en:
|
||||||
|
module_name:
|
||||||
|
cancerpredict: Predict Breast Cancer Tool
|
||||||
cancerpredict:
|
cancerpredict:
|
||||||
cancerpredict: Predict breast cancer
|
hidden_variables: "Hidden Variables"
|
||||||
|
advance_mode_hint1: "After opening advance mode,calculation will change!\nAre you sure switch to advance mode?"
|
||||||
|
advance_mode_hint2: "一般模式: 選項設定在計算時對應到的值由1開始。(例如: 選項設定為[\"是\",\"否\"],則\"是\"在計算時對應到1,而\"否\"在計算時對應到2)。<br><hr class=\"solid_line_hr\">進階模式: 選項設定在計算時對應到的值由0開始。<br>而若開啟選項值從大到小,則0對應到選項設定中的最後一項。<br>選項對應到的值的意思為當前述的計算值為0時,則對應到定義的Array的第1個元素的值,以此類推。<br>欄位對應檔案可上傳一個csv檔案,在計算時,會先依照csv中的第1直行,找到對應的變數1(生成的變數名稱為csv中的第1列)的值,其餘生成的變數值則為對應之後的同一橫列的值。"
|
||||||
|
module_mode: Module Mode
|
||||||
|
advance_mode: Advance Mode
|
||||||
|
Overall_Survival: Overall Survival
|
||||||
|
cancerpredict: Adjust the predict breast cancer tool
|
||||||
|
submitResult: see submit results of the users
|
||||||
|
result_is_right: Is therapy choices in the right hand side of result block?
|
||||||
|
text_descibe: text descibe
|
||||||
|
font_size: font size
|
||||||
|
small: small
|
||||||
|
medium: medium
|
||||||
|
large: large
|
||||||
|
Input_fields: User input fields' contents
|
||||||
|
tool_head_pictures: All the logos in the page of predict tool
|
||||||
|
sort_num: sort num
|
||||||
|
logo: logo image
|
||||||
|
title: title of the page of predict tool
|
||||||
|
title_text: title texts
|
||||||
|
add_image: add image
|
||||||
|
years: Years
|
||||||
|
table_above_texts: Texts above table
|
||||||
|
text_above_texts: Texts above text
|
||||||
|
surgery_only_texts: Surgery only texts
|
||||||
|
extra_texts: Extra texts
|
||||||
|
extra_therapy_texts: Extra therapy texts
|
||||||
|
danger_texts: Warning texts
|
||||||
|
texts_between_Result_and_result_block: Texts between "Result" and "Result block"
|
||||||
|
prev_page: Previous page
|
||||||
|
next_page: Next page
|
||||||
|
export_cancer_predict_tool_records: Export cancer predict tool records
|
||||||
table:
|
table:
|
||||||
welcome: Welcome to The after breast cancer healing system of Taiwanprepare!\nTo start, please enter the relevant information below.
|
welcome: Welcome to The after breast cancer healing system of Taiwanprepare!\nTo start, please enter the relevant information below.
|
||||||
Reset: Reset
|
Reset: Reset
|
||||||
|
@ -19,9 +52,18 @@ en:
|
||||||
no: no
|
no: no
|
||||||
unknown: unknown
|
unknown: unknown
|
||||||
Results: Results
|
Results: Results
|
||||||
AdditionalBenefit: Additional Benefit
|
Treatment: Treatment
|
||||||
OverallSurvival: Overall Survival(%)
|
Additional_Benefit: Additional Benefit
|
||||||
|
Overall_Survival: Overall Survival(%)
|
||||||
Surgeryonly: Surgery only
|
Surgeryonly: Surgery only
|
||||||
Hormonetherapy: Hormone therapy
|
Hormonetherapy: Hormone therapy
|
||||||
Chemotherapy: Chemotherapy
|
Chemotherapy: Chemotherapy
|
||||||
years: years
|
years: years
|
||||||
|
result: Results
|
||||||
|
table: Table
|
||||||
|
curve: Curves
|
||||||
|
text: Texts
|
||||||
|
Therapy_choice: Treatment options
|
||||||
|
lpv_impact: "lpv Impact(Input: Float)"
|
||||||
|
active_choice: "Active choice(input 1 present choice 1 is regarded as therapy enable)"
|
||||||
|
disable_condition: "Disable Condition"
|
|
@ -1,10 +1,43 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
|
module_name:
|
||||||
|
cancerpredict: 乳癌預測工具
|
||||||
cancerpredict:
|
cancerpredict:
|
||||||
cancerpredict: 乳癌預測
|
hidden_variables: "隱藏的變數"
|
||||||
|
advance_mode_hint1: "開啟進階模式後,計算方式有差異。\n您確定要開啟進階模式?"
|
||||||
|
advance_mode_hint2: "一般模式: 選項設定在計算時對應到的值由1開始。(例如: 選項設定為[\"是\",\"否\"],則\"是\"在計算時對應到1,而\"否\"在計算時對應到2)。<br><hr class=\"solid_line_hr\">進階模式: 選項設定在計算時對應到的值由0開始。<br>而若開啟選項值從大到小,則0對應到選項設定中的最後一項。<br>選項對應到的值的意思為當前述的計算值為0時,則對應到定義的Array的第1個元素的值,以此類推。<br>欄位對應檔案可上傳一個csv檔案,在計算時,會先依照csv中的第1直行,找到對應的變數1(生成的變數名稱為csv中的第1列)的值,其餘生成的變數值則為對應之後的同一橫列的值。"
|
||||||
|
module_mode: 模組模式
|
||||||
|
advance_mode: 進階模式
|
||||||
|
Overall_Survival: 總生存率
|
||||||
|
cancerpredict: 乳癌預測工具調整
|
||||||
|
submitResult: 查看用戶繳交表單結果
|
||||||
|
result_is_right: 治療選項在結果的右邊?
|
||||||
|
text_descibe: 文字說明
|
||||||
|
font_size: 字體
|
||||||
|
small: 小
|
||||||
|
medium: 中
|
||||||
|
large: 大
|
||||||
|
Input_fields: 使用者輸入欄位內容
|
||||||
|
tool_head_pictures: 預測工具頁面最上方的所有logo
|
||||||
|
sort_num: 順序號碼
|
||||||
|
logo: logo圖片
|
||||||
|
title: 預測工具頁面標題
|
||||||
|
title_text: 標題文字
|
||||||
|
add_image: 新增圖片
|
||||||
|
years: 年
|
||||||
|
table_above_texts: 在表格上方的文字
|
||||||
|
text_above_texts: 在文字區塊上方的文字
|
||||||
|
surgery_only_texts: 純手術的文字
|
||||||
|
extra_texts: 額外文字
|
||||||
|
extra_therapy_texts: 額外治療的文字
|
||||||
|
danger_texts: 警告文字
|
||||||
|
texts_between_Result_and_result_block: 在"結果"和"結果區塊"之間的文字
|
||||||
|
prev_page: 上一頁
|
||||||
|
next_page: 下一頁
|
||||||
|
export_cancer_predict_tool_records: 匯出乳癌預測系統的使用者紀錄
|
||||||
table:
|
table:
|
||||||
welcome: 歡迎使用台灣準備乳癌癒後系統!\n若要開始 請在下方輸入相關資訊
|
welcome: 歡迎使用台灣準備乳癌癒後系統!\n若要開始 請在下方輸入相關資訊
|
||||||
Reset: 重置
|
Reset: 重置
|
||||||
Submit: 提交
|
Submit: 送出
|
||||||
age: 確認年齡
|
age: 確認年齡
|
||||||
Menopausal: 更年期狀態
|
Menopausal: 更年期狀態
|
||||||
ER: ER狀態
|
ER: ER狀態
|
||||||
|
@ -20,9 +53,33 @@ zh_tw:
|
||||||
unknown: 未知
|
unknown: 未知
|
||||||
Results: 結果
|
Results: 結果
|
||||||
Treatment: 治療
|
Treatment: 治療
|
||||||
AdditionalBenefit: 額外治療效益
|
Additional_Benefit: 額外治療效益
|
||||||
OverallSurvival: 總生存率(%)
|
Overall_Survival: 總生存率(%)
|
||||||
Surgeryonly: 純手術
|
Surgeryonly: 純手術
|
||||||
Hormonetherapy: 賀爾蒙治療
|
Hormonetherapy: 賀爾蒙治療
|
||||||
Chemotherapy: 化學治療
|
Chemotherapy: 化學治療
|
||||||
years: 年
|
years: 年
|
||||||
|
result: 結果
|
||||||
|
table: 列表
|
||||||
|
curve: 曲線
|
||||||
|
text: 文字
|
||||||
|
Therapy_choice: 治療選項
|
||||||
|
variable: 變數名稱
|
||||||
|
name: 名稱
|
||||||
|
is_num: 數字欄位
|
||||||
|
hint: 提示文字
|
||||||
|
comment_text: 說明文字
|
||||||
|
choice_fields: '選項設定([]代表無選項)'
|
||||||
|
range: '數字範圍設定([]代表無範圍限制)'
|
||||||
|
right: 顯示在右側
|
||||||
|
is_float: 可輸入小數
|
||||||
|
revert_value: 選項值從大到小(ex:有兩個選項,則選項值依序為1和0)
|
||||||
|
map_values: 選項對應到的值(若無,則會使用初始值)
|
||||||
|
cancer_predict_mapping_file: 欄位對應檔案
|
||||||
|
calculate_settings: 計算設定
|
||||||
|
prediction_formula: 預測公式
|
||||||
|
add_field: 新增填寫欄位
|
||||||
|
add_therapy: 新增治療選項
|
||||||
|
lpv_impact: "lpv 影響(輸入浮點數)"
|
||||||
|
active_choice: "啟用治療選項(輸入1代表第1個選項視為啟用治療)"
|
||||||
|
disable_condition: "禁用條件"
|
|
@ -1,12 +1,27 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console')
|
||||||
|
Thread.new do
|
||||||
|
c = Cancerpredictfields.last
|
||||||
|
if c
|
||||||
|
sleep(5)
|
||||||
|
c.save
|
||||||
|
c.auto_write_predict_js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
locales = Site.first.in_use_locales rescue I18n.available_locales
|
locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||||
|
|
||||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
get 'cancerpredicts' , to: 'cancerpredicts#index'
|
get 'cancerpredicts' , to: 'cancerpredicts#index'
|
||||||
|
get 'editCancerpredicts' , to: 'cancerpredicts#edit'
|
||||||
|
post 'editCancerpredicts' , to: 'cancerpredicts#edit'
|
||||||
|
patch 'editCancerpredicts' , to: 'cancerpredicts#edit'
|
||||||
|
get 'cancerpredicts/showSubmit' , to: 'cancerpredicts#showSubmit'
|
||||||
|
get 'cancerpredicts/export_cancer_tool_record' , to: 'cancerpredicts#export_cancer_tool_record'
|
||||||
resources :cancerpredicts
|
resources :cancerpredicts
|
||||||
end
|
end
|
||||||
|
get "cancerpredictResult", to: "cancerpredicts#calculate"
|
||||||
|
post "cancerpredictResult", to: "cancerpredicts#calculate"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
230
index.html.erb
230
index.html.erb
|
@ -1,230 +0,0 @@
|
||||||
<% if params[:is_frontend_view] == "true" %>
|
|
||||||
<% OrbitHelper.render_css_in_head(["basic/icon","lib/orbit_bar/orbit-bar"]) %>
|
|
||||||
<% else %>
|
|
||||||
<%= stylesheet_link_tag "basic/icon" %>
|
|
||||||
<%= stylesheet_link_tag "lib/orbit_bar/orbit-bar" %>
|
|
||||||
<% end %>
|
|
||||||
<div id="orbit-bar">
|
|
||||||
<% if current_user.nil? %>
|
|
||||||
<label for="open-orbit-login" style="display:none;">Open login</label>
|
|
||||||
<input type="checkbox" title="open login" id="open-orbit-login">
|
|
||||||
<label for="open-orbit-login" class="cover"></label>
|
|
||||||
<div class="login-window">
|
|
||||||
<div class="login-header">
|
|
||||||
<label for="open-orbit-login" class="close">×</label>
|
|
||||||
<h3><%= t(:login_orbit) %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="login-body">
|
|
||||||
<%= form_tag "/sessions?locale=#{locale.to_s}", method: "post", :class => "container" do |f| %>
|
|
||||||
<div class="prepend input-group">
|
|
||||||
<span class="add input-group-addon"><i class="icon-user"></i></span>
|
|
||||||
<label for="user_user_id" style="display:none;">Username</label>
|
|
||||||
<input class="input" id="user_user_id" title="username" name="user_name" placeholder="<%= t("users.user_id") %>" size="30" title="username" type="text">
|
|
||||||
</div>
|
|
||||||
<div class="prepend input-group">
|
|
||||||
<span class="add input-group-addon"><i class="icon-lock"></i></span>
|
|
||||||
<label for="user_password" style="display:none;">Password</label>
|
|
||||||
<input class="input" id="user_password" name="password" placeholder="<%= t(:password) %>" title="password" size="30" type="password">
|
|
||||||
</div>
|
|
||||||
<div class="login-submit-wrap">
|
|
||||||
<div class="submit">
|
|
||||||
<button class="login-btn" type="submit"><%= t(:login) %></button>
|
|
||||||
</div>
|
|
||||||
<% if current_site.google_oauth_enabled %>
|
|
||||||
<div class="google-login">
|
|
||||||
<a class="login-btn" href="/auth/google_oauth2">
|
|
||||||
<i class="fa fa-google-plus"></i> Sign in
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% if !current_site.sign_up_roles.empty? %>
|
|
||||||
<div class="login-sign-up-btn"><a href="/users/new" rel="nofollow">Sign up now</a></div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<input type="checkbox" id="open-orbit-nav" title="orbitbar">
|
|
||||||
<div class="orbit-bar-inner">
|
|
||||||
<label for="open-orbit-nav">
|
|
||||||
<i class="icons-list-2"></i>
|
|
||||||
</label>
|
|
||||||
<h2 class="orbit-bar-title">
|
|
||||||
<a href="/"><%= current_site.mobile_orbit_bar_title.nil? || current_site.mobile_orbit_bar_title == "" ? "Orbit" : current_site.mobile_orbit_bar_title %></a>
|
|
||||||
</h2>
|
|
||||||
<ul class="orbit-bar-menu">
|
|
||||||
<li>
|
|
||||||
<span class="orbit-bar-logo">
|
|
||||||
<img src="<%= current_site.default_image.url.nil? ? '/assets/orbit-logo.png' : current_site.default_image.url %>" alt="Orbit Bar Logo" />
|
|
||||||
</span>
|
|
||||||
<% if !current_user.nil? %>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="/<%= locale.to_s %>/admin/dashboards">
|
|
||||||
<i class="icons-gauge"></i> <%= t(:dashboard_) %>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="/<%= locale.to_s %>/admin/members?at=thumbnail">
|
|
||||||
<i class="icons-users"></i> <%= t(:community_) %>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<% if current_user.is_admin? %>
|
|
||||||
<li class="divider"></li>
|
|
||||||
<li>
|
|
||||||
<a href="/<%= locale.to_s %>/admin/sites" tabindex="-1">
|
|
||||||
<i class="icons-cog"></i> <%= t(:settings) %>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="/" class="orbit-bar-home">
|
|
||||||
<i class="icons-house"></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<% if !current_user.nil? && current_user.is_admin? && TicketStatus.unread.count > 0 %>
|
|
||||||
<li>
|
|
||||||
<a href="/admin/sites" class="orbit-bar-notification">
|
|
||||||
<i class="icons-mail"></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<ul class="link1" style="width: 240px;float: left;">
|
|
||||||
<li><a href="/">回首頁</a></li>
|
|
||||||
<li><a href="https://www.nccu.edu.tw/app/home.php">政治大學</a></li>
|
|
||||||
<li><a href="/zh_tw/sitemap">網站導覽</a></li>
|
|
||||||
</ul>
|
|
||||||
<ul class="orbit-bar-search-sign-language">
|
|
||||||
<%
|
|
||||||
google_search_cx = current_site.search['sitesearch'] rescue nil
|
|
||||||
is_google_seach_cx = google_search_cx =~ /^[0-9]+\:[0-9A-Za-z]+$/
|
|
||||||
if !google_search_cx.blank? and is_google_seach_cx
|
|
||||||
%>
|
|
||||||
<li>
|
|
||||||
<form id="search" method="get" action="http://www.google.com/cse" target="_blank">
|
|
||||||
<input type="hidden" name="cx" value="<%= google_search_cx %>">
|
|
||||||
<label style="display:none;" for="q">Google Search</label>
|
|
||||||
<%= text_field_tag 'q', '', {:type => "search", :placeholder => t("search.sitesearch"), 'x-webkit-speech' => '', :title => "search"} %>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
<%
|
|
||||||
else
|
|
||||||
if !google_search_cx.blank? and !is_google_seach_cx
|
|
||||||
search_domain = google_search_cx
|
|
||||||
else
|
|
||||||
search_domain = request.host_with_port
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
<li>
|
|
||||||
<form id="search" method="get" action="http://www.google.com/custom" target="_blank">
|
|
||||||
<input type="hidden" name="client" value="pub-&" />
|
|
||||||
<input type="hidden" name="ie" id="ie" value="utf-8" />
|
|
||||||
<input type="hidden" name="oe" id="oe" value="utf-8" />
|
|
||||||
<input type="hidden" name="cof" id="cof" value="AH:center;AWFID:03de271f1940eea3;" />
|
|
||||||
<input type='hidden' name='domains' value='<%= search_domain %>'>
|
|
||||||
<input type='hidden' name='sitesearch' value='<%= search_domain %>'>
|
|
||||||
<label style="display:none;" for="q">Google Search</label>
|
|
||||||
<%= text_field_tag 'q', '', {:type => "search", :placeholder => t("search.sitesearch"), 'x-webkit-speech' => '', :title => "search"} %>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<li>
|
|
||||||
<% if current_site.enable_language_options %>
|
|
||||||
<% if @site_in_use_locales.count > 1 || current_site.enable_zh_cn %>
|
|
||||||
<% zh_cn_added = 0 %>
|
|
||||||
<% locale = session[:zh_cn] ? :zh_cn : I18n.locale %>
|
|
||||||
<span id="language"><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span>
|
|
||||||
<ul>
|
|
||||||
<% @site_in_use_locales.each do |l| %>
|
|
||||||
<%
|
|
||||||
case l
|
|
||||||
when :en
|
|
||||||
accesskey = "e"
|
|
||||||
when :zh_tw
|
|
||||||
accesskey = "t"
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
<% if l.to_s == I18n.locale.to_s and !session['zh_cn'] %>
|
|
||||||
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
|
|
||||||
<%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %>
|
|
||||||
</li>
|
|
||||||
<% else %>
|
|
||||||
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
|
|
||||||
<a accesskey="<%= accesskey %>" href="<%= switch_language(l) %>"><%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %></a>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% if current_site.enable_zh_cn and zh_cn_added == 0 and !request.path.include?("/admin/") %>
|
|
||||||
<% zh_cn_added = 1 %>
|
|
||||||
<% accesskey = "s" %>
|
|
||||||
<% if locale == :zh_cn %>
|
|
||||||
<li class="active">
|
|
||||||
<%= t(:zh_cn, :locale => :zh_tw) %>
|
|
||||||
</li>
|
|
||||||
<% else %>
|
|
||||||
<li>
|
|
||||||
<a accesskey="<%= accesskey %>" href="<%= switch_language(:zh_cn) %>"><%= t(:zh_cn, :locale => :zh_tw) %></a>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% if !current_user.nil? %>
|
|
||||||
<li>
|
|
||||||
<span id="user"><%= current_user.member_profile.name.nil? ? current_user.user_name : current_user.member_profile.name rescue nil %></span>
|
|
||||||
<ul>
|
|
||||||
<li><%= link_to content_tag(:i, nil, class: 'icons-tools') + ' ' + t("users.change_passwd"),admin_member_edit_passwd_path(current_user.member_profile.to_param), tabindex: '-1' rescue nil%></li>
|
|
||||||
<li><%= link_to content_tag(:i, nil, class: 'icons-vcard') + ' ' + t("users.user_basic_data"),admin_member_path(current_user.member_profile.to_param), tabindex: '-1' rescue nil %></li>
|
|
||||||
<% if current_user.is_admin? && params[:is_frontend_view] == "true" %>
|
|
||||||
<li>
|
|
||||||
<% if params[:editmode] == "on" %>
|
|
||||||
<a tabindex="-1" href="<%= request.fullpath.split("?").first %>" style="color:red;"><i class="icons-bolt"></i>Edit Mode Off</a>
|
|
||||||
<% else %>
|
|
||||||
<a tabindex="-1" href="<%= request.fullpath + "#{(request.query_parameters.empty? ? "?" : "&")}editmode=on" %>"><i class="icons-bolt"></i>Edit Mode On</a>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<li>
|
|
||||||
<a href="/logout"><i class="icons-logout"></i><%= t(:logout) %></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<% else %>
|
|
||||||
<li>
|
|
||||||
<a id="accesskey_login" class="sr-only" accesskey="L" href="/<%= "#{locale.to_s}" %>/accesskey" title="Login">:::</a>
|
|
||||||
<label for="open-orbit-login">
|
|
||||||
<i class="icons-login"></i>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$("#open-orbit-login").on("change",function(){
|
|
||||||
if($(this).is(":checked")){
|
|
||||||
$("#user_user_id").focus();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
$(".login-body form").on("submit",function(){
|
|
||||||
$(this).append("<input type='hidden' name='referer_url' value='<%= request.original_url %>'/>");
|
|
||||||
})
|
|
||||||
<%
|
|
||||||
for_js = @site_in_use_locales.map{|l| l.to_s}
|
|
||||||
for_js << "zh_cn" if current_site.enable_zh_cn
|
|
||||||
%>
|
|
||||||
var I18n = {
|
|
||||||
get locale(){ return "<%= (session[:locale] == 'zh_tw' ? (session[:zh_cn] ? 'zh_cn' : 'zh_tw' ) : session[:locale]) %>"},
|
|
||||||
get validLocales(){return <%= for_js.to_json.html_safe %>},
|
|
||||||
set locale(v){return false},
|
|
||||||
set validLocales(v){return false}
|
|
||||||
};
|
|
||||||
</script>
|
|
|
@ -9,18 +9,30 @@ module Cancerpredict
|
||||||
authorizable
|
authorizable
|
||||||
widget_methods ["widget"]
|
widget_methods ["widget"]
|
||||||
widget_settings [{"data_count"=>1}]
|
widget_settings [{"data_count"=>1}]
|
||||||
|
set_keyword_contstraints ['cancerpredictResult']
|
||||||
frontend_enabled
|
frontend_enabled
|
||||||
side_bar do
|
side_bar do
|
||||||
head_label_i18n 'cancerpredict.cancerpredict', icon_class: "icons-megaphone"
|
head_label_i18n 'cancerpredict.cancerpredict', icon_class: "icons-tools"
|
||||||
available_for "users"
|
available_for "users"
|
||||||
active_for_controllers (['admin/cancerpredicts'])
|
active_for_controllers (['admin/cancerpredicts'])
|
||||||
head_link_path "admin_cancerpredicts_path"
|
head_link_path "admin_cancerpredicts_path"
|
||||||
|
set_sidebar_order -10
|
||||||
|
|
||||||
context_link 'cancerpredict.cancerpredict',
|
context_link 'cancerpredict.cancerpredict',
|
||||||
:link_path=>"admin_cancerpredicts_path" ,
|
:link_path=>"admin_cancerpredicts_path" ,
|
||||||
:priority=>1,
|
:priority=>1,
|
||||||
:active_for_action=>{'admin/cancerpredicts'=>'index'},
|
:active_for_action=>{'admin/cancerpredicts'=>'index'},
|
||||||
:available_for => 'users'
|
:available_for => 'users'
|
||||||
|
context_link 'cancerpredict.submitResult',
|
||||||
|
:link_path=>"admin_cancerpredicts_showSubmit_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_action=>{'admin/cancerpredicts'=>'show_submit'},
|
||||||
|
:available_for => 'users'
|
||||||
|
context_link 'cancerpredict.export_cancer_predict_tool_records',
|
||||||
|
:link_path=>"admin_cancerpredicts_export_cancer_tool_record_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_action=>{'admin/cancerpredicts'=>'export_cancer_tool_record'},
|
||||||
|
:available_for => 'users'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,32 +1,7 @@
|
||||||
<div>
|
|
||||||
<%= javascript_include_tag "react.js"%>
|
|
||||||
<script type="text/javascript" src="/assets/jquery.smartmenus.min.js"></script>
|
<script type="text/javascript" src="/assets/jquery.smartmenus.min.js"></script>
|
||||||
<script type="text/javascript" src="/assets/jquery.smartmenus.bootstrap.min.js"></script>
|
<script type="text/javascript" src="/assets/jquery.smartmenus.bootstrap.min.js"></script>
|
||||||
<h3 class="w-cancer-tool__widget-title">
|
<script type="text/javascript" src="{{preidct_js_url}}"></script>
|
||||||
<span>{{widget-title}}</span>
|
{{table}}
|
||||||
</h3>
|
<%= stylesheet_link_tag "cancer_predict", media: "screen" %>
|
||||||
<div class="w-cancer-tool widget-cancerpredict-1">
|
<%= stylesheet_link_tag "bootstrap.min.print", media: "print" %>
|
||||||
<div class="w-cancer-tool" data-level="0" data-list="cancerpredict">
|
<%= stylesheet_link_tag "cancer_predict_print", media: "print" %>
|
||||||
<div class="w-cancer-tool" data-level="1" data-list="cancerpredict">
|
|
||||||
<div id="app">
|
|
||||||
<div class="loader-overlay">
|
|
||||||
<div class="loader" id="loader-1"> </div>
|
|
||||||
<div class="loader-text" id="id-loader-text">Loading...</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<style>
|
|
||||||
.form-group.has-error > :nth-child(3) {
|
|
||||||
border: 3px solid pink !important;
|
|
||||||
border-radius: 5px !important;
|
|
||||||
padding: 2px !important;
|
|
||||||
}
|
|
||||||
.form-group > :nth-child(3) {
|
|
||||||
border: 3px solid white !important;
|
|
||||||
border-radius: 5px !important;
|
|
||||||
padding: 2px !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,28 +1,7 @@
|
||||||
<div>
|
|
||||||
<script src="/assets/react.js"></script>
|
|
||||||
<script type="text/javascript" src="/assets/jquery.smartmenus.min.js"></script>
|
<script type="text/javascript" src="/assets/jquery.smartmenus.min.js"></script>
|
||||||
<script type="text/javascript" src="/assets/jquery.smartmenus.bootstrap.min.js"></script>
|
<script type="text/javascript" src="/assets/jquery.smartmenus.bootstrap.min.js"></script>
|
||||||
<h1 class="i-cancer-title">{{page-title}}</h1>
|
<script type="text/javascript" src="{{preidct_js_url}}"></script>
|
||||||
<div class="i-cancer-tool widget-announcement-1">
|
{{table}}
|
||||||
<div class="i-cancer-tool" data-level="0" data-list="statuses">
|
<%= stylesheet_link_tag "cancer_predict", media: "screen" %>
|
||||||
<div id="app">
|
<%= stylesheet_link_tag "bootstrap.min.print", media: "print" %>
|
||||||
<div class="loader-overlay">
|
<%= stylesheet_link_tag "cancer_predict_print", media: "print" %>
|
||||||
<div class="loader" id="loader-1"> </div>
|
|
||||||
<div class="loader-text" id="id-loader-text">Loading...</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<style>
|
|
||||||
.form-group.has-error > :nth-child(3) {
|
|
||||||
border: 3px solid pink !important;
|
|
||||||
border-radius: 5px !important;
|
|
||||||
padding: 2px !important;
|
|
||||||
}
|
|
||||||
.form-group > :nth-child(3) {
|
|
||||||
border: 3px solid white !important;
|
|
||||||
border-radius: 5px !important;
|
|
||||||
padding: 2px !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
Loading…
Reference in New Issue