From 2456174cc905d2d0ae19d21c94fec2c5552322a8 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 23 Aug 2012 20:00:10 -0700 Subject: back to identity creation form --- boot.php | 6 +- include/conversation.php | 14 +++++ include/identity.php | 11 ++++ include/text.php | 33 +++++++++++ index.php | 30 +++------- mod/mood.php | 142 ++++++++++++++++++++++++++++++++++++++++++++++ mod/poke.php | 2 +- mod/zentity.php | 91 ++++------------------------- version.inc | 2 +- view/css/mod_zentity.css | 17 ++++-- view/js/mod_zentity.js | 17 ++++++ view/php/default.php | 1 + view/tpl/mood_content.tpl | 20 +++++++ view/tpl/zentity.tpl | 51 ++++++----------- 14 files changed, 291 insertions(+), 146 deletions(-) create mode 100755 mod/mood.php create mode 100644 view/js/mod_zentity.js create mode 100644 view/tpl/mood_content.tpl diff --git a/boot.php b/boot.php index cf9aa3d57..8bcceff88 100644 --- a/boot.php +++ b/boot.php @@ -268,6 +268,7 @@ define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' ); define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' ); define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' ); +define ( 'ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood' ); define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' ); define ( 'ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note' ); @@ -1481,7 +1482,10 @@ if(! function_exists('proc_run')) { $args[$x] = escapeshellarg($args[$x]); $cmdline = implode($args," "); - proc_close(proc_open($cmdline." &",array(),$foo)); + if(get_config('system','proc_windows')) + proc_close(proc_open('start /b ' . $cmdline,array(),$foo)); + else + proc_close(proc_open($cmdline." &",array(),$foo)); } } diff --git a/include/conversation.php b/include/conversation.php index 3bbaf0cba..59f2f2ed8 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -206,6 +206,20 @@ function localize_item(&$item){ $item['body'] = sprintf($txt, $A, $B). "\n\n\n" . $Bphoto; } + if (stristr($item['verb'],ACTIVITY_MOOD)) { + $verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1)); + if(! $verb) + return; + + $Aname = $item['author-name']; + $Alink = $item['author-link']; + $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]'; + + $txt = t('%1$s is currently %2$s'); + + $item['body'] = sprintf($txt, $A, t($verb)); + } + if ($item['verb']===ACTIVITY_TAG){ $r = q("SELECT * from `item`,`contact` WHERE `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';", diff --git a/include/identity.php b/include/identity.php index 5164b5eae..8f906228f 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1,6 +1,17 @@ t('happy'), + 'sad' => t('sad'), + 'mellow' => t('mellow'), + 'tired' => t('tired'), + 'perky' => t('perky'), + 'angry' => t('angry'), + 'stupefied' => t('stupified'), + 'puzzled' => t('puzzled'), + 'interested' => t('interested'), + 'bitter' => t('bitter'), + 'cheerful' => t('cheerful'), + 'alive' => t('alive'), + 'annoyed' => t('annoyed'), + 'anxious' => t('anxious'), + 'cranky' => t('cranky'), + 'disturbed' => t('disturbed'), + 'frustrated' => t('frustrated'), + 'motivated' => t('motivated'), + 'relaxed' => t('relaxed'), + 'surprised' => t('surprised'), + ); + + call_hooks('mood_verbs', $arr); + return $arr; +} + + /** * * Function: smilies diff --git a/index.php b/index.php index 84fa1593a..8f7f8fa92 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ /** * - * Friendica + * Friendica Red * */ @@ -244,13 +244,13 @@ if($a->module_loaded) { $func = str_replace('-','_',current_theme()) . '_init'; $func($a); } -// elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) { -// require_once("view/theme/".$a->theme_info["extends"]."/theme.php"); -// if(function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) { -// $func = str_replace('-','_',$a->theme_info["extends"]) . '_init'; -// $func($a); -// } -// } + elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) { + require_once("view/theme/".$a->theme_info["extends"]."/theme.php"); + if(function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) { + $func = str_replace('-','_',$a->theme_info["extends"]) . '_init'; + $func($a); + } + } if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error) && (function_exists($a->module . '_post')) @@ -298,16 +298,6 @@ if(stristr( implode("",$_SESSION['sysmsg']), t('Permission denied'))) { call_hooks('page_end', $a->page['content']); - -/** - * - * Add a place for the pause/resume Ajax indicator - * - */ - -$a->page['content'] .= '
'; - - /** * * Add the navigation (menu) template @@ -348,10 +338,6 @@ head_add_js('mod_' . $a->module . '.js'); '$baseurl' => $a->get_baseurl(), '$local_user' => local_user(), '$generator' => FRIENDICA_PLATFORM . ' ' . FRIENDICA_VERSION, - '$delitem' => t('Delete this item?'), - '$comment' => t('Comment'), - '$showmore' => t('show more'), - '$showfewer' => t('show fewer'), '$update_interval' => $interval, '$head_css' => head_get_css(), '$head_js' => head_get_js(), diff --git a/mod/mood.php b/mod/mood.php new file mode 100755 index 000000000..7a793c71e --- /dev/null +++ b/mod/mood.php @@ -0,0 +1,142 @@ +user['allow_cid']; + $allow_gid = $a->user['allow_gid']; + $deny_cid = $a->user['deny_cid']; + $deny_gid = $a->user['deny_gid']; + } + + $poster = $a->contact; + + $uri = item_new_uri($a->get_hostname(),$uid); + + $action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]); + + $arr = array(); + + $arr['uid'] = $uid; + $arr['uri'] = $uri; + $arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri); + $arr['type'] = 'activity'; + $arr['wall'] = 1; + $arr['contact-id'] = $poster['id']; + $arr['owner-name'] = $poster['name']; + $arr['owner-link'] = $poster['url']; + $arr['owner-avatar'] = $poster['thumb']; + $arr['author-name'] = $poster['name']; + $arr['author-link'] = $poster['url']; + $arr['author-avatar'] = $poster['thumb']; + $arr['title'] = ''; + $arr['allow_cid'] = $allow_cid; + $arr['allow_gid'] = $allow_gid; + $arr['deny_cid'] = $deny_cid; + $arr['deny_gid'] = $deny_gid; + $arr['last-child'] = 1; + $arr['visible'] = 1; + $arr['verb'] = $activity; + $arr['private'] = $private; + + $arr['origin'] = 1; + $arr['body'] = $action; + + $item_id = item_store($arr); + if($item_id) { + q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", + dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id), + intval($uid), + intval($item_id) + ); + proc_run('php',"include/notifier.php","tag","$item_id"); + } + + + call_hooks('post_local_end', $arr); + + proc_run('php',"include/notifier.php","like","$post_id"); + + return; +} + + + +function mood_content(&$a) { + + if(! local_user()) { + notice( t('Permission denied.') . EOL); + return; + } + + $parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0'); + + + + $verbs = get_mood_verbs(); + + $shortlist = array(); + foreach($verbs as $k => $v) + if($v !== 'NOTRANSLATION') + $shortlist[] = array($k,$v); + + + $tpl = get_markup_template('mood_content.tpl'); + + $o = replace_macros($tpl,array( + '$title' => t('Mood'), + '$desc' => t('Set your current mood and tell your friends'), + '$verbs' => $shortlist, + '$parent' => $parent, + '$submit' => t('Submit'), + )); + + return $o; + +} \ No newline at end of file diff --git a/mod/poke.php b/mod/poke.php index bb062308f..a4ccc517a 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -76,7 +76,7 @@ function poke_init(&$a) { $poster = $a->contact; - $uri = item_new_uri($a->get_hostname(),$owner_uid); + $uri = item_new_uri($a->get_hostname(),$uid); $arr = array(); diff --git a/mod/zentity.php b/mod/zentity.php index 011ae8e79..794ac0ecb 100644 --- a/mod/zentity.php +++ b/mod/zentity.php @@ -35,7 +35,7 @@ function zentity_init(&$a) { if($cmd === 'checkaddr.json') { require_once('library/urlify/URLify.php'); $result = array('error' => false, 'message' => ''); - $n = trim($_REQUEST['addr']); + $n = trim($_REQUEST['nick']); $x = strtolower(URLify::transliterate($n)); @@ -56,71 +56,6 @@ function zentity_init(&$a) { } - - -// print_r($test); - -// if(! allowed_email($email)) -// $result['message'] = t('Your email domain is not among those allowed on this site'); -// if((! valid_email($email)) || (! validate_email($email))) -// $result['message'] .= t('Not a valid email address') . EOL; -// if($result['message']) -// $result['error'] = true; - -// header('content-type: application/json'); -// echo json_encode($result); -// killme(); - - - $pw1 = t("Password too short"); - $pw2 = t("Passwords do not match"); - - $a->page['htmlhead'] .= <<< EOT - - -EOT; - } @@ -309,7 +244,7 @@ function zentity_content(&$a) { if(get_config('system','no_age_restriction')) $label_tos = sprintf( t('I accept the %s for this website'), $toslink); else - $label_tos = t('Check this box to import an existing identity file from another location'); + $label_tos = $email = ((x($_REQUEST,'email')) ? $_REQUEST['email'] : "" ); @@ -322,20 +257,14 @@ function zentity_content(&$a) { $o = replace_macros(get_markup_template('zentity.tpl'), array( '$title' => t('Create Identity'), - '$registertext' => t('An identity is a profile container for a personal profile, blog, public or private group/forum, celebrity page, and more.
You may create as many of these as your hub provider allows.'), - '$invitations' => get_config('system','invitation_only'), - '$invite_desc' => t('Membership on this site is by invitation only.'), - '$label_invite' => t('Please enter your invitation code'), - '$invite_id' => $invite_id, - - '$label_email' => t('Full name'), - '$label_pass1' => t('Choose a short nickname'), - '$label_pass2' => t('Your nickname will be used to create an easily remembered web address ("webbie") for your profile.'), - '$label_tos' => $label_tos, - - '$email' => $email, - '$pass1' => $password, - '$pass2' => $password2, + '$desc' => t('An identity is a profile container for a personal profile, blog, public or private group/forum, celebrity page, and more. You may create as many of these as your provider allows.'), + + '$label_name' => t('Full name'), + '$label_nick' => t('Choose a short nickname'), + '$nick_desc' => t('Your nickname will be used to create an easily remembered web address ("webbie") for your profile.'), + '$label_import' => t('Check this box to import an existing identity file from another location'), + '$name' => $name, + '$nickname' => $nickname, '$submit' => t('Create') )); diff --git a/version.inc b/version.inc index 750c54773..2fc7661a2 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2012-08-22.54 +2012-08-23.55 diff --git a/view/css/mod_zentity.css b/view/css/mod_zentity.css index 2edb9e9a9..402572a38 100644 --- a/view/css/mod_zentity.css +++ b/view/css/mod_zentity.css @@ -4,29 +4,36 @@ h2 { margin-top: 15%; } -#zregister-form { +#zentity-form { font-size: 1.4em; margin-left: 15%; margin-top: 5%; + width: 50%; } -.zregister-label { +#zentity-form .descriptive-paragraph { + color: #888; + margin-left: 20px; + margin-bottom: 25px; +} + +.zentity-label { float: left; width: 275px; } -.zregister-input { +.zentity-input { float: left; width: 275px; padding: 5px; } -.zregister-feedback { +.zentity-feedback { float: left; margin-left: 5px; } -.zregister-field-end { +.zentity-field-end { clear: both; margin-bottom: 20px; } diff --git a/view/js/mod_zentity.js b/view/js/mod_zentity.js new file mode 100644 index 000000000..ad78db7d4 --- /dev/null +++ b/view/js/mod_zentity.js @@ -0,0 +1,17 @@ + $(document).ready(function() { + $("#zentity-name").blur(function() { + var zreg_name = $("#zentity-name").val(); + $.get("zentity/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) { + $("#zentity-nickname").val(data); + zFormError("#zentity-name-feedback",data.error); + }); + }); + $("#zentity-nickname").blur(function() { + var zreg_nick = $("#zentity-nickname").val(); + $.get("zentity/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) { + $("#zentity-nickname").val(data); + zFormError("#zentity-nickname-feedback",data.error); + }); + }); + + }); diff --git a/view/php/default.php b/view/php/default.php index 61f5f6863..80c8070b2 100644 --- a/view/php/default.php +++ b/view/php/default.php @@ -10,6 +10,7 @@
+
diff --git a/view/tpl/mood_content.tpl b/view/tpl/mood_content.tpl new file mode 100644 index 000000000..9349c56ae --- /dev/null +++ b/view/tpl/mood_content.tpl @@ -0,0 +1,20 @@ +

$title

+ +
$desc
+ +
+
+
+ + + + +
+
+ +
+ diff --git a/view/tpl/zentity.tpl b/view/tpl/zentity.tpl index f34042d05..f41578117 100644 --- a/view/tpl/zentity.tpl +++ b/view/tpl/zentity.tpl @@ -1,46 +1,27 @@

$title

-
+ -{{ if $registertext }} -
$registertext
-{{ endif }} +
$desc
-{{ if $invitations }} -

$invite_desc

+ + +
+
- - - -
-
+ + +
+
-{{ endif }} +
$nick_desc
- - -
-
+ + +
- - -
-
- -
-
$label_pass2
-
- -
 
- - - - -
-
- - -
+ +
-- cgit v1.2.3