Skip to content

Commit

Permalink
pistruiatul#25: Activity stream: news without display
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbull committed Sep 29, 2012
1 parent 36efa85 commit 2e183f6
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 67 deletions.
2 changes: 1 addition & 1 deletion db/hartapoliticii_mock_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,7 @@ INSERT INTO `wp_options` (`option_id`, `blog_id`, `option_name`, `option_value`,
(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'),
Expand Down
4 changes: 2 additions & 2 deletions www/_top.php
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
110 changes: 63 additions & 47 deletions www/person.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ function isExpandedModule($str) {

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 ----------------

Expand All @@ -108,82 +114,92 @@ function isExpandedModule($str) {
$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);
$viewmode = @$_GET['viewmode'];

// TODO(vivi): Move this stuff into templates too.
echo "<div class=module>";
echo "<div class=moduletitle>$moduleTitle</div>";
echo "<div class=modulecontent>";
if($viewmode == 'clasic'){

// Based on the module name, load the 'module_expanded.php' file.
$filename = str_replace("/", "_", $expandedModule);
include('mods/' . $filename . '_expanded.php');
if ($expandedModule != isExpandedModule($_GET['exp'])) {
// Get the long title of the module to display.
$moduleTitle = $person->getLongTitleForWhat($expandedModule);

echo "</div></div>";

} else {
$history = $person->getHistory();
// TODO(vivi): Move this stuff into templates too.
echo "<div class=module>";
echo "<div class=moduletitle>$moduleTitle</div>";
echo "<div class=modulecontent>";

// 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');
}
// Based on the module name, load the 'module_expanded.php' file.
$filename = str_replace("/", "_", $expandedModule);
include('mods/' . $filename . '_expanded.php');

// 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");

$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__);
}


echo "</div></div>";
}

}
?>

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

<?php
Expand Down
29 changes: 12 additions & 17 deletions www/wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
$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">
Expand All @@ -68,7 +68,6 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
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');
Expand Down Expand Up @@ -590,21 +589,17 @@ function register_new_user( $user_login, $user_email ) {
<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 ) { ?>
Expand Down

0 comments on commit 2e183f6

Please sign in to comment.