From dca20f42278e9d837d5cbfd130fc04ecaf09947d Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 29 Oct 2012 21:59:49 -0700 Subject: zchannel rename to new_channel --- mod/manage.php | 2 +- mod/new_channel.php | 122 +++++++++++++++++++++++++++++++++++++++++++ mod/register.php | 2 +- mod/settings.php | 18 +++---- mod/zchannel.php | 122 ------------------------------------------- view/css/mod_new_channel.css | 40 ++++++++++++++ view/css/mod_zchannel.css | 40 -------------- view/js/mod_new_channel.js | 17 ++++++ view/js/mod_zchannel.js | 17 ------ view/php/mod_new_channel.php | 3 ++ view/php/mod_zchannel.php | 3 -- view/tpl/new_channel.tpl | 29 ++++++++++ view/tpl/zchannel.tpl | 29 ---------- 13 files changed, 222 insertions(+), 222 deletions(-) create mode 100644 mod/new_channel.php delete mode 100644 mod/zchannel.php create mode 100644 view/css/mod_new_channel.css delete mode 100644 view/css/mod_zchannel.css create mode 100644 view/js/mod_new_channel.js delete mode 100644 view/js/mod_zchannel.js create mode 100644 view/php/mod_new_channel.php delete mode 100644 view/php/mod_zchannel.php create mode 100644 view/tpl/new_channel.tpl delete mode 100644 view/tpl/zchannel.tpl diff --git a/mod/manage.php b/mod/manage.php index 557a19375..57d33d086 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -35,7 +35,7 @@ function manage_content(&$a) { } $links = array( - array( 'zchannel', t('Create a new channel'), t('New Channel')) + array( 'new_channel', t('Create a new channel'), t('New Channel')) ); diff --git a/mod/new_channel.php b/mod/new_channel.php new file mode 100644 index 000000000..e815b2a73 --- /dev/null +++ b/mod/new_channel.php @@ -0,0 +1,122 @@ + 1) ? argv(1) : ''); + + + if($cmd === 'autofill.json') { + require_once('library/urlify/URLify.php'); + $result = array('error' => false, 'message' => ''); + $n = trim($_REQUEST['name']); + + $x = strtolower(URLify::transliterate($n)); + + $test = array(); + + // first name + $test[] = legal_webbie(substr($x,0,strpos($x,' '))); + if($test[0]) { + // first name plus first initial of last + $test[] = ((strpos($x,' ')) ? $test[0] . legal_webbie(trim(substr($x,strpos($x,' '),2))) : ''); + // first name plus random number + $test[] = $test[0] . mt_rand(1000,9999); + } + // fullname + $test[] = legal_webbie($x); + // fullname plus random number + $test[] = legal_webbie($x) . mt_rand(1000,9999); + + json_return_and_die(check_webbie($test)); + } + + if($cmd === 'checkaddr.json') { + require_once('library/urlify/URLify.php'); + $result = array('error' => false, 'message' => ''); + $n = trim($_REQUEST['nick']); + + $x = strtolower(URLify::transliterate($n)); + + $test = array(); + + $n = legal_webbie($x); + if(strlen($n)) { + $test[] = $n; + $test[] = $n . mt_rand(1000,9999); + } + + for($y = 0; $y < 100; $y ++) + $test[] = 'id' . mt_rand(1000,9999); + + json_return_and_die(check_webbie($test)); + } + + +} + + +function new_channel_post(&$a) { + + $arr = $_POST; + + if(($arr['account_id'] = get_account_id()) === false) { + notice( t('Permission denied.') . EOL ); + return; + } + + $result = create_identity($arr); + + if(! $result['success']) { + notice($result['message']); + return; + } + + $newuid = $result['channel']['channel_id']; + + change_channel($result['channel']['channel_id']); + + if(! strlen($next_page = get_config('system','workflow_channel_next'))) + $next_page = 'settings'; + + goaway(z_root() . '/' . $next_page); + +} + + + + + + + +function new_channel_content(&$a) { + + if(! get_account_id()) { + notice( t('Permission denied.') . EOL); + return; + } + + $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); + $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); + + + $o = replace_macros(get_markup_template('new_channel.tpl'), array( + + '$title' => t('Add a Channel'), + '$desc' => t('A channel is your own collection of related web pages. A channel can be used to hold social network profiles, blogs, conversation groups and forums, celebrity pages, and much more. You may create as many channels as your service provider allows.'), + + '$label_name' => t('Channel Name'), + '$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '), + '$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 channel.'), + '$label_import' => t('Check this box to import an existing channel file from another location'), + '$name' => $name, + '$nickname' => $nickname, + '$submit' => t('Create') + )); + + return $o; + +} + diff --git a/mod/register.php b/mod/register.php index 6326c8238..dbf8d25b7 100644 --- a/mod/register.php +++ b/mod/register.php @@ -105,7 +105,7 @@ function register_post(&$a) { authenticate_success($result['account'],true,false,true); if(! strlen($next_page = get_config('system','workflow_register_next'))) - $next_page = 'zchannel'; + $next_page = 'new_channel'; $_SESSION['workflow'] = true; diff --git a/mod/settings.php b/mod/settings.php index 430fc5187..a9f625056 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -16,6 +16,15 @@ function get_theme_config_file($theme){ function settings_init(&$a) { + + // default is channel settings in the absence of other arguments + + if(argc() == 1) { + $a->argc = 2; + $a->argv[] = 'channel'; + } + + $tabs = array( array( 'label' => t('Account settings'), @@ -83,10 +92,6 @@ function settings_post(&$a) { if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) return; - if(argc() == 1) { - $a->argc = 2; - $a->argv[] = 'channel'; - } if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) { notice( t('Permission denied.') . EOL); @@ -432,11 +437,6 @@ function settings_content(&$a) { $o = ''; nav_set_selected('settings'); - if(argc() == 1) { - $a->argc = 2; - $a->argv[] = 'channel'; - } - if(! local_user()) { notice( t('Permission denied.') . EOL ); diff --git a/mod/zchannel.php b/mod/zchannel.php deleted file mode 100644 index eca22b0a9..000000000 --- a/mod/zchannel.php +++ /dev/null @@ -1,122 +0,0 @@ - 1) ? argv(1) : ''); - - - if($cmd === 'autofill.json') { - require_once('library/urlify/URLify.php'); - $result = array('error' => false, 'message' => ''); - $n = trim($_REQUEST['name']); - - $x = strtolower(URLify::transliterate($n)); - - $test = array(); - - // first name - $test[] = legal_webbie(substr($x,0,strpos($x,' '))); - if($test[0]) { - // first name plus first initial of last - $test[] = ((strpos($x,' ')) ? $test[0] . legal_webbie(trim(substr($x,strpos($x,' '),2))) : ''); - // first name plus random number - $test[] = $test[0] . mt_rand(1000,9999); - } - // fullname - $test[] = legal_webbie($x); - // fullname plus random number - $test[] = legal_webbie($x) . mt_rand(1000,9999); - - json_return_and_die(check_webbie($test)); - } - - if($cmd === 'checkaddr.json') { - require_once('library/urlify/URLify.php'); - $result = array('error' => false, 'message' => ''); - $n = trim($_REQUEST['nick']); - - $x = strtolower(URLify::transliterate($n)); - - $test = array(); - - $n = legal_webbie($x); - if(strlen($n)) { - $test[] = $n; - $test[] = $n . mt_rand(1000,9999); - } - - for($y = 0; $y < 100; $y ++) - $test[] = 'id' . mt_rand(1000,9999); - - json_return_and_die(check_webbie($test)); - } - - -} - - -function zchannel_post(&$a) { - - $arr = $_POST; - - if(($arr['account_id'] = get_account_id()) === false) { - notice( t('Permission denied.') . EOL ); - return; - } - - $result = create_identity($arr); - - if(! $result['success']) { - notice($result['message']); - return; - } - - $newuid = $result['channel']['channel_id']; - - change_channel($result['channel']['channel_id']); - - if(! strlen($next_page = get_config('system','workflow_channel_next'))) - $next_page = 'settings'; - - goaway(z_root() . '/' . $next_page); - -} - - - - - - - -function zchannel_content(&$a) { - - if(! get_account_id()) { - notice( t('Permission denied.') . EOL); - return; - } - - $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); - $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); - - - $o = replace_macros(get_markup_template('zchannel.tpl'), array( - - '$title' => t('Add a Channel'), - '$desc' => t('A channel is your own collection of related web pages. A channel can be used to hold social network profiles, blogs, conversation groups and forums, celebrity pages, and much more. You may create as many channels as your service provider allows.'), - - '$label_name' => t('Channel Name'), - '$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '), - '$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 channel.'), - '$label_import' => t('Check this box to import an existing channel file from another location'), - '$name' => $name, - '$nickname' => $nickname, - '$submit' => t('Create') - )); - - return $o; - -} - diff --git a/view/css/mod_new_channel.css b/view/css/mod_new_channel.css new file mode 100644 index 000000000..3b9c80953 --- /dev/null +++ b/view/css/mod_new_channel.css @@ -0,0 +1,40 @@ + +h2 { + margin-left: 15%; + margin-top: 15%; +} + +#newchannel-form { + font-size: 1.4em; + margin-left: 15%; + margin-top: 5%; + width: 50%; +} + +#newchannel-form .descriptive-paragraph { + color: #888; + margin-left: 20px; + margin-bottom: 25px; +} + +.newchannel-label { + float: left; + width: 275px; +} + +.newchannel-input { + float: left; + width: 275px; + padding: 5px; +} + +.newchannel-feedback { + float: left; + margin-left: 5px; +} + +.newchannel-field-end { + clear: both; + margin-bottom: 20px; +} + diff --git a/view/css/mod_zchannel.css b/view/css/mod_zchannel.css deleted file mode 100644 index 1b4527a99..000000000 --- a/view/css/mod_zchannel.css +++ /dev/null @@ -1,40 +0,0 @@ - -h2 { - margin-left: 15%; - margin-top: 15%; -} - -#zchannel-form { - font-size: 1.4em; - margin-left: 15%; - margin-top: 5%; - width: 50%; -} - -#zchannel-form .descriptive-paragraph { - color: #888; - margin-left: 20px; - margin-bottom: 25px; -} - -.zchannel-label { - float: left; - width: 275px; -} - -.zchannel-input { - float: left; - width: 275px; - padding: 5px; -} - -.zchannel-feedback { - float: left; - margin-left: 5px; -} - -.zchannel-field-end { - clear: both; - margin-bottom: 20px; -} - diff --git a/view/js/mod_new_channel.js b/view/js/mod_new_channel.js new file mode 100644 index 000000000..02b6f857e --- /dev/null +++ b/view/js/mod_new_channel.js @@ -0,0 +1,17 @@ + $(document).ready(function() { + $("#newchannel-name").blur(function() { + var zreg_name = $("#newchannel-name").val(); + $.get("newchannel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) { + $("#newchannel-nickname").val(data); + zFormError("#newchannel-name-feedback",data.error); + }); + }); + $("#newchannel-nickname").blur(function() { + var zreg_nick = $("#newchannel-nickname").val(); + $.get("newchannel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) { + $("#newchannel-nickname").val(data); + zFormError("#newchannel-nickname-feedback",data.error); + }); + }); + + }); diff --git a/view/js/mod_zchannel.js b/view/js/mod_zchannel.js deleted file mode 100644 index 9f85295d7..000000000 --- a/view/js/mod_zchannel.js +++ /dev/null @@ -1,17 +0,0 @@ - $(document).ready(function() { - $("#zchannel-name").blur(function() { - var zreg_name = $("#zchannel-name").val(); - $.get("zchannel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) { - $("#zchannel-nickname").val(data); - zFormError("#zchannel-name-feedback",data.error); - }); - }); - $("#zchannel-nickname").blur(function() { - var zreg_nick = $("#zchannel-nickname").val(); - $.get("zchannel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) { - $("#zchannel-nickname").val(data); - zFormError("#zchannel-nickname-feedback",data.error); - }); - }); - - }); diff --git a/view/php/mod_new_channel.php b/view/php/mod_new_channel.php new file mode 100644 index 000000000..e7709cbd8 --- /dev/null +++ b/view/php/mod_new_channel.php @@ -0,0 +1,3 @@ +page['template'] = 'full'; diff --git a/view/php/mod_zchannel.php b/view/php/mod_zchannel.php deleted file mode 100644 index e7709cbd8..000000000 --- a/view/php/mod_zchannel.php +++ /dev/null @@ -1,3 +0,0 @@ -page['template'] = 'full'; diff --git a/view/tpl/new_channel.tpl b/view/tpl/new_channel.tpl new file mode 100644 index 000000000..b9171644a --- /dev/null +++ b/view/tpl/new_channel.tpl @@ -0,0 +1,29 @@ +

$title

+ +
+ +
$desc
+ + + + +
+ +
$help_name
+ + + + +
+ +
$nick_desc
+ + + + +
+ + +
+ +
diff --git a/view/tpl/zchannel.tpl b/view/tpl/zchannel.tpl deleted file mode 100644 index d714d8a59..000000000 --- a/view/tpl/zchannel.tpl +++ /dev/null @@ -1,29 +0,0 @@ -

$title

- -
- -
$desc
- - - - -
- -
$help_name
- - - - -
- -
$nick_desc
- - - - -
- - -
- -
-- cgit v1.2.3