Hi guys im the new co-mantainer of Service Links module and i'll be happy to share my plain for improve the general features with you all.
For now im working in 5.x branch and i already made in my local copy some change (added twitter service and the option for open in new window), but i think can be more useful a new approach for manage the project:

  1. add the new service must be really easy and fast, so i tought to create a service_links.inc file that contain the associative array of all services and their attributes (url, text, internal name, image name), maybe some of them can be derivate from the others (the image name can be the same of internal name + png extension) and settings hook modify will be automatic too (after some fix);
  2. the theme api for build the link must be open to the new attributes (b.e. for introduce a class name);
  3. the render must allow also a supplementary theme way (http://drupal.org/node/265391);
  4. integration with Share module, through the patch (i hope it will be soon upgraded to 6.x branch);
  5. add the service image too in the settings page.

These are just few idea's i had, any comment is welcome :))

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TheCrow’s picture

I didn't yet mentioned it but i found the interestling patch by bdragon at http://drupal.org/node/185642 i wish integrate it...
Instead of service.inc, will have other modules with just the address of services, respecting in this way the Drupal extension philosophy :P

RobLoach’s picture

Definitely seems like a good place for DRUPAL-6--2 ;-) .

TheCrow’s picture

Version: 6.x-2.x-dev » master
Component: Miscellaneous » Code
Assigned: Unassigned » TheCrow
Category: feature » task
Status: Needs review » Active

yes Rob, all these changes are for the new 2.x branch, and plus after your contrib about Yahoo Buzz i tought to speed the work changing the original plan; below all the news:

  1. [OK] Adding the services will be really fast: put the image under images/ folder of service_links module) create a module implementing the hook_service_links() and returning an array like this:
    $links['my_service'] = array(
      'name' => 'MyService',
      'description' => t('Bookmark the post on MyService now!'),
      'link' => 'http://myservice.com/?q=<encoded-url>&title=<encoded-title>',
      // The icon field is optional if the image has the same name of your service and 'png' extension
      // and if it's stored under the default path 'images/' (under service_links module)
      'icon' => 'icon_name.png',
      // Javascript file go under 'javascript/' folder
      'javascript' => 'my_javascript.js',
      // CSS file go under 'css/' folder
      'css' => 'my_styles.css',
      // HTML attributes are allowed
      'attributes' => array('class' => 'need a special class'),
      // Callback function could be useful for integrate external modules
      'callback' => 'my_function_name',
    );
    
  2. [OK] settings page: services are listed with the related icon and the group from where they come;
  3. [OK] service sorting through weights for 5.x branch;
  4. [OK] visual service sorting for 6.x branch (#365803: Change the order of icons);
  5. [OK] activable support for short-link for all the services or just for Twitter and similar via tag (#408618: Twitter TinyURL). The number of short-link services can be extended through Shorten module (#458968: Integrate with Shorten URLs module);
  6. [OK] support for Share module;
  7. [OK] support for Forward;
  8. [OK] support for browser bookmarking (Firefox, IE, Opera, Chrome). Concerning Chrome this script show only an alert window about the keystroke for add the bookmark;
  9. [OK] block with Fisheye effect;
  10. [Postponed for a future release] Indipendent popup effect;
  11. [Postponed for a future release] Tag Extension;
  12. [Postponed for a future release] CSS sprites instead of classical IMG elements;
  13. [Postponed for a future release] bookmark count with statistics page;
  14. [OK] support for Views (#494204: Views integration: Add a Service Links field);
  15. [OK] configurable path for custom icons;
  16. [OK] support for not-node pages;
  17. [OK] support for external javascript;
  18. [OK] support for css, cache, callback function and alterable links 380322#comment-1922548.

Some details:

  1. About the default services they are separate from the core providing another folder (services/) which store little modules that implement hook_service_links() (general_services.module, german_services.module, ...) all the icons are located under images/ folder (except for general, the other services have locale code prefix: _it_oknotizie, _ru_ruspace, ...);
  2. services are grouped by spoken lang for don't overload the general_service.module with less used services (italian_services.module, spanish_services.module, russian_service.module, ...);
  3. all the module related to service links will be in the same service links group (.info file);
  4. there are other little news not listed that come from single requests but interestling enough to be added.

The features not yet implemented will be considered for a further development, after release the 2.0 i'll open the 7.x-2.x-dev branch.

Many thanks to whoever shared their ideas and be welcome who want to partecipate :))

attiks’s picture

We needed a link to the forward module and a 'bookmark this' link

For the forward module it's pretty easy (I copied their icon to the image directory)

  $links['forward'] = theme('service_links_build_link', t('Forward'), "/forward?path=node/$node->nid", t('Send to a friend.'), 'images/forward.gif', $nodelink);

For the 'bookmark this' it's a bit more complicated, since there's no support for a class on a link (idea: pass a unique identifier to the theme function and a a class like service_link_uniqueid to each link). We ended up doing this

  $links['bookmark'] = theme('service_links_build_link', t('Bookmark'), "/", t('Bookmark this page.'), 'images/bookmark.gif', $nodelink);

create a servicelink.js file and add it to your theme.info file

$(document).ready(function(){
// only show for FF and IE
  if (window.sidebar || window.external) { 
    $("a:has(img[src=/sites/all/modules/service_links/images/bookmark.gif])").click(function(event){
      event.preventDefault();
      var url = this.href;
      var title = this.title;
      
      if (window.sidebar) { 
        window.sidebar.addPanel(title, url,"");
      } else if ( window.external ) { 
        window.external.AddFavorite( url, title);
      }
    });
    } else {
      $("a:has(img[src=/sites/all/modules/service_links/images/bookmark.gif])").remove();
    }
});
TheCrow’s picture

Great ideas attiks, i'll support both; for the second maybe i'll integrate Bookmark US module just for don't duplicate the efforces :))

Thank you!

greenSkin’s picture

Initial Drupal 6 version of Share is available. Docs haven't yet been written for the new API but you can take a look at the share_plugin or sharethis_plugin and link_codes modules for examples of how to use the API. The _plugin modules are used to provide different methods of displaying different ways to share. To add a tab to the share_plugin, look at the link_codes module.

The Share API is not set in stone so any advice or needs please share.

Initial patch for Share version 2 can be found at #413860: Beginning work for implementation of Share hooks

attiks’s picture

Good idea integrating with bookmark, only 'problem' i see is that their icon is a bit bigger then yours, so it looks a bit weird.

TheCrow’s picture

@greenSkin great news, if i understood well your module now allow different profiles and for each tab module different settings can be configurated (as link_codes do)... if that's right ill need more time for integrate the whole system! Anyway thank you for the patch is a good start :)).

@attiks another problem with bookmark_us is the module allow the bookmark only for the current page and not the single post. Ill try to talk with the author for expand some feature otherwise ill bring service links in the hall of shame =))

