<?xl version="0.1" encoding="SHIFT_JIS"?>



<vobj type="raw">

<Define> ^property-list
	<List>
		photo
		plot
		plot.co.mapion
		reference
		base
		stereo
		test
	</List>
</Define>

<Define> ^qind-edit-window ()
<Arguments>
	^call-window-id
	^query
</Arguments>
<Let>
<Env> ^vobj </Env>
<Env> ^current-lang-env </Env>
<vobjTarget>

	<!--------------------------------------------------
		Action Functions
	--------------------------------------------------->

	<Define> ^current (CurrentEnvironment) </Define>
	<Define> ^cancel-close-function  () ^sym
	<Let>
		<VDestroy refer="qind-edit-window" />
		<VgbQueryIndicate refer.id="^call-window-id"
			enabled="1" />
	</Let>
	</Define>
	<Define> ^ok-close-function  () ^sym
	<Let>
	<Sub>
	<title>	([GE path="descriptor" el="1"] ([GetStatus refer="qind-edit-window-title"
			flags="descriptor"]))
	</title>
	<id><If> (= query ())
		<Then>	0 </Then>
		<Else>	(GetAttribute (car query) "id") </Else>
	</If></id>
	<url>	([GE path="value" el="1"]  ([GetStatus refer="qind-edit-window-URL"
			flags="value"]))
	</url>
	<property>
		([GE path="value" el="1"]  ([GetStatus refer="qind-edit-window-property"
			flags="value"]))
	</property>
	<new-query>
	<quote>
		<query id="$id" title="$title"> ($
		<Switch>
		<Case> (= url 1)
		<quote>
			<URL>
			($ ([GE path="descriptor" el="1"]
				 ([GetStatus refer="URL:" flags="descriptor"])))
			</URL>
		</quote>
		</Case>
		<Case> (= property 1)
		<quote>
			<AND>
			<qualifier cond="part">
				($ gb-ns)
				0
				property
				()
				($ (GE property-list
				  ([GE path="value" el="1"]
					 ([GetStatus refer="GB-property"
					flags="value"]))))
			</qualifier>
			<qualifier cond="boundary">
				($ gb-ns)
				0
				content.period
				W3C-DTF
				($ 
				  (+ 
				  ([GE path="descriptor" el="1"] 
					 ([GetStatus refer="time-from"
					flags="descriptor"]))
				" / "
				  ([GE path="descriptor" el="1"] 
					([GetStatus refer="time-to"
					flags="descriptor"]))))
			</qualifier>
			</AND>
		</quote>
		</Case>
		<Case> 1
(PrintStd url)
(PrintStd property)
		</Case>
		</Switch>
		 )
		</query>
	</quote>
	</new-query>
	</Sub>
