1
0

Added a build version

This commit is contained in:
Ben Smith 2010-04-18 10:42:58 +12:00 committed by Bharat Mediratta
parent 35d70d4b1d
commit 842fd2c66f
151 changed files with 22650 additions and 222 deletions

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/gwtorganise/build.xml"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="gwtorganise"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/gwtorganise/build.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/gwtorganise}"/>
</launchConfiguration>

View File

@ -30,6 +30,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/New_Builder.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>

View File

@ -1,4 +1,4 @@
#Thu Feb 11 15:27:06 NZDT 2010
#Fri Mar 26 11:43:34 NZDT 2010
eclipse.preferences.version=1
entryPointModules=
filesCopiedToWebInfLib=gwt-servlet.jar

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generate a java class with the current svn revision number -->
<project>
<echo>Generate build info class...</echo>
<tstamp>
<format property="TODAY" pattern="EEE, d-MMMM-yyyy HH:mm:ss z" locale="ENGLISH, GERMANY"/>
</tstamp>
<echo>Virtual PVT Cell Revision: ${svn.revision}</echo>
<echo>Time stamp ${TODAY}</echo>
<echo>Write build info to file ${basedir}\helpers\BuildInfo.java</echo>
<!-- the source code of the java class -->
<echo file="${basedir}\helpers\revision.php">
&#60;?php defined("SYSPATH") or die("No direct script access.");
class revision_Core {
static function getTimeStamp(){
return "${TODAY}";
}
}
</echo>
</project>

View File

