# Depositing a Document (DD)
# Gerald Banon, 1998 - 2001

package provide dpi.inpe.br/banon/1998/08.02.08.56 2.1

# ----------------------------------------------------------------------
# Example:
# DDHelp .window.main.dd {} dd(ok)

proc DDHelp {entryWidget entryName varName} {
# runs with start
# entryName and varName not used in DDHelp (used in XXDirectory)
	global editorPath
	global defaultMetadataRepository
	
	set col ../../../../..
#	regexp ".*\.dd" $entryWidget win	;# .dd or .window.output.dd
#	set win $entryWidget
	regsub {.dd} $entryWidget {} win	;# .window.main
	set t .ddhelp.f.t
	$t delete 1.0 end
	set font [lindex [lindex [$t configure -font] end] 0]
	$t configure -font {$font 10}
	set pwd [pwd]
	regexp {(^.*)/col/} $pwd m homePath
	TextStyles $t
	Insert $t insert \
{Depositing a Document in a Repository}
	TagAdd $t bold12 {Depositing a Document in a Repository}
	$t insert insert "\n\n"
	Insert $t insert \
"You place a document in the URLib collection by depositing it\
in a repository. You do that by informing, through two\
appropriate forms, which is the document and where\
it has to be deposited, and then by clicking the OK Button."
	TagAdd $t italic {document}
	TagAdd $t green {document}
	TagAdd $t underline {document}
	TagAdd $t {document} {document}
	TagBind $t {document} $win.definition
	TagAdd $t italic {Lib}
	TagAdd $t italic repository
	TagAdd $t green {repository}
	TagAdd $t underline {repository}
	TagAdd $t {repository} {repository}
	TagBind $t {repository} $win.definition
	TagAdd $t blue {forms}
	TagAdd $t {forms} {forms}
	TagBind $t {forms} "$entryWidget.lbwhich $entryWidget.lbwhere"
	TagAdd $t italic which
	TagAdd $t italic where
	TagAdd $t current9 OK
	TagAdd $t blue {OK Button}
	TagAdd $t {OK Button} {OK Button}
	TagBind $t {OK Button} $entryWidget.buttons.ok.ok
	$t insert insert "\n\n"
	Insert $t insert \
{Depositing a Document in a New Repository}
	TagAdd $t bold12 {Depositing a Document in a New Repository}
	$t insert insert "\n\n"
	Insert $t insert \
"When you ask for depositing a document in a New Repository,\
a new repository is automatically created in your\
local collection and the document is deposited in it."
	TagAdd $t italic "New Repository"
	TagAdd $t blue {New Repository}
	TagAdd $t {New Repository} {New Repository}
	TagBind $t {New Repository} $entryWidget.rep.h1.h1.b1
	$t insert insert "\n\n"
	Insert $t insert \
"All the repositories are created under a\
directory called <col> (for collection)."
	TagAdd $t fixed <col>
	$t insert insert " "
	Insert $t insert \
{Your local collection begins at: <$var1/col>.} \
{} $homePath
	TagAdd $t fixed {<$var1/col>} -forward $homePath
	$t insert insert "\n\n"
	Insert $t insert \
"In a repository, the document folder name is always <doc>\
(for document)."
	TagAdd $t fixed <doc>
	$t insert insert "\n\n"
	Insert $t insert \
{For example, the document in the repository\
<dpi.inpe.br/banon/1995/08.08.00.00> begins at:\
<$var1/col/dpi.inpe.br/banon/1995/08.08.00.00/doc>.} {} $homePath
	TagAdd $t fixed <dpi.inpe.br/banon/1995/08.08.00.00>
	TagAdd $t fixed \
		{<$var1/col/dpi.inpe.br/banon/1995/08.08.00.00/doc>} \
		-forward $homePath
	$t insert insert "\n\n"
	Insert $t insert \
{Depositing the Default or Empty Document}
	TagAdd $t bold {Depositing the Default or Empty Document}
	$t insert insert "\n\n"
	Insert $t insert \
"You may choose to deposit the Default Document or\
the Empty Document."
	TagAdd $t blue {Default Document}
	TagAdd $t blue {Empty Document}
	TagAdd $t {Default Document} {Default Document}
	TagBind $t {Default Document} $entryWidget.dir.h1.h1.b1
	TagAdd $t {Empty Document} {Empty Document}
	TagBind $t {Empty Document} $entryWidget.dir.h1.h1.b2
	$t insert insert "\n\n"
	Insert $t insert \
"The Default Document is the current document stored\
in the repository <dpi.inpe.br/banon/1999/09.19.18.20>.\
Depositing it results in making a copy of it in\
the <doc> directory."
	TagAdd $t italic "Default Document"
	TagAdd $t fixed <dpi.inpe.br/banon/1999/09.19.18.20>
	TagAdd $t fixed <doc>
	$t insert insert "\n\n"
	Insert $t insert \
"The Empty Document corresponds to a document folder containing\
no file. Depositing it results in an empty <doc> directory."
	TagAdd $t italic "Empty Document"
	TagAdd $t fixed <doc>
	$t insert insert "\n\n"
	Insert $t insert \
{Depositing Any Other Document}
	TagAdd $t bold {Depositing Any Other Document}
	$t insert insert "\n\n"
	Insert $t insert \
"Besides the Default and the Empty Document, you may deposit\
any other document located in your file system."
	$t insert insert " "
	Insert $t insert \
"You inform which is the document by opening the small window\
in the Which ? Form and by entering the absolute path\
leading up to the document folder."
	TagAdd $t blue {Which ? Form}
	TagAdd $t {Which ? Form} {Which ? Form}
	TagBind $t {Which ? Form} $entryWidget.lbwhich
	$t insert insert "\n\n"
	Insert $t insert \
"For example, to deposit the document stored in the folder\
<TomatoSoup> located at:"
	TagAdd $t fixed <TomatoSoup>
	$t insert insert "\n"
	Insert $t insert \
{<C:\\My Documents\\Recipes>,}
	TagAdd $t fixed {<C:\\My Documents\\Recipes>}
	$t insert insert "\n"
	Insert $t insert \
"you enter:"
	$t insert insert "\n"
	Insert $t insert \
{<C:/My Documents/Recipes/TomatoSoup/>.}
	TagAdd $t fixed {<C:/My Documents/Recipes/TomatoSoup/>}
	$t insert insert "\n\n"
	Insert $t insert \
"To enter such a path, you can use the keyboard or alternatively\
the two Buttons < and >."
	TagAdd $t courier11 <
	TagAdd $t courier11 >
	TagAdd $t blue {Buttons < and >}
	TagAdd $t {Buttons < and >} {Buttons < and >}
	TagBind $t {Buttons < and >} "$entryWidget.dir.h1.h2.v2.entry.button1.1 \
		$entryWidget.dir.h1.h2.v2.entry.button2.2"
	$t insert insert "\n\n"
	Insert $t insert \
"The > Button is a menu button which gives you all the possible\
path options from the current path."
	TagAdd $t courier11 >
	TagAdd $t blue {> Button}
	TagAdd $t {> Button} {> Button}
	TagBind $t {> Button} $entryWidget.dir.h1.h2.v2.entry.button2.2
	$t insert insert " "
	Insert $t insert \
"The < Button allows you to return to the parent path."
	TagAdd $t courier11 <
	TagAdd $t blue {< Button}
	TagAdd $t {< Button} {< Button}
	TagBind $t {< Button} $entryWidget.dir.h1.h2.v2.entry.button1.1
	$t insert insert "\n\n"
	Insert $t insert \
"You can use the Back Space Key in place of the < Button to get\
a backward similar effect."
	TagAdd $t italic {Back Space Key}
	TagAdd $t courier11 <
	$t insert insert "\n\n"
	Insert $t insert \
"A click on the < Button by using the mouse right button clears the entry."
	TagAdd $t courier11 <
	TagAdd $t blue {< Button}
	TagAdd $t {< Button} {< Button}
	TagBind $t {< Button} $entryWidget.dir.h1.h2.v2.entry.button1.1
	TagAdd $t italic right
	$t insert insert "\n\n"
	Insert $t insert \
"The S Menu Button (S for Select) may be used to re-enter one of the\
most recent paths."
	TagAdd $t current9 S
	TagAdd $t blue {S Menu Button}
	TagAdd $t {S Menu Button} {S Menu Button}
	TagBind $t {S Menu Button} $entryWidget.dir.h1.h2.v2.entry.button3.3
	$t insert insert "\n\n"
	Insert $t insert \
"A click on the S Menu Button by using the mouse right button\
selects the <doc> directory of the repository selected in the\
Where ? Form (the small window in this form must be open)."
	TagAdd $t current9 S
	TagAdd $t blue {S Menu Button}
	TagAdd $t {S Menu Button} {S Menu Button}
	TagBind $t {S Menu Button} $entryWidget.dir.h1.h2.v2.entry.button3.3
	TagAdd $t italic right
	TagAdd $t fixed <doc>
	TagAdd $t blue {Where ? Form}
	TagAdd $t {Where ? Form} {Where ? Form}
	TagBind $t {Where ? Form} $entryWidget.lbwhere
	$t insert insert "\n\n"
	Insert $t insert \
"The C Button (C for Check) can be used to check the contain\
of the current folder."
	TagAdd $t current9 C
	TagAdd $t blue {C Button}
	TagAdd $t {C Button} {C Button}
	TagBind $t {C Button} $entryWidget.dir.h1.h2.v2.entry.button4.4
	$t insert insert "\n\n"
	Insert $t insert \
"By clicking the C Button, a window will open, showing\
the list of files contained in the current folder."
	TagAdd $t current9 C
	TagAdd $t blue {C Button}
	TagAdd $t {C Button} {C Button}
	TagBind $t {C Button} $entryWidget.dir.h1.h2.v2.entry.button4.4
	$t insert insert "\n\n"
	Insert $t insert \
"By selecting, in this window, some files with the mouse left button,\
you restrict the folder content to be deposited."
	$t insert insert "\n\n"
	Insert $t insert \
"To select more than one file, hold the Control-Key down\
and click their names."
	$t insert insert "\n\n"
	Insert $t insert \
"If no entry is selected, then the whole folder content\
will be deposited."
	$t insert insert "\n\n"
	Insert $t insert \
"When you deposit a document from the file system,\
you may choose among three options."
	TagAdd $t italic "three options"
	$t insert insert "\n\n"
	Insert $t insert \
"The first option means that the document in\
the file system must be copied into the collection."
	TagAdd $t blue {The first option}
	TagAdd $t {The first option} {The first option}
	TagBind $t {The first option} $entryWidget.radio.f1.r1
	TagAdd $t italic "copied"
	$t insert insert " "
	Insert $t insert \
"In this case, the folder document and its content are preserved in\
the file system."
	$t insert insert "\n\n"
	Insert $t insert \
"The second option means that the document must be moved from the\
file system into the collection but preserving the document folder\
in the file system."
	TagAdd $t blue {The second option}
	TagAdd $t {The second option} {The second option}
	TagBind $t {The second option} $entryWidget.radio.f2.r2
	TagAdd $t italic "moved"
	$t insert insert "\n\n"
	Insert $t insert \
"For example, depositing the document contained in the <TomatoSoup>\
folder would result in an empty <TomatoSoup> directory and all\
its original content would be transfered into the collection under the\
<doc> directory."
	TagAdd $t fixed <TomatoSoup>
	TagAdd $t fixed <TomatoSoup> -backward
	TagAdd $t fixed <doc>
	$t insert insert "\n\n"
	Insert $t insert \
"The third option just differs from the second one in the sense that\
the document folder is not preserved in the file system."
	TagAdd $t blue {The third option}
	TagAdd $t {The third option} {The third option}
	TagBind $t {The third option} $entryWidget.radio.f3.r3
	$t insert insert " "
	Insert $t insert \
"In the previous example, the <TomatoSoup> directory (and its content)\
would be deleted from the directory:"
	TagAdd $t fixed <TomatoSoup>
	$t insert insert "\n"
	Insert $t insert \
{<C:\\My Documents\\Recipes>.}
	TagAdd $t fixed {<C:\\My Documents\\Recipes>}
	$t insert insert "\n\n"
	Insert $t insert \
{Editing the Metadata}
	TagAdd $t bold {Editing the Metadata}
	$t insert insert "\n\n"
	Insert $t insert \
{We strongly recommend to edit the metadata before depositing\
a document. You edit the metadata by pressing the Edit Button.}
	TagAdd $t italic {metadata}
	TagAdd $t green {metadata}
	TagAdd $t underline {metadata}
	TagAdd $t {metadata} {metadata}
	TagBind $t {metadata} $win.definition
	TagAdd $t italic before
	TagAdd $t blue {Edit Button}
	TagAdd $t {Edit Button} {Edit Button}
	TagBind $t {Edit Button} $entryWidget.buttons.edit.edit
	$t insert insert "\n\n"
	Insert $t insert \
{On Windows platform, if the EndNote Demo package has been installed\
in the local collection, you can use it to enter the metadata\
instead of using the Edit Button. Once you have edited the\
metadata in the EndNote Reference Editing Window, you must select the\
edited reference in the EndNote Library Window and press the Crtl+K key\
sequence before clicking the OK Button.}
	TagAdd $t italic before
	TagAdd $t current9 OK
	TagAdd $t blue {OK Button}
	TagAdd $t {OK Button} {OK Button}
	TagBind $t {OK Button} $entryWidget.buttons.ok.ok
	$t insert insert "\n\n"
	Insert $t insert \
{If you forget to edit the metadata before pressing the OK Button,\
then URLibService will use the metadata deposited in the\
default metadata repository: <$var1>.} {} $defaultMetadataRepository
	TagAdd $t italic {Lib}
	TagAdd $t current9 OK
	TagAdd $t blue {OK Button}
	TagAdd $t {OK Button} {OK Button}
	TagBind $t {OK Button} $entryWidget.buttons.ok.ok
	TagAdd $t fixed {<$var1>} -forward $defaultMetadataRepository
	TagAdd $t $defaultMetadataRepository {<$var1>} -forward $defaultMetadataRepository
# puts [list Edit $editorPath $homePath/col/$defaultMetadataRepository/doc/@metadata.refer]
	if [file exists $editorPath] {
		TagAdd $t blue {<$var1>} -forward $defaultMetadataRepository
#		$t tag bind $defaultMetadataRepository <1> \
#		[list Edit $editorPath $homePath/col/$defaultMetadataRepository/doc/@metadata.refer]	;# commented by GJFB  in 2011-03-019 - path must not be absolute
		$t tag bind $defaultMetadataRepository <1> \
		[list Edit $editorPath $col/$defaultMetadataRepository/doc/@metadata.refer]	;# added by GJFB  in 2011-03-019 - path must be relative 
		$t tag bind $defaultMetadataRepository <Enter> "$t config -cursor hand2"
		$t tag bind $defaultMetadataRepository <Leave> "$t config -cursor double_arrow"
	}

	$t insert insert "\n\n"
	Insert $t insert \
{Depositing a Document in an Existing Repository}
	TagAdd $t bold12 {Depositing a Document in an Existing Repository}
	$t insert insert "\n\n"
	Insert $t insert \
"Finally, you can choose to deposit a document in an existing\
repository."
	$t insert insert " "
	Insert $t insert \
"You enter the repository name in the Where ? Form, using the\
keyboard or alternatively the Buttons < and >."
	TagAdd $t courier11 <
	TagAdd $t courier11 >
	TagAdd $t blue {Where ? Form}
	TagAdd $t {Where ? Form} {Where ? Form}
	TagBind $t {Where ? Form} $entryWidget.lbwhere
	TagAdd $t blue {Buttons < and >}
	TagAdd $t {Buttons < and >2} {Buttons < and >}
	TagBind $t {Buttons < and >2} "$entryWidget.rep.h1.h2.v2.entry.button1.1 \
		$entryWidget.rep.h1.h2.v2.entry.button2.2"
	$t insert insert "\n\n"
	Insert $t insert \
"There are two possible options for entering the repository name."
	TagAdd $t italic two
	$t insert insert "\n\n"
	Insert $t insert \
"The default one is called Identification Key First."
	TagAdd $t italic {Identification Key First}
	$t insert insert " "
	Insert $t insert \
"This is the simplest option, instead of the\
repository name, you enter (first) the identification\
key associated with it. If there is only one repository having\
that identification key, then the repository name is\
automatically added."
	TagAdd $t italic {identification key}
	TagAdd $t green {identification key}
	TagAdd $t underline {identification key}
	TagAdd $t {identification key} {identification key}
	TagBind $t {identification key} $win.definition
 	$t insert insert "\n\n"
	Insert $t insert \
"The second option is called Repository First."
	TagAdd $t italic {Repository First}
	$t insert insert " "
	Insert $t insert \
"With this option, you enter first the repository name and the\
identification key is automatically added."
	$t insert insert "\n\n"
	Insert $t insert \
"In both cases, when the entry is complete, the background color\
becomes  magenta ."
	TagAdd $t magenta { magenta }
	$t insert insert "\n\n"
	Insert $t insert \
"You can then switch from one option to the other, just by pressing\
the R Button (R for Reverse)."
	TagAdd $t current9 R
	TagAdd $t blue {R Button}
	TagAdd $t {R Button} {R Button}
	TagBind $t {R Button} $entryWidget.rep.h1.h2.v2.entry.button5.5
	$t insert insert "\n\n"
	Insert $t insert \
"If you deposit a document in an existing repository, you will lose\
forever the existing document in that repository."
	$t insert insert "\n"

	$t configure -state disabled
}
