Closed (fixed)
Project:
Bibliography Module
Version:
5.x-1.10
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2008 at 22:21 UTC
Updated:
5 Jan 2010 at 01:27 UTC
Biblio module allows entries to have types (magazine article, book etc.), but this type is not shown in the node wiew nor in the list of entries, if only you don't show entries by type. This patch adds type name to the node and to the biblio classic style.
diff -Nuar biblio/biblio.module biblio.new/biblio.module
--- biblio/biblio.module 2007-12-14 01:07:46.000000000 +0300
+++ biblio.new/biblio.module 2008-01-09 06:23:54.000000000 +0300
@@ -1451,7 +1451,7 @@
*
*/
function biblio_load($node) {
- $additions = db_fetch_object(db_query('SELECT * FROM {biblio} WHERE vid = %d', $node->vid));
+ $additions = db_fetch_object(db_query('SELECT biblio.*, biblio_types.name AS biblio_type_name FROM {biblio}, {biblio_types} WHERE tid=biblio_type AND vid = %d', $node->vid));
if ( $additions->biblio_year == 9998) {
$additions->biblio_year = t("In Press");
}
@@ -1516,7 +1516,7 @@
switch (variable_get('biblio_node_layout', '0')) {
case 'orig':
case 'ft':
- $node->content['body']['#value'] = theme('biblio_long', $node,$base,$style);
+ $node->content['body']['#value'] = theme('biblio_long', $node,$base,$style,$teaser);
break;
case 'tabular':
default:
@@ -1573,7 +1573,7 @@
}
-function theme_biblio_long($node,$base='biblio',$style='classic') {
+function theme_biblio_long($node,$base='biblio',$style='classic',$teaser=false) {
if (empty($node->biblio_coins)) biblio_coins_generate($node);
$output .= $node->biblio_coins;
@@ -1603,7 +1603,7 @@
if ($openurl_base) $output .= theme('biblio_openurl',biblio_openurl($node, $openurl_base));
-
+ $output .= '<h3>'.t("Type").':</h3> ' . check_plain($node->biblio_type_name) . "\n";
$output .= '<div class="biblio_authors"><h3>'.t("Authors").':</h3> ' . _biblio_author_links($authors,$base) . "</div>\n";
$output .= '<div class="biblio_source"><h3>'.t("Source").': </h3> ';
$source = null;
@@ -1652,7 +1652,7 @@
if ($node->biblio_abst_e) $output .= '<h3>'.t("Abstract").':</h3> ' . check_markup($node->biblio_abst_e,FILTER_HTML_ESCAPE,FALSE) . "\n";
if ($node->biblio_abst_f) $output .= '<p>' . check_markup($node->biblio_abst_f,FILTER_HTML_ESCAPE,FALSE) . "\n";
if ($node->biblio_notes) $output .= '<h3>'.t("Notes").': </h3>' . check_markup($node->biblio_notes,FILTER_HTML_ESCAPE,FALSE) . "\n";
- if ( strlen(trim($node->body)) && user_access('view full text') ) {
+ if ( strlen(trim($node->body)) && user_access('view full text') && !$teaser ) {
$output .= '<h3>'.t('Full Text').':</h3>'.check_markup($node->body,FILTER_HTML_ESCAPE,FALSE);
}
if ( biblio_access('export',$node)) {
@@ -1849,6 +1849,8 @@
$inline = false;
$join = array();
$join[] = "left join {biblio} b on n.vid=b.vid";
+ $join[] = "left join {biblio_types} btp on b.biblio_type=btp.tid";
+
if (variable_get('biblio_view_only_own', 0) ) {
$limit .= " AND n.uid=$user->uid ";
}
@@ -2025,7 +2027,7 @@
$where_clause = count($where) > 1 ? '('. implode(') AND (', $where) .')': $where[0];
- $query = db_rewrite_sql("SELECT DISTINCT n.*, b.* FROM {node} n $joins WHERE $where_clause $published $limit $sortby ");
+ $query = db_rewrite_sql("SELECT DISTINCT n.*, b.*, btp.name AS biblio_type_name FROM {node} n $joins WHERE $where_clause $published $limit $sortby ");
$count_query = db_rewrite_sql("SELECT DISTINCT COUNT(*) FROM {node} n $joins WHERE $where_clause $published $limit ");
//echo $query; die;
$_SESSION['last_biblio_query'] = $query;
diff -Nuar biblio/biblio_style_classic.inc biblio.new/biblio_style_classic.inc
--- biblio/biblio_style_classic.inc 2007-12-03 06:08:08.000000000 +0300
+++ biblio.new/biblio_style_classic.inc 2008-01-09 06:24:34.000000000 +0300
@@ -26,6 +26,7 @@
* The styled biblio entry
*/
function biblio_style_classic($node, $base='biblio', $inline=false){
+ $output .= check_plain($node->biblio_type_name) . ' ';
if (variable_get('biblio_normalize', 0)) {
$authors = _biblio_parse_authors($node->biblio_authors);
} else {
Comments
Comment #1
gracearoha commentedI am trying to use biblio "type" field in a custom view that i am creating.
The field, "Biblio: Type of Work" is included in the views drop-down list of views, however the biblio types do not appear in my actual view when i choose this field.
Will this patch help me to achieve that?
Comment #2
rjerome commentedTo be honest, I haven't examined this patch to see exactly what it does, but I suspect that if you are using Views, then the answer is no it probably won't help.
The views integration still needs a lot of work... unfortunately there are only so many hours in a day and my "day job" consumes most of them :-)
Ron.
Comment #3
gracearoha commentedyes, i am using views. thanks for your quick reply. i certainly understand the time issue. thanks for a great module. i will get alot of use out of it. :)
Comment #4
KiberGus-1 commentedThis patch gives only first approaching to the views integration. It adds all fields, but solution is not clean. Type of work is not a usual field, because it is a key for a value, which is stored in another table. So it needs special handling. I didn't write that handling.
Comment #5
bekasu commentedUpgrade to Biblio 6x, it plays well with Views and Panels.
Marking issue closed.