The Drupal7 port of this module has begun and is under development. The 7.x-1.x-dev branch of the module has been created and initialized with the code from comment #35 below.
All further issues with that code should be posted in separate issues.

Comments

Apfel007’s picture

StatusFileSize
new10.59 KB

made a quick convert with http://upgrade.boombatower.com/.

The module unfortunately is not working :-) any could help to fix this?

What about the field should we use a instance of the "file field"?
First Part rework - help welcome :-)

/**
 * @file
 * Integration with Scribd.com.
 */

/**
 * Implements hook_menu().
 */
function scribd_menu() {
  $items['admin/config/media/scribdfield'] = array(
    'title'             => 'ScribdField',
    'description'       => 'Configure ScribdField integration with Scribd.com.',
    'page callback'     => 'drupal_get_form',
    'page arguments'    => array('scribdfield_settings'),
    'access arguments'  => array('administer site configuration'),
  );

  return $items;
}

/**
 * Configure ScribdField integration with Scribd.com.
 */
function scribd_settings($form, &$form_state) {
  $form['scribdfield_server'] = array(
    '#collapsible'   => TRUE,
    '#title'         => t('Scribd.com API information'),
    '#type'          => 'fieldset',
  );
  $form['scribdfield_server']['scribd_api_key'] = array(
    '#default_value' => variable_get('scribd_api_key', NULL),
    '#title'         => t('Scribd.com API key'),
    '#type'          => 'textfield',
  );

  return system_settings_form($form);
}

/**
 * Implements hook_element_info().
 */
/*function scribdfield_element_info() {
  $filefield_elements = filefield_elements();
  $elements['scribdfield_widget'] = $filefield_elements['filefield_widget'];
  $elements['scribdfield_widget']['#process'][] = 'scribdfield_widget_process';
  return $elements;
}*/

/**
 * Implements hook_field_info().
 *
 * Provides the description of the field.
 */
function scribd_field_info() {
  return array(
    'field_scribd' => array(
      'label' => t('Scribd'),
      'description'   => t('A widget which sends its uploaded files to Scribd.com.'),
      'default_widget' => 'scribd_ipaper',
     ),
  );
}

/**
 * Implements hook_field_widget_info().
 */
function scribd_field_widget_info() {
  return array(
    'scribd_ipaper' => array(
      'label' => t('iPaper'),
      'field types' => array('field_scribd'),
      ),
  );
}

bryancasler’s picture

subscribe

lsolesen’s picture

+1

mikl’s picture

I'd like to take some time to refactor the 6.x-1.x branch first, implementing the library and many of the settings provided by the iPaper module.

toxiclung’s picture

+1

olemsa’s picture

StatusFileSize
new17.44 KB

I needed a drupal 7 version for a project, so here is a working "light" version.

If you need any help making a stable 7 release I will lend a hand.

Poieo’s picture

subscribing

Poieo’s picture

Thanks olemsa.

What would it take to get your version working with the html5 viewer rather than flash? If it's even possible...

Poieo’s picture

Answered my own question:

"Currently, embeds you create using our API will be displayed in our Flash-based reader. Our engineers are preparing to release an update to our API to support HTML5-based embeds, and we'll update our API documentation when that happens."

Apparently its not ready yet...

olemsa’s picture

Yeah.
HTML5 would be great, but haven't seen any eta on when the API is going to be updated.

kevin-bcr’s picture

Subscribe. Thank you for your work.

simonbcfa’s picture

Would there be an idiots guide to getting this to work?

(and when i mean idiot I really mean Idiot!)

Poieo’s picture

@olemsa - The 6.x version appears to be embedding the html5 version. What would it take to get the 7.x version working as well?

olemsa’s picture

@Poieo I'm pretty sure 6.x embeds the flash version. Havent seen any API changes http://www.scribd.com/developers for html5 support yet.

Poieo’s picture

@olemsa - I'm using it on this site: http://christcentralmissions.org/documents/christ-central-ministries-org...

