Hey, I love the Windows XP uploader with the older version of Gallery. I notice it is not included at this time with G2. Will this feature be available for G2? Or is it availale now?
we'll probably get to it eventually... anyone want to write it?
pospues
Joined: 2004-12-28
Posts: 31
Posted: Mon, 2005-01-03 02:59
mindless, I took a quick look at the code in publish_xp.php and it doesn't look overly complicated to covert it to G2. Would the intention be to have this use the same flow as in G1 only with it updated to use the new methods required for G2 or are there other changes that need / should be made?
bharat
Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2005-01-03 09:29
I think that we should maintain the same feature set as we have with G1. We should create a new module with an ItemAddPlugin that provides you with the registry file for XP, then provide it with a URL directly to a controller inside the new module which provides all the functionality that it needs. The remote module is a good example of how to do all of this. Look at modules/remote/GalleryRemote.inc to see how to do the command processing. We're around to provide guidance...
pospues
Joined: 2004-12-28
Posts: 31
Posted: Mon, 2005-01-03 16:41
Excellent. Then I volunteer to at least make an attempt at an implementation. Should the processing be the same such that the Publish function in XP iterates through the selected photos sending one at a time? Or more generally, since the module will be providing it's own controller, keeping the same protocol as used in Gallery 1 should be acceptable?
pospues
Joined: 2004-12-28
Posts: 31
Posted: Tue, 2005-01-04 03:08
I believe I've answered my own questions. The way the publish mechanism in XP works forces the way the uploads are processed (after the XML is modified). And as for keeping the same protocol, to take advantage of some services offered by G2, I'm using the new form model which by definition means a different protocol.
rtdean
Joined: 2004-12-03
Posts: 2
Posted: Tue, 2005-01-04 03:17
Thanks for working on this. If you need a beta tester, let me know. I'm not much of a programmer, but I can install and let you know how it works on my site.
pospues
Joined: 2004-12-28
Posts: 31
Posted: Tue, 2005-01-04 15:17
rtdean, Thanks for offering to beta test it. I'll definitely take advantage of your offer! I should have something to try around the end of the week if not sooner. I'm changing the style and flow slightly to make it feel more integrated with the Publishing Wizard so when I send it along, I'd definitely appreciate feedback on how the user experience is in addition to whether it works or not.
pospues
Joined: 2004-12-28
Posts: 31
Posted: Wed, 2005-01-05 07:30
I've finished an initial implementation of the PublishXP module that allows users to publish using XP's publish wizard. Since this is actually my first attempt at PHP, I'm sure I haven't used it correctly. Though as far as I can tell, it seems to be working well with G2 -- it's a complete rewrite from what was used in G1.
rtdean, would you mind giving this a try on your system and let me know how it works for you and any suggestions you may have?
bharat, could you please review my code and answer some questions I have? Please see below.
1. Since each page that is served to XP needs to follow a given format, it would have been helpful for me to use the template processing support that G2 uses. Is this something worth pursuing, and if so, where should I look to figure out how to leverage it? Please see my base WizardPage class I used to abstract out the different steps in the flow.
2. What's the right way for me to make this localizable? I know for sure that how I currently have it isn't right since I have hardcoded strings all over the place. But since I'm not using templates, I can't use {g->text text="..."}. Please see any of the classes/*Page files for an example of what I mean.
3. I decided against using the style sheets from the selected Gallery theme since I felt having it appear more like XP would give the user a more consistent experience. All of it seems to be working well, but I have hard-coded the background color of the Publishing wizard window to have the pages match the background. Does someone know of a way in IE to access the current system background color for dialogs? As users can change Windows default colors, this would make my hardcoded value show up as an off-color background.
4. I've updated the generated registry file to use the domain name in the publishing wizard. This makes it easy if a user needs to publish to multiple sites -- though perhaps I should use the name of the top-level album. What seems to make the most sense? Do most people rename their top-level album? Or is using the domain name more consistent for users?
5. My most basic question is... How does my coding style look in PHP? I've been working in compiled languages so long, it's taking a bit to switch over and I'm not sure if my OO design makes sense in how PHP is set up. I broke each page of the wizard into a separate file to make it more maintainable but perhaps there is a better way of accomplishing the same thing in PHP?
6. For PHP, I had tested on my local system code like $gallery->getUrlGenerator()->getCurrentDomain() and it all worked well. When I uploaded it to my Linux server I host a Gallery on, it failed. I had to update it to split the command into two lines. (The Linux server is running 4.3.x while my local development box is running 5.0.x of PHP). Is this a structure we should generally be avoiding?
7. My final question is around locks. In a number of places in G2 code, I've seen locks being established and then during processing, if an error occurs, return is called before explicitly releasing the locks. Does this mean that G2 automatically releases locks upon error conditions? Or should these failures be releasing locks before returning?
8. Do you have a good example of how we should be using phpunit? I'm not familiar with phpunit (though I am aware of extreme programming principles).
9. For questions like these going forward, should I be using the gallery-devel mailing list or are the forums the right place to ask questions for the development of G2 modules?
Thanks,
pospues
bharat
Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2005-01-07 04:13
This is a great start! I have a lot of comments, but I think that you're mostly
headed in the right direction we just need to do some course corrections. You
probably expected that, though If some of this stuff doesn't make sense then
let's talk it throuhg. Sounds to me like you've got a pretty good grasp of what's
going on though so I think most of what I say will make sense to you.
I did this review over two days so it might be a little disjointed, sorry! I
read through and commented on the code before answering your individual questions
(the answers to those are at the bottom of this post).
General issues:
WizardPage.php, LoginPage.php, etc. should all be renamed to end in
.class because we want to avoid having random files be executable
out of context by the PHP engine. There's only one entry point into
G2 and that's main.php.
When I try to run it, I get a variety of "Notice: Undefined variable" warnings.
When you develop for G2, you should configure your environment so that it's
very restrictive (max warnings) so that it helps you to find areas where you're
taking shortcuts that can cause problems on other systems. Read and follow
the dev instructions here: http://gallery.sf.net/wiki.php?page=Development%20Environment
I like the API that you've created with WizardPage, but ultimately I think
that you're just reproducing what we already have with views and controllers,
except that you're losing a little of the benefit. If you promote all of
the WizardPage subclasses to be (non-immediate) GalleryView and GalleryController
pairs, then you get a few advantages:
You can easily use templates which will give you separation between
your code and content (which will greatly aid readability and is something
that we are pretty strict about for core G2 code)
You can render all of your pages inside the gallery global template, which
will cause your pages to look the same as the rest of the Gallery pages
You won't have an extra layer of abstraction
You can use our existing styles/themes and not have to write your own
inline CSS
Since you have some HTML that you render on every page, you can follow
a model similar to UserAdmin (or ItemAdmin, SiteAdmin .. but UserAdmin is a
simpler example) where your url is to: ...g2_view=publishxp:PublishXP&g2_subView=publishxp:LoginPage...
this way it will load up the PublishXP view which can look for the subView
and call GalleryView::loadView() to load it up and $subView->loadTemplate()
to allow it to store its variables into the template. Then you render it all
at once. This will make your wizard look very much like every other view in
the system which will make it easier to support and extend in the future.
Also, separating out the code that changes the data model into controllers makes
it easier to write tests since it follows our conventional phpunit test model.
Style issues:
curly braces should be on the same line as the calling construct, eg:
Single line comments should be /* */ instead of //
Static methods shouldn't have any whitespace around the "::"
(first seen on module.inc line 51, 68)
lines should not exceed 100 characters (first seen module.inc line 51).
no spaces after the & reference operator (eg, "& $form" should be "&$form")
PublishXP.inc:
methods that start with an underescore (_) are private, so you should
not do: $page->_handleRequest(...)
You might want to swap _handleRequest() and handleRequest() in WizardPage
so that the public method doesn't have the underscore.
DownloadReg.inc:
You don't need the controller here since you're not changing any data
when you build the link on the ItemAddPublishXP.tpl do it like this: {g->url arg1="view=publishxp:DownloadReg"}
and it'll use your view instead
You don't need a form for this view. Form processing is useful when you
want to maintain state between pages (or on subsequent reloads of the same
page) but in your case you're sending just a command, so you can structure
your params like this:
If you use regular non-immediate views, you can use almost any of our
existing views as examples of how to use templates in this case.
You can always localize things by using GalleryCoreApi::loadPlugin() to
get the current module, and then calling $module->translate() on a string.
But once you move all your content into templates, it's far easier to
do {g->text}
I can see the advantage of making it more seamless with Gallery, but if
you make your own style here then it won't be easily controlled by the
theming system. I like the though that if you're uploading to a gallery then
you see the look and feel of the destination during the upload process (it's
like a portal into the destination site). Either way, it's going to be far
easier to start by using the global template. If it looks really bad, we can
make a streamlined template (a peer to global.tpl) that you can use instead
The name of the top level album is probably better. It's the only place where
we allow you to customize the "name" of your G2 at the moment.
Unfortunately PHP 4.x does not support the $a->b()->c() syntax. PHP 5 does, but
our compatibility target is 4.1
G2 will clean up dangling locks. If you think that your error can be caught and
handled, then you should probably clean up any locks that you know of, but it's
ok not to. Lock cleanup can be quite verbose and we can always do clean up later if we
realize that there was a way to recover from the error.
You mainly want to write unit tests for your controllers, which will be changing your
data model. Look at any of the ControllerTests in modules/core/test/phpunit. Mostly
they make up dummy data, create a $form and let the controller do its thing, then
validate that the results are correct. It's a bit tricky at first, but once you get
the hang of it it's pretty simple to pound out new tests.
The forums are more active than the mailing list and are searchable, so this is a good
place to ask this stuff.
[/]
[/]
[/]
[/]
[/]
[/]
pospues
Joined: 2004-12-28
Posts: 31
Posted: Fri, 2005-01-07 05:14
Thanks for the detailed comments. I definitely appreciate the course correction before I went too far down this path. I believe I understand what you are getting at though I'll have to go through implementing the comments to know for sure.
Quote:
You can render all of your pages inside the gallery global template, which
will cause your pages to look the same as the rest of the Gallery pages
What I was worried about is screen realestate. The wizard window in XP is non-resizable. After looking into this, I realized that the navigation on the left-side of Gallery is just provided by the template and as such, I can easily define templates that use the standard styles but don't require excessive realestate.
Thanks for the links to coding guidelines and the development environment. As a follow-up, do you have a recommended IDE to use for development of PHP and Gallery?
bharat
Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2005-01-08 04:40
Yea .. I think that once we get something going we can take a look at it and figure out whether it's going to be too messy to do it with the global template. We may want to create a new "slim" template for things like this (but we can easily do that later once your code is templatized).
I use Emacs to do my PHP development. If you use php-mode.el, it does most of the work for you. Apply our php style on top of that and it'll conform to the G2 style (mostly).
Signe uses PhpED and likes it, I think. I'll let him weigh in on that.
signe
Joined: 2003-07-27
Posts: 2322
Posted: Sat, 2005-01-08 05:30
I find that I do most of my work in vim... it's configurable, and it has good defaults for php.
phpEd is a wonderful IDE, but I've found that it doesn't like the G2 coding standards unless I pay a lot of extra attention. The auto-indenting and select-shift/ctrl-shift stuff (normal Win32 IDE indent/unindent hotkeys) aren't all that well done.
The one thing that phpEd has that I haven't really seen in any other IDEs is server-side runtime debugging and code profiling. The ability to single-step code while it's executing is unbelievably useful to me in G1 and G2 (and any PHP code, really). The profiling has come in handy several times, and is a nice tool, but not useful on a day-to-day basis.
The main problem with phpEd is the cost. ~$300 for a single license... extra licenses are cheap, but it's the first one that kills you.
pospues
Joined: 2004-12-28
Posts: 31
Posted: Mon, 2005-01-10 23:00
In the screenshot below, I am now taking advantage of the templates (per recommendation). Apart from the screen being compact, I'm running into an issue with the layout. Could someone please point me at better CSS options to use in order that the components stretch to the right side of the screen? Here's what I'm using right now (the CSS tags lifted from another page under core):
<div id="gsAdminContents">
<div class="gbTopFlag">
<div class="gbTitle">
<h2 class="giTitle">
{g->text text="Choose the album for new items"}
</h2>
</div>
</div>
<div class="gbAdmin">
<div class="gbDescription">
{g->text text="...snip..."}
<a href="javascript:createNewAlbum();">{g->text text="create a new album"}</a> {g->text text="...snip..."}
</div>
<div class="gbDataEntry">
<select ......
[/code]
RwD
Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-01-11 06:28
Would like to help you (testing)
But actually have not a good idea of how to install the thing.
Got two files named publishxp and renameall. What would be the next step??
Usually I find the weird errors, not sure if you are gonna like me for testing :roll:
well, let me know what to do and you've got yourself a tester ;)
kylemcginn
Joined: 2005-01-11
Posts: 1
Posted: Tue, 2005-01-11 09:09
Also would like to help out testing, but also having problems installing! Any chance you could put a quick 'howto' up?
I've got the module installed and activated correctly but unable to to get the registry download working.
Thanks!
RwD
Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-01-11 11:26
How did you install and activate the module?
I amtotally new to gallery, so it could be simple. I am at my work now and can't test it right now unfortunately...
Perhaps in return I know how to solve your problem ;)
pospues
Joined: 2004-12-28
Posts: 31
Posted: Tue, 2005-01-11 12:35
The files that I published previously would be extracted into the modules area under your gallery2 installation. That said, for PublishXP, I'm working on a rewrite given Bharat's comments on my first attempt. Given the magnitude of the changes, I'd ask that you wait to test it -- and then I'd definitely appreciate your help testing it out and giving feedback. Thanks!
RwD
Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-01-11 13:39
Personal preference: Is it possible to be able to manually set image titles and descriptions instead of just the descriptions?
pospues
Joined: 2004-12-28
Posts: 31
Posted: Tue, 2005-01-11 13:45
Potentially, though I feel that naming items and descriptions is part of the core proficiency of Gallery. Or optionally you can assign useful filenames in the operating system prior to upload. If we do it as part of the upload process and for some reason, you have to abort, you end up loosing all of your work, whereas in Gallery or beforehand in the OS you have the same capability but it is persisted. The titles can be set to the filenames with or without the extensions but are always set.
Is what you are looking for an efficient way to name all items in an album?
pospues
Joined: 2004-12-28
Posts: 31
Posted: Tue, 2005-01-11 14:00
Quote:
Also would like to help out testing, but also having problems installing! Any chance you could put a quick 'howto' up?
For testing this, when I have a new version available with the updated UI and implementation model, I'll also publish a HOWTO on how to get going with it. Thanks.
RwD
Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-01-11 14:01
yes, I found that all options inside gallery2 basically give you no options. You can choose sizes, orientations and type in a description.
I would like to be able to quickly set the title for 80 items and add a description if I want one for pictures comming from a digi-cam (so the filenames are always numeric) So having inputfields available without having to open a seperate page for each image or anything faster then that would be great!
I have similar concerns and Bharat mentioned that there is a new update that allows multiple items to be renamed.
bharat
Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2005-01-13 07:32
Try using <div id="gsContents"> instead of gsAdminContents. Does that fix it?
pospues
Joined: 2004-12-28
Posts: 31
Posted: Fri, 2005-01-14 01:56
Thanks, that did it.
c4actbe
Joined: 2004-09-01
Posts: 83
Posted: Thu, 2005-03-03 15:29
any updates? it doesn't work with my week old g2 build.
Fatal error: Call to a member function on a non-object in .../modules/core/classes/GalleryModule.class on line 301
Line 301: if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-03-03 15:44
c4actbe, you may understand that we can't support old g2 builds during alpha development. i'd recommend upgrading to beta 1 tonight when beta is out.
besides, your error was much too general...
c4actbe
Joined: 2004-09-01
Posts: 83
Posted: Thu, 2005-03-03 20:41
i am not seeking support. I do not expect anyone to drop whatever they were doing and start helping me with my problems.
Since this module not in CVS. in the best case scenario, i expected to find some leads on where i should search for updates....
sorry if my post sounded like request or something...
pospues
Joined: 2004-12-28
Posts: 31
Posted: Thu, 2005-03-03 20:56
Sorry, I've been caught up in some busy times at my day job. If the work for the new G2 Remote Protocol doesn't invalidate this work, then I can publish a new version that works with the updated APIs. I'll publish a message when it's tweaked.
c4actbe
Joined: 2004-09-01
Posts: 83
Posted: Thu, 2005-03-03 22:08
the funny part is that after giving error, this module got activated after 2nd try.
i blindly tried to guess how i should tweak my registry to make it work.... miserably failed.... oh well, it's not first, and not last time
quentinjs
Joined: 2004-11-25
Posts: 32
Posted: Sat, 2005-03-12 23:08
any more news on this ?
sethcohn
Joined: 2005-03-21
Posts: 3
Posted: Mon, 2005-03-21 14:06
quentinjs wrote:
any more news on this ?
Bump.
Another user looking for this to allow my wife the easiest way to upload.
Upgraded from G1 to G2 (and it's now part of our Drupal blog), but I miss this feature. Doesn't install on current Beta.
bharat
Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2005-03-22 10:37
We haven't forgotten. But we haven't acquired any new resources to work on this, either :-/
pospues
Joined: 2004-12-28
Posts: 31
Posted: Mon, 2005-03-28 20:34
I've finally put together an updated version of the publishxp module that I originally put together for an early version of G2. This includes most of the recommendations that Bharat made, however I have other tweaks left to make including phpunit integration. I've tested with this Gallery 2's latest version in CVS. One note, you may have to re-register your gallery with XP using the Add Items -> Windows XP option and downloading the appropriate registry file.
Please let me know any comments or problems you have using this module.
Good luck. Tim
pospues
Joined: 2004-12-28
Posts: 31
Posted: Mon, 2005-03-28 20:53
Instructions: Forgot to mention, to activate, extract into your gallery2/modules directory. Go to Site Admin, and select modules. From there, look under Import and click "install" for Publish XP. When the page comes back, you'll now need to select "activate". There is nothing to configure for this module.
Bharat or others: At line 85 of NewAlbum.inc (ignore the coding conventions, will be fixed later), I set into $form['album'] the ID of the album that has been created. The idea being, that when the user returns to SelectAlbum, the newly created album is already selected. For some reason, when it returns to SelectAlbum, it appears the change has not been picked up. I've tried to use both redirect and delegate to get the behavior I want, but in both cases, I am unable to get the value out. One thought I had was whether $form was being passed in by value or reference, so I tried changing it to & $form without any change (again, still a novice at PHP). Any suggestions on how I can get the value change in $form['album'] to be available when rendering the SelectAlbum view?
g0d
Joined: 2005-03-12
Posts: 22
Posted: Tue, 2005-03-29 16:03
i get the following error:
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /modules/publishxp/DownloadReg.inc on line 48
pospues
Joined: 2004-12-28
Posts: 31
Posted: Tue, 2005-03-29 20:54
Quote:
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /modules/publishxp/DownloadReg.inc on line 48
Looks like I'm still taking advantage of some PHP5 language syntaxes. I'll remove them and re-publish. To confirm, what version of PHP are you using?
sethcohn
Joined: 2005-03-21
Posts: 3
Posted: Tue, 2005-03-29 21:44
pospues wrote:
Quote:
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /modules/publishxp/DownloadReg.inc on line 48
Looks like I'm still taking advantage of some PHP5 language syntaxes. I'll remove them and re-publish. To confirm, what version of PHP are you using?
Same error here, less than PHP5 (PHP 4.something)
sethcohn
Joined: 2005-03-21
Posts: 3
Posted: Tue, 2005-03-29 22:15
sethcohn wrote:
pospues wrote:
Quote:
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /modules/publishxp/DownloadReg.inc on line 48
Looks like I'm still taking advantage of some PHP5 language syntaxes. I'll remove them and re-publish. To confirm, what version of PHP are you using?
Same error here, less than PHP5 (PHP 4.something)
It's the $gallery->getUrlGenerator()->generateUrl() lines
that it chokes on (also in UploadItems)
replace all of those with
$urlgen = $gallery->getUrlGenerator();
$urlgen->generateUrl()
style code
and it should work (does for me!)
pospues
Joined: 2004-12-28
Posts: 31
Posted: Tue, 2005-03-29 23:44
Re-published with the updates -- actually had the exact same code you mentioned down to the variable name ;-) Thanks for confirming that this fixed it. Hopefully this now keeps working through the G2 final release. Now it's working for others, I'll go through and clean up the code per Gallery style conventions. Cheers
g0d
Joined: 2005-03-12
Posts: 22
Posted: Wed, 2005-03-30 02:39
Thanks it works now ...
internetgardener
Joined: 2004-09-10
Posts: 5
Posted: Thu, 2005-03-31 23:56
Just installed G2 (Dark - Beta1) - works and looks great!.
Download your most recent version of the XP Publishing tool. When I go to gallery modules/import I get the following error showing up:
Publish XP 0.9.1 Implementation for direct publishing from XP
Incompatible module! Core API Required: 5.0 (available: 4.0)
Not sure what it means by "Core API Reqired: 5.0 (availablle: 4.0)"
Thoughts?
Cheers,
Curt
pospues
Joined: 2004-12-28
Posts: 31
Posted: Fri, 2005-04-01 01:39
Modify the module.inc file in the publishxp/ directory. Change:
$this->setRequiredCoreApi(array(5, 0));
To the following:
$this->setRequiredCoreApi(array(4, 0));
I've been testing this module against the latest version in CVS. Please confirm that this fixes your issue.
rstocks
Joined: 2002-12-18
Posts: 26
Posted: Fri, 2005-04-01 02:04
Installed this module this morning and gave it a quick run. Originally had the same issue as internetgardener, but grabbed the latest snap and updated the beta rather than hack the version required in the module.
Pospues, great work! Download of the registry file was flawless, and the upload worked perfectly. Very nice piece of integration work.
On a side note to the devs: great work also on the updater! I went from the Dark Fibre beta release to the current CVS snap, and the update process was faultless. Very slick work from all involved.
Cheers,
Rich
internetgardener
Joined: 2004-09-10
Posts: 5
Posted: Sat, 2005-04-02 04:27
That worked GREAT! Thanks for the fix.
Now I am just trying to figure out what I need to do on the registry side of things. Gallery 1 had a nice little publish_xp.php that when downloaded gave the proper registry entry.
Thoughts?
Curt
arehm
Joined: 2002-11-14
Posts: 16
Posted: Sat, 2005-04-02 14:35
Everything works fine for me untill i go to view the albums i have uploaded. There is nothing there. www.therehmsonline.net is the site. Anyone else having this problem?
pospues
Joined: 2004-12-28
Posts: 31
Posted: Sat, 2005-04-02 16:28
internetgardener
If you activate the module, you just have to go to Add Items for any of your albums and select Windows XP using the tab at the top. From that page you can download the registry file.
internetgardener
Joined: 2004-09-10
Posts: 5
Posted: Sat, 2005-04-02 22:09
Thanks Pospues - again, worked great.
i am now running into same issues as arehm. Images don't show up once uploaded. Still trying to diagnose the problem.
IG.
arehm
Joined: 2002-11-14
Posts: 16
Posted: Sun, 2005-04-03 03:40
pospues, your account is active....still have the same problem. As soon as i get xp publisher i'm going to get my sister with her nikkon D70 to test it out... see how my site handles huge pix
lindehoff
Joined: 2005-04-03
Posts: 20
Posted: Sun, 2005-04-03 07:16
I get a "Internet Explorer Script Error" when I try to uppload, it come's up when the upload is about to start.
ROW: 50
Char: 31
URL : mail.php
arehm
Joined: 2002-11-14
Posts: 16
Posted: Sun, 2005-04-03 20:34
i uploaded a picture 100_5710.JPG
here's all i see when i search for 5710 on my server
Posts: 8601
we'll probably get to it eventually... anyone want to write it?
Posts: 31
mindless, I took a quick look at the code in publish_xp.php and it doesn't look overly complicated to covert it to G2. Would the intention be to have this use the same flow as in G1 only with it updated to use the new methods required for G2 or are there other changes that need / should be made?
Posts: 7994
I think that we should maintain the same feature set as we have with G1. We should create a new module with an ItemAddPlugin that provides you with the registry file for XP, then provide it with a URL directly to a controller inside the new module which provides all the functionality that it needs. The remote module is a good example of how to do all of this. Look at modules/remote/GalleryRemote.inc to see how to do the command processing. We're around to provide guidance...
Posts: 31
Excellent. Then I volunteer to at least make an attempt at an implementation. Should the processing be the same such that the Publish function in XP iterates through the selected photos sending one at a time? Or more generally, since the module will be providing it's own controller, keeping the same protocol as used in Gallery 1 should be acceptable?
Posts: 31
I believe I've answered my own questions. The way the publish mechanism in XP works forces the way the uploads are processed (after the XML is modified). And as for keeping the same protocol, to take advantage of some services offered by G2, I'm using the new form model which by definition means a different protocol.
Posts: 2
Thanks for working on this. If you need a beta tester, let me know. I'm not much of a programmer, but I can install and let you know how it works on my site.
Posts: 31
rtdean, Thanks for offering to beta test it. I'll definitely take advantage of your offer! I should have something to try around the end of the week if not sooner. I'm changing the style and flow slightly to make it feel more integrated with the Publishing Wizard so when I send it along, I'd definitely appreciate feedback on how the user experience is in addition to whether it works or not.
Posts: 31
I've finished an initial implementation of the PublishXP module that allows users to publish using XP's publish wizard. Since this is actually my first attempt at PHP, I'm sure I haven't used it correctly. Though as far as I can tell, it seems to be working well with G2 -- it's a complete rewrite from what was used in G1.
rtdean, would you mind giving this a try on your system and let me know how it works for you and any suggestions you may have?
bharat, could you please review my code and answer some questions I have? Please see below.
The module as it is currently implemented can be downloaded from http://www.pospues.com/addons/
So my questions are:
1. Since each page that is served to XP needs to follow a given format, it would have been helpful for me to use the template processing support that G2 uses. Is this something worth pursuing, and if so, where should I look to figure out how to leverage it? Please see my base WizardPage class I used to abstract out the different steps in the flow.
2. What's the right way for me to make this localizable? I know for sure that how I currently have it isn't right since I have hardcoded strings all over the place. But since I'm not using templates, I can't use {g->text text="..."}. Please see any of the classes/*Page files for an example of what I mean.
3. I decided against using the style sheets from the selected Gallery theme since I felt having it appear more like XP would give the user a more consistent experience. All of it seems to be working well, but I have hard-coded the background color of the Publishing wizard window to have the pages match the background. Does someone know of a way in IE to access the current system background color for dialogs? As users can change Windows default colors, this would make my hardcoded value show up as an off-color background.
4. I've updated the generated registry file to use the domain name in the publishing wizard. This makes it easy if a user needs to publish to multiple sites -- though perhaps I should use the name of the top-level album. What seems to make the most sense? Do most people rename their top-level album? Or is using the domain name more consistent for users?
5. My most basic question is... How does my coding style look in PHP? I've been working in compiled languages so long, it's taking a bit to switch over and I'm not sure if my OO design makes sense in how PHP is set up. I broke each page of the wizard into a separate file to make it more maintainable but perhaps there is a better way of accomplishing the same thing in PHP?
6. For PHP, I had tested on my local system code like $gallery->getUrlGenerator()->getCurrentDomain() and it all worked well. When I uploaded it to my Linux server I host a Gallery on, it failed. I had to update it to split the command into two lines. (The Linux server is running 4.3.x while my local development box is running 5.0.x of PHP). Is this a structure we should generally be avoiding?
7. My final question is around locks. In a number of places in G2 code, I've seen locks being established and then during processing, if an error occurs, return is called before explicitly releasing the locks. Does this mean that G2 automatically releases locks upon error conditions? Or should these failures be releasing locks before returning?
8. Do you have a good example of how we should be using phpunit? I'm not familiar with phpunit (though I am aware of extreme programming principles).
9. For questions like these going forward, should I be using the gallery-devel mailing list or are the forums the right place to ask questions for the development of G2 modules?
Thanks,
pospues
Posts: 7994
This is a great start! I have a lot of comments, but I think that you're mostly
headed in the right direction we just need to do some course corrections. You
probably expected that, though If some of this stuff doesn't make sense then
let's talk it throuhg. Sounds to me like you've got a pretty good grasp of what's
going on though so I think most of what I say will make sense to you.
I did this review over two days so it might be a little disjointed, sorry! I
read through and commented on the code before answering your individual questions
(the answers to those are at the bottom of this post).
General issues:
.class because we want to avoid having random files be executable
out of context by the PHP engine. There's only one entry point into
G2 and that's main.php.
When you develop for G2, you should configure your environment so that it's
very restrictive (max warnings) so that it helps you to find areas where you're
taking shortcuts that can cause problems on other systems. Read and follow
the dev instructions here:
http://gallery.sf.net/wiki.php?page=Development%20Environment
that you're just reproducing what we already have with views and controllers,
except that you're losing a little of the benefit. If you promote all of
the WizardPage subclasses to be (non-immediate) GalleryView and GalleryController
pairs, then you get a few advantages:
your code and content (which will greatly aid readability and is something
that we are pretty strict about for core G2 code)
will cause your pages to look the same as the rest of the Gallery pages
inline CSS
Since you have some HTML that you render on every page, you can follow
a model similar to UserAdmin (or ItemAdmin, SiteAdmin .. but UserAdmin is a
simpler example) where your url is to:
...g2_view=publishxp:PublishXP&g2_subView=publishxp:LoginPage...
this way it will load up the PublishXP view which can look for the subView
and call GalleryView::loadView() to load it up and $subView->loadTemplate()
to allow it to store its variables into the template. Then you render it all
at once. This will make your wizard look very much like every other view in
the system which will make it easier to support and extend in the future.
Also, separating out the code that changes the data model into controllers makes
it easier to write tests since it follows our conventional phpunit test model.
Style issues:
(first seen on module.inc line 51, 68)
PublishXP.inc:
not do:
$page->_handleRequest(...)
You might want to swap _handleRequest() and handleRequest() in WizardPage
so that the public method doesn't have the underscore.
DownloadReg.inc:
when you build the link on the ItemAddPublishXP.tpl do it like this:
{g->url arg1="view=publishxp:DownloadReg"}
and it'll use your view instead
want to maintain state between pages (or on subsequent reloads of the same
page) but in your case you're sending just a command, so you can structure
your params like this:
To answer your specific questions:
existing views as examples of how to use templates in this case.
get the current module, and then calling $module->translate() on a string.
But once you move all your content into templates, it's far easier to
do {g->text}
you make your own style here then it won't be easily controlled by the
theming system. I like the though that if you're uploading to a gallery then
you see the look and feel of the destination during the upload process (it's
like a portal into the destination site). Either way, it's going to be far
easier to start by using the global template. If it looks really bad, we can
make a streamlined template (a peer to global.tpl) that you can use instead
we allow you to customize the "name" of your G2 at the moment.
our conventions (http://gallery.menalto.com/modules.php?op=modload&name=GalleryDocs&file=index&page=gallery2-devguide.c\
oding-standards.php). I had some comments on this above. I don't see any flaws
with the mechanics of your OO work, except that I think that it's probably not the
right design direction to be going in.
our compatibility target is 4.1
handled, then you should probably clean up any locks that you know of, but it's
ok not to. Lock cleanup can be quite verbose and we can always do clean up later if we
realize that there was a way to recover from the error.
data model. Look at any of the ControllerTests in modules/core/test/phpunit. Mostly
they make up dummy data, create a $form and let the controller do its thing, then
validate that the results are correct. It's a bit tricky at first, but once you get
the hang of it it's pretty simple to pound out new tests.
place to ask this stuff.
[/]
[/]
[/]
[/]
[/]
[/]
Posts: 31
Thanks for the detailed comments. I definitely appreciate the course correction before I went too far down this path. I believe I understand what you are getting at though I'll have to go through implementing the comments to know for sure.
What I was worried about is screen realestate. The wizard window in XP is non-resizable. After looking into this, I realized that the navigation on the left-side of Gallery is just provided by the template and as such, I can easily define templates that use the standard styles but don't require excessive realestate.
Thanks for the links to coding guidelines and the development environment. As a follow-up, do you have a recommended IDE to use for development of PHP and Gallery?
Posts: 7994
Yea .. I think that once we get something going we can take a look at it and figure out whether it's going to be too messy to do it with the global template. We may want to create a new "slim" template for things like this (but we can easily do that later once your code is templatized).
I use Emacs to do my PHP development. If you use php-mode.el, it does most of the work for you. Apply our php style on top of that and it'll conform to the G2 style (mostly).
Signe uses PhpED and likes it, I think. I'll let him weigh in on that.
Posts: 2322
I find that I do most of my work in vim... it's configurable, and it has good defaults for php.
phpEd is a wonderful IDE, but I've found that it doesn't like the G2 coding standards unless I pay a lot of extra attention. The auto-indenting and select-shift/ctrl-shift stuff (normal Win32 IDE indent/unindent hotkeys) aren't all that well done.
The one thing that phpEd has that I haven't really seen in any other IDEs is server-side runtime debugging and code profiling. The ability to single-step code while it's executing is unbelievably useful to me in G1 and G2 (and any PHP code, really). The profiling has come in handy several times, and is a nice tool, but not useful on a day-to-day basis.
The main problem with phpEd is the cost. ~$300 for a single license... extra licenses are cheap, but it's the first one that kills you.
Posts: 31
In the screenshot below, I am now taking advantage of the templates (per recommendation). Apart from the screen being compact, I'm running into an issue with the layout. Could someone please point me at better CSS options to use in order that the components stretch to the right side of the screen? Here's what I'm using right now (the CSS tags lifted from another page under core):
[/code]
Posts: 383
Would like to help you (testing)
But actually have not a good idea of how to install the thing.
Got two files named publishxp and renameall. What would be the next step??
Usually I find the weird errors, not sure if you are gonna like me for testing :roll:
well, let me know what to do and you've got yourself a tester ;)
Posts: 1
Also would like to help out testing, but also having problems installing! Any chance you could put a quick 'howto' up?
I've got the module installed and activated correctly but unable to to get the registry download working.
Thanks!
Posts: 383
How did you install and activate the module?
I amtotally new to gallery, so it could be simple. I am at my work now and can't test it right now unfortunately...
Perhaps in return I know how to solve your problem ;)
Posts: 31
The files that I published previously would be extracted into the modules area under your gallery2 installation. That said, for PublishXP, I'm working on a rewrite given Bharat's comments on my first attempt. Given the magnitude of the changes, I'd ask that you wait to test it -- and then I'd definitely appreciate your help testing it out and giving feedback. Thanks!
Posts: 383
Personal preference: Is it possible to be able to manually set image titles and descriptions instead of just the descriptions?
Posts: 31
Potentially, though I feel that naming items and descriptions is part of the core proficiency of Gallery. Or optionally you can assign useful filenames in the operating system prior to upload. If we do it as part of the upload process and for some reason, you have to abort, you end up loosing all of your work, whereas in Gallery or beforehand in the OS you have the same capability but it is persisted. The titles can be set to the filenames with or without the extensions but are always set.
Is what you are looking for an efficient way to name all items in an album?
Posts: 31
For testing this, when I have a new version available with the updated UI and implementation model, I'll also publish a HOWTO on how to get going with it. Thanks.
Posts: 383
yes, I found that all options inside gallery2 basically give you no options. You can choose sizes, orientations and type in a description.
I would like to be able to quickly set the title for 80 items and add a description if I want one for pictures comming from a digi-cam (so the filenames are always numeric) So having inputfields available without having to open a seperate page for each image or anything faster then that would be great!
Any ideas?
Posts: 31
Please see this topic:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=24557
I have similar concerns and Bharat mentioned that there is a new update that allows multiple items to be renamed.
Posts: 7994
Try using
<div id="gsContents">
instead of gsAdminContents. Does that fix it?Posts: 31
Thanks, that did it.
Posts: 83
any updates? it doesn't work with my week old g2 build.
Fatal error: Call to a member function on a non-object in .../modules/core/classes/GalleryModule.class on line 301
Line 301: if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
Posts: 32509
c4actbe, you may understand that we can't support old g2 builds during alpha development. i'd recommend upgrading to beta 1 tonight when beta is out.
besides, your error was much too general...
Posts: 83
i am not seeking support. I do not expect anyone to drop whatever they were doing and start helping me with my problems.
Since this module not in CVS. in the best case scenario, i expected to find some leads on where i should search for updates....
sorry if my post sounded like request or something...
Posts: 31
Sorry, I've been caught up in some busy times at my day job. If the work for the new G2 Remote Protocol doesn't invalidate this work, then I can publish a new version that works with the updated APIs. I'll publish a message when it's tweaked.
Posts: 83
the funny part is that after giving error, this module got activated after 2nd try.
i blindly tried to guess how i should tweak my registry to make it work.... miserably failed.... oh well, it's not first, and not last time
Posts: 32
any more news on this ?
Posts: 3
Bump.
Another user looking for this to allow my wife the easiest way to upload.
Upgraded from G1 to G2 (and it's now part of our Drupal blog), but I miss this feature. Doesn't install on current Beta.
Posts: 7994
We haven't forgotten. But we haven't acquired any new resources to work on this, either :-/
Posts: 31
I've finally put together an updated version of the publishxp module that I originally put together for an early version of G2. This includes most of the recommendations that Bharat made, however I have other tweaks left to make including phpunit integration. I've tested with this Gallery 2's latest version in CVS. One note, you may have to re-register your gallery with XP using the Add Items -> Windows XP option and downloading the appropriate registry file.
Download the updated module from:
http://www.pospues.com/addons/publishxp.zip
Please let me know any comments or problems you have using this module.
Good luck. Tim
Posts: 31
Instructions: Forgot to mention, to activate, extract into your gallery2/modules directory. Go to Site Admin, and select modules. From there, look under Import and click "install" for Publish XP. When the page comes back, you'll now need to select "activate". There is nothing to configure for this module.
Bharat or others: At line 85 of NewAlbum.inc (ignore the coding conventions, will be fixed later), I set into $form['album'] the ID of the album that has been created. The idea being, that when the user returns to SelectAlbum, the newly created album is already selected. For some reason, when it returns to SelectAlbum, it appears the change has not been picked up. I've tried to use both redirect and delegate to get the behavior I want, but in both cases, I am unable to get the value out. One thought I had was whether $form was being passed in by value or reference, so I tried changing it to & $form without any change (again, still a novice at PHP). Any suggestions on how I can get the value change in $form['album'] to be available when rendering the SelectAlbum view?
Posts: 22
i get the following error:
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /modules/publishxp/DownloadReg.inc on line 48
Posts: 31
Looks like I'm still taking advantage of some PHP5 language syntaxes. I'll remove them and re-publish. To confirm, what version of PHP are you using?
Posts: 3
Same error here, less than PHP5 (PHP 4.something)
Posts: 3
It's the $gallery->getUrlGenerator()->generateUrl() lines
that it chokes on (also in UploadItems)
replace all of those with
$urlgen = $gallery->getUrlGenerator();
$urlgen->generateUrl()
style code
and it should work (does for me!)
Posts: 31
Re-published with the updates -- actually had the exact same code you mentioned down to the variable name ;-) Thanks for confirming that this fixed it. Hopefully this now keeps working through the G2 final release. Now it's working for others, I'll go through and clean up the code per Gallery style conventions. Cheers
Posts: 22
Thanks it works now ...
Posts: 5
Just installed G2 (Dark - Beta1) - works and looks great!.
Download your most recent version of the XP Publishing tool. When I go to gallery modules/import I get the following error showing up:
Publish XP 0.9.1 Implementation for direct publishing from XP
Incompatible module! Core API Required: 5.0 (available: 4.0)
Not sure what it means by "Core API Reqired: 5.0 (availablle: 4.0)"
Thoughts?
Cheers,
Curt
Posts: 31
Modify the module.inc file in the publishxp/ directory. Change:
$this->setRequiredCoreApi(array(5, 0));
To the following:
$this->setRequiredCoreApi(array(4, 0));
I've been testing this module against the latest version in CVS. Please confirm that this fixes your issue.
Posts: 26
Installed this module this morning and gave it a quick run. Originally had the same issue as internetgardener, but grabbed the latest snap and updated the beta rather than hack the version required in the module.
Pospues, great work! Download of the registry file was flawless, and the upload worked perfectly. Very nice piece of integration work.
On a side note to the devs: great work also on the updater! I went from the Dark Fibre beta release to the current CVS snap, and the update process was faultless. Very slick work from all involved.
Cheers,
Rich
Posts: 5
That worked GREAT! Thanks for the fix.
Now I am just trying to figure out what I need to do on the registry side of things. Gallery 1 had a nice little publish_xp.php that when downloaded gave the proper registry entry.
Thoughts?
Curt
Posts: 16
Everything works fine for me untill i go to view the albums i have uploaded. There is nothing there. www.therehmsonline.net is the site. Anyone else having this problem?
Posts: 31
internetgardener
If you activate the module, you just have to go to Add Items for any of your albums and select Windows XP using the tab at the top. From that page you can download the registry file.
Posts: 5
Thanks Pospues - again, worked great.
i am now running into same issues as arehm. Images don't show up once uploaded. Still trying to diagnose the problem.
IG.
Posts: 16
pospues, your account is active....still have the same problem. As soon as i get xp publisher i'm going to get my sister with her nikkon D70 to test it out... see how my site handles huge pix
Posts: 20
I get a "Internet Explorer Script Error" when I try to uppload, it come's up when the upload is about to start.
ROW: 50
Char: 31
URL : mail.php
Posts: 16
i uploaded a picture 100_5710.JPG
here's all i see when i search for 5710 on my server
var/www/html/g2data/cache/entity/5/7/5710.inc
var/www/html/g2data/cache/derivative/5/7/5710.dat
var/www/html/g2data/cache/derivative/5/7/5710-meta.inc
var/www/html/g2data/locks/5/7/5710
the picture does not exist on my site....