<page xmlns="http://bali.us.oracle.com/cabo/baja"
      xmlns:baja="http://bali.us.oracle.com/cabo/baja" 
      xmlns:data="http://bali.us.oracle.com/cabo/marlin"
      xmlns:html="http://www.w3.org/TR/REC-html40">  

    <baja:content xmlns="http://bali.us.oracle.com/cabo/marlin">
      <dataScope>
        <contents>

        <html:title>
          <text data:text="title@assignRulesToDevicesData" />
        </html:title>
        <html:noScript>
          "This page uses JavaScript to perform the list of values lookup. Your browser either does not support JavaScript, or it is disabled.  Please enable JavaScript, or upgrade your browser."
        </html:noScript>

        <form name="configDevices" method="POST">
          <contents>

          <pageLayout>
            <mediumAdvertisement>
              <include baja:node="../oemBanner" />
            </mediumAdvertisement>

            <globalButtons>
              <include baja:node="../globalButtonBar" /> 
            </globalButtons>
      
            <tabs>
              <include baja:node ="../globalTabs" />
            </tabs>

            <pageHeader>
              <include baja:node="header"/>
            </pageHeader>
       
            <contentFooter>
              <stackLayout rendered="true"
                           data:rendered="showContents@assignRulesToDevicesData">
                <contents>
                  <pageButtonBar>
                    <contents>
                      <submitButton data:text="CANCEL@commonResourceBundle" 
                                    name="event" 
                                    value="Cancel"/>
                      <submitButton data:text="OK@commonResourceBundle" 
                                    name="event" 
                                    value="Ok"/>  
                    </contents>
                  </pageButtonBar>
                </contents>
              </stackLayout>
            </contentFooter>

            <data:location>
              <include baja:node="../breadCrumbs"/>
            </data:location>

            <copyright>
             <include baja:node="../copyright" />
            </copyright>

            <contents>

              <messageBox rendered="false"
                          data:rendered="showMessage@assignRulesToDevicesData"
                          messageType="info"
                          data:message="altText@assignRulesToDevicesData"
                          />

              <header data:text="header@assignRulesToDevicesData" 
                      width="90%">
                <contents>

                  <tableLayout width="98%">
                    <contents>
                      <rowLayout hAlign="right">
                        <contents>
                          <cellFormat hAlign="left" width="95%">
                            <contents>
                              <styledText data:text="ASSIGN_RULES_TO_DEVICES_HDR_MSG@notifResourceBundle"
                                          styleClass="OraInstructionText"/>
                            </contents>
                          </cellFormat>
                          <cellFormat>
                            <contents>
                              <pageButtonBar>
                                <contents>
                                  <submitButton data:text="CANCEL@commonResourceBundle" 
                                                name="event" 
                                                value="Cancel"/>
                                  <submitButton data:text="OK@commonResourceBundle" 
                                                name="event" 
                                                value="Ok"/>  
                                </contents>
                              </pageButtonBar>
                            </contents>
                          </cellFormat>
                        </contents>
                      </rowLayout>
                    </contents>
                  </tableLayout>

                  <switcher data:childName="node@assignRulesToDevicesData">
                    <case name="okNode">
                      <stackLayout>
                        <contents>
                          <spacer height="10"/>

                          <inlineMessage data:prompt="VIEW@notifResourceBundle" labeledNodeId="viewBy" >
                            <contents>
                              <choice name="viewBy" columns="30" id="viewBy" 
                                            onChange="submitForm('configDevices', true, {event:'viewBy'})">
                                <contents data:childData="viewBy@assignRulesToDevicesData" >
                                  <option data:text="text"
                                          data:value="value"
                                          data:selected="selected" />
                                </contents>
                              </choice>
                            </contents>
                          </inlineMessage>

                          <spacer height="5"/>
                          <switcher data:childName="showRuleOwner@assignRulesToDevicesData">
                            <case name="true">
                              <hGrid id="HG"
                                     data:summary="header@assignRulesToDevicesData"
                                     data:alternateText="altText@assignRulesToDevicesData"
                                     data:treeData="nodes@assignRulesToDevicesData" 
                                     width="100%" 
                                     proxied="true" 
                                     data:proxy="hGridProxy@assignRulesToDevicesData" 
                                     formSubmitted="true">
                                <nodeStamp>
                                  <column>
                                    <columnHeader>
                                      <styledText data:text="NOTIF_METHOD_NAME_TYPE@notifResourceBundle"/>
                                    </columnHeader>
                                    <contents>
                                      <styledText rendered="true"
                                                  data:rendered="showDeviceName"
                                                  data:text="deviceDisplayName"/>
                                    </contents>
                                  </column>
                                </nodeStamp>
                                <columnHeaderStamp>
                                  <text data:text="text"/>
                                </columnHeaderStamp>
                                <columnHeaderData>
                                  <col data:text="NOTIF_RULE_NAME@notifResourceBundle"/>
                                  <col data:text="NOTIF_RULE_OWNER@notifResourceBundle"/>
                                  <col data:text="ASSIGN_RULE_TO_DEVICE@notifResourceBundle"/>
                                </columnHeaderData>
                                <columnFormats>
                                  <columnFormat columnDataFormat="textFormat"/>
                                  <columnFormat columnDataFormat="textFormat"/>
                                  <columnFormat columnDataFormat="iconButtonFormat"/>
                                </columnFormats>
                                <contents>
                                  <styledText data:text="ruleName"/>
                                  <styledText data:text="ruleOwner"/>
                                  <rowLayout>
                                    <contents>
                                      <checkBox name="assignCheckbox"                                     
                                                data:rendered="showCheckBox"
                                                data:shortDesc="SELECT@commonResourceBundle"
                                                data:value="rowId"
                                                data:checked="assign">                              
                                      </checkBox>                                      
                                    </contents>
                                  </rowLayout>
                                  <formValue name="assign" data:value="rowId" />  
                                </contents>
                              </hGrid>                                   
                            </case>
                            <case name="false">
                              <hGrid id="HG"
                                     data:summary="header@assignRulesToDevicesData"
                                     data:alternateText="altText@assignRulesToDevicesData"
                                     data:treeData="nodes@assignRulesToDevicesData" 
                                     width="100%" 
                                     proxied="true" 
                                     data:proxy="hGridProxy@assignRulesToDevicesData" 
                                     formSubmitted="true">
                                <nodeStamp>
                                  <column>
                                    <columnHeader>
                                      <styledText data:text="NOTIF_METHOD_NAME_TYPE@notifResourceBundle"/>
                                    </columnHeader>
                                    <contents>
                                      <styledText rendered="true"
                                                  data:rendered="showDeviceName"
                                                  data:text="deviceDisplayName"/>
                                    </contents>
                                  </column>
                                </nodeStamp>
                                <columnHeaderStamp>
                                  <text data:text="text"/>
                                </columnHeaderStamp>
                                <columnHeaderData>
                                  <col data:text="NOTIF_RULE_NAME@notifResourceBundle"/>
                                  <col data:text="ASSIGN_RULE_TO_DEVICE@notifResourceBundle"/>
                                </columnHeaderData>
                                <columnFormats>
                                  <columnFormat width="40%" columnDataFormat="textFormat"/>
                                  <columnFormat width="10%" columnDataFormat="iconButtonFormat"/>
                                </columnFormats>
                                <contents>
                                  <styledText data:text="ruleName"/>
                                  <rowLayout>
                                    <contents>
                                      <checkBox name="assignCheckbox"                                     
                                                data:rendered="showCheckBox"
                                                data:value="rowId"
                                                data:checked="assign">                              
                                      </checkBox>                                      
                                    </contents>
                                  </rowLayout>
                                  <formValue name="assign" data:value="rowId" />  
                                </contents>
                              </hGrid>                                   
                            </case>
                          </switcher>
                        </contents>
                      </stackLayout>
                    </case>
                    <case name="errNode">
                      <messageBox data:message="errMsg@assignRulesToDevicesData"
                                  messageType="error"
                                  longDescURL="unimpl"
                                  data:text="ERROR_OCCURRED_MSG@notifResourceBundle">
                      </messageBox>
                    </case>
                  </switcher>
                  
                  <formValue name="noRules" data:value="noRules@assignRulesToDevicesData" />  

                </contents>
              </header>                      
            </contents>
          </pageLayout>
          </contents>
        </form> 

        </contents>
        <provider>
          <data name="commonResourceBundle">
            <bundle class="oracle.sysman.resources.CommonResourceBundle"/>
          </data>
          <data name="notifResourceBundle">
            <bundle class="oracle.sysman.resources.NotifMsg"/>
          </data>
          <data name="assignRulesToDevicesData">
            <method class="oracle.sysman.eml.pref.NotifRulesPref"
                    method="getAssignRulesToDevicesData"/>
          </data>
        </provider>
      </dataScope>
    </baja:content>
    <baja:handlers>
      <!-- this handles the help setup and the hgrid event -->
      <event name="*">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents" 
                method="doLoad"/>
      </event>
      <event name="Cancel">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents"
                method="cancelAssignData"/>
      </event>
      <event name="Ok">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents"
                method="doAssignData"/>
      </event>
      <event name="viewBy">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents"
                method="doAssignData"/>
      </event>
    </baja:handlers>
</page>

