Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagina fiecărui politician ar trebui să apară ca un activity stream #25

Open
okvivi opened this issue May 3, 2012 · 3 comments
Open

Comments

@okvivi
Copy link
Member

okvivi commented May 3, 2012

** Context **
Cel mai natural fel în care oamenii învață despre concepte, despre prieteni, despre știri, este printr-un stream de fapte, ordonate în timp. Componenta temporală este foarte importantă pentru noi, ca oameni, pentru că ne oferă un punct de referință prin care să înțelegem ceea ce se întâmplă.

** Soluția **
Pagina fiecărui politician ar trebui focusată mult mai mult pe ideea unui activity stream. Atunci când mă uit la un politician, ar trebui să văd în primul rând o listă de evenimente recente importante pentru personajul respectiv, cu un pic de context minimal în jurul acestor evenimente, și cu link-uri către a afla mai multe și a explora mai mult contextul acestor evenimente.

http://hartapoliticii.ro/i/harta-politicii-politician.jpg

Imaginați-vă un fel de facebook generat automat pentru fiecare persoană, cu date pe care harta deja le indexează și crawluiește.
Dacă vă uitați la screenshot-ul de mai sus, sunt mai multe categorii de evenimente posibile:

  • apariții în presă, împreună cu subiectele principale în jurul cărora s-a centrat aceste apariții
  • voturi noi în parlament, sau absențe de la voturi din parlament
  • noi poziții ocupate de anumiți politicieni, că devin miniștri sau că nu mai sunt miniștri, că schimbă partidul, etc.
  • declarații remarcabile subliniate de anumiți utilizatori
  • voturi noi pe issue-uri cunoscute

Asta nu schimbă ceea ce harta prezintă în acest moment. Datele rămân acolo, și explorarea lor rămâne posibilă. Ceea ce ne dorim să adăugăm este un fel ușor pentru utilizatori să simtă că înțeleg mai bine politicienii pe care doresc să îi urmărească.

@dan-bizdadea
Copy link
Member

Am inceput lucrul la issue azi.
Am creat tabela activity_stream avand campurile : id, time, idperson, activity_type, activity_data.
activity_type e varchar cu valori posibile : "news", "votes", etc..
activity_data e camp de timp longtext ce contine un xml cu toate informatiile necesare pentru a afisa activitatile de la data respectiva.

Am implementat clasele ce extind interfata, si am scris un script php ce selecteaza toate persoanele din sistem, si pentru fiecare persoana scrie in activity stream activitatea din ziua respectiva.
Acest script este pus intr-un folder now creat : /crons si va trebui rulat ca un cronjob la sfarsitul zilei.

@sarbull
Copy link
Member

sarbull commented Sep 29, 2012

Incomplet

25_hartapoliticii_activity_stream_news.patch

diff -ur hp/db/hartapoliticii_mock_data.sql hartapoliticii/db/hartapoliticii_mock_data.sql
--- hp/db/hartapoliticii_mock_data.sql  2012-09-29 20:44:11.782806139 +0300
+++ hartapoliticii/db/hartapoliticii_mock_data.sql  2012-09-29 10:52:01.147491249 +0300
@@ -2113,7 +2113,7 @@
 (35, 0, 'hack_file', '', 'yes'),
 (36, 0, 'blog_charset', 'UTF-8', 'yes'),
 (37, 0, 'moderation_keys', '', 'no'),
-(38, 0, 'active_plugins', 'a:4:{i:0;s:19:"akismet/akismet.php";i:1;s:63:"feedburner_feedsmith_plugin_2.3/FeedBurner_FeedSmith_Plugin.php";i:2;s:33:"social-connect/social-connect.php";i:3;s:47:"subscribe-to-comments/subscribe-to-comments.php";}', 'yes'),
+(38, 0, 'active_plugins', 'a:3:{i:0;s:19:"akismet/akismet.php";i:1;s:63:"feedburner_feedsmith_plugin_2.3/FeedBurner_FeedSmith_Plugin.php";i:2;s:47:"subscribe-to-comments/subscribe-to-comments.php";}', 'yes'),
 (39, 0, 'home', 'http://zen.dev', 'yes'),
 (40, 0, 'category_base', '', 'yes'),
 (41, 0, 'ping_sites', 'http://rpc.pingomatic.com/', 'yes'),
