Skip to content

Commit

Permalink
Bootstrap-based UI. About page. Mobile considerations. Readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdevroe committed Jun 28, 2016
1 parent c42993a commit 6543838
Show file tree
Hide file tree
Showing 9 changed files with 261 additions and 74 deletions.
75 changes: 75 additions & 0 deletions about.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/*
App: Three Toe
Description: A simple SMS autoresponder on top of the Twilio API
Author: Colin Devroe
Author URL: http://cdevroe.com/
------------------------------------------------------------------------
Copyright 2016 Colin Devroe
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.
*/

include('app/init.php'); ?>

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ThreeToe</title>
<link rel="stylesheet" href="<?php echo $app_url; ?>assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo $app_url; ?>assets/css/styles.css">
</head>

<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header"><a class="navbar-brand navbar-link" href="<?php echo $app_url; ?>">ThreeToe </a>
<button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navcol-1"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
</div>
<div class="collapse navbar-collapse" id="navcol-1">
<ul class="nav navbar-nav">
<li role="presentation"><a href="<?php echo $app_url; ?>configure/">Configure </a></li>
<li class="active" role="presentation"><a href="<?php echo $app_url; ?>about.php">About </a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>About Three Toe <?php echo $app_version; ?></h1>
<p>Three Toe is a simple SMS autoresponder built on top of the Twilio API. Send a phone number a code, get an SMS in response. It was <a href="http://cdevroe.com/2016/06/24/three-toe-a-simple-sms-autoresponder-on-top-of-the-twilio-api/">built by Colin Devroe to scratch an itch</a>.</p>
<p>If you would like something like this, or would like to have Three Toe customized for your needs, <a href="http://cdevroe.com/hire">just ask</a>.</p>
<p><a href="https://github.com/cdevroe/threetoe">Code available on Github</a></p>
</div>
</div>
</div>
<footer style="margin-top: 25px;">
<div class="container">
<div class="row">
<div class="col-md-12">
<hr>
<p class="text-center">Created by <a href="http://cdevroe.com" title="Colin Devroe, programmer and photographer for hire">Colin Devroe</a>.</p>
</div>
</div>
</div>
</footer>
<script src="<?php echo $app_url; ?>assets/js/jquery.min.js"></script>
<script src="<?php echo $app_url; ?>assets/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion app/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Basic, non-private configuration variables
*/

$app_version = '0.1.0';
$app_version = '0.3.0';
$data_location = str_replace('app/config.php','',__FILE__).'responses/';

?>
11 changes: 11 additions & 0 deletions assets/bootstrap/css/bootstrap.min.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions assets/bootstrap/js/bootstrap.min.js

Large diffs are not rendered by default.

Empty file added assets/css/styles.css
Empty file.
5 changes: 5 additions & 0 deletions assets/js/jquery.min.js

Large diffs are not rendered by default.

178 changes: 113 additions & 65 deletions configure/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,71 +20,119 @@
endswitch;
endif;
?>

<!DOCTYPE html>
<html>
<head>
<title>Configure: Three Toe</title>
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1">
</head>
<body>
<h1>Three Toe</h1>
<p>A simple SMS autoresponder.</p>
<hr>
<h2>Configuration</h2>
<?php $responses = responses_list(); ?>

<form id="responses" method="post" action="index.php">

<?php if ( !isset($_GET['response']) ) : ?>
<p><label for="responses_list">Choose a code:</label>
<select name="responses_list" id="responses_list">
<?php if ( !isset($_GET['response']) ) : ?>
<option selected value="">Choose...</option>
<?php endif ?>
<option value="add_new_code">++ ADD NEW CODE</option>
<?php
if ( count($responses) > 0 ) :
for($i=0;$i<count($responses);$i++) :
$selected = ( isset($_GET['response']) && $_GET['response'] == $responses[$i] ) ? 'selected' : '';
echo '<option value="' . $responses[$i] . '" ' . $selected . '>' . $responses[$i] . '</option>';
endfor;
endif; ?>
</select></p>
<?php elseif ( isset($_GET['response']) && $_GET['response'] != 'add_new_code' ) : ?>
<h3>Editing code "<?php echo $_GET['response']; ?>"</h3>
<p><a href="<?php echo $app_url; ?>configure"><< Go back</a></p>
<?php endif; ?>

