2010年4月9日

          基于Domino8.5.1創建Web應用程序

          http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Master_Table_of_Contents_for_Building_Domino_Web_Applications_using_Domino_8.5.1

          posted @ 2010-04-19 10:44 明高 閱讀(303) | 評論 (0)編輯 收藏

          Eclipse無插件配置Resin

          http://blog.csdn.net/samboy2002/archive/2006/04/03/648785.aspx

          posted @ 2010-04-19 09:52 明高 閱讀(268) | 評論 (0)編輯 收藏

          Lotus的服務器端編程

          posted @ 2010-04-12 17:09 明高 閱讀(222) | 評論 (0)編輯 收藏

          1

          Teamstudio CIAO! Client Edition  2.50

          Serial No.        AP-24607  License Key        PMSGQ-N4LXB-RTFKVT
          Maintenance Expires  2009/08/31  Number Licenses        1

           

          Teamstudio CIAO! Server Edition  2.40

          Serial No.        AP-24608  License Key        XMSGA-BIAIV-SCI2RX
          Maintenance Expires  2009/08/31  Number Licenses        1


           

          posted @ 2010-04-09 17:34 明高 閱讀(189) | 評論 (0)編輯 收藏

          Tomcat配置與應用.doc

          如何部署Java Web應用程序到Tomcat中?
          第一步配置tomcat
          安裝Tomcat后,在我的電腦->屬性->高級->環境變量->系統變量中添加以下環境變量(假定你的tomcat安裝在c:\tomcat):

          CATALINA_HOME=c:\tomcat
          CATALINA_BASE=c:\tomcat

          然后修改環境變量中的classpath,把tomat安裝目錄下的common\lib下的(可以根據實際追加)servlet.jar追加到classpath中去,修改后的classpath如下:

          classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet.jar;

          接著可以啟動tomcat,在IE中訪問http://localhost:8080,如果看到tomcat的歡迎頁面的話說明安裝成功了。

          第二步:部署Servlet:
          建立 Servlet
          1.用你最熟悉的編輯器(建議使用有語法檢查的java ide)新建一個servlet程序,文件名為Test.java,文件內容如下:

          package test;
          import java.io.IOException;
          import java.io.PrintWriter;
          import javax.servlet.ServletException;
          import javax.servlet.http.HttpServlet;
          import javax.servlet.http.HttpServletRequest;
          import javax.servlet.http.HttpServletResponse;
          public class Test extends HttpServlet {
          protected void doGet(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
          PrintWriter out=response.getWriter();
          out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
          out.flush();
          }
          }

          2 .編譯
          將Test.java放在c:\test下,使用如下命令編譯:

          C:\Test>javac Test.java

          然后在c:\Test下會產生一個編譯后的servlet文件:Test.class

          3 .將結構test\Test.class剪切到%CATALINA_HOME%\webapps\myapp\WEB-INF\classes下,也就是剪切那個test目錄到classes目錄下,如果classes目錄不存在,就新建一個。 現在webapps\myapp\WEB-INF\classes下有test\Test.class的文件目錄結構

          4 .修改webapps\myapp\WEB-INF\web.xml,添加servlet和servlet-mapping

          編輯后的web.xml如下所示,紅色為添加的內容:

          <?xml version="1.0" encoding="ISO-8859-1"?>
          <!DOCTYPE web-app
          PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          "http://java.sun.com/dtd/web-app_2_3.dtd">
          <web-app>
          <display-name>My Web Application</display-name>
          <description>
          A application for test.
          </description>
          <servlet>
          <servlet-name>Test</servlet-name>
          <display-name>Test</display-name>
          <description>A test Servlet</description>
          <servlet-class>test.Test</servlet-class>
          </servlet>
          <servlet-mapping>
          <servlet-name>Test</servlet-name>
          <url-pattern>/Test</url-pattern>
          </servlet-mapping>
          </web-app>

          這段話中的servlet這一段聲明了你要調用的Servlet,而servlet-mapping則是將聲明的servlet"映射"到地址/Test上

          5 .好了,重啟動Tomcat,啟動瀏覽器,輸入http://localhost:8080/myapp/Test 如果看到輸出This is a servlet test.就說明編寫的servlet成功了。

          注意:修改了web.xml以及新加了class,都要重啟Tomcat

          參考:
          http://blog.csdn.net/NetMicrobe/archive/2006/04/14/663031.aspx
          http://read.newbooks.com.cn/info/196577.html

          posted @ 2010-04-09 15:50 明高 閱讀(216) | 評論 (0)編輯 收藏

          lotus&dojo

          http://www-10.lotus.com/ldd/ddwiki.nsf/dx/domino85-use-dojo-libraries.htm
          http://ideajam.net/IdeaJam/P/ij.nsf/0/7E146908362FE350862576D500522C65?OpenDocument#
          http://www.training-classes.com/programs/03/16/31617_domino_designer_8-5_browser_applications_and_dojo.php
          https://www.ibm.com/developerworks/cn/web/wa-dojotoolkit/

          posted @ 2010-04-09 15:48 明高 閱讀(198) | 評論 (0)編輯 收藏

          Lotus程序設計優化

          http://www.ibm.com/developerworks/lotus/library/notes7-application-performance2/index.html?S_TACT=105AGX13&S_CMP=EDU

          posted @ 2010-04-09 14:39 明高 閱讀(177) | 評論 (0)編輯 收藏

          Perl操縱數據庫

          #!perl
          use Win32::ODBC;
          $Data = new Win32::ODBC("DSN=dhcp;UID=netman;PWD=netman;");
          $Data2 = new Win32::ODBC("DSN=dhcp;UID=netman;PWD=netman;");
          $Data1 = new Win32::ODBC("DSN=dhcp;UID=netman;PWD=netman;");
          $Data3 = new Win32::ODBC("DSN=dhcp;UID=netman;PWD=netman;");

           


          $Data->Sql("select ip,mac,host from dhcplist");

          while ($Data->FetchRow())
          {
           
           ($ip,$mac,$host) = $Data->Data;
           print $host,"\n";

            
           $Data1->Sql("select * from Employee ");
           
           while ($Data1->FetchRow())
           
           {
           ($cname,$dept,$dno,$id,$ext) = $Data1->Data;

           print "$cname","\n";
           print "$id","\n";
           


           }
           $Data1->Close();

           $flag = '';


           $Data2->Sql("select * from dhcp_data where host = '$host' and ip = '$ip' ");

                  #print "select * from dhcp_data where host = '$host' and ip = '$ip'" ;

           while ($Data2->FetchRow())
                  {
           
           #@flag = $Data2->Data;

           if ( $flag ne "" )
           {
           print "ok"; 
           
           $Data3->sql("update dhcp_data set ip = '$ip',host = '$host',mac ='$mac',cname = '$cname',dept = '$dept',dno = $dno',notesid = '$id',ext = '$ext',modifydate = getdate()"); 
              
           $Data3->Close();
            
           }
           else
           {
                  print "ok2";
           $Data3->sql("insert into dhcp_data(ip,host,mac,cname,dept,dno,notesid,ext,modifydate) values('$ip','$host','$mac','$cname','$dept','$dno','$id','$ext',getdate())"); 
              
           $Data3->Close(); 
           }

          }
           $Data2->Close(); 

           
            
          }  
           
          $Data->Close();


           

          posted @ 2010-04-09 10:02 明高 閱讀(137) | 評論 (0)編輯 收藏

          在Lotus中操縱txt文件

          那怎么用LS創建TXT文件  Superhewei(360700686) 11:03:43 Dim fileNum As Integer, empNumber As Integer, n As Integer  Dim fileName As String, empName As String  fileNum% = Freefile()  fileName$ = "H:\zcjn"+Format(Now,"yyyy-mm-dd")+".trs" ' fileName$ = "c:\zcjn"+Format(Now,"yyyy-mm-dd")+".trs"  Open fileName$ For Output As fileNum% 

          posted @ 2010-04-09 09:33 明高 閱讀(237) | 評論 (0)編輯 收藏

          在Lotus開發中使用ODBC進行數據交互

          Sub Initialize  Dim session As New NotesSession  Dim doc As NotesDocument     '當前文檔的后臺文檔  Dim tobeSearchDb As NotesDatabase   '待搜索的數據庫  Dim DstDocs As NotesDocumentCollection  '搜索結果集  Dim RstDoc As NotesDocument                '查詢到的文檔  Dim sRstView As NotesView                    '結果顯示視圖  Set Db=Session.CurrentDatabase   Set doc=session.DocumentContext    Dim con As ODBCConnection  Dim userName As String  Dim password As String  Dim qry As ODBCQuery  Dim result As ODBCResultSet  Dim A As String    Set con = New ODBCConnection  Set qry = New ODBCQuery  Set result = New ODBCResultSet    Set qry.Connection = con  Set result.Query = qry    A=con.ConnectTo("CoprYW","sa","123")    qry.SQL = " INSERT INTO mt(phone,msg_content,sm_flag)  VALUES ('"+doc.SMSendTo(0)+"','"+doc.SMBody(0)+"','1'); "    'Call JSAction("Alert",Cstr(a))  If Not result.Execute Then   'Messagebox _   'result.GetExtendedErrorMessage,, result.GetErrorMessage      'Exit Sub  End If  result.Close(DB_CLOSE)  con.Disconnect   End Sub

          posted @ 2010-04-09 09:32 明高 閱讀(283) | 評論 (0)編輯 收藏

          Lotus中定制搜索

          Sub SearchWeb()
           Dim QryDB As NotesDatabase
           Dim vwDBList As NotesView
           Dim sQueryString As String
           Dim sMinRecord,sMaxRecord,sSortMethod,sTemp,sQry,sOldQry,sSymbol As String
           Dim sSearchFuzzy As String
           Dim sUseCache As String
           Dim sServername As String
           Dim sDbName As String
           Dim sViewName As String
           Dim sPage As String
           Dim sCondition As String
           Dim sDBDocID As String
           Dim sFields As String
           Dim vResult() As Variant
           Dim vTemp,vDBDocList As Variant
           Dim i,j,iRecordNumber As Integer
           
           Set session = New NotesSession
           Set db = session.currentdatabase
           Set doc = session.documentcontext
           sQry = doc.Query_String_Decoded(0)
           sOldQry = sQry
           '-------------------------------- 獲取查詢參數 --------------------------------------
           vTemp = Evaluate("@ReplaceSubstring('"+sQry+"';'+';' ')")
           
           sTemp = vTemp(0)
           sQry = sTemp
           
           i = Instr(sTemp,"^")
           sCondition = Mid(sTemp,i+1) '查詢條件
           
           sDBDocID = Left(sTemp,i-1)
           i = Instr(sDBDocID,"&")
           sDBDocID = Mid(sDBDocID,i+1)'查詢視圖參數
           
           'sSortMethod = Mid(sCondition,Instr(sCondition,"~")+1,1)'排序方式 
           sSearchFuzzy = Mid(sCondition,Instr(sCondition,"!")+1,1)'是否使用模糊查詢
           sUseCache = Mid(sCondition,Instr(sCondition,"$")+1,1)'是否使用Cache
           
           i = Instr(sCondition,"@")
           j = Instr(i+1,sCondition,"@")
           sMinRecord=Val(Mid(sCondition,i+1,j-i-1))'查詢記錄起始數
           sMaxRecord=Val(Mid(sCondition,j+1))'查詢記錄每頁最大結果數
           sCondition = Mid(sCondition,1,i-1)'取得查詢關鍵字 
           
           vDBDocList = Extract(sDBDocID,",") '獲取查詢視圖參數的數組
           
           Call ExtractArray(sCondition) '獲取查詢關鍵字列表
           iRecordNumber = 0
           sPage = ""
           sSymbol = ""
           If sSearchFuzzy = "1" Then
            sSymbol = "*"
           End If
           '------------------------------------------------------------------------------------
           '---------------------------------- 開始查詢 ----------------------------------------
           Forall x In vDBDocList
            vTemp = Extract(Cstr(x),"!")'拆分查詢參數(所在服務器!所在數據庫!查詢視圖)
            
            sServerName=vTemp(0)'查詢數據庫所在服務器
            sDbName=vTemp(1)'查詢數據庫
            sViewName = vTemp(2)'查詢的視圖名
            
            Set QryDB = New NotesDatabase(sServerName,sDbName)'取得查詢數據庫對象
            
            Set view = QryDB.getview(sViewName)'取得查詢數據庫視圖
            sQry=""
            sQueryString = ""
            Forall y In sQryKey
             sQry = Replace(y,"""","''")
             sTemp = ""
             '當指定域查詢時
             If doc.Fields(0) <> "" Then
              Forall z In doc.Fields
               If sTemp = "" Then
                sTemp = "FIELD "+z+{ contains "}+sSymbol+sQry+sSymbol+{"}
               Else
                sTemp = sTemp + " AND FIELD "+z+{ contains "}+sSymbol+sQry+sSymbol+{"}
               End If
              End Forall
              
              If sQueryString = "" Then
               sQueryString = "(" + sTemp +")"
              Else
               sQueryString = sQueryString + " OR (" + sTemp +")"
              End If
             Else'未指定域
              If sQueryString = "" Then
               sQueryString = sQry
              Else
               sQueryString = sQueryString + " AND " + sQry
              End If
             End If
            End Forall
            j = view.FTSearch( sQueryString, Cint(sMaxRecord))'開始查詢
            '將結果形成XML數據
            If j>0 Then
             For i = 1 To j
              iRecordNumber = iRecordNumber + 1
              Set qrydoc = view.getnthdocument(i)
              sPage = sPage + {<row url="javascript:opendoc('/}+QryDB.Replicaid+{/0/}+qrydoc.Universalid+{?opendocument')">}
              sPage = sPage + {<number>}+Cstr(iRecordNumber)+{</number>}
              sPage = sPage + {<title>}+qrydoc.ColumnValues(0)+{</title>}
              sPage = sPage + {<category>}+doc.Name(0)+{</category>}
              sPage = sPage + {<score>}+Cstr(qrydoc.FTSearchScore)+{%</score>}
              sPage = sPage + {</row>}
             Next
            End If
            Call view.clear
           End Forall
           '------------------------------------------------------------------------------------
           '---------------------------------- 輸出結果 ----------------------------------------
           Print {Content-type: text/xml}
           Print {<?xml version='1.0' encoding="utf-8" ?>}
           Print {<view name="查詢結果" id="vgosearchresult.xml">}
           Print {<header>}
           Print { <number>序號</number>}
           Print { <title>標題</title>}
           Print { <category>位置</category>}
           Print { <score>匹配度</score>}
           Print {</header>}
           Print {<action/>}
           Print {<rows>}
           Print sPage
           Print {</rows>}
           Print {</view>}
           '------------------------------------------------------------------------------------
          End Sub

          posted @ 2010-04-09 09:21 明高 閱讀(140) | 評論 (0)編輯 收藏

          在Lotus開發中的使用JDBC進行數據交互

          import java.io.*;
          import java.net.URL;
          import java.sql.*;
          import java.util.Properties;
          import lotus.notes.*;
          import java.util.*;

          public class  savetonewdatabase extends AgentBase {
           public void NotesMain() {

            Driver drv = null;
            PrintWriter out = null; 
                 try {
                     Session session = getSession();
                     AgentContext ac = session.getAgentContext();
                     Database db = ac.getCurrentDatabase();
             Database SendDB = session.getDatabase(db.getServer(),"lt_getfile.nsf");
                     Document doc = ac.getDocumentContext();   

                     out = getAgentOutput();      
                         String docUnid;
                         //Get the new record's unid
                         docUnid = uniqueID();
                             
             //Get the sql insert statement   
             StringBuffer SqlUrl = new StringBuffer("Insert into Shouwen_stat (");
             StringBuffer SqlValue = new StringBuffer(" values (");

               String temp= doc.getItemValueString("F_hao");
            
                         if(temp!=null){
                          temp = doc.getItemValueString("F_ziTitle")+"〔"+doc.getItemValueString("F_zi")+"〕"+doc.getItemValueString("F_hao")+"號";
                          }else{
                          temp = "〔"+doc.getItemValueString("F_zi")+"〕";
                         }  
           
             if (temp!= null){
              SqlUrl.append("doc_no");
              SqlValue.append("'" + temp+"'");
               
             }
             String doc_id = doc.getItemValueString("CurDocId");
             if (doc_id != null) {
              SqlUrl.append(",doc_id");
              SqlValue.append(",'" + doc_id + "'");
             }
             String sqlField = doc.getItemValueString("F_title");
             if (sqlField != null) {
              SqlUrl.append(",doc_title");
              SqlValue.append(",'" + sqlField + "'");
              }
             
             sqlField = doc.getItemValueString("shenghr");
             if (sqlField != null) {
              SqlUrl.append(",niban_people");
              SqlValue.append(",'" + sqlField + "'");
             }
             
             sqlField = doc.getItemValueString("F_BigSpecies");
             if (sqlField != null) {
              SqlUrl.append(",wen_zhong");
              SqlValue.append(",'" + sqlField  + "'");
             }
             sqlField = doc.getItemValueString("text");
             if (sqlField != null) {
              SqlUrl.append(",file_content");
              SqlValue.append(",'" + sqlField  + "'");
             }

             sqlField = doc.getItemValueString("timewrite"); //收文日期
             
             if (sqlField != null) {
              SqlUrl.append(",shouwen_date");
              SqlValue.append(",'" + sqlField  + "'");
             }
             sqlField = doc.getItemValueString("F_FilekeyWord");
             if (sqlField != null) {
              SqlUrl.append(",title_word");
              SqlValue.append(",'" + sqlField  + "'");
              }
             sqlField = doc.getItemValueString("F_emergency");
             if (sqlField != null) {
              SqlUrl.append(",huan_ji");
              SqlValue.append(",'" + sqlField + "'");
             }
             
             sqlField = doc.getItemValueString("F_UnitName");
             if (sqlField != null) {
              SqlUrl.append(",laiwen_unit");
              SqlValue.append(",'" + sqlField  + "'");
             }
             sqlField = doc.getItemValueString("F_Secret");
             if (sqlField != null) {
              SqlUrl.append(",mi_ji");
              SqlValue.append(",'" + sqlField  + "'");
              }

             sqlField = doc.getItemValueString("laiwfs");
             if (sqlField != null) {
              SqlUrl.append(",laiwen_mode");
              SqlValue.append(",'" + sqlField  + "'");
             }
             sqlField = doc.getItemValueString("shengpyj");
             if (sqlField != null) {
              SqlUrl.append(",niban_date");
              SqlValue.append(",'" + sqlField  + "'");
             }
             
             sqlField = doc.getItemValueString("shenghyj");
             if (sqlField != null) {
              SqlUrl.append(",niban_yijian");
              SqlValue.append(",'" + sqlField + "'");
             }
             
             sqlField = doc.getItemValueString("F_EndTime");
             if (sqlField != null) {
              SqlUrl.append(",banli_qixian");
              SqlValue.append(",'" + sqlField  + "'");
             }
             sqlField = doc.getItemValueString("lind");
             
             if (sqlField != null) {
              SqlUrl.append(",chengban_yj");
              SqlValue.append(",'" + sqlField  + "'");
              }

             sqlField = doc.getItemValueString("pisyj");
             if (sqlField != null) {
              SqlUrl.append(",piban_date");
              SqlValue.append(",'" + sqlField  + "'");
             }
             
             sqlField = doc.getItemValueString("lindps");
             if (sqlField != null) {
              SqlUrl.append(",piban_yijian");
              SqlValue.append(",'" + sqlField  + "'");       
             }

                 sqlField = doc.getItemValueString("banlyj");
             if (sqlField != null) {
              SqlUrl.append(",banli_jieguo");
              SqlValue.append(",'" + sqlField  + "'");
             }
             sqlField = doc.getItemValueString("banlr");
             if (sqlField != null) {
              SqlUrl.append(",banli_people");
              SqlValue.append(",'" + sqlField  + "'");
             }

             sqlField = doc.getItemValueString("banlsj");
             if (sqlField != null) {
              SqlUrl.append(",banli_date");
              SqlValue.append(",'" + sqlField  + "'");
             }
                         sqlField = doc.getItemValueString("chengbyj");
             if (sqlField != null) {
              SqlUrl.append(",piban_people");
              SqlValue.append(",'" + sqlField  + "'");
             }
             sqlField = doc.getItemValueString("chengbr");
             if (sqlField != null) {
              SqlUrl.append(",chengban_people");
              SqlValue.append(",'" + sqlField  + "'");
             }

             sqlField = doc.getItemValueString("chengbsj");
             if (sqlField != null) {
              SqlUrl.append(",chengban_date");
              SqlValue.append(",'" + sqlField  + "'");
             }
             sqlField = doc.getItemValueString("temp");  //流水號
             if (sqlField != null) {
              SqlUrl.append(",shouwen_bianhao");
              SqlValue.append(",'" + sqlField  + "'");
             }  
             sqlField=doc.getItemValueString("shihgd");   //文件是否歸檔
            if(sqlField!=null){
             SqlUrl.append(",document_state");
              SqlValue.append(",'"+sqlField+"'");
             } 
             sqlField=doc.getItemValueString("wenjzx");    //文件走向
             if(sqlField!=null){
              SqlUrl.append(",send_file");
              SqlValue.append(",'"+sqlField+"'");
             }   

             SqlUrl.append(")");
             SqlValue.append(")");
             String Va = SqlValue.toString();
              SqlUrl.append(Va);
             
             // Connect to data source
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
             drv = new sun.jdbc.odbc.JdbcOdbcDriver();   
             
             String url = "jdbc:odbc:is_archive";
                           
             Properties props = new Properties();
             props.put("user","isa");
             props.put("password","gxmi");   
             Connection con = drv.connect(url,props);
             
             if (con==null){
              out.println("<h1>Con't Connect to DB!</h1>");
              return;
             }   
             Statement stmt = con.createStatement();
             
             //Insert a record to the Fwdj table             
             Va = SqlUrl.toString();
             Va =new String(Va.getBytes("gb2312"),"ISO-8859-1"); 
             
             stmt.executeUpdate(Va);
           
            
                   out.println("<link rel='stylesheet' href='/oa.css'><br><br><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>");
                       out.println("<TR VALIGN=top><TD WIDTH=232><IMG SRC='/Lt_getfile.nsf/c01a1dee4878d8a648256b270024a88c/$Body/0.25E!OpenElement&FieldElemFormat=gif' WIDTH=208 HEIGHT=21></TD>");
                       out.println("<TD WIDTH=416 VALIGN=middle><DIV ALIGN=center><B><FONT SIZE=5 COLOR='0000FF'>操作反饋信息</FONT></B></DIV></TD></TR></TABLE>");
                       out.println("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR VALIGN=top>");
                       out.println("<TD WIDTH=689><IMG SRC='/Lt_getfile.nsf/c01a1dee4878d8a648256b270024a88c/$Body/0.CFA!OpenElement&FieldElemFormat=jpg' WIDTH=688 HEIGHT=4></TD></TR>");
                       out.println("</TABLE><BR><br><br><br><br><P><BR><BR><BR><BR>");
                       out.println("<table border=0  bgColor=#0099cc borderColorLight=#000000 cellPadding=1 cellSpacing=2 align='center'><tr><td  bgcolor=#EFEFEF>文件發送給下一辦理人"+doc.getItemValue("sendtobak")+"辦理!</td></tr></table>");
           
            } catch (Exception e) {
             out.println(e.getMessage());
             e.printStackTrace();
            }
              }
           public static String uniqueID()
            {
                   StringBuffer sb=new StringBuffer(20);
               java.text.SimpleDateFormat formatter=new java.text.SimpleDateFormat("yyyy/MM/dd");
               java.util.Date currentTime=new java.util.Date();
               String sid=formatter.format(currentTime);
               return sid;
               }
              
           public static String replaceAll(String operStr,String oldStr ,String replaceStr){
            int fromIndex=0;
            int index=0;
            int oldStrLen=oldStr.length();
            int replaceStrLen=replaceStr.length();
            
            while((index=operStr.indexOf(oldStr,fromIndex))!=-1){
             //新的位置起點
             //fromIndex+replaceStrLen-oldStrLen+1
             fromIndex=index + replaceStrLen;
             operStr=operStr.substring(0,index)+replaceStr+
              operStr.substring(index+oldStrLen,operStr.length());
            }
            
            return operStr;
           }
           
           
           
          }

          posted @ 2010-04-09 09:20 明高 閱讀(403) | 評論 (0)編輯 收藏

          lotus notes 開發中BS下實現組合查詢的方法

          在進行系統設計的時候用戶要求對各文件能夠實現組合條件的查詢和統計,開發之初我選擇了notes自身提供的綜合查詢表單$$Search Form來實現,但在用戶使用了一段時間發現,采用$$Search Form來進行組合條件查詢時常常會搜索到許多并不滿足條件的文檔或者搜索到的文檔根本就不知道是什么,為了解決這個問題,我決定寫代碼來實現組合條件查詢,下面就來講講實現的過程。   首先建立一個表單(Fsearch),主要用來現實和選擇查詢條件,表單的域元素如下表所示:

          編號
           域名
           含義
           類型
           說明
           
          01
           SaveOptions
           防止使用該表單創建文檔
           文本域
           該域是系統域當值為”0”的時候當前表單不會創建文檔,因為這里使用該表單僅僅是為了選擇查詢條件,不需要創建文檔,所以該域的值為“0”
           
          02
           biaoti
           發文標題
           文本域
            
          03
           zhutici
           主題詞
           文本域
            
          04
           laiwenhao
           發文號
           文本域
            
          05
           nigaoren
           擬稿人
           文本域
            
          06
           danwei
           擬稿人單位
           文本域
            
          07
           syear
           文檔所屬年度
           文本域
            
          08
           smonth
           文檔所屬月份
           文本域
            

          在表單上按照用戶要求和使用習慣利用表格布局好上述元素后,在表單上創建一個熱點按鈕“現在查找“,執行@Command([ToolsRunMacro];"(wFaWenSearch)") 的公式命令,其中wFaWenSearch 是一個共享代理,代碼如下:Sub Initialize    ‘//定義變量 Dim session As New NotesSession Dim cDoc As NotesDocument Dim db As NotesDatabase Dim sResult , Set sResultemp  As NotesDocumentCollection Dim sql As String   Set db=session.currentDatabase  ‘//獲得當前數據庫 Set cDoc=session.DocumentContext() ‘//獲得當前文檔,即用戶打開的選擇條件的表單Fsearch Set view=db.getView("($UNID)") ‘//獲得($UNID)視圖,該視圖里現實所有文件 ‘//============獲取查詢條件=========// sYear=cDoc.syear(0) sMonth=cDoc.smonth(0) biaoti=cDoc.biaoti(0) zhutici=cDoc.zhutici(0)  laiwenhao=cDoc.laiwenhao(0) danwei=cDoc.danwei(0) nigaoren=cDoc.nigaoren(0)  ‘//================END================//‘//=====組合查詢條件======//sql="form=""fwmain"""+"&(@Contains(biaoti;"""+biaoti+""")"+"|@Contains(zhutici;"""+zhutici''>|@Contains(zhutici;"""+zhutici+""")"+_"|@Contains(t1+""[""+@text(t2)+""]""+@text(t3''>|@Contains(t1+""[""+@text(t2)+""]""+@text(t3)+ ""號""+;"""+laiwenhao+""")"+"|@contains(danwei">|@contains(danwei; """+danwei+""")"+_"|@Contains(nigaoren;"""+nigaoren+""")"+"|@Contains(sYear;"""+sYear''>|@Contains(nigaoren;"""+nigaoren+""")"+"|@Contains(sYear;"""+sYear+""")"+"| @Contains(sMonth;"""+sMonth+"""))"Set  sResultemp= db.search(sql,Nothing,0)  ‘//在數據庫中搜索滿足上述條件的所有文檔,獲得該文檔集;但是由于使用search語法會把當前操’//作者沒有閱讀權限的文檔也搜索到,所以先把搜索到的文檔集賦予臨時變量sResultemp 再進行處理 Set  sResult=db.search("@Contains(sYear;''1'')",Nothing,0) ‘//初始化一個文檔集sResul,這文檔集中沒有文件的‘//========下面這循環主要是利用視圖對文檔讀者權限的限制功能把sResultemp====//‘//========這個文檔集中當前用戶有閱讀權限的文檔添加到文檔集sResul中去=====// For i=1 To  sResultemp.count  Set  sDoc=sResultemp.getNthDocument(i)  key=sDoc.bh(0)  Set  Sview=db.getView("default")  Set  sDoc=Sview.Getdocumentbykey(key,True)  If  Not  sDoc  Is  Nothing Then   Set  sDoctmp=sResult.Getdocument(sDoc)   If  sDoctmp Is  Nothing Then    Call sResult.Adddocument(sDoc)   End If  End If Next If  sResult.count=0  Then  Print "沒有找到您要查找的文件"  Exit Sub End  If  ''//=========創建網頁來顯示查詢結果=======// Print "<html>" Print "<head>" Print "<link rel=stylesheet type=text/css href=ViewCss.css>" Print "</script>" Print "</head>"Print "<body>" Print "<table width=100%>" Print "<tr>" Print "<td colspan=6 align=right style=border-style:solid;border-width:0 0 2px;border-color:#669933>查找到&nbsp;"+Cstr(jjj)+"&nbsp;份文件&nbsp;<br>" Print "</td>" Print "</tr>" Print "<tr>" Print "<td width=5% class=td1></td>" Print "<td width=10% class=td1>年度</td>" Print "<td width=10% class=td1>月份</td>" Print "<td width=40% class=td1>標題</td>" Print "<td width=20% class=td1>主辦部門</td>" Print "<td width=15% class=td1>擬稿人</td>" Print "</tr>" For i=1 To sResult.count  Set sDoc=sResult.getNthDocument(i)  Set sDoc=view.getDocumentByKey(sDoc.bh(0),True)  If Not sDoc Is Nothing Then      Print "<tr>"    Print "<td class=tdx><a href=/"+sDoc.DBPath(0)+"/merit_gwgl.nsf/($UNID)/"+sDoc.UniversalID+"?opendocument target=_blank><img src=01.gif border=0 ></a></td>"   Print "<td class=tdx>"+sDoc.sYear(0)+"</td>"   Print "<td class=tdx>"+sDoc.sMonth(0)+"</td>"   Print "<td class=tdx>"+sDoc.biaoti(0)+"</td>"   Print "<td class=tdx>"+sDoc.danwei(0)+"</td>"   Print "<td class=tdx>"+sDoc.nigaoren(0)+"</td>"   Print "</tr>"  End If Next Print "</table>"  Print "</body>" Print "</html>" End Sub

          posted @ 2010-04-09 09:20 明高 閱讀(397) | 評論 (0)編輯 收藏

          Js操控Lotus中的附件

          <input type="checkbox" name="%%Detach" value="IBM咨詢.txt"><a href="附件路徑">IBM咨詢.txt</a></td></tr>

          選中以后,保存文檔,附件就會被系統自動刪除 
          江川之子 22:04:47 使用什么方法定位嵌入的embeddedobject呢 ,嵌入到文檔還是rtf域 
          CoolStar~_~ 22:04:55 文檔 
          江川之子 22:05:24 只能用getembedobject 
          江川之子 22:05:44 如果是rtf中的就可以用ref。emdedobjects  

           主業務數據表組,日志數據表組,組織結構權限組表,輔助數據表組,業務控制數據表組,
          尤其對于oa,組織結構最重要。對于一般的業務,業務控制數據最重要,這樣可以讓你的業務變的很靈活。

          posted @ 2010-04-09 09:19 明高 閱讀(161) | 評論 (0)編輯 收藏

          <2010年4月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          導航

          統計

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 平遥县| 黄龙县| 诏安县| 浦北县| 鲁山县| 屏东市| 舒城县| 古浪县| 城市| 石楼县| 阿城市| 曲水县| 德令哈市| 二连浩特市| 紫云| 文山县| 桐梓县| 宜宾县| 宁阳县| 镶黄旗| 元江| 泾阳县| 龙海市| 宜兰市| 攀枝花市| 惠安县| 工布江达县| 荔波县| 忻城县| 周宁县| 黄大仙区| 宁南县| 叶城县| 靖江市| 台前县| 灵武市| 柯坪县| 康保县| 阿图什市| 手机| 隆尧县|