## AUI-specific macros
## When adding new macros make sure not to overlap names with macros.vm CONF-15666
#macro (onoffAUI $fieldname $checked)
    #if ($checked==true)
        <input name="$fieldname" type="checkbox" checked disabled> #else <input name="$fieldname" type="checkbox" disabled>
    #end
#end

#macro (yesnoAUI $checked)
    #if ($checked==true) <span class="yes-label">$action.getText('yes.name.caps')</span> #else <span class="no-label">$action.getText('no.name.caps')</span> #end
#end

#macro (displayToolbarButtonsAUI)
    #set ($webItemContext = $action.webInterfaceContext)
    #foreach ($item in $webInterfaceManager.getDisplayableItems("system.editor.action", $webItemContext))
        #set ($linkTitle = $item.label.getDisplayableLabel($req, $webItemContext))
        #set ($linkImg = $item.icon.url.getDisplayableUrl($req, $webItemContext))
        <a id="$item.link.id" href="#" title="$linkTitle">
            <img src="$linkImg" title="$linkTitle" alt="$linkTitle" height="$item.icon.height" width="$item.icon.width">
        </a>
    #end
#end

#macro (fielderrorAUI $fieldname)
    #set ($fieldErrors = $action.fieldErrors)
    #if ($fieldErrors)
      #if ($fieldErrors.get($fieldname))
          #foreach ($error in $fieldErrors.get($fieldname))
          <span id="${fieldname}-error" class="error">
            #set( $message = $action.getText(${error}) )
            #if( $message && $message != "" )
              $message
            #else
              $error
            #end
          </span>
          #end
      #end
    #end
#end