2010年4月7日
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Master_Table_of_Contents_for_Building_Domino_Web_Applications_using_Domino_8.5.1
http://blog.csdn.net/samboy2002/archive/2006/04/03/648785.aspx
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
如何部署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
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/
http://www.ibm.com/developerworks/lotus/library/notes7-application-performance2/index.html?S_TACT=105AGX13&S_CMP=EDU
#!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();
那怎么用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%
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
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
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;
}
}
在进行系统设计的时候用户要求对各文件能够实现组合条件的查询和统计,开发之初我选择了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>查找到 "+Cstr(jjj)+" 份文件 <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
<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,组织结构最重要。对于一般的业务,业务控制数据最重要,这样可以让你的业务变的很灵活。
Sub InitAttachment
On Error Goto ErrorHandle
Dim temDoc As notesDocument
Dim temDoc1 As NotesDocument
Dim docAttachment As NotesDocument
Dim strQuery As String
Dim strUNID As String
Dim strFormula As String
Dim strList As String
Dim vPath As Variant
strQuery = note.Query_String_Decoded(0)
If Instr(strQuery,"&UNID=") > 0 Then
strUNID = Mid(strQuery,Cint(Instr(strQuery,"&UNID=")) + 6,32)
Set temDoc = db.GetDocumentByUNID(strUNID)
If Not (temDoc Is Nothing) Then
Set docAttachment = db.CreateDocument
docAttachment.Form = "fmAttachment"
docAttachment.Status = "0"
docAttachment.CourseInfoUnid = temDoc.UniversalID
If temDoc.HasEmbedded Then
Set temDoc1 = db.CreateDocument
Call temDoc.CopyAllItems (temDoc1)
Forall item In temDoc1.Items
If Not (Ucase(item.Name) = "$FILE") Then
temDoc1.RemoveItem (item.Name)
End If
End Forall
Call temDoc1.CopyAllItems(docAttachment)
End If
End If
End If
Call docAttachment.Save(True,False)
docAttachment.CurUnid = docAttachment.UniversalID
Call docAttachment.Save(True,False)
vPath = Evaluate(|@ReplaceSubstring(@Subset(@DbName;-1); " " : "\\"; "+" : "/")|)
Print |<script language="javascript"> |
Print |<!-- |
Print |window.location.href = "/| & vPath(0) & _
|/0/| & docAttachment.UniversalID & |?editdocument";|
Print |--> |
Print |</script> |
Exit Sub
'Domino Control Platform Error Info
ErrorHandle:
Messagebox db.FilePath & "_LibEduCommand.InitAttachment:" & Error$ & " at line number " & Cstr(Erl)
'Resume Next
End Sub
Sub SendMailNotification( docMain As Notesdocument, strSendto As String ,strTempletNum As String)
On Error Goto ErrorHandle
Dim docMail As NotesDocument
Dim rti As NotesRichTextItem
Dim body As NotesMIMEEntity
Dim child As NotesMIMEEntity
Dim stream As NotesStream
Dim strTmp As String
Dim strReplace As String
Dim bSuccess As Boolean
Dim strHtml As String
s.ConvertMIME = False
Set stream = s.CreateStream
Set docMail = New NotesDocument(docMain.ParentDatabase)
Call docMail.ReplaceItemValue("Form","Memo")
Call docMail.ReplaceItemValue("Principal","Reporter Notification")
Call docMail.ReplaceItemValue("ReplyTo","")
Set body = docMail.CreateMIMEEntity("Body")
Set child = body.CreateChildEntity
Call stream.WriteText(MailText(docMain,strTempletNum))
Call docMail.ReplaceItemValue( "Subject",MailSubject(docMain,strTempletNum))
strHtml = |<br><div style="font-size:15px; "><b><a href="|&ProfileDoc.DBHome(0) & ProfileDoc.DBPath(0) & |/0/| & docMain.UniversalID &|?opendocument" target="_blank">请点击打开文档</a></b></div>|
stream.WriteText(strHtml)
Call docMail.ReplaceItemValue("BlindCopyTo", strSendto)
Call child.SetContentFromText(stream, "text/html;charset=GB2312", ENC_NONE)
Call stream.Truncate
Call docMail.Send(False)
s.ConvertMIME = True
Call docMail.Remove(True)
Exit Sub
ErrorHandle:
'iSuccess = False
Messagebox db.FilePath & "_LSMailCommand.SendNotification:" & Error$ & " at line number " & Cstr(Erl)
Exit Sub
End Sub
'Print |正在统计,请稍候...|
Print |<script language="javascript"> |
Print |<!--
var oXL
var oBook
var oSheet1
var oXL = new ActiveXObject("Excel.Application");
oBook = oXL.Workbooks.Add();
oSheet1 = oBook.ActiveSheet;
oSheet1.Name = "IP-ASIC-Simulation";
oXL.sheets(oSheet1.Name).Select;
oXL.Range("A1:G1").Select;
oXL.Selection.RowHeight = 28.50;
oXL.Selection.HorizontalAlignment = 3;
oXL.Selection.VerticalAlignment = 3 ;
oXL.Selection.Font.Name = "宋体";
oXL.Selection.Font.FontStyle = "加粗";
oXL.Selection.Font.Size = 10;
oXL.Selection.Interior.ColorIndex = 19;
oXL.Selection.Borders.LineStyle = 1;
oSheet1.Cells(1,1).Value = "Customer's Project";
oSheet1.Cells(1,2).Value = "SH Project";
oSheet1.Cells(1,3).Value = "GID";
oSheet1.Cells(1,4).Value = "RD Users";
oSheet1.Cells(1,5).Value = "Layout Users";
oSheet1.Cells(1,6).Value = "Created Time";
oSheet1.Cells(1,7).Value = "Update Time";
oXL.Selection.Columns.AutoFit;
oXL.Selection.Rows.AutoFit;
|
i = 2
While Not (doc Is Nothing)
Print |oSheet1.Cells(| & Cstr(i) & |,1).Value = "| & Cstr(doc.Plan_Code_Sunplus(0)) & |";|
Print |oSheet1.Cells(| & Cstr(i) & |,2).Value = "| & Cstr(doc.Plan_Code_Sh(0)) & |";|
Print |oSheet1.Cells(| & Cstr(i) & |,3).Value = "| & Cstr(ProfileDoc.GID(0)+i-2) & |";|
'RDUser和LayoutUser
For j=1 To doc.num(0)
strItemName = "LoginName" & j
Set item = doc.GetFirstItem(strItemName)
strUserList = strUserList + item.Text+","
Next
Print |oSheet1.Cells(| & Cstr(i) & |,4).Value = "| & strUserList & |";|
Print |oSheet1.Cells(| & Cstr(i) & |,5).Value = "| & strUserList & |";|
Print |oSheet1.Cells(| & Cstr(i) & |,6).Value = "| & Cstr(doc.Created) & |";|
Print |oSheet1.Cells(| & Cstr(i) & |,7).Value = "| & Cstr(doc.ChangeDate(0)) & |";|
i = i+1
Print |
oXL.sheets(oSheet1.Name).Select;
oXL.Range(oSheet1.Cells(2,1),oSheet1.Cells(| & Cstr(i) & |-1,7)).Select;
oXL.Selection.Font.Name = "宋体";
oXL.Selection.Font.Size = 10;
oXL.Selection.Borders.LineStyle = 1;
oXL.ReferenceStyle = 1;
oXL.Range("A1").Select;
|
Set doc = vw.GetNextDocument(doc)
Wend
Print |oXL.Visible = true; |
Print |window.history.go(-1); |
'Print |window.close(); |
Print |--> |
Print |</script> |
基本原理:函件收集针对异域domino服务器的notes数据库进行信息的传递。
启动administrator端,选择"People&Group"的标签;
展开"Mail-In Database and Resources",添加“函件收集数据库”;
以新闻数据库为例:
函件收集数据库名称:dccnews(随意)
Internet地址:dccnews@ibm.com
网络域:ibm
服务器:mingle/ibm
文件名:oa/dccnews.nsf
说明:dccnews@ibm.com为邮件的通信地址,不需要单独为此在names.nsf中注册。只需要将其在外发的邮件服务器中设置,这样进来的邮件可以识别即可。我们可以通过创建类型为“邮件进入时”的代理即可解析和接收邮件的信息。
$Conflict
如果文档中有此域产生,则标志此域为冲突文档。
$$QuerySaveAgent
功能:等价于表单中的WebQuerySave事件。
示例代码:
Class DOMobj_Person
gdoc_Person As NotesDocument
' ** 屬性
Property Get Document
Set Document = gdoc_Person
End Property
Property Set Document
Set gdoc_Person = Document
End Property
Property Get NotesID
NotesID = gdoc_Person.GetItemValue("NotesID")(0)
End Property
Property Get No
No = gdoc_Person.GetItemValue("EmpNo")(0)
End Property
Property Get CName
CName = gdoc_Person.GetItemValue("EmpCName")(0)
End Property
Property Get EName
EName = gdoc_Person.GetItemValue("EmpName")(0)
End Property
Property Get DeptNo
DeptNo = gdoc_Person.GetItemValue("DeptNo")(0)
End Property
Property Get DeptName
DeptName = gdoc_Person.GetItemValue("DeptCName")(0)
End Property
Property Get DeptLayer
DeptLayer = gdoc_Person.GetItemValue("DeptLayer")(0)
End Property
' ** 代理資訊
Property Get AgentStatus
AgentStatus = gdoc_Person.GetItemValue("AgentStart")(0)
End Property
' ** 建構子
Sub New(pstr_SearchType As String , pstr_SearchKey As String)
Set gdoc_Person = domf_docGetPersonal(pstr_SearchType , pstr_SearchKey)
End Sub
' ** 方法
Function getPerson(pstr_SearchType As String , pstr_SearchKey As String)
Set gdoc_Person = domf_docGetPersonal(pstr_SearchType,pstr_SearchKey)
End Function
'---get First Item Value
Function getFirstItemValue(pstr_item As String) As Variant
getFirstItemValue = Me.gdoc_Person.getFirstItemValue(pstr_item)
End Function
'---get Default Deputy
Function getDefaultDeputy() As DOMobj_Person
Set getDefaultDeputy = Nothing
If (Me.AgentStatus) Then
If gdoc_Person.GetItemValue("DeputyEmpNo")(0) <> "" Then
Set getDefaultDeputy = New DOMobj_Person("NO" , gdoc_Person.GetItemValue("DeputyEmpNo")(0))
End If
End If
End Function
'---get Class Deputy
Function getDeputyByClass(pstr_Class As String)
End Function
End Class
这是一个老生常谈的老问题:
环境:Domino7.0.1 2003server.Sp1,用户mail模板Dwa7.ntf
利用Domino web access访问用户mail数据库,时常出现无法下载保存中文名称附件。
影响的Domino版本很多,IBM承认是软件bug,但一直没有解决这个问题
附件格式:
中英文混和、utf格式的文档、名称中包含+号、包含路径等的附件名称格式
心细的你可能注意到,如果你发送一个如:abc中文.txt的附件,用户收到后,附件名称就会变更为“abc 中文.txt”,中间多了一个空格!
解决:
看多了网络上关于这个方面的讨论,没有彻底的解决方法
1:修改服务器文档---internet协议---Domino web引擎中的“字符集”,使用UTF-8输出
2:如果碰到这个问题,将这个邮件转发给自己!在看看,一般而言也可以打开(这个是IBM发布的变相解决,嘿嘿)
相关配置:
当前服务器文档:
tab标签“Internet协议”——〉tab标签“Domino Web引擎”,依次找到
语言项设置:
缺省字符串资源语言:英语
其他字符串资源语言:中文(简体),中文(繁体)
字符集:
使用UTF-8输出:是
在HTML表单中使用UTF-8:是
缺省的字符集群组:简体中文
安装多语言包
比如客户端使用的是繁体中文的操作系统,domino server就必须安装繁体中文的语言包,否则此客户将无法访问中文名称(比如:上海世博.ppt)的附件。
解决方案1、附件存储在单独的一个数据库中,供业务文档来访问使用。
AttachmentDBPahtUrl :=@GetProfileField("ConfigProfile";"DBHome") + @GetProfileField("ConfigProfile";"AttachmentDBPath");
@Implode("<div align=left><IMG SRC=\"/icons/vwicn005.gif\"><A HREF=" + AttachmentDBPahtUrl + "0/"+@Text(AttachmentDocID0)+"/$FILE/"+@URLEncode("Domino";AttachmentName0)+" TARGET=_BLANK>"+AttachmentName0+"</A> </div>")
域AttachmentDocID0:存储附件所在的文档的UNID
域AttachmentName0:存储附件的名称,可能为中文、字母和相关符号的组合。
@URLEncode:对附件的名字进行编码,避免OS为繁体或其他非简体中文的操作系统因URL链接被截断而无法访问。
在Lotuscript中对汉语进行URLEncode
两种方式:
1、在ls中使用公式语言
Dim cmd As String
Dim x As Variant
cmd = {@URLEncode("Domino";"上海世博会")}
x=Evaluate(cmd)
msgbox CStr(x(0))
2、使用ls自定义的函数