What's the situation with a D7 version of this? I can't see one so far - but what with the name change I may have missed it

Do you have it planned any time soon? Is it unecessary? Is there a work around?

Thanks!

Comments

icecreamyou’s picture

Category: support » feature

I haven't put any thought or effort into planning or building a D7 version of this module yet.

mathankumarc’s picture

Status: Active » Needs review
StatusFileSize
new9.48 KB

Here is the initial(Maybe complete) port.

icecreamyou’s picture

Status: Needs review » Needs work

Well that was fast.

This patch doesn't upgrade everything: hook_perm() is now hook_permission(), hook_theme() has changed, and there's no migration path for the two settings variables. But it's a pretty good start -- thanks. @mathankumarc, I've given you full maintainer permissions on this project so you can commit and tag a new release if you'd like once these issues and the ones below are fixed.

+++ b/fbssts.js
@@ -32,7 +34,7 @@ Drupal.behaviors.fbssts = function (context) {
-        fbssts_box.load(Drupal.settings.basePath +'index.php?q=fbssts/load',
+        fbssts_box.load(Drupal.settings.basePath +'fbssts/load',

The index.php?q= part is required (otherwise this fails for sites with Clean URLs disabled).

+++ b/fbssts.js
@@ -106,3 +109,23 @@ $.fn.textBeforeCursor = function(distanceBefore) {
+// Change remaining character count.
+function fbss_print_remaining(fbss_remaining, where) {
+  if (fbss_remaining >= 0) {
+    where.html(Drupal.formatPlural(fbss_remaining, '1 character left', '@count characters left', {}));
+    if (statuses_submit_disabled) {
+      $('.statuses-submit').attr('disabled', false);
+      statuses_submit_disabled = false;
+    }
+  }
+  else if (Drupal.settings.statuses.maxlength != 0) {
+    where.html('<span class="statuses-negative">'+ Drupal.formatPlural(Math.abs(fbss_remaining), '-1 character left', '-@count characters left', {}) +'</span>');
+    if (!statuses_submit_disabled) {
+      $('.statuses-submit').attr('disabled', true);
+      statuses_submit_disabled = true;
+    }
+  }
+}

This function is already in statuses.js and as far as I can tell there's no reason for it to be added again here.

+++ b/fbssts.module
@@ -90,15 +94,17 @@ function fbssts_get_suggestions($type, $part, $count) {
+  $query->condition('t.type', $type)

Put the ->condition() on a separate line so it matches the second one below it

+++ b/fbssts.module
@@ -90,15 +94,17 @@ function fbssts_get_suggestions($type, $part, $count) {
+    ->condition('t.name', db_like($part) . '%%', 'LIKE');

Only one % sign is necessary (in D6 two are required because the first one is the escape symbol).

+++ b/fbssts.module
@@ -90,15 +94,17 @@ function fbssts_get_suggestions($type, $part, $count) {
+    $query->condition('s.created', time() - variable_get('fbssts_time', ''), '>');

Use REQUEST_TIME instead of time()

+++ b/fbssts.module
@@ -133,8 +135,10 @@ function _fbssts_get_suggestions($type, $part, $count, $own, $exclude = array())
+    ->where('LOWER(name) LIKE LOWER(:username)', array(':username' => db_like($part) . '%%'));

Only one % necessary

mathankumarc’s picture

Will revise the patch and work with you on the D7 release.

mathankumarc’s picture

This function is already in statuses.js and as far as I can tell there's no reason for it to be added again here.

In statuses.js file fbss_print_remaining() function was put in the following context,

(function($) {

})(jQuery);

So its not available outside of the statuses.js

How can we address this scenario?

icecreamyou’s picture

Ooh, right. We can just move the function outside of that closure in statuses.js and replace $() with jQuery() inside of it.

mathankumarc’s picture

StatusFileSize
new9.67 KB

Here is the revised patch.

Added migration path also(However I'm not sure about that).

Holding on this until #1505346: Move fbss_print_remaining() out of jQuery closure gets fixed.

icecreamyou’s picture

I don't know what I was thinking about the migration path. Looking at it now I don't think a migration path is needed. The only reason variables would need to be migrated is if there is a name change, and there isn't one here. Sorry about that. Other than that this is RTBC

mathankumarc’s picture

Status: Needs work » Fixed

Added new branch for D7. Downloadable file will be available in another 12 hours.

Status: Fixed » Closed (fixed)

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