shawl.qiu asp jscript 服务端框架类 v 1.3

类别: CSharp.Net, function, 数据操作
标签: shawl.qiu, asp, jscript, class, imports(), framework, sqFwJsSs, import
摘要: ..
正文:
<%
 var exec = eval;
 var im = new Imports();
 im.path = '/sqFwJsSs/';
 /*-----------------------------------------------------------------------------------*\
  * shawl.qiu Jscript Imports class v1.3
 \*-----------------------------------------------------------------------------------*/

 //---------------------------------begin class Imports()-------------------------------//
 function Imports()
 {// shawl.qiu code
  //------------------------------------begin public variable
  //---------------begin about
  this.au = {}
  this.au.Subject = "shawl.qiu Jscript Imports class";
  this.au.Version = "v1.3";
  this.au.Name = "shawl.qiu";
  this.au.Email = "shawl.qiu@gmail.com";
  this.au.Blog = "http://blog.csdn.net/btbtd";
  this.au.CreatedDate = "2006-12-30";
  this.au.Update = {};
  this.au.Update["1"] = "";
  this.au.Update["2"] = "";
  this.au.Update["3"] = "2007-5-31 v1.3";
  //---------------end about
  this.path = '/sqFwJsSs/';
  this.pathPhysical = "";
  this.extension = 'asp';
  this.charset = 'UTF-8';
  this.ext_vbs = 'inc';
  //------------------------------------end public variable
  //------------------------------------begin public method
  //begin this.go
  this.go = fGo;
  //--------------------end this.go
  //begin this.help
  this.help = fMtdHelp;
  //--------------------end this.help
  //begin this.help.self
  this.help.self =
   function(bHighlight, bShow, bReturn)
   {
    return tl.help('default', bHighlight, bShow, bReturn);
   }
  
  this.help.source =
   function(bHighlight, bShow, bReturn)
   {
    return tl.help('source', bHighlight, bShow, bReturn);
   }
  //--------------------end this.help.self
  //begin this.find
  this.find = fMtdFind;
  //--------------------end this.find
  //begin this.about
  this.readme =
   function(bHighlight, bShow, bReturn)
   {
    return this.help('readme', bHighlight, bShow, bReturn);
   }
  //--------------------end this.about
  //------------------------------------end public method
  //------------------------------------begin private variable
  var tl = Tl = this// top level;
  //------------------------------------end private variable
  //------------------------------------begin private method
  function fGo(sAct)
  {
   var ar = sAct.split(' | ');
   var arCode = [];
   var arCodeCount = 0;
   var iArCount = 0;
   var iArLen = ar.length;
   Tl.pathPhysical = Server.MapPath(Tl.path);
   
   while(iArCount < iArLen)
   {
    ar[iArCount] = Tl.pathPhysical + '\\' + (ar[iArCount].replace(/\./, '\\')) + '.' + tl.extension;
    
    if(fFlCkFl(ar[iArCount]))
    {
     arCode[arCodeCount] = fStmRead(ar[iArCount], tl.charset);
    }
    iArCount++ ;
   } // end while(iArCount<iArLen)
   return arCode.join("").replace(/<\%|\%\>/g, "");
  } // end function fGo
  
  function fStmRead(sPath, sCharset)
  {
   var sStr = '';
   var o = new ActiveXObject('adodb.stream')
   
   with(o)
   {
    Type = 2;
    Mode = 3;
    Open();
    LoadFromFile(sPath);
    
    if(sCharset !== "")CharSet = sCharset;
    var pNum = 0
    
    if(sCharset == 'utf -8' || sCharset == 'unicode')pNum = 2;
    Position = pNum
    sStr = ReadText();
    Close();
   }
   o = null;
   return sStr;
  } // shawl.qiu code
  
  function fCkExt(sCk, sForCk)
  {
   if(!sCk)return false;
   
   if(!sForCk)return false;
   sForCk = sForCk.toLowerCase();
   sCk = sCk.split(', ');
   
   for(var i = 0, j = sCk.length; i < j; i++ )
   {
    var re = new RegExp(sCk[i] + '$''i');
    
    if(re.test(sForCk))return true;
   } return false;
  } // shawl.qiu code
  
  function fEncode(str)
  {
   if(!str)return false;
   str = str.replace(/[&]/g, '&amp; ');
   str = str.replace(/</g, '&lt; ');
   str = str.replace(/>/g, '&gt; ');
   return str;
  } // shawl.qiu code
  
  function fMtdHelp(sAct, bHighlight, bShow, bReturn)
  {
   var sCode = '';
   //if 1
   if(!sAct)
   {
    sCode = fRcsvFso(tl.pathPhysical, true'txt');
   }
   else if (sAct == 'default')
   {
    sCode += fStmRead(tl.pathPhysical + '\\default.txt', tl.charset)
   }
   else if (sAct == 'source')
   {
    sCode += fStmRead(tl.pathPhysical + '\\default.asp', tl.charset);
   }
   else if (sAct == 'readme')
   {
    sCode += fStmRead(tl.pathPhysical + '\\readme.txt', tl.charset);
   }
   else
   {
    sAct = sAct.split(' | ');
    //for
    for(var i = 0, j = sAct.length; i < j; i++ )
    {
     sAct[i] = sAct[i].replace(/^\s+|\s+$/'');
     //if 2
     if(!/\./.test(sAct[i]))
     {
      sCode += fRcsvFso(tl.pathPhysical + '\\' + sAct[i], false, true, 'txt');
     }
     else
     {
      sAct[i] = this.pathPhysical + '
\\' + (sAct[i].replace(/\./'\\'));
      
      if(fFlCkFld(sAct[i]))
      {
       sCode += fRcsvFso(sAct[i], false, true, '
txt');
      }
      var iPath = sAct[i] + '
.txt';
      
      if(fFlCkFl(iPath))
      {
       sCode += fStmRead(iPath, tl.charset);
      }
     }
    }
    // end if 2
    //end for
   }
   //end if 1
   var sDiv = '
 < div style = "background-color:#cccccc;display:table;width:100%;" > &nbsp; <  / div > ';
   sCode = fEncode(sCode);
   sCode = sCode.replace(/([-]{3}\/[-]{20,})/gi, sDiv);
   
   if(bHighlight)
   {
    eval(tl.go('
string.highlight'));
    sCode = highlight(sCode);
   }
   
   if(!bShow) Response.Write('
 < pre style = "background - color : #f4f4f4!important; ' +
   '
color : black!important; " > ' + sCode + ' <  / pre > ');
   
   if(bReturn) return sCode;
   return true;
  } // end function fMtdHelp
  
  function fMtdFind(sPath, bHighlight, bShow, bReturn)
  {
   if(!sPath) var sPath = '
default.asp'
   var sCode = '
';
   sPath = Server.MapPath(this.path + sPath);
   
   if(fFlCkFl(sPath))
   {
    sCode += fStmRead(sPath, tl.charset);
   }
   sCode = fEncode(sCode);
   
   if(bHighlight)
   {
    eval(tl.go('
string.highlight'));
    sCode = highlight(sCode);
   }
   
   if(!bShow) Response.Write('
 < pre style = "background - color : #f4f4f4!important; ' +
   '
color : black!important; " > ' + sCode + ' <  / pre > ');
   
   if(bReturn) return sCode;
   return true;
  } // end function fMtdFind
  
  function fRcsvFso(sPath, bRcsv, bLv, sExt)
  {
   var fso = new ActiveXObject('
scripting.fileSystemObject');
   var path = fso.GetFolder(sPath);
   var temp = '
';
   var strAll = '
';
   
   if(!sExt)var sExt = tl.extension;
   
   if(!bLv)
   {
    for(var eu = new Enumerator(path.SubFolders); !eu.atEnd(); eu.moveNext())
    {
     for(var eu_ = new Enumerator(eu.item().Files); !eu_.atEnd(); eu_.moveNext())
     {
      if(fCkExt(sExt, eu_.item().Path))
      {
       temp = fStmRead(eu_.item().Path, tl.charset);
       strAll += temp + '
\n';
      }
     }
     
     if(bRcsv)     arguments.callee(eu.item().Path, bRcsv, sExt);
     }
    }
    else
    {
     for(var eu_ = new Enumerator(path.Files); !eu_.atEnd(); eu_.moveNext())
     {
      if(fCkExt(sExt, eu_.item().Path))
      {
       temp = fStmRead(eu_.item().Path, tl.charset);
       strAll += temp + '
\n';
      }
     }
    }
   fso = path = null;
   return strAll;
  } // shawl.qiu code
  
  function fFlCkFld(sPath)
  {
   if(!sPath) return false;
   
   if(sPath.length == 0)return false;
   return new ActiveXObject("scripting.fileSystemObject").FolderExists(sPath);
  } // shawl.qiu code
  
  function fFlCkFl(sPath)
  {
   if(!sPath) return false;
   
   if(sPath.length == 0)return false;
   return new ActiveXObject("scripting.fileSystemObject").FileExists(sPath);
  } // shawl.qiu code
  //------------------------------------end private method
 } // shawl.qiu code
 //---------------------------------end class Imports()---------------------------------//
%>

 
文章相关信息:
主题: shawl.qiu asp jscript 服务端框架类 v 1.3
发表者: shawl.qiu
电子邮件: shawl.qiu@gmail.com
QQ: 908202921
MSN: btbtd@msn.com
Homepage: http://www.btbtd.org/
Blog: http://blog.csdn.net/btbtd/
发表日期: 2007-9-9 12:55:39
更新日期: 2007-9-9 12:55:39
来源引用: shawl.qiu CSharp DotNet 个人资料管理系统
引用本页: http://gi.2288.org/mod/code/display/Default.aspx?aid=572
关闭
Google
搜索WWW
搜索www.btbtd.org
搜索blog.csdn.net
Powered by shawl.qiu © 2008-2010 the shawl.qiu Javascript Kits
Copyright © 2008-2010 by shawl.qiu