<%unless already_submitted%>
 <%Links::Payment::add_method%>
 <%if method_invalid%>
    <%set error_message = 'Invalid payment method: '%>
    <%set error_message_2 = $method%>
    <%include payment_methods_add.html%>
    <%endparse%>
  <%elsif method_used%>
    <%set error_message = 'Invalid payment method: '%>
    <%set error_message_2 = $method%>
    <%set error_message_3 = ' has already been set up'%>
    <%include payment_methods_add.html%>
    <%endparse%>
  <%elsif method_failed%>
    <%set error_message = "Unable to load payment method '<b>"%>
    <%set error_message_2 = $method%>
    <%set error_message_3 = "</b>':<br><br>"%>
    <%set error_message_4 = $method_failed_reason%>
    <%include payment_methods_add.html%>
    <%endparse%>
  <%endif%>
<%endunless%>

<html>
<head>
  <title>Gossamer Links - Payments - <%if modify%>Modify<%else%>Add<%endif%> Method - <%payment_name%></title>
</head>

<body bgcolor="white">
<%if modify%>
  <%set header_title = "Modify"%>
  <%set header_description = "Modify a previously configured payment method"%>
<%else%>
  <%set header_title = "Add"%>
  <%set header_description = "Configure a new payment method"%>
<%endif%>
<%set header_title .= " Payment Method"%>
<%include payment_header.html%>
<form action="admin.cgi" method="post">
<input type="hidden" name="do" value="page">
<input type="hidden" name="page" value="payment_methods_add_method_submit.html">
<input type="hidden" name="type" value="<%type%>">
<input type="hidden" name="method" value="<%payment_method%>">
<%if modify%><input type="hidden" name="modify" value="1"><%endif%>
<%set font_tag = '<font face="Tahoma,Arial,Helvetica" size="2">'%>
<br>
<%set no_configure_link = 1%>
<%include payment_methods_display_new.html%>
<br>

<%if required_fields.length%>
<table border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <table bgcolor="white" border="0" cellpadding="3" cellspacing="3" width="500" valign="top">
        <tr>
          <td colspan="2"><%font_tag%><b>Required Fields</b></font></td>
        </tr>
      <%if payment_notes%>
        <tr>
          <td colspan="2"><%font_tag%><%payment_notes%></font></td>
        </tr>
      <%endif%>
        <tr>
          <td colspan="2"><%font_tag%>The following fields are required to set up a <b><%payment_name%></b> payment method:</font></td>
        </tr>
<%loop required_fields%>
        <tr>
          <td width="20%"><%font_tag%><b><%if missing%><font color="red"><%field_title%>:</font><%else%><%field_title%>:<%endif%></b></font></td>
          <td width="80%">
            <%font_tag%>
              <%if type eq 'YESNO'%>
                <input type="radio" name="<%field%>" value="1"<%if field_value%> checked<%endif%>>Yes
                <input type="radio" name="<%field%>" value="0"<%if field_value eq '0'%> checked<%endif%>>No
              <%elsif type eq 'TEXTAREA'%>
                <textarea name="<%field%>" rows="<%if rows%><%rows%><%else%>30<%endif%>" cols="<%if cols%><%cols%><%else%>5<%endif%>"><%if field_value%><%field_value%><%endif%></textarea>
              <%elsif type eq 'SELECT'%>
                <select name="<%field%>">
                  <option value="">---</option>
                  <%loop options%><option value="<%value%>"<%if field_value eq $value%> selected<%endif%>><%unescape_html string%></option>
                  <%endloop%>
                </select>
              <%elsif type eq 'RADIO'%>
                <%loop options%>
		  <input type="radio" name="<%field%>" value="<%value%>"<%if field_value eq $value%> checked<%endif%>><%unescape_html string%><br>
                <%endloop%>
              <%else%><%--if type eq 'TEXT'--%>
                <input type="text" name="<%field%>" value="<%if field_value%><%field_value%><%endif%>" size="<%if size%><%size%><%else%>20<%endif%>">
              <%endif%>
            </font>
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><%font_tag%><%field_description%><br><br></font></td>
        </tr>
<%endloop%>
      </table>
    </td>
  </tr>
</table>

<br>
<%endif%>

<%if optional_fields.length%>
<table border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <table bgcolor="white" border="0" cellpadding="3" cellspacing="3" width="500" valign="top">
        <tr>
          <td colspan="2"><%font_tag%><b>Optional Fields</b></font></td>
        </tr>
        <tr>
          <td colspan="2">
            <%font_tag%>
              The following fields are optional parameters for the payment
              method and are not required for the payment process.
            </font>
          </td>
        </tr>
<%loop optional_fields%>
        <tr>
          <td width="20%" rowspan="2" valign="top"><%font_tag%><b><%if invalid%><font color="red"><%field_title%>:</font><%else%><%field_title%>:<%endif%></b></font></td>
          <td width="80%">
            <%font_tag%>
              <%if type eq 'YESNO'%>
                <select name="<%field%>">
                  <option value="">---</option>
                  <option value="1"<%if field_value%> selected<%endif%>>Yes</option>
                  <option value="0"<%if field_value eq '0'%> selected<%endif%>>No</option>
                </select>
              <%elsif type eq 'TEXTAREA'%>
                <textarea name="<%field%>" rows="<%if rows%><%rows%><%else%>30<%endif%>" cols="<%if cols%><%cols%><%else%>5<%endif%>"><%if field_value%><%field_value%><%endif%></textarea>
              <%elsif type eq 'SELECT'%>
                <select name="<%field%>">
                  <option value="">---</option>
                  <%loop options%><option value="<%value%>"<%if field_value eq $value%> selected<%endif%>><%unescape_html string%></option>
                  <%endloop%>
                </select>
              <%elsif type eq 'RADIO'%>
              <%loop options%><input type="radio" name="<%field%>" value="<%value%>"<%if field_value eq $value%> checked<%endif%>><%unescape_html string%><br>
                <%endloop%>
              <%else%><%--if type eq 'TEXT'--%>
                <input type="text" name="<%field%>" value="<%if field_value%><%field_value%><%endif%>" size="<%if size%><%size%><%else%>20<%endif%>">
              <%endif%>
            </font>
          </td>
        </tr>
        <tr>
          <td><%font_tag%><%field_description%><br><br></font></td>
        </tr>
<%endloop%>
      </table>
    </td>
  </tr>
</table>

<br>
<%endif%>

<table border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <table bgcolor="white" border="0" cellpadding="3" cellspacing="3" width="500" valign="top">
        <tr>
          <td align="center"><input type="submit" value="<%if modify%>Modify<%else%>Add<%endif%> Payment Method"> <input type="reset"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
</body>
</html>
