home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / CHIPCD_3_98.iso / software / testsoft / exchange / webdata / usa / movcpy / root.asp < prev   
Text File  |  1997-08-25  |  9KB  |  252 lines

  1. <!--#include file="../constant.inc"-->
  2. <!--#include file="../lib/session.inc"-->
  3. <!--#include file="../lib/getrend.inc"-->
  4. <!--#include file="../lib/jsutil.inc"-->
  5. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
  6. <HTML>
  7. <HEAD>
  8. <TITLE><%=L_MoveCopy_StaticText%></TITLE>
  9. <%
  10. '<!-- Microsoft Outlook Web Access-->
  11. '<!-- Root.asp : movecopy dialog -->
  12. '<!-- Copyright (c) Microsoft Corporation 1993-1997. All rights reserved.-->
  13. '------------------------------------------------------------------
  14. Public Function HasFolderPermissions(objFolder)
  15.     HasFolderPermissions = True
  16.     bSrcCanMove=0
  17.     bSrcCanCopy=0
  18.     nAccess=0
  19.  
  20.     nAccess = objFolder.Fields.Item(ActMsgPR_ACCESS) 
  21.     bSrcCanMove = nAccess And MAPI_ACCESS_DELETE
  22.     bSrcCanCopy = nAccess And MAPI_ACCESS_READ
  23.  
  24.     If bSrcCanMove=0 And bSrcCanCopy=0 Then
  25.         HasFolderPermissions=False
  26.     End If
  27. End Function
  28. '--------------------------------------------------------------------
  29. Public Sub InitThePage(nType)
  30.     On Error Resume Next
  31.     idestStore=nType    
  32.  
  33.     If nType = PRIVATE_AUTHENTICATED Then
  34.         OpenPrivateStore
  35.         If bstrDestFolderID="" Then
  36.             bstrDestFolderID=bstrPrivateRootID
  37.         End If
  38.         Set objFolder = OpenFolder(bstrDestFolderID)
  39.         If objFolder Is Nothing Then
  40.             ReportErro1 L_errFailOpenFolder_ErrorMessage 
  41.         End If
  42.     ElseIf nType = PUBLIC_AUTHENTICATED Then
  43.         OpenPublicStore
  44.         If bstrDestFolderID="" Then
  45.             bstrDestFolderID=bstrPublicRootID 
  46.         End If
  47.         Set objFolder = OpenFolder(bstrDestFolderID)
  48.         If objFolder Is Nothing Then
  49.             ReportError1 L_errFailGetPubFolder_ErrorMessage
  50.         End If
  51.     End If
  52.     If objFolder.Messages Is Nothing Then
  53.        ReportError1 L_errFolderNotReplicated_ErrorMessage
  54.     Else
  55.        If nType=PUBLIC_AUTHENTICATED Then
  56.            Set objRenderer = GetPublicHierarchyRenderer(fNew)
  57.        Else
  58.            Set objRenderer = GetPrivateHierarchyRenderer(fNew)
  59.        End If
  60.        Set objFolders = objFolder.Folders
  61.        objRenderer.DataSource = objFolders
  62.     End If
  63. End Sub
  64. '--------------------------------------------------------------------
  65. Public Sub GetQueries()
  66.     iProcess=CInt(Request.QueryString("process"))
  67.     bstrStore=Request.QueryString("store")
  68.     bstrSrcFolderID = Request.QueryString("folderid")
  69.     bstrDestFolderID=Request.QueryString("obj")
  70.     
  71.     Set objSrcFolder=Session(CURRENT_FOLDER)    
  72.  
  73.     If bstrStore<>"" Then
  74.         idestStore=CInt(bstrStore)
  75.     Else                                    'Called for the first time
  76.         idestStore=PRIVATE_AUTHENTICATED
  77.     End If
  78.     
  79.     InitThePage idestStore
  80.  
  81.     If iProcess="1" Then 'move/copy message 
  82.         bstrSrcMsgID = Request.QueryString("msgid")
  83.     Else 'folder move/copy
  84.         If IsSpecialFolder(bstrSrcFolderID) Then
  85.             ReportErrorClose L_errFailMoveFolder_ErrorMessage
  86.         End If
  87.     End If
  88. End Sub
  89. '-------------------------------------
  90. Public Function IsSpecialFolder(szObj)
  91.     IsSpecialFolder = False
  92.  
  93.     Set objStore = Session(bstrObjPrivateStore)
  94.     If Not objStore Is Nothing Then
  95.         If (szObj = objOMSession.Inbox.ID) Or _
  96.             (szObj = objStore.Fields.Item(ActMsgPR_IPM_OUTBOX_ENTRYID).Value) Or _
  97.             (szObj = objStore.Fields.Item(ActMsgPR_IPM_WASTEBASKET_ENTRYID).Value) Or _
  98.             (szObj = objStore.Fields.Item(ActMsgPR_IPM_SENTMAIL_ENTRYID).Value) Or _
  99.             (szObj = objStore.Fields.Item(ActMsgPR_IPM_SUBTREE_ENTRYID).Value) Then
  100.             IsSpecialFolder = True
  101.          End If
  102.     End If
  103. End Function
  104. '-------------------------------------
  105. Public Function getRootID(nType)
  106.     
  107.     Dim objInfoStore
  108.  
  109.     If nType=PRIVATE_AUTHENTICATED Then
  110.         szPrivateID = objOMSession.Inbox.StoreID
  111.         Set objInfoStore = objOMSession.GetInfoStore(szPrivateID)
  112.         getRootID = objInfoStore.RootFolder.ID
  113.     Else
  114.  
  115.         Set objStores = objOMSession.InfoStores
  116.     
  117.         If (Err.Number <> 0) Then
  118.             ReportError1 L_errFailGetStores_ErrorMessage
  119.         Else
  120.             For i = 1 To objStores.Count
  121.                 Set objInfoStore = objStores.Item(i)
  122.                 lMask = objInfoStore.Fields.Item(ActMsgPR_STORE_SUPPORT_MASK)
  123.                 Err.Clear
  124.                 
  125.                 If lMask And ActMsgSTORE_PUBLIC_FOLDERS Then            ' STORE_PUBLIC_FOLDERS
  126.                     getRootID=objInfoStore.Fields.Item(ActMsgPR_IPM_PUBLIC_FOLDERS_ENTRYID).Value
  127.                 End If
  128.             Next
  129.         End If
  130.     End If 
  131. End Function
  132. '--------------------------------------------------------------------
  133. 'Main routine
  134. '----------------------------------------------------------------------
  135. On Error Resume Next
  136.  
  137. CheckSession2 bstrVirtRoot+"/movcpy/root.asp"
  138.  
  139. Dim objFolder             'Destination Folder
  140. Dim objSrcFolder        'Source Folder
  141. Dim objRenderer            'Renderer
  142. Dim iProcess            'Move or Copy
  143. Dim bstrSrcFolderID        'Source folder ID
  144. Dim bstrSrcMsgID        'Source message ID
  145. Dim idestStore            'Destination store (public or private)
  146. Dim bstrDestFolderID    'Destination folder ID
  147. Dim bstrPrivateRootID    'Private Root Folder ID
  148. Dim bstrPublicRootID    'Public Root Folder ID
  149.  
  150.  
  151. bstrPrivateRootID=getRootID(PRIVATE_AUTHENTICATED)
  152. bstrPublicRootID=getRootID(PUBLIC_AUTHENTICATED)
  153.  
  154. GetQueries
  155. '--------------------------------------------------------------------------
  156. %>
  157. <script language=javascript>
  158. //"override" the function in jsroot.inc to redirect 
  159. function SetNewFolderPick(folderID) {
  160.     self.location="root.asp?store=<%=idestStore%>&process=<%=iProcess%>&folderid=<%=bstrSrcFolderID%>&msgid=<%=bstrSrcMsgID%>&obj="+folderID;
  161. }
  162. //populate the hidden form value depending on button clicked
  163. function submitMe(item,process) {
  164.     self.document.mainForm.process.value=process;
  165.     self.document.mainForm.item.value=item;
  166.     self.document.mainForm.submit();
  167. }
  168. function changeStore(store) {
  169.     var rootID=""
  170.     if (store==0) rootID="<%=bstrPrivateRootID%>";
  171.     else rootID="<%=bstrPublicRootID%>";
  172.     self.location="root.asp?store="+store+ "&process=<%=iProcess%>&folderid=<%=bstrSrcFolderID%>&msgid=<%=bstrSrcMsgID%>&obj="+rootID;
  173. }
  174. </script>
  175. </head>
  176. <%If HasFolderPermissions(objSrcFolder)=true Then%>
  177.  
  178. <BODY bgcolor=#c0c0c0 text=000000 link=000000 vlink=000000 alink=000000 leftmargin=1 topmargin=0 <% If fDeleted = True Then %>onLoad="RedirectToRoot()"<% End If %>>
  179. <form name="mainForm" action="commands.asp" METHOD="POST">
  180. <table width=100%>
  181. <tr>
  182. <td>
  183. <img src="<%=bstrVirtRoot%>/images/divider.gif" width=4 height=24 align="middle">
  184.  
  185. <a href="javascript:changeStore(1);"><img src="<%=bstrVirtRoot%>/images/pubfoldr.gif" width=24 alt='Public Folders' height=24 align=middle border=0></a>
  186.  
  187. <img src="<%=bstrVirtRoot%>/images/divider.gif" width=4 height=24 align="middle">
  188.  
  189. <a href="javascript:changeStore(0);"><img src="<%=bstrVirtRoot%>/images/prvfoldr.gif" alt='Private Folders' border=0 align=middle width=24 height=24></a>
  190.  
  191. <img src="<%=bstrVirtRoot%>/images/divider.gif" width=4 height=24 align="middle">
  192.  
  193. <A href="JAVASCRIPT:openNewWindow('<%=bstrVirtRoot%>/help/readmsg.htm','inlineHelpWindow',600,400)"><IMG SRC="<%=bstrVirtRoot%>/images/help.gif" alt="<%=L_Help_ToolTip%>" align="middle" border=0 height=20 width=20></a>
  194.  
  195. <img src="<%=bstrVirtRoot%>/images/divider.gif" width=4 height=24 align="middle">
  196. </td>
  197.  
  198. <td align=right>
  199. <input type="button" value="Close" onClick="self.close();">
  200. </td>
  201.  
  202. </tr>
  203.  
  204. <tr>
  205. <td valign=bottom>Folders:
  206. </td>
  207. </tr>
  208.  
  209. <tr>
  210.  
  211. <td width=75% valign=top bgcolor=#ffffff>
  212. <%    err.clear
  213.     objRenderer.Render AMHTML_FolderHierarchy, 0, 0, Response
  214. %>
  215. </td>
  216. <td align=right valign=top>
  217. <%If iProcess=1 Then 'Message%>
  218.     <input type="button" value="Move" onClick="submitMe('message','move');"><br><br>
  219.     <input type="button" value="Copy" onClick="submitMe('message','copy');"><br><br>
  220. <%Else  'Folder%>
  221.     <input type="button" value="Move" onClick="submitMe('folder','move');"><br><br>
  222.     <input type="button" value="Copy" onClick="submitMe('folder','copy');"><br><br>
  223. <%End If%>
  224. </td>
  225. </tr>
  226. </table>
  227.  
  228. <input type="hidden" name="process" value="">
  229. <input type="hidden" name="item" value="">
  230. <input type="hidden" name="srcfolder" value="<%=bstrSrcFolderID%>">
  231. <input type="hidden" name="destfolder" value="<%=bstrDestFolderID%>">
  232. <input type="hidden" name="srcmsg" value="<%=bstrSrcMsgID%>">
  233. </form>
  234. </body>
  235. </html>
  236.  
  237. <%Else  'No permissions to move%>
  238. <body bgcolor=ffffff text=000000>
  239. <br><br>
  240. <font size=3><center><h3 align=center>Insufficient Access Permission</h3>
  241. <blockquote>
  242. <p>You don't have the necessary permissions to Move or Copy this item.
  243. Please contact your Exchange Administrator if you feel this is incorrect.
  244. </blockquote>
  245. <br><footnote>
  246. <a href="Javascript:self.close();">Close</a> 
  247. </footnote>
  248. </center>
  249. </body>
  250. </html>
  251. <% End If %>
  252.