]> git.sur5r.net Git - contagged/commitdiff
tagcloud added
authorAndreas Gohr <gohr@cosmocode.de>
Mon, 23 Jan 2006 09:27:33 +0000 (10:27 +0100)
committerAndreas Gohr <gohr@cosmocode.de>
Mon, 23 Jan 2006 09:27:33 +0000 (10:27 +0100)
darcs-hash:20060123092733-6e07b-48424c2a174293a7557b27f200358aa23c21e57e.gz

lang/de.php
lang/en.php
pix/cog.png [new file with mode: 0644]
tags.php [new file with mode: 0644]
templates/list_filter.tpl
templates/orgs.tpl
templates/style.css
templates/tags.tpl [new file with mode: 0644]

index d32c37f6fa3ec040e507f73f808fde28f2d6103e..0e11b9f179e5fad8189aba490008e6a66961d5f9 100644 (file)
@@ -24,6 +24,7 @@ $lang[manager]        = 'Key Account';
 
 $lang[anniversary]    = 'Geburtstag';
 $lang[marker]         = 'Tags';
+$lang[tagcloud]       = 'Alle verwendeten Tags, alphabetisch sortiert. Häufig verwendete Tags werden größer dargestellt.';
 
 $lang[business]       = 'Geschäftlich';
 $lang[private]        = 'Privat';
index 7e87240318438a279f9f3c73d5012b47c4eabd09..369d82d44f75cf22da1298259d690ebed18434d6 100644 (file)
@@ -24,6 +24,7 @@ $lang[manager]        = 'Key Account';
 
 $lang[anniversary]    = 'Birthday';
 $lang[marker]         = 'Tags';
+$lang[tagcloud]       = 'All used tags, sorted alphabetically. Frequently used tags are shown bigger.';
 
 $lang[business]       = 'Business';
 $lang[private]        = 'Private';
diff --git a/pix/cog.png b/pix/cog.png
new file mode 100644 (file)
index 0000000..dba86c9
Binary files /dev/null and b/pix/cog.png differ
diff --git a/tags.php b/tags.php
new file mode 100644 (file)
index 0000000..13b07b2
--- /dev/null
+++ b/tags.php
@@ -0,0 +1,46 @@
+<?
+  require_once('init.php');
+  ldap_login();
+
+  //prepare templates
+  tpl_std();
+  $smarty->assign('tagcloud',tag_cloud());
+  //display templates
+  header('Content-Type: text/html; charset=utf-8');
+  $smarty->display('header.tpl');
+  $smarty->display('list_filter.tpl');
+  $smarty->display('tags.tpl');
+  $smarty->display('footer.tpl');
+
+  function tag_cloud(){
+    global $conf;
+    global $LDAP_CON;
+    if(!$conf[extended]) return;
+    
+    $result = ldap_queryabooks('(objectClass=contactPerson)','marker');
+
+    $max = 0;
+    $tags = array();
+    foreach ($result as $entry){
+      if(count($entry['marker'])){
+        foreach($entry['marker'] as $marker){
+          $marker = strtolower($marker);
+          $tags[$marker] += 1;
+          if($tags[$marker] > $max) $max = $tags[$marker];
+        }
+      }
+    }
+    ksort($tags);
+
+    $out = '';
+    foreach($tags as $tag => $cnt){
+      $pct = round($cnt * 20 / $max); // percents from 0 to 20
+
+      $out .= '<a href="index.php?marker='.rawurlencode($tag).'" class="tc'.$pct.'">';
+      $out .= htmlspecialchars($tag).'</a> ';
+    }
+
+    return $out;
+  }
+
+?>
index 579659ee37d2858ba62c2c1eabb0d4a0fde0918e..ac0dab4a84a6b92923c164d73a4f97be45dd4bc3 100644 (file)
   </form>
 </td>
 {/if}
+
 {if $conf.extended}
 <td class="filterrow" align="right">
   <form method="get" action="index.php" style="display:inline">
-    {$lang.marker}:
+    <a href="tags.php">{$lang.marker}</a>:
     <input name="marker" class="searchfield" type="text" id="taglookup" value="{$smarty.request.marker|escape}"/>
     <input type="submit" value="{$lang.search}" class="searchbutton">
   </form>
index fcfe45ac8847558af73f99cdb5d15e5bfd21773c..4aa3c071cfed140b8237b828dc5dfdbde627cd32 100644 (file)
@@ -1,8 +1,8 @@
 <table width="100%">
 {foreach from=$orgs item=org}
   <tr>
-    <td class="result" width="25">
-      <img src="pix/org.png" border="0" width="22" height="22" align="middle">
+    <td class="result" width="20">
+      <img src="pix/cog.png" border="0" width="16" height="16" align="middle" />
     </td>
     <td class="result">
       <a href="index.php?org={$org|escape:url}">{$org}</a><br>
index 6dff811d2daa3e20b13009745927f62399b4e075..049be1101a436245145bbbfe07b23a6e7ac53b7b 100644 (file)
@@ -132,3 +132,27 @@ div#nedit_editor input {
   font-family:Lucida,Helvetica,Verdana,Arial,Sans-Serif;
   font-size: 12px;
 }
+
+/* TagCloud */
+a.tc0  { font-size: 80%; }
+a.tc1  { font-size: 100%; }
+a.tc2  { font-size: 120%; }
+a.tc3  { font-size: 130%; }
+a.tc4  { font-size: 140%; }
+a.tc5  { font-size: 150%; }
+a.tc6  { font-size: 160%; }
+a.tc7  { font-size: 170%; }
+a.tc8  { font-size: 180%; }
+a.tc9  { font-size: 190%; }
+a.tc10 { font-size: 200%; }
+a.tc11 { font-size: 210%; }
+a.tc12 { font-size: 220%; }
+a.tc13 { font-size: 230%; }
+a.tc14 { font-size: 240%; }
+a.tc15 { font-size: 250%; }
+a.tc16 { font-size: 260%; }
+a.tc17 { font-size: 270%; }
+a.tc18 { font-size: 280%; }
+a.tc19 { font-size: 290%; }
+a.tc20 { font-size: 300%; }
+
diff --git a/templates/tags.tpl b/templates/tags.tpl
new file mode 100644 (file)
index 0000000..203b334
--- /dev/null
@@ -0,0 +1,5 @@
+<p>{$lang.tagcloud}</p>
+
+<div class="tagcloud">
+  {$tagcloud}
+</div>