I haven't changed anything, and it just started embedding with html5... I'm using the latest version of Firefox, haven't checked in other browsers yet.

BenK’s picture

Subscribing

bryancasler’s picture

Instead of just a D7 version, should this be ported to support the media module? Just like the "Media: Youtube" module does http://drupal.org/project/media_youtube

drupizzle’s picture

@animelion I agree. That would be a great way to continue this functionality.

carsonblack’s picture

StatusFileSize
new17.76 KB

Attached is an updated version of #6 that implements Version 2 of the javascript API which will display the HTML5 output from Scribd instead of the Flash where it is applicable.

I would also be interested in helping with a Stable 7 release. Thanks @olemsa!

@animelion I'm not sure about that. While that would be great on the display side of things for something that has already been uploaded and exists on Scribd, not sure if it would be able to implement the full Scribd settings for each uploaded file and even the upload of the file to Scribd the way this module does. Although I guess that could be done through some integration with Media Mover. It certainly wouldn't hurt to have a Media: Scribd module. But that's a duscussion for a different issue queue.

Poieo’s picture

This module has been working great for me, and thanks to @carsonblack for the api update.

However, it just stopped working when trying to add new nodes with a scribdfield with the following error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'scribd_doc_id' cannot be null: INSERT INTO {scribdfield_file} (fid, scribd_doc_id, scribd_access_key) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 923 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => ) in scribd_loadfile() (line 110 of /sites/all/modules/scribdfield/scribdfield.module).

Previously added files display just fine, even with the new api. I just can't add new ones.

Any ideas what might cause this?

Poieo’s picture

Title: D7 Port » Port Scribd field to Drupal 7
Poieo’s picture

Status: Needs review » Active

This may be an issue cause by a recent upgrade from php 5.2 to 5.3.

edit: This is not the cause.

carsonblack’s picture

I am working on a completely new D7 version of this implementing it properly via the Field and File APIs. I have run across something similar during development. This is caused when there is no doc_id returned from Scribd and there is no checking in place to make sure there is a doc_id set before the attempt to save it in the DB . Note that the current version of this is kind of just slapped together to just get some basic functionality happening in D7. It is taking several more hours to implement this properly, but that's mostly because I'm using this as a way to teach myself the Field and File API. I'm finding there are several places where some checking needs to be done to make sure that similar issues to what is described in #20 don't happen. But I imagine that's probably just best coding practice anyway.

carsonblack’s picture

Status: Active » Needs review
StatusFileSize
new19.77 KB

Attached is my first attempt at the D7 version. Please give me some feedback.

MAINTAINERS: Are you still maintaining this? Can you take a look at my code and possibly get it committed? Not trying to step on toes or anything, just trying to help. Thx!

So there are some extra settings now available in the configuration for the Reader. There are also some TODOs I have commented in the code that could make this even better.

This is DEV so use at your own risk! You may find bugs and if you do please report them (or better yet fix them!).

Should I wait to put this up on github or my d.o. sandbox? Looks like there haven't been any recent commits from the maintainers on this project.

Poieo’s picture

@carsonblack - Will this work as a drop-in replace for the previous version you posted in #19?

CinemaSaville’s picture

Status: Active » Needs review

I used #24, but when I add the scribed field I get this error message in the add fields of my content type section.

Notice: Undefined index: scribd_local_storage in scribdfield_field_instance_settings_form() (line 170 of /home/placemea/public_html/d7/sites/all/modules/scribdfield/scribdfield.module).
Notice: Undefined index: scribd_local_storage_directory in scribdfield_field_instance_settings_form() (line 178 of /home/placemea/public_html/d7/sites/all/modules/scribdfield/scribdfield.module).
Notice: Undefined index: scribdfield_uri_scheme in scribdfield_field_instance_settings_form() (line 187 of /home/placemea/public_html/d7/sites/all/modules/scribdfield/scribdfield.module).
Notice: Undefined index: scribd_local_storage_directory in scribdfield_field_widget_form() (line 225 of /home/placemea/public_html/d7/sites/all/modules/scribdfield/scribdfield.module).
Notice: Undefined index: scribdfield_uri_scheme in scribdfield_field_widget_form() (line 228 of /home/placemea/public_html/d7/sites/all/modules/scribdfield/scribdfield.module).
Notice: Undefined index: display_field in file_field_widget_form() (line 507 of /home/placemea/public_html/d7/modules/file/file.field.inc).