<?php if ( isset($_GET['response']) && $_GET['response'] == 'add_new_code' ) : ?>
<input type="hidden" name="action" id="action" value="add">
<p><label for="code">Code:</label>
<input type="text" maxlength="8" size="8" id="code" name="code"> <small>E.g. "T0001" or "BLUE123" or "C210001"</small></p>
<p><label for="password">Password:</label>
<input type="password" id="password" name="password"></p>
<p><input type="submit" value="Add"> <small><a href="<?php echo $app_url; ?>configure">Cancel</a></small></p>

<?php endif; ?>

<?php if ( isset($_GET['response']) && $_GET['response'] != 'add_new_code' ) :
$response = responses_load($_GET['response']);
//var_dump($response);
if ( isset($response) && !empty($response) ) : ?>
<input type="hidden" name="action" id="action" value="edit">
<input type="hidden" id="code" name="code" value="<?php echo $_GET['response']; ?>">
<p><label for="response_edit">Edit response:</label><br/><textarea name="response_edit" id="response_edit" cols="40" rows="5"><?php echo $response; ?></textarea></p>

<p><label for="password">Password:</label>
<input type="password" id="password" name="password"></p>
<p><input type="submit" value="Save"> <?php if ( $_GET['response'] != 'notfound' ) : ?><small style="text-align: right;"><a href="#" id="deletecode">Delete "<?php echo $_GET['response']; ?>" code?</a></small><?php endif; ?></p>

<?php else : ?>
<p>No response found. Perhaps an error?</p>
<?php endif;
endif; ?>

</form>
<hr>
<p><small>Written by <a href="http://cdevroe.com/">Colin Devroe</a></small></p>
<script type="text/javascript" src="<?php echo $app_url; ?>configure/configure.js"></script>
</body>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Three Toe: Configuration</title>
<link rel="stylesheet" href="<?php echo $app_url; ?>assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo $app_url; ?>assets/css/styles.css">
</head>

<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header"><a class="navbar-brand navbar-link" href="<?php echo $app_url; ?>">ThreeToe </a>
<button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navcol-1"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
</div>
<div class="collapse navbar-collapse" id="navcol-1">
<ul class="nav navbar-nav">
<li class="active" role="presentation"><a href="<?php echo $app_url; ?>configure/">Configure </a></li>
<li role="presentation"><a href="<?php echo $app_url; ?>about.php">About </a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<h3>Configure</h3>
</div>

<div class="col-md-12">
<?php // Get all responses
$responses = responses_list(); ?>

<form id="responses" method="post" action="index.php">
<?php if ( !isset($_GET['response']) ) : ?>
<label for="responses_list">Choose a code:</label>
<select name="responses_list" id="responses_list" class="form-control">
<optgroup label="Action">
<option value="add_new_code">++ ADD NEW CODE</option>
</optgroup>
<optgroup label="Codes">
<?php if ( !isset($_GET['response']) ) : ?>
<option selected value="">Choose a code to edit...</option>
<?php endif ?>

<?php
if ( count($responses) > 0 ) :
for($i=0;$i<count($responses);$i++) :
$selected = ( isset($_GET['response']) && $_GET['response'] == $responses[$i] ) ? 'selected' : '';
echo '<option value="' . $responses[$i] . '" ' . $selected . '>' . $responses[$i] . '</option>';
endfor;
endif; ?>
</optgroup>
</select>
<?php elseif ( isset($_GET['response']) && $_GET['response'] != 'add_new_code' ) : ?>
<h4>Editing code "<?php echo $_GET['response']; ?>"</h4>
<p><a href="<?php echo $app_url; ?>configure"><< Go back</a></p>
<?php endif; ?>

<!-- Add New Code -->
<?php if ( isset($_GET['response']) && $_GET['response'] == 'add_new_code' ) : ?>
<input type="hidden" name="action" id="action" value="add">

