Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
Option explicit
4
Response.Expires = 0	' always load the page, dont store
5
%>
6
<%
7
'=====================================================
8
'					Import Docs
9
'=====================================================
10
%>
11
<!--#include file="common/conf.asp"-->
12
<!--#include file="common/globals.asp"-->
13
<!--#include file="common/qstr.asp"-->
14
<!--#include file="common/common_subs.asp"-->
15
<!--#include file="common/common_dbedit.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/_popup_window_common.asp"-->
18
<%
19
'------------ ACCESS CONTROL ------------------
20
%>
21
<!--#include file="_access_control_login.asp"-->
22
<!--#include file="_access_control_general.asp"-->
23
<!--#include file="_access_control_project.asp"-->
24
<%
25
'------------ Variable Definition -------------
26
Dim parPv_id
27
Dim parDRdoc_title
28
Dim parDRdoc_id
29
Dim retVal
30
Dim rsDocReg
31
Dim parEdit
32
Dim cIsLatest
33
Dim parVersion_id
34
Dim parDoc_Num
35
'------------ Constants Declaration -----------
36
'------------ Variable Init -------------------
37
parPv_id = QStrPar("pv_id")
38
parRtag_id = QStrPar("rtag_id")
39
parEdit = Request("edit") 
40
parVersion_id = Request("version_id")
41
parDoc_Num = Request("doc_num")
42
'-- CONDITIONS --------------------------------
43
'----------------------------------------------
44
%>
45
<%
46
'-------------------------------------------------------------------------------------------------------------------------------
47
Sub Import_Document ( nPv_id, nDRdoc_id )
48
	Dim doc_id, is_latest, sDocVersion
49
 
50
	is_latest = "'Y'"
51
	doc_id = nDRdoc_id
52
	sDocVersion = "Always Latest"
53
 
54
	If Request("version_id") <> "" Then 
55
		Call Short_Document_Details ( Request("version_id"), NULL, sDocVersion, NULL  )
56
		doc_id = Request("version_id")
57
		is_latest = "NULL"
58
 
59
	End If
60
 
61
	On Error Resume Next
62
	OraSession.BeginTrans
63
 
64
	OraDatabase.ExecuteSQL _
65
		" DELETE FROM PACKAGE_DOCUMENTS "&_
66
		" WHERE pv_id = "& nPv_id&_
67
		"   AND doc_num = "& SQLstring ( Request("doc_num") )
68
 
69
	OraDatabase.ExecuteSQL _
70
		" INSERT INTO package_documents ( pv_id, doc_id, doc_num, is_latest  )"&_
71
		" VALUES ( "& nPv_id &", "& doc_id &", '"& SQLstring ( Request("doc_num") ) &"', "& is_latest &" )"
72
 
73
	OraSession.CommitTrans
74
 
75
 
76
	'/* Log Action */
77
	Call Log_Action ( nPv_id, "document_add", "Document number: "& Request("doc_num") &", Version: "& sDocVersion )
78
 
79
End Sub
80
'-------------------------------------------------------------------------------------------------------------------------------
81
Sub UpdatePackageDocument ( nPvId, nDocId, nVersionId )
82
 
83
	Dim cIsLatest, sDocVersion
84
 
85
	cIsLatest = "Y"
86
	sDocVersion = "Always Latest"
87
 
88
	If ( nVersionId <> "" ) Then 
89
		Call Short_Document_Details ( nVersionId, NULL, sDocVersion, NULL  )
90
		cIsLatest = NULL
91
	Else
92
		nVersionId = nDocId
93
	End If
94
 
95
 
96
	OraDatabase.Parameters.Add "PV_ID", nPvId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
97
	OraDatabase.Parameters.Add "DOC_ID", nVersionId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
98
	OraDatabase.Parameters.Add "DOC_NUM", parDoc_Num, 	ORAPARM_INPUT, ORATYPE_VARCHAR2
99
	OraDatabase.Parameters.Add "IS_LATEST", cIsLatest, 	ORAPARM_INPUT, ORATYPE_VARCHAR2 
100
 
101
 
102
	'On Error Resume Next
103
	OraSession.BeginTrans
104
 
105
	OraDatabase.ExecuteSQL _
106
		" UPDATE PACKAGE_DOCUMENTS pd SET "&_
107
		"    pd.doc_id = :DOC_ID, "&_
108
		"    pd.doc_num = :DOC_NUM, "&_
109
		"    pd.IS_LATEST = :IS_LATEST"&_
110
		" WHERE pd.PV_ID = :PV_ID "&_