@ -73,13 +73,21 @@ class Json_Album_Controller extends Controller {
access::verify_csrf();
$target_album = ORM::factory("item", $target_album_id);
access::required("view", $target_album);
access::required("add", $target_album);
$source_album = null;
$js = json_decode($_REQUEST["sourceids"]);
$i = 0;
$source_album = null;
foreach ($js as $source_id) {
$source = ORM::factory("item", $source_id);
if (empty($source_album)) { // get the source_album
$source_album = $source->parent();
}
if (!$source->contains($target_album)) {
access::required("edit", $source);
item::move($source, $target_album);
}
$i++;
@ -226,12 +234,7 @@ class Json_Album_Controller extends Controller {
print json_encode(array("result" => "success"));
}
public function rotate($id, $dir) {
access::verify_csrf();
$item = model_cache::get("item", $id);
access::required("view", $item);
access::required("edit", $item);
public function p_rotate($item, $dir){
$degrees = 0;
switch($dir) {
case "ccw":
@ -262,6 +265,63 @@ class Json_Album_Controller extends Controller {
}
}
return $item;
}
public function delete_many($id) {
access::verify_csrf();
$js = json_decode($_REQUEST["sourceids"]);
$i = 0;
$toreturn = array();
foreach ($js as $item_id) {
$item = ORM::factory("item", $item_id);
access::required("view", $item);
access::required("edit", $item);
if ($item->is_album()) {
$msg = t("Deleted album <b>%title</b>", array("title" => html::purify($item->title)));
} else {
$msg = t("Deleted photo <b>%title</b>", array("title" => html::purify($item->title)));
}
$parent = $item->parent();
$item->delete();
message::success($msg);
}
print json_encode(array("result" => "success"));
}
public function rotate_many($dir) {
access::verify_csrf();
$js = json_decode($_REQUEST["sourceids"]);
$i = 0;
$toreturn = array();
foreach ($js as $item_id) {
$item = ORM::factory("item", $item_id);
access::required("view", $item);
access::required("edit", $item);
$item = $this->p_rotate($item, $dir);
$toreturn[$item_id] = self::child_json_encode($item);
$i++;
}
print json_encode($toreturn);
}
public function rotate($id, $dir) {
access::verify_csrf();
$item = model_cache::get("item", $id);
access::required("view", $item);
access::required("edit", $item);
$item = $this->p_rotate($item, $dir);
print json_encode(self::child_json_encode($item));
}

View File

@ -0,0 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.");
class revision_Core {
static function getTimeStamp(){
return "Fri, 16-April-2010 14:55:28 NZST";
}
}

View File

@ -27,6 +27,7 @@ import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
/**
* encapsulates an album
@ -189,7 +190,6 @@ public class Album extends TreeItem {
popupMenuBar.addItem(addAlbum);
popupMenuBar.addItem(userPermissions);
popupMenuBar.setVisible(true);
popupPanel.add(popupMenuBar);

View File

@ -28,19 +28,7 @@ public class AlbumItemDropContainer implements DropController{
@Override
public void onDrop(DragContext context) {
JSONArray jsa = new JSONArray();
int i = 0;
for (Widget widget : context.selectedWidgets){
if (widget instanceof Item){
jsa.set(i, new JSONNumber(((Item)widget).getID()));
i++;
}
}
m_Album.moveTo(jsa);
// context.
// TODO Auto-generated method stub
m_Album.moveTo(Utils.extractIds(context));
}
@Override

View File

@ -0,0 +1,73 @@
package com.gloopics.g3viewer.client;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
public class ConfirmDialogBox extends DialogBox {
public ConfirmCallBack m_Callback;
private final HTML m_Dialog;
public interface ConfirmCallBack{
void ok();
}
public ConfirmDialogBox(G3Viewer a_Parent){
m_Dialog = new HTML("Empty");
initComponents();
}
public void initComponents(){
setModal(true);
addStyleName("dialog");
setAnimationEnabled(true);
setText("Confirm");
Button close = new Button("Cancel", new ClickHandler() {
public void onClick(ClickEvent event) {
ConfirmDialogBox.this.hide();
}
});
Button ok = new Button("ok", new ClickHandler() {
public void onClick(ClickEvent event) {
if (m_Callback!=null)
{
m_Callback.ok();
}
ConfirmDialogBox.this.hide();
}
});
FlowPanel fp = new FlowPanel();
fp.add(ok);
fp.add(close);
fp.addStyleName("dButtons");
DockPanel dp = new DockPanel();
dp.add(m_Dialog , DockPanel.CENTER);
dp.add(fp, DockPanel.SOUTH);
dp.addStyleName("dContents");
add(dp);
}
public void doDialog(String a_Message, ConfirmCallBack a_Callback){
m_Callback = a_Callback;
m_Dialog.setHTML(a_Message);
show();
}
}

View File

@ -17,6 +17,8 @@ package com.gloopics.g3viewer.client;
import com.allen_sauer.gwt.dnd.client.PickupDragController;
import com.gloopics.g3viewer.client.ConfirmDialogBox.ConfirmCallBack;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.dom.client.Style.Unit;
@ -133,11 +135,22 @@ public class G3Viewer {
*/
public static final String ROTATE_URL = BASE_URL + "index.php/json_album/rotate/";
/**
* rotate url
*/
public static final String ROTATE_ALL_URL = BASE_URL + "index.php/json_album/rotate_many/";
/**
* Resize details URL
*/
public static final String RESIZE_DETAILS_URL = BASE_URL + "index.php/json_album/resize_config";
/**
* Resize details URL
*/
public static final String DELETE_ALL_URL = BASE_URL + "index.php/json_album/delete_many/";
/*
* tree
*/
@ -158,6 +171,11 @@ public class G3Viewer {
*/
private final HttpDialogBox m_HttpDialogBox= new HttpDialogBox(this);
/**
* the only confirmation dialog box
*/
private final ConfirmDialogBox m_ConfirmDialogBox = new ConfirmDialogBox(this);
private class SimplePanelEx extends SimplePanel
{
public SimplePanelEx()
@ -223,7 +241,7 @@ public class G3Viewer {
/**
* the drag controller
*/
private final PickupDragController m_DragController;
private final MyPickupDragController m_DragController;
/**
* the upload control
@ -235,7 +253,7 @@ public class G3Viewer {
*/
public G3Viewer(){
m_DragController = new PickupDragController(RootPanel.get(),false);
m_DragController = new MyPickupDragController(RootPanel.get(),false);
m_DragController.setBehaviorMultipleSelection(true);
m_DragController.setBehaviorDragStartSensitivity(5);
m_DragController.setBehaviorDragProxy(true);
@ -307,7 +325,7 @@ public class G3Viewer {
/**
* returns the drag controller
*/
public PickupDragController getDragController(){
public MyPickupDragController getDragController(){
return m_DragController;
}
@ -328,6 +346,11 @@ public class G3Viewer {
m_HttpDialogBox.doDialog(BASE_URL + a_Url, a_Handler);
}
public void doConfirm(String a_Text, ConfirmCallBack a_Handler)
{
m_ConfirmDialogBox.doDialog(a_Text, a_Handler);
}
public void showImage(String a_Url)
{
m_ImageDialogBox.doDialog( a_Url);

View File

@ -20,48 +20,42 @@ import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
public class HttpDialogBox extends DialogBox{
public class HttpDialogBox extends DialogBox {
private FormPanel m_FormPanel = null;
private HttpDialogHandler m_Callback;
private final HTML m_Dialog;
private final G3Viewer m_Parent;
public HttpDialogBox(G3Viewer a_Parent){
private final G3Viewer m_Parent;
public HttpDialogBox(G3Viewer a_Parent) {
m_Parent = a_Parent;
m_Dialog = new HTML("Empty");
initComponents();
}
public void initComponents(){
public void initComponents() {
setModal(true);
addStyleName("dialog");
setAnimationEnabled(true);
setText("Dialog");
Button close = new Button("Cancel", new ClickHandler() {
public void onClick(ClickEvent event) {
HttpDialogBox.this.hide();
Loading.getInstance().endLoading();
}
});
Button ok = new Button("ok", new ClickHandler() {
public void onClick(ClickEvent event) {
if (m_FormPanel!=null)
{
submitForm();
}
HttpDialogBox.this.hide();
Loading.getInstance().loading("Please Wait..");
submitForm();
}
});
@ -70,209 +64,224 @@ public class HttpDialogBox extends DialogBox{
fp.add(close);
fp.addStyleName("dButtons");
DockPanel dp = new DockPanel();
dp.add(m_Dialog , DockPanel.CENTER);
dp.add(m_Dialog, DockPanel.CENTER);
dp.add(fp, DockPanel.SOUTH);
dp.addStyleName("dContents");
add(dp);
}
private class RequestCallbackImpl implements RequestCallback {
private static final int STATUS_CODE_OK = 200;
private final String m_URL;
public RequestCallbackImpl(String a_URL){
m_URL = a_URL;
}
private static final int STATUS_CODE_OK = 200;
public void onError(Request request, Throwable exception) {
showDialog("Could not get " + m_URL + " Exception thrown " + exception.toString());
}
private final String m_URL;
public void onResponseReceived(Request request, Response response) {
if (STATUS_CODE_OK == response.getStatusCode()) {
showDialog(response.getText());
} else {
showDialog(m_URL + response.getText());
}
}
public RequestCallbackImpl(String a_URL) {
m_URL = a_URL;
}
public void onError(Request request, Throwable exception) {
showDialog("Could not get " + m_URL + " Exception thrown "
+ exception.toString());
}
public void onResponseReceived(Request request, Response response) {
if (STATUS_CODE_OK == response.getStatusCode()) {
showDialog(response.getText());
} else {
showDialog(m_URL + response.getText());
}
}
}
public native static String createData(Element form) /*-{
var fieldValue = function(el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (typeof successful == 'undefined') successful = true;
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (typeof successful == 'undefined') successful = true;
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1))
return null;
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1))
return null;
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) return null;
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) return null;
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
var v = op.value;
if (!v) // extra pain for IE...
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
if (one) return v;
a.push(v);
}
}
return a;
}
return el.value;
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
if (one) return v;
a.push(v);
}
}
return a;
}
return el.value;
};
var a = "";
var added = false;
var appendA = function(str)
{
if(added)
{
a = a+"&"+str;
a = a+"&"+str;
}
else
{
a = a+str;
added = true;
{
a = a+str;
added = true;
}
}
var els = form.getElementsByTagName('*'); //: form.elements;
if (!els) return a;
for(var i=0, max=els.length; i < max; i++) {
var el = els[i];
var n = el.name;
if (!n) continue;
var v = fieldValue(el, true);
if (v && v.constructor == Array) {
for(var j=0, jmax=v.length; j < jmax; j++)
appendA(n+"="+escape(v[j]));
}
else if (v !== null && typeof v != 'undefined')
appendA(n+"="+escape(v));
}
var els = form.getElementsByTagName('*'); //: form.elements;
if (!els) return a;
for(var i=0, max=els.length; i < max; i++) {
var el = els[i];
var n = el.name;
if (!n) continue;
return a;
}-*/;
var v = fieldValue(el, true);
if (v && v.constructor == Array) {
for(var j=0, jmax=v.length; j < jmax; j++)
appendA(n+"="+escape(v[j]));
}
else if (v !== null && typeof v != 'undefined')
appendA(n+"="+escape(v));
}
return a;
}-*/;
private void submitForm() {
if (m_FormPanel != null) {
String url = m_FormPanel.getAction();
String data = createData(m_FormPanel.getElement());
m_Parent.doJSONRequest(url, new HttpSuccessHandler() {
@Override
public void success(JSONValue aValue) {
JSONObject object = aValue.isObject();
if (object != null) {
JSONValue result = object.get("result");
if (result != null) {
if (result.isString().stringValue().equals(
"success")) {
m_Callback.success(aValue.toString());
Loading.getInstance().endLoading();
} else {
JSONValue resul = object.get("form");
showDialog(resul.isString().stringValue());
}
} else {
G3Viewer.displayError("result was null ", aValue
.toString());
}
} else {
G3Viewer.displayError("Only JSON Value Returned ",
aValue.toString());
}
}
}, false, false, data);
}
HttpDialogBox.this.hide();
Loading.getInstance().loading("Please Wait..");
private void submitForm(){
String url = m_FormPanel.getAction();
String data = createData(m_FormPanel.getElement());
m_Parent.doJSONRequest(url, new HttpSuccessHandler() {
@Override
public void success(JSONValue aValue) {
JSONObject object = aValue.isObject();
if (object != null){
JSONValue result = object.get("result");
if (result != null)
{
if (result.isString().stringValue().equals("success")){
m_Callback.success(aValue.toString());
Loading.getInstance().endLoading();
}
else{
JSONValue resul = object.get("form");
showDialog(resul.isString().stringValue());
}
}
else
{
G3Viewer.displayError("result was null ", aValue.toString() );
}
} else {
G3Viewer.displayError("Only JSON Value Returned ", aValue.toString() );
}
}
}, false ,false, data);
}
private void showDialog(String a_Text){
private void showDialog(String a_Text) {
m_Dialog.setHTML(a_Text);
// hide all submits
NodeList<Element> inputs = this.getElement().getElementsByTagName("input");
NodeList<Element> inputs = this.getElement().getElementsByTagName(
"input");
Element input;
for (int i = 0; i < inputs.getLength(); i++){
for (int i = 0; i < inputs.getLength(); i++) {
input = inputs.getItem(i);
if (input.getAttribute("type").equals("submit"))
{
if (input.getAttribute("type").equals("submit")) {
input.setAttribute("style", "display:none");
}
}
Loading.getInstance().hideAnimation();
show();
// find forms if it exists
NodeList<Element> forms = this.getElement().getElementsByTagName("form");
if (forms.getLength() > 0)
{
Element element = this.getElement().getElementsByTagName("form").getItem(0);
setText(element.getElementsByTagName("legend").getItem(0).getInnerText());
NodeList<Element> forms = this.getElement()
.getElementsByTagName("form");
if (forms.getLength() > 0) {
Element element = this.getElement().getElementsByTagName("form")
.getItem(0);
setText(element.getElementsByTagName("legend").getItem(0)
.getInnerText());
m_FormPanel = FormPanel.wrap(element, true);
}
else
{
setText(this.getElement().getElementsByTagName("legend").getItem(0).getInnerText());
m_FormPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
@Override
public void onSubmit(SubmitEvent event) {
event.cancel();
submitForm();
}
});
} else {
setText(this.getElement().getElementsByTagName("legend").getItem(0)
.getInnerText());
m_FormPanel = null;
}
setPopupPosition(Window.getClientWidth() / 2 - this.getOffsetWidth() / 2,
Window.getClientHeight() / 2 - this.getOffsetHeight() / 2);
Timer t = new Timer(){
public void run(){
// find any scripts if they exist
NodeList<Element> scripts = HttpDialogBox.this.getElement().getElementsByTagName("script");
for (int i = 0; i < scripts.getLength(); i++ )
{
Element script = scripts.getItem(i);
script.removeFromParent();
Element nscript = DOM.createElement("script");
nscript.setAttribute("type", script.getAttribute("type"));
nscript.setAttribute("src", script.getAttribute("src"));
getElementByTagName("head").appendChild(nscript);
}
setPopupPosition(Window.getClientWidth() / 2 - this.getOffsetWidth()
/ 2, Window.getClientHeight() / 2 - this.getOffsetHeight() / 2);
Timer t = new Timer() {
public void run() {
// find any scripts if they exist
NodeList<Element> scripts = HttpDialogBox.this.getElement()
.getElementsByTagName("script");
for (int i = 0; i < scripts.getLength(); i++) {
Element script = scripts.getItem(i);
// script.removeFromParent();
Element nscript = DOM.createElement("script");
nscript.setAttribute("type", script.getAttribute("type"));
nscript.setAttribute("src", script.getAttribute("src"));
getElementByTagName("head").appendChild(nscript);
}
}
};
t.schedule(10);
}
/**
* Gets an element by its tag name; handy for single elements like HTML,
* HEAD, BODY.
* @param tagName The name of the tag.
*
* @param tagName
* The name of the tag.
* @return The element with that tag name.
*/
public native static Element getElementByTagName(String tagName) /*-{
var elem = $doc.getElementsByTagName(tagName);
return elem ? elem[0] : null;
}-*/;
public void doDialog(String url, HttpDialogHandler a_Callback){
var elem = $doc.getElementsByTagName(tagName);
return elem ? elem[0] : null;
}-*/;
public void doDialog(String url, HttpDialogHandler a_Callback) {
m_Callback = a_Callback;
Loading.getInstance().loading("Please Wait");
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
@ -280,9 +289,9 @@ public class HttpDialogBox extends DialogBox{
try {
builder.sendRequest(null, new RequestCallbackImpl(url));
} catch (RequestException e) {
showDialog("Could not call " + url + " Exception thrown " + e.toString());
showDialog("Could not call " + url + " Exception thrown "
+ e.toString());
}
}
}

View File

@ -1,6 +1,7 @@
package com.gloopics.g3viewer.client;
import java.util.Iterator;
import java.util.List;
import com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile;
import com.gloopics.g3viewer.client.dnddesktop.DesktopDroppableWidget;
@ -27,6 +28,7 @@ import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.gears.client.desktop.File;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
@ -161,7 +163,7 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
}
}
private void updateImages(JSONValue a_Value){
public void updateImages(JSONValue a_Value){
JSONObject jso = a_Value.isObject();
if (jso != null) {
@ -189,19 +191,20 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
m_LinkedAlbum = a_Album;
}
public void removeLinkedAlbum()
{
if (m_LinkedAlbum != null){
m_LinkedAlbum.remove();
}
}
public void showPopupMenu(ContextMenuEvent event){
Iterator<Widget> iter = m_Container.getDragController().getSelectedWidgets().iterator();
// show views popup menu if items are selected
if (iter.hasNext())
if (m_Container.getDragController().getSelectedWidgetcount() > 1)
{
iter.next();
if (iter.hasNext())
{
m_View.showPopupMenu(event);
return;
}
m_View.showPopupMenu(event);
return;
}
this.addStyleName("popped");
@ -267,7 +270,7 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
MenuItem rotateCW = new MenuItem("Rotate Clockwise", true, new Command() {
@Override
public void execute() {
m_ThumbImage.setUrl(Loading.URL);
setLoadingThumb();
m_Container.doJSONRequest(G3Viewer.ROTATE_URL + m_ID + "/cw", new HttpSuccessHandler() {
public void success(JSONValue aValue) {
@ -283,7 +286,7 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
MenuItem rotateCCW = new MenuItem("Rotate Couter-Clockwise", true, new Command() {
@Override
public void execute() {
m_ThumbImage.setUrl(Loading.URL);
setLoadingThumb();
m_Container.doJSONRequest(G3Viewer.ROTATE_URL + m_ID + "/ccw", new HttpSuccessHandler() {
public void success(JSONValue aValue) {
@ -297,6 +300,7 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
popupMenuBar.addItem(rotateCCW);
}
popupMenuBar.setVisible(true);
@ -317,6 +321,10 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
popupPanel.show();
}
public void setLoadingThumb()
{
m_ThumbImage.setUrl(Loading.URL);
}
public boolean isAlbum(){
return m_IsAlbum;

View File

@ -0,0 +1,31 @@
package com.gloopics.g3viewer.client;
import java.util.List;
import com.allen_sauer.gwt.dnd.client.DragContext;
import com.allen_sauer.gwt.dnd.client.PickupDragController;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Widget;
public class MyPickupDragController extends PickupDragController{
public MyPickupDragController(AbsolutePanel boundaryPanel, boolean allowDroppingOnBoundaryPanel) {
super(boundaryPanel, allowDroppingOnBoundaryPanel);
}
public DragContext getDragContext()
{
return context;
}
public List<Widget> getSelectedWidgets()
{
return context.selectedWidgets;
}
public int getSelectedWidgetcount()
{
return context.selectedWidgets.size();
}
}

View File

@ -126,6 +126,7 @@ public class UploadFile extends Composite{
{
m_Label.setText("Upload Error");
addStyleName("upload-error");
G3Viewer.displayError("Error Uploading", request.getResponseText());
}
removeCapture(RS, m_Name);

View File

@ -1,7 +1,10 @@
package com.gloopics.g3viewer.client;
import com.allen_sauer.gwt.dnd.client.DragContext;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.ui.Widget;
public class Utils {
public static int extractId(JSONValue a_Value){
@ -14,5 +17,18 @@ public class Utils {
return Integer.parseInt(val);
}
}
public static JSONArray extractIds(DragContext context) {
JSONArray jsa = new JSONArray();
int i = 0;
for (Widget widget : context.selectedWidgets){
if (widget instanceof Item){
jsa.set(i, new JSONNumber(((Item)widget).getID()));
i++;
}
}
return jsa;
}
}

View File

@ -13,10 +13,13 @@ import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.gears.client.desktop.File;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.MenuBar;
@ -140,17 +143,26 @@ public class View extends FlowPanel implements DesktopDroppableWidget{
@Override
public void execute() {
/*
m_Container.doDialog("index.php/quick/form_delete/" + m_ID, new HttpDialogHandler() {
public void success(String aResult) {
m_View.removeFromView(Item.this);
if (m_LinkedAlbum != null){
m_LinkedAlbum.remove();
}
popupPanel.hide();
m_Container.doConfirm("Are you sure you wish to delete selected items?", new ConfirmDialogBox.ConfirmCallBack() {
public void ok() {
JSONArray jsa = Utils.extractIds(m_Container.getDragController().getDragContext());
m_Container.doJSONRequest(G3Viewer.DELETE_ALL_URL + "?sourceids=" + jsa.toString() , new HttpSuccessHandler() {
public void success(JSONValue aValue) {
final List<Widget> widgets = m_Container.getDragController().getSelectedWidgets();
Item i;
for (Widget widget: widgets){
i = (Item)widget;
removeFromView(i);
i.removeLinkedAlbum();
}
}}, true, true);
}
});
*/
popupPanel.hide();
}
});
@ -160,6 +172,62 @@ public class View extends FlowPanel implements DesktopDroppableWidget{
popupMenuBar.setVisible(true);
popupPanel.add(popupMenuBar);
MenuItem rotateAllCW = new MenuItem("Rotate All Clockwise", true, new Command() {
@Override
public void execute() {
// change all thumbs into loading
final List<Widget> widgets = m_Container.getDragController().getSelectedWidgets();
for (Widget widget: widgets){
final Item i = ((Item)widget);
if (i.isPhoto())
{
i.setLoadingThumb();
}
m_Container.doJSONRequest(G3Viewer.ROTATE_URL + i.getID() + "/cw",
new HttpSuccessHandler() {
public void success(JSONValue aValue) {
i.updateImages(aValue);
}
},false,true);
}
popupPanel.hide();
}
});
rotateAllCW.addStyleName("popup-item");
popupMenuBar.addItem(rotateAllCW);
MenuItem rotateAllCCW = new MenuItem("Rotate All Counter-Clockwise", true, new Command() {
@Override
public void execute() {
// change all thumbs into loading
final List<Widget> widgets = m_Container.getDragController().getSelectedWidgets();
for (Widget widget: widgets){
final Item i = ((Item)widget);
if (i.isPhoto())
{
i.setLoadingThumb();
}
m_Container.doJSONRequest(G3Viewer.ROTATE_URL + i.getID() + "/cw",
new HttpSuccessHandler() {
public void success(JSONValue aValue) {
i.updateImages(aValue);
}
},false,true);
}
popupPanel.hide();
}
});
rotateAllCW.addStyleName("popup-item");
popupMenuBar.addItem(rotateAllCCW);
int x = DOM.eventGetClientX((Event)event.getNativeEvent());
int y = DOM.eventGetClientY((Event)event.getNativeEvent());
popupPanel.setPopupPosition(x, y);
@ -167,6 +235,4 @@ public class View extends FlowPanel implements DesktopDroppableWidget{
popupPanel.show();
}
}

View File

@ -4,3 +4,4 @@
?>
<iframe src="<?=$url?>" style="width:100%; height:500px; border:8px solid #d2e1f6; margin:0; padding:0;">
</iframe>
GWT Organise version built on <?= revision::getTimeStamp()?>

Some files were not shown because too many files have changed in this diff Show More