diff options
-rw-r--r-- | phpfspot.class.php | 7 | ||||
-rw-r--r-- | phpfspot.js | 30 | ||||
-rw-r--r-- | rpc.php | 12 |
3 files changed, 33 insertions, 16 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index 0954040..8646ff1 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -643,6 +643,9 @@ class PHPFSPOT { if(!in_array($tag, $_SESSION['selected_tags'])) array_push($_SESSION['selected_tags'], $tag); + + + return "ok"; } // addTag() @@ -663,6 +666,8 @@ class PHPFSPOT { sort($_SESSION['selected_tags']); } + return "ok"; + } // delTag() /** @@ -1447,6 +1452,8 @@ class PHPFSPOT { { $_SESSION['tag_condition'] = $mode; + return "ok"; + } // setTagCondition() /** diff --git a/phpfspot.js b/phpfspot.js index c90d80e..ca3f9c0 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -12,24 +12,35 @@ function showCredits() function Tags(mode, id) { + var objTemp = new Object(); + if(mode == "add") { - // add the tag to users session - HTML_AJAX.grab(encodeURI('rpc.php?action=addtag&id=' + id)); + // add tag to users session + objTemp['action'] = 'addtag'; + objTemp['id'] = id; } else if(mode == "del") { - // del the tag from users session - HTML_AJAX.grab(encodeURI('rpc.php?action=deltag&id=' + id)); + // del tag from users session + objTemp['action'] = 'deltag'; + objTemp['id'] = id; } else if(mode == "condition") { setCheckedValue(id, id.value); - HTML_AJAX.grab(encodeURI('rpc.php?action=tagcondition&mode=' + id.value)); + objTemp['action'] = 'tagcondition'; + objTemp['mode'] = id.value; } - refreshAvailableTags(); - refreshSelectedTags(); - refreshPhotoIndex(); + var retr = HTML_AJAX.post('rpc.php', objTemp); + if(retr == "ok") { + refreshAvailableTags(); + refreshSelectedTags(); + refreshPhotoIndex(); + } + else { + window.alert(retr); + } -} +} // Tags() function refreshAvailableTags() { @@ -101,7 +112,6 @@ function startSearch() to_day = document.getElementById('today').value; to = to_year +"-"+ to_month +"-"+ to_day; - // Create object with values of the form var objTemp = new Object(); objTemp['action'] = 'search'; @@ -67,14 +67,14 @@ class PHPFSPOT_RPC { break; case 'addtag': - if(isset($_GET['id']) && is_numeric($_GET['id'])) { - $fspot->addTag($_GET['id']); + if(isset($_POST['id']) && is_numeric($_POST['id'])) { + print $fspot->addTag($_POST['id']); } break; case 'deltag': - if(isset($_GET['id']) && is_numeric($_GET['id'])) { - $fspot->delTag($_GET['id']); + if(isset($_POST['id']) && is_numeric($_POST['id'])) { + print $fspot->delTag($_POST['id']); } break; @@ -87,8 +87,8 @@ class PHPFSPOT_RPC { break; case 'tagcondition': - if(isset($_GET['mode']) && in_array($_GET['mode'], Array('or', 'and'))) { - $fspot->setTagCondition($_GET['mode']); + if(isset($_POST['mode']) && in_array($_POST['mode'], Array('or', 'and'))) { + print $fspot->setTagCondition($_POST['mode']); } break; |