(PrintStd new-query)
		<VDestroy refer="qind-edit-window" />
		<VgbQueryIndicate refer.id="^call-window-id"
			qind.qthSet="new-query"
			enabled="1" />
	</Let>
	</Define>
	<Define> ^button-action () ^sym
	<Let>
	<Sub>
	<url> <GE path="value" el="1">
		<GetStatus refer="qind-edit-window-URL"
			flags="value"/>
	</GE></url>
	<property><GE path="value" el="1">
		 <GetStatus refer="qind-edit-window-property"
			flags="value"/>
	</GE></property>
	</Sub>
	<Switch>
	<Case> (= url 1)
		<VHAlignView refer="qind-edit-window-URL-config"
			enabled="1"/>
		<VHAlignView refer="qind-edit-window-property-config"
			enabled="0"/>
	</Case>
	<Case> (= property 1)
		<VHAlignView refer="qind-edit-window-URL-config"
			enabled="0"/>
		<VHAlignView refer="qind-edit-window-property-config"
			enabled="1"/>
	</Case>
	</Switch>
	</Let>
	</Define>


	<!--------------------------------------------------
		Window Design
	--------------------------------------------------->

	<VWindow	name="qind-edit-window"
		resizable="0"
		spacing="0,0"
		attr="floating"
		descriptor="^qind-edit-window-name"
		visible="0">
	<VGroupBox
		name = "group-box"
		ws="TitleStyle"
		padding="10,10"
		visible="1">
	<VVAlignView>
	<VHAlignView name="qind-edit-window-title-box"
			alignh="left" visible="1">
		<VStaticText ws="TitleStyle"
				alignh="left"
				descriptor="^qind-edit-window-title"/>
		<VEditText name="qind-edit-window-title"
			alignh="left"
			min_len="20"
			descriptor=""/>
	</VHAlignView>
	<VHSeparator alignh="top" padding="0,10"/>
	<VRadioButton name="qind-edit-window-URL"
		ws="TitleStyle"
		alignh="left"
		descriptor="^qind-edit-window-URL" />
	<VStaticText ws="NormalStyle"
		alignh="left"
		descriptor="^qind-edit-window-URL-doc" />
	<VHAlignView name="qind-edit-window-URL-config"
			alignh="left" visible="1">
		<VStaticText ws="NormalStyle"
			alignh="left"
			name="qind-edit-window-URL-config-TBL"
			descriptor="URL:" />
		<VEditText name="URL:"
			alignh="left"
			min_len="30"
				descriptor=""/>
	</VHAlignView>
	<VRadioButton name="qind-edit-window-property"
		ws="TitleStyle"
		alignh="left"
		descriptor="^qind-edit-window-property"
		group="qind-edit-window-URL" />
	<VStaticText ws="NormalStyle"
		alignh="left"
		descriptor="^qind-edit-window-property-doc" />
	<VHAlignView name="qind-edit-window-property-config"
			alignh="left">
	<VTableView alignv="top" alignh="left" rows="2" cols="2" homogeneous="0"
		name="qind-edit-window-property-config-TBL">
	<TR>
		<TD> <VHAlignView alignh="left">
			<VStaticText ws="TitleStyle"
				descriptor="^general-property"/>
		</VHAlignView></TD>
		<TD> <VHAlignView alignh="left">
			<VPopupButton name="GB-property"
				descriptor="GB-property"
				value="0">
					^property-list
			</VPopupButton>
		</VHAlignView></TD>
	</TR>
	<TR>
		<TD> <VHAlignView alignh="left">
			<VStaticText ws="TitleStyle"
				descriptor="^general-time"/>
		</VHAlignView></TD>
		<TD> <VHAlignView alignh="left">
			<VEditText name="time-from"
				alignh="left"
				min_len="15"
					descriptor=""/>
			<VStaticText ws="NormalStyle"
				alignh="left"
				descriptor="^general-to" />
			<VEditText name="time-to"
				alignh="left"
				min_len="15"
					descriptor=""/>
		</VHAlignView></TD>
	</TR>
	</VTableView>
	</VHAlignView>
	<VHAlignView alignh="right">
		<VPushButton
			alignh="right"
			descriptor="^general-cancel"
			cancel_button="1"
			value_event_handler="e/current/cancel-close-function"
			visible="1"/>
		<VPushButton
			alignh="right"
			descriptor="^general-ok"
			value_event_handler="e/current/ok-close-function"
			default_button="1"
			visible="1"/>
	</VHAlignView>
	</VVAlignView>
	</VGroupBox>
	</VWindow>

	<VRadioButton refer="qind-edit-window-property"
		value_event_handler="e/current/button-action" />
	<VRadioButton refer="qind-edit-window-URL"
		value_event_handler="e/current/button-action"/>


	<!--------------------------------------------------
		Setup Initial Parameters
	--------------------------------------------------->

	<If> (= query ())
	<Else>

	<Let>
	<Sub>
	<title> (GetAttribute (car query) "title") </title>
	<qtype> (GetAttribute (car query) "qtype") </qtype>
	</Sub>
	<If> (Not (= title ())) <Then>
		<VEditText refer="qind-edit-window-title"
			descriptor="^title"/>
	</Then></If>

	<Switch>
	<Case> (= qtype "URL")
		<VRadioButton refer="qind-edit-window-URL" value="1" />
		<Let>
		<Sub>
		<URL> ([GE path="URL" el="1"] query) </URL>
		</Sub>
		<VEditText refer="URL:" descriptor="^URL"/>
		</Let>
	</Case>
	<Case> (= qtype "property")
		<VRadioButton refer="qind-edit-window-property" value="1" />
		<Let>
		<Sub>
		<a> ([GE path="AND" default=""] query) </a>
		</Sub>
		<If> (= a "") <Then>
			<set> ^a (cdr query) </set>
		</Then></If>
		<For dec="a">
			<Let>
			<Sub>
			<q>  (car a) </q>
			<qq> (If (= q 'AND) (Then ())
					(Else q)) </qq>
			<field> (GE qq 3) </field>
			<data> (GE qq 5) </data>
			</Sub>
			<Switch>
			<Case> (= field "content.period")
				<Let>
				<Sub>
				<d> (DivideString data "/") </d>
				<from> (GE d 0) </from>
				<to> (GE d 1) </to>
				</Sub>
				<If> (= from ()) <Then>
				<set> ^from ^"" </set>
				</Then></If>
				<If> (= to ()) <Then>
				<set> ^to ^"" </set>
				</Then></If>

				<VEditText refer="time-from"
					descriptor="^from"/>
				<VEditText refer="time-to"
					descriptor="^to"/>
				</Let>
			</Case>
			<Case> (= field "property")
				<VPopupButton refer="GB-property"
						VALUE="^data"/>
			</Case>
			</Switch>
			</Let>
		</For>
		</Let>
	</Case>
	</Switch>
	</Let>

	</Else></If>

	<!--------------------------------------------------
		Visible
	--------------------------------------------------->

	<button-action/>
	<VWindow	refer="qind-edit-window" visible="1"/>
</vobjTarget>
</Let>
</Define>

</vobj>