Poieo’s picture

I completely uninstalled the previous version, then installed the version from #24. The admin interface works well. However, when I upload a file to the filefield, the upload completes but nothing is stored. The upload box is simply empty.

Let me know how I can help debug.

Poieo’s picture

I can verify the file was uploaded to the server (local storage enabled), but not to Scribd.com.

With local storage disabled, I had the same result with no file uploaded to the server (as expected).

carsonblack’s picture

StatusFileSize
new19.98 KB

Oops, looks like I had a little issue with my local git repo and you got an older version. Sorry about that! Try this new one.

Also, the local storage thing is now not an option that's something I started on but didn't finish and will wait to add as a new feature later. The module should save the file local as well as stick it up on Scribd. Please also make sure to check the settings and make sure you have entered your Scribd API keys. I have not put any checking in there yet for those. I also need to change the README the instruction in there right now are for the old one.

Yes, you should uninstall the old version before installing this one. I have not written any update code.

Thanks for the feedback.

carsonblack’s picture

StatusFileSize
new19.97 KB

Wait, I seemed to have exposed some other warnings and notices, so I squashed. Use this one instead! ;-)

simonbcfa’s picture

uploaded and tested #30

Storing file locally but getting this error...

Warning: require_once(sites/all/modules/scribdfield_2/scribdfield/includes/multipart.inc) [function.require-once]: failed to open stream: No such file or directory in _scribdfield_request() (line 415 of *******\sites\all\modules\scribdfield_2\scribdfield\includes\scribd.php).

after copying a multipart.inc file from a previous version (just to see) I get this error...

Notice: Undefined property: stdClass::$data in _scribdfield_request() (line 432 of *******\sites\all\modules\scribdfield_2\scribdfield\includes\scribd.php).
Exception: String could not be parsed as XML in SimpleXMLElement->__construct() (line 344 of *******\sites\all\modules\scribdfield_2\scribdfield\includes\scribd.php).

Thoughts?

kirkcaraway’s picture

I finally found the time to try out the D7 version here, and it seems work OK. The document uploads to scribd as it should, and displays just fine.

However, I'd like to know if there is an option to get rid of the extra ID and Key form elements for already uploaded documents on the content creation pages. That is just confusing for most end users, and it's an option we will never use. All of the document uploads will be done with the widget.

In the absence of a configuration option, can I just remove this from the module code without affecting anything else? Or, perhaps there is a way to hide this via CSS?

I've been using the D6 version on two live sites now for several months, and my users love the simplicity of it, just upload with the widget and save the node. I'd like to keep it that simple when I upgrade the sites to D7. Thanks.

off’s picture

I am trying to use this version and this show error after upload file:

Fatal error: Cannot create references to/from string offsets nor overloaded objects in /home/energetix/energetix.nichost.ru/docs/includes/common.inc on line 6430

Taxoman’s picture

carsonblack’s picture

StatusFileSize
new20.32 KB

Hi folks! Thanks for the input. I've ran into a couple of the issues reported here myself and had a chance to clean it up a little. The latest iteration is attached. Please test to see if your issues go away.

Here's what I'm pretty sure is fixed:
#31
#32: Now when you add the field you have a choice of 2 widgets: Scribd File (this is what you want) or Scribd Document ID and Access Key (Not what you want, but I had a use case for this).

Here's what is not fixed:
#33: no idea, and I cannot replicate. perhaps this version will make that go away. Can you test that please? or provide more info about what else you have installed?
#34: Since you cannot find any mention of iPaper anymore on the Scribd site I'm guessing it's deprecated for just what they are calling the Scribd API, which is what this implements. I'd love to work with others on this, but alas, I am not a maintainer of this module, and the current maintainers seemed to have made this module a VERY low priority so all I can do is post my patches here. I don't have the power to make that decision for this module.
Maybe you or the maintainers of iPaper have some ideas on how to solve this?

