Subversion Repositories DevTools

Rev

Rev 5357 | Rev 5590 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5357 dpurdie 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
   objEH.TryORA ( OraSession )
62
   On Error Resume Next
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
   If Err.Number = 0 Then
70
      OraDatabase.ExecuteSQL _
71
         " INSERT INTO package_documents ( pv_id, doc_id, doc_num, is_latest  )"&_
72
         " VALUES ( "& nPv_id &", "& doc_id &", '"& SQLstring ( Request("doc_num") ) &"', "& is_latest &" )"
73
   End If
74
 
75
   objEH.CatchORA ( OraSession )
76
 
77
   If objEH.LastOraFailed = FALSE Then
78
      '/* Log Action */
79
      Call Log_Action ( nPv_id, "document_add", "Document number: "& Request("doc_num") &", Version: "& sDocVersion )
80
   End If
81
 
82
End Sub
83
'-------------------------------------------------------------------------------------------------------------------------------
84
Sub UpdatePackageDocument ( nPvId, nDocId, nVersionId )
85
 
86
   Dim cIsLatest, sDocVersion
87
 
88
   cIsLatest = "Y"
89
   sDocVersion = "Always Latest"
90
 
91
   If ( nVersionId <> "" ) Then
92
      Call Short_Document_Details ( nVersionId, NULL, sDocVersion, NULL  )
93
      cIsLatest = NULL
94
   Else
95
      nVersionId = nDocId
96
   End If
97
 
98
   OraDatabase.Parameters.Add "PV_ID", nPvId,    ORAPARM_INPUT, ORATYPE_NUMBER
99
   OraDatabase.Parameters.Add "DOC_ID", nVersionId,    ORAPARM_INPUT, ORATYPE_NUMBER
100
   OraDatabase.Parameters.Add "DOC_NUM", parDoc_Num,    ORAPARM_INPUT, ORATYPE_VARCHAR2
101
   OraDatabase.Parameters.Add "IS_LATEST", cIsLatest,    ORAPARM_INPUT, ORATYPE_VARCHAR2
102
 
103
   objEH.TryORA ( OraSession )
104
   On Error Resume Next
105
 
106
   OraDatabase.ExecuteSQL _
107
      " UPDATE PACKAGE_DOCUMENTS pd SET "&_
108
      "    pd.doc_id = :DOC_ID, "&_
109
      "    pd.doc_num = :DOC_NUM, "&_
110
      "    pd.IS_LATEST = :IS_LATEST"&_
111
      " WHERE pd.PV_ID = :PV_ID "&_
112
      "   AND UPPER( pd.DOC_NUM ) = UPPER( :DOC_NUM ) "
113
 
114
   objEH.CatchORA ( OraSession )
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
   If objEH.LastOraFailed = FALSE Then
122
      '/* Log Action */
123
      Call Log_Action ( nPvId, "document_update", "Document number: "& Request("doc_num") &", Version: "& sDocVersion )
124
   End If
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
<link rel="shortcut icon" href="<%=FavIcon%>"/>
190
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
191
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
192
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
193
<link rel="stylesheet" href="images/navigation.css" type="text/css">
194
<script language="JavaScript" src="images/common.js"></script>
195
</head>
196
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();FormName.doc_num.focus();">
197
   <table width="100%" border="0" cellspacing="0" cellpadding="2" height="100%">
198
   <form name="FormName" method="get" action="<%=scriptName%>">
199
      <tr>
200
         <td background="images/lbox_bg_blue.gif" width="1%" height="1%">&nbsp;</td>
201
         <td background="images/lbox_bg_blue.gif" nowrap width="50%" class="wform_ttl">&nbsp;</td>
202
         <td background="images/lbox_bg_blue.gif" align="right" width="50%">
203
            <%If parEdit = "" Then%>
204
               <input tabindex="10" type="submit" name="btn" value="Import" class="form_btn_comp" <%If (parDRdoc_id = "") OR IsNull(parDRdoc_id) Then%>disabled<%End If%>>
205
            <%Else%>
206
               <input tabindex="10" type="submit" name="btn" value="Update" class="form_btn_comp">
207
            <%End If%>
208
            <input type="reset" name="btn" value="Close" class="form_btn_comp" onclick="self.close()">
209
         </td>
210
         <td background="images/lbox_bg_blue.gif" align="right" width="1%" nowrap>
211
         <img src="images/h_trsp_dot.gif" width="5" height="22"> </td>
212
      </tr>
213
      <tr>
214
         <td height="100%" width="1%">&nbsp;</td>
215
         <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
216
            <table width="100%" border="0" cellspacing="1" cellpadding="2">
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
                        End If
284
                     End If
285
                     %>
286
                  </td>
287
               </tr>
288
               <input name="pv_id" type="hidden" value="<%=parPv_id%>">
289
               <input name="rtag_id" type="hidden" value="<%=parRtag_id%>">
290
               <input name="edit" type="hidden" value="<%=parEdit%>">
291
               <input name="lookup" type="hidden" value="true">
292
               <input name="action" type="hidden" value="true">
293
            </form>
294
            </table>
295
         </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"-->