! DOCCREATE.SCP ! Script to create a document for any subsystem, puts new document in @#CURDOC ! see comments at end ! ! Get the doct-spec from the command line, if any is left: ! ! If there was more on the command line, interpret it as a document ! reference: ! [folder\]title ! ************** -- OA$MENU_REMAINDER ! ! which means you do not need to invoke the DOCSEL form to get ! the document spec from the user via form-entry. ! ! .if OA$MENU_REMAINDER nes "" - ! then get #TITLE = OA$MENU_REMAINDER \ - ! get #FOLDER = "" \ - ! get #DOCNUM = "" \ - ! get_symbol #TITLE,#X,'\' \ - ! .if #TITLE eqs "" - ! then get #TITLE = #X - ! ELSE get #CREATE_FOLDER = #X GET #PREVIOUS_DOC=@#CURDOC GET #STATUS=#SETDOC="" .IF #CREATE_FOLDER NES "" THEN GET #FOLDER=#CREATE_FOLDER - ELSE GET #FOLDER=OA$CURDOC_FOLDER ! .if OA$MENU_REMAINDER nes "" - ! THEN .GOTO TOP .IF #VMS_IMPORT EQS "1" THEN FORM DOCDSCVMS - ELSE .IF #NO_TEMPLATE EQS "1" THEN FORM DOCDSCNT - ELSE FORM DOCDSC .LABEL TOP .if OA$MENU_REMAINDER nes "" - THEN GET OA$MENU_REMAINDER = "" - ELSE .IF OA$FORM_DISPOSE NE 2 THEN .GOTO EXIT_STATUS_0 .IF #SETFOLDER NES "" OR #SETTITLE NES "" OR #SETDOCNUM NES "" - THEN .GOTO SET_UP_DOC .LABEL GOT_DOC !DISPLAY Creating new document . . . GET OA$DISPLAY=OA$_WP_CREAINGDOC\FORCE ! if there is a default file extension or DSAB in the HANDLING file, use it GET #DSAB=#CREATE_DSAB .IF #DSAB EQS "" THEN GET #DSAB=FORMAT.DSAB[#FORMAT]\- GET #DEFAULT_FILE=FORMAT.DEFAULT_FILE[#FORMAT] .IF #DEFAULT_FILE EQS "" THEN - GET #DEFAULT_FILE=OA$TEXT_DSAB.EXTENSION[#DSAB] .IF #DSAB EQS "" THEN GET #DSAB=OA$DEFAULT_DSAB CAB CREATE #FOLDER,#DEFAULT_FILE,@#CURDOC .IF OA$STATUS NE 1 THEN .GOTO ERROR_CREATE GET #NUMBER=OA$CURDOC_DOCNUM GET #FILENAME=OA$CURDOC_FILENAME CAB BEGIN CAB ADD_ATTR ,"TITLE",#TITLE CAB ADD_ATTR ,"KEYWORDS",#KEYWORDS CAB ADD_ATTR ,"TYPE","DOCUMENT" CAB ADD_ATTR ,"FORMAT",#FORMAT CAB ADD_ATTR ,"AUTHOR",#AUTHOR CAB ADD_ATTR ,"DSAB",#DSAB CAB END ! see if there is a template document to merge !DISPLAY Merging template document . . . .IF #SETDOC NES "" THEN - GET OA$DISPLAY=OA$_WP_MRGTEMPDOC\FORCE- \GET OA$FUNCTION="MERGE " CAB$:DOCUMENT.FILENAME[#SETDOC] "," - #FILENAME- \CAB CURRENT @#CURDOC ! see if there is a template formname to display from the HANDLING file GET #TEMPFRM=FORMAT.TEMPLATEFRM[OA$CURDOC_FORMAT] .IF #TEMPFRM NES "" THEN - GET OA$FUNCTION="FORM " #TEMPFRM ! see if there is a template filename to merge from the HANDLING file GET #TEMPFILE=FORMAT.TEMPLATEDOC[OA$CURDOC_FORMAT] !DISPLAY Merging special handling template document . . . .IF #TEMPFILE NES "" THEN - GET OA$DISPLAY=OA$_WP_MRGSPECHAND\FORCE- \GET OA$FUNCTION="MERGE " #TEMPFILE "," OA$CURDOC_FILENAME .IF #P1 EQS "NOEDIT" THEN .GOTO EXIT_PROCEDURE GET #DELETEDOC=OA$CURDOC GET #EDITFUNC=FORMAT.EDITFUNC[OA$CURDOC_FORMAT] .IF #EDITFUNC == "" THEN .GOTO DEFAULT_EDITING .IF #EDITFUNC == "N/A" THEN .GOTO NO_EDITING .IF #EDITFUNC = "EDIT" THEN .GOTO EDIT_FUNCTION GET OA$FUNCTION=#EDITFUNC .IF OA$FORM_DISPOSE EQ 0 THEN .GOTO ERROR_EXIT .GOTO EXIT_PROCEDURE .LABEL DEFAULT_EDITING GET #EDITOR=FORMAT.EDITOR[OA$CURDOC_FORMAT] .IF #EDITOR == "" THEN GET #EDITOR=OA$DEFAULT_EDITOR GET OA$FUNCTION="EDIT OA$CURDOC_FILENAME,"""","""",""" #EDITOR """" .IF OA$FORM_DISPOSE EQ 0 THEN .GOTO ERROR_EXIT .LABEL EXIT_PROCEDURE GET #CREATE_DSAB=#CREATE_TITLE=#P1=#CREATE_FOLDER=#DEFAULT_FILE="" .EXIT .LABEL SET_UP_DOC CAB SELECT #SETFOLDER,#SETDOCNUM,#SETTITLE,#SETDOC .IF OA$STATUS == 1 THEN .GOTO GOT_DOC ! FORM DOCDSC/BEGIN=SETFOLDER/PRE="DISPLAY Can't find that template document" FORM DOCDSC/BEGIN=SETFOLDER/PRE="GET OA$DISPLAY=OA$_WP_NOTEMPDOC" .GOTO TOP .LABEL EDIT_FUNCTION GET #PURGE=FORMAT.PURGE[OA$CURDOC_FORMAT] GET #EDITINI=FORMAT.EDITINI[OA$CURDOC_FORMAT] GET #EDITOR=FORMAT.EDITOR[OA$CURDOC_FORMAT] GET OA$FUNCTION=#EDITFUNC ',"' #EDITINI '","' #PURGE '","' #EDITOR '"' .IF OA$FORM_DISPOSE NE 0 THEN .GOTO EXIT_PROCEDURE .LABEL ERROR_EXIT CAB DELETE_DOCUMENT #DELETEDOC GET @#CURDOC=#PREVIOUS_DOC .IF #PREVIOUS_DOC EQS "" THEN .GOTO EXIT_PROCEDURE CAB CURRENT #PREVIOUS_DOC .GOTO EXIT_PROCEDURE .LABEL NO_EDITING !DISPLAY This document may not be edited GET OA$DISPLAY=OA$_WP_DOCNONEDBLE .GOTO EXIT_PROCEDURE ! Error messages ... .LABEL ERROR_CREATE !DISPLAY Document could not be created GET OA$DISPLAY=OA$_WP_CREDOCFAIL .LABEL EXIT_STATUS_0 GET #STATUS="0" .GOTO EXIT_PROCEDURE ! Symbols to be used in calling this script: ! #P1 if 'NOEDIT' does not enter editor ! #NO_TEMPLATE if true then don't allow template document ! #CREATE passed as text to the CREATE field in the DOCDSC* forms ! #CREATE_TITLE title for the created document, defaults to blank ! #CREATE_DSAB specifies the DSAB for the new created document ! #DEFAULT_FILE specifies a default file spec ! #CREATE_FOLDER folder for the new created document, defaults to curr ! #CURDOC specifies the symbol to contain the created document ! Output symbol ! @#CURDOC specifies the key (folder/number) of the created ! document. ! DEC/CMS REPLACEMENT HISTORY, Element DOCCREATE.SCP ! *2 7-FEB-1986 14:55:47 SAUNDERS "Replace text with message codes for OAMESS" ! *1 27-JAN-1986 17:55:15 SAUNDERS "BASE Create a document" ! DEC/CMS REPLACEMENT HISTORY, Element DOCCREATE.SCP