BibMerge: delete duplicate record first

* When merging and deleting records, do first submit the deleted
  one such that any possible identifier that would result in a
  duplicate are removed first, before updating the remaining
  record.  (closes #1645)

Signed-off-by: Jerome Caffaro <jerome.caffaro@cern.ch>
Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
OAIHarvest: configurable selective post-processing

* Allow to selectively apply post-processing phases to each
  individual harvested record. To do so override function
  oai_harvest_templates.tmpl_should_process_record_with_mode().
  (closes #1477)

Signed-off-by: Jerome Caffaro <jerome.caffaro@cern.ch>
Acked-by: Jan Aage Lavik <jan.age.lavik@cern.ch>
OAIHarvest: consider source_id for selective post-processing

* Added source_id parameter to function
  oai_harvest_templates.tmpl_should_process_record_with_mode()
  in order to enable decision based on harvesting source.

Signed-off-by: Jerome Caffaro <jerome.caffaro@cern.ch>
Acked-by: Jan Aage Lavik <jan.age.lavik@cern.ch>
WebAccess: update check for "external" account at CERN

* Changed conditions for an account to be considered as "external"
  at CERN.

Signed-off-by: Jerome Caffaro <jerome.caffaro@cern.ch>
Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
WebComment: link to "Your Comments" after posting

* After a user has submitted a comment, display a hint regarding
  the possibility to view all previously submitted comments
  in "Your Comments" page.

* Link opens in a new window/tab as a quick measure to prevent
  double posting when using browser's back button.

Signed-off-by: Jerome Caffaro <jerome.caffaro@cern.ch>
BibFormat: initial example of Twitter Card support

* Outputs sample Twitter Card markup (using fallback on OpenGraph
  markup).

* Uses DBCOLLID2TWITTERCARDTYPE knownledge base to map record type
  to card type.

* Introduced parameter 'one_icon_per_bibdoc' in bfe_meta_opengraph_image
  in order to avoid repetition of same icon preview in multiple sizes.

* Better output in bfe_meta_opengraph_image for Twitter Cards, with
  dedicated tag to comply with image size limit. Introduced
  'twitter_card_type' parameter to switch between 'gallery' and 'photo'
  card type (stricly either a group of 4 photos, or a single one).
  Reordered bfe_meta_opengraph_image and bfe_meta_opengraph_video in
  order to force Twitter not to fall back on corresponding OpenGraph
  tag (which would otherwise most probably get it reach the image
  size limit).

* Some additional CERN-specific changes.

Signed-off-by: Jerome Caffaro <jerome.caffaro@cern.ch>
WebJournal: sample Twitter Card markup

* Added necessary tags to support Twitter Card.

* Use article featured image for Twitter Card image.

Signed-off-by: Jerome Caffaro <jerome.caffaro@cern.ch>
WebJournal: fix image dimension retrieval

* When trying to retrieve the dimension of an image (to keep
  the correct ratio when explicitely setting width/height),
  consider that the fetched image might not be reachable and
  could be returned as an HTML (error message, login page, etc.)
  Try to analyze the image only when the content-type indicates
  an image.

Signed-off-by: Jerome Caffaro <jerome.caffaro@cern.ch>
BibRank: temporary file storage in CFG_TMPDIR

* Stores temporary data files used for plotting in CFG_TMPDIR
  instead of CFG_WEBDIR.
  Adds explicit 'bibrank_grapher_' prefix.
  This is not helping, but nor worsening the creation and
  servicing of graphs in load-balanced setups.

* Temporary directory set using 'dir' parameter instead of
  'tempfile.tempdir'.  (addresses #1594)

* Makes use of safer tempfile.mkstemp (instead of tempfile.mktemp).

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
Merge branch 'maint-0.99' into maint-1.0

* maint-0.99:
  BibRank: temporary file storage in CFG_TMPDIR

Conflicts:
	modules/bibrank/lib/bibrank_grapher.py

Signed-off-by: Tibor Simko <tibor.simko@cern.ch>
BatchUploader: avoid tempfile.tempdir redefinition

* Temporary directory set using 'dir' parameter instead of
  'tempfile.tempdir'.  (closes #1594)

* Makes use of safer tempfile.mkstemp (instead of tempfile.mktemp).

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
Merge branch 'maint-1.0' into maint-1.1

* maint-1.0:
  BatchUploader: avoid tempfile.tempdir redefinition
  BibRank: temporary file storage in CFG_TMPDIR

Conflicts:
	modules/bibrank/lib/bibrank_grapher.py
	modules/bibupload/lib/batchuploader.py
	modules/bibupload/lib/batchuploader_engine.py

Signed-off-by: Tibor Simko <tibor.simko@cern.ch>
Merge branch 'maint-1.1'

* maint-1.1:
  BatchUploader: avoid tempfile.tempdir redefinition
  BibRank: temporary file storage in CFG_TMPDIR
Merge branch 'master' into next

* master:
  BatchUploader: avoid tempfile.tempdir redefinition
  BibRank: temporary file storage in CFG_TMPDIR
  WebJournal: fix image dimension retrieval
  WebJournal: sample Twitter Card markup
  BibFormat: initial example of Twitter Card support
  WebComment: link to "Your Comments" after posting
  WebAccess: update check for "external" account at CERN
  OAIHarvest: consider source_id for selective post-processing
  OAIHarvest: configurable selective post-processing
  BibMerge: delete duplicate record first

* NOTE Format changes to be propagated to new template schema.

Signed-off-by: Tibor Simko <tibor.simko@cern.ch>