summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/edit.php2
-rw-r--r--www/get.php3
-rw-r--r--www/index.html9
-rw-r--r--www/scripts/main.js67
4 files changed, 63 insertions, 18 deletions
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