diff options
-rw-r--r-- | INSTRUCTIONS | 21 | ||||
-rw-r--r-- | www/edit.php | 2 | ||||
-rw-r--r-- | www/get.php | 3 | ||||
-rw-r--r-- | www/index.html | 9 | ||||
-rw-r--r-- | www/scripts/main.js | 67 |
5 files changed, 75 insertions, 27 deletions
diff --git a/INSTRUCTIONS b/INSTRUCTIONS index fa0bc98..207db88 100644 --- a/INSTRUCTIONS +++ b/INSTRUCTIONS @@ -7,23 +7,26 @@ will be displayed. Note if you get your passphrase wrong there is no indication except for the passwords being blank or jumbled. If this is the case alter the passphrase and hit Load again. -The last row displayed is the row where new entries can be added. If a group -name is entered in the New Group box then the entry will be added to that -group. To add the record enter a description, username and password and hit the -Add link. +In the lower part of the page is a table with the currently selected +description, username and password along with the related commands. + +To add a new entry update the fields and hit the Add button. If a new group +name is entered in the New Group box then the entry will be added to that group. To edit an existing entry modify the fields as desired and hit the Edit link. +If a name is entered in the New Group box then the entry will be moved to that +group. To delete an existing record simply hit the Delete link. -The Copy Username and Copy Password links can be used to copy the username or +The Copy Username and Copy Password buttons can be used to copy the username or password respectively to the clipboard. -The Show link can be used to reveal the password while the button is down. -Alternatively all passwords (including the pass phrase) can be seen by ticking -the Show Passwords checkbox. +All passwords (including the pass phrase) can be seen by ticking the Show +Passwords checkbox. -The Up/Down links move the entry up/down as appropriate in the list. +The Up/Down buttons move the entry up/down as appropriate in the description +list. The New Passphrase box and button allows you to enter a new passphrase for the passwords. Take heed of the warning -- if you have not entered a valid diff --git a/www/edit.php b/www/edit.php index 890d042..226e142 100644 --- a/www/edit.php +++ b/www/edit.php @@ -46,6 +46,8 @@ try $cmd->execute(); $result["status"] = true; + $result["group"] = $group; + $result["id"] = $id; $db = null; } diff --git a/www/get.php b/www/get.php index a4e1f2a..ee4dae5 100644 --- a/www/get.php +++ b/www/get.php @@ -29,7 +29,8 @@ try $index = 0; - foreach ($db->query("SELECT * FROM pm_store ORDER BY display") as $row) + foreach ($db->query("SELECT * FROM pm_store ORDER BY groupname, display") + as $row) { $data = array(); $data["id"] = $row["id"]; diff --git a/www/index.html b/www/index.html index db66991..088767d 100644 --- a/www/index.html +++ b/www/index.html @@ -60,6 +60,11 @@ <table id="DataTable" class="datatable"> <tr class="datatable"> +<td class="description">Description</td> +<td class="username">Username</td> +<td class="password">Password</td> +<td class="commands">Commands</td> +<tr class="datatable"> <td class="description"> <select id="DescriptionSelect" class="fill_0_0_lower" onchange="DoSelectDescription()"> @@ -78,6 +83,10 @@ <input type="button" id="Delete" value="Delete" onclick="DoDelete()" class="smalltext" disabled> <input type="button" id="Add" value="Add" onclick="DoAdd()" class="smalltext"> +<input type="button" id="Up" value="Up" onclick="DoUp()" class="smalltext" + disabled> +<input type="button" id="Down" value="Down" onclick="DoDown()" + class="smalltext" disabled> <br> <input type="button" id="CopyUsername" value="Copy Username" onclick="DoCopyUsername()" class="smalltext" disabled> diff --git a/www/scripts/main.js b/www/scripts/main.js index 93c3c83..36ac5f3 100644 --- a/www/scripts/main.js +++ b/www/scripts/main.js @@ -135,6 +135,31 @@ function GetData(id) return null; } +function FindNextPrevious() +{ + var rows = GetGroupRows(); + var f; + var ret = {prev: -1, next: -1}; + var prev = -1; + + for(f = 0; f < rows.length; f++) + { + if (rows[f].id == globalCurrentSelection) + { + ret.prev = prev; + + if (f < rows.length - 1) + { + ret.next = rows[f + 1].id; + } + } + + prev = rows[f].id; + } + + return ret; +} + function SetButtonState() { SetEnable("Add", true); @@ -142,6 +167,8 @@ function SetButtonState() SetEnable("Delete", globalCurrentSelection != -1); SetEnable("CopyUsername", globalCurrentSelection != -1); SetEnable("CopyPassword", globalCurrentSelection != -1); + SetEnable("Up", globalCurrentSelection != -1); + SetEnable("Down", globalCurrentSelection != -1); } function LoadGroups(keep_selection) @@ -356,6 +383,7 @@ function DoChangePassphrase() ); } + document.getElementById("PassPhrase").value = newphrase; document.getElementById("NewPassPhrase").value = ""; } } @@ -449,6 +477,8 @@ function DoEditAsync() } else { + globalCurrentGroup = response.group; + globalCurrentSelection = response.id; RefreshData(); } } @@ -564,28 +594,32 @@ function DoReorderAsync() function DoUp() { - var id = this.dataset.pmId; - var prev = this.dataset.pmPrevId; + var rec = FindNextPrevious(); - WebRequest("reorder.php", DoReorderAsync, - [ - "from_id", id, - "to_id", prev - ] - ); + if (rec.prev != -1) + { + WebRequest("reorder.php", DoReorderAsync, + [ + "from_id", globalCurrentSelection, + "to_id", rec.prev + ] + ); + } } function DoDown() { - var id = this.dataset.pmId; - var next = this.dataset.pmNextId; + var rec = FindNextPrevious(); - WebRequest("reorder.php", DoReorderAsync, - [ - "from_id", id, - "to_id", next - ] - ); + if (rec.next != -1) + { + WebRequest("reorder.php", DoReorderAsync, + [ + "from_id", globalCurrentSelection, + "to_id", rec.next + ] + ); + } } function DoShowPasswords() @@ -604,7 +638,6 @@ function DoShowPasswords() SetInputType("PassPhrase", type); SetInputType("NewPassPhrase", type); SetInputType("Password", type); - SetInputType("NewPassword", type); } // vim: sw=4 ts=4 |