[chg] change rename/delete tag form

This commit is contained in:
Knah Tsaeb 2015-05-20 10:40:51 +02:00
parent 2e05b32a32
commit 3737a64ff3
5 changed files with 124 additions and 53 deletions

View file

@ -212,13 +212,13 @@ pre code {
align-items: flex-start; align-items: flex-start;
} }
.searchform input:nth-child(1), .tagfilter input:nth-child(1), .addform input:nth-child(1) { .searchform input:nth-child(1), .tagfilter input:nth-child(1), .addform input:nth-child(1){
order: 1; order: 1;
flex: 1 0 auto; flex: 1 0 auto;
align-self: stretch; align-self: stretch;
} }
.searchform input:nth-child(2), .tagfilter input:nth-child(2), .addform input:nth-child(2) { .searchform input:nth-child(2), .tagfilter input:nth-child(2), .addform input:nth-child(2){
order: 2; order: 2;
flex: 0 0 20%; flex: 0 0 20%;
align-self: stretch; align-self: stretch;
@ -310,6 +310,21 @@ pre code {
padding: 0; padding: 0;
} }
fieldset {
border: 1px solid #CDCDCD;
border-radius: 0.3em;
padding: 0.3em;
margin: 0.3em 0;
}
legend {
padding : 0 0.3em;
margin: 0 0 0 0.6em;
color : #FFFFFF;
font-weight: bolder;
}
p { p {
margin: 1em 0; margin: 1em 0;
} }

View file

@ -1473,7 +1473,7 @@ function renderPage()
// -------- User wants to rename a tag or delete it // -------- User wants to rename a tag or delete it
if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=changetag')) if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=changetag'))
{ {
if (empty($_POST['fromtag'])) if (empty($_POST['fromtag']) && empty($_POST['tagToDelete']))
{ {
$PAGE = new pageBuilder; $PAGE = new pageBuilder;
$PAGE->assign('linkcount',count($LINKSDB)); $PAGE->assign('linkcount',count($LINKSDB));
@ -1484,9 +1484,9 @@ function renderPage()
if (!tokenOk($_POST['token'])) die('Wrong token.'); if (!tokenOk($_POST['token'])) die('Wrong token.');
// Delete a tag: // Delete a tag:
if (!empty($_POST['deletetag']) && !empty($_POST['fromtag'])) if (!empty($_POST['deletetag']) && !empty($_POST['tagToDelete']))
{ {
$needle=trim($_POST['fromtag']); $needle=trim($_POST['tagToDelete']);
$linksToAlter = $LINKSDB->filterTags($needle,true); // true for case-sensitive tag search. $linksToAlter = $LINKSDB->filterTags($needle,true); // true for case-sensitive tag search.
foreach($linksToAlter as $key=>$value) foreach($linksToAlter as $key=>$value)
{ {

View file

@ -1,16 +1,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>{include="includes"}</head> <head>
<body onload="document.addform.post.focus();"> {include="includes"}
<div id="pageheader"> </head>
{include="page.header"} <body onload="document.addform.post.focus();">
<div id="headerform"> <div id="pageheader">
<form method="GET" action="" name="addform" class="addform"> {include="page.header"}
<input type="text" name="post" style="width:50%;"> <div id="headerform">
<input type="submit" value="Add link" class="bigbutton"> <form method="GET" action="" name="addform" class="addform">
</form> <input type="text" name="post">
</div> <input type="submit" value="Add link" class="bigbutton">
</div> </form>
{include="page.footer"} </div>
</body> </div>
{include="page.footer"}
</body>
</html> </html>

View file

@ -1,15 +1,26 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>{include="includes"}</head> <head>
<body onload="document.changepasswordform.oldpassword.focus();"> {include="includes"}
<div id="pageheader"> </head>
{include="page.header"} <body onload="document.changepasswordform.oldpassword.focus();">
<form method="POST" action="" name="changepasswordform" id="changepasswordform"> <div id="pageheader">
Old password: <input type="password" name="oldpassword">&nbsp; &nbsp; {include="page.header"}
New password: <input type="password" name="setpassword"> <form method="POST" action="" name="changepasswordform" id="changepasswordform">
<input type="hidden" name="token" value="{$token}"> <p>
<input type="submit" name="Save" value="Save password" class="bigbutton"></form> <label for="oldpassword">Old password:</label>
</div> <input type="password" name="oldpassword" id="oldpassword" />
{include="page.footer"} </p>
</body> <p>
<label for="setpassword">New password:</label>
<input type="password" name="setpassword" id="setpassword">
</p>
<p>
<input type="hidden" name="token" value="{$token}">
<input type="submit" name="Save" value="Save password" class="bigbutton">
</p>
</form>
</div>
{include="page.footer"}
</body>
</html> </html>

View file

@ -1,26 +1,69 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>{include="includes"} <head>
{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if} {include="includes"}
</head> {if="empty($GLOBALS['disablejquery'])"}
<body onload="document.changetag.fromtag.focus();"> <script src="inc/jquery.min.js#"></script>
<div id="pageheader"> <script src="inc/jquery-ui.min.js#"></script>
{include="page.header"} {/if}
<form method="POST" action="" name="changetag" id="changetag"> </head>
<input type="hidden" name="token" value="{$token}"> <body>
Tag: <input type="text" name="fromtag" id="fromtag"> <div id="pageheader">
<input type="text" name="totag" style="margin-left:40px;"><input type="submit" name="renametag" value="Rename tag" class="bigbutton"> {include="page.header"}
&nbsp;&nbsp;or&nbsp; <input type="submit" name="deletetag" value="Delete tag" class="bigbutton" onClick="return confirmDeleteTag();"><br>(Case sensitive)</form> <form method="POST" action="" name="changetag" id="editlinkform">
<script language="JavaScript">function confirmDeleteTag() { var agree=confirm("Are you sure you want to delete this tag from all links ?"); if (agree) return true ; else return false ; }</script> <fieldset>
</div> <legend>
{include="page.footer"} Rename tag
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"} </legend>
<script language="JavaScript"> <p>
$(document).ready(function() <label for="">Old tag :</label>
{ <input type="text" name="fromtag" class="fromtag" autofocus>
$('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1}); (Case sensitive)
}); </p>
</script> <p>
{/if} <label>New tag :</label>
</body> <input type="text" name="totag" class="fromtag">
</p>
<p class="submitButton">
<input type="submit" name="renametag" value="Rename tag" class="bigbutton">
</p>
</fieldset>
<fieldset>
<legend>
Delete tag
</legend>
<p>
<label for="">Tag :</label>
<input type="text" name="tagToDelete" class="fromtag">
(Case sensitive)
</p>
<p class="submitButton">
<input type="hidden" name="token" value="{$token}">
<input type="submit" name="deletetag" value="Delete tag" class="bigbutton" onClick="return confirmDeleteTag();">
</p>
</fieldset>
</form>
<script language="JavaScript">
function confirmDeleteTag() {
var agree = confirm("Are you sure you want to delete this tag from all links ?");
if (agree) {
return true;
} else {
return false;
}
}
</script>
</div>
{include="page.footer"}
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
<script language="JavaScript">
$(document).ready(function() {
$('.fromtag').autocomplete({
source : '{$source}?ws=singletag',
minLength : 1
});
});
</script>
{/if}
</body>
</html> </html>