New module - eCard
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
Grab the zip file from http://www.gallerymodules.com Codex page here: http://codex.gallery2.org/Gallery3:Modules:ecard The eCard module allows a user to send a resized image as an electronic postcard, with a customizable message. This module will only be displayed when the visitor has sufficient privileges. -- |
|
bharat
![]()
Joined: 2002-05-21
Posts: 7994 |
![]() |
Please start by adding it to your own fork of -contrib on github first -- it's much easier to share the code that way. I'll pull it into the gallery3-contrib section and fill in some of the missing pieces to get you going. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
Thanks Bharat. I'll wait till I see it in -contrib before I make any more modifications, so I don't undo anything you might be adding. -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
OK, so I've made some progress...when you click the "send ecard" link, it expands out, but instead of showing the form, shows the entire page (image, sidebar, etc) in the space where the form should be... Sorry, I haven't gotten it into github yet...i've forked -contrib, but I don't have time to work on it at night, and during the day, I can't SSH out from the office (and I can't install the windows git client). -- |
|
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
this post has the what appears to be the G2 module. Dave |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
Right you are...wrong ecard directory. I've corrected the file. -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
Hmm..I think I may have found something that might be contributing. On line 34 of controllers/ecards.php I've got:
I couldn't find any doc on what "ORM::factory" does, but by looking through the code, it appears that it is creating a new entry in the database, in a table with the name passed into the factory() call (ie, this would be looking for g3_ecards). However, I have no such table, nor does any such table need to exist, since the ecard data is not retained. So that throws the entire "try" block into disarray...is there any way around this? -- |
|
webmalone
Joined: 2007-03-06
Posts: 30 |
![]() |
I've been monitoring the G3 modules page everyday with the hope of seeing eCard ... so I'm very happy to see this today! I'm no help with the code, but I would enjoy seeing a table of all the eCards sent ... could turn into a "Popular eCards" section. I use Gallery as our Portfolio of Ideas and our Distributors use the eCard as a way to send their clients ideas/examples that they can relate to. I'm here to help test however possible, because I cannot fully implement G3 without the eCard function, one of our finest Sales Tools. Great work all around guys ... looking forward to eCard progress. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
webmalone wrote:
I've been monitoring the G3 modules page everyday with the hope of seeing eCard ... so I'm very happy to see this today! Glad someone besides me will find it useful. Baby steps for me. Since the API docs in G3 are pretty much non-existent, I'm hacking away as best I can. I want to get this thing working first, then I'll add whistles and bells. -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
I've done the following: Where I am now: What's still not working: I've attached the newest version here. If anyone can help with the 2 issues above, please let me know. -- |
|
hukoeth
Joined: 2009-03-20
Posts: 127 |
![]() |
dmolavi wrote:
I've done the following: I've been there (in fact still are with the JavaScript of jCarousel) ;-) but actually wanted to say that I am also looking very much forward to having this module up and running. Thanks for the work you put into this. Uli --- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
You're welcome, and thanks for your efforts on the nav carousel I'm going to try to get as much of this done this week as I can, as I'll be on vacation next week and won't be able to work on it at all... -- |
|
bharat
![]()
Joined: 2002-05-21
Posts: 7994 |
![]() |
Ok.. I committed your code to gallery3-contrib (sorry for the delay -- I thought you were going to do it on your own fork and then we'd pull it in). Your code went in here: http://github.com/gallery/gallery3-contrib/commit/6e38f07e9c773f523601c8aba818dd191db96cb5 The only thing I did there was to strip carriage returns. Then I did a pass over it here: http://github.com/gallery/gallery3-contrib/commit/d917430aec662272d70a9db73fbfda1bd2ec6bc9 The commit description explains a lot about what I did there. Mostly structural cleanup. If you don't agree with stuff I've done, please feel free to revert, change, etc. I made some executive decisions about stuff. The main change I made was that I felt it was unnecessary to create a model for your data; you really just need to send the ecard when the user hits return. I also simplified the UI so that the ecard form appears in a dialog box, which makes life a lot easier (we ditch the .js and .css, etc). What's left? From my commit msg: LEFT TO DO: 1) Rename Ecards_Controller to Ecard_Controller for consistency (and put it in ecard.php) 2) Actually have it send the ecard
I left #1 there as an exercise for the reader Regarding the sad state of affairs for dev docs, remember also that there are a ton of docs for Kohana here: http://docs.kohanaphp.com/ Things like the ORM class and many other constructs are well documented there. Let me know what questions you have. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
Thanks I should just use $item->resize_img for fetching the image to place into the email, i'm guessing... -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
I see that the validation has been removed. It was (from the comments module) in the comments model. Since a model is no longer used, I've tried, without success to put it in the controller, and the helper. Is it using the Kohana validation? If so, it doesn't appear to be working, as a completely blank form doesn't return any errors... EDIT: Ah, it's the built in handler. I still don't understand why I'm not seeing the json error messages though when submitting an incomplete form. The fact that this is in a dialog box shouldn't impact these, should it? Or should the error messages be presented in another way? EDIT #2: Got it -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
PROGRESS!!! I've got the form completed, properly validating, and it even sends the email. The last major hurdle is that the image isn't included. I'm using: So this raises the following question: Is it better to hotlink to the image in the email, or is it better to put it as an inline attachment? I'd go for the latter, but what is the most efficient way to accomplish that, or is it impossible with our framework? -- |
|
webmalone
Joined: 2007-03-06
Posts: 30 |
![]() |
I selfishly hope you figure out how to put the image inline like in G2. Inline is ideal for Smartphone users ... one less step to see image. Being able to choose the size of the inline image would be gravy |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
I'm trying to just get it inline for now, using the resize that's available. After this, i'm going to give a go at a mobile-browser module... -- |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
dmolavi, try $item->resize_url(true) That'll return the full url with FQDN, but then you'll need to build the styling yourself. I just figured out that bit from working on this thread: As for the other question of if it should be inline or not.... I don't care. Inline means it's part of the message making the email larger. Hotlinked then you have to deal with an extra step in nearly every email client and probably more bandwidth consumed from your site. As for how to get it inline, I don't know. But $item->resize_path() will return the full system path to the image if you need that to attach the image to the email. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
nivekiam wrote:
dmolavi, try $item->resize_url(true) That'll return the full url with FQDN, but then you'll need to build the styling yourself. Yeah, even outlook 2007 at work doesn't like to display hotlinked images. Inline would be a lot better, and I that's how it was done in G2. But looking at the G2 code doesn't give any insight as to how to do it here. Bharat, any thoughts? As for the functionality, I just need to get the image into the message and it's a done deal EDIT: G2 used mail_mime to inline the image. it was a PEAR module that was installed w/ G2. what's the official stance on including external modules like that? if it's ok, i will make it part of the ecard installation... -- |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
Quote:
EDIT: G2 used mail_mime to inline the image. it was a PEAR module that was installed w/ G2. what's the official stance on including external modules like that? if it's ok, i will make it part of the ecard installation... Funny you should ask: http://gallery.menalto.com/node/97166#comment-349334 |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
nivekiam wrote:
suh-WEEEEEEEEEET. I picked up the packages (2 extra files) and will try to tinker with them. Hopefully by the end of the week, this'll be ready... -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
BOOYAH!!! It's working The one thing I don't like is how there is no space between the eCard title on the sidebar and whatever block occupies the space above it. any idea how to fix that? look at the screenshot on the codex page for ecard to see what i'm talking about. I've updated the zip file on the original post. -- |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
I installed eCard on my server and it looks fine in my sidebar. I'm not seeing what you are in that screenshot. I'm just using the default, unmodified (I believe) Wind theme. A couple of things I noticed you may already be aware of them. 1) If I click Send without entering anything I get a bunch of raw escaped html for the returned validation errors. Even with the HTML Purifier module installed. If that module is a requirement, perhaps the eCard module should check to see if it's installed and install it first if needed. Though even after I installed HTML Purifier I still got raw, escaped HTML. 2) The "results:success" dialog probably needs some different text 3) While you have a sidebar option, it's not listed under the manageable sidebar options under Appearance > Manage Sidebar. I'd actually prefer to see it as a button right next to Slideshow and the other options. Though I'm not sure how you get something up on that menu. Maybe possibly have it as an option to be a sidebar block or a button next to the other buttons like Slideshow. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
1. Hmm..I'm not seeing raw HTML for the validation errors. it might be the cache here at my office. i'll check when i get home. where are you seeing this? under the input text boxes in the form? I've tried to repro your issues in firefox 3.6.8 and IE8 with no success... -- |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
AAAAAAHHHHH Chrome crashed. Feck, a dozen or so sites I had open for the last few days, gone. Guess there's a few threads I won't be replying to unless the poster bumps the thread.... Firefox handles crashing with tabs open WAAAAY better than Chrome. I might be running a newer version of the G3 code base than you so that might explain the "result":"success" dialog. I'm attaching screenshots. One more suggestion, maybe not have the eCard option show up under you are looking at the photo. If you send an eCard for an album you get an email with no image attached. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
Yeah, you're running from git, aren't you? I'm doing this on RC2 just to get the functionality down, then i'll update for all the post-RC2 API changes. I'll have to work on getting it off the album sidebar. should be easy enough. Edit: done -- |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
Yeah. I'll try with RC2 and see how things go. I'm not a big eCard fan myself, but I have and keep that functionality installed on my Gallery installs because I know some people like it. And G3's interface is going to be so much easier to use I can see my visitors using more functionality other than just browsing. |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
nivekiam wrote:
Yep, works as expected in RC2. No raw HTML or no ajaxy "success" dialog. OK, i'll have to update soon then. The scrunchy dialog is probably a product of the theme i'm using. -- |
|
webmalone
Joined: 2007-03-06
Posts: 30 |
![]() |
Nice! Tested and it works ... the initial install had an extra % after the to and from names, but I simply removed the trailing % in the eCard Admin and it looks good. Some requests: In G2, the Admin had the option to receive all eCards sent, and we really enjoyed seeing the activity, so I hope this is added back in. I want the eCard Button to be the top box in the sidebar, but I don't have the ability to move it in the Manage Sidebar admin, and it's stuck at the bottom of the sidebar. Considering the eCard button appears on every page, even the homepage and every album page, sending the Album Cover as the inline image would make sense considering those emails are currently without photo, but say click the photo in the body of the message. Thank You ! |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
webmalone wrote:
Nice! Tested and it works ... the initial install had an extra % after the to and from names, but I simply removed the trailing % in the eCard Admin and it looks good. Yeah, that was an "oops". It should be fixed in the version that's up there now. webmalone wrote:
Some requests: It's on the list. webmalone wrote:
I want the eCard Button to be the top box in the sidebar, but I don't have the ability to move it in the Manage Sidebar admin, and it's stuck at the bottom of the sidebar. Yeah, I don't know how to do that. I'm going to have to poke around in other code to see how to get it moved. webmalone wrote:
Considering the eCard button appears on every page, even the homepage and every album page, sending the Album Cover as the inline image would make sense considering those emails are currently without photo, but say click the photo in the body of the message. I've removed it from album pages; it only appears on photo pages now. webmalone wrote:
Thank You ! You're welcome |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
I've made the following updates: * Ensure the button doesn't show up when viewing in an album, only when looking at a photo -- |
|
webmalone
Joined: 2007-03-06
Posts: 30 |
![]() |
are those updates included in the current zip? if so, i cannot see them. sorry if i'm jumping the gun. dmolavi wrote:
I've made the following updates: |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
sorry, distracted by my day job ;) it's updated now. -- |
|
webmalone
Joined: 2007-03-06
Posts: 30 |
![]() |
Nice Work! I wish all these emails weren't getting caught by my Postini Spam filter. |
|
bharat
![]()
Joined: 2002-05-21
Posts: 7994 |
![]() |
Great! Any luck in getting it into git? |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
.sigh ... no. primarily because i didn't have time last night, and i had to be up at 5AM for work today. i have the windows client installed on my PC at home, just need to grab a few minutes to get it uploaded... -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
Updated to 1.1: * Made an admin option of where to display the button/link for the eCard. -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
I just updated my install to the latest from GIT and all looks well. I've attached the post-RC2 version of the module here. Can I get more testers? Also, I still don't see the "result:success" dialog in any of my browsers... EDIT: tried this in IE8. While FF correctly shows the errors below the missing inputs, IE barfs, complaining that JSON isn't defined. It's the line w/ "JSON" in the following section of code: var content = ""; if (mimeType[1] == "application/json") { data = JSON.parse(data); } else { data = {"html": escape(data)}; } anyone else seeing this in IE8? I have no problem using FF (it's my only browser), but my parents and inlaws don't know any better. I'm wondering if this is why i'm not seeing the "results:success" dialog. FF appears to ignore it and still refresh the page and get rid of the dialog box, whereas IE stops dead in it's tracks. -- |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
I'm using Chrome and Firefox and everything appears to work fine except (well I haven't tested all the options yet) for one minor thing. The upgrader doesn't appear to work. I installed the new module, with the new version number 1.1 and went to /gallery3/index.php/ugprader and tried to upgrade. G3 sees that I have version 1 installed and 1.1 to upgrade to but it doesn't upgrade. So far in G3 I've only seen modules increment full numbers, so not 1.1, but 2 Don't know if that's the issue or not. Validation works and displays red text. Sending works. Icon works. Being displayed only on photo pages works. Looks great! Now we just need a graphics person to make an envelope icon that looks like the other icons... |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
@nivekiam: Re: the upgrade, I noticed the same thing with the navigation carousel (which is at version 4.2). I'm guessing G3 just looks at the portion of the version number before the decimal point. EDIT: I tried this at home tonight on IE8 and all worked. Must've been something at my office. -- |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
the twins just went down for a nap, so i'm going to bump the version to 2 and get it into my fork in git. -- |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
after much consternation, my commit is in my fork (dmolavi/gallery3-contrib) of the -contrib repo. pull in whenever convenient. -- |
|
bharat
![]()
Joined: 2002-05-21
Posts: 7994 |
![]() |
I've pulled your changes into gallery3-contrib. I fixed some whitespace issues and merge conflicts along the way. There was also an error where you bumped the version in module.info to 2, but the installer was still installing it as version 1. Not a big deal; it just meant that when you install it would think that it needed an upgrade. Make sure that you merge my changes back into your fork before you make more changes; that'll avoid merge conflicts in the future. |
|
bharat
![]()
Joined: 2002-05-21
Posts: 7994 |
![]() |
Oh and btw -- your ecard_block::get() function should check to see if there's an item before using it. Else it'll fail on pages that don't have items (tag pages, etc). |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
One tiny anomaly I see is when you send the ecard the entire page refreshes instead of just having the dialog disappear. What it causes is you to see the "eCard successfully sent" message appear and then the page reload and the message "eCard successfully sent" slowly fade in as it should. |
|
dmolavi
![]()
Joined: 2002-12-05
Posts: 573 |
![]() |
bharat wrote:
I've pulled your changes into gallery3-contrib. I fixed some whitespace issues and merge conflicts along the way. There was also an error where you bumped the version in module.info to 2, but the installer was still installing it as version 1. Not a big deal; it just meant that when you install it would think that it needed an upgrade. how do i merge your changes into my fork? i can't see anything on the web interface that shows how to do it. and i think i may have b0rked things from git-bash, so maybe starting over with a new fork is the best thing to do... -- |
|