<!--#set global $pane="Index Sites"#-->
<!--#set global $help_uri="configure-indexers-0-7"#-->
<!--#include $webdir + "/_inc_header_uc.tmpl"#-->

<div class="colmask">
    <form action="saveNewzbin" method="post" name="fullform" id="fullform">
    <input type="hidden" id="session" name="session" value="$session" />
    <div class="section">
        <div class="col2">
            <h3>NzbMatrix $T('accountInfo')</h3>
            <p>$T('explain-nzbmatrix')</p>
        </div><!-- /col2 -->
        <div class="col1">
            <fieldset>
                <div class="field-pair alt">
                    <label class="config" for="matrix_username">$T('opt-username_matrix')</label>
                    <input type="text" name="matrix_username" id="matrix_username" value="$matrix_username" size="30" />
                    <span class="desc">$T('explain-username_matrix')</span>
                </div>
                <div class="field-pair">
                    <label class="config" for="matrix_apikey">$T('opt-apikey_matrix')</label>
                    <input type="text" name="matrix_apikey" id="matrix_apikey" value="$matrix_apikey" size="35" />
                    <span class="desc">$T('explain-apikey_matrix')</span>
                </div>
                <div class="field-pair alt">
                    <label class="config" for="matrix_del_bookmark">$T('opt-newzbin_unbookmark')</label>
                    <input type="checkbox" name="matrix_del_bookmark" id="matrix_del_bookmark" value="1" <!--#if int($matrix_del_bookmark) > 0 then 'checked="checked"' else ""#--> />
                    <span class="desc">$T('explain-newzbin_unbookmark')</span>
                </div>
                <div class="field-pair">
                    <input type="submit" value="$T('button-saveChanges')" class="saveButton" />
                </div>
            </fieldset>
        </div><!-- /col1 -->
    </div><!-- /section -->
    <div class="section">
        <div class="col2">
            <h3>Newzbin $T('accountInfo')</h3>
            <p>$T('explain-newzbin')</p>
        </div><!-- /col2 -->
        <div class="col1">
            <fieldset>
                <div class="field-pair alt">
                    <label class="config" for="username_newzbin">$T('opt-username_newzbin')</label>
                    <input type="text" name="username_newzbin" id="username_newzbin" value="$username_newzbin" size="30" />
                    <span class="desc">$T('explain-username_newzbin')</span>
                </div>
                <div class="field-pair">
                    <label class="config" for="password_newzbin">$T('opt-password_newzbin')</label>
                    <input type="password" name="password_newzbin" id="password_newzbin" value="$password_newzbin" size="30" />
                    <span class="desc">$T('explain-password_newzbin')</span>
                </div>
                <div class="field-pair">
                    <input type="submit" value="$T('button-saveChanges')" class="saveButton" />
                </div>
            </fieldset>
        </div><!-- /col1 -->
    </div><!-- /section -->
    <div class="section">
        <div class="col2">
            <h3>Newzbin $T('newzbinBookmarks')</h3>
            <p>
                <input type="button" id="getBookmarks" value="$T('link-getBookmarks')" />
                <span id="getBookmarks-result" class="icon">&nbsp;</span>
                <br/><br/>
                <!--#if $bookmarks_list#-->
                <input type="button" id="hideBookmarks" value="$T('link-HideBM')" />
                <!--#else#-->
                <input type="button" id="showBookmarks" value="$T('link-ShowBM')" />
                <!--#end if#-->
            </p>
        </div><!-- /col2 -->
        <div class="col1">
            <fieldset>
                <div class="field-pair alt">
                    <label class="config" for="newzbin_bookmarks">$T('opt-newzbin_bookmarks')</label>
                    <input type="checkbox" name="newzbin_bookmarks" id="newzbin_bookmarks" value="1" <!--#if int($newzbin_bookmarks) > 0 then 'checked="checked"' else ""#--> />
                    <span class="desc">$T('explain-newzbin_bookmarks')</span>
                </div>
                <div class="field-pair">
                    <label class="config" for="newzbin_unbookmark">$T('opt-newzbin_unbookmark')</label>
                    <input type="checkbox" name="newzbin_unbookmark" id="newzbin_unbookmark" value="1" <!--#if int($newzbin_unbookmark) > 0 then 'checked="checked"' else ""#--> />
                    <span class="desc">$T('explain-newzbin_unbookmark')</span>
                </div>
                <div class="field-pair alt">
                    <label class="config" for="bookmark_rate">$T('opt-bookmark_rate')</label>
                    <input type="number" name="bookmark_rate" id="bookmark_rate" value="$bookmark_rate" size="8" min="15" max="1440" />
                    <span class="desc">$T('explain-bookmark_rate')</span>
                </div>
                <div class="field-pair">
                    <input type="submit" value="$T('button-saveChanges')" class="saveButton" />
                </div>
            </fieldset>
        </div><!-- /col1 -->
    </div><!-- /section -->
    <!--#if $bookmarks_list#-->
    <div class="section">
        <div class="col2">
            <h3>Newzbin Bookmarks</h3>
        </div><!-- /col2 -->
        <div class="col1">
            <fieldset>
            <!--#set $odd = False#-->
            <!--#for $msgid in $bookmarks_list#-->
                <!--#set $odd = not $odd#-->
                <div class="field-pair <!--#if $odd then "alt" else ""#-->">
                    <a href="https://$newzbin_url/browse/post/$msgid/" target="_blank">$msgid</a><br/>
                </div>
            <!--#end for#-->
            </fieldset>
        </div><!-- /col1 -->
    </div><!-- /section -->
    <!--#end if#-->
    <div class="padding alt">
        <input type="submit" value="$T('button-saveChanges')" class="saveButton" />
        <input type="button" value="$T('button-restart') SABnzbd" class="sabnzbd_restart" />
    </div>
    </form>
</div><!-- /colmask -->

<script>
\$(document).ready(function(){
    \$('#matrix_apikey').click(function(){ \$(this).select() });
    \$('#getBookmarks2').click(function(){ window.location='getBookmarks?session='+apikey; });
    \$('#hideBookmarks').click(function(){ window.location='hideBookmarks?session='+apikey; });
    \$('#showBookmarks').click(function(){ window.location='showBookmarks?session='+apikey; });
});
</script>
<script>
\$(document).ready(function(){
    \$('#getBookmarks').click(function(event){
      \$.ajax({
        type: "GET",
        url: "../../tapi",
        data: {mode: 'newzbin', name: 'get_bookmarks', output: 'json', apikey: '$session' },
        beforeSend: function(){
          \$('#getBookmarks').attr("disabled", "disabled");
          \$('#getBookmarks-result').removeClass("success failure").addClass("loading");
        },
        complete: function(){
          \$('#getBookmarks').removeAttr("disabled");
          \$('#getBookmarks-result').removeClass("loading");
        },
        success: function(data){
          if(data.status == true)
            \$('#getBookmarks-result').addClass("success");
          else {
            \$('#getBookmarks-result').addClass("failure")
            alert(data.error);
          }
        }
      });
    });
});
</script>

<!--#include $webdir + "/_inc_footer_uc.tmpl"#-->