111
		"   AND UPPER( pd.DOC_NUM ) = UPPER( :DOC_NUM ) "
112
 
113
	OraSession.CommitTrans
114
 
115
 
116
	OraDatabase.Parameters.Remove "PV_ID"
117
	OraDatabase.Parameters.Remove "DOC_ID"
118
	OraDatabase.Parameters.Remove "DOC_NUM"
119
	OraDatabase.Parameters.Remove "IS_LATEST"
120
 
121
 
122
	'/* Log Action */
123
	Call Log_Action ( nPvId, "document_update", "Document number: "& Request("doc_num") &", Version: "& sDocVersion )
124
 
125
 
126
End Sub
127
'-------------------------------------------------------------------------------------------------------------------------------
128
Sub GetPackageDocument ( nPvId, nDocId, outcIsLatest )
129
	Dim query, rsTemp
130
 
131
	OraDatabase.Parameters.Add "PV_ID", nPvId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
132
	OraDatabase.Parameters.Add "DOC_ID", nDocId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
133
 
134
	query = _
135
	" SELECT pd.*"&_
136
	"  FROM PACKAGE_DOCUMENTS pd"&_
137
	" WHERE pd.PV_ID = :PV_ID"&_
138
	"   AND pd.DOC_ID = :DOC_ID"
139
 
140
	Set rsTemp = OraDatabase.DbCreateDynaset( query, cint(0))
141
 
142
	If rsTemp.RecordCount > 0 Then
143
		outcIsLatest = "N"
144
		If rsTemp("is_latest") = "Y" Then
145
			outcIsLatest = "Y"
146
		End If
147
	End If
148
 
149
	rsTemp.Close()
150
	Set rsTemp = nothing
151
 
152
	OraDatabase.Parameters.Remove "PV_ID"
153
	OraDatabase.Parameters.Remove "DOC_ID"
154
 
155
End Sub
156
'-------------------------------------------------------------------------------------------------------------------------------
157
%>
158
<%
159
'Process submition
160
If CBool(Request("action"))  AND  objAccessControl.UserLogedIn  Then
161
 
162
 
163
	If (parEdit = "true") Then
164
		Call GetPackageDocument ( parPv_id, parVersion_id, cIsLatest )
165
	End If
166
 
167
 
168
	retVal = Lookup_Document ( Request("doc_num"), parDRdoc_title, parDRdoc_id, Empty, Empty  )
169
 
170
	If Request("btn") = "Import" Then
171
		Call Import_Document ( parPv_id, parDRdoc_id )
