prepare jquery autocomplete (does not work yet)

This commit is contained in:
Christian Weiske 2011-03-17 08:46:15 +01:00
parent 6e46a9329e
commit 8146646a0e
3 changed files with 26 additions and 26 deletions

View file

@ -26,12 +26,12 @@ function jsEscTitle($title)
<tr> <tr>
<th align="left"><?php echo T_('Address'); ?></th> <th align="left"><?php echo T_('Address'); ?></th>
<td><input type="text" id="address" name="address" size="75" maxlength="65535" value="<?php echo filter($row['bAddress'], 'xml'); ?>" onblur="useAddress(this)" /></td> <td><input type="text" id="address" name="address" size="75" maxlength="65535" value="<?php echo filter($row['bAddress'], 'xml'); ?>" onblur="useAddress(this)" /></td>
<td>&larr; <?php echo T_('Required'); ?></td> <td> <?php echo T_('Required'); ?></td>
</tr> </tr>
<tr> <tr>
<th align="left"><?php echo T_('Title'); ?></th> <th align="left"><?php echo T_('Title'); ?></th>
<td><input type="text" id="titleField" name="title" size="75" maxlength="255" value="<?php echo filter($row['bTitle'], 'xml'); ?>" onkeypress="this.style.backgroundImage = 'none';" /></td> <td><input type="text" id="titleField" name="title" size="75" maxlength="255" value="<?php echo filter($row['bTitle'], 'xml'); ?>" onkeypress="this.style.backgroundImage = 'none';" /></td>
<td>&larr; <?php echo T_('Required'); ?></td> <td> <?php echo T_('Required'); ?></td>
</tr> </tr>
<tr> <tr>
<th align="left"> <th align="left">
@ -39,7 +39,7 @@ function jsEscTitle($title)
<a onclick="var nz = document.getElementById('privateNoteZone'); nz.style.display='';this.style.display='none';"><?php echo T_("Add Note"); ?></a> <a onclick="var nz = document.getElementById('privateNoteZone'); nz.style.display='';this.style.display='none';"><?php echo T_("Add Note"); ?></a>
</th> </th>
<td><textarea name="description" id="description" rows="5" cols="63" ><?php echo filter($row['bDescription'], 'xml'); ?></textarea></td> <td><textarea name="description" id="description" rows="5" cols="63" ><?php echo filter($row['bDescription'], 'xml'); ?></textarea></td>
<td>&larr; <?php echo T_('You can use anchors to delimite attributes. for example: [publisher]blah[/publisher] '); ?> <td> <?php echo T_('You can use anchors to delimite attributes. for example: [publisher]blah[/publisher] '); ?>
<?php if(count($GLOBALS['descriptionAnchors'])>0): ?> <?php if(count($GLOBALS['descriptionAnchors'])>0): ?>
<br /><br /> <br /><br />
<?php echo T_('Suggested anchors: '); ?> <?php echo T_('Suggested anchors: '); ?>
@ -56,19 +56,15 @@ function jsEscTitle($title)
<tr id="privateNoteZone" <?php if(strlen($row['bPrivateNote'])==0):?>style="display:none"<?php endif; ?>> <tr id="privateNoteZone" <?php if(strlen($row['bPrivateNote'])==0):?>style="display:none"<?php endif; ?>>
<th align="left"><?php echo T_('Private Note'); ?></th> <th align="left"><?php echo T_('Private Note'); ?></th>
<td><textarea name="privateNote" id="privateNote" rows="1" cols="63" ><?php echo filter($row['bPrivateNote'], 'xml'); ?></textarea></td> <td><textarea name="privateNote" id="privateNote" rows="1" cols="63" ><?php echo filter($row['bPrivateNote'], 'xml'); ?></textarea></td>
<td>&larr; <?php echo T_('Just visible by you and your contacts.'); ?> <td> <?php echo T_('Just visible by you and your contacts.'); ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<th align="left"><?php echo T_('Tags'); ?></th> <th align="left"><?php echo T_('Tags'); ?></th>
<td class="scuttletheme"> <td class="scuttletheme">
<!--
<span dojoType="dojo.data.ItemFileReadStore" jsId="memberTagStore" url="<?php echo ROOT?>ajax/<?php echo ($GLOBALS['adminsAreAdvisedTagsFromOtherAdmins'] && $currentUser->isAdmin())?'getadmintags':'getcontacttags'?>.php"></span>
<input type="text" dojoType="js.MultiComboBox" id="tags" name="tags" size="75" value="<?php echo filter(implode(', ', $row['tags']), 'xml'); ?>" store="memberTagStore" delimiter="," searchAttr="tag" hasDownArrow="false" queryExpr="*${0}*" autoComplete="false" highlightMatch="all"/>
-->
<input type="text" id="tags" name="tags" size="75" value="<?php echo filter(implode(', ', $row['tags']), 'xml'); ?>"/> <input type="text" id="tags" name="tags" size="75" value="<?php echo filter(implode(', ', $row['tags']), 'xml'); ?>"/>
</td> </td>
<td>&larr; <?php echo T_('Comma-separated'); ?></td> <td> <?php echo T_('Comma-separated'); ?></td>
</tr> </tr>
<tr> <tr>
<th></th> <th></th>
@ -104,7 +100,7 @@ function jsEscTitle($title)
echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $row['bHash']).'">'; echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $row['bHash']).'">';
echo T_('edit common description').'</a>)'; echo T_('edit common description').'</a>)';
} }
if ($popup) { if ($popup) {
?> ?>
<input type="hidden" name="popup" value="1" /> <input type="hidden" name="popup" value="1" />
@ -135,7 +131,6 @@ jQuery(document).ready(function() {
}); });
</script> </script>
<?php <?php
// Dynamic tag selection // Dynamic tag selection
//FIXME$this->includeTemplate('dynamictags.inc'); //FIXME$this->includeTemplate('dynamictags.inc');
@ -204,5 +199,5 @@ else if (false)
<?php <?php
} }
$this->includeTemplate($GLOBALS['bottom_include']); $this->includeTemplate($GLOBALS['bottom_include']);
?> ?>