Only in hartapoliticii/www: ActivityStreamProducer.php
Only in hartapoliticii/www: crons
Only in hartapoliticii/www/images: people
diff -ur hp/www/person.php hartapoliticii/www/person.php
--- hp/www/person.php   2012-09-29 20:44:11.914806780 +0300
+++ hartapoliticii/www/person.php   2012-09-29 18:36:48.156903432 +0300
@@ -98,6 +98,12 @@

 echo "<div class=identity_img><img src=\"$img\" $t></div>";

+$nume_parlamentar = $_GET['name'];
+?>
+<div align="center" style="padding-top:10px;">
+  <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo rawurlencode($_SERVER['SERVER_NAME'] . "/?name=" . $nume_parlamentar); ?>&amp;send=false&amp;layout=standard&amp;width=310&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:310px; height:35px;" allowTransparency="true"></iframe>
+</div>
+<?php
 // ----------------------------------------------------------
 // -------------- The left hand side section ----------------

@@ -108,82 +114,92 @@
 $t->display('person_qualifiers.tpl');

 // Display all contact details of the person
-include('mods/contact_details.php');
+/*    */ include('mods/contact_details.php');

 // TODO: make the compact mods also something automatic.
 include('mods/news_compact.php');

 include('mods/person_declarations_compact.php');

+
+
+
 $t = new Smarty();
+/*    */ 
 $t->assign('title', $title);
 $t->assign('idperson', $person->id);
 $t->display('person_sidebar_extra_links.tpl');
-
+/*    */ 
 echo "</div></td>";

 // ----------------------------------------------------------
 // --------------- The main mods section --------------------
 echo "<td valign=top>";
-
+/*    */ 
 // If I am displaying an expanded module, this will take the entire content
 // part and we are no longer displaying all the modules of one person.
 //
