summaryrefslogtreecommitdiff
path: root/data/templates/editbookmark.tpl.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-05-02 18:07:15 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-05-02 18:07:15 +0200
commit8be81abfe6193e221afcdc35582d34505797a7b8 (patch)
tree95ae7e30d40596f27875adb2f96a15fc827f9f86 /data/templates/editbookmark.tpl.php
parentf629d081ddf52e3cb83ffbfc973a97adc691790c (diff)
parent40b4674e471f8b0fbdc77a26eec86018e2ab03ea (diff)
downloadsemanticscuttle-8be81abfe6193e221afcdc35582d34505797a7b8.tar.gz
semanticscuttle-8be81abfe6193e221afcdc35582d34505797a7b8.tar.bz2
merge master
Diffstat (limited to 'data/templates/editbookmark.tpl.php')
-rw-r--r--data/templates/editbookmark.tpl.php156
1 files changed, 91 insertions, 65 deletions
diff --git a/data/templates/editbookmark.tpl.php b/data/templates/editbookmark.tpl.php
index 25524b9..8b71230 100644
--- a/data/templates/editbookmark.tpl.php
+++ b/data/templates/editbookmark.tpl.php
@@ -16,33 +16,41 @@ switch ($row['bStatus']) {
break;
}
-$this->includeTemplate("dojo.inc");
-
function jsEscTitle($title)
{
return addcslashes($title, "'");
}
-?>
-
-
+function jsEscTitleDouble($title)
+{
+ return addcslashes(addcslashes($title, "'"), "'\\");
+}
+function fixOperaButtonName($name) {
+ //yes, opera has problems with double quotes in button names
+ return str_replace('"', "''", $name);
+}
-<script type="text/javascript">
-//window.onload = function() {
-// document.getElementById("address").focus();
-//}
-</script>
+if (is_array($row['tags'])) {
+ $row['tags'] = implode(', ', $row['tags']);
+}
+$ajaxUrl = ROOT . 'ajax/'
+ . (
+ ($GLOBALS['adminsAreAdvisedTagsFromOtherAdmins'] && $currentUser->isAdmin())
+ ? 'getadmintags'
+ : 'getcontacttags'
+ ) . '.php';
+?>
<form action="<?php echo $formaction; ?>" method="post">
<table>
<tr>
<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>&#8592; <?php echo T_('Required'); ?></td>
+ <td>← <?php echo T_('Required'); ?></td>
</tr>
<tr>
<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>&#8592; <?php echo T_('Required'); ?></td>
+ <td>← <?php echo T_('Required'); ?></td>
</tr>
<tr>
<th align="left">
@@ -50,7 +58,7 @@ function jsEscTitle($title)
<a onclick="var nz = document.getElementById('privateNoteZone'); nz.style.display='';this.style.display='none';"><?php echo T_("Add Note"); ?></a>
</th>
<td><textarea name="description" id="description" rows="5" cols="63" ><?php echo filter($row['bDescription'], 'xml'); ?></textarea></td>
- <td>&#8592; <?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): ?>
<br /><br />
<?php echo T_('Suggested anchors: '); ?>
@@ -67,19 +75,19 @@ function jsEscTitle($title)
<tr id="privateNoteZone" <?php if(strlen($row['bPrivateNote'])==0):?>style="display:none"<?php endif; ?>>
<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>&#8592; <?php echo T_('Just visible by you and your contacts.'); ?>
+ <td>← <?php echo T_('Just visible by you and your contacts.'); ?>
</td>
</tr>
<tr>
<th align="left"><?php echo T_('Tags'); ?></th>
<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"/></td>
- <td>&#8592; <?php echo T_('Comma-separated'); ?></td>
+ <input type="text" id="tags" name="tags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
+ </td>
+ <td>← <?php echo T_('Comma-separated'); ?></td>
</tr>
<tr>
<th></th>
- <td align="right"><small><?php echo T_('Note: use ">" to include one tag in another. e.g.: europe>france>paris')?></small></td>
+ <td align="right"><small><?php echo htmlspecialchars(T_('Note: use ">" to include one tag in another. e.g.: europe>france>paris'))?></small></td>
</tr>
<tr>
<th></th>
@@ -124,65 +132,83 @@ function jsEscTitle($title)
?>
</td>
<td></td>
-</tr>
-</table>
+ </tr>
+ </table>
</form>
-<?php
-// Dynamic tag selection
-$this->includeTemplate('dynamictags.inc');
+<link href="<?php echo ROOT ?>js/jquery-ui-1.8.11/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css"/>
-// Bookmarklets and import links
-if (empty($_REQUEST['popup']) && (!isset($showdelete) || !$showdelete)) {
-?>
-
-<h3><?php echo T_('Bookmarklet'); ?></h3>
+<script type="text/javascript" src="<?php echo ROOT ?>js/jquery-ui-1.8.11/jquery.ui.core.js"></script>
+<script type="text/javascript" src="<?php echo ROOT ?>js/jquery-ui-1.8.11/jquery.ui.widget.js"></script>
+<script type="text/javascript" src="<?php echo ROOT ?>js/jquery-ui-1.8.11/jquery.ui.position.js"></script>
+<script type="text/javascript" src="<?php echo ROOT ?>js/jquery-ui-1.8.11/jquery.ui.autocomplete.js"></script>
<script type="text/javascript">
//<![CDATA[
-var browser=navigator.appName;
-if (browser == "Opera") {
- document.write('<p>' +
- <?php echo json_encode(
- sprintf(
- T_("Click one of the following bookmarklets to add a button you can click whenever you want to add the page you are on to %s"),
- $GLOBALS['sitename']
- )
- ); ?> + ':</p>'
- );
-} else {
- document.write('<p>' +
- <?php echo json_encode(
- sprintf(
- T_("Drag one of the following bookmarklets to your browser's bookmarks and click it whenever you want to add the page you are on to %s"),
- $GLOBALS['sitename']
- )
- );
- ?> + ':</p>'
- );
-}
-var selection = '';
-if (window.getSelection) {
- selection = 'window.getSelection()';
-} else if (document.getSelection) {
- selection = 'document.getSelection()';
-} else if (document.selection) {
- selection = 'document.selection.createRange().text';
-}
-document.write('<ul>');
-if (browser == "Opera")
+jQuery(document).ready(function() {
+ function split(val)
{
- document.write('<li><a class="bookmarklet" href="opera:/button/Go%20to%20page,%20%22javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');location.href=\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&amp;address=\'+a+\'&amp;title=\'+t+\'&amp;description=\'+d;void 0%22;,,%22Post%20to%20<?php echo jsEscTitle($GLOBALS['sitename']); ?>%22,%22Scuttle%22"><?php echo jsEscTitle(sprintf(T_('Post to %s'), $GLOBALS['sitename'])); ?><\/a><\/li>');
- document.write('<li><a class="bookmarklet" href="opera:/button/Go%20to%20page,%20%22javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');open(\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&amp;popup=1&amp;address=\'+a+\'&amp;title=\'+t+\'&amp;description=\'+d,\'<?php echo jsEscTitle($GLOBALS['sitename']); ?>\',\'modal=1,status=0,scrollbars=1,toolbar=0,resizable=1,width=790,height=465,left=\'+(screen.width-790)/2+\',top=\'+(screen.height-425)/2);void 0;%22,,%22Post%20to%20<?php echo urlencode($GLOBALS['sitename']); ?>%20(Pop-up)%22,%22Scuttle%22"><?php echo jsEscTitle(sprintf(T_('Post to %s (Pop-up)'), $GLOBALS['sitename'])); ?><\/a><\/li>');
+ return val.split(/[,=><]\s*/);
}
-else
+
+ function extractLast(term)
{
- document.write('<li><a class="bookmarklet" href="javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');location.href=\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&amp;address=\'+a+\'&amp;title=\'+t+\'&amp;description=\'+d;void 0;"><?php echo jsEscTitle(sprintf(T_('Post to %s'), $GLOBALS['sitename'])); ?><\/a><\/li>');
- document.write('<li><a class="bookmarklet" href="javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');open(\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&amp;popup=1&amp;address=\'+a+\'&amp;title=\'+t+\'&amp;description=\'+d,\'<?php echo jsEscTitle($GLOBALS['sitename']); ?>\',\'modal=1,status=0,scrollbars=1,toolbar=0,resizable=1,width=790,height=465,left=\'+(screen.width-790)/2+\',top=\'+(screen.height-425)/2);void 0;"><?php echo jsEscTitle(sprintf(T_('Post to %s (Pop-up)'), $GLOBALS['sitename'])); ?><\/a><\/li>');
+ return split(term).pop();
}
-document.write('<\/ul>');
+ //var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"];
+
+ jQuery("input#tags").autocomplete({
+ autoFocus: true,
+ minLength: 1,
+
+ source: function(request, response) {
+ // delegate back to autocomplete, but extract the last term
+ var term = extractLast(request.term);
+ if (term.length < this.options.minLength) {
+ return;
+ }
+ response(
+ /*
+ $.ui.autocomplete.filter(
+ availableTags, extractLast(request.term)
+ )
+ */
+ $.getJSON(
+ "<?php echo $ajaxUrl; ?>",
+ { beginsWith: term },
+ response
+ )
+ );
+ },
+
+ focus: function() {
+ // prevent value inserted on focus
+ return false;
+ },
+ select: function(event, ui) {
+ var terms = split(this.value);
+ // remove the current input
+ terms.pop();
+ // add the selected item
+ terms.push(ui.item.value);
+ // add placeholder to get the comma-and-space at the end
+ terms.push("");
+ this.value = terms.join(", ");
+ return false;
+ }
+ });
+});
//]]>
</script>
+<?php
+// Dynamic tag selection
+$this->includeTemplate('dynamictags.inc');
+
+// Bookmarklets and import links
+if (empty($_REQUEST['popup']) && (!isset($showdelete) || !$showdelete)) {
+
+$this->includeTemplate('bookmarklet.inc.php');
+?>
<h3><?php echo T_('Import'); ?></h3>
<ul>
<li><a href="<?php echo createURL('importNetscape'); ?>"><?php echo T_('Import bookmarks from bookmark file'); ?></a> (<?php echo T_('Internet Explorer, Mozilla Firefox and Netscape'); ?>)</li>