Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x

This commit is contained in:
Evan Prodromou 2009-04-07 11:40:38 -04:00
commit 770788d98e
11 changed files with 106 additions and 41 deletions

View File

@ -143,6 +143,25 @@ class FavoritedAction extends Action
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
$favorite = new Fave;
if ($favorite->count()) {
return;
}
$message = _('Favorite notices appear on this page but noone has favorited one yet.') . ' ';
if (common_logged_in()) {
$message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.');
}
else {
$message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!');
}
$this->elementStart('div', 'blankfiller');
$this->raw(common_markup_to_html($message));
$this->elementEnd('div');
}
/**

View File

@ -72,12 +72,23 @@ class GroupsearchAction extends SearchAction
$terms = preg_split('/[\s,]+/', $q);
$results = new GroupSearchResults($user_group, $terms, $this);
$results->show();
} else {
$this->element('p', 'error', _('No results'));
}
$user_group->free();
$this->pagination($page > 1, $cnt > GROUPS_PER_PAGE,
$page, 'groupsearch', array('q' => $q));
} else {
$this->element('p', 'error', _('No results.'));
$this->searchSuggestions($q);
if (common_logged_in()) {
$message = _('If you can\'t find the group you\'re looking for, you can [create it](%%action.newgroup%%) yourself.');
}
else {
$message = _('Why not [register an account](%%action.register%%) and [create the group](%%action.newgroup%%) yourself!');
}
$this->elementStart('div', 'blankfiller');
$this->raw(common_markup_to_html($message));
$this->elementEnd('div');
$user_group->free();
}
}
}
@ -98,10 +109,5 @@ class GroupSearchResults extends GroupList
{
return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
}
function isReadOnly()
{
return true;
}
}

View File

@ -114,22 +114,27 @@ class NoticesearchAction extends SearchAction
$cnt = $notice->find();
}
if ($cnt === 0) {
$this->element('p', 'error', _('No results'));
$this->element('p', 'error', _('No results.'));
$this->searchSuggestions($q);
if (common_logged_in()) {
$message = sprintf(_('Be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
}
else {
$message = sprintf(_('Why not [register an account](%%%%action.register%%%%) and be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
}
$this->elementStart('div', 'blankfiller');
$this->raw(common_markup_to_html($message));
$this->elementEnd('div');
return;
}
$terms = preg_split('/[\s,]+/', $q);
$nl = new SearchNoticeList($notice, $this, $terms);
$cnt = $nl->show();
$this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'noticesearch', array('q' => $q));
}
function isReadOnly()
{
return true;
}
}
class SearchNoticeList extends NoticeList {

View File

@ -60,14 +60,8 @@ class PeoplesearchAction extends SearchAction
function showResults($q, $page)
{
$profile = new Profile();
// lcase it for comparison
// $q = strtolower($q);
$search_engine = $profile->getSearchEngine('identica_people');
$search_engine->set_sort_mode('chron');
// Ask for an extra to see if there's more.
$search_engine->limit((($page-1)*PROFILES_PER_PAGE), PROFILES_PER_PAGE + 1);
@ -81,14 +75,15 @@ class PeoplesearchAction extends SearchAction
$terms = preg_split('/[\s,]+/', $q);
$results = new PeopleSearchResults($profile, $terms, $this);
$results->show();
} else {
$this->element('p', 'error', _('No results'));
}
$profile->free();
$this->pagination($page > 1, $cnt > PROFILES_PER_PAGE,
$page, 'peoplesearch', array('q' => $q));
} else {
$this->element('p', 'error', _('No results.'));
$this->searchSuggestions($q);
$profile->free();
}
}
}

View File

@ -168,14 +168,13 @@ class PublicAction extends Action
function showPageNotice()
{
$notice = Notice::publicStream(0, 1);
$notice = new Notice;
if (!$notice) {
$this->serverError(_('Could not retrieve public stream.'));
return;
}
// no notices in the public stream, let's get out of here
if ($notice->count()) {
return;
}

View File

@ -63,7 +63,7 @@ class PublictagcloudAction extends Action
sprintf(_('These are most popular recent tags on %s '),
common_config('site', 'name')));
$tags = new Notice_tag();
$tags = new Notice_tag;
if ($tags->count()) {
return;
}

View File

@ -46,4 +46,5 @@ VALUES
('twitux','Twitux','http://live.gnome.org/DanielMorales/Twitux', now()),
('twitvim','TwitVim','http://vim.sourceforge.net/scripts/script.php?script_id=2204', now()),
('urfastr','urfastr','http://urfastr.net/', now()),
('adium', 'Adium', 'http://www.adiumx.com/', now());
('adium', 'Adium', 'http://www.adiumx.com/', now()),
('yatca','Yatca','http://www.yatca.com/', now());

8
doc-src/bookmarklet Normal file
View File

@ -0,0 +1,8 @@
A bookmarklet is a small piece of javascript code used as a bookmark. This one will let you post to %%site.name%% simply by selecting some text on a page and pressing the bookmarklet.
Drag-and-drop the following link to your bookmarks bar or right-click it and add it to your browser favorites to keep it handy.
<MTMarkdownOptions output='raw'>
<a href="javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://%%site.server%%/%%site.path%%/notice/new',l=d.location,e=encodeURIComponent,g=f+'?status_textarea=%22'+e(s)+'%22 from '+l.href;function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=570')){l.href=g;}}a();void(0);">Post to %%site.name%%</a>
</MTMarkdownOptions>

View File

@ -133,5 +133,28 @@ class SearchAction extends Action
$this->showResults($q, $page);
}
}
function searchSuggestions($q) {
$qe = urlencode($q);
$message = sprintf(_(<<<E_O_T
* Make sure all words are spelled correctly.
* Try different keywords.
* Try more general keywords.
* Try fewer keywords.
You can also try your search on other engines:
* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=identi.ca)
* [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s)
* [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
* [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
E_O_T
), $qe, $qe, $qe, $qe);
$this->elementStart('div', 'blankfiller');
$this->raw(common_markup_to_html($message));
$this->elementEnd('div');
}
}

View File

@ -581,10 +581,8 @@ function common_shorten_link($url, $reverse = false)
function common_xml_safe_str($str)
{
$xmlStr = htmlentities(iconv('UTF-8', 'UTF-8//IGNORE', $str), ENT_NOQUOTES, 'UTF-8');
// Replace control, formatting, and surrogate characters with '*', ala Twitter
return preg_replace('/[\p{Cc}\p{Cf}\p{Cs}]/u', '*', $str);
// Neutralize control codes and surrogates
return preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
}
function common_tag_link($tag)

View File

@ -1,11 +1,14 @@
# This version needs to match the tarball and unpacked directory name.
%define LACVER 0.7.3
BuildRequires: php-pear
BuildRequires: httpd-devel
Name: laconica
Version: 0.7.2
Version: %{LACVER}
Release: 1%{?dist}
License: GAGPL v3 or later
Source: laconica-0.7.2.tar.gz
Source: laconica-%{version}.tar.gz
Group: Applications/Internet
Summary: Laconica, the Open Source microblogging platform
BuildArch: noarch
@ -49,6 +52,8 @@ cp -a * %{buildroot}%{wwwpath}
mkdir -p %{buildroot}%{_datadir}/laconica
cp -a db %{buildroot}%{_datadir}/laconica/db
mkdir -p %{buildroot}%{_datadir}/laconica/avatar
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d
cat > %{buildroot}%{_sysconfdir}/httpd/conf.d/laconica.conf <<"EOF"
Alias /laconica/ "/var/www/laconica/"
@ -74,6 +79,12 @@ rm -rf %buildroot
%config(noreplace) %{_sysconfdir}/httpd/conf.d/laconica.conf
%changelog
* Wed Apr 03 2009 Zach Copley <zach@controlyourself.ca> - 0.7.3
- Changed version number to 0.7.3.
* Fri Mar 13 2009 Ken Sedgwick <ksedgwic@bonsai.com> - 0.7.2.1-1
- Factored laconica version to the first line of the file.
* Wed Mar 03 2009 Zach Copley <zach@controlyourself.ca> - 0.7.2
- Changed version number to 0.7.2.