diff options
Diffstat (limited to 'data/templates')
-rw-r--r-- | data/templates/admin.tpl.php | 2 | ||||
-rw-r--r-- | data/templates/bookmarkcommondescriptionedit.tpl.php | 3 | ||||
-rw-r--r-- | data/templates/bookmarklet.inc.php | 117 | ||||
-rw-r--r-- | data/templates/bookmarks.tpl.php | 34 | ||||
-rw-r--r-- | data/templates/dynamictags.inc.php | 73 | ||||
-rw-r--r-- | data/templates/editbookmark.tpl.php | 156 | ||||
-rw-r--r-- | data/templates/editprofile.tpl.php | 8 | ||||
-rw-r--r-- | data/templates/sidebar.block.linked.php | 133 | ||||
-rw-r--r-- | data/templates/sidebar.block.menu.php | 6 | ||||
-rw-r--r-- | data/templates/sidebar.block.menu2.php | 71 | ||||
-rw-r--r-- | data/templates/sidebar.block.recent.php | 2 | ||||
-rw-r--r-- | data/templates/sidebar.block.search.php | 2 | ||||
-rw-r--r-- | data/templates/sidebar.block.users.php | 4 | ||||
-rw-r--r-- | data/templates/sidebar.block.watchlist.php | 8 | ||||
-rw-r--r-- | data/templates/tag2tagadd.tpl.php | 2 | ||||
-rw-r--r-- | data/templates/tagcommondescriptionedit.tpl.php | 3 | ||||
-rw-r--r-- | data/templates/tagrename.tpl.php | 4 | ||||
-rw-r--r-- | data/templates/top.inc.php | 17 | ||||
-rw-r--r-- | data/templates/users.tpl.php | 9 |
19 files changed, 396 insertions, 258 deletions
diff --git a/data/templates/admin.tpl.php b/data/templates/admin.tpl.php index c8d47e8..50680f6 100644 --- a/data/templates/admin.tpl.php +++ b/data/templates/admin.tpl.php @@ -11,7 +11,7 @@ foreach($users as $user) { echo '<div class="link">';
echo '<a href="'.createURL('profile', $user->getUsername()).'">'.$user->getUsername().'</a>'; - echo ' - <span title='. T_('Public/Shared/Private') .'>'. $user->getNbBookmarks('public') .' / '. $user->getNbBookmarks('shared') .' / '. $user->getNbBookmarks('private') .' '. T_('bookmark(s)') .'</span>';
+ echo ' - <span title="'. T_('Public/Shared/Private') .'">'. $user->getNbBookmarks('public') .' / '. $user->getNbBookmarks('shared') .' / '. $user->getNbBookmarks('private') .' '. T_('bookmark(s)') .'</span>';
echo '</div>';
if($user->getUsername() != $currentUser->getUsername()) {
diff --git a/data/templates/bookmarkcommondescriptionedit.tpl.php b/data/templates/bookmarkcommondescriptionedit.tpl.php index af5909a..807c58b 100644 --- a/data/templates/bookmarkcommondescriptionedit.tpl.php +++ b/data/templates/bookmarkcommondescriptionedit.tpl.php @@ -30,7 +30,8 @@ window.onload = function() { if(strlen($description['cdDatetime'])>0) { echo T_('Last modification:').' '.$description['cdDatetime'].', '; $lastUser = $userservice->getUser($description['uId']); - echo '<a href="'.createURL('profile', $lastUser['username']).'">'.$lastUser['username'].'</a>'; + echo '<a href="'.createURL('profile', $lastUser['username']).'">' + . SemanticScuttle_Model_UserArray::getName($lastUser) . '</a>'; } ?> </td> diff --git a/data/templates/bookmarklet.inc.php b/data/templates/bookmarklet.inc.php new file mode 100644 index 0000000..9867745 --- /dev/null +++ b/data/templates/bookmarklet.inc.php @@ -0,0 +1,117 @@ +<h3><?php echo T_('Bookmarklet'); ?></h3> +<p id="bookmarklet"></p> +<script type="text/javascript"> +//<![CDATA[ +var browser = navigator.appName; +jQuery(function($) { +if (browser == "Opera") { + $('#bookmarklet').append( + <?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'] + ) + ); ?> + ); +} else { + $('#bookmarklet').append( + <?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'] + ) + ); + ?> + ); +} +}); +//]]> +</script> +<script type="text/javascript"> +//<![CDATA[ +var selection = ''; +if (window.getSelection) { + selection = 'window.getSelection()'; +} else if (document.getSelection) { + selection = 'document.getSelection()'; +} else if (document.selection) { + selection = 'document.selection.createRange().text'; +} +if (browser == "Opera") { + $('#bookmarklet').append( + '<ul>' + + '<li>' + + '<a class="bookmarklet" href="' + + '<?php +$popupLink = 'javascript:' + . "location.href='" + . createURL('bookmarks', $GLOBALS['user']) + . '?action=add' + . "&address='+encodeURIComponent(document.location.href)+'" + . "&title='+encodeURIComponent(document.title)+'" + . "&description='+encodeURIComponent(SELECTION)" + . ";"; +$link = 'opera:/button/' + //Opera command + . 'Go to page' + //command parameter 1 + . ',"' . rawurlencode($popupLink) . '"' + //command parameter 2 + . ',' + //button title + . ',"Post to ' . fixOperaButtonName($GLOBALS['sitename']) . '"' + //button icon name + . ',"Scuttle"'; +echo jsEscTitle(htmlspecialchars($link)); +?>'.replace('SELECTION', selection) + + '"><?php echo jsEscTitle(sprintf(T_('Post to %s'), $GLOBALS['sitename'])); ?></a>' + + '</li>' + + '<li>' + + '<a class="bookmarklet" href="' + + '<?php +$popupLink = 'javascript:' + . 'open(' + . "'" . createURL('bookmarks', $GLOBALS['user']) + . '?action=add' + . '&popup=1' + . "&address='+encodeURIComponent(document.location.href)+'" + . "&title='+encodeURIComponent(document.title)+'" + . "&description='+encodeURIComponent(SELECTION)" + . "," + . "'" . htmlspecialchars(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"; +$link = 'opera:/button/' + . 'Go to page' + . ',"' . rawurlencode($popupLink) . '"' + . ',' + . ',"Post to ' . fixOperaButtonName($GLOBALS['sitename']) . ' (Pop-up)"' + . ',"Scuttle"'; +echo jsEscTitle(htmlspecialchars($link)); +?>'.replace('SELECTION', selection) + + '"><?php echo jsEscTitle(sprintf(T_('Post to %s (Pop-up)'), $GLOBALS['sitename'])); ?></a>' + + '</li>' + + '</ul>' + ); +} else { + $('#bookmarklet').append( + '<ul>' + + '<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&address=\'+a+\'&title=\'+t+\'&description=\'+d;void 0;"><?php echo jsEscTitle(sprintf(T_('Post to %s'), $GLOBALS['sitename'])); ?><\/a><\/li>' + + '<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&popup=1&address=\'+a+\'&title=\'+t+\'&description=\'+d,\'<?php echo htmlspecialchars(jsEscTitleDouble($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>' + + '</ul>' + ); +} +//]]> +</script> diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php index e32d3c9..55d6a0f 100644 --- a/data/templates/bookmarks.tpl.php +++ b/data/templates/bookmarks.tpl.php @@ -62,12 +62,16 @@ if($currenttag!= '' && $cdservice->getLastTagDescription($currenttag)) { } //common tag description edit -if($userservice->isLoggedOn()) { - if($currenttag!= '' && ($GLOBALS['enableCommonTagDescriptionEditedByAll'] || $currentUser->isAdmin())) { +if ($userservice->isLoggedOn()) { + if ($currenttag != '' + && ($GLOBALS['enableCommonTagDescriptionEditedByAll'] + || $currentUser->isAdmin() + ) + ) { echo ' <a href="'. createURL('tagcommondescriptionedit', $currenttag).'" title="'.T_('Edit the common description of this tag').'">'; echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):''; echo ' <img src="'.ROOT.'images/b_edit.png" /></a>'; - } elseif(isset($hash)) { + } else if (isset($hash)) { echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $hash).'" title="'.T_('Edit the common description of this bookmark').'">'; echo T_('Edit the common description of this bookmark').'</a>)'; } @@ -117,33 +121,33 @@ $votingSort = 'voting_desc'; switch(getSortOrder()) { case 'date_asc': - $dateArrow = ' ↑'; + $dateArrow = ' ↑'; $dateSort = 'date_desc'; break; case 'title_asc': - $titleArrow = ' ↑'; + $titleArrow = ' ↑'; $titleSort = 'title_desc'; break; case 'title_desc': - $titleArrow = ' ↓'; + $titleArrow = ' ↓'; $titleSort = 'title_asc'; break; case 'voting_asc': - $votingArrow = ' ↑'; + $votingArrow = ' ↑'; $votingSort = 'voting_desc'; break; case 'voting_desc': - $votingArrow = ' ↓'; + $votingArrow = ' ↓'; $votingSort = 'voting_asc'; break; case 'date_desc': default: - $dateArrow = ' ↓'; + $dateArrow = ' ↓'; $dateSort = 'date_asc'; break; } @@ -292,10 +296,9 @@ if ($currenttag!= '') { $edit = ' - <a href="' . createURL('edit', $row['bId']) . '">' . T_('Edit') . '</a>' - . '<script type="text/javascript">' - . 'document.write(" - <a href=\"#\" onclick=\"deleteBookmark(this, '. $row['bId'] .'); return false;\">' + . ' <a href="#" onclick="deleteBookmark(this, '. $row['bId'] .'); return false;">' . T_('Delete') - .'<\/a>");</script>'; + .'</a>'; } // Last update @@ -309,10 +312,11 @@ if ($currenttag!= '') { $copy .= T_('you'); } else { $copy .= '<a href="' . createURL('bookmarks', $row['username']) . '">' - . $row['username'] . '</a>'; + . SemanticScuttle_Model_UserArray::getName($row) + . '</a>'; } - // Udders! + // others if (!isset($hash)) { $others = $otherCounts[$row['bAddress']]; $ostart = '<a href="' . createURL('history', $row['bHash']) . '">'; @@ -390,7 +394,7 @@ if ($currenttag!= '') { echo ' <div' . $adminBgClass . '>' . "\n"; echo ' <div class="link">' - . '<a href="'. $address .'"'. $rel .' class="taggedlink" target="_blank">' + . '<a href="'. htmlspecialchars($address) .'"'. $rel .' class="taggedlink">' . filter($row['bTitle']) . '</a>' . $adminStar . "</div>\n"; if ($row['bDescription'] == '') { diff --git a/data/templates/dynamictags.inc.php b/data/templates/dynamictags.inc.php index b18565b..8cf07c1 100644 --- a/data/templates/dynamictags.inc.php +++ b/data/templates/dynamictags.inc.php @@ -36,28 +36,40 @@ $allPopularTagsCount = count($allPopularTags); // function printing the cloud -function writeTagsProposition($tagsCloud, $title) { - echo 'document.write(\'<div class="collapsible">\');'; - echo 'document.write(\'<h3>'. $title .'<\/h3>\');'; - echo 'document.write(\'<p id="popularTags" class="tags">\');'; +function writeTagsProposition($tagsCloud, $title) +{ + static $id = 0; + ++$id; + + echo <<<JS + $('.edit-tagclouds') + .append( +'<div class="collapsible" id="edit-tagcloud-$id">' ++ ' <h3>$title</h3>' ++ ' <p class="popularTags tags"></p>' ++ '</div>'); +JS; $taglist = ''; - foreach(array_keys($tagsCloud) as $key) { - $row =& $tagsCloud[$key]; + foreach (array_keys($tagsCloud) as $key) { + $row = $tagsCloud[$key]; $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); - $taglist .= '<span title="'. $row['bCount'] .' '. $entries .'" style="font-size:'. $row['size'] .'" onclick="addTag(this)">'. filter($row['tag']) .'<\/span> '; + $taglist .= '<span' + . ' title="'. $row['bCount'] . ' ' . $entries . '"' + . ' style="font-size:' . $row['size'] . '"' + . ' onclick="addTag(this)">' + . filter($row['tag']) + . '</span> '; } - - echo 'document.write(\''. $taglist .'\');'; - echo 'document.write(\'<\/p>\');'; - echo 'document.write(\'<\/div>\');'; - + echo '$(\'#edit-tagcloud-' . $id . ' p\').append(' + . json_encode($taglist) + . ");\n"; } if ($allPopularTagsCount > 0 || $userPopularTagsCount > 0 ) { ?> - <script type="text/javascript"> +//<![CDATA[ Array.prototype.contains = function (ele) { for (var i = 0; i < this.length; i++) { if (this[i] == ele) { @@ -87,20 +99,26 @@ function addonload(addition) { } } -addonload( - function () { - var taglist = document.getElementById('tags'); - var tags = taglist.value.split(', '); +jQuery(function($) { +<?php +if ($userPopularTagsCount > 0) { + writeTagsProposition($userPopularTagsCloud, T_('Popular Tags')); +} +if ($allPopularTagsCount > 0) { + writeTagsProposition($allPopularTagsCloud, T_('Popular Tags From All Users')); +} +?> + var taglist = $('#tags'); + var tags = taglist.val().split(', '); - var populartags = document.getElementById('popularTags').getElementsByTagName('span'); + var populartags = $('.edit-tagclouds span'); for (var i = 0; i < populartags.length; i++) { if (tags.contains(populartags[i].innerHTML)) { populartags[i].className = 'selected'; } } - } -); +}); function addTag(ele) { var thisTag = ele.innerHTML; @@ -122,20 +140,9 @@ function addTag(ele) { document.getElementById('tags').focus(); } - -<?php -if( $userPopularTagsCount > 0) { - writeTagsProposition($userPopularTagsCloud, T_('Popular Tags')); -} -if( $allPopularTagsCount > 0) { - writeTagsProposition($allPopularTagsCloud, T_('Popular Tags From All Users')); -} - - -?> - +//]]> </script> - +<div class="edit-tagclouds"></div> <?php } ?> 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>← <?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>← <?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>← <?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>← <?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>← <?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&address=\'+a+\'&title=\'+t+\'&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&popup=1&address=\'+a+\'&title=\'+t+\'&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&address=\'+a+\'&title=\'+t+\'&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&popup=1&address=\'+a+\'&title=\'+t+\'&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> diff --git a/data/templates/editprofile.tpl.php b/data/templates/editprofile.tpl.php index b55d250..2a3c3b8 100644 --- a/data/templates/editprofile.tpl.php +++ b/data/templates/editprofile.tpl.php @@ -3,9 +3,7 @@ $this->includeTemplate($GLOBALS['top_include']); ?> <form action="<?php echo $formaction; ?>" method="post"> -<input type="hidden" name="token" value="<?php echo $token; ?>"> - -</table> +<input type="hidden" name="token" value="<?php echo $token; ?>"/> <h3><?php echo T_('Account Details'); ?></h3> @@ -28,7 +26,7 @@ $this->includeTemplate($GLOBALS['top_include']); <tr> <th align="left"><?php echo T_('E-mail'); ?></th> <td><input type="text" name="pMail" size="75" value="<?php echo filter($objectUser->getEmail(), 'xml'); ?>" /></td> - <td>← <?php echo T_('Required'); ?></td> + <td>← <?php echo T_('Required'); ?></td> </tr> </table> @@ -58,7 +56,7 @@ $this->includeTemplate($GLOBALS['top_include']); <th align="left"><?php echo T_('Export bookmarks'); ?></th> <td> <a href="../api/export_html.php"><?php echo T_('HTML file (for browsers)')?></a> / - <a href="../api/posts/all"><?php echo T_('XML file (like del.icio.us)')?></a> / + <a href="../api/posts_all.php"><?php echo T_('XML file (like del.icio.us)')?></a> / <a href="../api/export_csv.php"><?php echo T_('CSV file (for spreadsheet tools)')?></a> </td> </tr> diff --git a/data/templates/sidebar.block.linked.php b/data/templates/sidebar.block.linked.php index 9e91f93..9aa3cc0 100644 --- a/data/templates/sidebar.block.linked.php +++ b/data/templates/sidebar.block.linked.php @@ -1,4 +1,11 @@ <?php +/* + * Used in: + * - populartags.php + * - bookmarks.php + * - alltags.php + * - tags.php + */ /* Service creation: only useful services are created */ $tag2tagservice =SemanticScuttle_Service_Factory::get('Tag2Tag'); @@ -8,98 +15,52 @@ require_once('sidebar.linkedtags.inc.php'); $user = isset($user)?$user:''; $userid = isset($userid)?$userid:0; $currenttag = isset($currenttag)?$currenttag:''; -$summarizeLinkedTags = isset($summarizeLinkedTags)?$summarizeLinkedTags:false; - +//$summarizeLinkedTags = isset($summarizeLinkedTags)?$summarizeLinkedTags:false; $logged_on_userid = $userservice->getCurrentUserId(); -if ($logged_on_userid === false) { - $logged_on_userid = NULL; -} - -$explodedTags = array(); -if (strlen($currenttag)>0) { - $explodedTags = explode('+', $currenttag); -} else { - if($summarizeLinkedTags == true) { - $orphewTags = $tag2tagservice->getOrphewTags('>', $userid, 4, "nb"); - } else { - $orphewTags = $tag2tagservice->getOrphewTags('>', $userid); - } - - foreach($orphewTags as $orphewTag) { - $explodedTags[] = $orphewTag['tag']; - } -} - +$editingMode = $logged_on_userid !== false; ?> - +<h2><?php echo T_('Linked Tags'); ?></h2> +<div id="related"> <?php -if(($logged_on_userid != null) && ($userid === $logged_on_userid)) { - $editingMode = true; -} else { - $editingMode = false; -} - -$this->includeTemplate("dojo.inc"); -?> - -<?php if(count($explodedTags)>0 || $editingMode):?> - -<h2><?php - - -echo T_('Linked Tags').' '; -//if($userid != null) { -$cUser = $userservice->getUser($userid); -//echo '<small><a href="'.createURL('alltags', $cUser['username']).'">('.T_('all tags').')</a></small>'; -//} -?></h2> -<?php //endif?> - -<div id="related"> <?php -if($editingMode) { +if ($editingMode) { echo '<p style="margin-bottom: 13px;text-align:center;">'; echo ' (<a href="'. createURL('tag2tagadd','') .'" rel="tag">'.T_('Add new link').'</a>) '; echo ' (<a href="'. createURL('tag2tagdelete','') .'" rel="tag">'.T_('Delete link').'</a>)'; echo '</p>'; } - -if(strlen($user)==0) { - $cat_url = createURL('tags', '%2$s'); -} - -$stopList = array(); -foreach($explodedTags as $explodedTag) { - if(!in_array($explodedTag, $stopList)) { - - - - // fathers tag - $fatherTags = $tag2tagservice->getLinkedTags($explodedTag, '>', $userid, true); - if(count($fatherTags)>0) { - foreach($fatherTags as $fatherTag) { - echo '<a href="'. sprintf($cat_url, filter($user, 'url'), filter($fatherTag, 'url')) .'" rel="tag">('. filter($fatherTag) .')</a> '; - } - } - /* - $displayLinkedTags = displayLinkedTags($explodedTag, '>', $userid, $cat_url, $user, $editingMode, null, 1); - echo $displayLinkedTags['output']; - if(is_array($displayLinkedTags['stopList'])) { - $stopList = array_merge($stopList, $displayLinkedTags['stopList']); - }*/ - echo '<div dojoType="dojo.data.ItemFileReadStore" url="'.ROOT.'ajax/getlinkedtags.php?tag='.filter($explodedTag, 'url').'&uId='.$userid.'" jsid="linkedTagStore" ></div>'; - echo '<div dojoType="dijit.Tree" store="linkedTagStore" labelAttr="name" >'; - echo '<script type="dojo/method" event="onClick" args="item">'; - $returnUrl = sprintf($cat_url, filter($user, 'url'), filter('', 'url')); - echo 'window.location = "'.$returnUrl.'"+item.name'; - echo '</script>'; - echo '<script type="dojo/method" event="getLabelClass" args="item">'; - echo 'return \'treeTag\';'; - echo '</script>'; - echo '</div>'; - } - -} -?> </div> - -<?php endif?> +?> + <div id="related-content"></div> + <script type="text/javascript">//<![CDATA[ +jQuery("#related-content") +.jstree({ + "themes" : { + "theme": "default", + "dots": false, + "icons": true, + "url": '<?php echo ROOT_JS ?>themes/default/style.css' + }, + "json_data" : { + "ajax" : { + "url": function(node) { + //-1 is root + parentparam = ""; + if (node == -1 ) { + node = <?php echo json_encode($currenttag); ?>; + parentparam = "&parent=true"; + } else if (node.attr('rel')) { + node = node.attr('rel'); + } else { + return; + } + + return "<?php echo ROOT ?>ajax/getlinkedtags.php?tag=" + node + + parentparam; + } + } + }, + plugins : [ "themes", "json_data"] +}); +//]]> + </script> +</div>
\ No newline at end of file diff --git a/data/templates/sidebar.block.menu.php b/data/templates/sidebar.block.menu.php index ee82997..94a9fa2 100644 --- a/data/templates/sidebar.block.menu.php +++ b/data/templates/sidebar.block.menu.php @@ -65,13 +65,13 @@ if (sizeof($menuTags) > 0 || ($userid != 0 && $userid === $logged_on_userid)) { <?php $cUser = $userservice->getUser($userid); ?> <?php if($userid>0): ?> <?php if($userid==$logged_on_userid): ?> -<p style="text-align:right"><a href="<?php echo createURL('alltags', $cUser['username']); ?>" title="<?php echo T_('See all your tags')?>"><?php echo T_('all your tags'); ?></a> →</p> +<p style="text-align:right"><a href="<?php echo createURL('alltags', $cUser['username']); ?>" title="<?php echo T_('See all your tags')?>"><?php echo T_('all your tags'); ?></a> →</p> <?php else: ?> -<p style="text-align:right"><a href="<?php echo createURL('alltags', $cUser['username']); ?>" title="<?php echo T_('See all tags from this user')?>"><?php echo T_('all tags from this user'); ?></a> →</p> +<p style="text-align:right"><a href="<?php echo createURL('alltags', $cUser['username']); ?>" title="<?php echo T_('See all tags from this user')?>"><?php echo T_('all tags from this user'); ?></a> →</p> <?php endif; ?> <?php else : ?> -<p style="text-align:right"><a href="<?php echo createURL('populartags', $cUser['username']); ?>" title="<?php echo T_('See popular tags')?>"><?php echo T_('Popular Tags'); ?></a> →</p> +<p style="text-align:right"><a href="<?php echo createURL('populartags', $cUser['username']); ?>" title="<?php echo T_('See popular tags')?>"><?php echo T_('Popular Tags'); ?></a> →</p> <?php endif; ?> </div> diff --git a/data/templates/sidebar.block.menu2.php b/data/templates/sidebar.block.menu2.php index 5f06b40..1c177a5 100644 --- a/data/templates/sidebar.block.menu2.php +++ b/data/templates/sidebar.block.menu2.php @@ -1,7 +1,4 @@ <?php -/* Service creation: only useful services are created */ -$tag2tagservice =SemanticScuttle_Service_Factory::get('Tag2Tag'); - require_once('sidebar.linkedtags.inc.php'); /* Manage input */ @@ -15,44 +12,60 @@ if ($logged_on_userid === false) { } -$cat_url = createURL('tags', '%2$s'); +$cat_url = createURL('tags', '%s'); $menu2Tags = $GLOBALS['menu2Tags']; -if (sizeOf($menu2Tags) > 0) { - $this->includeTemplate("dojo.inc"); - ?> +if (count($menu2Tags) > 0) { +?> <h2><?php echo T_('Featured Menu Tags');?></h2> <div id="maintagsmenu" <?php echo 'title="'.T_('This menu is composed of keywords (tags) organized by admins.').'"'?>> - + <ul> <?php -foreach($menu2Tags as $menu2Tag) { - - echo '<div dojoType="dojo.data.ItemFileReadStore" url="'.ROOT.'ajax/getadminlinkedtags.php?tag='.filter($menu2Tag, 'url').'" jsid="linkedTagStore" ></div>'; - echo '<div dojoType="dijit.Tree" store="linkedTagStore" labelAttr="name" >'; - echo '<script type="dojo/method" event="onClick" args="item">'; - $returnUrl = sprintf($cat_url, filter($user, 'url'), filter('', 'url')); - echo 'window.location = "'.$returnUrl.'"+item.name'; - echo '</script>'; - //echo '<script type="dojo/method" event="getLabel" args="item">'; - //echo 'return item.name + "...";'; - //echo '</script>'; - //echo '<script type="dojo/method" event="onMouseOver" args="item">'; - //echo 'i = item.relatedTarget;'; - //echo 'if(i.innerHTML.charAt(i.innerHTML)=="a") alert(i.innerHTML)'; - //echo '</script>'; - //echo '<script type="dojo/method" event="getLabelClass" args="item">'; - //echo 'return \'treeTag\';'; - //echo '</script>'; - echo '</div>'; +//this is unneeded and replaced by the ajax tree anyway. we keep it for +// non-js browsers +foreach ($menu2Tags as $menu2Tag) { + echo ' <li>' + . sprintf( + '<a href="%s">%s</a>', + sprintf($cat_url, $menu2Tag), + $menu2Tag + ) + . '</li>' . "\n"; } ?> + </ul> </div> - - +<script type="text/javascript"> +jQuery("#maintagsmenu") +.jstree({ + "themes" : { + "theme": "default", + "dots": false, + "icons": true, + "url": '<?php echo ROOT_JS ?>themes/default/style.css' + }, + "json_data" : { + "ajax" : { + "url": function(node) { + //-1 is root + if (node == -1 ) { + node = ""; + } else if (node.attr('rel')) { + node = node.attr('rel'); + } else { + return; + } + return "<?php echo ROOT ?>ajax/getadminlinkedtags.php?tag=" + node; + } + } + }, + plugins : [ "themes", "json_data"] +}); +</script> <?php } ?> diff --git a/data/templates/sidebar.block.recent.php b/data/templates/sidebar.block.recent.php index e34f820..1ffeb4d 100644 --- a/data/templates/sidebar.block.recent.php +++ b/data/templates/sidebar.block.recent.php @@ -31,7 +31,7 @@ if ($recentTags && count($recentTags) > 0) { } echo $contents ."</p>\n"; ?> - <p style="text-align:right"><a href="<?php echo createURL('populartags'); ?>"><?php echo T_('Popular Tags'); ?></a> →</p> + <p style="text-align:right"><a href="<?php echo createURL('populartags'); ?>"><?php echo T_('Popular Tags'); ?></a> →</p> </div> <?php diff --git a/data/templates/sidebar.block.search.php b/data/templates/sidebar.block.search.php index f4e6b42..d3cd8a5 100644 --- a/data/templates/sidebar.block.search.php +++ b/data/templates/sidebar.block.search.php @@ -34,7 +34,7 @@ foreach ($lastSearches as $row) { echo '<a href="' . htmlspecialchars(createURL('search', $range.'/'.$row['shTerms'])) . '">'; - echo $row['shTerms']; + echo htmlspecialchars($row['shTerms']); echo '</a>'; echo ' <span title="' . T_('Number of bookmarks for this query') diff --git a/data/templates/sidebar.block.users.php b/data/templates/sidebar.block.users.php index 3ad18bc..58fdfb7 100644 --- a/data/templates/sidebar.block.users.php +++ b/data/templates/sidebar.block.users.php @@ -18,7 +18,7 @@ if ($lastUsers && count($lastUsers) > 0) { foreach ($lastUsers as $row) { echo '<tr><td>'; echo '<a href="'.createURL('profile', $row['username']).'">'; - echo $row['username']; + echo SemanticScuttle_Model_UserArray::getName($row); echo '</a>'; echo ' (<a href="'.createURL('bookmarks', $row['username']).'">'.T_('bookmarks').'</a>)'; echo '</td></tr>'; @@ -27,7 +27,7 @@ foreach ($lastUsers as $row) { ?> </table> -<p style="text-align:right"><a href="<?php echo createURL('users'); ?>" title="<?php echo T_('See all users')?>"><?php echo T_('All users'); ?></a> →</p> +<p style="text-align:right"><a href="<?php echo createURL('users'); ?>" title="<?php echo T_('See all users')?>"><?php echo T_('All users'); ?></a> →</p> </div> <?php } diff --git a/data/templates/sidebar.block.watchlist.php b/data/templates/sidebar.block.watchlist.php index 07b7f15..3af9c5a 100644 --- a/data/templates/sidebar.block.watchlist.php +++ b/data/templates/sidebar.block.watchlist.php @@ -16,7 +16,7 @@ foreach($watching as $watchuser) { ?> <?php if(count($closeContacts)>0):?> -<h2 title="<?php echo T_('Close contacts are mutual contacts');?>"><?php echo ' ↔ '. T_('Close contacts'); ?></h2> +<h2 title="<?php echo T_('Close contacts are mutual contacts');?>"><?php echo ' ↔ '. T_('Close contacts'); ?></h2> <div id="watching"> <ul> <?php foreach($closeContacts as $watchuser): ?> @@ -27,7 +27,7 @@ foreach($watching as $watchuser) { <?php endif; ?> -<h2><?php echo ' → '. T_('Watching'); ?></h2> +<h2><?php echo ' → '. T_('Watching'); ?></h2> <div id="watching"> <ul> <?php if($userservice->isLoggedOn() && $currentUser->getUsername() == $user): ?> @@ -41,7 +41,7 @@ foreach($watching as $watchuser) { <?php foreach($watching as $watchuser): ?> <li><a href="<?php echo createURL('bookmarks', $watchuser); ?>"><?php echo $watchuser; ?></a> <?php if($userservice->isLoggedOn() && $currentUser->getUsername() == $user): ?> - - <a href="<?php echo createUrl('watch','?contact='.$watchuser); ?>" title="<?php echo T_('Remove this contact'); ?>">x<a/> + - <a href="<?php echo createUrl('watch','?contact='.$watchuser); ?>" title="<?php echo T_('Remove this contact'); ?>">x</a> </li> <?php endif; ?> <?php endforeach; ?> @@ -49,7 +49,7 @@ foreach($watching as $watchuser) { </ul> </div> -<h2><?php echo ' ← '. T_('Watched By'); ?></h2> +<h2><?php echo ' ← '. T_('Watched By'); ?></h2> <div id="watching"> <ul> <?php foreach($watchedBy as $watchuser): ?> diff --git a/data/templates/tag2tagadd.tpl.php b/data/templates/tag2tagadd.tpl.php index fcbd372..9482007 100644 --- a/data/templates/tag2tagadd.tpl.php +++ b/data/templates/tag2tagadd.tpl.php @@ -4,7 +4,7 @@ $this->includeTemplate($GLOBALS['top_include']); <form action="<?php echo $formaction; ?>" method="post"> -<p align=right" style="float:right"> +<p align="right" style="float:right"> <small style="text-align:right"><?php echo T_('Note: use "=" to make synonym two tags. e.g.: france=frenchcountry')?></small><br/> <small style="text-align:right"><?php echo T_('Note: use ">" to include one tag in another. e.g.: europe>france>paris')?></small><br/> </p> diff --git a/data/templates/tagcommondescriptionedit.tpl.php b/data/templates/tagcommondescriptionedit.tpl.php index d3a006a..f938f93 100644 --- a/data/templates/tagcommondescriptionedit.tpl.php +++ b/data/templates/tagcommondescriptionedit.tpl.php @@ -20,7 +20,8 @@ window.onload = function() { if(strlen($description['cdDatetime'])>0) { echo T_('Last modification:').' '.$description['cdDatetime'].', '; $lastUser = $userservice->getUser($description['uId']); - echo '<a href="'.createURL('profile', $lastUser['username']).'">'.$lastUser['username'].'</a>'; + echo '<a href="' . createURL('profile', $lastUser['username']) . '">' + . SemanticScuttle_Model_UserArray::getName($lastUser) . '</a>'; } ?> </td> diff --git a/data/templates/tagrename.tpl.php b/data/templates/tagrename.tpl.php index ea8b516..894b964 100644 --- a/data/templates/tagrename.tpl.php +++ b/data/templates/tagrename.tpl.php @@ -11,12 +11,12 @@ window.onload = function() { <tr> <th align="left"><?php echo T_('Old'); ?></th> <td><input type="text" name="old" id="old" value="<?php echo $old; ?>" /></td> - <td>← <?php echo T_('Required'); ?></td> + <td>← <?php echo T_('Required'); ?></td> </tr> <tr> <th align="left"><?php echo T_('New'); ?></th> <td><input type="text" name="new" id="new" value="" /></td> - <td>← <?php echo T_('Required'); ?></td> + <td>← <?php echo T_('Required'); ?></td> </tr> <tr> <td></td> diff --git a/data/templates/top.inc.php b/data/templates/top.inc.php index b1ffa14..bdd4b1a 100644 --- a/data/templates/top.inc.php +++ b/data/templates/top.inc.php @@ -1,7 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> <title><?php echo filter($GLOBALS['sitename'] .(isset($pagetitle) ? ' » ' . $pagetitle : '')); ?></title> <link rel="icon" type="image/png" href="<?php echo ROOT ?>icon.png" /> <link rel="stylesheet" type="text/css" href="<?php echo ROOT ?>scuttle.css" /> @@ -17,17 +18,19 @@ if (isset($rsschannels)) { } ?> - <link rel="stylesheet" type="text/css" - href="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dijit/themes/nihilo/nihilo.css" /> - <?php if (isset($loadjs)) :?> +<?php if (DEBUG_MODE) : ?> + <script type="text/javascript" src="<?php echo ROOT_JS ?>jquery-1.4.2.js"></script> + <script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.jstree.js"></script> +<?php else: ?> + <script type="text/javascript" src="<?php echo ROOT_JS ?>jquery-1.4.2.min.js"></script> + <script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.jstree.min.js"></script> +<?php endif ?> <script type="text/javascript" src="<?php echo ROOT ?>jsScuttle.php"></script> <?php endif ?> </head> - - <body class="nihilo"> -<!-- the class is used by Dojo widgets --> + <body> <?php $headerstyle = ''; diff --git a/data/templates/users.tpl.php b/data/templates/users.tpl.php index c209f94..fa92bef 100644 --- a/data/templates/users.tpl.php +++ b/data/templates/users.tpl.php @@ -14,7 +14,14 @@ if ($users && count($users) > 0) { <?php $contents = '<'; foreach ($users as $row) { - echo '<li><strong>'.$row['username'].'</strong> (<a href="'.createURL('profile', $row['username']).'">'.T_('profile').'</a> '.T_('created in').' '.date('M Y',strtotime($row['uDatetime'])).') : <a href="'.createURL('bookmarks', $row['username']).'">'.T_('bookmarks').'</a></li>'; + echo '<li><strong>' + . SemanticScuttle_Model_UserArray::getName($row) . '</strong>' + . ' (<a href="' . createURL('profile', $row['username']) . '">' + . T_('profile') . '</a> ' + . T_('created in') . ' ' + . date('M Y', strtotime($row['uDatetime'])) . ')' + . ' : <a href="' . createURL('bookmarks', $row['username']).'">' + . T_('bookmarks') . '</a></li>'; } ?> </ul> |