<p><label for="code">Code:</label>
<input class="form-control" type="text" maxlength="8" size="8" id="code" name="code"> <small>E.g. "T0001" or "BLUE123" or "C210001"</small></p>
<p><label for="password">Password:</label>
<input class="form-control" type="password" id="password" name="password"></p>
<p><button class="btn btn-primary" type="submit">Save</button> <a href="<?php echo $app_url; ?>configure/" class="btn btn-link">Cancel</a></p>
<?php endif; ?>

<!-- Edit existing code -->
<?php if ( isset($_GET['response']) && $_GET['response'] != 'add_new_code' ) :
$response = responses_load($_GET['response']);
//var_dump($response);
if ( isset($response) && !empty($response) ) : ?>
<input type="hidden" name="action" id="action" value="edit">
<input type="hidden" id="code" name="code" value="<?php echo $_GET['response']; ?>">

<p><label for="response_edit">Edit response:</label><br/><textarea class="form-control" name="response_edit" id="response_edit" cols="40" rows="5"><?php echo $response; ?></textarea></p>

<p><label for="password">Password:</label>
<input class="form-control" type="password" id="password" name="password"></p>

<div class="col-lg-6 col-md-12 col-xs-12">
<button class="btn btn-primary" type="submit">Save</button> &nbsp; &nbsp; &nbsp; <?php if ( $_GET['response'] != 'notfound' ) : ?><button id="deletecode" class="btn btn-danger btn-xs" type="button">Delete</button><?php endif; ?>
</div>

<?php else : ?>
<p>No response found. Perhaps an error?</p>
<?php endif;
endif; ?>

</form>
</div>


</div>
</div>
<footer style="margin-top: 25px;">
<div class="container">
<div class="row">
<div class="col-md-12">
<hr>
<p class="text-center">Created by <a href="http://cdevroe.com" title="Colin Devroe, programmer and photographer for hire">Colin Devroe</a>.</p>
</div>
</div>
</div>
</footer>
<script src="<?php echo $app_url; ?>assets/js/jquery.min.js"></script>
<script src="<?php echo $app_url; ?>assets/bootstrap/js/bootstrap.min.js"></script>
<script src="<?php echo $app_url; ?>configure/configure.js"></script>
</body>
</html>
52 changes: 44 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,52 @@
threetoe_respond();
exit;
else : ?>

<!DOCTYPE html>
<html>
<head>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Three Toe</title>
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1">
</head>
<body>
<h1>Three Toe</h1>
<p>A simple SMS autoresponder.</p>
<p><small>Written by <a href="http://cdevroe.com/">Colin Devroe</a></small></p>
</body>
<link rel="stylesheet" href="<?php echo $app_url; ?>assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo $app_url; ?>assets/css/styles.css">
</head>

<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header"><a class="navbar-brand navbar-link" href="<?php echo $app_url; ?>">ThreeToe </a>
<button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navcol-1"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
</div>
<div class="collapse navbar-collapse" id="navcol-1">
<ul class="nav navbar-nav">
<li role="presentation"><a href="<?php echo $app_url; ?>configure/">Configure </a></li>
<li role="presentation"><a href="<?php echo $app_url; ?>about.php">About </a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Three Toe</h1>
<p>A simple SMS autoresponder.</p>
</div>
</div>
</div>
<footer style="margin-top: 25px;">
<div class="container">
<div class="row">
<div class="col-md-12">
<hr>
<p class="text-center">Created by <a href="http://cdevroe.com" title="Colin Devroe, programmer and photographer for hire">Colin Devroe</a>.</p>
</div>
</div>
</div>
</footer>
<script src="<?php echo $app_url; ?>assets/js/jquery.min.js"></script>
<script src="<?php echo $app_url; ?>assets/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
<?php endif; ?>
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ This simple script was built to scratch an itch and learn the basics of the Twil

## Version History

### 0.3.0 - June 28, 2016
- New: Bootstrap-based UI
- New: About page.
- Fixed: Mobile considerations

### 0.2.1 - June 27, 2016
- Fixed: App determination if Twilio is sending a request or not

Expand Down

0 comments on commit 6543838

Please sign in to comment.