Side note: the project I needed this for is pretty much complete, so while I'll keep an eye on it I may not be able to hop on issues very quickly. But I do hve an interest in making sure it continues to work and exist.

simonbcfa’s picture

@carsonblack - Thanks for your work and the update... still getting the #31 error

Poieo’s picture

Hey @carsonblack. Thanks for all your hard work on this. I've found two issues:

#1 - Trying to delete a file from a node results in the following error:

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of .../includes/entity.inc).
Recoverable fatal error: Argument 1 passed to file_usage_list() must be an instance of stdClass, boolean given, called in .../modules/scribdfield/scribdfield.module on line 344 and defined in file_usage_list() (line 611 of .../includes/file.inc).

#2 - Setting the path to save files does not work. All files are uploaded to the root files directory.

scottcheek’s picture

Any recent movement on this?

@carsonblack: I was able take what you have done and fix the first issue on #37. This issue seemed to stem from the naming convention of the field type that was used.

I have a version that works with one upload form, but it still breaks if you set the number of values to anything other than 1. (#33's issue) I know enough of the drupal api to be dangerous, but I'm not sure what this module needs to be fully functional.

cedewey’s picture

@carsonblack, this module is exactly what I needed! I know it still has some issues to work out, but wanted to just say thanks for getting this D7 port going.

marcingy’s picture

@carsonblack do you want commit access to the project??

carsonblack’s picture

Hey folks! Work kind of took me away from this, but I'd still love to be as helpful as possible. @marcingy, if I can help you out in that way, then yes, I'll accept commit access on this. I know how difficult it can be to keep up with maintenance on these modules. Particularly when dealing with some outside API that changes or you have, oh, only about a million other things to do! ;-)
I think at least getting a D7 dev version up will help with getting some patches generated for the issues that came up and were fixed in #37 above. Thanks!

carsonblack’s picture

Just thinking out loud here. Do the people at Scribd know we are doing this for them? Perhaps they'd be interested in $upporting (typo on purpose) the community that supports them? I know that's sometimes taboo but it happens elsewhere. ;-)

marcingy’s picture

I don't believe they do! Yeah this was a project for a job that I have since left so I am happy to add keen hands, and you now have maintainer rights on the project :) Welcome aboard and feel free to commit away!!

carsonblack’s picture

Thanks @marcingy!

I'll probably get a dev version up within the next week or so.

Thanks again!

carsonblack’s picture

Assigned: Unassigned » carsonblack

Hi folks, I had some career changes and a DrupalCamp to organize and all kinds of other sidetrack stuff that took me away from this for a while. But I have just created a new 7.x-1.x branch in the version control for the D7 version and have initialized that with the code from #35.

carsonblack’s picture

Also created a 7.x-1.x-dev release for for that as well so whenever the bot gets around to creating that it will be there for you to download from the main page.

carsonblack’s picture

So with that I'd like to close this issue and have you very helpful folks create new, separate issues for the 7.x-1.x-dev release so I can keep track of them separately and be a little more organized.
I can do this for those of you with what look like outstanding issues, or you can help me out by creating them yourselves (you'll also be able to keep track of the issue a little better as well).
So if the following could try out the dev version to see if they're still having the same issue and create a new issue that would be great:
Comment #37 - Poieo
Comment #33 - OFF (with follow-up by scottcheek)

Thanks!

carsonblack’s picture

I'm going to need more info to reproduce the error. Perhaps there is a conflict with some other module you have installed? Perhaps you could open a new issue for just this on the 7.x-1.x-dev version?

carsonblack’s picture

carsonblack’s picture

Status: Needs review » Closed (fixed)

closing as there has been no further response and other non-related issues are being handled elsewhere.

carsonblack’s picture

Issue summary: View changes

Updated issue summary.