Home > Domino Tips > Developer > Other > Partial hide design
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

OTHER

Partial hide design


Sirry Hboos
01.14.2004
Rating: -4.60- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


In some cases a developer needs to alter some design elements in the client's locations such as form fields, view columns, pages or any other elements, but he/she needs all the scripting to be hidden even in the forms and views.

In ND6 we have the new class (NotesNoteCollection) that is useful and powerful to navigate, control and modify all database designs and data documents.

I have also submitted Partial replace design, which has to do with the NotesNoteCollection class. I now submit this tip, which is (I believe) is very useful for developers using the same class convention.

This routine requires designer ACL level or higher to be executed.

Note that you must keep a copy of your design before executing this code. Also, after executing this routine, you may alter the design elements (forms, pages, views and folders) and save them without losing the scripting inside them, but it very important not to alter the scripting areas. Doing so may cause you lose any call for the used routine inside them.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Sirry Hboos. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Code

Here is a sample for using this call by an agent or a button.

Sub Initialize
 
 Dim s As New NotesSession
 Dim db As NotesDatabase

 Dim DocTypes(0 To 1)
 
 DocTypes(0) = "SCRIPTLIBRARIES"
 DocTypes(1) = "DATABASESCRIPT"
 
 
 Set db = s.CurrentDatabase
 
 
 If db.QueryAccess(s.UserName) < ACLLevel_Designer Then
  Msgbox "Your access level doesn't allow you to execute this action."
  Exit Sub
 End If

Call HideDesignElements(db, DocTypes)
 
End Sub
'**********************************************************

Public Sub HideDesignElements(db As NotesDatabase, DocTypes As Variant)
%REM
DocTypes are arrays of strings

This routine hides the script of doctypes design elements

%END REM
 'here are some fields witch carrying the scripting text according to the design
document Const fnScriptLib = "$ScriptLib" Const fnDBScript = "$DBScript" Const fnFormGlobalScript = "$Script" Const fnFormScript = "$$FormScript" Const fnViewGlobalScript = "$ViewGlobalScript" Const fnViewScript = "$ViewScript" Dim DesignDocs() As NotesDocument Dim fns As Variant Dim ErrMsg As String Dim x As Long, updated As Boolean For x = Lbound(DocTypes) To Ubound(DocTypes) Gosub GetScriptFields If fns(0) = "" Then Goto GetNextType If Not GetDesignDocs(db, DocTypes(x), DesignDocs(), ErrMsg) Then
Goto GetNextType updated = False Forall doc In DesignDocs Forall fn In fns If doc.HasItem(fn) Then Call doc.RemoveItem(fn) updated = True End If End Forall If updated Then Print "Updating " & doc.GetItemValue("$Title")(0) Call doc.Save(True, False) End If End Forall GetNextType: Next Exit Sub '================================================== GetScriptFields: Redim fns(0) Select Case DocTypes(x) Case "SCRIPTLIBRARIES" Redim fns(0) fns(0) = fnScriptLib Case "DATABASESCRIPT" Redim fns(0) fns(0) = fnDBScript Case "FORMS", "SUBFORMS", "PAGES" Redim fns(0 To 1) fns(0) = fnFormGlobalScript fns(1) = fnFormScript Case "VIEWS" Redim fns(0 To 1) fns(0) = fnViewGlobalScript fns(1) = fnViewScript Case "FOLDERS" Redim fns(0 To 1) fns(0) = fnViewGlobalScript fns(1) = fnViewScript Case Else 'not supported End Select Return End Sub '********************************************************** Private Function GetDesignDocs(db As NotesDatabase, Byval DesignDocType As
String, DesignDocs() As NotesDocument, ErrMsg As String) As Boolean Const LSI_THREAD_PROC = 1 Dim nc As NotesNoteCollection Dim notedoc As NotesDocument Dim nid As String Dim TypeNotFound As Boolean Dim msgNotFound As String Dim x As Long, y As Long msgNotFound = "No design documents found from type " & DesignDocType Set nc = db.CreateNoteCollection(False) Call SelectDesignTypeCollection(nc, DesignDocType, TypeNotFound) If TypeNotFound Then ErrMsg = msgNotFound Exit Function Else Call nc.BuildCollection End If nid = nc.GetFirstNoteId y = 0 Redim DesignDocs(y) For x = 1 To nc.Count Set notedoc = db.GetDocumentByID(nid) If notedoc Is Nothing Then Goto GetNextNote Redim Preserve DesignDocs(y) Set DesignDocs(y) = notedoc y = y + 1 GetNextNote: nid = nc.GetNextNoteId(nid) Next If DesignDocs(0) Is Nothing Then ErrMsg = msgNotFound Else GetDesignDocs = True End If End Function '********************************************************** Private Sub SelectDesignTypeCollection(nc As NotesNoteCollection, Byval DocType
As String, NotFound As Boolean) Select Case Ucase(DocType) Case "ACTIONS" nc.SelectActions = True Case "AGENTS" nc.SelectAgents = True Case "DATABASESCRIPT" nc.SelectDatabaseScript = True Case "DATACONNECTIONS" nc.SelectDataConnections = True Case "FOLDERS" nc.SelectFolders = True Case "FORMS" nc.SelectForms = True Case "FRAMESETS" nc.SelectFramesets = True Case "HELPABOUT" nc.SelectHelpAbout = True Case "HELPINDEX" nc.SelectHelpIndex = True Case "HELPUSING" nc.SelectHelpUsing = True Case "ICON" nc.SelectIcon = True Case "IMAGERESOURCES" nc.SelectImageResources = True Case "FORMULA" nc.SelectionFormula = True Case "JAVARESOURCES" nc.SelectJavaResources = True Case "MISCCODEELEMENTS" nc.SelectMiscCodeElements = True Case "MISCFORMATELEMENTS" nc.SelectMiscFormatElements = True Case "INDEXELEMENTS" nc.SelectMiscIndexElements = True Case "NAVIGATORS" nc.SelectNavigators = True Case "OUTLINES" nc.SelectOutlines = True Case "PAGES" nc.SelectPages = True Case "REPLICATIONFORMULAS" nc.SelectReplicationFormulas = True Case "SCRIPTLIBRARIES" nc.SelectScriptLibraries = True Case "SHAREDFIELDS" nc.SelectSharedFields = True Case "STYLESHEETRESOURCES" nc.SelectStyleSheetResources = True Case "SUBFORMS" nc.SelectSubforms = True Case "VIEWS" nc.SelectViews = True Case Else NotFound = True End Select End Sub


Do you have comments on this tip? Let us know.


Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Other
Create a dynamic user-driven navigator for a Notes/Domino application
How to apply XSL style sheets to XML views
Comparing replicas on clustered Lotus Domino servers
Creating a Lotus Notes view column categorized by month
Using the XMLHTTP object for integration with Domino or any RDBMS back end
Hiding field properties/data from DocProperties box
Export a view to Excel without coding
Prevent document deletion if there are response documents
Switching between test IDs quickly
AddParameter to a NotesXSLTransFormer

Lotus Notes Domino Database Management
LotusScript agent parses ACL to Microsoft Notepad
Domino Domain Monitoring hints and gotchas
LotusScript code rebuilds corrupted busytime.nsf file
LotusScript agent automates selective mail file replication
Configuring Domino Domain Monitoring (DDM)
How to move Notes databases off Domino 8 servers and save disk space
What is Notes 8.5's DAOS (Domino Attachment and Object Storage) feature?
LotusScript agent indexes Lotus Notes/Domino databases
An introduction to Domino Domain Monitoring (DDM)
'Customize this view' options are disabled in Lotus Notes databases

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts