I am happily using the biblio module on my site http://info.ulrich-schrader.de so collect references for research and for my students. I am also using the bib-tag for citation in my nodes in conjunction with the footnotes module. And works is great!

Since I do enter references directly using the biblio interface I would need a way to enter a citekey. Currently I have to go to the datebase and edit the tables to insert values for the citekeys as there are only empty strings. This is the same method I use when I want to look up a citekey for a given reference I have to go directly to the database. It would be nice, to have a citekey field when entering a reference that is also displayed when looking at the reference. Perhaps it would be helpful if the citekey field is automatically set to the node id (with a prefix?) as a default.

Thanks for a great module.
Ulrich

CommentFileSizeAuthor
#28 Biblio-Settings-CiteKey.png28.09 KBforedoc
#22 biblio3.jpg53.74 KBgsteenss

Comments

rjerome’s picture

You can in fact turn on an input field for this item on this page... admin/settings/biblio/defaults Just scroll down near the bottom and you will see the biblio_citekey field, make sure the "Common" check box is checked and it should show up on all input forms.

I have been working on a "auto-generate" function for citekeys, but it's not quite finished yet. I agree that they should show up in the display, so I'll add them. Of course output display is another can of worms, since almost everybody wants something different. I had hopped to have a fully customizable output display format by now, but my time is somewhat limited these days.

Ron.

ulrich’s picture

Sorry I did not see this option.
Ron, you are doing a fantastic work.
Ulrich

fm’s picture

I have been working on a "auto-generate" function for citekeys

Will this be implemented soon?

rjerome’s picture

To be honest, no it still needs some work. As you may have noticed, lately I have only had time for bug fixes but I may be able to devote a bit more time over the next couple of weeks.

Ron.

fm’s picture

Any progress on the auto-generate function?

fm’s picture

auto citekey?

gustav’s picture

Title: Possibility to edit and display a citekey field » Auto-generate citekey

If you simply want to autogenerate a citekey you can add

  if (empty($node->biblio_citekey)) {
    $node->biblio_citekey = $node->nid;
  }

at the start of the biblio_insert() and biblio_update() functions in biblio.module

physiotek’s picture

excellent i needed this
thanks,
pht3k

danaktivix’s picture

That piece of code is great. Without it I'm somewhat confused about how you're supposed to generate citekeys at all. Just manually? Given their importance for using the tags...

If there's not a problem with it, it should definitely go into the main module, perhaps with a toggle switch for 'autogenerate citekey'. I can't imagine any reason why anyone *wouldn't* want that to happen, but hey...

And are there are problems that I don't know about with having node number as citekey?

And! Are there any other modules that might help with the 'find a specific citekey while writing with an autocomplete field that can detect author or title' problem? If not, I may have to start trying to write it.

Dan

rjerome’s picture

This certainly covers the basic need, however my intent was to have the cite key tied a little more closely to the publication, i.e. combine the first 3 letters of the primary authors last name (or maybe inititals) with the publication year and then add an integer on the end for multiple publication within the same year.

Ron.

csc4’s picture

Is there any chance of this going into the standard module as you keep producing fabulous upgrades - and then I forget to reapply the change!!

  if (empty($node->biblio_citekey)) {
    $node->biblio_citekey = ($node->biblio_isbn) ? 'ISBN:' . $node->biblio_isbn : 'NID:' . $node->nid;
  }
rjerome’s picture

Yep, I'll put it in. Maybe what I'll do is have a admin definable option to choose what field(s) the auto citekey will be built from.

Ron.

csc4’s picture

Brilliant, thanks Ron

rjerome’s picture

OK, It's in the -dev version now.

On the settings page you can specify a prefix (e.g. NID:) and you can also select one or two fields to build the citekey from. If the first field is empty, the second field will be used, so you want to be sure that at least one of the fields is guaranteed to have a value (like Node ID, which always has a value).

Ron.

csc4’s picture

Thanks for this work - have no idea how you find the time - but am glad you do!

rjerome’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

gsteenss’s picture

Hi,

I'm using the new auto-generate citekey feature in RC2,
and it is working great when creating new biblio entries with prefix+ node id giving me a new citekey.
However is there a way to have the nodeid start from a given number?

If I'm correct the code is not using the standard MySQL autoincrement feature for NID in biblio entries,
and I can't seem to find how biblio decides which NID is given to a newly created entry...

This is basically because I have imported a number of biblio entries with citekey numbers already over 13000,
when the max nodeid is still about 3000.
When i now create a new biblio entry by hand I would like the the citekey number to be automatically generated and to start from 14000,
instead of being (max noid) +1 ...

any tips here?

Thx

rjerome’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

Biblio entries are standard Drupal "nodes" consequently they share the nodeID numbering with all other nodes. As a result of this biblio entries will not necessarily be numbered consecutively. If you look at the node table, you should find that the rows are numbered consecutively, but they may not all be biblio type nodes. Drupal starts numbering nodes at 1 when the site is first installed and it never resets the counter, so if you delete nodes, there will be gaps in the node numbering.

There is a feature in the 6.x-1.x-dev version (on the admin/settings/biblio, in the citekey section) which allows you to add a piece of PHP code which will be evaluated to generate your cite key. You could try something like this...

 $citekey = variable_get('biblio_citekey_number', 14000);
 variable_set('biblio_citekey_number', $citekey+1);
 return $citekey;

Which should generate consecutively numbered citekeys starting at 14000.

rjerome’s picture

Status: Closed (fixed) » Active
gsteenss’s picture

Hi, thanks for the quick reply,

That'll be exactly what I need...
Only I think I'll wait for RC3 or even final release to upgrade my current version.
we're not production yet, but only just converting and importing old data to the new system...

And I must say: Great work, thanks for the effort !
at some point i may have further questions for you when we actually go live with it...

gsteenss’s picture

Version: 6.x-1.x-dev » 6.x-1.0-rc4
Component: User interface » Code
StatusFileSize
new53.74 KB

Hi,

I don!t think this is working properly in RC4:
when adding the PHP code you mentioned above, no citekey is generated at all.
If I leave out the additional code I do get an citekey autogenerated as requested.
There may be some error with including/interpreting the PHP code, because I have my doubts if the code is actually being executed as enabling PHP error reporting doesn't give me any more information... (PHP code as shown in image)

rjerome’s picture

Ok, I found the problem. I didn't write that particular section of the code, so I'm waiting for an answer from the person who did. The issue is that the code specifically prevents setting the citekey to an integer value (which is exactly what you are trying to do) and I don't know why he did that. I'll update this post when I find out.

P.S. you should update to RC5, RC4 has a bug that might bite you.

Ron.

rhaschke’s picture

I fixed this piece of code in the dev branch. I explicitly checked for a string to ensure that check_plain doesn't complain.
Now it works for numeric values as well as html code, whose tags are stripped off.

Robert.

rhaschke’s picture

Status: Active » Fixed
rjerome’s picture

Thanks Robert,

I've never seen check_plain complain about numeric values, I guess because it's expecting UTF-8 encoded values?

Just out of curiosity, are you generating citekeys which might have html tags in them, or was that just a precaution?

Ron.

Status: Fixed » Closed (fixed)

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

foredoc’s picture

Version: 6.x-1.0-rc4 » 7.x-1.0-rc7
Component: Code » User interface
Issue summary: View changes
Status: Closed (fixed) » Active
StatusFileSize
new28.09 KB

Hi,

First of all, this is a great module, and I appreciate all the effort by both the creator/maintainer(s) and the community.

When I play with this module, one thing I found that, the citekey can only be visible if I check the "Show citation key in results" option on the citekey setting page (admin/config/content/biblio).

If I leave this unchecked, there is no way for an end-user to figure out how to cite the publication.

And I am wondering, instead of having the citekey listed in front of the publication str, is there a way to display it in the publication content (node content) as well? For Example, can we create another row in the publication node body, showing the citekey of it?

Thanks.

Regards,

foredoc

discipolo’s picture

Status: Active » Closed (fixed)

please dont reopen fixed issues. create a new one for your support request.