Submitted byCategory
Review Cycle
.
Public
Joachim Mutter/sysarc
on 12/02/2008 at 11:45 AM
Notes

Notes Toolbar action collection

A while ago I found some code in the web, which shows a real cool method of bringing some
usefull actions together in one dialog, callable from a toolbar button. I've enhanced that stuff
and rebuild it, that it fits my needs, so here is the stuff (and many thanks to the unknown person
who first had this idea, if anyone know him, I will notice that here)


Option := @Prompt( [OkCancelList] ; "Select Option" ; "What would you like to do:" ;
"Change Field Content";
"Show ReplicaID" :
"Change Field Content":
"RemoveField" :
"Add Field" :
"Undo Replication Conflict" :
"Unlock Document" :
"Refresh Selected Documents" :
"Link Message" :
"Get Notes ID" :
"Get UNID" :
"Get Parent UNID" :
"Open Parent Doc" :
"Delete UIDoc" :
"Show Authors") ;

@If( Option = "Refresh Selected Documents" ; @Command([ToolsRefreshSelectedDocs]);
Option = "Undo Replication Conflict" ; @Do( @SetField("$REF" ; @DeleteField ) : @SetField( "$Conflict" ; @DeleteField ) ) ;
Option = "Link Message" ; @Do ( @Command([Compose]; @MailDbName; "Bookmark") ) ;
Option = "Link Doc"; @Do (@Command([EditMakeDocLink]) );
Option = "Get Parent UNID" ; @Do ( @Prompt([OkCancelEdit]; "Parent UNID"; "Parent Unique ID"; @Text($REF)) ) ;
Option = "Get UNID" ; @Do ( @Prompt([OkCancelEdit]; "UNID"; "Unique ID"; @Text(@DocumentUniqueID)) ) ;
Option = "Get Notes ID" ; @Do ( @Prompt([OkCancelEdit]; "NoteID"; "NoteID"; @Text(@NoteID)) ) ;
Option = "Show ReplicaID"; @Do( @Prompt([OkCancelEdit]; "ReplicaID"; "ReplicaID"; @Text(@ReplicaID)));
Option = "Show Authors" ; @Do ( @Prompt( [OkCancelList] ; "Authors of this document" ; "Authors of this document:" ; "" ; @Author ) ) ;
Option = "Open Parent Doc"; @Do( @Command( [OpenDocument] ; @False ; @Text($REF)) );
Option = "Delete UIDoc" ; @Do (
@If(@Prompt([Ok]; "Delete UI Document"; "Are you shure to remove the current document?") = 1;
@Do(
@Command([FileCloseWindow]);
@Command([EditClear])
);
@True
)
) ;
Option = "RemoveField";@Do(@Set("List"; @DocFields);
@Set("RemoveField"; @Prompt( [OkCancelList] ; "Select a field to remove" ; "Select the field you wish to remove:" ; "" ; List ));
@SetField(RemoveField; @DeleteField)
);
Option = "Change Field Content" | Option = "Add Field"; @Do(
@If(option="Add Field"; @Set("List"; @Prompt([OkCancelEdit]; "New Fieldname"; "Please type in the Fieldname"; "")); @Set("List"; @DocFields));
@Set("DataTypes"; "Text" : "Date" : "Integer" : "Name" : "Common Name" : "Remove Field" : "Text Multi Value" : "Date Multi Value" : "Integer Multi Value" : "Name Multi Value" : "Common Name Multi Value":"Free Name Multi Value");
@If(option="Add Field"; @Set("EditField"; List); @Set("EditField"; @Prompt( [OkCancelList] ; "Select a field to alter" ; "Select the field you wish to alter:" ; "CustomerReply" ; List )));
@Set("DataType"; @Prompt( [OkCancelList] : [NoSort] ; "Data Type" ; "Please Select the correct DataType" ; "Text" ; DataTypes ));
RawValue := @If(
@Contains( DataType ; "Name Multi Value" ); @PickList( [Name] );
@Contains( DataType ; "Free Name Multi Value" ); @Prompt( [OkCancelEdit] ; "Free Name Multi Value" ; "Please enter the new desired Names, Roles, ... seperated with : for each value." ; @Implode( EditField ; ":") );
@Contains( DataType ; "Name" ) ; @PickList( [Name] : [Single] );
DataType = "Remove Field" ; "" ;
@Contains( DataType ; "Multi Value" ); @Prompt( [OkCancelEdit] ; "New Value" ; "Please enter the new desired value seperated with : for each value." ; @Abstract([TextOnly] ; 254 ; "" ; @Text( EditField ) ) );
@Prompt( [OkCancelEdit] ; "New Value" ; "Please enter the new desired value." ; @Abstract([TextOnly] ; 254 ; "" ; @Text( EditField) ) )
);
@If(
DataType = "Date" ; @If( @SetField( EditField ; @TextToTime( RawValue ) ) );
DataType = "Integer" ; @If( @IsError( @TextToNumber( RawValue ) ) ; "" ; @SetField( EditField ; @TextToNumber( RawValue ) ) ) ;
DataType = "Common Name" ; @SetField( EditField ; @Name( [CN]; RawValue ) ) ;
DataType = "Remove Field" ; @SetField( EditField ; @DeleteField ) ;
DataType = "Text Multi Value" ; @SetField( EditField ; @Explode( RawValue ; ":" ) ) ;
DataType = "Date Multi Value" ; @SetField( EditField ; @TextToTime( @Explode( RawValue ; ":" ) ) ) ;
DataType = "Integer Multi Value" ; @If( @IsError( @TextToNumber( @Explode( RawValue ; ":" ) ) ) ; "" ; @SetField( EditField ; @TextToNumber( @Explode( RawValue ; ":" ) ) ) ) ;
DataType = "Name Multi Value" ; @SetField( EditField ; @Explode( RawValue ; ":" ) ) ;
DataType = "Common Name Multi Value" ; @SetField( EditField ; @Name( [CN]; @Explode( RawValue ; ":" ) ) );
DataType = "Free Name Multi Value"; @SetField( EditField ; @Explode( RawValue ; ":" ) ) ;
@SetField( EditField ; RawValue )
)
);
"" );
@All