172
		Call OpenInParentWindow ("documentation.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id)
173
		Call CloseWindow()
174
 
175
	ElseIf Request("btn") = "Update" Then
176
		Call UpdatePackageDocument ( parPv_id, parDRdoc_id, parVersion_id )
177
		Call OpenInParentWindow ("documentation.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id)
178
		Call CloseWindow()
179
 
180
	End If
181
 
182
 
183
End If
184
 
185
%>
186
<html>
187
<head>
188
<title>Release Manager</title>
189
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
190
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
191
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
192
<link rel="stylesheet" href="images/navigation.css" type="text/css">
193
<script language="JavaScript" src="images/common.js"></script>
194
</head>
195
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();FormName.doc_num.focus();">
196
  <table width="100%" border="0" cellspacing="0" cellpadding="2" height="100%">
197
  <form name="FormName" method="get" action="<%=scriptName%>">
198
    <tr> 
199
      <td background="images/lbox_bg_blue.gif" width="1%" height="1%">&nbsp;</td>
200
      <td background="images/lbox_bg_blue.gif" nowrap width="50%" class="wform_ttl">&nbsp;</td>
201
      <td background="images/lbox_bg_blue.gif" align="right" width="50%">
202
	  	<%If parEdit = "" Then%>
203
	    <input tabindex="10" type="submit" name="btn" value="Import" class="form_btn_comp" <%If (parDRdoc_id = "") OR IsNull(parDRdoc_id) Then%>disabled<%End If%>> 
204
		<%Else%>
205
		<input tabindex="10" type="submit" name="btn" value="Update" class="form_btn_comp"> 
206
		<%End If%>
207
        <input type="reset" name="btn" value="Close" class="form_btn_comp" onclick="self.close()"> 
208
      </td>
209
      <td background="images/lbox_bg_blue.gif" align="right" width="1%" nowrap> 
210
        <img src="images/h_trsp_dot.gif" width="5" height="22"> </td>
211
    </tr>
212
    <tr> 
213
      <td height="100%" width="1%">&nbsp;</td>
214
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
215
	  <table width="100%" border="0" cellspacing="1" cellpadding="2">
216
 
217
        <tr>
218
          <td width="1%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
219
          <td width="1%" nowrap class="form_group" valign="bottom"></td>
220
          <td nowrap width="100%">&nbsp; </td>
221
        </tr>
222
        <tr>
223
          <td>&nbsp;</td>
224
          <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Document Number </td>
225
          <td nowrap background="images/bg_form_lightbluedark.gif" class="form_txt">
226
		      <input name="doc_num" type="text" class="form_item" value="<%=Request("doc_num")%>" size="20" maxlength="50" <%If parEdit <> "" Then%>readonly<%End If%>>
227
              <input tabindex="1" name="btn" type="submit" class="form_btn_comp" value="Lookup" <%If parEdit <> "" Then%>disabled<%End If%>>
228
          </td>
229
        </tr>
230
		<%If parDRdoc_title <> "" Then%>
231
        <tr>
232
          <td>&nbsp;</td>
233
          <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Document Title</td>
234
          <td nowrap background="images/bg_form_lightbluedark.gif" class="form_txt"><a href="<%=DocRepositiryLink%><%=Request("doc_num")%>" class="txt_linked" target="_blank"><%=parDRdoc_title%></a></td>
235
        </tr>
236
		<tr>
237
          <td>&nbsp;</td>
238
          <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Version</td>
239
          <td nowrap background="images/bg_form_lightbluedark.gif" class="form_txt">
240
			<%
241
			Set rsDocReg = Server.CreateObject("ADODB.Recordset")
242
			rsDocReg.ActiveConnection = DOCREP_conn
243
 
244
			rsDocReg.Source = "EXEC docregister.dbo.sp_RM_getDocumentFiles '"& Request("doc_num") &"';"
245
			rsDocReg.CursorType = 0
246
			rsDocReg.CursorLocation = 2
247
			rsDocReg.LockType = 3
248
			rsDocReg.Open()
249
 
250
			%>
251
			<select name="version_id" class="form_txt">
252
				<option value="">Always Latest</option>
253
				<%While (NOT rsDocReg.BOF) AND (NOT rsDocReg.EOF)%>
254
				<option value="<%=rsDocReg("id")%>" <%If ( parVersion_id = CStr(rsDocReg("id"))  AND  ( cIsLatest <> "Y" ) ) Then%>selected<%End If%>><%=FormatVersion(rsDocReg("version"))%></option>
255
				<%rsDocReg.MoveNext()
256
				WEnd
257
				%>
258
			</select>
259
 
260
			<%
261
			rsDocReg.Close
262
			Set rsDocReg = Nothing
263
			%>
264
		  </td>
265
        </tr>
266
		<%End If%>
267
        <tr>
268
          <td width="1%">&nbsp;</td>
269
          <td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="100" height="10"></td>
270
          <td nowrap width="100%">
271
		  <%
272
		  If retVal <> 0 Then
273
		  	  Response.write enumMSSQL_ERROR
274
		  Else
275
		  	If (parEdit = "") Then
276
			  If (Request("doc_num") <> "") AND  IsNull(parDRdoc_id) Then
277
			  	Call DisplayInfo ( "DOC_NUMBER_NOTFOUND", 350 )
278
 
279
			  ElseIf (Request("doc_num") <> "") AND  NOT IsNull(parDRdoc_id) Then
280
			  	Call DisplayInfo ( "DOC_NUMBER_FOUND", 350 )
281
 
282
			  End If
283
 
284
			End If
285
		  End If
286
		  %>
287
          </td>
288
        </tr>
289
		<input name="pv_id" type="hidden" value="<%=parPv_id%>">
290
		<input name="rtag_id" type="hidden" value="<%=parRtag_id%>">
291
		<input name="edit" type="hidden" value="<%=parEdit%>">
292
		<input name="lookup" type="hidden" value="true">
293
		<input name="action" type="hidden" value="true">
294
		</form>
295
      </table></td>
296
    </tr>
297
    <tr> 
298
      <td width="1%" height="1%" background="images/lbox_bg_blue.gif"><img src="images/h_trsp_dot.gif" width="5" height="5"></td>
299
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/lbox_bg_blue.gif"></td>
300
    </tr>
301
  </table>
302
</body>
303
</html>
304
 
305
 
306
<!-- DESTRUCTOR ------->
307
<!--#include file="common/destructor.asp"-->