home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / ProPlus.WW / ProPsWW2.cab / PUBLICFUNCTIONS.JS5 < prev    next >
Text File  |  2007-02-04  |  10KB  |  317 lines

  1. // ****************************************************************************
  2. // Name: PublicFunctions.js
  3. //
  4. // Description: functions available to Form and Macro scripts in the Forms Tool.
  5. //
  6. // Comments:
  7. // All functions contained can be called by custom form or macro scripts.
  8. // Contents may be changed in future versions.  
  9. // Please don't modify this file, as modifications may be overwritten.
  10. //
  11. // Copyright ⌐2006 Microsoft Corporation,  All Rights Reserved.
  12. // ****************************************************************************
  13.  
  14. // Globals used by various methods
  15. var GrooveMessageBoxIcon_None = 0x0000;
  16. var GrooveMessageBoxIcon_Exclamation = 0x0080;
  17. var GrooveMessageBoxIcon_Warning = 0x0081;
  18. var GrooveMessageBoxIcon_Information = 0x0100;
  19. var GrooveMessageBoxIcon_Asterisk = 0x0101;
  20. var GrooveMessageBoxIcon_Question = 0x0081;
  21. var GrooveMessageBoxIcon_Stop = 0x0400;
  22. var GrooveMessageBoxIcon_Error = 0x0401;
  23. var GrooveMessageBoxIcon_Hand = 0x0402;
  24.  
  25. var GrooveDialogBoxResultCode_OK = 1;
  26. var GrooveDialogBoxResultCode_Cancel = 2;
  27.  
  28. var GrooveFormsToolRole_Guest = 0x01;
  29. var GrooveFormsToolRole_Participant = 0x02;
  30. var GrooveFormsToolRole_Manager = 0x04;
  31.  
  32. var GrooveIntlDateFormatStyle_Full = 0;
  33. var GrooveIntlDateFormatStyle_Long = 1;
  34. var GrooveIntlDateFormatStyle_Medium = 2;
  35. var GrooveIntlDateFormatStyle_Short = 3;
  36. var GrooveIntlDateFormatStyle_Default = GrooveIntlDateFormatStyle_Medium;
  37.  
  38. var GrooveFormsToolLinkType_None = 0;
  39. var GrooveFormsToolLinkType_Record = 1;
  40. var GrooveFormsToolLinkType_View = 2;
  41. var GrooveFormsToolLinkType_Tool = 3;
  42.  
  43.  
  44. // This function returns the App object. The App object implements various
  45. // functions as defined by the IGrooveFormsToolUIDelegate interface. This
  46. // object provides functions and properties which are useful when building
  47. // applications which need to interact with the Groove platform.
  48. function GetApp()
  49. {
  50.     return int_GetApp();
  51. }
  52.  
  53. // This function returns an IGrooveBSTREnum which can be used as a parameter
  54. // in several calls on the application.
  55. function CreateBSTREnumFromArray(i_StringArray)
  56. {
  57.     return int_CreateBSTREnumFromArray(i_StringArray);
  58. }
  59.  
  60. // This function will dynamically set the text of a field label on a form.
  61. function SetFieldLabel(i_FieldName, i_Label)
  62. {
  63.     int_SetFieldLabel(i_FieldName, i_Label);
  64. }
  65.  
  66. // This function will dynamically show a field and its label on a form.
  67. // i_bShow is an optional argument and will default to true.
  68. function ShowField(i_FieldName, i_bShow)
  69. {
  70.     if (typeof i_bShow == "undefined")
  71.         i_bShow = true;
  72.  
  73.     int_HideField(i_FieldName, !i_bShow);
  74. }
  75.  
  76. // This function will dynamically hide a field and its label on a form.
  77. // i_bHide is an optional argument and will default to true.
  78. function HideField(i_FieldName, i_bHide)
  79. {
  80.     if (typeof i_bHide == "undefined")
  81.         i_bHide = true;
  82.  
  83.     int_HideField(i_FieldName, i_bHide);
  84. }
  85.  
  86. // This function will dynamically enable a field on a form.
  87. // i_bEnable is an optional argument and will default to true.
  88. function EnableField(i_FieldName, i_bEnable)
  89. {
  90.     if (typeof i_bEnable == "undefined")
  91.         i_bEnable = true;
  92.  
  93.     int_DisableField(i_FieldName, !i_bEnable);
  94. }
  95.  
  96. // This function will dynamically disable a field on a form.
  97. // i_bDisable is an optional argument and will default to true.
  98. function DisableField(i_FieldName, i_bDisable)
  99. {
  100.     if (typeof i_bDisable == "undefined")
  101.         i_bDisable = true;
  102.  
  103.     int_DisableField(i_FieldName, i_bDisable);
  104. }
  105.  
  106. // This function will refresh all visible error icons on the page. This should
  107. // be used if there is any code that dynamically changes the layout of the page
  108. // and there are fields on the form that have any validation (i.e. "Required",
  109. // "Min/Max", or text validation). Calling this will make sure that all of the
  110. // error icons display in the proper location.
  111. function RefreshErrorIcons()
  112. {
  113.     int_RefreshErrorIcons();
  114. }
  115.  
  116. // This function will refresh the contents of the preview pane from the record.
  117. function RefreshPreviewPane()
  118. {
  119.     int_RefreshPreviewPane();
  120. }
  121.  
  122.  
  123. // Returns true if record is new, false otherwise.
  124. function GetIsNew()
  125. {
  126.     return int_GetIsNew();
  127. }
  128.  
  129. // Returns true if form opened in search dialog; false otherwise.
  130. function GetIsSearch()
  131. {
  132.     return int_GetIsSearch();
  133. }
  134.  
  135. // Returns true if form open in preview layout; false otherwise.
  136. function GetIsFormPreview()
  137. {
  138.     return int_GetIsFormPreview();
  139. }
  140.  
  141. // Returns true if form opened in preview pane; false otherwise.
  142. function GetIsPreviewPane()
  143. {
  144.     return int_GetIsPreviewPane();
  145. }
  146.  
  147. // Returns true if record is read-only; false otherwise.
  148. function GetIsReadOnly()
  149. {
  150.     return int_GetIsReadOnly();
  151. }
  152.  
  153. // Returns true is record is a response; false otherwise.
  154. function GetIsResponse()
  155. {
  156.     return int_GetIsResponse();
  157. }
  158.  
  159. // Returns true if record is versioned; false otherwise.
  160. function GetIsVersioned()
  161. {
  162.     return int_GetIsVersioned();
  163. }
  164.  
  165. // Returns the ID of the current record.
  166. function GetRecordID()
  167. {
  168.     return int_GetRecordID();
  169. }
  170.  
  171. // Returns the ID of the current form.
  172. function GetFormID()
  173. {
  174.     return int_GetFormID();
  175. }
  176.  
  177. // Returns the ID of the record that was selected when a new record is created.
  178. function GetSelectedID()
  179. {
  180.     return int_GetSelectedID();
  181. }
  182.  
  183. // Return the current record as an IGrooveFormsToolFormRecord.
  184. function GetFormRecord()
  185. {
  186.     return int_GetFormRecord();
  187. }
  188.  
  189.  
  190. // This function will open the current record for edit (if allowed) in
  191. // full-screen mode if it is currently being viewed in the preview pane.
  192. function OpenThisRecord()
  193. {
  194.     int_OpenThisRecord();
  195. }
  196.  
  197. // This function will return the current value of any HTML field as a
  198. // string. It will not work on Rich Text or Attachments fields.
  199. function GetHTMLFieldValue(i_FieldName)
  200. {
  201.     return int_GetHTMLFieldValue(i_FieldName);
  202. }
  203.  
  204. // This function will return the current value of any numeric field as
  205. // a number. The only field types it will work with is Number, Unformatted
  206. // Number, and Currency.
  207. function GetHTMLFieldValueAsNumber(i_FieldName)
  208. {
  209.     return int_GetHTMLFieldValueAsNumber(i_FieldName);
  210. }
  211.  
  212. // This function will return the current value of any Date or Date/Time
  213. // field as a number in millseconds. This can be used to create a new
  214. // JavaScript date object to get more in depth information.
  215. function GetHTMLFieldValueAsDate(i_FieldName)
  216. {
  217.     return int_GetHTMLFieldValueAsDate(i_FieldName);
  218. }
  219.  
  220. // This function will set the current value of any HTML field as a string.
  221. // It will not work on Rich Text or Attachments fields.
  222. function SetHTMLFieldValue(i_FieldName, i_Value)
  223. {
  224.     int_SetHTMLFieldValue(i_FieldName, i_Value);
  225. }
  226.  
  227. // This function will set the current value of any numeric field as a
  228. // number. The only field types it will work with is Number, Unformatted
  229. // Number, and Currency.
  230. function SetHTMLFieldValueAsNumber(i_FieldName, i_Value)
  231. {
  232.     int_SetHTMLFieldValueAsNumber(i_FieldName, i_Value);
  233. }
  234.  
  235. // This function will set the current value of any Date or Date/Time field.
  236. // The value passed in should be a number representing the number of milliseconds
  237. // past the date 1/1/1970 00:00.
  238. function SetHTMLFieldValueAsDate(i_FieldName, i_Value)
  239. {
  240.     int_SetHTMLFieldValueAsDate(i_FieldName, i_Value);
  241. }
  242.  
  243. // This is a utility function to check for the existence of any function that
  244. // a script writer might want to call. It is a good idea to make this call for
  245. // any methods defined after this one for backwards compatibility. Pass in the
  246. // name of the method you want to check, as a string.
  247. function DoesFunctionExist(i_FunctionName)
  248. {
  249.     return int_DoesFunctionExist(i_FunctionName);
  250. }
  251.  
  252. // This function will take an enum, usually returned from a lookup, and insert
  253. // the values into a drop-down list or list box field. The third argument,
  254. // i_bAllowDuplicates, is optional, and is false by default. You must call
  255. // DoesFunctionExist before using this method as it was added in 3.0f.
  256. function InsertBSTREnumIntoListField(i_BSTREnum, i_FieldName, i_bAllowDuplicates)
  257. {
  258.     int_InsertBSTREnumIntoListField(i_BSTREnum, i_FieldName, i_bAllowDuplicates);
  259. }
  260.  
  261. // This function will determine if a date's value, in milliseconds, is valid.
  262. function IsValidDate(i_Value)
  263. {
  264.     return int_IsValidDate(i_Value);
  265. }
  266.  
  267. // This function creates a unique ID.  The ID returned is the same type of ID
  268. // generated when using a field whose initial value is set to be 'Unique' in the
  269. // Forms Designer.
  270. function CreateUniqueID()
  271. {
  272.     return int_getUniqueID();
  273. }
  274.  
  275. // This functions should be used after calling GetApp().SaveCurrentFormData()
  276. // to determine if there were validation errors that the user must fix.
  277. function HasValidationErrors()
  278. {
  279.     return int_HasValidationErrors();
  280. }
  281.  
  282. // This function will set the current value of any contact field on the form.
  283. // The contact is set to empty if the i_Contact value passed in is null.
  284. function SetContactFieldValue(i_FieldName, i_Contact)
  285. {
  286.     int_SetContactFieldValue(i_FieldName, i_Contact);
  287. }
  288.  
  289. // This function will return the current value of any contact field on the form.
  290. // If the contact field is empty, it will return null.
  291. function GetContactFieldValue(i_FieldName)
  292. {
  293.     return int_GetContactFieldValue(i_FieldName);
  294. }
  295.  
  296. // This function will return the number of attachments in the attachments field on the form.
  297. // If there is no attachments field on the form, it will return null.
  298. function GetAttachmentCount()
  299. {
  300.     return int_GetAttachmentCount();
  301. }
  302.  
  303. // This function will bring up the 'Add Attachments' dialog.
  304. // If there is no attachments field on the form, the dialog will fail to load
  305. function LoadAddAttachmentDialog()
  306. {
  307.     int_LoadAddAttachmentDialog();
  308. }
  309.  
  310. // This function will return an IGrooveNameValueEnum containing the names and sizes
  311. // of attached files in the attachment field on the form.
  312. // If there is no attachments field on the form, it will return null.
  313. function CreateAttachmentsNameSizeEnum()
  314. {
  315.     return int_CreateAttachmentsNameSizeEnum();
  316. }
  317.