Compare commits

..

No commits in common. "master" and "maint/jjg" have entirely different histories.

478 changed files with 67177 additions and 3570 deletions

80
pom.xml
View File

@ -7,8 +7,9 @@
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
<org.springframework.version>3.1.0.RELEASE</org.springframework.version> <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<jettyVersion>7.2.0.v20101020</jettyVersion> <!--<jettyVersion>7.2.0.v20101020</jettyVersion>-->
<jettyVersion>8.1.0.RC4</jettyVersion>
<org.slf4j.version>1.6.4</org.slf4j.version> <org.slf4j.version>1.6.4</org.slf4j.version>
</properties> </properties>
@ -19,7 +20,6 @@
<url>https://repository.jboss.org/nexus/content/repositories/releases</url> <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
<snapshots><enabled>false</enabled></snapshots> <snapshots><enabled>false</enabled></snapshots>
</repository> </repository>
<repository> <repository>
<id>org.eclipse.repository.development</id> <id>org.eclipse.repository.development</id>
<name>Jetty Repo</name> <name>Jetty Repo</name>
@ -47,12 +47,6 @@
<version>${org.springframework.version}</version> <version>${org.springframework.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
@ -80,44 +74,17 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>javax.validation</groupId>
<artifactId>spring-orm</artifactId> <artifactId>validation-api</artifactId>
<version>${org.springframework.version}</version> <version>1.0.0.GA</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId> <artifactId>hibernate-validator</artifactId>
<version>3.6.7.Final</version> <version>4.1.0.Final</version>
</dependency> </dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.160</version>
</dependency>
<dependency> <dependency>
<groupId>joda-time</groupId> <groupId>joda-time</groupId>
<artifactId>joda-time</artifactId> <artifactId>joda-time</artifactId>
@ -150,26 +117,40 @@
<version>1.2</version> <version>1.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>0.7.2</version>
<scope>compile</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.inject</groupId>-->
<!--<artifactId>javax.inject</artifactId>-->
<!--<version>1</version>-->
<!--<scope>compile</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.9</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.10</version> <version>4.10</version>
</dependency> </dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId> <artifactId>jetty-server</artifactId>
<version>${jettyVersion}</version> <version>${jettyVersion}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
@ -181,7 +162,6 @@
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
</configuration> </configuration>
<version>2.3.2</version>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -31,11 +31,11 @@ public class ByteUtils {
this.data = data.clone(); this.data = data.clone();
} }
public static int byteToUint(byte b) { public static final int byteToUint(byte b) {
return (b < 0 ? BYTE_OVERFLOW + b : b); return (b < 0 ? BYTE_OVERFLOW + b : b);
} }
public static byte uintToByte(int i) { public static final byte uintToByte(int i) {
return (byte)(i & BYTE_MAX); return (byte)(i & BYTE_MAX);
} }

View File

