Skip to content

Commit

Permalink
2004-05-11 Pierre-Luc Paour <gallery@paour.com> (1.4-b10)
Browse files Browse the repository at this point in the history
	* Fixed upload (and slideshow) applets when Gallery is embedded in a CMS.
	* Applets now attempt to use the same language as the Gallery (GR language
	  support is sorely lacking at the moment).
	* Cleaned up UI of upload applet, added config parameters for showing
	  Resize before upload and divider location.
  • Loading branch information
Pierre-Luc Paour committed May 11, 2004
1 parent 5c83f9a commit d7f6190
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 276 deletions.
12 changes: 10 additions & 2 deletions ChangeLog
@@ -1,6 +1,14 @@
2004-05-11 Pierre-Luc Paour <gallery@paour.com> (1.4-b10)

* Fixed upload (and slideshow) applets when Gallery is embedded in a CMS.
* Applets now attempt to use the same language as the Gallery (GR language
support is sorely lacking at the moment).
* Cleaned up UI of upload applet, added config parameters for showing
Resize before upload and divider location.

2004-05-07 Pierre-Luc Paour <gallery@paour.com> (1.4-b9)

* Fixed a slowdown when moving pas many pictures in slideshow.
* Fixed a slowdown when moving past many pictures in slideshow.

2004-05-07 Pierre-Luc Paour <gallery@paour.com> (1.4-b8)

Expand Down Expand Up @@ -44,7 +52,7 @@

2004-04-20 Pierre-Luc Paour <gallery@paour.com> (1.4-b4)

* Added German translation, courtesy of Hubert Baumgartner.
* Added German translation, by Hubert Baumgartner (extremely incomplete).

2004-04-20 Pierre-Luc Paour <gallery@paour.com> (1.4-b3)

Expand Down
45 changes: 37 additions & 8 deletions com/gallery/GalleryRemote/GRApplet.java
Expand Up @@ -88,21 +88,24 @@ protected AppletInfo getGRAppletInfo() {
AppletInfo info = new AppletInfo();

info.gallery = new Gallery(GalleryRemote._().getCore().getMainStatusUpdate());
info.gallery.setBlockWrites(true);

String url = getParameter("gr_url");
String urlFull = getParameter("gr_url_full");
String cookieName = getParameter("gr_cookie_name");
String cookieValue = getParameter("gr_cookie_value");
String cookieDomain = getParameter("gr_cookie_domain");
String cookiePath = getParameter("gr_cookie_path");

info.albumName = getParameter("gr_album");

Log.log(Log.LEVEL_TRACE, MODULE, "Applet parameters: ");
Log.log(Log.LEVEL_TRACE, MODULE, "gr_url: " + url);
Log.log(Log.LEVEL_TRACE, MODULE, "gr_cookie_name: " + cookieName);
Log.log(Log.LEVEL_TRACE, MODULE, "gr_cookie_domain: " + cookieDomain);
Log.log(Log.LEVEL_TRACE, MODULE, "gr_cookie_path: " + cookiePath);
Log.log(Log.LEVEL_TRACE, MODULE, "gr_album: " + info.albumName);
Log.log(Log.LEVEL_INFO, MODULE, "Applet parameters:");
Log.log(Log.LEVEL_INFO, MODULE, "gr_url:" + url);
Log.log(Log.LEVEL_INFO, MODULE, "gr_url_full:" + urlFull);
Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_name:" + cookieName);
Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_domain:" + cookieDomain);
Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_path:" + cookiePath);
Log.log(Log.LEVEL_INFO, MODULE, "gr_album:" + info.albumName);

if (cookieDomain == null || cookieDomain.length() < 1) {
try {
Expand All @@ -118,14 +121,40 @@ protected AppletInfo getGRAppletInfo() {
try {
url = new URL(documentBase.getProtocol(), documentBase.getHost(), documentBase.getPort(),
url).toString();

if (urlFull != null) {
}
} catch (MalformedURLException e1) {
Log.logException(Log.LEVEL_ERROR, MODULE, e1);
}
}
}

info.gallery.setType(Gallery.TYPE_STANDALONE);
info.gallery.setStUrlString(url);
if (urlFull != null) {
try {
URL documentBase = getDocumentBase();
String path = documentBase.getPath();
int i = path.lastIndexOf("/");
if (i != -1) {
path = path.substring(0, i);
}
urlFull = new URL(documentBase.getProtocol(), documentBase.getHost(), documentBase.getPort(),
path + "/" + urlFull).toString();
info.gallery.setType(Gallery.TYPE_APPLET);
info.gallery.setApUrlString(urlFull);
Log.log(Log.LEVEL_TRACE, MODULE, "Full URL: " + urlFull);
} catch (MalformedURLException e) {
Log.logException(Log.LEVEL_ERROR, MODULE, e);
urlFull = null;
}
}

if (urlFull == null) {
// old versions of Gallery, or bad urlFull
info.gallery.setType(Gallery.TYPE_STANDALONE);
info.gallery.setStUrlString(url);
}

info.gallery.cookieLogin = true;

CookieModule.addCookie(new Cookie(cookieName, cookieValue, cookieDomain, cookiePath, null, false));
Expand Down
46 changes: 29 additions & 17 deletions com/gallery/GalleryRemote/GRAppletMini.java
Expand Up @@ -44,11 +44,12 @@ public class GRAppletMini extends GRApplet implements GalleryRemoteCore, ActionL
StatusBar jStatusBar;
JScrollPane jScrollPane;
DroppableList jPicturesList;
JPanel jContentPanel;
//JPanel jContentPanel;
JCheckBox jResize;
JPanel jInspector;
JLabel captionLabel;
JTextArea jCaption;
JSplitPane jDivider;

DefaultComboBoxModel galleries = null;
Album album = null;
Expand Down Expand Up @@ -104,6 +105,7 @@ public void startup() {

public void shutdown() {
if (hasStarted) {
GalleryRemote._().properties.setIntProperty(APPLET_DIVIDER_LOCATION, jDivider.getDividerLocation());
GalleryRemote._().properties.write();
GalleryRemote.shutdownInstance();
}
Expand Down Expand Up @@ -174,11 +176,12 @@ protected void jbInit() {
jStatusBar = new StatusBar(75);
jScrollPane = new JScrollPane();
jPicturesList = new DroppableList();
jContentPanel = new JPanel(new GridBagLayout());
//jContentPanel = new JPanel(new GridBagLayout());
jResize = new JCheckBox();
jInspector = new JPanel(new GridBagLayout());
captionLabel = new JLabel();
jCaption = new JTextArea();
jDivider = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

jScrollPane.setBorder(new TitledBorder(BorderFactory.createEmptyBorder(), GRI18n.getString(MODULE, "pictures")));

Expand All @@ -201,25 +204,34 @@ protected void jbInit() {
jCaption.setFont(UIManager.getFont("Label.font"));
jCaption.setBackground(UIManager.getColor("TextField.inactiveBackground"));

jContentPanel.add(jScrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
jContentPanel.add(jResize, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0));
jContentPanel.add(jInspector, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));

jInspector.add(captionLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jInspector.add(jCaption, new GridBagConstraints(0, 1, 1, 1, 0.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
jDivider.setBorder(null);
jDivider.setOneTouchExpandable(true);
//jDivider.setResizeWeight(.75);
jDivider.setDividerLocation(GalleryRemote._().properties.getIntProperty(APPLET_DIVIDER_LOCATION));

jScrollPane.setMinimumSize(new Dimension(100, 0));
jInspector.setMinimumSize(new Dimension(0, 0));
jDivider.setLeftComponent(jScrollPane);
jDivider.setRightComponent(jInspector);
// jContentPanel.add(jScrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
// ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
// jContentPanel.add(jInspector, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0
// ,GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));

jInspector.add(captionLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0));
jInspector.add(jCaption, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));

this.getContentPane().setLayout(new GridBagLayout());
this.getContentPane().add(jButtonPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
this.getContentPane().add(jDivider, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
this.getContentPane().add(jResize, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0));
this.getContentPane().add(jButtonPanel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
this.getContentPane().add(jStatusBar, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0
this.getContentPane().add(jStatusBar, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.getContentPane().add(jContentPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));

jAdd.addActionListener(this);
jUpload.addActionListener(this);
Expand Down
2 changes: 1 addition & 1 deletion com/gallery/GalleryRemote/GalleryComm2.java
Expand Up @@ -308,7 +308,7 @@ private boolean login() {
Object[] params = {g.toString()};
status(su, StatusUpdate.LEVEL_GENERIC, GRI18n.getString(MODULE, "logIn", params));

if (g.getType() != Gallery.TYPE_STANDALONE) {
if (g.getType() != Gallery.TYPE_STANDALONE && g.getType() != Gallery.TYPE_APPLET) {
try {
requestResponse(null, null, g.getLoginUrl(scriptName), false, su);
} catch (IOException ioe) {
Expand Down
4 changes: 3 additions & 1 deletion com/gallery/GalleryRemote/UploadProgress.java
Expand Up @@ -210,7 +210,9 @@ public void actionPerformed(ActionEvent e) {
final ActionEvent fe = e;
new Thread() {
public void run() {
cancelListener.actionPerformed(fe);
if (cancelListener != null) {
cancelListener.actionPerformed(fe);
}
}
}.start();
}
Expand Down
22 changes: 20 additions & 2 deletions com/gallery/GalleryRemote/model/Gallery.java
Expand Up @@ -79,6 +79,8 @@ public class Gallery extends DefaultTreeModel implements Serializable, Preferenc
public static final int TYPE_PHPNUKE = 2;
public static final int TYPE_GEEKLOG = 3;

public static final int TYPE_APPLET = 99;

public static final int TOSTRING_MAXLEN = 40;

public Gallery(StatusUpdate su) {
Expand Down Expand Up @@ -564,6 +566,12 @@ public String getGlLoginUrlString() {
}
}

/* Applet URL */

public void setApUrlString(String urlString) {
stUrlString = urlString;
}

/* Generic */

public URL getLoginUrl(String galleryFile) {
Expand All @@ -581,6 +589,9 @@ public URL getLoginUrl(String galleryFile) {
case TYPE_GEEKLOG:
return new URL(replace(glLoginUrlString, galleryFile));

case TYPE_APPLET:
return new URL(stUrlString);

default:
throw new RuntimeException("Unknown type: " + type);
}
Expand Down Expand Up @@ -608,13 +619,16 @@ public URL getGalleryUrl(String galleryFile) {
case TYPE_GEEKLOG:
return new URL(replace(glGalleryUrlString, galleryFile));

case TYPE_APPLET:
return new URL(stUrlString);

default:
throw new RuntimeException("Unknown type: " + type);
}
} catch (MalformedURLException e) {
Log.log(Log.LEVEL_ERROR, MODULE, "Malformed URL.");
Log.logException(Log.LEVEL_ERROR, MODULE, e);
JOptionPane.showMessageDialog((JFrame) su, "Malformed URL (" + e.getMessage() + ")",
JOptionPane.showMessageDialog((Component) su, "Malformed URL (" + e.getMessage() + ")",
"Error", JOptionPane.ERROR_MESSAGE);
return null;
}
Expand Down Expand Up @@ -851,6 +865,10 @@ public String toString(boolean disambiguate) {
tmp = glGalleryUrlString;
break;

case TYPE_APPLET:
tmp = stUrlString;
break;

default:
throw new RuntimeException("Unknown type: " + type);
}
Expand Down Expand Up @@ -1049,7 +1067,7 @@ public Album getAlbumByName(String name) {
return null;
}

private void setBlockWrites(boolean blockWrites) {
public void setBlockWrites(boolean blockWrites) {
this.blockWrites = blockWrites;
}

Expand Down
5 changes: 5 additions & 0 deletions com/gallery/GalleryRemote/prefs/PreferenceNames.java
Expand Up @@ -40,6 +40,7 @@ public interface PreferenceNames {
public static final String POSTNUKE = "PostNuke";
public static final String PHPNUKE = "PHPNuke";
public static final String GEEKLOG = "GeekLog";
public static final String APPLET = "Applet";
public static final String PN_GALLERY_URL = "pnGalleryUrl.";
public static final String PN_LOGIN_URL = "pnLoginUrl.";
public static final String PHPN_GALLERY_URL = "phpnGalleryUrl.";
Expand Down Expand Up @@ -74,4 +75,8 @@ public interface PreferenceNames {
public static final String SUPPRESS_WARNING_JPEGTRAN = "suppressWarningJpegtran";
public static final String SUPPRESS_WARNING_JPEGTRAN_CROP = "suppressWarningJpegtranCrop";
public static final String SUPPRESS_WARNING_CORRUPTED = "suppressWarningCorrupted";

// Applet
public static final String APPLET_SHOW_RESIZE = "appletShowResize";
public static final String APPLET_DIVIDER_LOCATION = "appletDividerLocation";
}

0 comments on commit d7f6190

Please sign in to comment.