laryn’s picture

It would be neat to have an option to mimic the fisheye effect shown here:
http://www.sociofluid.com/

...without having to link an external script like that service requires.

loze’s picture

Hello,

I think it would be nice feature if this module kept track of what was being bookmarked.
so you could have a "most bookmarked" block.

great work.

RobLoach’s picture

You said this was in DRUPAL-6--2? I don't see it anywhere. I just see DRUPAL-6--1.....

Here is a proposal for a hook_service_links(). Since we don't really know if the service requires additional JavaScript, or CSS, we have a gathering hook and an adding hook that's called when a service is added.

/**
 * Adds external services to the Service Links.
 */
function hook_service_links() {
  $services['myservice'] = array(
    'name' => 'MyService',
    'description' => 'Bookmark the post on MyService now!',
    'link' => 'http://myservice.com/?q=!url&title=!title',
    'icon' => drupal_get_path('module', 'service_links') . '/images/myservice.png',
  );
  return $services;
}

/**
 * Adding an external service link to the page.
 *
 * @param $service
 *   The service that we're adding.
 */
function hook_service_links_add($service) {
  if ($service == 'myservice') {
   drupal_add_js(drupal_get_path('module', 'service_links') . '/myservice.js');
 }

So we end up with hook_service_links() and hook_service_links_add(). We could even easily add a hook_service_links_alter() ;-) .

TheCrow’s picture

@lpkb, @loze two pretty ideas i would like to add them as external addons but about the fisheye effect for have something good will need 128x128 icons, so i dont know if is better keep it as an example for theme extension.

@Rob before upload im fixing some detail and reviewing some point... wondering if the render function can accept a theme function as input (so we reuse the standard render function but with another theme job) but too if the render function can be variable and served as option... if we want integrate the bookmarks count i tought on a menu item as service_links/twitter/node-id (and relative callback function)... links will have an url in this path instead of the classic http://twitter.com/... so we can count the link and redirect at the service page after the validation... :))