View file

@ -27,18 +27,20 @@ require_once '../www-header.php';
$b2tservice =SemanticScuttle_Service_Factory::get('Bookmark2Tag'); $b2tservice =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$bookmarkservice =SemanticScuttle_Service_Factory::get('Tag'); $bookmarkservice =SemanticScuttle_Service_Factory::get('Tag');
$listTags = $b2tservice->getContactTags(
$userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId()
);
$tags = array();
foreach($listTags as $t) {
$tags[] = array(
'caption' => $t['tag'],
'value' => $t['tag'],
);
}
echo json_encode($tags);
?> ?>
{identifier:"tag",
items: [
<?php
$listTags = $b2tservice->getContactTags($userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId());
foreach($listTags as $t) {
echo "{tag: \"".$t['tag']."\"},";
}
?>
]}

View file

@ -41,7 +41,6 @@ isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('PO
isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', ''); isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
isset($_POST['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', ''); isset($_POST['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', '');
isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', ''); isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', ''); isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_POPUP', ''); isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_POPUP', '');
@ -50,6 +49,10 @@ isset($_POST['popup']) ? define('POST_POPUP', $_POST['popup']): define('POST_POP
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0); isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', ''); isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
if (!isset($_POST['tags'])) {
$_POST['tags'] = array();
}
//echo '<p>' . var_export($_POST, true) . '</p>';die();
if ((GET_ACTION == "add") && !$userservice->isLoggedOn()) { if ((GET_ACTION == "add") && !$userservice->isLoggedOn()) {
@ -143,7 +146,7 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
$description = trim(POST_DESCRIPTION); $description = trim(POST_DESCRIPTION);
$privateNote = trim(POST_PRIVATENOTE); $privateNote = trim(POST_PRIVATENOTE);
$status = intval(POST_STATUS); $status = intval(POST_STATUS);
$categories = trim(POST_TAGS); $categories = trim(implode(',', $_POST['tags']));
$saved = true; $saved = true;
if ($bookmarkservice->addBookmark($address, $title, $description, $privateNote, $status, $categories)) { if ($bookmarkservice->addBookmark($address, $title, $description, $privateNote, $status, $categories)) {
if (POST_POPUP != '') { if (POST_POPUP != '') {
@ -184,10 +187,10 @@ if ($templatename == 'editbookmark.tpl') {
'bAddress' => stripslashes(POST_ADDRESS), 'bAddress' => stripslashes(POST_ADDRESS),
'bDescription' => stripslashes(POST_DESCRIPTION), 'bDescription' => stripslashes(POST_DESCRIPTION),
'bPrivateNote' => stripslashes(POST_PRIVATENOTE), 'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
'tags' => (POST_TAGS ? explode(',', stripslashes(POST_TAGS)) : array()), 'tags' => ($_POST['tags'] ? $_POST['tags'] : array()),
'bStatus' => 0, 'bStatus' => 0,
); );
$tplVars['tags'] = POST_TAGS; $tplVars['tags'] = $_POST['tags'];
} else { } else {
if(GET_COPYOF != '') { //copy from bookmarks page if(GET_COPYOF != '') { //copy from bookmarks page
$tplVars['row'] = $bookmarkservice->getBookmark(intval(GET_COPYOF), true); $tplVars['row'] = $bookmarkservice->getBookmark(intval(GET_COPYOF), true);