@ -119,8 +119,8 @@ public class ArtDmxPacket extends ArtNetPacket {
/** /**
* Sets universe and subnet into data array. Needed because subnet and universe are both 4 bit and share one byte * Sets universe and subnet into data array. Needed because subnet and universe are both 4 bit and share one byte
* @param subnetID The ArtNet Subnet ID from 0 to 3 * @param subnetID
* @param universeID The ArtNet Universe ID from 0 to 3 * @param universeID
*/ */
private void setUniverse(int subnetID, int universeID) { private void setUniverse(int subnetID, int universeID) {
getData().setInt16LE(subnetID << HALF_BYTE | universeID, OFFSET_UNIVERSE); getData().setInt16LE(subnetID << HALF_BYTE | universeID, OFFSET_UNIVERSE);

View File

@ -1,7 +1,6 @@
package de.ctdo.bunti.control; package de.ctdo.bunti.control;
import de.ctdo.bunti.model.BuntiDevice; import de.ctdo.bunti.model.BuntiDevice;
import de.ctdo.bunti.model.Room;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -13,7 +12,4 @@ public interface BuntiController {
boolean updateDeviceData(int deviceId, Map<String, Object> options); boolean updateDeviceData(int deviceId, Map<String, Object> options);
Collection<Room> getAllRooms();
Room getRoomById(int roomId);
} }

View File

@ -3,7 +3,6 @@ package de.ctdo.bunti.control;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import de.ctdo.bunti.dao.RoomsDAO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -20,19 +19,12 @@ public class BuntiControllerImpl implements BuntiController, ApplicationEventPu
private static final Logger LOGGER = LoggerFactory.getLogger(BuntiControllerImpl.class); private static final Logger LOGGER = LoggerFactory.getLogger(BuntiControllerImpl.class);
private ApplicationEventPublisher applicationEventPublisher = null; private ApplicationEventPublisher applicationEventPublisher = null;
private BuntiDevicesDAO devicesDAO; private BuntiDevicesDAO devicesDAO;
private RoomsDAO roomsDAO;
@Autowired @Autowired
public final void setDevicesDAO(BuntiDevicesDAO devicesDAO) { public final void setDevicesDAO(BuntiDevicesDAO devicesDAO) {
this.devicesDAO = devicesDAO; this.devicesDAO = devicesDAO;
} }
@Autowired
public final void setRoomsDAO(RoomsDAO roomsDAO) {
this.roomsDAO = roomsDAO;
}
@Override @Override
public final void setApplicationEventPublisher(ApplicationEventPublisher publisher) { public final void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
this.applicationEventPublisher = publisher; this.applicationEventPublisher = publisher;
@ -44,26 +36,15 @@ public class BuntiControllerImpl implements BuntiController, ApplicationEventPu
BuntiDevice device = devicesDAO.getDeviceById(deviceId); BuntiDevice device = devicesDAO.getDeviceById(deviceId);
if (device != null) { if (device != null) {
LOGGER.debug("publishEvent in BuntiController");
this.applicationEventPublisher.publishEvent(new DeviceChangedEvent(this, device, options)); this.applicationEventPublisher.publishEvent(new DeviceChangedEvent(this, device, options));
LOGGER.debug("publishEvent in BuntiController");
return true; return true;
} }
return false; return false;
} }
@Override
public Collection<Room> getAllRooms() {
return roomsDAO.getRooms();
}
@Override
public Room getRoomById(int roomId) {
return roomsDAO.getRoom(roomId);
}
@Override @Override
public Collection<BuntiDevice> getAllDevices() { public Collection<BuntiDevice> getAllDevices() {
return devicesDAO.getAllDevices(); return devicesDAO.getAllDevices();

View File

@ -1,17 +1,14 @@
package de.ctdo.bunti.dao; package de.ctdo.bunti.dao;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import de.ctdo.bunti.model.*; import de.ctdo.bunti.model.*;
public interface BuntiDevicesDAO { public interface BuntiDevicesDAO {
List<BuntiDevice> getAllDevices(); Collection<BuntiDevice> getAllDevices();
List<BuntiDMXDevice> getAllDMXDevices(); Collection<BuntiDMXDevice> getAllDMXDevices();
BuntiDevice getDeviceById(int deviceId); BuntiDevice getDeviceById(int deviceId);
void addDevice(BuntiDevice device);
void removeDevice(int deviceId);
} }

View File

@ -1,36 +1,63 @@
package de.ctdo.bunti.dao; package de.ctdo.bunti.dao;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.ctdo.bunti.model.*; import de.ctdo.bunti.model.*;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.springframework.stereotype.Repository;
@Repository
public final class BuntiDevicesDAOImpl implements BuntiDevicesDAO {
private static final Logger LOGGER = LoggerFactory.getLogger(BuntiDevicesDAOImpl.class);
private List<BuntiDevice> devices = new ArrayList<BuntiDevice>();
public BuntiDevicesDAOImpl() {
addDummyDevices();
}
public final class BuntiDevicesDAOImpl extends HibernateDaoSupport implements BuntiDevicesDAO { private void addDummyDevices() {
int deviceID = 0;
devices.add(new Par56Spot(deviceID++, 1, "Par56 Lampe 1"));
devices.add(new Par56Spot(deviceID++, 6, "Par56 Lampe 2"));
devices.add(new Par56Spot(deviceID++, 11, "Par56 Lampe 3"));
devices.add(new Par56Spot(deviceID++, 16, "Par56 Lampe 4"));
devices.add(new Strobe1500(deviceID++, 21, "Stroboskop 1"));
devices.add(new Par56Spot(deviceID, 508, "Par56 Lampe 5"));
LOGGER.debug("added dummy devices in DAO");
}
@Override @Override
public List<BuntiDMXDevice> getAllDMXDevices() { public Collection<BuntiDMXDevice> getAllDMXDevices() {
return getHibernateTemplate().loadAll(BuntiDMXDevice.class); List<BuntiDMXDevice> list = new ArrayList<BuntiDMXDevice>();
for (BuntiDevice device : devices) {
if( device instanceof BuntiDMXDevice ) {
list.add((BuntiDMXDevice) device);
}
}
return list;
} }
@Override @Override
public List<BuntiDevice> getAllDevices() { public Collection<BuntiDevice> getAllDevices() {
return getHibernateTemplate().loadAll(BuntiDevice.class); return Collections.unmodifiableCollection(devices);
} }
@Override @Override
public BuntiDevice getDeviceById(int deviceId) { public BuntiDevice getDeviceById(int deviceId) {
return getHibernateTemplate().get(BuntiDevice.class,deviceId); for (BuntiDevice dev : devices) {
if(dev.getDeviceId() == deviceId) {
return dev;
} }
@Override
public void addDevice(BuntiDevice device) {
getHibernateTemplate().save(device);
} }
return null;
@Override
public void removeDevice(int deviceId) {
getHibernateTemplate().delete(getDeviceById(deviceId));
} }
} }

View File

@ -1,12 +0,0 @@
package de.ctdo.bunti.dao;
import de.ctdo.bunti.model.Room;
import java.util.List;
public interface RoomsDAO {
List<Room> getRooms();
Room getRoom(int id);
Room addRoom(Room room);
void removeRoom(int id);
}

View File

@ -1,29 +0,0 @@
package de.ctdo.bunti.dao;
import de.ctdo.bunti.model.Room;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import java.util.List;
public final class RoomsDAOImpl extends HibernateDaoSupport implements RoomsDAO {
@Override
public List<Room> getRooms() {
return getHibernateTemplate().loadAll(Room.class);
}
@Override
public Room getRoom(int id) {
return getHibernateTemplate().get(Room.class, id);
}
@Override
public Room addRoom(Room room) {
getHibernateTemplate().save(room);
return room;
}
@Override
public void removeRoom(int id) {
getHibernateTemplate().delete(getRoom(id));
}
}

View File

@ -1,4 +1,4 @@
package de.ctdo.bunti.dmx.model; package de.ctdo.bunti.dmx;
public class DMXChannel { public class DMXChannel {
private int offset; private int offset;

View File

@ -1,7 +1,5 @@
package de.ctdo.bunti.dmx; package de.ctdo.bunti.dmx;
import de.ctdo.bunti.dmx.model.DMXChannel;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;

View File

@ -45,7 +45,6 @@ public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChanged
} }
if (hasDataChanged) { if (hasDataChanged) {
LOGGER.debug("sending DMX Data");
artNetSender.sendDMXData(dmxMap, artNetDeviceAddress); artNetSender.sendDMXData(dmxMap, artNetDeviceAddress);
hasDataChanged = false; hasDataChanged = false;
} }

View File

@ -1,30 +1,28 @@
package de.ctdo.bunti.model; package de.ctdo.bunti.model;
import de.ctdo.bunti.dmx.DMX; import de.ctdo.bunti.dmx.DMX;
import de.ctdo.bunti.dmx.model.DMXChannel; import de.ctdo.bunti.dmx.DMXChannel;
import de.ctdo.bunti.dmx.DMXChannels; import de.ctdo.bunti.dmx.DMXChannels;
import org.codehaus.jackson.annotate.JsonIgnore; import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.Entity;
import javax.persistence.Transient;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@Entity
public abstract class BuntiDMXDevice extends BuntiDevice { public abstract class BuntiDMXDevice extends BuntiDevice {
private int startAddress; private int startAddress;
private final DMXChannels dmxChannels = new DMXChannels(); private final DMXChannels dmxChannels = new DMXChannels();
public BuntiDMXDevice() { public BuntiDMXDevice(int deviceId, int startAddress, String name) {
super(deviceId, name);
setStartAddress(startAddress);
} }
/** /**
* Gets the DMX start address for this device * Gets the DMX start address for this device
* @return The address value from 1 to max 512 * @return The address value from 1 to max 512
*/ */
public int getStartAddress() { public final int getStartAddress() {
return startAddress; return startAddress;
} }
@ -33,7 +31,7 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
* @param startAddress The address value from 1 to max 512 * @param startAddress The address value from 1 to max 512
* @return True on success, false if start address is wrong * @return True on success, false if start address is wrong
*/ */
public boolean setStartAddress(int startAddress) { public final boolean setStartAddress(int startAddress) {
if(startAddress < DMX.DMX_CHANNEL_INDEX_MIN || if(startAddress < DMX.DMX_CHANNEL_INDEX_MIN ||
startAddress - 1 + dmxChannels.getCount() > DMX.DMX_CHANNEL_INDEX_MAX) { startAddress - 1 + dmxChannels.getCount() > DMX.DMX_CHANNEL_INDEX_MAX) {
return false; return false;
@ -64,8 +62,6 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
* @param name The channel name to get the value from. * @param name The channel name to get the value from.
* @return The desired channel value. * @return The desired channel value.
*/ */
@JsonIgnore
@Transient
protected final int getChannelValueByName(String name) { protected final int getChannelValueByName(String name) {
DMXChannel dx = dmxChannels.getChannelByName(name); DMXChannel dx = dmxChannels.getChannelByName(name);
if (dx != null) { if (dx != null) {
@ -79,7 +75,6 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
* @return The channel data with startaddress+offset of every channel * @return The channel data with startaddress+offset of every channel
*/ */
@JsonIgnore @JsonIgnore
@Transient
public Map<Integer, Integer> getChannelData() { public Map<Integer, Integer> getChannelData() {
Map<Integer, Integer> map = new HashMap<Integer, Integer>(); Map<Integer, Integer> map = new HashMap<Integer, Integer>();
@ -111,18 +106,6 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
return true; return true;
} }
@Transient
@Override
public final Map<String, Object> getOptions() {
Map<String, Object> options = new HashMap<String, Object>();
for(DMXChannel channel: dmxChannels.getAllChannels()) {
options.put(channel.getName(), channel.getValue());
}
return options;
}
/** /**
* Add a channel to this DMX Device * Add a channel to this DMX Device
* used internally by subclasses to define their structure * used internally by subclasses to define their structure

View File

@ -1,6 +1,5 @@
package de.ctdo.bunti.model; package de.ctdo.bunti.model;
import javax.persistence.*;
import java.util.Map; import java.util.Map;
/** /**
@ -8,24 +7,20 @@ import java.util.Map;
* Maybe this is a lamp, or a switchable power source, or a strobe, ... * Maybe this is a lamp, or a switchable power source, or a strobe, ...
* @author lucas * @author lucas
*/ */
@Entity
@Table(name = "devices")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public abstract class BuntiDevice { public abstract class BuntiDevice {
private int id; private int deviceId;
private String deviceName; private String deviceName;
private String picture;
public BuntiDevice() {
public BuntiDevice(int deviceId, String deviceName) {
this.deviceId = deviceId;
this.deviceName = deviceName;
} }
/** /**
* Get the type of this device * Get the type of this device
* @return a string with the class name (=the Type) * @return a string with the class name (=the Type)
*/ */
@Transient @SuppressWarnings("UnusedDeclaration")
public final String getType() { public final String getType() {
String fqClassName = this.getClass().getName(); String fqClassName = this.getClass().getName();
int firstChar = fqClassName.lastIndexOf ('.') + 1; int firstChar = fqClassName.lastIndexOf ('.') + 1;
@ -39,22 +34,15 @@ public abstract class BuntiDevice {
* Gets the device Id * Gets the device Id
* @return the device Id * @return the device Id
*/ */
@Id public final int getDeviceId() {
@GeneratedValue(strategy = GenerationType.IDENTITY) return deviceId;
@Column(name = "BUNTIDEVICE_ID", updatable=false, nullable=false)
public final int getId() {
return id;
}
public final void setId(int id) {
this.id = id;
} }
/** /**
* Gets the device name * Gets the device name
* @return The name of the device * @return The name of the device
*/ */
public String getDeviceName() { public final String getDeviceName() {
return deviceName; return deviceName;
} }
@ -62,26 +50,10 @@ public abstract class BuntiDevice {
* Sets the device Name * Sets the device Name
* @param deviceName a String with the device name * @param deviceName a String with the device name
*/ */
public void setDeviceName(String deviceName) { public final void setDeviceName(String deviceName) {
this.deviceName = deviceName; this.deviceName = deviceName;
} }
/**
* Get the relative URL to the picture of this device
* @return the relative URL to the picture
*/
public String getPicture() {
return picture;
}
/**
* Get the relative URL to the picture of this device
* @param picture The relative URL to the picture
*/
public void setPicture(String picture) {
this.picture = picture;
}
/** /**
* Switch this device off. * Switch this device off.
*/ */
@ -100,9 +72,4 @@ public abstract class BuntiDevice {
*/ */
public abstract boolean setValuesFromOptions(Map<String, Object> options); public abstract boolean setValuesFromOptions(Map<String, Object> options);
@Transient
public abstract Map<String, Object> getOptions();
} }

View File

@ -1,41 +1,19 @@
package de.ctdo.bunti.model; package de.ctdo.bunti.model;
import javax.persistence.Entity;
import javax.persistence.Transient;
import java.util.Map; import java.util.Map;
@Entity
public abstract class BuntiSwitchingDevice extends BuntiDevice { public abstract class BuntiSwitchingDevice extends BuntiDevice {
private static final String OPTION_STATE = "state";
private boolean state = false;
public BuntiSwitchingDevice() {
public BuntiSwitchingDevice(int deviceId, String deviceName) {
super(deviceId, deviceName);
} }
@Override @Override
public final boolean setValuesFromOptions(Map<String, Object> options) { public final boolean setValuesFromOptions(Map<String, Object> options) {
// TODO Auto-generated method stub
if(options.containsKey(OPTION_STATE)) {
try {
boolean value = Boolean.parseBoolean(options.get(OPTION_STATE).toString());
setState(value);
return true;
} catch (Exception e) {
return false; return false;
} }
} }
return false;
}
@Transient
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
}

View File

@ -1,13 +1,8 @@
package de.ctdo.bunti.model; package de.ctdo.bunti.model;
import de.ctdo.bunti.dmx.DMX; import de.ctdo.bunti.dmx.DMX;
import de.ctdo.bunti.dmx.model.DMXChannel; import de.ctdo.bunti.dmx.DMXChannel;
import org.codehaus.jackson.annotate.JsonIgnore;
import javax.persistence.Entity;
import javax.persistence.Transient;
@Entity
public class Par56Spot extends BuntiDMXDevice { public class Par56Spot extends BuntiDMXDevice {
private static final String CHANNEL_MODE = "mode"; private static final String CHANNEL_MODE = "mode";
@ -16,12 +11,8 @@ public class Par56Spot extends BuntiDMXDevice {
private static final String CHANNEL_BLUE = "blue"; private static final String CHANNEL_BLUE = "blue";
private static final String CHANNEL_SPEED = "speed"; private static final String CHANNEL_SPEED = "speed";
public Par56Spot() { public Par56Spot(int deviceId, int startAddress, String deviceName) {
super(); super(deviceId, startAddress, deviceName);
addChannels();
}
private void addChannels() {
int offset = 0; int offset = 0;
addChannel(new DMXChannel(offset++, CHANNEL_MODE)); addChannel(new DMXChannel(offset++, CHANNEL_MODE));
addChannel(new DMXChannel(offset++, CHANNEL_RED)); addChannel(new DMXChannel(offset++, CHANNEL_RED));
@ -30,51 +21,45 @@ public class Par56Spot extends BuntiDMXDevice {
addChannel(new DMXChannel(offset, CHANNEL_SPEED)); addChannel(new DMXChannel(offset, CHANNEL_SPEED));
} }
public final void setRed(int value) { public final void setColorRed(int value) {
setChannelValueByName(CHANNEL_RED, value); setChannelValueByName(CHANNEL_RED, value);
} }
public final void setGreen(int value) { public final void setColorGreen(int value) {
setChannelValueByName(CHANNEL_GREEN, value); setChannelValueByName(CHANNEL_GREEN, value);
} }
public final void setBlue(int value) { public final void setColorBlue(int value) {
setChannelValueByName(CHANNEL_BLUE, value); setChannelValueByName(CHANNEL_BLUE, value);
} }
@JsonIgnore public final int getColorRed() {
@Transient
public final int getRed() {
return getChannelValueByName(CHANNEL_RED); return getChannelValueByName(CHANNEL_RED);
} }
@JsonIgnore public final int getColorGreen() {
@Transient
public final int getGreen() {
return getChannelValueByName(CHANNEL_GREEN); return getChannelValueByName(CHANNEL_GREEN);
} }
@JsonIgnore public final int getColorBlue() {
@Transient
public final int getBlue() {
return getChannelValueByName(CHANNEL_BLUE); return getChannelValueByName(CHANNEL_BLUE);
} }
@Override @Override
public final void switchOff() { public final void switchOff() {
setChannelValueByName(CHANNEL_MODE, DMX.DMX_CHANNEL_VALUE_MIN); setChannelValueByName(CHANNEL_MODE, DMX.DMX_CHANNEL_VALUE_MIN);
setRed(DMX.DMX_CHANNEL_VALUE_MIN); setColorRed(DMX.DMX_CHANNEL_VALUE_MIN);
setGreen(DMX.DMX_CHANNEL_VALUE_MIN); setColorGreen(DMX.DMX_CHANNEL_VALUE_MIN);
setBlue(DMX.DMX_CHANNEL_VALUE_MIN); setColorBlue(DMX.DMX_CHANNEL_VALUE_MIN);
setChannelValueByName(CHANNEL_SPEED, DMX.DMX_CHANNEL_VALUE_MIN); setChannelValueByName(CHANNEL_SPEED, DMX.DMX_CHANNEL_VALUE_MIN);
} }
@Override @Override
public final void switchOn() { public final void switchOn() {
setChannelValueByName(CHANNEL_MODE, DMX.DMX_CHANNEL_VALUE_MIN); setChannelValueByName(CHANNEL_MODE, DMX.DMX_CHANNEL_VALUE_MIN);
setRed(DMX.DMX_CHANNEL_VALUE_MAX); setColorRed(DMX.DMX_CHANNEL_VALUE_MAX);
setGreen(DMX.DMX_CHANNEL_VALUE_MAX); setColorGreen(DMX.DMX_CHANNEL_VALUE_MAX);
setBlue(DMX.DMX_CHANNEL_VALUE_MAX); setColorBlue(DMX.DMX_CHANNEL_VALUE_MAX);
setChannelValueByName(CHANNEL_SPEED, DMX.DMX_CHANNEL_VALUE_MIN); setChannelValueByName(CHANNEL_SPEED, DMX.DMX_CHANNEL_VALUE_MIN);
} }
@ -82,15 +67,15 @@ public class Par56Spot extends BuntiDMXDevice {
public final String toString() { public final String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Par56Spot "); sb.append("Par56Spot ");
sb.append(getId()); sb.append(getDeviceId());
sb.append(", "); sb.append(", ");
sb.append(getDeviceName()); sb.append(getDeviceName());
sb.append(" ["); sb.append(" [");
sb.append(getRed()); sb.append(getColorRed());
sb.append(","); sb.append(",");
sb.append(getGreen()); sb.append(getColorGreen());
sb.append(","); sb.append(",");
sb.append(getBlue()); sb.append(getColorBlue());
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }

View File

@ -1,96 +0,0 @@
package de.ctdo.bunti.model;
import javax.persistence.*;
import java.util.*;
@Entity
@Table( name = "rooms" )
public final class Room {
private int id;
private String name;
private String floor;
private int xCord;
private int yCord;
private List<BuntiDevice> devices = new ArrayList<BuntiDevice>();
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ROOM_ID", updatable=false, nullable=false)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column( name = "roomName")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getxCord() {
return xCord;
}
public void setxCord(int xCord) {
this.xCord = xCord;
}
public int getyCord() {
return yCord;
}
public void setyCord(int yCord) {
this.yCord = yCord;
}
public String getFloor() {
return floor;
}
public void setFloor(String floor) {
this.floor = floor;
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, targetEntity = BuntiDevice.class)
@JoinTable(name = "ROOM_BUNTIDEVICE",
joinColumns = { @JoinColumn(name = "ROOM_ID") },
inverseJoinColumns = { @JoinColumn(name = "BUNTIDEVICE_ID") })
public List<BuntiDevice> getDevices() {
return Collections.unmodifiableList(this.devices);
}
public void setDevices(List<BuntiDevice> devices) {
this.devices = devices;
}
@Transient
public boolean addDevice(BuntiDevice device) {
return getDevices().add(device);
}
@Transient
public boolean removeDevice(BuntiDevice device) {
return getDevices().remove(device);
}
@Transient
public BuntiDevice getDevice(int id) {
for (BuntiDevice device: getDevices()) {
if( device.getId() == id) {
return device;
}
}
return null;
}
}

View File

@ -1,25 +1,17 @@
package de.ctdo.bunti.model; package de.ctdo.bunti.model;
import de.ctdo.bunti.dmx.DMX; import de.ctdo.bunti.dmx.DMX;
import de.ctdo.bunti.dmx.model.DMXChannel; import de.ctdo.bunti.dmx.DMXChannel;
import org.codehaus.jackson.annotate.JsonIgnore;
import javax.persistence.Entity;
import javax.persistence.Transient;
@Entity
public class Strobe1500 extends BuntiDMXDevice { public class Strobe1500 extends BuntiDMXDevice {
private static final String CHANNEL_SPEED = "speed"; private static final String CHANNEL_SPEED = "speed";
private static final String CHANNEL_INTENSITY = "intensity"; private static final String CHANNEL_INTENSITY = "intensity";
private static final String CHANNEL_MODE = "mode"; private static final String CHANNEL_MODE = "mode";
public Strobe1500() { public Strobe1500(int deviceId, int startAddress, String deviceName) {
super(); super(deviceId, startAddress, deviceName);
addChannels();
}
private void addChannels() {
addChannel(new DMXChannel(0, CHANNEL_SPEED)); addChannel(new DMXChannel(0, CHANNEL_SPEED));
addChannel(new DMXChannel(1, CHANNEL_INTENSITY)); addChannel(new DMXChannel(1, CHANNEL_INTENSITY));
addChannel(new DMXChannel(2, CHANNEL_MODE)); addChannel(new DMXChannel(2, CHANNEL_MODE));
@ -37,20 +29,14 @@ public class Strobe1500 extends BuntiDMXDevice {
return setChannelValueByName(CHANNEL_MODE, value); return setChannelValueByName(CHANNEL_MODE, value);
} }
@JsonIgnore
@Transient
public final int getSpeed() { public final int getSpeed() {
return getChannelValueByName(CHANNEL_SPEED); return getChannelValueByName(CHANNEL_SPEED);
} }
@JsonIgnore
@Transient
public final int getIntensity() { public final int getIntensity() {
return getChannelValueByName(CHANNEL_INTENSITY); return getChannelValueByName(CHANNEL_INTENSITY);
} }
@JsonIgnore
@Transient
public final int getMode() { public final int getMode() {
return getChannelValueByName(CHANNEL_MODE); return getChannelValueByName(CHANNEL_MODE);
} }
@ -73,7 +59,7 @@ public class Strobe1500 extends BuntiDMXDevice {
public final String toString() { public final String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Strobe1500 "); sb.append("Strobe1500 ");
sb.append(getId()); sb.append(getDeviceId());
sb.append(", "); sb.append(", ");
sb.append(getDeviceName()); sb.append(getDeviceName());
sb.append(" ["); sb.append(" [");

View File

@ -1,33 +0,0 @@
package de.ctdo.bunti.web;
import de.ctdo.bunti.control.BuntiController;
import de.ctdo.bunti.webmodel.DeviceUpdate;
import de.ctdo.bunti.webmodel.DeviceUpdates;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping(value = "/control")
public class DeviceControlController {
private static final Logger LOGGER = LoggerFactory.getLogger(DeviceControlController.class);
private BuntiController controller;
@Autowired
public final void setController(BuntiController controller) {
this.controller = controller;
}
@RequestMapping(value = "/devices", method = RequestMethod.POST)
public void setDevices(@RequestBody DeviceUpdates updates) {
LOGGER.info("handle PUT /devices" + " request update=" + updates.toString() );
for (DeviceUpdate update: updates.getUpdates()) {
LOGGER.info("Update deviceId=" + update.getDeviceId());
controller.updateDeviceData(update.getDeviceId(), update.getOptions());
}
}
}

View File

@ -1,38 +0,0 @@
package de.ctdo.bunti.web;
import de.ctdo.bunti.dao.BuntiDevicesDAO;
import de.ctdo.bunti.model.BuntiDevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
@Controller
@RequestMapping(value = "/devices")
public class DevicesController {
private BuntiDevicesDAO devicesDAO;
@Autowired
public void setDevicesDAO(BuntiDevicesDAO devicesDAO) {
this.devicesDAO = devicesDAO;
}
@RequestMapping(value = "", method = RequestMethod.GET)
public @ResponseBody Collection<BuntiDevice> getAll() {
return devicesDAO.getAllDevices();
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public @ResponseBody BuntiDevice getDeviceById(@PathVariable("id") int id) {
return devicesDAO.getDeviceById(id);
}
@RequestMapping(value = "", method = RequestMethod.POST)
public @ResponseBody BuntiDevice setDevices(@RequestBody BuntiDevice device) {
devicesDAO.addDevice(device);
return device;
}
}

View File

@ -0,0 +1,43 @@
package de.ctdo.bunti.web;
import de.ctdo.bunti.control.BuntiController;
import de.ctdo.bunti.model.BuntiDevice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.Map;
@Controller
public class RestController {
private static final Logger LOGGER = LoggerFactory.getLogger(RestController.class);
@Autowired
private BuntiController controller;
@RequestMapping(value = "/devices", method = RequestMethod.GET)
@ResponseBody
public Collection<BuntiDevice> getAll() {
LOGGER.info("handle GET /devices request");
return controller.getAllDevices();
}
@RequestMapping(value = "/devices/{id}", method = RequestMethod.GET)
@ResponseBody
public BuntiDevice getDeviceById(@PathVariable("id") int id) {
LOGGER.info("handle GET /devices/" + id + " request");
return controller.getDeviceById(id);
}
@RequestMapping(value = "/devices/{id}", method = RequestMethod.PUT)
public String setDeviceById(@PathVariable("id") int id, @RequestBody Map<String, Object> update) {
LOGGER.info("handle PUT /devices/" + id + " request update=" + update.toString() );
controller.updateDeviceData(id, update);
return "redirect:devices/" + id;
}
}

View File

@ -1,45 +0,0 @@
package de.ctdo.bunti.web;
import de.ctdo.bunti.dao.RoomsDAO;
import de.ctdo.bunti.model.BuntiDevice;
import de.ctdo.bunti.model.Room;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.List;
@Controller
@RequestMapping(value = "/rooms")
public class RoomsController {
private RoomsDAO roomsDAO;
@Autowired
public void setRoomsDAO(RoomsDAO roomsDAO) {
this.roomsDAO = roomsDAO;
}
@RequestMapping(value = "", method = RequestMethod.GET)
public @ResponseBody Collection<Room> getAll() {
return roomsDAO.getRooms();
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public @ResponseBody Room getRoomById(@PathVariable("id") int id) {
return roomsDAO.getRoom(id);
}
@RequestMapping(value = "/{id}/devices", method = RequestMethod.GET)
public @ResponseBody
List<BuntiDevice> getDevicesFromRoom(@PathVariable("id") int id) {
Room room = roomsDAO.getRoom(id);
if(room != null) {
return room.getDevices();
}
return null;
}
}

View File

@ -4,7 +4,7 @@ import java.io.Serializable;
import java.util.Map; import java.util.Map;
public class DeviceUpdate { public class DeviceUpdate implements Serializable {
private int deviceId; private int deviceId;
private Map<String, Object> options; private Map<String, Object> options;

View File

@ -1,29 +0,0 @@
package de.ctdo.bunti.webmodel;
import java.util.ArrayList;
import java.util.List;
/**
* Diese Klasse gibts nur, weil ich es nicht hinbekomme mit Jackson
* ein ArrayList<DeviceUpdate> als Parameter im Controller zu verarbeiten.
*/
public class DeviceUpdates {
private long timeStamp = 0;
private List<DeviceUpdate> updates = new ArrayList<DeviceUpdate>();
public List<DeviceUpdate> getUpdates() {
return updates;
}
public void setUpdates(List<DeviceUpdate> updates) {
this.updates = updates;
}
public long getTimeStamp() {
return timeStamp;
}
public void setTimeStamp(long timeStamp) {
this.timeStamp = timeStamp;
}
}

View File

@ -0,0 +1,30 @@
/**
*
*/
package de.ctdo.bunti.websocket;
import javax.servlet.http.HttpServletRequest;
import org.atmosphere.cpr.AtmosphereResource;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebArgumentResolver;
import org.springframework.web.context.request.NativeWebRequest;
public class AtmosphereResourceArgumentResolver implements WebArgumentResolver {
/* (non-Javadoc)
* @see org.springframework.web.bind.support.WebArgumentResolver#resolveArgument(org.springframework.core.MethodParameter, org.springframework.web.context.request.NativeWebRequest)
*/
@Override
public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) {
if (AtmosphereResource.class.isAssignableFrom(methodParameter.getParameterType())) {
return AtmosphereUtils.getAtmosphereResource(webRequest.getNativeRequest(HttpServletRequest.class));
} else {
return WebArgumentResolver.UNRESOLVED;
}
}
}

View File

@ -0,0 +1,25 @@
package de.ctdo.bunti.websocket;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.atmosphere.cpr.AtmosphereResource;
import org.atmosphere.cpr.AtmosphereServlet;
import org.springframework.util.Assert;
public final class AtmosphereUtils {
private AtmosphereUtils() { }
public static AtmosphereResource<HttpServletRequest, HttpServletResponse> getAtmosphereResource(
HttpServletRequest request) {
AtmosphereResource<HttpServletRequest, HttpServletResponse> resource =
(AtmosphereResource<HttpServletRequest, HttpServletResponse>) request.getAttribute(AtmosphereServlet.ATMOSPHERE_RESOURCE);
Assert.notNull(resource,"AtmosphereResource could not be located for the request. Check that AtmosphereServlet is configured correctly in web.xml");
return resource;
}
}

View File

@ -0,0 +1,55 @@
package de.ctdo.bunti.websocket;
import org.atmosphere.cpr.AtmosphereResource;
import org.atmosphere.cpr.Broadcaster;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
@Controller
public class WebSocketController {
private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketController.class);
@RequestMapping(value="/buntisocket", method=RequestMethod.GET)
@ResponseBody
public void websockets(final AtmosphereResource<HttpServletRequest,HttpServletResponse> event) {
final HttpServletRequest req = event.getRequest();
// final HttpServletResponse res = event.getResponse();
LOGGER.debug("call to websockets " + req.toString());
final ObjectMapper mapper = new ObjectMapper();
event.suspend();
final Broadcaster bc = event.getBroadcaster();
bc.scheduleFixedBroadcast(new Callable<String>() {
@Override
public String call() throws IOException {
LOGGER.debug("call was called");
return mapper.writeValueAsString("blafaselblubb");
}
}, 10, TimeUnit.SECONDS);
}
}

View File

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"
xmlns:jdbc="http://www.springframework.org/schema/jdbc">
<jdbc:embedded-database id="dataSource" type="H2">
<jdbc:script location="classpath:init_schema.sql" />
<jdbc:script location="classpath:init_data.sql" />
</jdbc:embedded-database>
<bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="packagesToScan" value="de.ctdo.bunti.model"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<!--<prop key="hibernate.hbm2ddl.auto">create</prop>-->
</props>
</property>
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="roomsDAO" class="de.ctdo.bunti.dao.RoomsDAOImpl">
<property name="sessionFactory" ref="hibernateSessionFactory" />
</bean>
<bean id="devicesDAO" class="de.ctdo.bunti.dao.BuntiDevicesDAOImpl">
<property name="sessionFactory" ref="hibernateSessionFactory" />
</bean>
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="hibernateSessionFactory" />
</bean>
<tx:annotation-driven />
</beans>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<context:component-scan base-package="de.ctdo.bunti">
<context:exclude-filter type="regex" expression="de\.ctdo\.bunti\.web*"/>
</context:component-scan>
<task:annotation-driven scheduler="myScheduler"/>
<task:scheduler id="myScheduler" pool-size="3"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:bunti.properties"/>
</bean>
<bean class="de.ctdo.bunti.dmx.DMXMixerImpl">
<property name="artNetDeviceAddress" value="${artnet.deviceAddress}"/>
</bean>
<import resource="hibernate-beans.xml"/>
</beans>

View File

@ -1,2 +0,0 @@
#db.driverClassName=org.hsqldb.jdbcDriver
#db.url=jdbc:hsqldb:mem:buntiserver

View File

@ -1,19 +0,0 @@
insert into rooms (ROOM_ID, floor, roomName, xCord, yCord) values (null, '2. Etage', 'Kueche', '0', '0');
insert into rooms (ROOM_ID, floor, roomName, xCord, yCord) values (null, '2. Etage', 'Wohnzimmer', '0', '1');
insert into rooms (ROOM_ID, floor, roomName, xCord, yCord) values (null, '2. Etage', 'Werkstatt', '1', '0');
insert into rooms (ROOM_ID, floor, roomName, xCord, yCord) values (null, '2. Etage', 'Flur', '1', '1');
insert into devices (DTYPE, BUNTIDEVICE_ID, deviceName, picture, startAddress)
values ('Par56Spot',null,'Lampe1',null, 1);
insert into devices (DTYPE, BUNTIDEVICE_ID, deviceName, picture, startAddress)
values ('Par56Spot',null,'Lampe2',null, 6);
insert into devices (DTYPE, BUNTIDEVICE_ID, deviceName, picture, startAddress)
values ('Par56Spot',null,'Lampe3',null, 11);
insert into devices (DTYPE, BUNTIDEVICE_ID, deviceName, picture, startAddress)
values ('Par56Spot',null,'Lampe4',null, 16);

View File

@ -1,29 +0,0 @@
drop table ROOM_BUNTIDEVICE if exists;
drop table devices if exists;
drop table rooms if exists;
create table ROOM_BUNTIDEVICE (ROOM_ID integer not null, BUNTIDEVICE_ID int not null,
primary key (ROOM_ID, BUNTIDEVICE_ID), unique (BUNTIDEVICE_ID));
create table devices (DTYPE varchar(31) not null,
BUNTIDEVICE_ID integer generated by default as identity (start with 1),
deviceName varchar(255),
picture varchar(255),
startAddress integer,
primary key (BUNTIDEVICE_ID));
create table rooms (ROOM_ID integer generated by default as identity (start with 1),
floor varchar(255),
roomName varchar(255),
xCord integer not null,
yCord integer not null,
primary key (ROOM_ID));
alter table ROOM_BUNTIDEVICE add constraint FK96EF8F028BB4B62 foreign key (ROOM_ID) references rooms;
alter table ROOM_BUNTIDEVICE add constraint FK96EF8F021E9F392 foreign key (BUNTIDEVICE_ID) references devices;

View File

@ -0,0 +1,15 @@
#log4j.rootLogger=debug, stdout
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
##log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c: %m%n
#log4j.appender.R=org.apache.log4j.RollingFileAppender
#log4j.appender.R.File=application.log
#log4j.appender.R.MaxFileSize=100KB
#log4j.appender.R.MaxBackupIndex=1
#log4j.appender.R.layout=org.apache.log4j.PatternLayout
#log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

View File

@ -11,22 +11,34 @@
</layout> </layout>
</appender> </appender>
<logger name="org.springframework"> <!-- 3rdparty Loggers -->
<logger name="org.springframework.core">
<level value="info" /> <level value="info" />
</logger> </logger>
<logger name="org.springframework.beans">
<level value="info" />
</logger>
<logger name="org.springframework.context">
<level value="info" />
</logger>
<logger name="org.springframework.web">
<level value="info" />
</logger>
<logger name="de.ctdo"> <logger name="de.ctdo">
<level value="debug" /> <level value="debug" />
</logger> </logger>
<logger name="org.hibernate"> <logger name="org.atmosphere">
<level value="info" /> <level value="debug" />
</logger> </logger>
<!-- Root Logger -->
<root> <root>
<priority value="info" /> <priority value="warn" />
<appender-ref ref="console" /> <appender-ref ref="console" />
</root> </root>

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@ -1,88 +1,107 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%> <%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WebSockets</title> <title>WebSockets</title>
<link type="text/css" href="<c:url value="/resources/css/screen.css"/>" rel="stylesheet" />
<link type="text/css" href="<c:url value="/resources/css/styles.css"/>" rel="stylesheet" />
<link type="text/css" href="<c:url value="/resources/css/smoothness/jquery-ui-1.8.18.custom.css"/>" rel="stylesheet" /> <link type="text/css" href="<c:url value="/resources/css/smoothness/jquery-ui-1.8.18.custom.css"/>" rel="stylesheet" />
<script type="text/javascript" src="<c:url value="/resources/js/jquery-1.7.1.min.js" />"></script> <script type="text/javascript" src="<c:url value="/resources/js/jquery-1.7.1.min.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/jquery-ui-1.8.18.custom.min.js" />"></script> <script type="text/javascript" src="<c:url value="/resources/js/jquery-ui-1.8.18.custom.min.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/events.class.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/jquery.cookie.js" />"></script> <script type="text/javascript">
<script type="text/javascript" src="<c:url value="/resources/js/underscore.js" />"></script> var ws;
<script type="text/javascript" src="<c:url value="/resources/js/backbone-min.js" />"></script> var dmxData;
<script type="text/javascript" src="<c:url value="/resources/js/handlebars.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/main.js" />"></script> $(document).ready(
<script type="text/javascript" src="<c:url value="/resources/js/jquery.colorpicker.js" />"></script> function() {
<script type="text/javascript" src="<c:url value="/resources/js/jquery.mousewheel.js" />"></script> var Socket = "MozWebSocket" in window ? MozWebSocket : WebSocket;
<script type="text/javascript" src="<c:url value="/resources/js/models.js" />"></script> ws = new Socket("ws://" + window.location.hostname + ":" + window.location.port + "/bunti_server/bunti");
<script type="text/javascript" src="<c:url value="/resources/js/views.js" />"></script>
ws.onmessage = function (message) {
//$("#messages").append("<p>" + message.data + "</p>");
var obj = jQuery.parseJSON(message.data);
if( obj.dmx512values != null) {
dmxData = obj.dmx512values;
// das direkt zu machen ist evtl etwas unklug, da das sliden des sliders im
// gleichen browser dann hier zu ner aenderung fuehrt und der slider dann
// ruckelt. Aber es tut :D
$("#slider1").slider("value", dmxData[1]);
$("#slider2").slider("value", dmxData[2]);
$("#slider3").slider("value", dmxData[3]);
}
};
ws.onopen = function () {
$("#messages").append("<p>WS opened</p>");
};
ws.onclose = function () {
$("#messages").append("<p>WS closed</p>");
};
$("#slider1").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:2=" + ui.value);
ws.send("channel:7=" + ui.value);
ws.send("channel:12=" + ui.value);
ws.send("channel:17=" + ui.value);
} });
$("#slider2").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:3=" + ui.value);
ws.send("channel:8=" + ui.value);
ws.send("channel:13=" + ui.value);
ws.send("channel:18=" + ui.value);
} });
$("#slider3").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:4=" + ui.value);
ws.send("channel:9=" + ui.value);
ws.send("channel:14=" + ui.value);
ws.send("channel:19=" + ui.value);
} });
$("#buttonLampe1").click(function() {
$.getJSON('/devices/1', function(data) {
alert("data: " + data.deviceId + " " + data.colorRed );
});
});
});
</script>
</head> </head>
<body> <body>
<h1>CTDO Raumsteuerung</h1> <h1>Hello World!</h1>
<div id="container">
<div id="room-tabs">
</div> <script>
</div>
<script type="text/x-handlebars-template" id="room-tabs-template">
<ul>
{{#each rooms}}
<li><a href="#room-tabs-{{roomId}}">{{roomName}}</a></li>
{{/each}}
</ul>
{{#each rooms}}
<div id="room-tabs-{{roomId}}">
</div>
{{/each}}
</script>
<script type="text/x-handlebars-template" id="room-vertical-tabs-template">
<div id="room{{roomId}}-vertical-tabs" class="ui-tabs-vertical">
<ul>
{{#each types}}
<li><a href="#room{{roomId}}-vertical-tabs-{{id}}">{{typeName}}</a></li>
{{/each}}
</ul>
{{#each types}}
<div id="room{{roomId}}-vertical-tabs-{{id}}">
</div>
{{/each}}
</div>
</script>
<script type="text/x-handlebars-template" id="par56-options-template">
{{#each devices}}
<option name="{{deviceId}}">{{deviceName}}</option>
{{/each}}
</script>
<script type="text/x-handlebars-template" id="buzzer-template">
<div class="buzzer">
<span class="circle {{color}}">{{text}}</span>
<button>Buzzern</button>
</div>
</script>
<script type="text/x-handlebars-template" id="lampel-template">
<div class="lampel">
<span class="circle red" title="click to toggle"></span>
<span class="circle yellow" title="click to toggle"></span>
<span class="circle green" title="click to toggle"></span>
</div>
</script>
<script type="text/x-handlebars-template">
</script> </script>
<div class="demo">
<div id="slider1" style="width: 300px"></div>
<div id="slider2" style="width: 300px; margin-top: 10px"></div>
<div id="slider3" style="width: 300px; margin-top: 10px"></div>
</div>
<div id="messages"></div>
<input type="button" value="Update Lampe 1" id="buttonLampe1" />
</body> </body>
</html> </html>

View File

@ -1,77 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WebSockets</title>
<link type="text/css" href="<c:url value="/resources/css/screen.css"/>" rel="stylesheet"/>
<link type="text/css" href="<c:url value="/resources/css/styles.css"/>" rel="stylesheet"/>
<script type="text/javascript" src="<c:url value="/resources/js/jquery-1.7.1.min.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/main.js" />"></script>
<script type="text/javascript">
function sendData(data) {
var time = Math.round(new Date().getTime() / 1000);
data = {"timeStamp":time, "updates":data};
$.ajax({
type:'POST',
url:"/control/devices",
contentType:"application/json",
dataType:"json",
data:JSON.stringify(data)
});
console.log(data);
console.log(JSON.stringify(data));
}
$('#par56 .pink').click(function () {
data = [
{"deviceId":0, "options":{"red":255, "green":0, "blue":40}},
{"deviceId":1, "options":{"red":255, "green":0, "blue":40}},
{"deviceId":2, "options":{"red":255, "green":0, "blue":40}},
{"deviceId":3, "options":{"red":255, "green":0, "blue":40}}
];
sendData(data);
});
$('#par56 .gruen').click(function () {
data = [
{"deviceId":0, "options":{"red":0, "green":255, "blue":0}},
{"deviceId":1, "options":{"red":0, "green":255, "blue":0}},
{"deviceId":2, "options":{"red":0, "green":255, "blue":0}},
{"deviceId":3, "options":{"red":0, "green":255, "blue":0}}
];
sendData(data);
});
$('#par56 .rot').click(function () {
data = [
{"deviceId":0, "options":{"red":255, "green":0, "blue":0}},
{"deviceId":1, "options":{"red":255, "green":0, "blue":0}},
{"deviceId":2, "options":{"red":255, "green":0, "blue":0}},
{"deviceId":3, "options":{"red":255, "green":0, "blue":0}}
];
sendData(data);
});
</script>
</head>
<body>
<h1>CTDO Raumsteuerung</h1>
<p id="par56">Par56: <br>
<button class="pink">Pink</button>
<button class="gruen">Grün</button>
<button class="rot">Rot</button>
</p>
<p id="lampel">Lampel:<br>
<button class="rota">Rot (an)</button>
<button class="gelba">Gelb (an)</button>
<button class="gruena">Grün (an)</button>
<button class="roto">Rot (aus)</button>
<button class="gelbo">Gelb (aus)</button>
<button class="grueno">Grün (aus)</button>
</p>
</body>
</html>

View File

@ -2,12 +2,11 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd ">
<context:component-scan base-package="de.ctdo.bunti.web*"/>
<context:component-scan base-package="de.ctdo.bunti"/>
<!-- Configures the @Controller programming model --> <!-- Configures the @Controller programming model -->
<mvc:annotation-driven /> <mvc:annotation-driven />
@ -18,11 +17,23 @@
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory --> <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory -->
<mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:resources mapping="/resources/**" location="/resources/" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" /> <property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" /> <property name="suffix" value=".jsp" />
</bean> </bean>
<task:annotation-driven scheduler="myScheduler"/>
<task:scheduler id="myScheduler" pool-size="3"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:bunti.properties"/>
</bean>
<bean class="de.ctdo.bunti.dmx.DMXMixerImpl">
<property name="artNetDeviceAddress" value="${artnet.deviceAddress}"/>
</bean>
<!--<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />--> <!--<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />-->
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /> <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />

View File

@ -3,18 +3,14 @@
xmlns="http://java.sun.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0"> id="WebApp_ID" version="3.0">
<display-name>bunti_server</display-name> <display-name>bunti_server</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<description>CTDO bunti control Server</description> <description>CTDO bunti control Server</description>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:META-INF/spring/root-context.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter> <filter>
<filter-name>characterEncodingFilter</filter-name> <filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
@ -33,12 +29,53 @@
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </filter-mapping>
<!--<servlet>-->
<!--<servlet-name>dispatcher</servlet-name>-->
<!--<servlet-class>-->
<!--org.springframework.web.servlet.DispatcherServlet-->
<!--</servlet-class>-->
<!--<load-on-startup>1</load-on-startup>-->
<!--</servlet>-->
<session-config>
<session-timeout>25</session-timeout>
</session-config>
<servlet> <servlet>
<servlet-name>appServlet</servlet-name> <servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.servlet</param-name>
<param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.broadcasterClass</param-name>
<param-value>org.atmosphere.cpr.DefaultBroadcaster</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.broadcastFilterClasses</param-name>
<param-value>org.atmosphere.client.JavascriptClientFilter</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.CometSupport.maxInactiveActivity</param-name>
<param-value>30</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useStream</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useWebSocket</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useNative</param-name>
<param-value>true</param-value>
</init-param>
<init-param> <init-param>
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
<param-value>classpath:/META-INF/spring/mvc/servlet-context.xml</param-value> <param-value>/WEB-INF/spring/servlet-context.xml</param-value>
</init-param> </init-param>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>

View File

@ -0,0 +1,104 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WebSockets</title>
<link type="text/css" href="css/smoothness/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
var ws;
var dmxData;
$(document).ready(
function() {
var Socket = "MozWebSocket" in window ? MozWebSocket : WebSocket;
ws = new Socket("ws://" + window.location.hostname + ":" + window.location.port + "/bunti_server/bunti");
ws.onmessage = function (message) {
//$("#messages").append("<p>" + message.data + "</p>");
var obj = jQuery.parseJSON(message.data);
if( obj.dmx512values != null) {
dmxData = obj.dmx512values;
// das direkt zu machen ist evtl etwas unklug, da das sliden des sliders im
// gleichen browser dann hier zu ner aenderung fuehrt und der slider dann
// ruckelt. Aber es tut :D
$("#slider1").slider("value", dmxData[1]);
$("#slider2").slider("value", dmxData[2]);
$("#slider3").slider("value", dmxData[3]);
}
};
ws.onopen = function () {
$("#messages").append("<p>WS opened</p>");
};
ws.onclose = function () {
$("#messages").append("<p>WS closed</p>");
};
$("#slider1").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:2=" + ui.value);
ws.send("channel:7=" + ui.value);
ws.send("channel:12=" + ui.value);
ws.send("channel:17=" + ui.value);
} });
$("#slider2").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:3=" + ui.value);
ws.send("channel:8=" + ui.value);
ws.send("channel:13=" + ui.value);
ws.send("channel:18=" + ui.value);
} });
$("#slider3").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:4=" + ui.value);
ws.send("channel:9=" + ui.value);
ws.send("channel:14=" + ui.value);
ws.send("channel:19=" + ui.value);
} });
$("#buttonLampe1").click(function() {
$.getJSON('/devices/1', function(data) {
alert("data: " + data.deviceId + " " + data.colorRed );
});
});
});
</script>
</head>
<body>
<h1>Hello World!</h1>
<script>
</script>
<div class="demo">
<div id="slider1" style="width: 300px"></div>
<div id="slider2" style="width: 300px; margin-top: 10px"></div>
<div id="slider3" style="width: 300px; margin-top: 10px"></div>
</div>
<div id="messages"></div>
<input type="button" value="Update Lampe 1" id="buttonLampe1" />
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

View File

@ -1,9 +0,0 @@
body {
background-color: #fff;
color: #000;
}
.slider {
width: 300px;
margin-top: 10px
}

View File

@ -1,93 +0,0 @@
@CHARSET "UTF-8;
body {
font-family: Verdana, Arial, sans-serif;
}
#room-tabs {
height: 500px;
width: 770px;
margin: 0 auto;
}
.circle {
width: 60px;
height: 37px;
border-radius: 36px;
border: 2px solid black;
text-align: center;
padding-top: 23px;
font-size: 12px;
margin: 5px auto;
display: block;
}
.circle.red {
background-color: #ff1732;
color: #000b40;
}
.circle.green {
background-color: green;
color: #ffffff;
}
.circle.yellow {
background-color: #ffed4c;
color: #000000;
}
.circle.black {
background-color: #000000;
color: #ffffff;
}
.buzzer {
width: 95px;
}
.inner-tabs-container {
position: relative;
width: 600px;
height: 400px;
left: 120px;
top: 400px;
margin-top: -400px;
}
.lampel {
border: 2px solid white;
padding: 15px;
height: 64px;
width: 204px;
margin: 0 auto;
background-color: #111;
}
.lampel .circle {
display: inline-block;
margin: 0px;
}
select {
width: 200px;
height: 300px;
}
/* Vertical Tabs
----------------------------------*/
.ui-tabs-vertical .ui-tabs-nav {
-moz-transform: rotate(-90deg) translate(0, 100%);
-moz-transform-origin: 0% 100%;
-o-transform: rotate(-90deg) translate(0, 100%);
-o-transform-origin: 0% 100%;
-webkit-transform: rotate(-90deg) translate(0, 100%);
-webkit-transform-origin: 0% 100%;
transform: rotate(-90deg) translate(0, 100%);
transform-origin: 0% 100%;
width: 400px;
top: 373px;
position: relative;
left: -4px;
margin-bottom: -31px !important;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
}
.ui-tabs-vertical .ui-tabs-panel {
margin-left: 31px;
}
.ui-tabs-vertical .ui-tabs-nav a {
font-size: 11px;
}

View File

@ -0,0 +1,30 @@
jQuery UI Authors (http://jqueryui.com/about)
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
and logs, available at http://github.com/jquery/jquery-ui
Brandon Aaron
Paul Bakaus (paulbakaus.com)
David Bolter
Rich Caloggero
Chi Cheng (cloudream@gmail.com)
Colin Clark (http://colin.atrc.utoronto.ca/)
Michelle D'Souza
Aaron Eisenberger (aaronchi@gmail.com)
Ariel Flesler
Bohdan Ganicky
Scott González
Marc Grabanski (m@marcgrabanski.com)
Klaus Hartl (stilbuero.de)
Scott Jehl
Cody Lindley
Eduardo Lundgren (eduardolundgren@gmail.com)
Todd Parker
John Resig
Patty Toland
Ca-Phun Ung (yelotofu.com)
Keith Wood (kbwood@virginbroadband.com.au)
Maggie Costello Wachs
Richard D. Worth (rdworth.org)
Jörn Zaefferer (bassistance.de)

View File

@ -0,0 +1,278 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

View File

@ -0,0 +1,25 @@
Copyright (c) 2011 Paul Bakaus, http://jqueryui.com/
This software consists of voluntary contributions made by many
individuals (AUTHORS.txt, http://jqueryui.com/about) For exact
contribution history, see the revision history and logs, available
at http://jquery-ui.googlecode.com/svn/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion - Collapse content</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#accordion" ).accordion({
collapsible: true
});
});
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>By default, accordions always keep one section open. To allow for all sections to be be collapsible, set the <code>collapsible</code> option to true. Click on the currently open section to collapse its content pane.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion - Customize icons</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
var icons = {
header: "ui-icon-circle-arrow-e",
headerSelected: "ui-icon-circle-arrow-s"
};
$( "#accordion" ).accordion({
icons: icons
});
$( "#toggle" ).button().toggle(function() {
$( "#accordion" ).accordion( "option", "icons", false );
}, function() {
$( "#accordion" ).accordion( "option", "icons", icons );
});
});
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
</div>
<button id="toggle">Toggle icons</button>
</div><!-- End demo -->
<div class="demo-description">
<p>Customize the header icons with the <code>icons</code> option, which accepts classes for the header's default and selected (open) state. Use any class from the UI CSS framework, or create custom classes with background images.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#accordion" ).accordion();
});
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
suscipit faucibus urna.
</p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
</p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
</p>
<p>
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
</p>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>
Click headers to expand/collapse content that is broken into logical sections, much like tabs.
Optionally, toggle sections open/closed on mouseover.
</p>
<p>
The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is
usable without JavaScript.
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion - Fill space</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.mouse.js"></script>
<script src="../../ui/jquery.ui.resizable.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#accordion" ).accordion({
fillSpace: true
});
});
$(function() {
$( "#accordionResizer" ).resizable({
minHeight: 140,
resize: function() {
$( "#accordion" ).accordion( "resize" );
}
});
});
</script>
</head>
<body>
<div class="demo">
<h3 class="docs">Resize the outer container:</h3>
<div id="accordionResizer" style="padding:10px; width:350px; height:220px;" class="ui-widget-content">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
</div>
<span class="ui-icon ui-icon-grip-dotted-horizontal" style="margin:2px auto;"></span>
</div><!-- End accordionResizer -->
<div style="margin-top:7px; padding:10px; width:350px; height:50px;" class="ui-widget-content">I'm another panel</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Because the accordion is comprised of block-level elements, by default its width fills the available horizontal space. To fill the vertical space allocated by its container, set the boolean <code>fillSpace</code> option to true, and the script will automatically set the dimensions of the accordion to the height of its parent container. The accordion will also resize with its container if the container is <code>resizable</code>.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,138 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion - Open on hoverintent</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$("#accordion").accordion({
event: "click hoverintent"
});
});
var cfg = ($.hoverintent = {
sensitivity: 7,
interval: 100
});
$.event.special.hoverintent = {
setup: function() {
$( this ).bind( "mouseover", jQuery.event.special.hoverintent.handler );
},
teardown: function() {
$( this ).unbind( "mouseover", jQuery.event.special.hoverintent.handler );
},
handler: function( event ) {
var self = this,
args = arguments,
target = $( event.target ),
cX, cY, pX, pY;
function track( event ) {
cX = event.pageX;
cY = event.pageY;
};
pX = event.pageX;
pY = event.pageY;
function clear() {
target
.unbind( "mousemove", track )
.unbind( "mouseout", arguments.callee );
clearTimeout( timeout );
}
function handler() {
if ( ( Math.abs( pX - cX ) + Math.abs( pY - cY ) ) < cfg.sensitivity ) {
clear();
event.type = "hoverintent";
// prevent accessing the original event since the new event
// is fired asynchronously and the old event is no longer
// usable (#6028)
event.originalEvent = {};
jQuery.event.handle.apply( self, args );
} else {
pX = cX;
pY = cY;
timeout = setTimeout( handler, cfg.interval );
}
}
var timeout = setTimeout( handler, cfg.interval );
target.mousemove( track ).mouseout( clear );
return true;
}
};
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
suscipit faucibus urna.
</p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
</p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
</p>
<p>
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
</p>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>
Click headers to expand/collapse content that is broken into logical sections, much like tabs.
Optionally, toggle sections open/closed on mouseover.
</p>
<p>
The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is
usable without JavaScript.
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion Demos</title>
<link rel="stylesheet" href="../demos.css">
</head>
<body>
<div class="demos-nav">
<h4>Examples</h4>
<ul>
<li class="demo-config-on"><a href="default.html">Default functionality</a></li>
<li><a href="fillspace.html">Fill space</a></li>
<li><a href="no-auto-height.html">No auto height</a></li>
<li><a href="collapsible.html">Collapse content</a></li>
<li><a href="mouseover.html">Open on mouseover</a></li>
<li><a href="hoverintent.html">Open on hoverintent</a></li>
<li><a href="custom-icons.html">Customize icons</a></li>
<li><a href="sortable.html">Sortable</a></li>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion - Open on mouseover</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#accordion" ).accordion({
event: "mouseover"
});
});
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Toggle sections open/closed on mouseover with the <code>event</code> option. The default value for event is "click."</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion - No auto height</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#accordion" ).accordion({
autoHeight: false,
navigation: true
});
});
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<h3><a href="#section1">Section 1</a></h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, susceros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
<h3><a href="#section2">Section 2</a></h3>
<div>
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
</div>
<h3><a href="#section3">Section 3</a></h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
<ul>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
</ul>
<a href="#othercontent">Link to other content</a>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Setting <code>autoHeight: false</code> allows to accordion panels to keep their native height.</p>
<p>In addition, the <code>navigation</code> option is enabled, opening the panel based on the current location, eg. no-auto-height.html#panel2 would open the second panel on page load. It also finds anchors within the content, so #othercontent will open the third section, as it contains a link with that href.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Accordion - Sortable</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.mouse.js"></script>
<script src="../../ui/jquery.ui.sortable.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
/* IE has layout issues when sorting (see #5413) */
.group { zoom: 1 }
</style>
<script>
$(function() {
$( "#accordion" )
.accordion({
header: "> div > h3"
})
.sortable({
axis: "y",
handle: "h3",
stop: function( event, ui ) {
// IE doesn't register the blur when sorting
// so trigger focusout handlers to remove .ui-state-focus
ui.item.children( "h3" ).triggerHandler( "focusout" );
}
});
});
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<div class="group">
<h3><a href="#">Section 1</a></h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
</div>
<div class="group">
<h3><a href="#">Section 2</a></h3>
<div>
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
</div>
</div>
<div class="group">
<h3><a href="#">Section 3</a></h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
</div>
<div class="group">
<h3><a href="#">Section 4</a></h3>
<div>
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Drag the header to re-order panels.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Effects - addClass demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; position: relative; }
#button { padding: .5em 1em; text-decoration: none; }
#effect { width: 240px; padding: 1em; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
</style>
<script>
$(function() {
$( "#button" ).click(function() {
$( "#effect" ).addClass( "newClass", 1000, callback );
return false;
});
function callback() {
setTimeout(function() {
$( "#effect" ).removeClass( "newClass" );
}, 1500 );
}
});
</script>
</head>
<body>
<div class="demo">
<div class="toggler">
<div id="effect" class=" ui-corner-all">
Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede.
</div>
</div>
<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a>
</div><!-- End demo -->
<div class="demo-description">
<p>This demo adds a class which animates: text-indent, letter-spacing, width, height, padding, margin, and font-size.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Effects Demos</title>
<link rel="stylesheet" href="../demos.css">
</head>
<body>
<div class="demos-nav">
<h4>Examples</h4>
<ul>
<li class="demo-config-on"><a href="default.html">Default functionality</a></li>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Effects - Animate demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; position: relative; }
#button { padding: .5em 1em; text-decoration: none; }
#effect { width: 240px; height: 135px; padding: 0.4em; position: relative; background: #fff; }
#effect h3 { margin: 0; padding: 0.4em; text-align: center; }
</style>
<script>
$(function() {
$( "#button" ).toggle(
function() {
$( "#effect" ).animate({
backgroundColor: "#aa0000",
color: "#fff",
width: 500
}, 1000 );
},
function() {
$( "#effect" ).animate({
backgroundColor: "#fff",
color: "#000",
width: 240
}, 1000 );
}
);
});
</script>
</head>
<body>
<div class="demo">
<div class="toggler">
<div id="effect" class="ui-widget-content ui-corner-all">
<h3 class="ui-widget-header ui-corner-all">Animate</h3>
<p>
Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi.
</p>
</div>
</div>
<a href="#" id="button" class="ui-state-default ui-corner-all">Toggle Effect</a>
</div><!-- End demo -->
<div class="demo-description">
<p>Click the button above to preview the effect.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Effects Demos</title>
<link rel="stylesheet" href="../demos.css">
</head>
<body>
<div class="demos-nav">
<h4>Examples</h4>
<ul>
<li class="demo-config-on"><a href="default.html">Default functionality</a></li>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Categories</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-autocomplete-category {
font-weight: bold;
padding: .2em .4em;
margin: .8em 0 .2em;
line-height: 1.5;
}
</style>
<script>
$.widget( "custom.catcomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
var self = this,
currentCategory = "";
$.each( items, function( index, item ) {
if ( item.category != currentCategory ) {
ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
currentCategory = item.category;
}
self._renderItem( ul, item );
});
}
});
</script>
<script>
$(function() {
var data = [
{ label: "anders", category: "" },
{ label: "andreas", category: "" },
{ label: "antal", category: "" },
{ label: "annhhx10", category: "Products" },
{ label: "annk K12", category: "Products" },
{ label: "annttop C13", category: "Products" },
{ label: "anders andersson", category: "People" },
{ label: "andreas andersson", category: "People" },
{ label: "andreas johnson", category: "People" }
];
$( "#search" ).catcomplete({
delay: 0,
source: data
});
});
</script>
</head>
<body>
<div class="demo">
<label for="search">Search: </label>
<input id="search" />
</div><!-- End demo -->
<div class="demo-description">
<p>A categorized search result. Try typing "a" or "n".</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,174 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Combobox</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-button { margin-left: -1px; }
.ui-button-icon-only .ui-button-text { padding: 0.35em; }
.ui-autocomplete-input { margin: 0; padding: 0.48em 0 0.47em 0.45em; }
</style>
<script>
(function( $ ) {
$.widget( "ui.combobox", {
_create: function() {
var self = this,
select = this.element.hide(),
selected = select.children( ":selected" ),
value = selected.val() ? selected.text() : "";
var input = this.input = $( "<input>" )
.insertAfter( select )
.val( value )
.autocomplete({
delay: 0,
minLength: 0,
source: function( request, response ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
response( select.children( "option" ).map(function() {
var text = $( this ).text();
if ( this.value && ( !request.term || matcher.test(text) ) )
return {
label: text.replace(
new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" +
$.ui.autocomplete.escapeRegex(request.term) +
")(?![^<>]*>)(?![^&;]+;)", "gi"
), "<strong>$1</strong>" ),
value: text,
option: this
};
}) );
},
select: function( event, ui ) {
ui.item.option.selected = true;
self._trigger( "selected", event, {
item: ui.item.option
});
},
change: function( event, ui ) {
if ( !ui.item ) {
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
valid = false;
select.children( "option" ).each(function() {
if ( $( this ).text().match( matcher ) ) {
this.selected = valid = true;
return false;
}
});
if ( !valid ) {
// remove invalid value, as it didn't match anything
$( this ).val( "" );
select.val( "" );
input.data( "autocomplete" ).term = "";
return false;
}
}
}
})
.addClass( "ui-widget ui-widget-content ui-corner-left" );
input.data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( "<a>" + item.label + "</a>" )
.appendTo( ul );
};
this.button = $( "<button type='button'>&nbsp;</button>" )
.attr( "tabIndex", -1 )
.attr( "title", "Show All Items" )
.insertAfter( input )
.button({
icons: {
primary: "ui-icon-triangle-1-s"
},
text: false
})
.removeClass( "ui-corner-all" )
.addClass( "ui-corner-right ui-button-icon" )
.click(function() {
// close if already visible
if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
input.autocomplete( "close" );
return;
}
// work around a bug (likely same cause as #5265)
$( this ).blur();
// pass empty string as value to search for, displaying all results
input.autocomplete( "search", "" );
input.focus();
});
},
destroy: function() {
this.input.remove();
this.button.remove();
this.element.show();
$.Widget.prototype.destroy.call( this );
}
});
})( jQuery );
$(function() {
$( "#combobox" ).combobox();
$( "#toggle" ).click(function() {
$( "#combobox" ).toggle();
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label>Your preferred programming language: </label>
<select id="combobox">
<option value="">Select one...</option>
<option value="ActionScript">ActionScript</option>
<option value="AppleScript">AppleScript</option>
<option value="Asp">Asp</option>
<option value="BASIC">BASIC</option>
<option value="C">C</option>
<option value="C++">C++</option>
<option value="Clojure">Clojure</option>
<option value="COBOL">COBOL</option>
<option value="ColdFusion">ColdFusion</option>
<option value="Erlang">Erlang</option>
<option value="Fortran">Fortran</option>
<option value="Groovy">Groovy</option>
<option value="Haskell">Haskell</option>
<option value="Java">Java</option>
<option value="JavaScript">JavaScript</option>
<option value="Lisp">Lisp</option>
<option value="Perl">Perl</option>
<option value="PHP">PHP</option>
<option value="Python">Python</option>
<option value="Ruby">Ruby</option>
<option value="Scala">Scala</option>
<option value="Scheme">Scheme</option>
</select>
</div>
<button id="toggle">Show underlying select</button>
</div><!-- End demo -->
<div class="demo-description">
<p>A custom widget built by composition of Autocomplete and Button. You can either type something into the field to get filtered suggestions based on your input, or use the button to get the full list of selections.</p>
<p>The input is read from an existing select-element for progressive enhancement, passed to Autocomplete with a customized source-option.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Custom data and display</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
#project-label {
display: block;
font-weight: bold;
margin-bottom: 1em;
}
#project-icon {
float: left;
height: 32px;
width: 32px;
}
#project-description {
margin: 0;
padding: 0;
}
</style>
<script>
$(function() {
var projects = [
{
value: "jquery",
label: "jQuery",
desc: "the write less, do more, JavaScript library",
icon: "jquery_32x32.png"
},
{
value: "jquery-ui",
label: "jQuery UI",
desc: "the official user interface library for jQuery",
icon: "jqueryui_32x32.png"
},
{
value: "sizzlejs",
label: "Sizzle JS",
desc: "a pure-JavaScript CSS selector engine",
icon: "sizzlejs_32x32.png"
}
];
$( "#project" ).autocomplete({
minLength: 0,
source: projects,
focus: function( event, ui ) {
$( "#project" ).val( ui.item.label );
return false;
},
select: function( event, ui ) {
$( "#project" ).val( ui.item.label );
$( "#project-id" ).val( ui.item.value );
$( "#project-description" ).html( ui.item.desc );
$( "#project-icon" ).attr( "src", "images/" + ui.item.icon );
return false;
}
})
.data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
.appendTo( ul );
};
});
</script>
</head>
<body>
<div class="demo">
<div id="project-label">Select a project (type "j" for a start):</div>
<img id="project-icon" src="images/transparent_1x1.png" class="ui-state-default"/>
<input id="project"/>
<input type="hidden" id="project-id"/>
<p id="project-description"></p>
</div><!-- End demo -->
<div class="demo-description">
<p>You can use your own custom data formats and displays by simply overriding the default focus and select actions.</p>
<p>Try typing "j" to get a list of projects or just press the down arrow.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags" />
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.</p>
<p>The datasource is a simple JavaScript array, provided to the widget using the source-option.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Accent folding</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
var names = [ "Jörn Zaefferer", "Scott González", "John Resig" ];
var accentMap = {
"á": "a",
"ö": "o"
};
var normalize = function( term ) {
var ret = "";
for ( var i = 0; i < term.length; i++ ) {
ret += accentMap[ term.charAt(i) ] || term.charAt(i);
}
return ret;
};
$( "#developer" ).autocomplete({
source: function( request, response ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
response( $.grep( names, function( value ) {
value = value.label || value.value || value;
return matcher.test( value ) || matcher.test( normalize( value ) );
}) );
}
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<form>
<label for="developer">Developer: </label>
<input id="developer" />
</form>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>The autocomplete field uses a custom source option which will match results that have accented characters even when the text field doesn't contain accented characters. However if the you type in accented characters in the text field it is smart enough not to show results that aren't accented.</p>
<p>Try typing "Jo" to see "John" and "Jörn", then type "Jö" to see only "Jörn".</p>
</div><!-- End demo-description -->
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete Demos</title>
<link rel="stylesheet" href="../demos.css">
</head>
<body>
<div class="demos-nav">
<h4>Examples</h4>
<ul>
<li class="demo-config-on"><a href="default.html">Default functionality</a></li>
<li><a href="remote.html">Remote datasource</a></li>
<li><a href="remote-with-cache.html">Remote with caching</a></li>
<li><a href="remote-jsonp.html">Remote JSONP datasource</a></li>
<li><a href="maxheight.html">Scrollable results</a></li>
<li><a href="combobox.html">Combobox</a></li>
<li><a href="custom-data.html">Custom data and display</a></li>
<li><a href="xml.html">XML data parsed once</a></li>
<li><a href="categories.html">Categories</a></li>
<li><a href="folding.html">Accent folding</a></li>
<li><a href="multiple.html">Multiple values</a></li>
<li><a href="multiple-remote.html">Multiple, remote</a></li>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<geonames style="MEDIUM">
<totalResultsCount>6987</totalResultsCount>
<geoname>
<name>London</name>
<lat>51.5084152563931</lat>
<lng>-0.125532746315002</lng>
<geonameId>2643743</geonameId>
<countryCode>GB</countryCode>
<countryName>United Kingdom</countryName>
<fcl>P</fcl>
<fcode>PPLC</fcode>
</geoname>
<geoname>
<name>London</name>
<lat>42.983389283</lat>
<lng>-81.233042387</lng>
<geonameId>6058560</geonameId>
<countryCode>CA</countryCode>
<countryName>Canada</countryName>
<fcl>P</fcl>
<fcode>PPL</fcode>
</geoname>
<geoname>
<name>East London</name>
<lat>-33.0152850934643</lat>
<lng>27.9116249084473</lng>
<geonameId>1006984</geonameId>
<countryCode>ZA</countryCode>
<countryName>South Africa</countryName>
<fcl>P</fcl>
<fcode>PPL</fcode>
</geoname>
<geoname>
<name>City</name>
<lat>51.5133363996235</lat>
<lng>-0.0890064239501953</lng>
<geonameId>2643744</geonameId>
<countryCode>GB</countryCode>
<countryName>United Kingdom</countryName>
<fcl>A</fcl>
<fcode>ADM2</fcode>
</geoname>
<geoname>
<name>London</name>
<lat>37.1289771</lat>
<lng>-84.0832646</lng>
<geonameId>4298960</geonameId>
<countryCode>US</countryCode>
<countryName>United States</countryName>
<fcl>P</fcl>
<fcode>PPL</fcode>
</geoname>
<geoname>
<name>The Tower of London</name>
<lat>51.5082349601834</lat>
<lng>-0.0763034820556641</lng>
<geonameId>6286786</geonameId>
<countryCode>GB</countryCode>
<countryName>United Kingdom</countryName>
<fcl>S</fcl>
<fcode>CSTL</fcode>
</geoname>
<geoname>
<name>London Reefs</name>
<lat>8.85</lat>
<lng>112.5333333</lng>
<geonameId>1879967</geonameId>
<countryCode> </countryCode>
<countryName> </countryName>
<fcl>U</fcl>
<fcode>RFSU</fcode>
</geoname>
<geoname>
<name>Greater London</name>
<lat>51.5</lat>
<lng>-0.1666667</lng>
<geonameId>2648110</geonameId>
<countryCode>GB</countryCode>
<countryName>United Kingdom</countryName>
<fcl>A</fcl>
<fcode>ADM2</fcode>
</geoname>
<geoname>
<name>London</name>
<lat>46.1666667</lat>
<lng>6.0166667</lng>
<geonameId>2661811</geonameId>
<countryCode>CH</countryCode>
<countryName>Switzerland</countryName>
<fcl>H</fcl>
<fcode>STM</fcode>
</geoname>
<geoname>
<name>London Borough of Islington</name>
<lat>51.5333333</lat>
<lng>-0.1333333</lng>
<geonameId>3333156</geonameId>
<countryCode>GB</countryCode>
<countryName>United Kingdom</countryName>
<fcl>A</fcl>
<fcode>ADM2</fcode>
</geoname>
</geonames>

View File

@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Scrollable results</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-autocomplete {
max-height: 100px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
/* add padding to account for vertical scrollbar */
padding-right: 20px;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html .ui-autocomplete {
height: 100px;
}
</style>
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags" />
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>When displaying a long list of options, you can simply set the max-height for the autocomplete menu to prevent the menu from growing too large. Try typing "a" or "s" above to get a long list of results that you can scroll through.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Multiple, remote</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
</style>
<script>
$(function() {
function split( val ) {
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
$( "#birds" )
// don't navigate away from the field on tab when selecting an item
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).data( "autocomplete" ).menu.active ) {
event.preventDefault();
}
})
.autocomplete({
source: function( request, response ) {
$.getJSON( "search.php", {
term: extractLast( request.term )
}, response );
},
search: function() {
// custom minLength
var term = extractLast( this.value );
if ( term.length < 2 ) {
return false;
}
},
focus: function() {
// prevent value inserted on focus
return false;
},
select: function( event, ui ) {
var terms = split( this.value );
// remove the current input
terms.pop();
// add the selected item
terms.push( ui.item.value );
// add placeholder to get the comma-and-space at the end
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="birds">Birds: </label>
<input id="birds" size="50" />
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Usage: Enter at least two characters to get bird name suggestions. Select a value to continue adding more names.</p>
<p>This is an example showing how to use the source-option along with some events to enable autocompleting multiple values into a single field.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Multiple values</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
function split( val ) {
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
$( "#tags" )
// don't navigate away from the field on tab when selecting an item
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).data( "autocomplete" ).menu.active ) {
event.preventDefault();
}
})
.autocomplete({
minLength: 0,
source: function( request, response ) {
// delegate back to autocomplete, but extract the last term
response( $.ui.autocomplete.filter(
availableTags, extractLast( request.term ) ) );
},
focus: function() {
// prevent value inserted on focus
return false;
},
select: function( event, ui ) {
var terms = split( this.value );
// remove the current input
terms.pop();
// add the selected item
terms.push( ui.item.value );
// add placeholder to get the comma-and-space at the end
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tag programming languages: </label>
<input id="tags" size="50" />
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Usage: Type something, eg. "j" to see suggestions for tagging with programming languages. Select a value, then continue typing to add more.</p>
<p>This is an example showing how to use the source-option along with some events to enable autocompleting multiple values into a single field.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Remote JSONP datasource</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
#city { width: 25em; }
</style>
<script>
$(function() {
function log( message ) {
$( "<div/>" ).text( message ).prependTo( "#log" );
$( "#log" ).scrollTop( 0 );
}
$( "#city" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
name_startsWith: request.term
},
success: function( data ) {
response( $.map( data.geonames, function( item ) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name
}
}));
}
});
},
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.label :
"Nothing selected, input was " + this.value);
},
open: function() {
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="city">Your city: </label>
<input id="city" />
Powered by <a href="http://geonames.org">geonames.org</a>
</div>
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
Result:
<div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are cities, displayed when at least two characters are entered into the field.</p>
<p>In this case, the datasource is the <a href="http://geonames.org">geonames.org webservice</a>. While only the city name itself ends up in the input after selecting an element, more info is displayed in the suggestions to help find the right entry. That data is also available in callbacks, as illustrated by the Result area below the input.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Remote with caching</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
</style>
<script>
$(function() {
var cache = {},
lastXhr;
$( "#birds" ).autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term;
if ( term in cache ) {
response( cache[ term ] );
return;
}
lastXhr = $.getJSON( "search.php", request, function( data, status, xhr ) {
cache[ term ] = data;
if ( xhr === lastXhr ) {
response( data );
}
});
}
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="birds">Birds: </label>
<input id="birds" />
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are bird names, displayed when at least two characters are entered into the field.</p>
<p>Similar to the remote datasource demo, though this adds some local caching to improve performance. The cache here saves just one query, and could be extended to cache multiple values, one for each term.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Remote datasource</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
</style>
<script>
$(function() {
function log( message ) {
$( "<div/>" ).text( message ).prependTo( "#log" );
$( "#log" ).scrollTop( 0 );
}
$( "#birds" ).autocomplete({
source: "search.php",
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="birds">Birds: </label>
<input id="birds" />
</div>
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
Result:
<div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are bird names, displayed when at least two characters are entered into the field.</p>
<p>The datasource is a server-side script which returns JSON data, specified via a simple URL for the source-option. In addition, the minLength-option is set to 2 to avoid queries that would return too many results and the select-event is used to display some feedback.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,640 @@
<?php
$q = strtolower($_GET["term"]);
if (!$q) return;
$items = array(
"Great Bittern"=>"Botaurus stellaris",
"Little Grebe"=>"Tachybaptus ruficollis",
"Black-necked Grebe"=>"Podiceps nigricollis",
"Little Bittern"=>"Ixobrychus minutus",
"Black-crowned Night Heron"=>"Nycticorax nycticorax",
"Purple Heron"=>"Ardea purpurea",
"White Stork"=>"Ciconia ciconia",
"Spoonbill"=>"Platalea leucorodia",
"Red-crested Pochard"=>"Netta rufina",
"Common Eider"=>"Somateria mollissima",
"Red Kite"=>"Milvus milvus",
"Hen Harrier"=>"Circus cyaneus",
"Montagu`s Harrier"=>"Circus pygargus",
"Black Grouse"=>"Tetrao tetrix",
"Grey Partridge"=>"Perdix perdix",
"Spotted Crake"=>"Porzana porzana",
"Corncrake"=>"Crex crex",
"Common Crane"=>"Grus grus",
"Avocet"=>"Recurvirostra avosetta",
"Stone Curlew"=>"Burhinus oedicnemus",
"Common Ringed Plover"=>"Charadrius hiaticula",
"Kentish Plover"=>"Charadrius alexandrinus",
"Ruff"=>"Philomachus pugnax",
"Common Snipe"=>"Gallinago gallinago",
"Black-tailed Godwit"=>"Limosa limosa",
"Common Redshank"=>"Tringa totanus",
"Sandwich Tern"=>"Sterna sandvicensis",
"Common Tern"=>"Sterna hirundo",
"Arctic Tern"=>"Sterna paradisaea",
"Little Tern"=>"Sternula albifrons",
"Black Tern"=>"Chlidonias niger",
"Barn Owl"=>"Tyto alba",
"Little Owl"=>"Athene noctua",
"Short-eared Owl"=>"Asio flammeus",
"European Nightjar"=>"Caprimulgus europaeus",
"Common Kingfisher"=>"Alcedo atthis",
"Eurasian Hoopoe"=>"Upupa epops",
"Eurasian Wryneck"=>"Jynx torquilla",
"European Green Woodpecker"=>"Picus viridis",
"Crested Lark"=>"Galerida cristata",
"White-headed Duck"=>"Oxyura leucocephala",
"Pale-bellied Brent Goose"=>"Branta hrota",
"Tawny Pipit"=>"Anthus campestris",
"Whinchat"=>"Saxicola rubetra",
"European Stonechat"=>"Saxicola rubicola",
"Northern Wheatear"=>"Oenanthe oenanthe",
"Savi`s Warbler"=>"Locustella luscinioides",
"Sedge Warbler"=>"Acrocephalus schoenobaenus",
"Great Reed Warbler"=>"Acrocephalus arundinaceus",
"Bearded Reedling"=>"Panurus biarmicus",
"Red-backed Shrike"=>"Lanius collurio",
"Great Grey Shrike"=>"Lanius excubitor",
"Woodchat Shrike"=>"Lanius senator",
"Common Raven"=>"Corvus corax",
"Yellowhammer"=>"Emberiza citrinella",
"Ortolan Bunting"=>"Emberiza hortulana",
"Corn Bunting"=>"Emberiza calandra",
"Great Cormorant"=>"Phalacrocorax carbo",
"Hawfinch"=>"Coccothraustes coccothraustes",
"Common Shelduck"=>"Tadorna tadorna",
"Bluethroat"=>"Luscinia svecica",
"Grey Heron"=>"Ardea cinerea",
"Barn Swallow"=>"Hirundo rustica",
"Hooded Crow"=>"Corvus cornix",
"Dunlin"=>"Calidris alpina",
"Eurasian Pied Flycatcher"=>"Ficedula hypoleuca",
"Eurasian Nuthatch"=>"Sitta europaea",
"Short-toed Tree Creeper"=>"Certhia brachydactyla",
"Wood Lark"=>"Lullula arborea",
"Tree Pipit"=>"Anthus trivialis",
"Eurasian Hobby"=>"Falco subbuteo",
"Marsh Warbler"=>"Acrocephalus palustris",
"Wood Sandpiper"=>"Tringa glareola",
"Tawny Owl"=>"Strix aluco",
"Lesser Whitethroat"=>"Sylvia curruca",
"Barnacle Goose"=>"Branta leucopsis",
"Common Goldeneye"=>"Bucephala clangula",
"Western Marsh Harrier"=>"Circus aeruginosus",
"Common Buzzard"=>"Buteo buteo",
"Sanderling"=>"Calidris alba",
"Little Gull"=>"Larus minutus",
"Eurasian Magpie"=>"Pica pica",
"Willow Warbler"=>"Phylloscopus trochilus",
"Wood Warbler"=>"Phylloscopus sibilatrix",
"Great Crested Grebe"=>"Podiceps cristatus",
"Eurasian Jay"=>"Garrulus glandarius",
"Common Redstart"=>"Phoenicurus phoenicurus",
"Blue-headed Wagtail"=>"Motacilla flava",
"Common Swift"=>"Apus apus",
"Marsh Tit"=>"Poecile palustris",
"Goldcrest"=>"Regulus regulus",
"European Golden Plover"=>"Pluvialis apricaria",
"Eurasian Bullfinch"=>"Pyrrhula pyrrhula",
"Common Whitethroat"=>"Sylvia communis",
"Meadow Pipit"=>"Anthus pratensis",
"Greylag Goose"=>"Anser anser",
"Spotted Flycatcher"=>"Muscicapa striata",
"European Greenfinch"=>"Carduelis chloris",
"Common Greenshank"=>"Tringa nebularia",
"Great Spotted Woodpecker"=>"Dendrocopos major",
"Greater Canada Goose"=>"Branta canadensis",
"Mistle Thrush"=>"Turdus viscivorus",
"Great Black-backed Gull"=>"Larus marinus",
"Goosander"=>"Mergus merganser",
"Great Egret"=>"Casmerodius albus",
"Northern Goshawk"=>"Accipiter gentilis",
"Dunnock"=>"Prunella modularis",
"Stock Dove"=>"Columba oenas",
"Common Wood Pigeon"=>"Columba palumbus",
"Eurasian Woodcock"=>"Scolopax rusticola",
"House Sparrow"=>"Passer domesticus",
"Common House Martin"=>"Delichon urbicum",
"Red Knot"=>"Calidris canutus",
"Western Jackdaw"=>"Corvus monedula",
"Brambling"=>"Fringilla montifringilla",
"Northern Lapwing"=>"Vanellus vanellus",
"European Reed Warbler"=>"Acrocephalus scirpaceus",
"Lesser Black-backed Gull"=>"Larus fuscus",
"Little Egret"=>"Egretta garzetta",
"Little Stint"=>"Calidris minuta",
"Common Linnet"=>"Carduelis cannabina",
"Mute Swan"=>"Cygnus olor",
"Common Cuckoo"=>"Cuculus canorus",
"Black-headed Gull"=>"Larus ridibundus",
"Greater White-fronted Goose"=>"Anser albifrons",
"Great Tit"=>"Parus major",
"Redwing"=>"Turdus iliacus",
"Gadwall"=>"Anas strepera",
"Fieldfare"=>"Turdus pilaris",
"Tufted Duck"=>"Aythya fuligula",
"Crested Tit"=>"Lophophanes cristatus",
"Willow Tit"=>"Poecile montanus",
"Eurasian Coot"=>"Fulica atra",
"Common Blackbird"=>"Turdus merula",
"Smew"=>"Mergus albellus",
"Common Sandpiper"=>"Actitis hypoleucos",
"Sand Martin"=>"Riparia riparia",
"Purple Sandpiper"=>"Calidris maritima",
"Northern Pintail"=>"Anas acuta",
"Blue Tit"=>"Cyanistes caeruleus",
"European Goldfinch"=>"Carduelis carduelis",
"Eurasian Whimbrel"=>"Numenius phaeopus",
"Common Reed Bunting"=>"Emberiza schoeniclus",
"Eurasian Tree Sparrow"=>"Passer montanus",
"Rook"=>"Corvus frugilegus",
"European Robin"=>"Erithacus rubecula",
"Bar-tailed Godwit"=>"Limosa lapponica",
"Dark-bellied Brent Goose"=>"Branta bernicla",
"Eurasian Oystercatcher"=>"Haematopus ostralegus",
"Eurasian Siskin"=>"Carduelis spinus",
"Northern Shoveler"=>"Anas clypeata",
"Eurasian Wigeon"=>"Anas penelope",
"Eurasian Sparrow Hawk"=>"Accipiter nisus",
"Icterine Warbler"=>"Hippolais icterina",
"Common Starling"=>"Sturnus vulgaris",
"Long-tailed Tit"=>"Aegithalos caudatus",
"Ruddy Turnstone"=>"Arenaria interpres",
"Mew Gull"=>"Larus canus",
"Common Pochard"=>"Aythya ferina",
"Common Chiffchaff"=>"Phylloscopus collybita",
"Greater Scaup"=>"Aythya marila",
"Common Kestrel"=>"Falco tinnunculus",
"Garden Warbler"=>"Sylvia borin",
"Eurasian Collared Dove"=>"Streptopelia decaocto",
"Eurasian Skylark"=>"Alauda arvensis",
"Common Chaffinch"=>"Fringilla coelebs",
"Common Moorhen"=>"Gallinula chloropus",
"Water Pipit"=>"Anthus spinoletta",
"Mallard"=>"Anas platyrhynchos",
"Winter Wren"=>"Troglodytes troglodytes",
"Common Teal"=>"Anas crecca",
"Green Sandpiper"=>"Tringa ochropus",
"White Wagtail"=>"Motacilla alba",
"Eurasian Curlew"=>"Numenius arquata",
"Song Thrush"=>"Turdus philomelos",
"European Herring Gull"=>"Larus argentatus",
"Grey Plover"=>"Pluvialis squatarola",
"Carrion Crow"=>"Corvus corone",
"Coal Tit"=>"Periparus ater",
"Spotted Redshank"=>"Tringa erythropus",
"Blackcap"=>"Sylvia atricapilla",
"Egyptian Vulture"=>"Neophron percnopterus",
"Razorbill"=>"Alca torda",
"Alpine Swift"=>"Apus melba",
"Long-legged Buzzard"=>"Buteo rufinus",
"Audouin`s Gull"=>"Larus audouinii",
"Balearic Shearwater"=>"Puffinus mauretanicus",
"Upland Sandpiper"=>"Bartramia longicauda",
"Greater Spotted Eagle"=>"Aquila clanga",
"Ring Ouzel"=>"Turdus torquatus",
"Yellow-browed Warbler"=>"Phylloscopus inornatus",
"Blue Rock Thrush"=>"Monticola solitarius",
"Buff-breasted Sandpiper"=>"Tryngites subruficollis",
"Jack Snipe"=>"Lymnocryptes minimus",
"White-rumped Sandpiper"=>"Calidris fuscicollis",
"Ruddy Shelduck"=>"Tadorna ferruginea",
"Cetti's Warbler"=>"Cettia cetti",
"Citrine Wagtail"=>"Motacilla citreola",
"Roseate Tern"=>"Sterna dougallii",
"Black-legged Kittiwake"=>"Rissa tridactyla",
"Pygmy Cormorant"=>"Phalacrocorax pygmeus",
"Booted Eagle"=>"Aquila pennata",
"Lesser White-fronted Goose"=>"Anser erythropus",
"Little Bunting"=>"Emberiza pusilla",
"Eleonora's Falcon"=>"Falco eleonorae",
"European Serin"=>"Serinus serinus",
"Twite"=>"Carduelis flavirostris",
"Yellow-legged Gull"=>"Larus michahellis",
"Gyr Falcon"=>"Falco rusticolus",
"Greenish Warbler"=>"Phylloscopus trochiloides",
"Red-necked Phalarope"=>"Phalaropus lobatus",
"Mealy Redpoll"=>"Carduelis flammea",
"Glaucous Gull"=>"Larus hyperboreus",
"Great Skua"=>"Stercorarius skua",
"Great Bustard"=>"Otis tarda",
"Velvet Scoter"=>"Melanitta fusca",
"Pine Grosbeak"=>"Pinicola enucleator",
"House Crow"=>"Corvus splendens",
"Hume`s Leaf Warbler"=>"Phylloscopus humei",
"Great Northern Loon"=>"Gavia immer",
"Long-tailed Duck"=>"Clangula hyemalis",
"Lapland Longspur"=>"Calcarius lapponicus",
"Northern Gannet"=>"Morus bassanus",
"Eastern Imperial Eagle"=>"Aquila heliaca",
"Little Auk"=>"Alle alle",
"Lesser Spotted Woodpecker"=>"Dendrocopos minor",
"Iceland Gull"=>"Larus glaucoides",
"Parasitic Jaeger"=>"Stercorarius parasiticus",
"Bewick`s Swan"=>"Cygnus bewickii",
"Little Bustard"=>"Tetrax tetrax",
"Little Crake"=>"Porzana parva",
"Baillon`s Crake"=>"Porzana pusilla",
"Long-tailed Jaeger"=>"Stercorarius longicaudus",
"King Eider"=>"Somateria spectabilis",
"Greater Short-toed Lark"=>"Calandrella brachydactyla",
"Houbara Bustard"=>"Chlamydotis undulata",
"Curlew Sandpiper"=>"Calidris ferruginea",
"Common Crossbill"=>"Loxia curvirostra",
"European Shag"=>"Phalacrocorax aristotelis",
"Horned Grebe"=>"Podiceps auritus",
"Common Quail"=>"Coturnix coturnix",
"Bearded Vulture"=>"Gypaetus barbatus",
"Lanner Falcon"=>"Falco biarmicus",
"Middle Spotted Woodpecker"=>"Dendrocopos medius",
"Pomarine Jaeger"=>"Stercorarius pomarinus",
"Red-breasted Merganser"=>"Mergus serrator",
"Eurasian Black Vulture"=>"Aegypius monachus",
"Eurasian Dotterel"=>"Charadrius morinellus",
"Common Nightingale"=>"Luscinia megarhynchos",
"Northern willow warbler"=>"Phylloscopus trochilus acredula",
"Manx Shearwater"=>"Puffinus puffinus",
"Northern Fulmar"=>"Fulmarus glacialis",
"Eurasian Eagle Owl"=>"Bubo bubo",
"Orphean Warbler"=>"Sylvia hortensis",
"Melodious Warbler"=>"Hippolais polyglotta",
"Pallas's Leaf Warbler"=>"Phylloscopus proregulus",
"Atlantic Puffin"=>"Fratercula arctica",
"Black-throated Loon"=>"Gavia arctica",
"Bohemian Waxwing"=>"Bombycilla garrulus",
"Marsh Sandpiper"=>"Tringa stagnatilis",
"Great Snipe"=>"Gallinago media",
"Squacco Heron"=>"Ardeola ralloides",
"Long-eared Owl"=>"Asio otus",
"Caspian Tern"=>"Hydroprogne caspia",
"Red-breasted Goose"=>"Branta ruficollis",
"Red-throated Loon"=>"Gavia stellata",
"Common Rosefinch"=>"Carpodacus erythrinus",
"Red-footed Falcon"=>"Falco vespertinus",
"Ross's Goose"=>"Anser rossii",
"Red Phalarope"=>"Phalaropus fulicarius",
"Pied Wagtail"=>"Motacilla yarrellii",
"Rose-coloured Starling"=>"Sturnus roseus",
"Rough-legged Buzzard"=>"Buteo lagopus",
"Saker Falcon"=>"Falco cherrug",
"European Roller"=>"Coracias garrulus",
"Short-toed Eagle"=>"Circaetus gallicus",
"Peregrine Falcon"=>"Falco peregrinus",
"Merlin"=>"Falco columbarius",
"Snow Goose"=>"Anser caerulescens",
"Snowy Owl"=>"Bubo scandiacus",
"Snow Bunting"=>"Plectrophenax nivalis",
"Common Grasshopper Warbler"=>"Locustella naevia",
"Golden Eagle"=>"Aquila chrysaetos",
"Black-winged Stilt"=>"Himantopus himantopus",
"Steppe Eagle"=>"Aquila nipalensis",
"Pallid Harrier"=>"Circus macrourus",
"European Storm-petrel"=>"Hydrobates pelagicus",
"Horned Lark"=>"Eremophila alpestris",
"Eurasian Treecreeper"=>"Certhia familiaris",
"Taiga Bean Goose"=>"Anser fabalis",
"Temminck`s Stint"=>"Calidris temminckii",
"Terek Sandpiper"=>"Xenus cinereus",
"Tundra Bean Goose"=>"Anser serrirostris",
"European Turtle Dove"=>"Streptopelia turtur",
"Leach`s Storm-petrel"=>"Oceanodroma leucorhoa",
"Eurasian Griffon Vulture"=>"Gyps fulvus",
"Paddyfield Warbler"=>"Acrocephalus agricola",
"Osprey"=>"Pandion haliaetus",
"Firecrest"=>"Regulus ignicapilla",
"Water Rail"=>"Rallus aquaticus",
"European Honey Buzzard"=>"Pernis apivorus",
"Eurasian Golden Oriole"=>"Oriolus oriolus",
"Whooper Swan"=>"Cygnus cygnus",
"Two-barred Crossbill"=>"Loxia leucoptera",
"White-tailed Eagle"=>"Haliaeetus albicilla",
"Atlantic Murre"=>"Uria aalge",
"Garganey"=>"Anas querquedula",
"Black Redstart"=>"Phoenicurus ochruros",
"Common Scoter"=>"Melanitta nigra",
"Rock Pipit"=>"Anthus petrosus",
"Lesser Spotted Eagle"=>"Aquila pomarina",
"Cattle Egret"=>"Bubulcus ibis",
"White-winged Black Tern"=>"Chlidonias leucopterus",
"Black Stork"=>"Ciconia nigra",
"Mediterranean Gull"=>"Larus melanocephalus",
"Black Kite"=>"Milvus migrans",
"Yellow Wagtail"=>"Motacilla flavissima",
"Red-necked Grebe"=>"Podiceps grisegena",
"Gull-billed Tern"=>"Gelochelidon nilotica",
"Pectoral Sandpiper"=>"Calidris melanotos",
"Barred Warbler"=>"Sylvia nisoria",
"Red-throated Pipit"=>"Anthus cervinus",
"Grey Wagtail"=>"Motacilla cinerea",
"Richard`s Pipit"=>"Anthus richardi",
"Black Woodpecker"=>"Dryocopus martius",
"Little Ringed Plover"=>"Charadrius dubius",
"Whiskered Tern"=>"Chlidonias hybrida",
"Lesser Redpoll"=>"Carduelis cabaret",
"Pallas' Bunting"=>"Emberiza pallasi",
"Ferruginous Duck"=>"Aythya nyroca",
"Whistling Swan"=>"Cygnus columbianus",
"Black Brant"=>"Branta nigricans",
"Marbled Teal"=>"Marmaronetta angustirostris",
"Canvasback"=>"Aythya valisineria",
"Redhead"=>"Aythya americana",
"Lesser Scaup"=>"Aythya affinis",
"Steller`s Eider"=>"Polysticta stelleri",
"Spectacled Eider"=>"Somateria fischeri",
"Harlequin Duck"=>"Histronicus histrionicus",
"Black Scoter"=>"Melanitta americana",
"Surf Scoter"=>"Melanitta perspicillata",
"Barrow`s Goldeneye"=>"Bucephala islandica",
"Falcated Duck"=>"Anas falcata",
"American Wigeon"=>"Anas americana",
"Blue-winged Teal"=>"Anas discors",
"American Black Duck"=>"Anas rubripes",
"Baikal Teal"=>"Anas formosa",
"Green-Winged Teal"=>"Anas carolinensis",
"Hazel Grouse"=>"Bonasa bonasia",
"Rock Partridge"=>"Alectoris graeca",
"Red-legged Partridge"=>"Alectoris rufa",
"Yellow-billed Loon"=>"Gavia adamsii",
"Cory`s Shearwater"=>"Calonectris borealis",
"Madeiran Storm-Petrel"=>"Oceanodroma castro",
"Great White Pelican"=>"Pelecanus onocrotalus",
"Dalmatian Pelican"=>"Pelecanus crispus",
"American Bittern"=>"Botaurus lentiginosus",
"Glossy Ibis"=>"Plegadis falcinellus",
"Spanish Imperial Eagle"=>"Aquila adalberti",
"Lesser Kestrel"=>"Falco naumanni",
"Houbara Bustard"=>"Chlamydotis undulata",
"Crab-Plover"=>"Dromas ardeola",
"Cream-coloured Courser"=>"Cursorius cursor",
"Collared Pratincole"=>"Glareola pratincola",
"Black-winged Pratincole"=>"Glareola nordmanni",
"Killdeer"=>"Charadrius vociferus",
"Lesser Sand Plover"=>"Charadrius mongolus",
"Greater Sand Plover"=>"Charadrius leschenaultii",
"Caspian Plover"=>"Charadrius asiaticus",
"American Golden Plover"=>"Pluvialis dominica",
"Pacific Golden Plover"=>"Pluvialis fulva",
"Sharp-tailed Sandpiper"=>"Calidris acuminata",
"Broad-billed Sandpiper"=>"Limicola falcinellus",
"Spoon-Billed Sandpiper"=>"Eurynorhynchus pygmaeus",
"Short-Billed Dowitcher"=>"Limnodromus griseus",
"Long-billed Dowitcher"=>"Limnodromus scolopaceus",
"Hudsonian Godwit"=>"Limosa haemastica",
"Little Curlew"=>"Numenius minutus",
"Lesser Yellowlegs"=>"Tringa flavipes",
"Wilson`s Phalarope"=>"Phalaropus tricolor",
"Pallas`s Gull"=>"Larus ichthyaetus",
"Laughing Gull"=>"Larus atricilla",
"Franklin`s Gull"=>"Larus pipixcan",
"Bonaparte`s Gull"=>"Larus philadelphia",
"Ring-billed Gull"=>"Larus delawarensis",
"American Herring Gull"=>"Larus smithsonianus",
"Caspian Gull"=>"Larus cachinnans",
"Ivory Gull"=>"Pagophila eburnea",
"Royal Tern"=>"Sterna maxima",
"Brünnich`s Murre"=>"Uria lomvia",
"Crested Auklet"=>"Aethia cristatella",
"Parakeet Auklet"=>"Cyclorrhynchus psittacula",
"Tufted Puffin"=>"Lunda cirrhata",
"Laughing Dove"=>"Streptopelia senegalensis",
"Great Spotted Cuckoo"=>"Clamator glandarius",
"Great Grey Owl"=>"Strix nebulosa",
"Tengmalm`s Owl"=>"Aegolius funereus",
"Red-Necked Nightjar"=>"Caprimulgus ruficollis",
"Chimney Swift"=>"Chaetura pelagica",
"Green Bea-Eater"=>"Merops orientalis",
"Grey-headed Woodpecker"=>"Picus canus",
"Lesser Short-Toed Lark"=>"Calandrella rufescens",
"Eurasian Crag Martin"=>"Hirundo rupestris",
"Red-rumped Swallow"=>"Cecropis daurica",
"Blyth`s Pipit"=>"Anthus godlewskii",
"Pechora Pipit"=>"Anthus gustavi",
"Grey-headed Wagtail"=>"Motacilla thunbergi",
"Yellow-Headed Wagtail"=>"Motacilla lutea",
"White-throated Dipper"=>"Cinclus cinclus",
"Rufous-Tailed Scrub Robin"=>"Cercotrichas galactotes",
"Thrush Nightingale"=>"Luscinia luscinia",
"White-throated Robin"=>"Irania gutturalis",
"Caspian Stonechat"=>"Saxicola maura variegata",
"Western Black-eared Wheatear"=>"Oenanthe hispanica",
"Rufous-tailed Rock Thrush"=>"Monticola saxatilis",
"Red-throated Thrush/Black-throated"=>"Turdus ruficollis",
"American Robin"=>"Turdus migratorius",
"Zitting Cisticola"=>"Cisticola juncidis",
"Lanceolated Warbler"=>"Locustella lanceolata",
"River Warbler"=>"Locustella fluviatilis",
"Blyth`s Reed Warbler"=>"Acrocephalus dumetorum",
"Caspian Reed Warbler"=>"Acrocephalus fuscus",
"Aquatic Warbler"=>"Acrocephalus paludicola",
"Booted Warbler"=>"Acrocephalus caligatus",
"Marmora's Warbler"=>"Sylvia sarda",
"Dartford Warbler"=>"Sylvia undata",
"Subalpine Warbler"=>"Sylvia cantillans",
"Ménétries's Warbler"=>"Sylvia mystacea",
"Rüppel's Warbler"=>"Sylvia rueppelli",
"Asian Desert Warbler"=>"Sylvia nana",
"Western Orphean Warbler"=>"Sylvia hortensis hortensis",
"Arctic Warbler"=>"Phylloscopus borealis",
"Radde`s Warbler"=>"Phylloscopus schwarzi",
"Western Bonelli`s Warbler"=>"Phylloscopus bonelli",
"Red-breasted Flycatcher"=>"Ficedula parva",
"Eurasian Penduline Tit"=>"Remiz pendulinus",
"Daurian Shrike"=>"Lanius isabellinus",
"Long-Tailed Shrike"=>"Lanius schach",
"Lesser Grey Shrike"=>"Lanius minor",
"Southern Grey Shrike"=>"Lanius meridionalis",
"Masked Shrike"=>"Lanius nubicus",
"Spotted Nutcracker"=>"Nucifraga caryocatactes",
"Daurian Jackdaw"=>"Corvus dauuricus",
"Purple-Backed Starling"=>"Sturnus sturninus",
"Red-Fronted Serin"=>"Serinus pusillus",
"Arctic Redpoll"=>"Carduelis hornemanni",
"Scottish Crossbill"=>"Loxia scotica",
"Parrot Crossbill"=>"Loxia pytyopsittacus",
"Black-faced Bunting"=>"Emberiza spodocephala",
"Pink-footed Goose"=>"Anser brachyrhynchus",
"Black-winged Kite"=>"Elanus caeruleus",
"European Bee-eater"=>"Merops apiaster",
"Sabine`s Gull"=>"Larus sabini",
"Sooty Shearwater"=>"Puffinus griseus",
"Lesser Canada Goose"=>"Branta hutchinsii",
"Ring-necked Duck"=>"Aythya collaris",
"Greater Flamingo"=>"Phoenicopterus roseus",
"Iberian Chiffchaff"=>"Phylloscopus ibericus",
"Ashy-headed Wagtail"=>"Motacilla cinereocapilla",
"Stilt Sandpiper"=>"Calidris himantopus",
"Siberian Stonechat"=>"Saxicola maurus",
"Greater Yellowlegs"=>"Tringa melanoleuca",
"Forster`s Tern"=>"Sterna forsteri",
"Dusky Warbler"=>"Phylloscopus fuscatus",
"Cirl Bunting"=>"Emberiza cirlus",
"Olive-backed Pipit"=>"Anthus hodgsoni",
"Sociable Lapwing"=>"Vanellus gregarius",
"Spotted Sandpiper"=>"Actitis macularius",
"Baird`s Sandpiper"=>"Calidris bairdii",
"Rustic Bunting"=>"Emberiza rustica",
"Yellow-browed Bunting"=>"Emberiza chrysophrys",
"Great Shearwater"=>"Puffinus gravis",
"Bonelli`s Eagle"=>"Aquila fasciata",
"Calandra Lark"=>"Melanocorypha calandra",
"Sardinian Warbler"=>"Sylvia melanocephala",
"Ross's Gull"=>"Larus roseus",
"Yellow-Breasted Bunting"=>"Emberiza aureola",
"Pine Bunting"=>"Emberiza leucocephalos",
"Black Guillemot"=>"Cepphus grylle",
"Pied-billed Grebe"=>"Podilymbus podiceps",
"Soft-plumaged Petrel"=>"Pterodroma mollis",
"Bulwer's Petrel"=>"Bulweria bulwerii",
"White-Faced Storm-Petrel"=>"Pelagodroma marina",
"Pallass Fish Eagle"=>"Haliaeetus leucoryphus",
"Sandhill Crane"=>"Grus canadensis",
"Macqueens Bustard"=>"Chlamydotis macqueenii",
"White-tailed Lapwing"=>"Vanellus leucurus",
"Great Knot"=>"Calidris tenuirostris",
"Semipalmated Sandpiper"=>"Calidris pusilla",
"Red-necked Stint"=>"Calidris ruficollis",
"Slender-billed Curlew"=>"Numenius tenuirostris",
"Bridled Tern"=>"Onychoprion anaethetus",
"Pallass Sandgrouse"=>"Syrrhaptes paradoxus",
"European Scops Owl"=>"Otus scops",
"Northern Hawk Owl"=>"Surnia ulula",
"White-Throated Needletail"=>"Hirundapus caudacutus",
"Belted Kingfisher"=>"Ceryle alcyon",
"Blue-cheeked Bee-eater"=>"Merops persicus",
"Black-headed Wagtail"=>"Motacilla feldegg",
"Northern Mockingbird"=>"Mimus polyglottos",
"Alpine Accentor"=>"Prunella collaris",
"Red-flanked Bluetail"=>"Tarsiger cyanurus",
"Isabelline Wheatear"=>"Oenanthe isabellina",
"Pied Wheatear"=>"Oenanthe pleschanka",
"Eastern Black-eared Wheatear"=>"Oenanthe melanoleuca",
"Desert Wheatear"=>"Oenanthe deserti",
"White`s Thrush"=>"Zoothera aurea",
"Siberian Thrush"=>"Zoothera sibirica",
"Eyebrowed Thrush"=>"Turdus obscurus",
"Dusky Thrush"=>"Turdus eunomus",
"Black-throated Thrush"=>"Turdus atrogularis",
"Pallas`s Grasshopper Warbler"=>"Locustella certhiola",
"Spectacled Warbler"=>"Sylvia conspicillata",
"Two-barred Warbler"=>"Phylloscopus plumbeitarsus",
"Eastern Bonellis Warbler"=>"Phylloscopus orientalis",
"Collared Flycatcher"=>"Ficedula albicollis",
"Wallcreeper"=>"Tichodroma muraria",
"Turkestan Shrike"=>"Lanius phoenicuroides",
"Steppe Grey Shrike"=>"Lanius pallidirostris",
"Spanish Sparrow"=>"Passer hispaniolensis",
"Red-eyed Vireo"=>"Vireo olivaceus",
"Myrtle Warbler"=>"Dendroica coronata",
"White-crowned Sparrow"=>"Zonotrichia leucophrys",
"White-throated Sparrow"=>"Zonotrichia albicollis",
"Cretzschmar`s Bunting"=>"Emberiza caesia",
"Chestnut Bunting"=>"Emberiza rutila",
"Red-headed Bunting"=>"Emberiza bruniceps",
"Black-headed Bunting"=>"Emberiza melanocephala",
"Indigo Bunting"=>"Passerina cyanea",
"Balearic Woodchat Shrike"=>"Lanius senator badius",
"Demoiselle Crane"=>"Grus virgo",
"Chough"=>"Pyrrhocorax pyrrhocorax",
"Red-Billed Chough"=>"Pyrrhocorax graculus",
"Elegant Tern"=>"Sterna elegans",
"Chukar"=>"Alectoris chukar",
"Yellow-Billed Cuckoo"=>"Coccyzus americanus",
"American Sandwich Tern"=>"Sterna sandvicensis acuflavida",
"Olive-Tree Warbler"=>"Hippolais olivetorum",
"Eastern Olivaceous Warbler"=>"Acrocephalus pallidus",
"Indian Cormorant"=>"Phalacrocorax fuscicollis",
"Spur-Winged Lapwing"=>"Vanellus spinosus",
"Yelkouan Shearwater"=>"Puffinus yelkouan",
"Trumpeter Finch"=>"Bucanetes githagineus",
"Red Grouse"=>"Lagopus scoticus",
"Rock Ptarmigan"=>"Lagopus mutus",
"Long-Tailed Cormorant"=>"Phalacrocorax africanus",
"Double-crested Cormorant"=>"Phalacrocorax auritus",
"Magnificent Frigatebird"=>"Fregata magnificens",
"Naumann's Thrush"=>"Turdus naumanni",
"Oriental Pratincole"=>"Glareola maldivarum",
"Bufflehead"=>"Bucephala albeola",
"Snowfinch"=>"Montifrigilla nivalis",
"Ural owl"=>"Strix uralensis",
"Spanish Wagtail"=>"Motacilla iberiae",
"Song Sparrow"=>"Melospiza melodia",
"Rock Bunting"=>"Emberiza cia",
"Siberian Rubythroat"=>"Luscinia calliope",
"Pallid Swift"=>"Apus pallidus",
"Eurasian Pygmy Owl"=>"Glaucidium passerinum",
"Madeira Little Shearwater"=>"Puffinus baroli",
"House Finch"=>"Carpodacus mexicanus",
"Green Heron"=>"Butorides virescens",
"Solitary Sandpiper"=>"Tringa solitaria",
"Heuglin's Gull"=>"Larus heuglini"
);
function array_to_json( $array ){
if( !is_array( $array ) ){
return false;
}
$associative = count( array_diff( array_keys($array), array_keys( array_keys( $array )) ));
if( $associative ){
$construct = array();
foreach( $array as $key => $value ){
// We first copy each key/value pair into a staging array,
// formatting each key and value properly as we go.
// Format the key:
if( is_numeric($key) ){
$key = "key_$key";
}
$key = "\"".addslashes($key)."\"";
// Format the value:
if( is_array( $value )){
$value = array_to_json( $value );
} else if( !is_numeric( $value ) || is_string( $value ) ){
$value = "\"".addslashes($value)."\"";
}
// Add to staging array:
$construct[] = "$key: $value";
}
// Then we collapse the staging array into the JSON form:
$result = "{ " . implode( ", ", $construct ) . " }";
} else { // If the array is a vector (not associative):
$construct = array();
foreach( $array as $value ){
// Format the value:
if( is_array( $value )){
$value = array_to_json( $value );
} else if( !is_numeric( $value ) || is_string( $value ) ){
$value = "'".addslashes($value)."'";
}
// Add to staging array:
$construct[] = $value;
}
// Then we collapse the staging array into the JSON form:
$result = "[ " . implode( ", ", $construct ) . " ]";
}
return $result;
}
$result = array();
foreach ($items as $key=>$value) {
if (strpos(strtolower($key), $q) !== false) {
array_push($result, array("id"=>$value, "label"=>$key, "value" => strip_tags($key)));
}
if (count($result) > 11)
break;
}
echo array_to_json($result);
?>

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - XML data parsed once</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
</style>
<script>
$(function() {
function log( message ) {
$( "<div/>" ).text( message ).prependTo( "#log" );
$( "#log" ).scrollTop( 0 );
}
$.ajax({
url: "london.xml",
dataType: "xml",
success: function( xmlResponse ) {
var data = $( "geoname", xmlResponse ).map(function() {
return {
value: $( "name", this ).text() + ", " +
( $.trim( $( "countryName", this ).text() ) || "(unknown country)" ),
id: $( "geonameId", this ).text()
};
}).get();
$( "#birds" ).autocomplete({
source: data,
minLength: 0,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + ", geonameId: " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});
}
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="birds">London matches: </label>
<input id="birds" />
</div>
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
Result:
<div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>This demo shows how to retrieve some XML data, parse it using jQuery's methods, then provide it to the autocomplete as the datasource.</p>
<p>This should also serve as a reference on how to parse a remote XML datasource - the parsing would just happen for each request within the source-callback.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Checkboxes</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#check" ).button();
$( "#format" ).buttonset();
});
</script>
<style>
#format { margin-top: 2em; }
</style>
</head>
<body>
<div class="demo">
<input type="checkbox" id="check" /><label for="check">Toggle</label>
<div id="format">
<input type="checkbox" id="check1" /><label for="check1">B</label>
<input type="checkbox" id="check2" /><label for="check2">I</label>
<input type="checkbox" id="check3" /><label for="check3">U</label>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>A checkbox is styled as a toggle button with the button widget. The label element associated with the checkbox is used for the button text.</p>
<p>This demo also demonstrates three checkboxes styled as a button set by calling <code>.buttonset()</code> on a common container.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "input:submit, a, button", ".demo" ).button();
$( "a", ".demo" ).click(function() { return false; });
});
</script>
</head>
<body>
<div class="demo">
<button>A button element</button>
<input type="submit" value="A submit button"/>
<a href="#">An anchor</a>
</div><!-- End demo -->
<div class="demo-description">
<p>Examples of the markup that can be used for buttons: A button element, an input of type submit and an anchor.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Icons</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( ".demo button:first" ).button({
icons: {
primary: "ui-icon-locked"
},
text: false
}).next().button({
icons: {
primary: "ui-icon-locked"
}
}).next().button({
icons: {
primary: "ui-icon-gear",
secondary: "ui-icon-triangle-1-s"
}
}).next().button({
icons: {
primary: "ui-icon-gear",
secondary: "ui-icon-triangle-1-s"
},
text: false
});
});
</script>
</head>
<body>
<div class="demo">
<button>Button with icon only</button>
<button>Button with icon on the left</button>
<button>Button with two icons</button>
<button>Button with two icons and no text</button>
</div><!-- End demo -->
<div class="demo-description">
<p>Some buttons with various combinations of text and icons, here specified via metadata.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button Demos</title>
<link rel="stylesheet" href="../demos.css">
</head>
<body>
<div class="demos-nav">
<h4>Examples</h4>
<ul>
<li class="demo-config-on"><a href="default.html">Default functionality</a></li>
<li><a href="radio.html">Radios</a></li>
<li><a href="checkbox.html">Checkboxes</a></li>
<li><a href="icons.html">Icons</a></li>
<li><a href="toolbar.html">Toolbar</a></li>
<li><a href="splitbutton.html">Split Button</a></li>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Radios</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#radio" ).buttonset();
});
</script>
</head>
<body>
<div class="demo">
<form>
<div id="radio">
<input type="radio" id="radio1" name="radio" /><label for="radio1">Choice 1</label>
<input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">Choice 2</label>
<input type="radio" id="radio3" name="radio" /><label for="radio3">Choice 3</label>
</div>
</form>
</div><!-- End demo -->
<div class="demo-description">
<p>A set of three radio buttons transformed into a button set.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Split button</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#rerun" )
.button()
.click(function() {
alert( "Running the last action" );
})
.next()
.button( {
text: false,
icons: {
primary: "ui-icon-triangle-1-s"
}
})
.click(function() {
alert( "Could display a menu to select an action" );
})
.parent()
.buttonset();
});
</script>
<style>
</style>
</head>
<body>
<div class="demo">
<div>
<button id="rerun">Run last action</button>
<button id="select">Select an action</button>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>An example of a split button built with two buttons: A plan button with just text, one with only a primary icon and no text. Both are grouped together in a set.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Toolbar</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
#toolbar {
padding: 10px 4px;
}
</style>
<script>
$(function() {
$( "#beginning" ).button({
text: false,
icons: {
primary: "ui-icon-seek-start"
}
});
$( "#rewind" ).button({
text: false,
icons: {
primary: "ui-icon-seek-prev"
}
});
$( "#play" ).button({
text: false,
icons: {
primary: "ui-icon-play"
}
})
.click(function() {
var options;
if ( $( this ).text() === "play" ) {
options = {
label: "pause",
icons: {
primary: "ui-icon-pause"
}
};
} else {
options = {
label: "play",
icons: {
primary: "ui-icon-play"
}
};
}
$( this ).button( "option", options );
});
$( "#stop" ).button({
text: false,
icons: {
primary: "ui-icon-stop"
}
})
.click(function() {
$( "#play" ).button( "option", {
label: "play",
icons: {
primary: "ui-icon-play"
}
});
});
$( "#forward" ).button({
text: false,
icons: {
primary: "ui-icon-seek-next"
}
});
$( "#end" ).button({
text: false,
icons: {
primary: "ui-icon-seek-end"
}
});
$( "#shuffle" ).button();
$( "#repeat" ).buttonset();
});
</script>
</head>
<body>
<div class="demo">
<span id="toolbar" class="ui-widget-header ui-corner-all">
<button id="beginning">go to beginning</button>
<button id="rewind">rewind</button>
<button id="play">play</button>
<button id="stop">stop</button>
<button id="forward">fast forward</button>
<button id="end">go to end</button>
<input type="checkbox" id="shuffle" /><label for="shuffle">Shuffle</label>
<span id="repeat">
<input type="radio" id="repeat0" name="repeat" checked="checked" /><label for="repeat0">No Repeat</label>
<input type="radio" id="repeat1" name="repeat" /><label for="repeat1">Once</label>
<input type="radio" id="repeatall" name="repeat" /><label for="repeatall">All</label>
</span>
</span>
</div><!-- End demo -->
<div class="demo-description">
<p>
A mediaplayer toolbar. Take a look at the underlying markup: A few button elements,
an input of type checkbox for the Shuffle button, and three inputs of type radio for the Repeat options.
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Populate alternate field</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#datepicker" ).datepicker({
altField: "#alternate",
altFormat: "DD, d MM, yy"
});
});
</script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker">&nbsp;<input type="text" id="alternate" size="30"/></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Populate an alternate field with its own date format whenever a date is selected using the <code>altField</code> and <code>altFormat</code> options. This feature could be used to present a human-friendly date for user selection, while passing a more computer-friendly date through for further processing.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Animations</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.effects.bounce.js"></script>
<script src="../../ui/jquery.effects.clip.js"></script>
<script src="../../ui/jquery.effects.drop.js"></script>
<script src="../../ui/jquery.effects.fold.js"></script>
<script src="../../ui/jquery.effects.slide.js"></script>
<script src="../../ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#datepicker" ).datepicker();
$( "#anim" ).change(function() {
$( "#datepicker" ).datepicker( "option", "showAnim", $( this ).val() );
});
});
</script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker" size="30"/></p>
<p>Animations:<br />
<select id="anim">
<option value="show">Show (default)</option>
<option value="slideDown">Slide down</option>
<option value="fadeIn">Fade in</option>
<option value="blind">Blind (UI Effect)</option>
<option value="bounce">Bounce (UI Effect)</option>
<option value="clip">Clip (UI Effect)</option>
<option value="drop">Drop (UI Effect)</option>
<option value="fold">Fold (UI Effect)</option>
<option value="slide">Slide (UI Effect)</option>
<option value="">None</option>
</select>
</p>
</div><!-- End demo -->
<div class="demo-description">
<p>Use different animations when opening or closing the datepicker. Choose an animation from the dropdown, then click on the input to see its effect. You can use one of the three standard animations or any of the UI Effects.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Display button bar</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#datepicker" ).datepicker({
showButtonPanel: true
});
});
</script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker"></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Display a button for selecting Today's date and a Done button for closing the calendar with the boolean <code>showButtonPanel</code> option. Each button is enabled by default when the bar is displayed, but can be turned off with additional options. Button text is customizable.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Format date</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#datepicker" ).datepicker();
$( "#format" ).change(function() {
$( "#datepicker" ).datepicker( "option", "dateFormat", $( this ).val() );
});
});
</script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker" size="30"/></p>
<p>Format options:<br />
<select id="format">
<option value="mm/dd/yy">Default - mm/dd/yy</option>
<option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option>
<option value="d M, y">Short - d M, y</option>
<option value="d MM, y">Medium - d MM, y</option>
<option value="DD, d MM, yy">Full - DD, d MM, yy</option>
<option value="'day' d 'of' MM 'in the year' yy">With text - 'day' d 'of' MM 'in the year' yy</option>
</select>
</p>
</div><!-- End demo -->
<div class="demo-description">
<p>Display date feedback in a variety of ways. Choose a date format from the dropdown, then click on the input and select a date to see it in that format.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Select a Date Range</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
var dates = $( "#from, #to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
var option = this.id == "from" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
}
});
});
</script>
</head>
<body>
<div class="demo">
<label for="from">From</label>
<input type="text" id="from" name="from"/>
<label for="to">to</label>
<input type="text" id="to" name="to"/>
</div><!-- End demo -->
<div class="demo-description">
<p>Select the date range to search for.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker"></p>
</div><!-- End demo -->
<div class="demo-description">
<p>The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.</p>
</div><!-- End demo-description -->
</body>
</html>

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