diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-25 15:57:29 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-25 15:57:29 +0000 |
commit | 15b91c7e661d928d8b125ec9cfbda1702319c8b4 (patch) | |
tree | 092d474c05e414bb04a8c428b8ff6cb9ccab765d /templates | |
parent | 9aafe7551eb5a73739709e72465031db7a1531b4 (diff) | |
download | semanticscuttle-15b91c7e661d928d8b125ec9cfbda1702319c8b4.tar.gz semanticscuttle-15b91c7e661d928d8b125ec9cfbda1702319c8b4.tar.bz2 |
Major refactoring: transform user into object, define parameters used into each file, ...
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@173 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'templates')
-rw-r--r-- | templates/about.tpl.php | 13 | ||||
-rw-r--r-- | templates/bookmarkcommondescriptionedit.tpl.php | 7 | ||||
-rw-r--r-- | templates/bookmarks.tpl.php | 20 | ||||
-rw-r--r-- | templates/editbookmark.tpl.php | 8 | ||||
-rw-r--r-- | templates/editprofile.tpl.php | 8 | ||||
-rw-r--r-- | templates/profile.tpl.php | 14 | ||||
-rw-r--r-- | templates/sidebar.block.common.php | 26 | ||||
-rw-r--r-- | templates/sidebar.block.popular.php | 7 | ||||
-rw-r--r-- | templates/sidebar.block.recent.php | 2 | ||||
-rw-r--r-- | templates/sidebar.block.related.php | 7 | ||||
-rw-r--r-- | templates/top.inc.php | 3 | ||||
-rw-r--r-- | templates/userlist.tpl.php | 19 |
12 files changed, 76 insertions, 58 deletions
diff --git a/templates/about.tpl.php b/templates/about.tpl.php index 3f3cbe3..a4bc718 100644 --- a/templates/about.tpl.php +++ b/templates/about.tpl.php @@ -1,9 +1,13 @@ <?php -$this->includeTemplate($GLOBALS['top_include']); +/* Service creation: only useful services are created */ $userservice =& ServiceFactory::getServiceInstance('UserService'); -$currentUser = $userservice->getCurrentUser(); -$currentUserId = $userservice->getCurrentUserId(); +//$currentUser = $userservice->getCurrentUser(); +//$currentUserId = $userservice->getCurrentUserId(); + +$currentObjectUser = $userservice->getCurrentObjectUser(); + +$this->includeTemplate($GLOBALS['top_include']); ?> <ul> @@ -20,9 +24,10 @@ $currentUserId = $userservice->getCurrentUserId(); -<?php if(!is_null($currentUser) && $userservice->isAdmin($currentUserId)): ?> +<?php if(!is_null($currentObjectUser) && $currentObjectUser->isAdmin()): ?> <li>SemanticScuttle v0.91</li> <?php endif ?> + </ul> <?php diff --git a/templates/bookmarkcommondescriptionedit.tpl.php b/templates/bookmarkcommondescriptionedit.tpl.php index 39f20ae..053ee30 100644 --- a/templates/bookmarkcommondescriptionedit.tpl.php +++ b/templates/bookmarkcommondescriptionedit.tpl.php @@ -1,7 +1,12 @@ <?php -$this->includeTemplate($GLOBALS['top_include']); +/* Service creation: only useful services are created */ $userservice = & ServiceFactory :: getServiceInstance('UserService'); + +$this->includeTemplate($GLOBALS['top_include']); + list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']); + + ?> <script type="text/javascript"> window.onload = function() { diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php index 475436b..ce34634 100644 --- a/templates/bookmarks.tpl.php +++ b/templates/bookmarks.tpl.php @@ -6,8 +6,6 @@ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); $tagservice =& ServiceFactory::getServiceInstance('TagService'); $cdservice =& ServiceFactory::getServiceInstance('CommonDescriptionService'); - - //$logged_on_userid = $userservice->getCurrentUserId(); //$currentUser = $userservice->getCurrentUser(); //$currentUsername = $currentUser[$userservice->getFieldName('username')]; @@ -28,10 +26,13 @@ include('search.inc.php'); <?php -if((isset($currenttag) && $GLOBALS['enableCommonTagDescription']) +// common tag description +if((isset($currenttag) && $currenttag!= '' && $GLOBALS['enableCommonTagDescription']) || (isset($hash) && $GLOBALS['enableCommonBookmarkDescription'])):?> + + <p class="commondescription"><?php -if(isset($currenttag) && $cdservice->getLastTagDescription($currenttag)) { +if(isset($currenttag) && $currenttag!= '' && $cdservice->getLastTagDescription($currenttag)) { $description = $cdservice->getLastTagDescription($currenttag); echo nl2br(filter($description['cdDescription'])); } elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) { @@ -40,8 +41,9 @@ if(isset($currenttag) && $cdservice->getLastTagDescription($currenttag)) { echo nl2br(filter($description['cdDescription'])). "<br/>"; } +//common tag description edit if($userservice->isLoggedOn()) { - if(isset($currenttag)) { + if(isset($currenttag) && $currenttag!= '') { echo ' (<a href="'. createURL('tagcommondescriptionedit', $currenttag).'">'; echo T_('edit common description').'</a>)'; } elseif(isset($hash)) { @@ -55,7 +57,7 @@ if($userservice->isLoggedOn()) { <?php /* Private tag description */ -if(isset($currenttag) && isset($user)) { +if(isset($currenttag) && $currenttag!= '' && isset($user)) { $userObject = $userservice->getUserByUsername($user); if($tagservice->getDescription($currenttag, $userObject['uId'])) { ?> @@ -87,7 +89,7 @@ if (!isset($hash)) { <?php } ?> <?php -if(isset($currenttag)) { +if(isset($currenttag) && $currenttag!= '') { if(isset($user)) { echo ' - '; echo '<a href="'. createURL('tags', $currenttag) .'">'; @@ -216,8 +218,8 @@ if(isset($currenttag)) { // Ordering $sortOrder = ''; - if (isset($_GET['sort'])) { - $sortOrder = 'sort='. $_GET['sort']; + if (GET_SORT != '') { + $sortOrder = 'sort='. GET_SORT; } $sortAmp = (($sortOrder) ? '&'. $sortOrder : ''); diff --git a/templates/editbookmark.tpl.php b/templates/editbookmark.tpl.php index c947ec3..b112455 100644 --- a/templates/editbookmark.tpl.php +++ b/templates/editbookmark.tpl.php @@ -47,8 +47,6 @@ switch ($row['bStatus']) { <input type="text" dojoType="dojox.form.MultiComboBox" id="tags" name="tags" size="75" value="<?php echo filter(implode(', ', $row['tags']), 'xml'); ?>" store="memberTagStore" delimiter="," searchAttr="tag" hasDownArrow="false"/></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> @@ -73,7 +71,7 @@ switch ($row['bStatus']) { <td> <input type="submit" name="submitted" value="<?php echo $btnsubmit; ?>" /> <?php - if ($showdelete) { + if (isset($showdelete) && $showdelete) { ?> <input type="submit" name="delete" value="<?php echo T_('Delete Bookmark'); ?>" /> <?php @@ -82,7 +80,7 @@ switch ($row['bStatus']) { ?> <input type="hidden" name="popup" value="1" /> <?php - } elseif ($referrer) { + } elseif (isset($referrer)) { ?> <input type="hidden" name="referrer" value="<?php echo $referrer; ?>" /> <?php @@ -99,7 +97,7 @@ switch ($row['bStatus']) { $this->includeTemplate('dynamictags.inc'); // Bookmarklets and import links -if (empty($_REQUEST['popup']) && !$showdelete) { +if (empty($_REQUEST['popup']) && (!isset($showdelete) || !$showdelete)) { ?> <h3><?php echo T_('Bookmarklet'); ?></h3> diff --git a/templates/editprofile.tpl.php b/templates/editprofile.tpl.php index 055aab0..6e548ba 100644 --- a/templates/editprofile.tpl.php +++ b/templates/editprofile.tpl.php @@ -27,7 +27,7 @@ $this->includeTemplate($GLOBALS['top_include']); </tr> <tr> <th align="left"><?php echo T_('E-mail'); ?></th> - <td><input type="text" name="pMail" size="75" value="<?php echo filter($row['email'], 'xml'); ?>" /></td> + <td><input type="text" name="pMail" size="75" value="<?php echo filter($objectUser->getEmail(), 'xml'); ?>" /></td> <td>← <?php echo T_('Required'); ?></td> </tr> </table> @@ -37,15 +37,15 @@ $this->includeTemplate($GLOBALS['top_include']); <table class="profile"> <tr> <th align="left"><?php echo T_('Name'); ?></th> - <td><input type="text" name="pName" size="75" value="<?php echo filter($row['name'], 'xml'); ?>" /></td> + <td><input type="text" name="pName" size="75" value="<?php echo filter($objectUser->getName(), 'xml'); ?>" /></td> </tr> <tr> <th align="left"><?php echo T_('Homepage'); ?></th> - <td><input type="text" name="pPage" size="75" value="<?php echo filter($row['homepage']); ?>" /></td> + <td><input type="text" name="pPage" size="75" value="<?php echo filter($objectUser->getHomepage()); ?>" /></td> </tr> <tr> <th align="left"><?php echo T_('Description'); ?></th> - <td><textarea name="pDesc" cols="75" rows="10"><?php echo $row['uContent']; ?></textarea></td> + <td><textarea name="pDesc" cols="75" rows="10"><?php echo $objectUser->getContent(); ?></textarea></td> </tr> <tr> <th></th> diff --git a/templates/profile.tpl.php b/templates/profile.tpl.php index e3e44ab..a544fb4 100644 --- a/templates/profile.tpl.php +++ b/templates/profile.tpl.php @@ -7,26 +7,26 @@ $this->includeTemplate($GLOBALS['top_include']); <dt><?php echo T_('Username'); ?></dt> <dd><?php echo $user; ?></dd> <?php -if ($row['name'] != "") { +if ($objectUser->getName() != "") { ?> <dt><?php echo T_('Name'); ?></dt> - <dd><?php echo filter($row['name']); ?></dd> + <dd><?php echo filter($objectUser->getName()); ?></dd> <?php } -if ($row['homepage'] != "") { +if ($objectUser->getHomepage() != "") { ?> <dt><?php echo T_('Homepage'); ?></dt> - <dd><a href="<?php echo filter($row['homepage']); ?>"><?php echo filter($row['homepage']); ?></a></dd> + <dd><a href="<?php echo filter($objectUser->getHomepage()); ?>"><?php echo filter($objectUser->getHomepage()); ?></a></dd> <?php } ?> <dt><?php echo T_('Member Since'); ?></dt> - <dd><?php echo date($GLOBALS['longdate'], strtotime($row['uDatetime'])); ?></dd> + <dd><?php echo date($GLOBALS['longdate'], strtotime($objectUser->getDatetime())); ?></dd> <?php -if ($row['uContent'] != "") { +if ($objectUser->getContent() != "") { ?> <dt><?php echo T_('Description'); ?></dt> - <dd><?php echo $row['uContent']; ?></dd> + <dd><?php echo $objectUser->getContent(); ?></dd> <?php } $watching = $userservice->getWatchNames($userid); diff --git a/templates/sidebar.block.common.php b/templates/sidebar.block.common.php index dd3ce18..6f1e9f7 100644 --- a/templates/sidebar.block.common.php +++ b/templates/sidebar.block.common.php @@ -1,28 +1,26 @@ <?php $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); $commonTags =& $b2tservice->getRelatedTagsByHash($hash); -$commonTags =& $b2tservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc'); +$commonTags =& $b2tservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc'); if ($commonTags && count($commonTags) > 0) { -?> + ?> <h2><?php echo T_('Popular Tags'); ?></h2> <div id="common"> - <p class="tags"> - <?php - $contents = ''; +<p class="tags"><?php +$contents = ''; - if(strlen($user)==0) { +if(strlen($user)==0) { $cat_url = createURL('tags', '%2$s'); - } +} - foreach ($commonTags as $row) { - $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); - $contents .= '<a href="'. sprintf($cat_url, $user, filter($row['tag'], 'url')) .'" title="'. $row['bCount'] .' '. $entries .'" rel="tag" style="font-size:'. $row['size'] .'">'. filter($row['tag']) .'</a> '; - } - echo $contents ."\n"; - ?> - </p> +foreach ($commonTags as $row) { + $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); + $contents .= '<a href="'. sprintf($cat_url, $user, filter($row['tag'], 'url')) .'" title="'. $row['bCount'] .' '. $entries .'" rel="tag" style="font-size:'. $row['size'] .'">'. filter($row['tag']) .'</a> '; +} +echo $contents ."\n"; +?></p> </div> <?php diff --git a/templates/sidebar.block.popular.php b/templates/sidebar.block.popular.php index cc5c73a..b9c029f 100644 --- a/templates/sidebar.block.popular.php +++ b/templates/sidebar.block.popular.php @@ -2,6 +2,13 @@ $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); $userservice =& ServiceFactory::getServiceInstance('UserService'); +if(!isset($user)) { + $user = ''; +} +if(!isset($userid)) { + $userid = NULL; +} + $logged_on_userid = $userservice->getCurrentUserId(); if ($logged_on_userid === false) { $logged_on_userid = NULL; diff --git a/templates/sidebar.block.recent.php b/templates/sidebar.block.recent.php index fef85f2..9e4df08 100644 --- a/templates/sidebar.block.recent.php +++ b/templates/sidebar.block.recent.php @@ -20,7 +20,7 @@ if ($recentTags && count($recentTags) > 0) { <?php $contents = '<p class="tags">'; - if(!isset($user)) { + if(!isset($user) || $user == '') { $user = ''; $cat_url = createURL('tags', '%2$s'); } diff --git a/templates/sidebar.block.related.php b/templates/sidebar.block.related.php index 380c789..88d42d6 100644 --- a/templates/sidebar.block.related.php +++ b/templates/sidebar.block.related.php @@ -6,7 +6,12 @@ $logged_on_userid = $userservice->getCurrentUserId(); if ($logged_on_userid === false) { $logged_on_userid = NULL; } -if(strlen($user)==0) { + +if(!isset($userid)) { + $userid = NULL; +} + +if(isset($user) && strlen($user)==0) { $cat_url = createURL('tags', '%2$s'); } if ($currenttag) { diff --git a/templates/top.inc.php b/templates/top.inc.php index 0d59dfb..2039db2 100644 --- a/templates/top.inc.php +++ b/templates/top.inc.php @@ -22,13 +22,14 @@ if(isset($rsschannels)) { <script type="text/javascript" src="<?php echo ROOT ?>jsScuttle.php"></script> + <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dijit/themes/nihilo/nihilo.css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dojo/dojo.xd.js" djConfig="parseOnLoad:true, isDebug:false, usePlainJson:true"></script> - + <script type="text/javascript"> dojo.require("dojo.parser"); dojo.require("dojo.data.ItemFileReadStore"); diff --git a/templates/userlist.tpl.php b/templates/userlist.tpl.php index e05ea6d..85c1998 100644 --- a/templates/userlist.tpl.php +++ b/templates/userlist.tpl.php @@ -1,27 +1,24 @@ <?php
-
+ +/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService'); -$currentUser = $userservice->getCurrentUser();
-$currentUserID = $userservice->getCurrentUserId();
-$currentUsername = $currentUser[$userservice->getFieldName('username')]; -
+$currentObjectUser = $userservice->getCurrentObjectUser();
$this->includeTemplate($GLOBALS['top_include']);
echo '<ol id="bookmarks">';
-
-foreach(array_keys($users) as $key) {
-
+ +foreach($users as $user) {
echo '<li class="xfolkentry">'."\n";
echo '<div class="link">';
- echo '<a href="'.createURL('profile', $users[$key][$userservice->getFieldname('username')]).'">'.$users[$key][$userservice->getFieldName('username')].'</a>';
+ echo '<a href="'.createURL('profile', $user->getUsername()).'">'.$user->getUsername().'</a>';
echo '</div>';
- if($users[$key][$userservice->getFieldName('username')] != $currentUsername) {
+ if($user->getUsername() != $currentObjectUser->getUsername()) {
echo '<div class="meta">';
- echo '<a href="'.createURL('admin','delete/'.$users[$key][$userservice->getFieldname('username')]).'" onclick="return confirm(\''.T_('Are you sure?').'\');">'.T_('Delete').'</a>';
+ echo '<a href="'.createURL('admin','delete/'.$user->getUsername()).'" onclick="return confirm(\''.T_('Are you sure?').'\');">'.T_('Delete').'</a>';
echo '</div>'; }
|