<?php
/**
 * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
 *
 * @author Double Bastion LLC
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

declare(strict_types=1);

script('sms_relentless', 'settings');
style('sms_relentless', 'style');

?>

<div id="sms_relentless_adm">
        <div class="section">
           <h2><?php p($l->t('SMS Relentless'));?></h2>

           <div id="appTitlePrg"></div>

           <div class="sms_followupsection">

                <form id="prov_credentials" action="#" >

                   <div id="nadmProvSection"></div>

                   <p><label for="messagesperpage" class="setlabeltext"><b>Number of messages per page</b> (Enter the number of messages to be displayed on one page of the
                          received/sent/grouped messages tables. If you don't enter anything in this field, the default of 100 messages per page will be used.):</label></p>
                   <input type="number" class="smsr_textbox" id="messagesperpage" name="messagesperpage" autocomplete="false" placeholder="<?php p($l->t('e.g. 100')); ?>"/><br><br>

                   <p><label for="get_notify" class="setlabeltext"><b>I want to see a notification in Nextcloud when a new SMS/MMS is received:</b></label></p>
                   <input type="checkbox" class="sms_rel_checkbox" id="get_notify" name="get_notify" autocomplete="false" /><br>

                   <p class="setlabeltext">To enable email notifications for every received SMS/MMS, the "sendmail" utility ("/usr/sbin/sendmail" on Debian Linux),
                      has to be present on the server. "sendmail" is a binary which gets installed when Postfix is installed. Also the server user (www-data) has to be
                      allowed to send emails from command line (by specifying "authorized_submit_users = www-data" in "/etc/postfix/main.cf" for Postfix on a Debian based Linux 
                      distribution).</p><br>

                   <p><label for="notification_email" class="setlabeltext"><b>I want to receive a notification to the email address from below, when a new SMS/MMS is
                      received:</b></label></p>
                   <input type="text" class="smsr_textbox" id="notification_email" name="notification_email" autocomplete="false"
                          placeholder="<?php p($l->t('e.g. john.doe@example.com')); ?>" /><br><br>

                   <p><label for="includesmsinemail" class="setlabeltext"><b>Include the SMS/MMS message in the email notification itself:</b></label></p>
                   <input type="checkbox" class="sms_rel_checkbox" id="includesmsinemail" name="includesmsinemail" autocomplete="false" /><br>

                   <p><label for="showdisplaynames" class="setlabeltext"><b>Show the display name of the message author, before each message:</b></label></p>
                   <input type="checkbox" class="sms_rel_checkbox" id="showdisplaynames" name="showdisplaynames" autocomplete="false" /><br>

                   <p><label for="showdisplaynames" class="setlabeltext"><b>Set auto-reply messages for the following phone numbers:</b></label></p><br>
                   <table id="autoReplyTbl">
                        <tr><th>Auto-reply Author</th><th id="autoRplPhoneNb">Phone Number <div class="tooltipautoreplypn"><div id="infoautoreplypn">i</div>
                        <div class="autorpltooltippn">Sending a message to a phone number with a configured auto-reply from another phone number with a configured auto-reply must 
                        be avoided because it will trigger an infinite loop: the 2 numbers will send auto-replies to each other incessantly, until they will consume all the available 
                        funds in the balance.</div></div></th><th>Mode</th><th>Message</th><tr>
                   </table><br>

                   <input type="hidden" id="user_id" name="user_id" />

                   <input id="save_sms_settings" type="submit" value="<?php p($l->t('Save')) ?>" title='Save settings' />

                   <span id="smsr_save_msg"></span>

               </form>
           </div>
        </div>
</div>