-if ($expandedModule = isExpandedModule($_GET['exp'])) {
-  // Get the long title of the module to display.
-  $moduleTitle = $person->getLongTitleForWhat($expandedModule);
-
-  // TODO(vivi): Move this stuff into templates too.
-  echo "<div class=module>";
-  echo "<div class=moduletitle>$moduleTitle</div>";
-  echo "<div class=modulecontent>";
-
-  // Based on the module name, load the 'module_expanded.php' file.
-  $filename = str_replace("/", "_", $expandedModule);
-  include('mods/' . $filename . '_expanded.php');
+$viewmode = @$_GET['viewmode'];

-  echo "</div></div>";
+if($viewmode == 'clasic'){

-} else {
-  $history = $person->getHistory();
+    if ($expandedModule != isExpandedModule($_GET['exp'])) {
+      // Get the long title of the module to display.
+      $moduleTitle = $person->getLongTitleForWhat($expandedModule);
+
+      // TODO(vivi): Move this stuff into templates too.
+      echo "<div class=module>";
+      echo "<div class=moduletitle>$moduleTitle</div>";
+      echo "<div class=modulecontent>";
+
+      // Based on the module name, load the 'module_expanded.php' file.
+      $filename = str_replace("/", "_", $expandedModule);
+      include('mods/' . $filename . '_expanded.php');

-  // If we only have one module for this person, append the expanded news module
-  // at the end so that the page doesn't look totally stupid.
-  if (sizeof($history) <= 1) {
-    array_push($history, 'news/expanded');
-  }
-
-  // If we are simply displaying a person's page, go through all the modules
-  // that we loaded from people_history and load them one by one.
-  foreach ($history as $moduleName) {
-    // Display the wrapper for the module, with a title.
-    // TODO(vivi): Move this stuff into a template.
-    echo "<div class=module>";
-    $moduleTitle = $person->getLongTitleForWhat($moduleName);
-    echo "<div class=moduletitle>$moduleTitle</div><div class=modulecontent>";
-
-    // Based on the module name, load the 'module_compact.php' file.
-    $filename = str_replace("/", "_", $moduleName);
-
-    // This test is a bit of a hack so that we can display the expaneded news
-    // module on the person's page when the person has only one other module.
-    if (strrpos($filename, 'expanded') === false) {
-      // If this is not an expanded module, include the compact one.
-      include("mods/{$filename}_compact.php");
     } else {
-      // Otherwise just include the expanded module.
-      include("mods/{$filename}.php");
-    }

-    echo "</div></div>";
-  }
+      $history = $person->getHistory();

+      // If we only have one module for this person, append the expanded news module
+      // at the end so that the page doesn't look totally stupid.
+      if (sizeof($history) <= 1) {
+        array_push($history, 'news/expanded');
+      }
+
+      // If we are simply displaying a person's page, go through all the modules
+      // that we loaded from people_history and load them one by one.
+      foreach ($history as $moduleName) {
+        // Display the wrapper for the module, with a title.
+        // TODO(vivi): Move this stuff into a template.
+        echo "<div class=module>";
+        $moduleTitle = $person->getLongTitleForWhat($moduleName);
+        echo "<div class=moduletitle>$moduleTitle</div><div class=modulecontent>";
+
+        // Based on the module name, load the 'module_compact.php' file.
+        $filename = str_replace("/", "_", $moduleName);
+
+        // This test is a bit of a hack so that we can display the expaneded news
+        // module on the person's page when the person has only one other module.
+        if (strrpos($filename, 'expanded') === false) {
+          // If this is not an expanded module, include the compact one.
+          include("mods/{$filename}_compact.php");
+        } else {
+          // Otherwise just include the expanded module.
+          include("mods/{$filename}.php");
+        }
+
+        echo "</div></div>";
+      }
+    }
+} else {
+  echo dirname(__FILE__);
 }
-?>

-<?php
+
+
+
 // The hook into WordPress comments, displayed for each person at the bottom.
-include('person_comments.php')
+//include('person_comments.php')
 ?>

 <?php
diff -ur hp/www/_top.php hartapoliticii/www/_top.php
--- hp/www/_top.php 2012-09-29 20:44:11.862806527 +0300
+++ hartapoliticii/www/_top.php 2012-09-29 17:45:21.353596812 +0300
@@ -1,11 +1,11 @@
 <?php
   include_once('secret/db_user.php');

-  $dblink = mysql_connect($DB_HOST, $DB_USER, $DB_PASS) or die("Could not connect");
+  $dblink = mysql_connect($DB_HOST, $DB_USER, $DB_PASS) or die ("Could not connect");

   mysql_set_charset('UTF8', $dblink);

-  mysql_select_db($DB_NAME, $dblink) or die("Could not select database");
+  mysql_select_db($DB_NAME, $dblink) or die ("Could not select database");

   function info($msg) {
     $msg = str_replace("[", "[<font color=red>", $msg);
diff -ur hp/www/wp-login.php hartapoliticii/www/wp-login.php
--- hp/www/wp-login.php 2012-09-29 20:44:12.098807703 +0300
+++ hartapoliticii/www/wp-login.php 2012-09-29 10:52:01.527303133 +0300
@@ -55,8 +55,8 @@
    $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
    $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );

-   //if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
-       //add_action( 'login_head', 'wp_shake_js', 12 );
+   if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
+       add_action( 'login_head', 'wp_shake_js', 12 );

    ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -68,7 +68,6 @@
   include('header.php');
 ?>
   <link rel="stylesheet" href="styles.css?v=3" />
-  
   <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
   <?php
   do_action('login_head');
@@ -590,21 +589,17 @@
        <label><?php _e('Password') ?><br />
        <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
    </p>
-   
-   <?php do_action('login_form'); ?>
-   
+<?php do_action('login_form'); ?>
    <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90"<?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p>
-       <p class="submit">
-           <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Log In'); ?>" tabindex="100" />
-   <?php   if ( $interim_login ) { ?>
-           <input type="hidden" name="interim-login" value="1" />
-   <?php   } else { ?>
-           <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
-   <?php   } ?>
-           <input type="hidden" name="testcookie" value="1" />
-       </p>
-   
-   
+   <p class="submit">
+       <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Log In'); ?>" tabindex="100" />
+<?php  if ( $interim_login ) { ?>
+       <input type="hidden" name="interim-login" value="1" />
+<?php  } else { ?>
+       <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
+<?php  } ?>
+       <input type="hidden" name="testcookie" value="1" />
+   </p>
 </form>

 <?php if ( !$interim_login ) { ?>

sarbull added a commit to sarbull/hartapoliticii that referenced this issue Sep 29, 2012
@ghost ghost assigned sarbull Oct 1, 2012
@okvivi
Copy link
Member Author

okvivi commented Oct 1, 2012

Să îmi spui când e gata și de unde pot să fac pull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants