Commit d605f19a authored by Jason Frisvold's avatar Jason Frisvold
Browse files

- Started working on editTags function for feeds

- Removed custom trim() function, using jQuery instead
- Remove extraneous functions
parent 1b7a2963
......@@ -85,7 +85,7 @@ hr.onethird { width: 33%; }
dd { line-height: 1.5em; margin-bottom: 1em; }
p.copyright { color: black; font-size: small; font-weight: normal; margin: 2px; }
div#backend_freetag_list { border: 1px dotted rgb(0, 0, 0); padding: 5px; font-size: 9px; white-space: normal; margin-bottom: 5px; }
.formdiv { width:75%; margin:auto; }
.formdiv { width: 75%; margin: auto; }
.formlabel { float: left; width: 15%; }
.formrow { clear: both; margin-bottom: 5px; }
.forminput { margin-left: 150px; }
......@@ -96,6 +96,8 @@ div#backend_freetag_list { border: 1px dotted rgb(0, 0, 0); padding: 5px; font-s
.error { border: 5px solid #FF0000; }
.editTags { color: blue; background-color: transparent; text-decoration: underline; cursor: pointer; }
#blanketDiv {
background-color:#111;
opacity: 0.65;
......@@ -120,3 +122,29 @@ div#backend_freetag_list { border: 1px dotted rgb(0, 0, 0); padding: 5px; font-s
height:300px;
z-index: 9002;
}
#blanket {
background-color : #111;
opacity : 0.65;
position: fixed;
z-index : 9001;
top : 0px;
left : 0px;
width : 100%;
height : 100%;
}
#popup {
position : fixed;
background-color : #eee;
width : 300px;
height : 350px;
z-index : 9002;
top : 150px;
left : 500px;
margin: auto;
overflow: scroll;
border: 5px solid black;
padding: 5px;
}
\ No newline at end of file
......@@ -78,9 +78,9 @@
}
} elseif ($_REQUEST['action'] == 'tagedit') {
assign_tags($smarty, $user_obj);
$output = $smarty->fetch('tag_edit.tpl');
$jsonarray = json_encode(Array('success' => 'true',
'output' => $output));
} elseif ($_REQUEST['action'] == 'save') {
......@@ -96,7 +96,7 @@
$phpTodo_dbPass, $phpTodo_dbName,
$user_obj->user_id());
}
$feed->name($_REQUEST['feed_name']);
$feed->secret($_REQUEST['feed_secret']);
$feed->priority_min($_REQUEST['feed_priority_min']);
......@@ -120,6 +120,13 @@
$jsonarray = json_encode(Array('success' => 'true',
'feed_id' => $feed_id));
} elseif ($_REQUEST['action'] == 'editTags') {
assign_tags($smarty, $user_obj);
$output = $smarty->fetch('taglist_edit.tpl');
$jsonarray = json_encode(Array('success' => 'true',
'output' => $output));
}
}
......
......@@ -54,6 +54,45 @@
});
});
// Bind the edit tags function to each edit link
$( '.editTags' ).each( function() {
$( this ).bind('click', function () {
//$('<div id="blanket"></div><div id="popup"></div>').appendTo('#blanketDiv2');
//$('#blanket').bind('click', function(){
// $('#popup').remove();
// $('#blanket').remove();
// if (window.needs_refresh){
// window.needs_refresh = false;
// location.reload();
// }
//});
//
//var lLeft = ($(window).width() / 4) + "px";
//var lTop = ($(window).height() / 4) + "px";
//$('#popup').css('top', lTop).css('left', lLeft).css('width', $(window).width() / 2 + 'px').css('height', $(window).height() / 2 + 'px');
trToEdit = $( this ).closest('tr');
$.ajax({
url: 'feeds_ajax.php',
dataType: 'json',
type: 'POST',
data: {action: 'editTags'},
success: function(data) {
if (data.success == 'true') {
trToEdit.after(data.output);
} else {
ajax_error(data.output);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
ajax_error(errorThrown);
}
});
});
});
// Bind the add function for new feeds
$( '#feedAdd' ).bind('click', function() {
$.ajax({
......@@ -262,42 +301,6 @@
$( this ).addClass('even')
});
}
///* Displays a tag edit dialog for adding/removing tags for a given feed */
//function editTags(tagCell) {
// new Ajax.Request('feeds_ajax.php',
// {
// method: 'post',
// parameters: {action: 'tagedit'},
// onSuccess: function (transport) {
// var json = transport.responseText.evalJSON(true)
// if (json.success == 'true') {
// var editDiv = $('editDiv');
// var blanketDiv = $('blanketDiv');
//
// var blanket_height = blanket_size();
// blanketDiv.style.height = blanket_height + 'px';
//
// popUpDiv_height = blanket_height / 2 - 150;
// editDiv.style.top = popUpDiv_height + 'px';
//
// var window_width = window_pos();
// window_width = window_width / 2 - 150;
// editDiv.style.left = window_width + 'px';
//
// editDiv.innerHTML = json.output;
// blanketDiv.style.display = 'block';
// editDiv.style.display = 'block';
//
// } else {
// ajax_error(json.error);
// }
// },
// onFailure: function() {
// ajax_error('Server returned a failure');
// }
// })
//}
function saveuser() {
var usernameRegex = /^[a-zA-Z0-9_\-]{1,15}$/;
......@@ -341,71 +344,23 @@
alert('Bad Stuff Happened - ' + errmsg);
}
function blanket_size() {
if (typeof window.innerWidth != 'undefined') {
viewportheight = window.innerHeight;
} else {
viewportheight = document.documentElement.clientHeight;
}
if ((viewportheight > document.body.parentNode.scrollHeight) &&
(viewportheight > document.body.parentNode.clientHeight)) {
blanket_height = viewportheight;
} else {
if (document.body.parentNode.clientHeight >
document.body.parentNode.scrollHeight) {
blanket_height = document.body.parentNode.clientHeight;
} else {
blanket_height = document.body.parentNode.scrollHeight;
}
}
return(blanket_height);
}
function window_pos() {
if (typeof window.innerWidth != 'undefined') {
viewportwidth = window.innerHeight;
} else {
viewportwidth = document.documentElement.clientHeight;
}
if ((viewportwidth > document.body.parentNode.scrollWidth) &&
(viewportwidth > document.body.parentNode.clientWidth)) {
window_width = viewportwidth;
} else {
if (document.body.parentNode.clientWidth >
document.body.parentNode.scrollWidth) {
window_width = document.body.parentNode.clientWidth;
} else {
window_width = document.body.parentNode.scrollWidth;
}
}
return(window_width);
}
function addTag(addTag) {
var freetags = $("tags").value.split(',');
var freetags = $( '#tags' ).val().split(',');
inList = false;
for (var freetag = 0; freetag < freetags.length; freetag++) {
if (freetags[freetag] &&
trim(freetags[freetag].toLowerCase()) == addTag.toLowerCase()) {
if (freetags[freetag] && freetags[freetag].toLowerCase().trim() == addTag.toLowerCase()) {
inList = true;
}
}
if (!inList) {
if ($("tags").value.lastIndexOf(',') == ($("tags").value.length-1)) {
if ($( '#tags' ).val().lastIndexOf( ',' ) == ( $( '#tags' ).val().length - 1) ) {
sepChar = '';
} else {
sepChar = ',';
}
$("tags").value = $("tags").value + sepChar + addTag;
$( '#tags' ).val( $( '#tags' ).val() + sepChar + addTag );
}
}
function trim(str) {
if (str) return str.replace(/^\\s*|\\s*$/g,"");
else return '';
}
\ No newline at end of file
}
\ No newline at end of file
......@@ -15,8 +15,6 @@
{* along with this program; if not, write to the Free Software *}
{* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* $Id$ */
$(window).load(function ()
{
var entry_dirty = false;
......@@ -183,7 +181,8 @@
inList = false;
for (var freetag = 0; freetag < freetags.length; freetag++) {
if (freetags[freetag] && trim(freetags[freetag].toLowerCase()) == addTag.toLowerCase()) {
if (freetags[freetag] &&
freetags[freetag].toLowerCase().trim() == addTag.toLowerCase()) {
inList = true;
}
}
......@@ -197,9 +196,4 @@
$( '#tags' ).val( $( '#tags' ).val() + sepChar + addTag );
}
}
function trim(str) {
if (str) return str.replace(/^\\s*|\\s*$/g,"");
else return '';
}
}
\ No newline at end of file
......@@ -15,8 +15,6 @@
{* along with this program; if not, write to the Free Software *}
{* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *}
{* $Id$ *}
<td>
{if (isset($row))}
<a href='feed.php?user_id={$user_id}&amp;secret={$row.feed_secret}&amp;feed_id={$row.feed_id}'>
......@@ -46,7 +44,8 @@
{html_options options=$status_list selected=$row.feed_status|default:""}
</select>
</td><td>
<a href='#' onclick='editTags(this);' style='font-size:small;'>Edit</a>
<!-- <a href='#' onclick='editTags(this);' style='font-size:small;'>Edit</a> -->
<span class='editTags'>Edit</span>
<input type='text' name='feed_tag_filter' value='{$row.feed_tag_filter|default:""}' />
</td><td>
<select name='feed_order'>
......
......@@ -15,8 +15,6 @@
{* along with this program; if not, write to the Free Software *}
{* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *}
{* $Id$ *}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
......@@ -29,7 +27,6 @@
<title>phpTodo</title>
</head>
<body>
<div id='blanketDiv' style='display:none;'></div>
<div id='editDiv' style='display:none;'></div>
{assign var=page value='prefs'}
{include file='header.tpl'}
......@@ -78,7 +75,7 @@
</form>
</div>
<hr class='onethird' />
<div>
<div id='formdiv'>
<h3>Web Feeds</h3>
<form id='feeds' method='post' action='prefs.php'>
<div class='centered'>
......@@ -174,5 +171,5 @@
{/if}
</div> -->
{include file='footer.tpl'}
</body>
</body>
</html>
{* phpTodo - Web based todo lists *}
{* Copyright (C) 2005-12 Jason Frisvold <friz@godshell.com> *}
{* *}
{* This program is free software; you can redisdivibute it and/or modify *}
{* it under the terms of the GNU General Public License as published by *}
{* the Free Software Foundation; either version 2 of the License, or *}
{* (at your option) any later version. *}
{* *}
{* This program is disdivibuted 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, write to the Free Software *}
{* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *}
<tr><td colspan='12'>
<div class='formrow'>
<div>Tags</div>
<div id="backend_freetag_list">
{assign var='first' value=''}
{foreach name=fetag from=$taglist item=row}
{if $first != $row.first}
<b>|{$row.first}:</b>
{/if}
<a href='#tagListAnchor' style='text-decoration: none' onClick='addTag("{$row.tag}")'>{$row.tag}</a>
{if ! $smarty.foreach.fetag.last}, {/if}
{assign var='first' value=$row.first}
{/foreach}
</div>
<div>
<input type='text' name='tags' id='tags' value='{$mytags|default:""}' style='width: 100%' />
</div>
</div>
</td></tr>
{* phpTodo - Web based todo lists *}
{* Copyright (C) 2005-12 Jason Frisvold <friz@godshell.com> *}
{* *}
{* This program is free software; you can redisdivibute it and/or modify *}
{* This program is free software; you can redisdivibute it and/or modify *}
{* it under the terms of the GNU General Public License as published by *}
{* the Free Software Foundation; either version 2 of the License, or *}
{* (at your option) any later version. *}
{* *}
{* This program is disdivibuted in the hope that it will be useful, *}
{* This program is disdivibuted 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. *}
......@@ -15,8 +15,6 @@
{* along with this program; if not, write to the Free Software *}
{* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *}
{* $Id$ *}
<!DOCTYPE html PUBLIC "-//W3C//Ddiv XHTML 1.0 Sdivict//EN" "http://www.w3.org/div/xhtml1/Ddiv/xhtml1-sdivict.ddiv">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
......
......@@ -15,8 +15,6 @@
{* along with this program; if not, write to the Free Software *}
{* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *}
{* $Id$ *}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment