fbcontentpane.js
来自「proe5.0野火版下载(中文版免费下载)」· JavaScript 代码 · 共 1,698 行 · 第 1/4 页
JS
1,698 行
for (var i=0; i<count; i++) rows[i].update(htmlRows);}//****************************************************************************************// Row class//****************************************************************************************function std_row(n, item) // constructor{ // data this.index = n; // the index represents the html row number in the table this.item = item; // item is the data obtained fronm the server, this is constant // methods this.update = updateRowDisplay;}function updateRowDisplay(htmlRows){ var item = this.item; var row = htmlRows.item(this.index+1); if (item.isDisplayed()==true) row.style.display=""; else row.style.display="none";}//****************************************************************************************// Helper functions//****************************************************************************************function getPrefix(name, index){ var n = index.toString(); var length = name.length - n.length; return name.substring(0, length);}function changeRowClass(row, newclass){ var atts = row.attributes; for (var j=0; j<atts.length; j++) { var item = atts.item(j); if (item.nodeName == 'class') item.nodeValue = newclass + " rowfont"; }}//****************************************************************************************// Event handlers//****************************************************************************************function selectRow(n, cb_item){ var row = table.rows[n]; var htmlRows = getHtmlRows(); var html_row = htmlRows.item(row.index+1); // deselct previous one if (table.lastSelIdx != -1) { changeRowClass(htmlRows.item(table.lastSelIdx+1), getDoubleClassString ('tableNSelRow')); cb_item(table.rows[table.lastSelIdx+1], false); } // change the bg color for rows changeRowClass(html_row, getDoubleClassString ('tableSelRow')); cb_item(row.item, true); table.lastSelIdx = row.index;}function sortTable(compare){ // var start = new Date(); var htmlRows = getHtmlRows(); var count = table.rows.length; var sorted_rows = new Array(count); for (var i=0; i<count; i++) sorted_rows[i] = table.rows[i]; // now sort the rows sorted_rows.sort(compare); // place the html rows in sorted order in an array var sorted_htmlRows = new Array(count); sorted_htmlRows[0] = htmlRows.item(0); for (var i=0; i<count; i++) { var index = sorted_rows[i].index; sorted_htmlRows[i+1] = htmlRows.item(index); } // remove all the previous html rows var parentTBody = htmlRows.item(0).parentNode; for (var j=0; j<count; j++) parentTBody.removeChild(htmlRows.item(0)); // now append the rows one by one in the sorted order var trailer = htmlRows.item(0); if (trailer) { for (var i=0; i<count+1; i++) parentTBody.insertBefore(sorted_htmlRows[i], trailer); } else { for (var i=0; i<count+1; i++) parentTBody.appendChild(sorted_htmlRows[i]); } // now set the indexes of the rows as sorted for (var k=0; k<count; k++) sorted_rows[k].index = k; // var end = new Date(); // alert("STARTED:"+start+"\n" + "FINISHED:"+end);}function getHtmlRows(){ var htmlTable = document.getElementById(table.id); if (htmlTable) return htmlTable.getElementsByTagName("TR"); alert("Table with id " + table.id + "not found!"); return null;}/* DEBUG PURPOSES ONLY*/function reportTable(){ var htmlRows = getHtmlRows(); var str; for (var i=0; i<table.rows.length; i++) { var row = table.rows[i]; // str += "Index:" + row.index + " htmlRow: " + htmlRows.item(i).firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.innerHTML + "\n"; str += "Index:" + row.index + " htmlRow: " + htmlRows.item(i+1).firstChild.innerHTML + "\n"; } alert(str);}// --------------------------------------------------------------------------// Data functions// ==============// --------------------------------------------------------------------------/*--------------------------------------------------------------------------*\| Purpose: This class encompasses various data|| Input Args: tailpath - The name of the folder being displayed| ospath - The full path of the folder is OS format| uripath - The full path of the folder as a URI (i.e. file:///)\*--------------------------------------------------------------------------*/function HeadDataObj(tailpath, ospath, uripath ){ this.pathArr = null; // first element is a string, // all others are SegementedPathObj objects this.tailpath = tailpath; this.ospath = ospath; this.uripath = uripath; this.isInSession = false; this.isStdFilesys = false; this.colArr = null; this.inTrailMode = false; this.pvxCodebase = null; this.baseImgDir = '';}/*--------------------------------------------------------------------------*\| Purpose: Encompass the showing options data|| Input Args: showVers - should show Versions| showInst - should show Instances\*--------------------------------------------------------------------------*/function ShowOptsObj(showVers, showInst, allowVers, isFileCountLimitEnabled, file_count_limit, show_all_status_str, show_partial_status_str, show_partial_opt_str ){ this.showVers = showVers; this.showInst = showInst; this.allowVers = allowVers; this.isFileCountLimitEnabled = isFileCountLimitEnabled; this.file_count_limit = file_count_limit; this.show_all_status_str = show_all_status_str; this.show_partial_status_str = show_partial_status_str; this.show_partial_opt_str = show_partial_opt_str; this.filters = null; // holds an array of FilterObj this.curTypeIdx = null; // holds currently selected idx of filter arr this.curSubTypeIdx = null; // holds currently selected idx of subfilter arr}/*--------------------------------------------------------------------------*\| Purpose: Each object represents an entry in the Type Filter (which is| actually an HTML Select element, so each entry is used to | create an HTML Option element in the Select element)|| Input Args: id - string id| label - The label to be used in the select list\*--------------------------------------------------------------------------*/function FilterObj(id, label){ this.id = id; this.label = label; this.sub = null; //holds array of SubFilterObj}/*--------------------------------------------------------------------------*\| Purpose: See FilterObj. This is the same for SubTypes\*--------------------------------------------------------------------------*/function SubFilterObj(id, label){ this.id = id; this.label = label;}function ColDataObj(label, width){ this.label = label; this.width = width;}/*--------------------------------------------------------------------------*\| Purpose: This resets the varoius "Show Options" to default\*--------------------------------------------------------------------------*/function show_reset(){ var filter = document.getElementById('filter_id'); if (filter) filter.selectedIndex = 0; var subfilter = document.getElementById('subfilter_id'); if (subfilter) subfilter.selectedIndex = 0; show_apply(false, false);}/*--------------------------------------------------------------------------*\| Purpose: Pass to Pro/E the users "Showing Options"|| Input Args: show_all_vers - whether to show all versions| show_all_inst - whether to show instances\*--------------------------------------------------------------------------*/function show_apply(show_all_vers, show_all_inst){ var cmd = "FC_ShowOpts?"; cmd += "showVers=" + show_all_vers; cmd += "?showInst=" + show_all_inst; // add selected type var filter = document.getElementById('filter_id'); cmd += "?type=" + filter.options[filter.selectedIndex].value; // add selected subtype iff selected var sfilter = document.getElementById('subfilter_id'); if (sfilter && sfilter.options && sfilter.selectedIndex >= 0) { cmd += "?subtype=" + sfilter.options[sfilter.selectedIndex].value; } ProECommandVoid(cmd);}function is_file_count_limiting_on(){ var ret = false; if ( showOpts_data.isFileCountLimitEnabled && can_limit_file_count() ) { var show_all_opt_index = 1; var select = document.getElementById("view_select_ID"); if ( select != null ) { ret = ( select.selectedIndex != show_all_opt_index ); } else { ret = true; } } return ret;}function set_file_count_status(){ if ( is_file_count_limiting_on() ) { file_count_status = showOpts_data.show_partial_status_str; } else { file_count_status = showOpts_data.show_all_status_str; } var select = document.getElementById("view_select_ID"); var selected_opt = select.options[ select.selectedIndex ]; var td = document.getElementById("file_count_status_ID"); td.innerHTML = selected_opt.text + " ( " + file_count_status + " )";}function recreateTable(){ document.getElementById('table_div').innerHTML = generateTable(fbcpHeaderCB, null, fbcpRowCB); setTableDivOriginalHeight(); layoutPage(); fixupHrefs(); document.body.style.cursor = 'default';}// this callback is activated when user changes selection in the `view` drop-down listfunction on_limited_file_display_change( select ){ if ( can_limit_file_count() ) { document.body.style.cursor = 'wait'; window.setTimeout('recreateTable()', 50); } else { set_file_count_status(); }}// ==============================================================================// ========================== Table rendering callbacks =========================// ==============================================================================// Generates the header of the generated tablefunction fbcpHeaderCB(){ var header = ''; header += '<THEAD><TR class="' + getDoubleClassString ('tableheader') + '">'; // Type header header += '<TH width="5%"> </TH>'; var fileName = msgId_get("FBContentTableHeader"); header += '<TH width="' + s_filename_col_width + '">' + fileName + '</TH>'; // This loop creates a column foreach of the columns // in head_data.colArr (which originates from pfadir column API) var i; for (i=0; i<head_data.colArr.length; ++i) header += '<TH width="' + head_data.colArr[i].width + '%">' + head_data.colArr[i].label + '</TH>'; header += '</TR></THEAD>'; return header;}/*--------------------------------------------------------------------------*\| Purpose: De/Select a file. This is the event handler that is called| when a file is selected from the table.|| Input Args: file - FbcpFileObj selected| value - true for selection, false for deselection\*--------------------------------------------------------------------------*/function selectFile(file, value){ if (value) { s_selectedFile = file; // kill preview timer if needed if (s_previewTimerId != null) clearPreviewTimer(); if (s_UserClick) // if click was not initiated by PVX { // defer prview update in half-a-second. encode id of node to preview // in the deferred string to be executed. s_previewTimerId = window.setTimeout('updatePreview("' + file.filename + '")', 500); } else s_UserClick = true; }}function hasExtension(filename, ext){ var rv = false; var idx = filename.toLowerCase().indexOf(ext.toLowerCase()); if (idx > 0) rv = (idx == filename.length - ext.length); return rv;}function clearActivateFileTimer(){ window.clearTimeout(s_activateFileTimer); s_activateFileTimer = null;}function activateFileCommand( fileId ){ ProECommandVoid("FC_ActivateFile?" + unescape(fileId) );}// This functions assumes the line starts with "JavaScript Record("// On trail replay it will execute the javascript command ProETrailPlayLine with the parameters given to Recordfunction pvxEmitToTrailFile( line ){ ProECommandVoid( line ); }/*--------------------------------------------------------------------------*\| Purpose: event handler for double clicking an entry in the table|| Input Args: file - FbcpFileObj
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?