Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
Option explicit
129 ghuddy 4
Response.Expires = 0   ' always load the page, dont store
119 ghuddy 5
%>
6
<%
7
'=====================================================
129 ghuddy 8
'               Import Docs
119 ghuddy 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")
129 ghuddy 39
parEdit = Request("edit")
119 ghuddy 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 )
129 ghuddy 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
 
119 ghuddy 82
End Sub
83
'-------------------------------------------------------------------------------------------------------------------------------
84
Sub UpdatePackageDocument ( nPvId, nDocId, nVersionId )
129 ghuddy 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
 
119 ghuddy 126
End Sub
127
'-------------------------------------------------------------------------------------------------------------------------------
128
Sub GetPackageDocument ( nPvId, nDocId, outcIsLatest )
129 ghuddy 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
 
119 ghuddy 155
End Sub
156
'-------------------------------------------------------------------------------------------------------------------------------
157
%>
158
<%
159
'Process submition
160
If CBool(Request("action"))  AND  objAccessControl.UserLogedIn  Then
129 ghuddy 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
 
119 ghuddy 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();">
129 ghuddy 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
               <tr>
217
                  <td width="1%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
218
                  <td width="1%" nowrap class="form_group" valign="bottom"></td>
219
                  <td nowrap width="100%">&nbsp; </td>
220
               </tr>
221
               <tr>
222
                  <td>&nbsp;</td>
223
                  <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Document Number </td>
224
                  <td nowrap background="images/bg_form_lightbluedark.gif" class="form_txt">
225
                     <input name="doc_num" type="text" class="form_item" value="<%=Request("doc_num")%>" size="20" maxlength="50" <%If parEdit <> "" Then%>readonly<%End If%>>
226
                     <input tabindex="1" name="btn" type="submit" class="form_btn_comp" value="Lookup" <%If parEdit <> "" Then%>disabled<%End If%>>
227
                  </td>
228
               </tr>
229
               <%If parDRdoc_title <> "" Then%>
230
                  <tr>
231
                     <td>&nbsp;</td>
232
                     <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Document Title</td>
233
                     <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>
234
                  </tr>
235
                  <tr>
236
                     <td>&nbsp;</td>
237
                     <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Version</td>
238
                     <td nowrap background="images/bg_form_lightbluedark.gif" class="form_txt">
239
                        <%
240
                        Set rsDocReg = Server.CreateObject("ADODB.Recordset")
241
                        rsDocReg.ActiveConnection = DOCREP_conn
242
 
243
                        rsDocReg.Source = "EXEC docregister.dbo.sp_RM_getDocumentFiles '"& Request("doc_num") &"';"
244
                        rsDocReg.CursorType = 0
245
                        rsDocReg.CursorLocation = 2
246
                        rsDocReg.LockType = 3
247
                        rsDocReg.Open()
248
 
249
                        %>
250
                        <select name="version_id" class="form_txt">
251
                           <option value="">Always Latest</option>
252
                           <%While (NOT rsDocReg.BOF) AND (NOT rsDocReg.EOF)%>
253
                           <option value="<%=rsDocReg("id")%>" <%If ( parVersion_id = CStr(rsDocReg("id"))  AND  ( cIsLatest <> "Y" ) ) Then%>selected<%End If%>><%=FormatVersion(rsDocReg("version"))%></option>
254
                           <%rsDocReg.MoveNext()
255
                           WEnd
256
                           %>
257
                        </select>
258
 
259
                        <%
260
                        rsDocReg.Close
261
                        Set rsDocReg = Nothing
262
                        %>
263
                     </td>
264
                  </tr>
265
               <%End If%>
266
               <tr>
267
                  <td width="1%">&nbsp;</td>
268
                  <td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="100" height="10"></td>
269
                  <td nowrap width="100%">
270
                     <%
271
                     If retVal <> 0 Then
272
                           Response.write enumMSSQL_ERROR
273
                     Else
274
                        If (parEdit = "") Then
275
                           If (Request("doc_num") <> "") AND  IsNull(parDRdoc_id) Then
276
                              Call DisplayInfo ( "DOC_NUMBER_NOTFOUND", 350 )
277
 
278
                           ElseIf (Request("doc_num") <> "") AND  NOT IsNull(parDRdoc_id) Then
279
                              Call DisplayInfo ( "DOC_NUMBER_FOUND", 350 )
280
 
281
                           End If
282
                        End If
283
                     End If
284
                     %>
285
                  </td>
286
               </tr>
287
               <input name="pv_id" type="hidden" value="<%=parPv_id%>">
288
               <input name="rtag_id" type="hidden" value="<%=parRtag_id%>">
289
               <input name="edit" type="hidden" value="<%=parEdit%>">
290
               <input name="lookup" type="hidden" value="true">
291
               <input name="action" type="hidden" value="true">
292
            </form>
293
            </table>
294
         </td>
295
      </tr>
296
      <tr>
297
         <td width="1%" height="1%" background="images/lbox_bg_blue.gif"><img src="images/h_trsp_dot.gif" width="5" height="5"></td>
298
         <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/lbox_bg_blue.gif"></td>
299
      </tr>
300
   </table>
119 ghuddy 301
</body>
302
</html>
303
 
304
 
305
<!-- DESTRUCTOR ------->
129 ghuddy 306
<!--#include file="common/destructor.asp"-->