]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
trac750 better settings tab workflow
authorZach Copley <zach@controlyourself.ca>
Tue, 6 Jan 2009 20:57:38 +0000 (15:57 -0500)
committerZach Copley <zach@controlyourself.ca>
Tue, 6 Jan 2009 20:57:38 +0000 (15:57 -0500)
darcs-hash:20090106205738-7b5ce-e80f73130a1f699e8d33f31c63cf90ee259b72cd.gz

_darcs/inventory
_darcs/patches/20090106205738-7b5ce-e80f73130a1f699e8d33f31c63cf90ee259b72cd.gz [new file with mode: 0644]
_darcs/pristine/actions/facebookhome.php
_darcs/pristine/actions/facebooksettings.php
_darcs/pristine/lib/facebookaction.php
_darcs/tentative_pristine
actions/facebookhome.php
actions/facebooksettings.php
lib/facebookaction.php

index 22b47336e14e8bf629be354bb532ad8cae9651c5..70a030e46fa01ba8881a8dd3f1d55f0143f5ba53 100644 (file)
@@ -126,4 +126,6 @@ csarven@controlyourself.ca**20081210025922]
 [Actually crop your avatar when hitting 'crop' button on profile
 Zach Copley <zach@controlyourself.ca>**20081212043018] 
 [Some fixups of patches not already migrated to trunk to bring inline with PEAR coding stds
-Zach Copley <zach@controlyourself.ca>**20081225144601] 
\ No newline at end of file
+Zach Copley <zach@controlyourself.ca>**20081225144601] 
+[trac750 better settings tab workflow
+Zach Copley <zach@controlyourself.ca>**20090106205738] 
\ No newline at end of file
diff --git a/_darcs/patches/20090106205738-7b5ce-e80f73130a1f699e8d33f31c63cf90ee259b72cd.gz b/_darcs/patches/20090106205738-7b5ce-e80f73130a1f699e8d33f31c63cf90ee259b72cd.gz
new file mode 100644 (file)
index 0000000..74db175
Binary files /dev/null and b/_darcs/patches/20090106205738-7b5ce-e80f73130a1f699e8d33f31c63cf90ee259b72cd.gz differ
index 069ea5e75ce691c1cae0ed27e0cff41fc9fcba90..6206fb6c2704498f3e8300aa47cddb6b52dd5f30 100644 (file)
@@ -75,7 +75,7 @@ class FacebookhomeAction extends FacebookAction
                     $flink_id = $flink->insert();
 
                     if ($flink_id) {
-                        echo '<fb:success message="You can now use the Identi.ca from Facebook!" />';
+                        echo '<fb:success message="You can now use Identi.ca from Facebook!" />';
                     }
 
                     $this->show_home($facebook, $fbuid, $user);
index 469bcfc459f19d08204f11f0ce18ff99dae16b76..d28b1aa5ca95b7027be03d16b15bcce04b9ac6a3 100644 (file)
@@ -69,10 +69,12 @@ class FacebooksettingsAction extends FacebookAction
 
         $fbml = '<fb:if-section-not-added section="profile">'
             .'<h2>Add an Identi.ca box to my profile</h2>'
-            .'<fb:add-section-button section="profile"/>'
+            .'<p><fb:add-section-button section="profile"/></p>'
             .'</fb:if-section-not-added>';
 
-        $fbml .= '<fb:prompt-permission perms="status_update"><h2>Allow Identi.ca to update my Facebook status</h2></fb:prompt-permission>';
+        $fbml .= '<p><fb:prompt-permission perms="status_update"><h2>Allow Identi.ca to update my Facebook status</h2></fb:prompt-permission></p>';
+
+        if ($facebook->api_client->users_hasAppPermission('status_update')) {
 
         $fbml .= '<form method="post" id="facebook_settings">'
         .'<h2>Sync preferences</h2>'
@@ -101,6 +103,8 @@ class FacebooksettingsAction extends FacebookAction
         .'</p>'
         .'</form>';
 
+    }
+
         echo $fbml;
 
         $this->show_footer();
index 7fa097587d8f45035f5f97d93c1f4f9fafe62409..9230bad59368c025d09ab1f0f99579dfca11819c 100644 (file)
@@ -72,7 +72,7 @@ class FacebookAction extends Action
          }
          </style>';
 
-        $html = Facebookaction::Aender_notice($notice);
+        $html = Facebookaction::render_notice($notice);
 
  
         $fbml = "<fb:wide>$style $html</fb:wide>";