[EDIT] 6.x-2.x Branch is officially in CVS and available for download in the project page!

RobLoach’s picture

I did a bunch of work with Service Links today and hit up a number of things in commit 250904.

Caching
The retrieval of all the service links is now cached for some speed improvement. Due to this, a hook_service_links_alter() could be introduced.
Callback function
The 'callback' function in hook_service_links is invoked when the service link is created. This allows any additional custom code to be run when processing the link.
Service specific CSS
Like 'javascript', we can now have a CSS file added when the service link is added to the page.
Documentation
I added a service_links.api.php which details hook_service_links and hook_service_links_alter.
Works nicer with other modules
Once this commit was in, it allowed the removal of the majority of the ShareThis module making the ShareThis 6.x-2.x branch depend on Service Links to stick the ShareThis button in the correct location. Check it out!

Regarding #10 in your todo list , I just made #548960: Use inline popup for Service Links.

JasonSafro’s picture

I'm a big fan of your module and appreciate the work you all are putting in. Do you have any guesses about when you will release 6.x.2?

nco71’s picture

Following

nstryker’s picture

following

shaunak’s picture

Version: master » 6.x-2.x-dev
Component: Code » User interface
Category: task » feature
Priority: Normal » Minor

The 2.x branch of the module *greatly* improves the functionality of the module, great work on it.

I have a few suggestions.
1. Service link should allow the user a choice to select the size of images. [perhaps a "Large Icons: Yes/No" check-box?]
2. Integration with the AddtoAny module.

Deas’s picture

Priority: Minor » Normal

hello,

i just installed the module and like it very much! i placed the servicelinks block in the right menu pane. when i select icons only it takes only 3 lines, but when you move the mouse over the icons you don´t get a popup which service it is. enabling icon + text makes a list where you must scroll down a long list - not what i want...

feature request: please add a mouseover effect for each icon so the service name is displayed when the cursor is over a icon. this would make it easier for people to find the correct social bookmark link.

thank you very much!

brgds Deas

lordsilk’s picture

following

blavish’s picture

Component: User interface » Miscellaneous
Assigned: TheCrow » Unassigned

This is a brilliant module.

I just have a feature request to ask. I would love to use bigger buttons.

RagsToRich’s picture

This is the best social bookmarking module for Drupal I've found.

Main thing I'd like is buttons which high-light when you mouse-over them... id looks all purdy-like.. :D

netentropy’s picture

Status: Needs review » Active

I really like the refactoring

I would like for it to be possible to use theme functions to place individual bookmarks in the tpl files

something akin to

print $service_links['twitter']

sun’s picture

Status: Active » Needs review
FileSize
975 bytes
warning: array_filter() [function.array-filter]: The first argument should be an array in sites\all\modules\service_links\service_links.module on line 336.
sun’s picture

Hrm... while 2.x probably contains a lot of improvements, it's obvious that the code contains plenty of errors.

sun’s picture

Also restoring wrapping DIV container for block output.

greenSkin’s picture

@sun I noticed you pulled out a $settings = array(); in your patches. I am accustomed to specifing an empty array before filling it, is this bad practice?

sun’s picture

You usually need to initialize an array in loops:

foreach ($foo as $bar) {
  $item = array(); // Without this, array values will be stacked, which may not be intended.
  $item['baz'] = $bar;
}

and for indexed arrays:

$items = array(); // PHP notice without this.
$items[] = 'foo';

Associative arrays, however, don't need to be initialized:

$items['foo'] = 'bar';
greenSkin’s picture

Thanks!

marcvangend’s picture

Hi, thanks for this module. I have two more feature requests for the next version, if it's not too late yet...

1) I would like to enable the service links block on all pages, not just node/[nid] pages. I see no reason why we wouldn't allow users to share a view, or bookmark node/add/issue for instance.

2) For performance reasons, it would be better to use CSS image sprites. I'm not sure though if that can be combined with the fisheye effect.

Jerome F’s picture

following

Fenwick’s picture

Subscribing. Great module; would love to see the 2.x branch finished. Any word how close it is?

mawosch’s picture

Great Module with huge potential.
Is there a timeline for stable release?

