fbcontentpane.js

来自「proe5.0野火版下载(中文版免费下载)」· JavaScript 代码 · 共 1,698 行 · 第 1/4 页

JS
1,698
字号
\*--------------------------------------------------------------------------*/function activateFile(file){  // This doesn't cause any problems on UNIX  if (gSysDep.isMsie && s_previewTimerId != null)   {    clearPreviewTimer();    updatePreview(s_selectedFile.filename);  }  if (file && file.id)  {    // timeout on Windows leads to wrong  behavior on trail replay :    // doesn't play the double click.    if ( head_data.inTrailMode )    {      activateFileCommand(file.id); 	    }    else    {      if (s_activateFileTimer != null)        clearActivateFileTimer();      // Timeout added to workaround trail replay problem caused      // by browser ( spotted on unix ) disposing double click events as a result      // of navigation to new location from inside FC_ActivateFile.      // as a result trail recording lacked the double click which called      // activateFile in the first place.      // therefore, FC_ActivateFile is delayed,      //  so that it will happen only after we record the double click event.      s_activateFileTimer= window.setTimeout('activateFileCommand("' + file.id +'")', 50);    }  }}// Attention: If the row structure is changed - please update fixupHrefs()function fbcpRowCB(row){  var result = '';  var trClass = getDoubleClassString ('tableNSelRow');  result += '<TR class="' + trClass + '">';  var handlerStr   = 'onclick="selectRow(' + row.index + ', selectFile);return(false);"   ondblclick="activateFile(row_data[' + row.index + ']);"  href="#"';  // Type w/ anchor  result += '<TD width="5%">';  result += '<A ID="' + "NO_ID" + '_img" ';  result += handlerStr;  result += '><IMG border="0" SRC="' + ImgTable[row.item.icon_idx] + '"></IMG></A></TD>';  // File name w/ anchor  result += '<TD width="' + s_filename_col_width + '">';  result += '<A ID="' +  "NO_ID" + '" ';  result += handlerStr;  // inject tooltip for truncated labels.  var lbl = row.item.label;  // do a quick rejection on short labels  if (lbl.length > 30 )  {    if (lbl.substr(lbl.length-9, 9) == "%2E%2E%2E") // ends with ...    {      result += 'TITLE="' + unescape(row.item.filename) + '"';    }  }     result += ">" +unescape(lbl) + '</A></TD>';  var i;  for (i=0; i<row.item.colArr.length; ++i)    result += '<TD width="' + head_data.colArr[i].width + '%">' + unescape(row.item.colArr[i]) + '</TD>';  result += '</TR>';  return result;}function fixupHrefs(){  var table = document.getElementById('STDTABLE');  if ( !table )    return;  var rows  = table.getElementsByTagName('TR');  var unescapedUripath = unescape(head_data.uripath);  for (i = 1; i < rows.length; ++i )  {    var anchors = rows[i].getElementsByTagName('A');    var s = unescapedUripath + unescape(row_data[i-1].filename);    var unescapedId = unescape(row_data[i-1].id);	    anchors[0].href = s;    anchors[0].id = unescapedId + '_img';    anchors[1].href = s;    anchors[1].id = unescapedId;  }}function fbcpDisplayDirectoryPath(){  var label = msgId_get("FBContentDirPath");   var text = document.createTextNode(label + " " + unescape(head_data.tailpath) );    path = document.getElementById("pathDiv");   path.appendChild(text);}function fbcpTrailerCB(){  var result = '';  return result;}// Table data classfunction FbcpFileObj(id, imgsrc_idx, label, filename){  this.id = id;  this.icon_idx = imgsrc_idx;  this.label = label;  this.filename = filename;  this.colArr = null;  this.isDisplayed = FbcpFile_isDisplayed;	//this method is required						//by the table API}function FbcpFile_isDisplayed(){  return true;}function getImageHTML(pathToFile){  var str = '<IMG src="' + pathToFile + '" />';  return str;}function isImgFile(filename){  return hasExtension(filename, ".gif") ||    hasExtension(filename, ".jpg");}function isProEFile(filename){  // In this function I can't use hasExtension  // because the suffix is .prt.nn  return (    head_data.isStdFilesys && (      (filename.indexOf(".prt") > 0) ||      (filename.indexOf(".asm") > 0) ||      (filename.indexOf(".mfg") > 0) ||      (filename.indexOf(".sec") > 0) ||      (filename.indexOf(".rpt") > 0) ||      (filename.indexOf(".mrk") > 0) ||      (filename.indexOf(".gph") > 0) ||      useSheetControls(filename )	      )    );}function do_aux_cmd_1(){  var data = ProECommand( "FC_aux_cmd_1" );  var pvxObj = document.getElementById('pvx_id');  if (pvxObj != null && pvxObj.set_aux_cmd_1_data != null)	     pvxObj.set_aux_cmd_1_data( data );                      }function updatePvxPreview(filename){  var osfilepath = unescape(head_data.ospath) + filename;  if ( !pvxIsUp)  {    updatevxFileNameParam(osfilepath);    setVisible('PreviewDiv', false);    setVisible('PvxTable', true);	    pvxIsUp = true;  }  gSysDep.pvxLoadFile(osfilepath);  addPVXButtons(filename);	  layoutPage();}function updatevxFileNameParam(osfilepath){  // Update the applet/control parameter to point to the new file to be loaded  // prevents redundant render of teh initial file.  var filenameParam = document.getElementById('PvxFileNameParam');  if (filenameParam)  {    filenameParam.value = osfilepath;  }}// This is the main function that// takes care of all the preview// process.// It sets the preview image and// the preview file details according// to the given node.function updatePreview(esc_filename){  removePVXDone();  var filename = unescape(esc_filename);  if (isProEFile(filename))    updatePvxPreview(filename);  else    clearPreview();        s_previewTimerId = null;}function clearPreviewTimer(){  window.clearTimeout(s_previewTimerId);  s_previewTimerId = null;}// This function is a debug utility// function.function dumpNode(node){  var report = new String();   var attrs = node.attributes;  if (attrs == null || attrs.length == 0)    report += "no attributes\n";  else    for (i = 0 ; i < attrs.length; ++i)    {       if (  attrs.item(i).nodeValue != null)      {	report += "attr[" + i + "] ";	report += attrs.item(i).nodeName + "=" + attrs.item(i).nodeValue;	report += "\n";       }    }	    var nodeList = node.childNodes;  if ( nodeList == null || nodeList.length == 0)    report += "no Child Nodes\n";  else    for (i = 0 ; i < nodeList.length; ++i)    {       report += "child[" + i +"] ";      report += nodeList.item(i).nodeName ;      report += "\n";	      if (nodeList.item(i).className)	report += "\tClass:\t" + nodeList.item(i).className + "\n";    }	  alert(report);}// --------------------------------------------------------------------------// System dependent functions// ==========================// --------------------------------------------------------------------------function gen_createPvx(tag, attribs, osfilepath){	  var result = '<' + tag + ' ' + attribs;  if (head_data.pvxCodebase != null)    result += ' codebase="' + head_data.pvxCodebase + '"';  result += ' id="pvx_id" height="180" width="260" MAYSCRIPT>\n';    if (osfilepath && osfilepath != '')    result += '<param name="pvcname" id="PvxFileNameParam" value="' + osfilepath + '"></param>\n';    result += '<param name="showCopyright" value="0"></param>\n';  result += '<param name="showTitle" value="0"></param>\n';  result += '<param name="showToolbar" value="0"></param>\n';    result += '</' + tag + '>\n';  return result;}// MSIE functionsfunction msie_getInnerHeight(){ return document.body.clientHeight; }function msie_getInnerWidth(){ return document.body.clientWidth; }function msie_createPvx(osfilepath){  return gen_createPvx('object', 		       'CLASSID="CLSID:1ED48504-8834-11D5-AC75-0008C73FD642"',		       osfilepath);}function msie_pvxLoadFile(osfilepath){  var pvxObj = document.getElementById('pvx_id');  if (pvxObj == null)  {    // This should be called only once    var pvxDiv = document.getElementById('PvxDiv');    pvxDiv.innerHTML = gSysDep.createPvx(osfilepath)       + pvxDiv.innerHTML;  }  else   {    try {       pvxObj.setFileName(osfilepath);       // to refresh the view      pvxObj.setRenderStyle(3);    }    catch(e){ dbg_error_crash ('Error: failed doing pvx operation',			       'msie_pvxLoadFile'); }  }  }// MOZILLA functionsfunction moz_getInnerHeight(){ return window.innerHeight; }function moz_getInnerWidth(){ return window.innerWidth; }function moz_createPvx(osfilepath){  var result = null;  //  if (navigator.plugins['ProductView Express'] != null)  result = gen_createPvx('applet',			 'code="com.ptc.pvx.ProductViewExpress.class" archive="ptcpvx.jar"',			 osfilepath);  return result;}function moz_pvxLoadFile(osfilepath){//  if (navigator.plugins['ProductView Express'] != null)  {    var pvxObj = document.getElementById('pvx_id');    if (pvxObj == null)    {      // This should be called only once      var pvxDiv = document.getElementById('PvxDiv');      var pvxHTML = gSysDep.createPvx(osfilepath);      if (pvxHTML != null)      {	pvxDiv.innerHTML = pvxHTML + pvxDiv.innerHTML;      }    }    else if (pvxObj.setFileName)    {      try { 	pvxObj.setFileName(osfilepath);       }      catch(e){ dbg_error_crash ('Error: failed doing pvx operation',				 'moz_pvxLoadFile'); }    }  }  }// Sysdep objectfunction Sysdep(){  var agt=navigator.userAgent.toLowerCase();    this.isMsie = (agt.indexOf('msie') != -1);    if (this.isMsie)  {    this.getInnerHeight = msie_getInnerHeight;    this.getInnerWidth = msie_getInnerWidth;    this.createPvx = msie_createPvx;    this.pvxLoadFile = msie_pvxLoadFile;  }  else  {    this.getInnerHeight = moz_getInnerHeight;    this.getInnerWidth = moz_getInnerWidth;    this.createPvx = moz_createPvx;        this.pvxLoadFile = moz_pvxLoadFile;     }  }// --------------------------------------------------------------------------// Global variable initializtion// =============================// --------------------------------------------------------------------------gSysDep = new Sysdep();// --------------------------------------------------------------------------// PVX related code// =============================

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?