index 04a3f84cd79ac8a54c72b0bb941f305cf75d9e06..66a843163a4f03f981f81ca8f0894e144469a62b 100644 (file)
-hunk ./actions/profilesettings.php 57
--              if ($this->arg('save')) {
--                      $this->save_profile();
--              } else if ($this->arg('upload')) {
--                      $this->upload_avatar();
--              } else if ($this->arg('changepass')) {
--                      $this->change_password();
--              }
-+        if ($this->arg('save')) {
-+            $this->save_profile();
-+        } else if ($this->arg('upload')) {
-+            $this->upload_avatar();
-+        } else if ($this->arg('crop')) {
-+            $this->crop_avatar();
-+        } else if ($this->arg('changepass')) {
-+            $this->change_password();
-+        } else {
-+            $this->show_form(_('Unexpected form submission.'));
-+        }
-hunk ./actions/profilesettings.php 77
--              common_element_start('form', array('method' => 'POST',
--                                                                                 'id' => 'profilesettings',
--                                                                                 'action' =>
--                                                                                 common_local_url('profilesettings')));
--              common_hidden('token', common_session_token());
--              
--              # too much common patterns here... abstractable?
--              
--              common_input('nickname', _('Nickname'),
--                                       ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
--                                       _('1-64 lowercase letters or numbers, no punctuation or spaces'));
--              common_input('fullname', _('Full name'),
--                                       ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
--              common_input('homepage', _('Homepage'),
--                                       ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
--                                       _('URL of your homepage, blog, or profile on another site'));
--              common_textarea('bio', _('Bio'),
--                                              ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
--                                              _('Describe yourself and your interests in 140 chars'));
--              common_input('location', _('Location'),
--                                       ($this->arg('location')) ? $this->arg('location') : $profile->location,
--                                       _('Where you are, like "City, State (or Region), Country"'));
--              common_input('tags', _('Tags'),
--                                       ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
--                                       _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
-+        common_element_start('form', array('method' => 'POST',
-+                                           'id' => 'profilesettings',
-+                                           'action' => common_local_url('profilesettings')));
-+        common_hidden('token', common_session_token());
-+        
-+        # too much common patterns here... abstractable?
-+        
-+        common_input('nickname', _('Nickname'),
-+                     ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
-+                     _('1-64 lowercase letters or numbers, no punctuation or spaces'));
-+        common_input('fullname', _('Full name'),
-+                     ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
-+        common_input('homepage', _('Homepage'),
-+                     ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
-+                     _('URL of your homepage, blog, or profile on another site'));
-+        common_textarea('bio', _('Bio'),
-+                        ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
-+                        _('Describe yourself and your interests in 140 chars'));
-+        common_input('location', _('Location'),
-+                     ($this->arg('location')) ? $this->arg('location') : $profile->location,
-+                     _('Where you are, like "City, State (or Region), Country"'));
-+        common_input('tags', _('Tags'),
-+                     ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
-+                     _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
-hunk ./actions/profilesettings.php 118
--
-hunk ./actions/profilesettings.php 142
--              if ($original) {
--                      common_element('img', array('src' => $original->url,
--                                                                              'class' => 'avatar original',
--                                                                              'width' => $original->width,
--                                                                              'height' => $original->height,
--                                                                              'alt' => $user->nickname));
--              }
-+        if ($original) {
-+            common_element_start('div', array('id'=>'avatar_original', 'class'=>'avatar_view'));
-+            common_element('h3', null, _("Original:"));
-+            common_element_start('div', array('id'=>'avatar_original_view'));
-+            common_element('img', array('src' => $original->url,
-+                                        'class' => 'avatar original',
-+                                        'width' => $original->width,
-+                                        'height' => $original->height,
-+                                        'alt' => $user->nickname));
-+            common_element_end('div');
-+            common_element_end('div');
-+        }
-hunk ./actions/profilesettings.php 157
--              if ($avatar) {
--                      common_element('img', array('src' => $avatar->url,
--                                                                              'class' => 'avatar profile',
--                                                                              'width' => AVATAR_PROFILE_SIZE,
--                                                                              'height' => AVATAR_PROFILE_SIZE,
--                                                                              'alt' => $user->nickname));
--              }
-+        if ($avatar) {
-+            common_element_start('div', array('id'=>'avatar_preview', 'class'=>'avatar_view'));
-+            common_element('h3', null, _("Preview:"));
-+            common_element_start('div', array('id'=>'avatar_preview_view'));
-+            common_element('img', array('src' => $original->url,//$avatar->url,
-+                                        'class' => 'avatar profile',
-+                                        'width' => AVATAR_PROFILE_SIZE,
-+                                        'height' => AVATAR_PROFILE_SIZE,
-+                                        'alt' => $user->nickname));
-+            common_element_end('div');
-+            common_element_end('div');
-hunk ./actions/profilesettings.php 169
-+            foreach(array('avatar_crop_x', 'avatar_crop_y', 'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
-+                common_element('input', array('name' => $crop_info,
-+                                              'type' => 'hidden',
-+                                              'id' => $crop_info));
-+            }
-+            common_submit('crop', _('Crop'));
-+        }
-hunk ./actions/profilesettings.php 184
--
-hunk ./actions/profilesettings.php 410
--              @unlink($_FILES['avatarfile']['tmp_name']);
--      }
-+        @unlink($_FILES['avatarfile']['tmp_name']);
-+    }
-+
-+    function crop_avatar() {
-+
-+        $user = common_current_user();
-+        $profile = $user->getProfile();
-+
-+        $x = $this->arg('avatar_crop_x');
-+        $y = $this->arg('avatar_crop_y');
-+        $w = $this->arg('avatar_crop_w');
-+        $h = $this->arg('avatar_crop_h');
-+
-+        if ($profile->crop_avatars($x, $y, $w, $h)) {
-+            $this->show_form(_('Avatar updated.'), true);
-+        } else {
-+            $this->show_form(_('Failed updating avatar.'));
-+        }
-+    }
-hunk ./classes/Avatar.php 82
--      function to_image() {
--              $filepath = common_avatar_path($this->filename);
--              if ($this->mediatype == 'image/gif') {
--                      return imagecreatefromgif($filepath);
--              } else if ($this->mediatype == 'image/jpeg') {
--                      return imagecreatefromjpeg($filepath);
--              } else if ($this->mediatype == 'image/png') {
--                      return imagecreatefrompng($filepath);
--              } else {
--                      return NULL;
--              }
--      }
--      
--      function &pkeyGet($kv) {
--              return Memcached_DataObject::pkeyGet('Avatar', $kv);
--      }
-+    function scale_and_crop($size, $x, $y, $w, $h) 
-+    {
-+
-+        $image_s = imagecreatetruecolor($size, $size);
-+        $image_a = $this->to_image();
-+
-+        # Retain alpha channel info if possible for .pngs
-+        $background = imagecolorallocate($image_s, 0, 0, 0);
-+        ImageColorTransparent($image_s, $background);
-+        imagealphablending($image_s, false);
-+
-+        imagecopyresized($image_s, $image_a, 0, 0, $x, $y, $size, $size, $w, $h);
-+
-+        $ext = ($this->mediattype == 'image/jpeg') ? ".jpeg" : ".png";
-+
-+        $filename = common_avatar_filename($this->profile_id, $ext, $size, common_timestamp());
-+
-+        if ($this->mediatype == 'image/jpeg') {
-+            imagejpeg($image_s, common_avatar_path($filename));
-+        } else {
-+            imagepng($image_s, common_avatar_path($filename));
-+        }
-+
-+        $cropped = DB_DataObject::factory('avatar');
-+        $cropped->profile_id = $this->profile_id;
-+        $cropped->width = $size;
-+        $cropped->height = $size;
-+        $cropped->original = false;
-+        $cropped->mediatype = ($this->mediattype == 'image/jpeg') ? 'image/jpeg' : 'image/png';
-+        $cropped->filename = $filename;
-+        $cropped->url = common_avatar_url($filename);
-+        $cropped->created = DB_DataObject_Cast::dateTime(); # current time
-+
-+        if ($cropped->insert()) {
-+            return $cropped;
-+        } else {
-+            return NULL;
-+        }
-+    }
-+
-+    function to_image() 
-+    {
-+        $filepath = common_avatar_path($this->filename);
-+        if ($this->mediatype == 'image/gif') {
-+            return imagecreatefromgif($filepath);
-+        } else if ($this->mediatype == 'image/jpeg') {
-+            return imagecreatefromjpeg($filepath);
-+        } else if ($this->mediatype == 'image/png') {
-+            return imagecreatefrompng($filepath);
-+        } else {
-+            return NULL;
-+        }
-+    }
-+    
-+    function &pkeyGet($kv) 
-+    {
-+        return Memcached_DataObject::pkeyGet('Avatar', $kv);
-+    }
-+
-hunk ./classes/Profile.php 124
--      function delete_avatars() {
--              $avatar = new Avatar();
--              $avatar->profile_id = $this->id;
--              $avatar->find();
--              while ($avatar->fetch()) {
--                      $avatar->delete();
--              }
--              return true;
--      }
-+    function crop_avatars($x, $y, $w, $h) 
-+    {
-+
-+        $avatar = $this->getOriginalAvatar();
-+        $this->delete_avatars(false); # don't delete original
-+
-+        foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
-+            # We don't do a scaled one if original is our scaled size
-+            if (!($avatar->width == $size && $avatar->height == $size)) {
-+                $s = $avatar->scale_and_crop($size, $x, $y, $w, $h);
-+                if (!$s) {
-+                    return NULL;
-+                }
-+            }
-+        }
-+        return true;
-+    }
-+
-+    function delete_avatars($original=true) 
-+    {
-+        $avatar = new Avatar();
-+        $avatar->profile_id = $this->id;
-+        $avatar->find();
-+        while ($avatar->fetch()) {
-+            if ($avatar->original) {
-+                if ($original == false) {
-+                    continue;
-+                }
-+            }
-+            $avatar->delete();
-+        }
-+        return true;
-+    }
-hunk ./lib/settingsaction.php 63
--      function form_header($title, $msg=NULL, $success=false) {
--              common_show_header($title,
--                                 NULL,
--                                 array($msg, $success),
--                                                 array($this, 'show_top'));
--      }
-+    function form_header($title, $msg=NULL, $success=false) 
-+    {
-+        common_show_header($title,
-+                           array($this, 'show_header'),
-+                           array($msg, $success),
-+                           array($this, 'show_top'));
-+    }
-+
-+    function show_header() 
-+    {
-+        common_element('link', array('rel' => 'stylesheet',
-+                                     'type' => 'text/css',
-+                                     'href' => common_path('js/jcrop/jquery.Jcrop.css?version='.LACONICA_VERSION),
-+                                     'media' => 'screen, projection, tv'));
-+        common_element('script', array('type' => 'text/javascript',
-+                                       'src' => common_path('js/jcrop/jquery.Jcrop.pack.js')));
-+        common_element('script', array('type' => 'text/javascript',
-+                                       'src' => common_path('js/jcrop/jquery.Jcrop.go.js')));
-+    }
+hunk ./actions/facebookhome.php 78
+-                        echo '<fb:success message="You can now use the Identi.ca from Facebook!" />';
++                        echo '<fb:success message="You can now use Identi.ca from Facebook!" />';
+hunk ./actions/facebooksettings.php 72
+-            .'<fb:add-section-button section="profile"/>'
++            .'<p><fb:add-section-button section="profile"/></p>'
+hunk ./actions/facebooksettings.php 75
+-        $fbml .= '<fb:prompt-permission perms="status_update"><h2>Allow Identi.ca to update my Facebook status</h2></fb:prompt-permission>';
++        $fbml .= '<p><fb:prompt-permission perms="status_update"><h2>Allow Identi.ca to update my Facebook status</h2></fb:prompt-permission></p>';
++
++        if ($facebook->api_client->users_hasAppPermission('status_update')) {
+hunk ./actions/facebooksettings.php 106
++    }
++
+hunk ./lib/facebookaction.php 75
+-        $html = Facebookaction::Aender_notice($notice);
++        $html = Facebookaction::render_notice($notice);
index 069ea5e75ce691c1cae0ed27e0cff41fc9fcba90..6206fb6c2704498f3e8300aa47cddb6b52dd5f30 100644 (file)
@@ -75,7 +75,7 @@ class FacebookhomeAction extends FacebookAction
                     $flink_id = $flink->insert();
 
                     if ($flink_id) {
-                        echo '<fb:success message="You can now use the Identi.ca from Facebook!" />';
+                        echo '<fb:success message="You can now use Identi.ca from Facebook!" />';
                     }
 
                     $this->show_home($facebook, $fbuid, $user);
index 469bcfc459f19d08204f11f0ce18ff99dae16b76..d28b1aa5ca95b7027be03d16b15bcce04b9ac6a3 100644 (file)
@@ -69,10 +69,12 @@ class FacebooksettingsAction extends FacebookAction
 
         $fbml = '<fb:if-section-not-added section="profile">'
             .'<h2>Add an Identi.ca box to my profile</h2>'
-            .'<fb:add-section-button section="profile"/>'
+            .'<p><fb:add-section-button section="profile"/></p>'
             .'</fb:if-section-not-added>';
 
-        $fbml .= '<fb:prompt-permission perms="status_update"><h2>Allow Identi.ca to update my Facebook status</h2></fb:prompt-permission>';
+        $fbml .= '<p><fb:prompt-permission perms="status_update"><h2>Allow Identi.ca to update my Facebook status</h2></fb:prompt-permission></p>';
+
+        if ($facebook->api_client->users_hasAppPermission('status_update')) {
 
         $fbml .= '<form method="post" id="facebook_settings">'
         .'<h2>Sync preferences</h2>'
@@ -101,6 +103,8 @@ class FacebooksettingsAction extends FacebookAction
         .'</p>'
         .'</form>';
 
+    }
+
         echo $fbml;
 
         $this->show_footer();
index 7fa097587d8f45035f5f97d93c1f4f9fafe62409..9230bad59368c025d09ab1f0f99579dfca11819c 100644 (file)
@@ -72,7 +72,7 @@ class FacebookAction extends Action
          }
          </style>';
 
-        $html = Facebookaction::Aender_notice($notice);
+        $html = Facebookaction::render_notice($notice);
 
  
         $fbml = "<fb:wide>$style $html</fb:wide>";