// ============================================================================= // $Scanit$ msg_multiple_selections_prohibited="Ой-ля-ля! В данной группе уже выбран один признак."; msg_ie_crippled = "Cannot view saved content of the classificator under IE. Try other browser. Firefox and Opera are known to work."; // ============================================================================= function rebuild() { /* if (navigator.userAgent.toLowerCase().indexOf('msie') + 1) { alert(msg_ie_crippled); return; }; */ rebuild_fgstable('intsens', 0); rebuild_fgstable('logicsethics', 0); rebuild_fgstable('nalnost', 0); rebuild_fgstable('vertnost', 0); rebuild_fgstable('dominants', 1); rebuild_indfeatures_table(); if (top.file_id) { // this is a saved copy of the classifier // feature selection is taken care of above (in rebuild_*()) // fill in file properties top.frames[1].document.getElementById('file_location').innerHTML = top.location; top.frames[1].document.file_properties.file_name.value = top.file_name; top.frames[1].document.file_properties.file_source.value = top.file_source; // show the overview panel toggle_overview(1); } else { // this is a fresh copy of classifier // overview page is hidden by default } } function toggle_overview(toggle) { var on = "50%,50%" var off = "*,0"; if (toggle) { parent.document.body.rows = (parent.document.body.rows == on) ? off : on; } else { // if not toggle, hide it completely parent.document.body.rows = off; } } function register_feature_selection(add, fg_n, fid) { var f = fg_n + "_" + fid; // remove the feature from the list, to avoid duplicates var i; for(i=0; i '; row.appendChild(td); tbody.appendChild(row); row = null; var j; for (j=1; j < fs.length; j++) { var fid = j; // XXX not clean var result = fs[j].getElementsByTagName('td')[0].innerHTML; td = document.createElement('td'); td.id = "indfeature_main_" + fg_n + "_" + fid; td.className = 'indfeature_descr'; ///var a = document.createElement('a'); ///a.innerHTML = ' ' + result; td.innerHTML = ' ' + result; td.setAttribute('onClick', "toggle_indfeature_selection('" + fg_n + "', '" + fid + "', '" + type + "', '" + result + "', " + (fs.length-1) + "); return false;"); ///td.appendChild(a); if (row) { row.appendChild(td); tbody.appendChild(row); row = null; } else { row = document.createElement('tr'); row.appendChild(td); } } if (row) { td = document.createElement('td'); td.innerHTML = ' '; row.appendChild(td); tbody.appendChild(row); row = null; } // second pass, to toggle feature selection for (j=1; j < fs.length; j++) { var fid = j; // XXX not clean var result = fs[j].getElementsByTagName('td')[0].innerHTML; if (is_feature_selected(fg_n, fid)) { toggle_indfeature_selection(fg_n, fid, type, result , (fs.length-1)); } } } } // This function rebuilds the representation elements from the storage element function rebuild_fgstable(tblid, overviewmode) { // cleanup the representation elements flush_table(document, 'fgstable_' + tblid); flush_table(parent.frames[1].document, 'overview_fgstable_' + tblid); var fgs = document.getElementById('db_fgstable_' + tblid).getElementsByTagName('tbody'); var i; for(i=0; i'; } } trow.appendChild(td); tbl.appendChild(trow); ////var a = document.createElement('a'); ////a.setAttribute('onClick', "toggle_feature_selection('" + tblid + "', '" + fg_n + "', '" + fid + "', '" + result + "', " + overviewmode + "); return false;"); ////a.setAttribute('href', '#'); ////a.appendChild(tbl); ////fc.appendChild(a); fc.setAttribute('onClick', "toggle_feature_selection('" + tblid + "', '" + fg_n + "', '" + fid + "', '" + result + "', " + overviewmode + "); return false;"); fc.appendChild(tbl); frow.appendChild(fc); // manipulate the overview table fc = overview_document.createElement('td'); // a cell enclosing a single feature fc.width = 100/nfeatures + '%'; fc.id = tblid + "_overview_" + fg_n + "_" + fid; fc.className = 'feature_result_overview'; /* if (overviewmode == 0) { fc.innerHTML = '+'; } else { fc.innerHTML = ''+result+''; } */ overview_frow.appendChild(fc); if (is_feature_selected(fg_n, fid)) { toggle_feature_selection(tblid, fg_n, fid, result,overviewmode); } } // ============================================================================= function toggle_feature_selection(tblid, fg_n, fid, result, overviewmode) { var cell = document.getElementById(tblid + "_main_" + fg_n + "_" + fid); var overview_cell = parent.frames[1].document.getElementById(tblid + "_overview_" + fg_n + "_" + fid); // change the style of the feature table //var delta; if (cell.className == 'feature_cell_selected') { cell.className = 'feature_cell'; //delta = -1; overview_cell.innerHTML = ''; register_feature_selection(0, fg_n, fid); } else { // verify if there are no selected cells in this row var tds = cell.parentNode.getElementsByTagName('td'); var i; for (i=0; i