Google+/Facebook: Merged settings, added icons for the settings of the other connectors #187

Merged
annando merged 3 commits from master into master 2014-04-24 10:53:09 +02:00
2 changed files with 39 additions and 6 deletions
Showing only changes of commit 71a42a1749 - Show all commits

View file

@ -152,6 +152,12 @@ function fbpost_post(&$a) {
set_pconfig($uid,'facebook','post_to_page', $values[0]); set_pconfig($uid,'facebook','post_to_page', $values[0]);
set_pconfig($uid,'facebook','page_access_token', $values[1]); set_pconfig($uid,'facebook','page_access_token', $values[1]);
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
if (count($result) > 0) {
set_pconfig(local_user(),'fbsync','sync',intval($_POST['fbsync']));
set_pconfig(local_user(),'fbsync','create_user',intval($_POST['create_user']));
}
info( t('Settings updated.') . EOL); info( t('Settings updated.') . EOL);
} }
@ -207,7 +213,15 @@ function fbpost_content(&$a) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
. $a->get_baseurl() . '/addon/fbpost/fbpost.css' . '" media="all" />' . "\r\n"; . $a->get_baseurl() . '/addon/fbpost/fbpost.css' . '" media="all" />' . "\r\n";
$o .= '<h3>' . t('Facebook Export/Mirror') . '</h3>'; $result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
$fbsync = (count($result) > 0);
if($fbsync)
$title = t('Facebook Import/Export/Mirror');
else
$title = t('Facebook Export/Mirror');
$o .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'.$title.'</h3>';
if(! $fb_installed) { if(! $fb_installed) {
$o .= '<div id="fbpost-enable-wrapper">'; $o .= '<div id="fbpost-enable-wrapper">';
@ -279,8 +293,20 @@ function fbpost_content(&$a) {
$o .= "</select>"; $o .= "</select>";
$o .= '<p><input type="submit" name="submit" value="' . t('Save Settings') . '" /></form></div>'; if ($fbsync) {
$o .= '<div class="clear"></div>';
$sync_enabled = get_pconfig(local_user(),'fbsync','sync');
$checked = (($sync_enabled) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="fbsync" value="1"' . $checked . '/>' . ' ' . t('Import Facebook newsfeed.') . EOL;
$create_user = get_pconfig(local_user(),'fbsync','create_user');
$checked = (($create_user) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="create_user" value="1"' . $checked . '/>' . ' ' . t('Automatically create contacts.') . EOL;
}
$o .= '<p><input type="submit" name="submit" value="' . t('Save Settings') . '" /></form></div>';
} }
return $o; return $o;
@ -291,11 +317,15 @@ function fbpost_content(&$a) {
* @param null|object $b * @param null|object $b
*/ */
function fbpost_plugin_settings(&$a,&$b) { function fbpost_plugin_settings(&$a,&$b) {
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
if(count($result) > 0)
$title = t('Facebook Import/Export/Mirror');
else
$title = t('Facebook Export/Mirror');
$b .= '<div class="settings-block">'; $b .= '<div class="settings-block">';
$b .= '<a href="fbpost"><h3>' . t('Facebook Export/Mirror') . '</a></h3>'; $b .= '<a href="fbpost"><img class="connector" src="images/facebook.png" /><h3 class="connector">'.$title.'</h3></a>';
$b .= '</div>'; $b .= '</div>';
} }

View file

@ -100,6 +100,9 @@ function fbsync_follow($a, &$contact) {
function fbsync_settings(&$a,&$s) { function fbsync_settings(&$a,&$s) {
// Settings are done inside the fbpost addon
return;
if(! local_user()) if(! local_user())
return; return;
@ -120,11 +123,11 @@ function fbsync_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_fbsync_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">'; $s .= '<span id="settings_fbsync_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">';
$s .= '<h3>' . t('Facebook Import') . '</h3>'; $s .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'. t('Facebook Import').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_fbsync_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_fbsync_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">';
$s .= '<h3>' . t('Facebook Import') . '</h3>'; $s .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'. t('Facebook Import').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="fbsync-enable-wrapper">'; $s .= '<div id="fbsync-enable-wrapper">';