Hello,
On my website, I have mant translators working on differents domains managed with domain acces.
I wanted then to use the translation overview page but with the ability to choose on which domain they are working at.
I just added a filter which list all domains.
I used the 2009-Sep-22 dev version to build the patch

CommentFileSizeAuthor
#4 translation_overview_domain_filter.patch1.37 KBAnonymous (not verified)
#2 translation_overview_domain_filter.patch1.49 KBAnonymous (not verified)
translation_overview_domain_filter.patch1.27 KBAnonymous (not verified)

Comments

drewish’s picture

Status: Needs review » Needs work

Are you familiar with the module_exists() function? it would simplify this patch a bit. Also you're not following the Drupal coding standards for spacing between the if and ( and ) and {. Take a look at the coder module to help identify these issues.

+  //The domains filter
+  if (($file = db_result(db_query("SELECT filename FROM {system} WHERE type = 'module' AND name = 'domain' AND status = 1"))) && file_exists($file)) {
+    $domains = domain_domains();
+    if(count($domains) > 1){
+      $filters['domain'] = array('title' => t('Domain'),'options' => array());
+      foreach($domains as $domain){
+        $filters['domain']['options'][$domain['domain_id']] = $domain['sitename'];
+      }
+    }
+  }

Could you put a comment that domain referes to the domain access module? Actually could you do that on the other part too?

+        case 'domain':
+          $table = "da$index";
+          $where['domain'] = "$table.gid = '%d'";
+          $join[$table] = "INNER JOIN {domain_access} $table ON n.nid = $table.nid ";
+          break;
Anonymous’s picture

StatusFileSize
new1.49 KB

Sorry for the forgotten spaces, it's my speciality
About the module_exists() function, I knew that it exists, but I really don't like how it is coded.
It uses the module_list() wich return the list of all modules installed after having performed a file_exists on every files of every modules (http://api.drupal.org/api/function/module_list/6). I've more than one hundred modules installed so it's far to be efficient.
I just want to know if one module is installed so I just do the necessary.

drewish’s picture

I'm not persuaded by your argument against using module_exists(). The results are statically cached so it only happens once per request and there's plenty of other places in the code where it's called. We're already calling language_list() which indirectly calls module_exists().

Anonymous’s picture

StatusFileSize
new1.37 KB

Ok, I agree on that, Thanks for the enlightenment
I post an modified version of the path following your advise

drewish’s picture

Status: Needs work » Fixed

thanks, committed to HEAD.

Status: Fixed » Closed (fixed)

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