jamesialford’s picture

I am wondering if this is the module I am needing. I would like my registered users to add their facebook, Utube, My Space etc information to their profile. When the user post something on my site it will add a link to the users social networking page.

If this is the module, can you give me some details on how to complete this?
If not, Can you tell me one that might work?

Thank you
James

asb’s picture

just subscribing

pedrorocha’s picture

Status: Active » Needs review

subscribing

jasont28’s picture

I am seeing a need for Mashable style social buttons appearing. The ones that sit to the side of the users content, even when they scroll down the page. An example can be seen here http://mashable.com/2010/05/05/iphone-hd-video-recording/

My question with the 6.x-2.x Branch, is this possible to include as part of the module or would it be best left for design based implementation. Giving readers the ability to Like, Tweet, Stumble, Digg content without having to search for the buttons is appearing to be a prominent feature request.

baalsgate’s picture

Version: 6.x-2.x-dev » 5.x-1.2

I have a problem in submitting posts to facebook , I assume that other services would be the same , where the teaser view has the name of the image included in the description, I have tried google for a solution but this is hard to explain to a search engine on what my problem is, also tried asking in the IRC #drupal channel but have not got anywhere with that ... I have the same problem with ubercart products in Google search engine results, but I am at a loss to know how I might hide the file name from the description text.

thanks , hope someone can help and that i have not put this comment in the wrong place ... please forgive me if i have

cheers

marcvangend’s picture

Version: 5.x-1.2 » 6.x-2.x-dev

@baalsgate: this topic is about new features in the 6.x-2.x-dev version. Please open a new issue for your support request.

coolhandlukek2’s picture

subscribing - Just a thought, do you have any plan to integrate this with userpoints.module?

Melissamcewen’s picture

Nthing bigger buttons

benklocek’s picture

subscribe

fehin’s picture

subscribing

nelslynn’s picture

subscribing

volongoto’s picture

subscribing

Marat’s picture

+ subscribing, good work has been done ... love to see 2 soon!

anonymous07’s picture

Subscribe. Excellent work. Installed in production and seems to work very well. Thank you

SeanBannister’s picture

sub

anonymous07’s picture

Visiting again to say this module is absolutely awesome. All the updates have added great features.

It has been a much smoother road than some of the other modules, lol

Thanks for all the hard work on this!

giovanninews’s picture

Version: 6.x-2.x-dev » 6.x-1.1
FileSize
43.38 KB

I apologize to the community for posting in the wrong place my previous posting. I hope this is the right place. Service_links module, the latest version 6.x-1.1 produces an error xhtml, perhaps there will have noticed.
Giovanni

marcvangend’s picture

Version: 6.x-1.1 » 6.x-2.x-dev

giovanninews, sorry, but this is not the right place. Please create a new issue at http://drupal.org/node/add/project-issue/service_links. This issue is about new features for version 2.

By setting "Version" to "6.x-1.1", you changed it for this whole issue, not just your comment. I'm setting it back to 2.x now.

mama21mama’s picture

Version: master » 6.x-2.x-dev
Component: Code » Miscellaneous
Assigned: TheCrow » Unassigned
Category: task » feature
Status: Active » Needs review
<encoded-url>&title=<encoded-title>

do not know how to adapt this

http://www.sonico.com/share.php?url=$url
http://bitacoras.com/anotaciones/$url
http://www.feedburner.com/fb/a/emailFlare?sonicoitemTitle=$title&uri=$url

TheCrow’s picture

http://www.sonico.com/share.php?url=<encoded-url>
http://bitacoras.com/anotaciones/<encoded-url>
http://www.feedburner.com/fb/a/emailFlare?sonicoitemTitle=<encoded-title>&uri=<encoded-url>
HongPong’s picture

Subscribe - I'll chime in that it would be nice to be able to let each user set their own service links (my youtube, my facebook etc)... Maybe it could also render address fields and piggyback off link CCK that way, just acting as a display helper with those nice icons etc.

TheCrow’s picture

@HongPong do you mean badges? (http://drupal.org/node/383294)

rneal’s picture

Just wanted to leave a note to say that I installed the "refactored" version after not using the previous version for a while, and the new one is a significant improvement and works great. Thanks, and nice work!

dddave’s picture

Status: Needs review » Fixed

@TheCrow

You did a great job. Thanks for all your work and for continuing this path.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.