[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>
<body onload="document.addform.post.focus();">
<div id="pageheader">
{include="page.header"} {include="page.header"}
<div id="headerform"> <div id="headerform">
<form method="GET" action="" name="addform" class="addform"> <form method="GET" action="" name="addform" class="addform">
<input type="text" name="post" style="width:50%;"> <input type="text" name="post">
<input type="submit" value="Add link" class="bigbutton"> <input type="submit" value="Add link" class="bigbutton">
</form> </form>
</div> </div>
</div> </div>
{include="page.footer"} {include="page.footer"}
</body> </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>
<body onload="document.changepasswordform.oldpassword.focus();">
<div id="pageheader">
{include="page.header"} {include="page.header"}
<form method="POST" action="" name="changepasswordform" id="changepasswordform"> <form method="POST" action="" name="changepasswordform" id="changepasswordform">
Old password: <input type="password" name="oldpassword">&nbsp; &nbsp; <p>
New password: <input type="password" name="setpassword"> <label for="oldpassword">Old password:</label>
<input type="password" name="oldpassword" id="oldpassword" />
</p>
<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="hidden" name="token" value="{$token}">
<input type="submit" name="Save" value="Save password" class="bigbutton"></form> <input type="submit" name="Save" value="Save password" class="bigbutton">
</div> </p>
{include="page.footer"} </form>
</body> </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>
{/if}
</head>
<body>
<div id="pageheader">
{include="page.header"} {include="page.header"}
<form method="POST" action="" name="changetag" id="changetag"> <form method="POST" action="" name="changetag" id="editlinkform">
<fieldset>
<legend>
Rename tag
</legend>
<p>
<label for="">Old tag :</label>
<input type="text" name="fromtag" class="fromtag" autofocus>
(Case sensitive)
</p>
<p>
<label>New tag :</label>
<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="hidden" name="token" value="{$token}">
Tag: <input type="text" name="fromtag" id="fromtag"> <input type="submit" name="deletetag" value="Delete tag" class="bigbutton" onClick="return confirmDeleteTag();">
<input type="text" name="totag" style="margin-left:40px;"><input type="submit" name="renametag" value="Rename tag" class="bigbutton"> </p>
&nbsp;&nbsp;or&nbsp; <input type="submit" name="deletetag" value="Delete tag" class="bigbutton" onClick="return confirmDeleteTag();"><br>(Case sensitive)</form> </fieldset>
<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> </form>
</div> <script language="JavaScript">
{include="page.footer"} function confirmDeleteTag() {
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"} var agree = confirm("Are you sure you want to delete this tag from all links ?");
<script language="JavaScript"> if (agree) {
$(document).ready(function() return true;
{ } else {
$('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1}); return false;
}); }
</script> }
{/if} </script>
</body> </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>