code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio;
import org.apache.http.nio.reactor.IOEventDispatch;
/**
* Extended version of the {@link NHttpClientConnection} used by
* {@link IOEventDispatch} implementations to inform client-side connection
* objects of I/O events.
*
* @since 4.0
*/
public interface NHttpClientIOTarget extends NHttpClientConnection {
/**
* Triggered when the connection is ready to consume input.
*
* @param handler the client protocol handler.
*/
void consumeInput(NHttpClientHandler handler);
/**
* Triggered when the connection is ready to produce output.
*
* @param handler the client protocol handler.
*/
void produceOutput(NHttpClientHandler handler);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/NHttpClientIOTarget.java | Java | gpl3 | 1,914 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio;
import java.io.IOException;
import org.apache.http.HttpException;
/**
* Abstract client-side HTTP protocol handler.
*
* @since 4.0
*/
public interface NHttpClientHandler {
/**
* Triggered when a new outgoing connection is created.
*
* @param conn new outgoing HTTP connection.
* @param attachment an object that was attached to the session request
*/
void connected(NHttpClientConnection conn, Object attachment);
/**
* Triggered when the connection is ready to accept a new HTTP request.
* The protocol handler does not have to submit a request if it is not
* ready.
*
* @see NHttpClientConnection
*
* @param conn HTTP connection that is ready to accept a new HTTP request.
*/
void requestReady(NHttpClientConnection conn);
/**
* Triggered when an HTTP response is received. The connection
* passed as a parameter to this method is guaranteed to return
* a valid HTTP response object.
* <p/>
* If the response received encloses a response entity this method will
* be followed by a series of
* {@link #inputReady(NHttpClientConnection, ContentDecoder)} calls
* to transfer the response content.
*
* @see NHttpClientConnection
*
* @param conn HTTP connection that contains an HTTP response
*/
void responseReceived(NHttpClientConnection conn);
/**
* Triggered when the underlying channel is ready for reading a
* new portion of the response entity through the corresponding
* content decoder.
* <p/>
* If the content consumer is unable to process the incoming content,
* input event notifications can be temporarily suspended using
* {@link IOControl} interface.
*
* @see NHttpClientConnection
* @see ContentDecoder
* @see IOControl
*
* @param conn HTTP connection that can produce a new portion of the
* incoming response content.
* @param decoder The content decoder to use to read content.
*/
void inputReady(NHttpClientConnection conn, ContentDecoder decoder);
/**
* Triggered when the underlying channel is ready for writing a next portion
* of the request entity through the corresponding content encoder.
* <p>
* If the content producer is unable to generate the outgoing content,
* output event notifications can be temporarily suspended using
* {@link IOControl} interface.
*
* @see NHttpClientConnection
* @see ContentEncoder
* @see IOControl
*
* @param conn HTTP connection that can accommodate a new portion
* of the outgoing request content.
* @param encoder The content encoder to use to write content.
*/
void outputReady(NHttpClientConnection conn, ContentEncoder encoder);
/**
* Triggered when an I/O error occurs while reading from or writing
* to the underlying channel.
*
* @param conn HTTP connection that caused an I/O error
* @param ex I/O exception
*/
void exception(NHttpClientConnection conn, IOException ex);
/**
* Triggered when an HTTP protocol violation occurs while receiving
* an HTTP response.
*
* @param conn HTTP connection that caused an HTTP protocol violation
* @param ex HTTP protocol violation exception
*/
void exception(NHttpClientConnection conn, HttpException ex);
/**
* Triggered when no input is detected on this connection over the
* maximum period of inactivity.
*
* @param conn HTTP connection that caused timeout condition.
*/
void timeout(NHttpClientConnection conn);
/**
* Triggered when the connection is closed.
*
* @param conn closed HTTP connection.
*/
void closed(NHttpClientConnection conn);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/NHttpClientHandler.java | Java | gpl3 | 5,045 |
<html>
<head>
<!--
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
-->
</head>
<body>
Representations for non-blocking HTTP message entities.
An {@link org.apache.http.HttpEntity entity} is the optional content of a
{@link org.apache.http.HttpMessage message}.
This package provides a basic selection of entity implementations
that can obtain content from
{@link org.apache.http.nio.entity.NByteArrayEntity byte array},
{@link org.apache.http.nio.entity.NStringEntity string},
{@link org.apache.http.nio.entity.NFileEntity file}, or through an
{@link org.apache.http.nio.entity.NHttpEntityWrapper compatibility adaptor}
for blocking HTTP entities.
If a message is received from an open non-blocking connection, usually it is
represented by
{@link org.apache.http.nio.entity.ConsumingNHttpEntity consuming} entity.
</body>
</html>
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/package.html | HTML | gpl3 | 1,967 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.io.BufferInfo;
import org.apache.http.nio.util.ContentInputBuffer;
/**
* {@link InputStream} adaptor for {@link ContentInputBuffer}.
*
* @since 4.0
*/
public class ContentInputStream extends InputStream {
private final ContentInputBuffer buffer;
public ContentInputStream(final ContentInputBuffer buffer) {
super();
if (buffer == null) {
throw new IllegalArgumentException("Input buffer may not be null");
}
this.buffer = buffer;
}
@Override
public int available() throws IOException {
if (this.buffer instanceof BufferInfo) {
return ((BufferInfo) this.buffer).length();
} else {
return super.available();
}
}
@Override
public int read(final byte[] b, int off, int len) throws IOException {
return this.buffer.read(b, off, len);
}
@Override
public int read(final byte[] b) throws IOException {
if (b == null) {
return 0;
}
return this.buffer.read(b, 0, b.length);
}
@Override
public int read() throws IOException {
return this.buffer.read();
}
@Override
public void close() throws IOException {
// read and discard the remainder of the message
byte tmp[] = new byte[1024];
while (this.buffer.read(tmp, 0, tmp.length) >= 0) {
}
super.close();
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentInputStream.java | Java | gpl3 | 2,717 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import org.apache.http.HttpEntity;
import org.apache.http.entity.StringEntity;
/**
* An entity whose content is retrieved from a string. In addition to the
* standard {@link HttpEntity} interface this class also implements NIO specific
* {@link HttpNIOEntity}.
*
* @deprecated Use {@link NStringEntity}
*
* @since 4.0
*/
@Deprecated
public class StringNIOEntity extends StringEntity implements HttpNIOEntity {
public StringNIOEntity(
final String s,
String charset) throws UnsupportedEncodingException {
super(s, charset);
}
public ReadableByteChannel getChannel() throws IOException {
return Channels.newChannel(getContent());
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/StringNIOEntity.java | Java | gpl3 | 2,077 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.FileChannel;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.nio.ContentEncoder;
import org.apache.http.nio.ContentEncoderChannel;
import org.apache.http.nio.FileContentEncoder;
import org.apache.http.nio.IOControl;
/**
* A self contained, repeatable non-blocking entity that retrieves its content
* from a file. This class is mostly used to stream large files of different
* types, so one needs to supply the content type of the file to make sure
* the content can be correctly recognized and processed by the recipient.
*
* @since 4.0
*/
public class NFileEntity extends AbstractHttpEntity implements ProducingNHttpEntity {
private final File file;
private FileChannel fileChannel;
private long idx = -1;
private boolean useFileChannels;
/**
* Creates new instance of NFileEntity from the given source {@link File}
* with the given content type. If <code>useFileChannels</code> is set to
* <code>true</code>, the entity will try to use {@link FileContentEncoder}
* interface to stream file content directly from the file channel.
*
* @param file the source file.
* @param contentType the content type of the file.
* @param useFileChannels flag whether the direct transfer from the file
* channel should be attempted.
*/
public NFileEntity(final File file, final String contentType, boolean useFileChannels) {
if (file == null) {
throw new IllegalArgumentException("File may not be null");
}
this.file = file;
this.useFileChannels = useFileChannels;
setContentType(contentType);
}
public NFileEntity(final File file, final String contentType) {
this(file, contentType, true);
}
public void finish() {
try {
if(fileChannel != null)
fileChannel.close();
} catch(IOException ignored) {}
fileChannel = null;
}
public long getContentLength() {
return file.length();
}
public boolean isRepeatable() {
return true;
}
public void produceContent(ContentEncoder encoder, IOControl ioctrl)
throws IOException {
if(fileChannel == null) {
FileInputStream in = new FileInputStream(file);
fileChannel = in.getChannel();
idx = 0;
}
long transferred;
if(useFileChannels && encoder instanceof FileContentEncoder) {
transferred = ((FileContentEncoder)encoder)
.transfer(fileChannel, idx, Long.MAX_VALUE);
} else {
transferred = fileChannel.
transferTo(idx, Long.MAX_VALUE, new ContentEncoderChannel(encoder));
}
if(transferred > 0)
idx += transferred;
if(idx >= fileChannel.size())
encoder.complete();
}
public boolean isStreaming() {
return false;
}
public InputStream getContent() throws IOException {
return new FileInputStream(this.file);
}
public void writeTo(final OutputStream outstream) throws IOException {
if (outstream == null) {
throw new IllegalArgumentException("Output stream may not be null");
}
InputStream instream = new FileInputStream(this.file);
try {
byte[] tmp = new byte[4096];
int l;
while ((l = instream.read(tmp)) != -1) {
outstream.write(tmp, 0, l);
}
outstream.flush();
} finally {
instream.close();
}
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/NFileEntity.java | Java | gpl3 | 4,978 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import org.apache.http.HttpEntity;
import org.apache.http.entity.ByteArrayEntity;
/**
* An entity whose content is retrieved from a byte array. In addition to the
* standard {@link HttpEntity} interface this class also implements NIO specific
* {@link HttpNIOEntity}.
*
* @deprecated Use {@link NByteArrayEntity}
*
* @since 4.0
*/
@Deprecated
public class ByteArrayNIOEntity extends ByteArrayEntity implements HttpNIOEntity {
public ByteArrayNIOEntity(final byte[] b) {
super(b);
}
public ReadableByteChannel getChannel() throws IOException {
return Channels.newChannel(getContent());
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/ByteArrayNIOEntity.java | Java | gpl3 | 1,965 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.HttpEntity;
import org.apache.http.entity.HttpEntityWrapper;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.IOControl;
import org.apache.http.nio.util.ByteBufferAllocator;
import org.apache.http.nio.util.SimpleInputBuffer;
/**
* A {@link ConsumingNHttpEntity} that consumes content into a buffer. The
* content can be retrieved as an InputStream via
* {@link HttpEntity#getContent()}, or written to an output stream via
* {@link HttpEntity#writeTo(OutputStream)}.
*
* @since 4.0
*/
public class BufferingNHttpEntity extends HttpEntityWrapper implements
ConsumingNHttpEntity {
private final static int BUFFER_SIZE = 2048;
private final SimpleInputBuffer buffer;
private boolean finished;
private boolean consumed;
public BufferingNHttpEntity(
final HttpEntity httpEntity,
final ByteBufferAllocator allocator) {
super(httpEntity);
this.buffer = new SimpleInputBuffer(BUFFER_SIZE, allocator);
}
public void consumeContent(
final ContentDecoder decoder,
final IOControl ioctrl) throws IOException {
this.buffer.consumeContent(decoder);
if (decoder.isCompleted()) {
this.finished = true;
}
}
public void finish() {
this.finished = true;
}
@Override
public void consumeContent() throws IOException {
}
/**
* Obtains entity's content as {@link InputStream}.
*
* @throws IllegalStateException if content of the entity has not been
* fully received or has already been consumed.
*/
@Override
public InputStream getContent() throws IOException {
if (!this.finished) {
throw new IllegalStateException("Entity content has not been fully received");
}
if (this.consumed) {
throw new IllegalStateException("Entity content has been consumed");
}
this.consumed = true;
return new ContentInputStream(this.buffer);
}
@Override
public boolean isRepeatable() {
return false;
}
@Override
public boolean isStreaming() {
return true;
}
@Override
public void writeTo(final OutputStream outstream) throws IOException {
if (outstream == null) {
throw new IllegalArgumentException("Output stream may not be null");
}
InputStream instream = getContent();
byte[] buffer = new byte[BUFFER_SIZE];
int l;
// consume until EOF
while ((l = instream.read(buffer)) != -1) {
outstream.write(buffer, 0, l);
}
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/BufferingNHttpEntity.java | Java | gpl3 | 3,973 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.IOControl;
/**
* A non-blocking {@link HttpEntity} that allows content to be streamed from a
* {@link ContentDecoder}.
*
* @since 4.0
*/
public interface ConsumingNHttpEntity extends HttpEntity {
/**
* Notification that content is available to be read from the decoder.
* {@link IOControl} instance passed as a parameter to the method can be
* used to suspend input events if the entity is temporarily unable to
* allocate more storage to accommodate all incoming content.
*
* @param decoder content decoder.
* @param ioctrl I/O control of the underlying connection.
*/
void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException;
/**
* Notification that any resources allocated for reading can be released.
*/
void finish() throws IOException;
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java | Java | gpl3 | 2,199 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.nio.ContentEncoder;
import org.apache.http.nio.IOControl;
import org.apache.http.nio.protocol.AsyncNHttpServiceHandler;
import org.apache.http.protocol.HTTP;
/**
* A simple, self contained, repeatable non-blocking entity that retrieves
* its content from a {@link String} object.
*
* @see AsyncNHttpServiceHandler
* @since 4.0
*
*/
public class NStringEntity extends AbstractHttpEntity implements ProducingNHttpEntity {
protected final byte[] content;
protected final ByteBuffer buffer;
public NStringEntity(final String s, String charset)
throws UnsupportedEncodingException {
if (s == null) {
throw new IllegalArgumentException("Source string may not be null");
}
if (charset == null) {
charset = HTTP.DEFAULT_CONTENT_CHARSET;
}
this.content = s.getBytes(charset);
this.buffer = ByteBuffer.wrap(this.content);
setContentType(HTTP.PLAIN_TEXT_TYPE + HTTP.CHARSET_PARAM + charset);
}
public NStringEntity(final String s) throws UnsupportedEncodingException {
this(s, null);
}
public boolean isRepeatable() {
return true;
}
public long getContentLength() {
return this.buffer.limit();
}
public void finish() {
buffer.rewind();
}
public void produceContent(ContentEncoder encoder, IOControl ioctrl)
throws IOException {
encoder.write(buffer);
if(!buffer.hasRemaining())
encoder.complete();
}
public boolean isStreaming() {
return false;
}
public InputStream getContent() {
return new ByteArrayInputStream(content);
}
public void writeTo(final OutputStream outstream) throws IOException {
if (outstream == null) {
throw new IllegalArgumentException("Output stream may not be null");
}
outstream.write(content);
outstream.flush();
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java | Java | gpl3 | 3,444 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.IOControl;
/**
* A listener for available data on a non-blocking {@link ConsumingNHttpEntity}.
*
* @since 4.0
*/
public interface ContentListener {
/**
* Notification that content is available to be read from the decoder.
*
* @param decoder content decoder.
* @param ioctrl I/O control of the underlying connection.
*/
void contentAvailable(ContentDecoder decoder, IOControl ioctrl)
throws IOException;
/**
* Notification that any resources allocated for reading can be released.
*/
void finished();
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentListener.java | Java | gpl3 | 1,890 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.nio.util.ContentInputBuffer;
/**
* HTTP entity wrapper whose content is provided by a
* {@link ContentInputBuffer}.
*
* @since 4.0
*/
public class ContentBufferEntity extends BasicHttpEntity {
private HttpEntity wrappedEntity;
/**
* Creates new instance of ContentBufferEntity.
*
* @param entity the original entity.
* @param buffer the content buffer.
*/
public ContentBufferEntity(final HttpEntity entity, final ContentInputBuffer buffer) {
super();
if (entity == null) {
throw new IllegalArgumentException("HTTP entity may not be null");
}
this.wrappedEntity = entity;
setContent(new ContentInputStream(buffer));
}
@Override
public boolean isChunked() {
return this.wrappedEntity.isChunked();
}
@Override
public long getContentLength() {
return this.wrappedEntity.getContentLength();
}
@Override
public Header getContentType() {
return this.wrappedEntity.getContentType();
}
@Override
public Header getContentEncoding() {
return this.wrappedEntity.getContentEncoding();
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentBufferEntity.java | Java | gpl3 | 2,521 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.IOControl;
import org.apache.http.nio.util.ByteBufferAllocator;
/**
* A simple {@link ContentListener} that reads and ignores all content.
*
* @since 4.0
*/
public class SkipContentListener implements ContentListener {
private final ByteBuffer buffer;
public SkipContentListener(final ByteBufferAllocator allocator) {
super();
if (allocator == null) {
throw new IllegalArgumentException("ByteBuffer allocator may not be null");
}
this.buffer = allocator.allocate(2048);
}
public void contentAvailable(
final ContentDecoder decoder,
final IOControl ioctrl) throws IOException {
int totalRead = 0;
int lastRead;
do {
buffer.clear();
lastRead = decoder.read(buffer);
if (lastRead > 0)
totalRead += lastRead;
} while (lastRead > 0);
}
public void finished() {
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/SkipContentListener.java | Java | gpl3 | 2,299 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.http.nio.util.ContentOutputBuffer;
/**
* {@link OutputStream} adaptor for {@link ContentOutputBuffer}.
*
* @since 4.0
*/
public class ContentOutputStream extends OutputStream {
private final ContentOutputBuffer buffer;
public ContentOutputStream(final ContentOutputBuffer buffer) {
super();
if (buffer == null) {
throw new IllegalArgumentException("Output buffer may not be null");
}
this.buffer = buffer;
}
@Override
public void close() throws IOException {
this.buffer.writeCompleted();
}
@Override
public void flush() throws IOException {
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
this.buffer.write(b, off, len);
}
@Override
public void write(byte[] b) throws IOException {
if (b == null) {
return;
}
this.buffer.write(b, 0, b.length);
}
@Override
public void write(int b) throws IOException {
this.buffer.write(b);
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentOutputStream.java | Java | gpl3 | 2,347 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.ReadableByteChannel;
import org.apache.http.HttpEntity;
import org.apache.http.entity.FileEntity;
/**
* An entity whose content is retrieved from from a file. In addition to the standard
* {@link HttpEntity} interface this class also implements NIO specific
* {@link HttpNIOEntity}.
*
* @deprecated Use {@link NFileEntity}
*
* @since 4.0
*/
@Deprecated
public class FileNIOEntity extends FileEntity implements HttpNIOEntity {
public FileNIOEntity(final File file, final String contentType) {
super(file, contentType);
}
public ReadableByteChannel getChannel() throws IOException {
RandomAccessFile rafile = new RandomAccessFile(this.file, "r");
return rafile.getChannel();
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/FileNIOEntity.java | Java | gpl3 | 2,059 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.nio.ContentEncoder;
import org.apache.http.nio.IOControl;
/**
* An {@link HttpEntity} that can stream content out into a
* {@link ContentEncoder}.
*
* @since 4.0
*/
public interface ProducingNHttpEntity extends HttpEntity {
/**
* Notification that content should be written to the encoder.
* {@link IOControl} instance passed as a parameter to the method can be
* used to suspend output events if the entity is temporarily unable to
* produce more content.
* <p>
* When all content is finished, this <b>MUST</b> call {@link ContentEncoder#complete()}.
* Failure to do so could result in the entity never being written.
*
* @param encoder content encoder.
* @param ioctrl I/O control of the underlying connection.
*/
void produceContent(ContentEncoder encoder, IOControl ioctrl) throws IOException;
/**
* Notification that any resources allocated for writing can be released.
*/
void finish() throws IOException;
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java | Java | gpl3 | 2,313 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.nio.ContentEncoder;
import org.apache.http.nio.IOControl;
import org.apache.http.nio.protocol.AsyncNHttpServiceHandler;
/**
* A simple self contained, repeatable non-blocking entity that retrieves
* its content from a byte array.
*
* @see AsyncNHttpServiceHandler
* @since 4.0
*/
public class NByteArrayEntity
extends AbstractHttpEntity implements ProducingNHttpEntity {
protected final byte[] content;
protected final ByteBuffer buffer;
public NByteArrayEntity(final byte[] b) {
this.content = b;
this.buffer = ByteBuffer.wrap(b);
}
public void finish() {
buffer.rewind();
}
public void produceContent(ContentEncoder encoder, IOControl ioctrl)
throws IOException {
encoder.write(buffer);
if(!buffer.hasRemaining())
encoder.complete();
}
public long getContentLength() {
return buffer.limit();
}
public boolean isRepeatable() {
return true;
}
public boolean isStreaming() {
return false;
}
public InputStream getContent() {
return new ByteArrayInputStream(content);
}
public void writeTo(final OutputStream outstream) throws IOException {
if (outstream == null) {
throw new IllegalArgumentException("Output stream may not be null");
}
outstream.write(content);
outstream.flush();
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java | Java | gpl3 | 2,863 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import org.apache.http.HttpEntity;
import org.apache.http.entity.HttpEntityWrapper;
import org.apache.http.nio.ContentEncoder;
import org.apache.http.nio.IOControl;
/**
* {@link ProducingNHttpEntity} compatibility adaptor for blocking HTTP
* entities.
*
* @since 4.0
*/
public class NHttpEntityWrapper
extends HttpEntityWrapper implements ProducingNHttpEntity {
private final ReadableByteChannel channel;
private final ByteBuffer buffer;
public NHttpEntityWrapper(final HttpEntity httpEntity) throws IOException {
super(httpEntity);
this.channel = Channels.newChannel(httpEntity.getContent());
this.buffer = ByteBuffer.allocate(4096);
}
/**
* This method throws {@link UnsupportedOperationException}.
*/
@Override
public InputStream getContent() throws IOException, UnsupportedOperationException {
throw new UnsupportedOperationException("Does not support blocking methods");
}
@Override
public boolean isStreaming() {
return true;
}
/**
* This method throws {@link UnsupportedOperationException}.
*/
@Override
public void writeTo(OutputStream out) throws IOException, UnsupportedOperationException {
throw new UnsupportedOperationException("Does not support blocking methods");
}
/**
* This method is equivalent to the {@link #finish()} method.
* <br/>
* TODO: The name of this method is misnomer. It will be renamed to
* #finish() in the next major release.
*/
@Override
public void consumeContent() throws IOException {
finish();
}
public void produceContent(
final ContentEncoder encoder,
final IOControl ioctrl) throws IOException {
int i = this.channel.read(this.buffer);
this.buffer.flip();
encoder.write(this.buffer);
boolean buffering = this.buffer.hasRemaining();
this.buffer.compact();
if (i == -1 && !buffering) {
encoder.complete();
this.channel.close();
}
}
public void finish() {
try {
this.channel.close();
} catch (IOException ignore) {
}
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/NHttpEntityWrapper.java | Java | gpl3 | 3,629 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.HttpEntity;
import org.apache.http.entity.HttpEntityWrapper;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.IOControl;
/**
* A {@link ConsumingNHttpEntity} that forwards available content to a
* {@link ContentListener}.
*
* @since 4.0
*/
public class ConsumingNHttpEntityTemplate
extends HttpEntityWrapper implements ConsumingNHttpEntity {
private final ContentListener contentListener;
public ConsumingNHttpEntityTemplate(
final HttpEntity httpEntity,
final ContentListener contentListener) {
super(httpEntity);
this.contentListener = contentListener;
}
public ContentListener getContentListener() {
return contentListener;
}
@Override
public InputStream getContent() throws IOException, UnsupportedOperationException {
throw new UnsupportedOperationException("Does not support blocking methods");
}
@Override
public boolean isStreaming() {
return true;
}
@Override
public void writeTo(OutputStream out) throws IOException, UnsupportedOperationException {
throw new UnsupportedOperationException("Does not support blocking methods");
}
/**
* This method is equivalent to the {@link #finish()} method.
* <br/>
* TODO: The name of this method is misnomer. It will be renamed to
* #finish() in the next major release.
*/
@Override
public void consumeContent() throws IOException {
finish();
}
public void consumeContent(
final ContentDecoder decoder,
final IOControl ioctrl) throws IOException {
this.contentListener.contentAvailable(decoder, ioctrl);
}
public void finish() {
this.contentListener.finished();
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java | Java | gpl3 | 3,119 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.entity;
import java.io.IOException;
import java.nio.channels.ReadableByteChannel;
import org.apache.http.HttpEntity;
/**
* @deprecated Use {@link ProducingNHttpEntity}
*
* @since 4.0
*/
@Deprecated
public interface HttpNIOEntity extends HttpEntity {
ReadableByteChannel getChannel() throws IOException;
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/entity/HttpNIOEntity.java | Java | gpl3 | 1,532 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio;
import java.io.IOException;
import org.apache.http.HttpException;
/**
* Abstract server-side HTTP protocol handler.
*
* @since 4.0
*/
public interface NHttpServiceHandler {
/**
* Triggered when a new incoming connection is created.
*
* @param conn new incoming connection HTTP connection.
*/
void connected(NHttpServerConnection conn);
/**
* Triggered when a new HTTP request is received. The connection
* passed as a parameter to this method is guaranteed to return
* a valid HTTP request object.
* <p/>
* If the request received encloses a request entity this method will
* be followed a series of
* {@link #inputReady(NHttpServerConnection, ContentDecoder)} calls
* to transfer the request content.
*
* @see NHttpServerConnection
*
* @param conn HTTP connection that contains a new HTTP request
*/
void requestReceived(NHttpServerConnection conn);
/**
* Triggered when the underlying channel is ready for reading a
* new portion of the request entity through the corresponding
* content decoder.
* <p/>
* If the content consumer is unable to process the incoming content,
* input event notifications can be temporarily suspended using
* {@link IOControl} interface.
*
* @see NHttpServerConnection
* @see ContentDecoder
* @see IOControl
*
* @param conn HTTP connection that can produce a new portion of the
* incoming request content.
* @param decoder The content decoder to use to read content.
*/
void inputReady(NHttpServerConnection conn, ContentDecoder decoder);
/**
* Triggered when the connection is ready to accept a new HTTP response.
* The protocol handler does not have to submit a response if it is not
* ready.
*
* @see NHttpServerConnection
*
* @param conn HTTP connection that contains an HTTP response
*/
void responseReady(NHttpServerConnection conn);
/**
* Triggered when the underlying channel is ready for writing a
* next portion of the response entity through the corresponding
* content encoder.
* <p/>
* If the content producer is unable to generate the outgoing content,
* output event notifications can be temporarily suspended using
* {@link IOControl} interface.
*
* @see NHttpServerConnection
* @see ContentEncoder
* @see IOControl
*
* @param conn HTTP connection that can accommodate a new portion
* of the outgoing response content.
* @param encoder The content encoder to use to write content.
*/
void outputReady(NHttpServerConnection conn, ContentEncoder encoder);
/**
* Triggered when an I/O error occurs while reading from or writing
* to the underlying channel.
*
* @param conn HTTP connection that caused an I/O error
* @param ex I/O exception
*/
void exception(NHttpServerConnection conn, IOException ex);
/**
* Triggered when an HTTP protocol violation occurs while receiving
* an HTTP request.
*
* @param conn HTTP connection that caused an HTTP protocol violation
* @param ex HTTP protocol violation exception
*/
void exception(NHttpServerConnection conn, HttpException ex);
/**
* Triggered when no input is detected on this connection over the
* maximum period of inactivity.
*
* @param conn HTTP connection that caused timeout condition.
*/
void timeout(NHttpServerConnection conn);
/**
* Triggered when the connection is closed.
*
* @param conn closed HTTP connection.
*/
void closed(NHttpServerConnection conn);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/NHttpServiceHandler.java | Java | gpl3 | 4,955 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio;
import org.apache.http.nio.reactor.IOEventDispatch;
/**
* Extended version of the {@link NHttpServerConnection} used by
* {@link IOEventDispatch} implementations to inform server-side connection
* objects of I/O events.
*
* @since 4.0
*/
public interface NHttpServerIOTarget extends NHttpServerConnection {
/**
* Triggered when the connection is ready to consume input.
*
* @param handler the server protocol handler.
*/
void consumeInput(NHttpServiceHandler handler);
/**
* Triggered when the connection is ready to produce output.
*
* @param handler the server protocol handler.
*/
void produceOutput(NHttpServiceHandler handler);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/NHttpServerIOTarget.java | Java | gpl3 | 1,916 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.nio.channels.SelectionKey;
/**
* Type of I/O event notifications I/O sessions can declare interest in.
*
* @since 4.0
*/
public interface EventMask {
/**
* Interest in data input.
*/
public static final int READ = SelectionKey.OP_READ;
/**
* Interest in data output.
*/
public static final int WRITE = SelectionKey.OP_WRITE;
/**
* Interest in data input/output.
*/
public static final int READ_WRITE = READ | WRITE;
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/EventMask.java | Java | gpl3 | 1,716 |
<html>
<head>
<!--
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
-->
</head>
<body>
API for event driven NIO based on
<a href="http://gee.cs.oswego.edu/dl/">Doug Lea</a>'s
<a href="http://gee.cs.oswego.edu/dl/cpjslides/nio.pdf">reactor pattern</a>.
This API is not specific to HTTP communication.
However, it is minimal in the sense that it defines only
what is required within the scope of HTTP components.
</body>
</html>
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/package.html | HTML | gpl3 | 1,562 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.net.SocketAddress;
import java.nio.channels.ByteChannel;
/**
* IOSession interface represents a sequence of logically related data exchanges
* between two end points.
* <p>
* The channel associated with implementations of this interface can be used to
* read data from and write data to the session.
* <p>
* I/O sessions are not bound to an execution thread, therefore one cannot use
* the context of the thread to store a session's state. All details about
* a particular session must be stored within the session itself, usually
* using execution context associated with it.
* <p>
* Implementations of this interface are expected to be threading safe.
*
* @since 4.0
*/
public interface IOSession {
/**
* Name of the context attribute key, which can be used to obtain the
* session attachment object.
*/
public static final String ATTACHMENT_KEY = "http.session.attachment";
public static final int ACTIVE = 0;
public static final int CLOSING = 1;
public static final int CLOSED = Integer.MAX_VALUE;
/**
* Returns the underlying I/O channel associated with this session.
*
* @return the I/O channel.
*/
ByteChannel channel();
/**
* Returns address of the remote peer.
*
* @return socket address.
*/
SocketAddress getRemoteAddress();
/**
* Returns local address.
*
* @return socket address.
*/
SocketAddress getLocalAddress();
/**
* Returns mask of I/O evens this session declared interest in.
*
* @return I/O event mask.
*/
int getEventMask();
/**
* Declares interest in I/O event notifications by setting the event mask
* associated with the session
*
* @param ops new I/O event mask.
*/
void setEventMask(int ops);
/**
* Declares interest in a particular I/O event type by updating the event
* mask associated with the session.
*
* @param op I/O event type.
*/
void setEvent(int op);
/**
* Clears interest in a particular I/O event type by updating the event
* mask associated with the session.
*
* @param op I/O event type.
*/
void clearEvent(int op);
/**
* Terminates the session gracefully and closes the underlying I/O channel.
* This method ensures that session termination handshake, such as the one
* used by the SSL/TLS protocol, is correctly carried out.
*/
void close();
/**
* Terminates the session by shutting down the underlying I/O channel.
*/
void shutdown();
/**
* Returns status of the session:
* <p>
* {@link #ACTIVE}: session is active.
* <p>
* {@link #CLOSING}: session is being closed.
* <p>
* {@link #CLOSED}: session has been terminated.
*
* @return session status.
*/
int getStatus();
/**
* Determines if the session has been terminated.
*
* @return <code>true</code> if the session has been terminated,
* <code>false</code> otherwise.
*/
boolean isClosed();
/**
* Returns value of the socket timeout in milliseconds. The value of
* <code>0</code> signifies the session cannot time out.
*
* @return socket timeout.
*/
int getSocketTimeout();
/**
* Sets value of the socket timeout in milliseconds. The value of
* <code>0</code> signifies the session cannot time out.
*
* @param timeout socket timeout.
*/
void setSocketTimeout(int timeout);
/**
* Quite often I/O sessions need to maintain internal I/O buffers in order
* to transform input / output data prior to returning it to the consumer or
* writing it to the underlying channel. Memory management in HttpCore NIO
* is based on the fundamental principle that the data consumer can read
* only as much input data as it can process without having to allocate more
* memory. That means, quite often some input data may remain unread in one
* of the internal or external session buffers. The I/O reactor can query
* the status of these session buffers, and make sure the consumer gets
* notified correctly as more data gets stored in one of the session
* buffers, thus allowing the consumer to read the remaining data once it
* is able to process it
* <p>
* I/O sessions can be made aware of the status of external session buffers
* using the {@link SessionBufferStatus} interface.
*
* @param status
*/
void setBufferStatus(SessionBufferStatus status);
/**
* Determines if the input buffer associated with the session contains data.
*
* @return <code>true</code> if the session input buffer contains data,
* <code>false</code> otherwise.
*/
boolean hasBufferedInput();
/**
* Determines if the output buffer associated with the session contains
* data.
*
* @return <code>true</code> if the session output buffer contains data,
* <code>false</code> otherwise.
*/
boolean hasBufferedOutput();
/**
* This method can be used to associate a particular object with the
* session by the given attribute name.
* <p>
* I/O sessions are not bound to an execution thread, therefore one cannot
* use the context of the thread to store a session's state. All details
* about a particular session must be stored within the session itself.
*
* @param name name of the attribute.
* @param obj value of the attribute.
*/
void setAttribute(String name, Object obj);
/**
* Returns the value of the attribute with the given name. The value can be
* <code>null</code> if not set.
* <p>
* The value of the session attachment object can be obtained using
* {@link #ATTACHMENT_KEY} name.
*
* @see #setAttribute(String, Object)
*
* @param name name of the attribute.
* @return value of the attribute.
*/
Object getAttribute(String name);
/**
* Removes attribute with the given name.
*
* @see #setAttribute(String, Object)
*
* @param name name of the attribute to be removed.
* @return value of the removed attribute.
*/
Object removeAttribute(String name);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOSession.java | Java | gpl3 | 7,585 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
/**
* SessionRequestCallback interface can be used to get notifications of
* completion of session requests asynchronously without having to wait
* for it, blocking the current thread of execution.
*
* @since 4.0
*/
public interface SessionRequestCallback {
/**
* Triggered on successful completion of a {@link SessionRequest}.
* The {@link SessionRequest#getSession()} method can now be used to obtain
* the new I/O session.
*
* @param request session request.
*/
void completed(SessionRequest request);
/**
* Triggered on unsuccessful completion a {@link SessionRequest}.
* The {@link SessionRequest#getException()} method can now be used to
* obtain the cause of the error.
*
* @param request session request.
*/
void failed(SessionRequest request);
/**
* Triggered if a {@link SessionRequest} times out.
*
* @param request session request.
*/
void timeout(SessionRequest request);
/**
* Triggered on cancellation of a {@link SessionRequest}.
*
* @param request session request.
*/
void cancelled(SessionRequest request);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequestCallback.java | Java | gpl3 | 2,393 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.io.IOException;
/**
* HttpCore NIO is based on the Reactor pattern as described by Doug Lea.
* The purpose of I/O reactors is to react to I/O events and to dispatch event
* notifications to individual I/O sessions. The main idea of I/O reactor
* pattern is to break away from the one thread per connection model imposed
* by the classic blocking I/O model.
* <p>
* The IOReactor interface represents an abstract object implementing
* the Reactor pattern.
* <p>
* I/O reactors usually employ a small number of dispatch threads (often as
* few as one) to dispatch I/O event notifications to a much greater number
* (often as many as several thousands) of I/O sessions or connections. It is
* generally recommended to have one dispatch thread per CPU core.
*
* @since 4.0
*/
public interface IOReactor {
/**
* Returns the current status of the reactor.
*
* @return reactor status.
*/
IOReactorStatus getStatus();
/**
* Starts the reactor and initiates the dispatch of I/O event notifications
* to the given {@link IOEventDispatch}.
*
* @param eventDispatch the I/O event dispatch.
* @throws IOException in case of an I/O error.
*/
void execute(IOEventDispatch eventDispatch)
throws IOException;
/**
* Initiates shutdown of the reactor and blocks approximately for the given
* period of time in milliseconds waiting for the reactor to terminate all
* active connections, to shut down itself and to release system resources
* it currently holds.
*
* @param waitMs wait time in milliseconds.
* @throws IOException in case of an I/O error.
*/
void shutdown(long waitMs)
throws IOException;
/**
* Initiates shutdown of the reactor and blocks for a default period of
* time waiting for the reactor to terminate all active connections, to shut
* down itself and to release system resources it currently holds. It is
* up to individual implementations to decide for how long this method can
* remain blocked.
*
* @throws IOException in case of an I/O error.
*/
void shutdown()
throws IOException;
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactor.java | Java | gpl3 | 3,431 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
/**
* IOReactorStatus represents an internal status of an I/O reactor.
*
* @since 4.0
*/
public enum IOReactorStatus {
/**
* The reactor is inactive / has not been started
*/
INACTIVE,
/**
* The reactor is active / processing I/O events.
*/
ACTIVE,
/**
* Shutdown of the reactor has been requested.
*/
SHUTDOWN_REQUEST,
/**
* The reactor is shutting down.
*/
SHUTTING_DOWN,
/**
* The reactor has shut down.
*/
SHUT_DOWN;
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorStatus.java | Java | gpl3 | 1,746 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.CharacterCodingException;
import org.apache.http.util.CharArrayBuffer;
/**
* Session input buffer for non-blocking connections. This interface facilitates
* intermediate buffering of input data streamed from a source channel and
* reading buffered data to a destination, usually {@link ByteBuffer} or
* {@link WritableByteChannel}. This interface also provides methods for reading
* lines of text.
*
* @since 4.0
*/
public interface SessionInputBuffer {
/**
* Determines if the buffer contains data.
*
* @return <code>true</code> if there is data in the buffer,
* <code>false</code> otherwise.
*/
boolean hasData();
/**
* Returns the length of this buffer.
*
* @return buffer length.
*/
int length();
/**
* Makes an attempt to fill the buffer with data from the given
* {@link ReadableByteChannel}.
*
* @param src the source channel
* @return The number of bytes read, possibly zero, or <tt>-1</tt> if the
* channel has reached end-of-stream.
* @throws IOException in case of an I/O error.
*/
int fill(ReadableByteChannel src) throws IOException;
/**
* Reads one byte from the buffer. If the buffer is empty this method can
* throw a runtime exception. The exact type of runtime exception thrown
* by this method depends on implementation.
*
* @return one byte
*/
int read();
/**
* Reads a sequence of bytes from this buffer into the destination buffer,
* up to the given maximum limit. The exact number of bytes transferred
* depends on availability of data in this buffer and capacity of the
* destination buffer, but cannot be more than <code>maxLen</code> value.
*
* @param dst the destination buffer.
* @param maxLen the maximum number of bytes to be read.
* @return The number of bytes read, possibly zero.
*/
int read(ByteBuffer dst, int maxLen);
/**
* Reads a sequence of bytes from this buffer into the destination buffer.
* The exact number of bytes transferred depends on availability of data
* in this buffer and capacity of the destination buffer.
*
* @param dst the destination buffer.
* @return The number of bytes read, possibly zero.
*/
int read(ByteBuffer dst);
/**
* Reads a sequence of bytes from this buffer into the destination channel,
* up to the given maximum limit. The exact number of bytes transferred
* depends on availability of data in this buffer, but cannot be more than
* <code>maxLen</code> value.
*
* @param dst the destination channel.
* @param maxLen the maximum number of bytes to be read.
* @return The number of bytes read, possibly zero.
* @throws IOException in case of an I/O error.
*/
int read(WritableByteChannel dst, int maxLen) throws IOException;
/**
* Reads a sequence of bytes from this buffer into the destination channel.
* The exact number of bytes transferred depends on availability of data in
* this buffer.
*
* @param dst the destination channel.
* @return The number of bytes read, possibly zero.
* @throws IOException in case of an I/O error.
*/
int read(WritableByteChannel dst) throws IOException;
/**
* Attempts to transfer a complete line of characters up to a line delimiter
* from this buffer to the destination buffer. If a complete line is
* available in the buffer, the sequence of chars is transferred to the
* destination buffer the method returns <code>true</code>. The line
* delimiter itself is discarded. If a complete line is not available in
* the buffer, this method returns <code>false</code> without transferring
* anything to the destination buffer. If <code>endOfStream</code> parameter
* is set to <code>true</code> this method assumes the end of stream has
* been reached and the content currently stored in the buffer should be
* treated as a complete line.
* <p>
* The choice of a char encoding and line delimiter sequence is up to the
* specific implementations of this interface.
*
* @param dst the destination buffer.
* @param endOfStream
* @return <code>true</code> if a sequence of chars representing a complete
* line has been transferred to the destination buffer, <code>false</code>
* otherwise.
*
* @throws CharacterCodingException in case a character encoding or decoding
* error occurs.
*/
boolean readLine(CharArrayBuffer dst, boolean endOfStream)
throws CharacterCodingException;
/**
* Attempts to transfer a complete line of characters up to a line delimiter
* from this buffer to a newly created string. If a complete line is
* available in the buffer, the sequence of chars is transferred to a newly
* created string. The line delimiter itself is discarded. If a complete
* line is not available in the buffer, this method returns
* <code>null</code>. If <code>endOfStream</code> parameter
* is set to <code>true</code> this method assumes the end of stream has
* been reached and the content currently stored in the buffer should be
* treated as a complete line.
* <p>
* The choice of a char encoding and line delimiter sequence is up to the
* specific implementations of this interface.
*
* @param endOfStream
* @return a string representing a complete line, if available.
* <code>null</code> otherwise.
*
* @throws CharacterCodingException in case a character encoding or decoding
* error occurs.
*/
String readLine(boolean endOfStream)
throws CharacterCodingException;
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionInputBuffer.java | Java | gpl3 | 7,199 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.io.IOException;
import java.net.SocketAddress;
/**
* SessionRequest interface represents a request to establish a new connection
* (or session) to a remote host. It can be used to monitor the status of the
* request, to block waiting for its completion, or to cancel the request.
* <p>
* Implementations of this interface are expected to be threading safe.
*
* @since 4.0
*/
public interface SessionRequest {
/**
* Returns socket address of the remote host.
*
* @return socket address of the remote host
*/
SocketAddress getRemoteAddress();
/**
* Returns local socket address.
*
* @return local socket address.
*/
SocketAddress getLocalAddress();
/**
* Returns attachment object will be added to the session's context upon
* initialization. This object can be used to pass an initial processing
* state to the protocol handler.
*
* @return attachment object.
*/
Object getAttachment();
/**
* Determines whether the request has been completed (either successfully
* or unsuccessfully).
*
* @return <code>true</true> if the request has been completed,
* <code>false</true> if still pending.
*/
boolean isCompleted();
/**
* Returns {@link IOSession} instance created as a result of this request
* or <code>null</code> if the request is still pending.
*
* @return I/O session or <code>null</code> if the request is still pending.
*/
IOSession getSession();
/**
* Returns {@link IOException} instance if the request could not be
* successfully executed due to an I/O error or <code>null</code> if no
* error occurred to this point.
*
* @return I/O exception or <code>null</code> if no error occurred to
* this point.
*/
IOException getException();
/**
* Waits for completion of this session request.
*
* @throws InterruptedException in case the execution process was
* interrupted.
*/
void waitFor() throws InterruptedException;
/**
* Sets connect timeout value in milliseconds.
*
* @param timeout connect timeout value in milliseconds.
*/
void setConnectTimeout(int timeout);
/**
* Returns connect timeout value in milliseconds.
*
* @return connect timeout value in milliseconds.
*/
int getConnectTimeout();
/**
* Cancels the request. Invocation of this method will set the status of
* the request to completed and will unblock threads blocked in
* the {{@link #waitFor()}} method.
*/
void cancel();
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequest.java | Java | gpl3 | 3,881 |
/*
* $Date:
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
/**
* SessionBufferStatus interface is intended to query the status of session
* I/O buffers.
*
* @since 4.0
*/
public interface SessionBufferStatus {
/**
* Determines if the session input buffer contains data.
*
* @return <code>true</code> if the session input buffer contains data,
* <code>false</code> otherwise.
*/
boolean hasBufferedInput();
/**
* Determines if the session output buffer contains data.
*
* @return <code>true</code> if the session output buffer contains data,
* <code>false</code> otherwise.
*/
boolean hasBufferedOutput();
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionBufferStatus.java | Java | gpl3 | 1,862 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.io.IOException;
/**
* Abstract exception handler intended to deal with potentially recoverable
* I/O exceptions thrown by an I/O reactor.
*
* @since 4.0
*/
public interface IOReactorExceptionHandler {
/**
* This method is expected to examine the I/O exception passed as
* a parameter and decide whether it is safe to continue execution of
* the I/O reactor.
*
* @param ex potentially recoverable I/O exception
* @return <code>true</code> if it is safe to ignore the exception
* and continue execution of the I/O reactor; <code>false</code> if the
* I/O reactor must throw {@link IOReactorException} and terminate
*/
boolean handle(IOException ex);
/**
* This method is expected to examine the runtime exception passed as
* a parameter and decide whether it is safe to continue execution of
* the I/O reactor.
*
* @param ex potentially recoverable runtime exception
* @return <code>true</code> if it is safe to ignore the exception
* and continue execution of the I/O reactor; <code>false</code> if the
* I/O reactor must throw {@link RuntimeException} and terminate
*/
boolean handle(RuntimeException ex);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorExceptionHandler.java | Java | gpl3 | 2,458 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.net.SocketAddress;
/**
* ConnectingIOReactor represents an I/O reactor capable of establishing
* connections to remote hosts.
*
* @since 4.0
*/
public interface ConnectingIOReactor extends IOReactor {
/**
* Requests a connection to a remote host.
* <p>
* Opening a connection to a remote host usually tends to be a time
* consuming process and may take a while to complete. One can monitor and
* control the process of session initialization by means of the
* {@link SessionRequest} interface.
* <p>
* There are several parameters one can use to exert a greater control over
* the process of session initialization:
* <p>
* A non-null local socket address parameter can be used to bind the socket
* to a specific local address.
* <p>
* An attachment object can added to the new session's context upon
* initialization. This object can be used to pass an initial processing
* state to the protocol handler.
* <p>
* It is often desirable to be able to react to the completion of a session
* request asynchronously without having to wait for it, blocking the
* current thread of execution. One can optionally provide an implementation
* {@link SessionRequestCallback} instance to get notified of events related
* to session requests, such as request completion, cancellation, failure or
* timeout.
*
* @param remoteAddress the socket address of the remote host.
* @param localAddress the local socket address. Can be <code>null</code>,
* in which can the default local address and a random port will be used.
* @param attachment the attachment object. Can be <code>null</code>.
* @param callback interface. Can be <code>null</code>.
* @return session request object.
*/
SessionRequest connect(
SocketAddress remoteAddress,
SocketAddress localAddress,
Object attachment,
SessionRequestCallback callback);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ConnectingIOReactor.java | Java | gpl3 | 3,260 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
/**
* IOEventDispatch interface is used by I/O reactors to notify clients of I/O
* events pending for a particular session. All methods of this interface are
* executed on a dispatch thread of the I/O reactor. Therefore, it is important
* that processing that takes place in the event methods will not block the
* dispatch thread for too long, as the I/O reactor will be unable to react to
* other events.
*
* @since 4.0
*/
public interface IOEventDispatch {
/**
* Triggered after the given session has been just created.
*
* @param session the I/O session.
*/
void connected(IOSession session);
/**
* Triggered when the given session has input pending.
*
* @param session the I/O session.
*/
void inputReady(IOSession session);
/**
* Triggered when the given session is ready for output.
*
* @param session the I/O session.
*/
void outputReady(IOSession session);
/**
* Triggered when the given session as timed out.
*
* @param session the I/O session.
*/
void timeout(IOSession session);
/**
* Triggered when the given session has been terminated.
*
* @param session the I/O session.
*/
void disconnected(IOSession session);
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOEventDispatch.java | Java | gpl3 | 2,507 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.io.IOException;
/**
* I/O exception that can be thrown by an I/O reactor. Usually exceptions
* of this type are fatal and are not recoverable.
*
* @since 4.0
*/
public class IOReactorException extends IOException {
private static final long serialVersionUID = -4248110651729635749L;
public IOReactorException(final String message, final Exception cause) {
super(message);
if (cause != null) {
initCause(cause);
}
}
public IOReactorException(final String message) {
super(message);
}
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java | Java | gpl3 | 1,794 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.net.SocketAddress;
import java.util.Set;
import java.io.IOException;
/**
* ListeningIOReactor represents an I/O reactor capable of listening for
* incoming connections on one or several ports.
*
* @since 4.0
*/
public interface ListeningIOReactor extends IOReactor {
/**
* Opens a new listener endpoint with the given socket address. Once
* the endpoint is fully initialized it starts accepting incoming
* connections and propagates I/O activity notifications to the I/O event
* dispatcher.
* <p>
* {@link ListenerEndpoint#waitFor()} can be used to wait for the
* listener to be come ready to accept incoming connections.
* <p>
* {@link ListenerEndpoint#close()} can be used to shut down
* the listener even before it is fully initialized.
*
* @param address the socket address to listen on.
* @return listener endpoint.
*/
ListenerEndpoint listen(SocketAddress address);
/**
* Suspends the I/O reactor preventing it from accepting new connections on
* all active endpoints.
*
* @throws IOException in case of an I/O error.
*/
void pause()
throws IOException;
/**
* Resumes the I/O reactor restoring its ability to accept incoming
* connections on all active endpoints.
*
* @throws IOException in case of an I/O error.
*/
void resume()
throws IOException;
/**
* Returns a set of endpoints for this I/O reactor.
*
* @return set of endpoints.
*/
Set<ListenerEndpoint> getEndpoints();
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ListeningIOReactor.java | Java | gpl3 | 2,819 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.io.IOException;
import java.net.SocketAddress;
/**
* ListenerEndpoint interface represents an endpoint used by an I/O reactor
* to listen for incoming connection from remote clients.
*
* @since 4.0
*/
public interface ListenerEndpoint {
/**
* Returns the socket address of this endpoint.
*
* @return socket address.
*/
SocketAddress getAddress();
/**
* Returns an instance of {@link IOException} thrown during initialization
* of this endpoint or <code>null</code>, if initialization was successful.
*
* @return I/O exception object or <code>null</code>.
*/
IOException getException();
/**
* Waits for completion of initialization process of this endpoint.
*
* @throws InterruptedException in case the initialization process was
* interrupted.
*/
void waitFor() throws InterruptedException;
/**
* Determines if this endpoint has been closed and is no longer listens
* for incoming connections.
*
* @return <code>true</code> if the endpoint has been closed,
* <code>false</code> otherwise.
*/
boolean isClosed();
/**
* Closes this endpoint. The endpoint will stop accepting incoming
* connection.
*/
void close();
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ListenerEndpoint.java | Java | gpl3 | 2,521 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.nio.reactor;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.CharacterCodingException;
import org.apache.http.util.CharArrayBuffer;
/**
* Session output buffer for non-blocking connections. This interface
* facilitates intermediate buffering of output data streamed out to
* a destination channel and writing data to the buffer from a source, usually
* {@link ByteBuffer} or {@link ReadableByteChannel}. This interface also
* provides methods for writing lines of text.
*
* @since 4.0
*/
public interface SessionOutputBuffer {
/**
* Determines if the buffer contains data.
*
* @return <code>true</code> if there is data in the buffer,
* <code>false</code> otherwise.
*/
boolean hasData();
/**
* Returns the length of this buffer.
*
* @return buffer length.
*/
int length();
/**
* Makes an attempt to flush the content of this buffer to the given
* destination {@link WritableByteChannel}.
*
* @param channel the destination channel.
* @return The number of bytes written, possibly zero.
* @throws IOException in case of an I/O error.
*/
int flush(WritableByteChannel channel)
throws IOException;
/**
* Copies content of the source buffer into this buffer. The capacity of
* the destination will be expanded in order to accommodate the entire
* content of the source buffer.
*
* @param src the source buffer.
*/
void write(ByteBuffer src);
/**
* Reads a sequence of bytes from the source channel into this buffer.
*
* @param src the source channel.
*/
void write(ReadableByteChannel src)
throws IOException;
/**
* Copies content of the source buffer into this buffer as one line of text
* including a line delimiter. The capacity of the destination will be
* expanded in order to accommodate the entire content of the source buffer.
* <p>
* The choice of a char encoding and line delimiter sequence is up to the
* specific implementations of this interface.
*
* @param src the source buffer.
*/
void writeLine(CharArrayBuffer src)
throws CharacterCodingException;
/**
* Copies content of the given string into this buffer as one line of text
* including a line delimiter.
* The capacity of the destination will be expanded in order to accommodate
* the entire string.
* <p>
* The choice of a char encoding and line delimiter sequence is up to the
* specific implementations of this interface.
*
* @param s the string.
*/
void writeLine(String s)
throws IOException;
}
| 11chauhanpeeyush11-peeyush | OpenGPSTracker/external_sources/httpcore-4.1.1/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionOutputBuffer.java | Java | gpl3 | 4,034 |
ant clean; ant release; adb install -r bin/MetaTracker-release.apk
| 11chauhanpeeyush11-peeyush | MetaTracker/application/build-install.sh | Shell | gpl3 | 67 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.activity;
import android.content.SharedPreferences;
import android.location.Location;
import org.opentraces.metatracker.Constants;
public class TrackingState
{
public int loggingState;
public boolean newRoadRating;
public int roadRating;
public float distance;
public Track track = new Track();
public Segment segment = new Segment();
public Waypoint waypoint = new Waypoint();
private SharedPreferences sharedPreferences;
public TrackingState(SharedPreferences sharedPreferences) {
this.sharedPreferences = sharedPreferences;
reset();
}
public void load()
{
distance = sharedPreferences.getFloat("distance", 0.0f);
track.load();
waypoint.load();
}
public void save()
{
sharedPreferences.edit().putFloat("distance", distance).commit();
track.save();
waypoint.save();
}
public void reset()
{
loggingState = Constants.DOWN;
distance = 0.0f;
waypoint.reset();
track.reset();
}
public class Track
{
public int id = -1;
public String name = "NO TRACK";
public long creationTime;
public void load()
{
id = sharedPreferences.getInt("track.id", -1);
name = sharedPreferences.getString("track.name", "NO TRACK");
}
public void save()
{
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt("track.id", id);
editor.putString("track.name", name);
editor.commit();
}
public void reset()
{
name = "NO TRACK";
id = -1;
}
}
public static class Segment
{
public int id = -1;
}
public class Waypoint
{
public int id = -1;
public Location location;
public float speed;
public float accuracy;
public int count;
public void load()
{
id = sharedPreferences.getInt("waypoint.id", -1);
count = sharedPreferences.getInt("waypoint.count", 0);
}
public void save()
{
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt("waypoint.id", id);
editor.putInt("waypoint.count", count);
editor.commit();
}
public void reset()
{
count = 0;
id = -1;
location = null;
}
}
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/activity/TrackingState.java | Java | gpl3 | 2,800 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.activity;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.opentraces.metatracker.Constants;
import org.opentraces.metatracker.R;
import org.opentraces.metatracker.net.OpenTracesClient;
public class UploadTrackActivity extends Activity
{
protected static final int DIALOG_FILENAME = 11;
protected static final int PROGRESS_STEPS = 10;
private static final int DIALOG_INSTALL_FILEMANAGER = 34;
private static final String TAG = "MT.UploadTrack";
private String filePath;
private TextView fileNameView;
private SharedPreferences sharedPreferences;
private final DialogInterface.OnClickListener mFileManagerDownloadDialogListener = new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
Uri oiDownload = Uri.parse("market://details?id=org.openintents.filemanager");
Intent oiFileManagerDownloadIntent = new Intent(Intent.ACTION_VIEW, oiDownload);
try
{
startActivity(oiFileManagerDownloadIntent);
}
catch (ActivityNotFoundException e)
{
oiDownload = Uri.parse("http://openintents.googlecode.com/files/FileManager-1.1.3.apk");
oiFileManagerDownloadIntent = new Intent(Intent.ACTION_VIEW, oiDownload);
startActivity(oiFileManagerDownloadIntent);
}
}
};
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
setContentView(R.layout.uploaddialog);
fileNameView = (TextView) findViewById(R.id.filename);
filePath = null;
pickFile();
Button okay = (Button) findViewById(R.id.okayupload_button);
okay.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
if (filePath == null) {
return;
}
uploadFile(filePath);
}
});
}
/*
* (non-Javadoc)
* @see android.app.Activity#onCreateDialog(int)
*/
@Override
protected Dialog onCreateDialog(int id)
{
Dialog dialog = null;
Builder builder = null;
switch (id)
{
case DIALOG_INSTALL_FILEMANAGER:
builder = new AlertDialog.Builder(this);
builder
.setTitle(R.string.dialog_nofilemanager)
.setMessage(R.string.dialog_nofilemanager_message)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.btn_install, mFileManagerDownloadDialogListener)
.setNegativeButton(R.string.btn_cancel, null);
dialog = builder.create();
break;
default:
dialog = super.onCreateDialog(id);
break;
}
return dialog;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent)
{
super.onActivityResult(requestCode, resultCode, intent);
// Bundle extras = intent.getExtras();
switch (requestCode)
{
case Constants.REQUEST_CODE_PICK_FILE_OR_DIRECTORY:
if (resultCode == RESULT_OK && intent != null)
{
// obtain the filename
filePath = intent.getDataString();
if (filePath != null)
{
// Get rid of URI prefix:
if (filePath.startsWith("file://"))
{
filePath = filePath.substring(7);
}
fileNameView.setText(filePath);
}
}
break;
}
}
/*
http://edwards.sdsu.edu/labsite/index.php/josh/179-android-nuts-and-bolts-vii
http://code.google.com/p/openintents/source/browse/trunk/samples/TestFileManager/src/org/openintents/samples/TestFileManager/TestFileManager.java
*/
private void pickFile()
{
Intent intent = new Intent(Constants.ACTION_PICK_FILE);
intent.setData(Uri.parse("file://" + Environment.getExternalStorageDirectory() + Constants.EXTERNAL_DIR));
try
{
startActivityForResult(intent, Constants.REQUEST_CODE_PICK_FILE_OR_DIRECTORY);
} catch (ActivityNotFoundException e)
{
// No compatible file manager was found: install openintents filemanager.
showDialog(DIALOG_INSTALL_FILEMANAGER);
}
}
/*
http://edwards.sdsu.edu/labsite/index.php/josh/179-android-nuts-and-bolts-vii
http://code.google.com/p/openintents/source/browse/trunk/samples/TestFileManager/src/org/openintents/samples/TestFileManager/TestFileManager.java
*/
private void uploadFile(String aFilePath)
{
Intent intent = new Intent(Constants.ACTION_PICK_FILE);
intent.setData(Uri.parse("file://" + Environment.getExternalStorageDirectory() + Constants.EXTERNAL_DIR));
try
{
;
OpenTracesClient openTracesClient = new OpenTracesClient(sharedPreferences.getString(Constants.PREF_SERVER_URL, "http://geotracing.com/tland"));
openTracesClient.createSession();
openTracesClient.login(sharedPreferences.getString(Constants.PREF_SERVER_USER, "no_user"), sharedPreferences.getString(Constants.PREF_SERVER_PASSWORD, "no_passwd"));
openTracesClient.uploadFile(aFilePath);
openTracesClient.logout();
} catch (Throwable e)
{
Log.e(TAG, "Error uploading file : ", e);
}
}
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/activity/UploadTrackActivity.java | Java | gpl3 | 6,069 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.activity;
import org.opentraces.metatracker.R;
import android.os.Bundle;
import android.preference.PreferenceActivity;
/**
* Dialog for setting preferences.
*
* @author Just van den Broecke
*/
public class SettingsActivity extends PreferenceActivity
{
@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
addPreferencesFromResource( R.layout.settings );
}
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/activity/SettingsActivity.java | Java | gpl3 | 1,187 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.activity;
import android.app.*;
import android.content.*;
import android.database.ContentObserver;
import android.database.Cursor;
import android.location.Location;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.opentraces.metatracker.*;
import org.opentraces.metatracker.logger.GPSLoggerServiceManager;
import java.text.DecimalFormat;
public class MainActivity extends Activity
{
// MENU'S
private static final int MENU_SETTINGS = 1;
private static final int MENU_TRACKING = 2;
private static final int MENU_UPLOAD = 3;
private static final int MENU_HELP = 4;
private static final int MENU_ABOUT = 5;
private static final int DIALOG_INSTALL_OPENGPSTRACKER = 1;
private static final int DIALOG_INSTALL_ABOUT = 2;
private static DecimalFormat REAL_FORMATTER1 = new DecimalFormat("0.#");
private static DecimalFormat REAL_FORMATTER2 = new DecimalFormat("0.##");
private static final String TAG = "MetaTracker.Main";
private TextView waypointCountView, timeView, distanceView, speedView, roadRatingView, accuracyView;
private GPSLoggerServiceManager loggerServiceManager;
private TrackingState trackingState;
private MediaPlayer mediaPlayer;
// private PowerManager.WakeLock wakeLock = null;
private static final int COLOR_WHITE = 0xFFFFFFFF;
private static final int[] ROAD_RATING_COLORS = {0xFF808080, 0xFFCC0099, 0xFFEE0000, 0xFFFF6600, 0xFFFFCC00, 0xFF33CC33};
private SharedPreferences sharedPreferences;
private Button[] roadRatingButtons = new Button[6];
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState)
{
Log.d(TAG, "onCreate()");
super.onCreate(savedInstanceState);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
trackingState = new TrackingState(sharedPreferences);
trackingState.load();
setContentView(R.layout.main);
getLastTrackingState();
getApplicationContext().getContentResolver().registerContentObserver(Constants.Tracks.CONTENT_URI, true, trackingObserver);
// mUnits = new UnitsI18n(this, mUnitsChangeListener);
speedView = (TextView) findViewById(R.id.currentSpeed);
timeView = (TextView) findViewById(R.id.currentTime);
distanceView = (TextView) findViewById(R.id.totalDist);
waypointCountView = (TextView) findViewById(R.id.waypointCount);
accuracyView = (TextView) findViewById(R.id.currentAccuracy);
roadRatingView = (TextView) findViewById(R.id.currentRoadRating);
// Capture our button from layout
roadRatingButtons[0] = (Button) findViewById(R.id.road_qual_none);
roadRatingButtons[1] = (Button) findViewById(R.id.road_qual_nogo);
roadRatingButtons[2] = (Button) findViewById(R.id.road_qual_bad);
roadRatingButtons[3] = (Button) findViewById(R.id.road_qual_poor);
roadRatingButtons[4] = (Button) findViewById(R.id.road_qual_good);
roadRatingButtons[5] = (Button) findViewById(R.id.road_qual_best);
for (Button button : roadRatingButtons)
{
button.setOnClickListener(roadRatingButtonListener);
}
bindGPSLoggingService();
}
/**
* Called when the activity is started.
*/
@Override
public void onStart()
{
Log.d(TAG, "onStart()");
super.onStart();
}
/**
* Called when the activity is started.
*/
@Override
public void onRestart()
{
Log.d(TAG, "onRestart()");
super.onRestart();
}
/**
* Called when the activity is resumed.
*/
@Override
public void onResume()
{
Log.d(TAG, "onResume()");
getLastTrackingState();
// updateBlankingBehavior();
drawScreen();
super.onResume();
}
/**
* Called when the activity is paused.
*/
@Override
public void onPause()
{
trackingState.save();
/* if (this.wakeLock != null && this.wakeLock.isHeld())
{
this.wakeLock.release();
Log.w(TAG, "onPause(): Released lock to keep screen on!");
} */
Log.d(TAG, "onPause()");
super.onPause();
}
@Override
protected void onDestroy()
{
Log.d(TAG, "onDestroy()");
trackingState.save();
/* if (wakeLock != null && wakeLock.isHeld())
{
wakeLock.release();
Log.w(TAG, "onDestroy(): Released lock to keep screen on!");
} */
getApplicationContext().getContentResolver().unregisterContentObserver(trackingObserver);
sharedPreferences.unregisterOnSharedPreferenceChangeListener(this.sharedPreferenceChangeListener);
unbindGPSLoggingService();
super.onDestroy();
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
boolean result = super.onCreateOptionsMenu(menu);
menu.add(ContextMenu.NONE, MENU_TRACKING, ContextMenu.NONE, R.string.menu_tracking).setIcon(R.drawable.ic_menu_movie).setAlphabeticShortcut('T');
menu.add(ContextMenu.NONE, MENU_UPLOAD, ContextMenu.NONE, R.string.menu_upload).setIcon(R.drawable.ic_menu_upload).setAlphabeticShortcut('I');
menu.add(ContextMenu.NONE, MENU_SETTINGS, ContextMenu.NONE, R.string.menu_settings).setIcon(R.drawable.ic_menu_preferences).setAlphabeticShortcut('C');
menu.add(ContextMenu.NONE, MENU_HELP, ContextMenu.NONE, R.string.menu_help).setIcon(R.drawable.ic_menu_help).setAlphabeticShortcut('I');
menu.add(ContextMenu.NONE, MENU_ABOUT, ContextMenu.NONE, R.string.menu_about).setIcon(R.drawable.ic_menu_info_details).setAlphabeticShortcut('A');
return result;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case MENU_TRACKING:
startOpenGPSTrackerActivity();
break;
case MENU_UPLOAD:
startActivityForClass("org.opentraces.metatracker", "org.opentraces.metatracker.activity.UploadTrackActivity");
break;
case MENU_SETTINGS:
startActivity(new Intent(this, SettingsActivity.class));
break;
case MENU_ABOUT:
try
{
startActivityForResult(new Intent(Constants.OI_ACTION_SHOW_ABOUT_DIALOG), MENU_ABOUT);
}
catch (ActivityNotFoundException e)
{
showDialog(DIALOG_INSTALL_ABOUT);
}
break;
default:
showAlert(R.string.menu_message_unsupported);
break;
}
return true;
}
/*
* (non-Javadoc)
* @see android.app.Activity#onCreateDialog(int)
*/
@Override
protected Dialog onCreateDialog(int id)
{
Dialog dialog = null;
AlertDialog.Builder builder = null;
switch (id)
{
case DIALOG_INSTALL_OPENGPSTRACKER:
builder = new AlertDialog.Builder(this);
builder
.setTitle(R.string.dialog_noopengpstracker)
.setMessage(R.string.dialog_noopengpstracker_message)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.btn_install, mOpenGPSTrackerDownloadDialogListener)
.setNegativeButton(R.string.btn_cancel, null);
dialog = builder.create();
break;
case DIALOG_INSTALL_ABOUT:
builder = new AlertDialog.Builder(this);
builder
.setTitle(R.string.dialog_nooiabout)
.setMessage(R.string.dialog_nooiabout_message)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.btn_install, mOiAboutDialogListener)
.setNegativeButton(R.string.btn_cancel, null);
dialog = builder.create();
return dialog;
default:
dialog = super.onCreateDialog(id);
break;
}
return dialog;
}
private void drawTitleBar(String s)
{
this.setTitle(s);
}
/**
* Called on any update to Tracks table.
*/
private void onTrackingUpdate()
{
getLastTrackingState();
if (trackingState.waypoint.count == 1)
{
sendRoadRating();
}
drawScreen();
}
/**
* Called on any update to Tracks table.
*/
private synchronized void playPingSound()
{
if (!sharedPreferences.getBoolean(Constants.PREF_ENABLE_SOUND, false)) {
return;
}
try
{
if (mediaPlayer == null)
{
mediaPlayer = MediaPlayer.create(this, R.raw.ping_short);
} else
{
mediaPlayer.stop();
mediaPlayer.prepare();
}
mediaPlayer.start();
} catch (Throwable t)
{
Log.e(TAG, "Error playing sound", t);
}
}
/**
* Retrieve the last point of the current track
*/
private void getLastWaypoint()
{
Cursor waypoint = null;
try
{
ContentResolver resolver = this.getContentResolver();
waypoint = resolver.query(Uri.withAppendedPath(Constants.Tracks.CONTENT_URI, trackingState.track.id + "/" + Constants.Waypoints.TABLE),
new String[]{"max(" + Constants.Waypoints.TABLE + "." + Constants.Waypoints._ID + ")", Constants.Waypoints.LONGITUDE, Constants.Waypoints.LATITUDE, Constants.Waypoints.SPEED, Constants.Waypoints.ACCURACY, Constants.Waypoints.SEGMENT
}, null, null, null);
if (waypoint != null && waypoint.moveToLast())
{
// New point: increase pointcount
int waypointId = waypoint.getInt(0);
if (waypointId > 0 && trackingState.waypoint.id != waypointId)
{
trackingState.waypoint.count++;
trackingState.waypoint.id = waypoint.getInt(0);
// Increase total distance
Location newLocation = new Location(this.getClass().getName());
newLocation.setLongitude(waypoint.getDouble(1));
newLocation.setLatitude(waypoint.getDouble(2));
if (trackingState.waypoint.location != null)
{
float delta = trackingState.waypoint.location.distanceTo(newLocation);
// Log.d(TAG, "trackingState.distance=" + trackingState.distance + " delta=" + delta + " ll=" + waypoint.getDouble(1) + ", " +waypoint.getDouble(2));
trackingState.distance += delta;
}
trackingState.waypoint.location = newLocation;
trackingState.waypoint.speed = waypoint.getFloat(3);
trackingState.waypoint.accuracy = waypoint.getFloat(4);
trackingState.segment.id = waypoint.getInt(5);
playPingSound();
}
}
}
finally
{
if (waypoint != null)
{
waypoint.close();
}
}
}
private void getLastTrack()
{
Cursor cursor = null;
try
{
ContentResolver resolver = this.getApplicationContext().getContentResolver();
cursor = resolver.query(Constants.Tracks.CONTENT_URI, new String[]{"max(" + Constants.Tracks._ID + ")", Constants.Tracks.NAME, Constants.Tracks.CREATION_TIME}, null, null, null);
if (cursor != null && cursor.moveToLast())
{
int trackId = cursor.getInt(0);
// Check if new track created
if (trackId != trackingState.track.id)
{
trackingState.reset();
trackingState.save();
}
trackingState.track.id = trackId;
trackingState.track.name = cursor.getString(1);
trackingState.track.creationTime = cursor.getLong(2);
}
}
finally
{
if (cursor != null)
{
cursor.close();
}
}
}
private void getLastTrackingState()
{
getLastTrack();
getLoggingState();
getLastWaypoint();
}
private void sendRoadRating()
{
if (trackingState.roadRating > 0 && trackingState.newRoadRating && loggerServiceManager != null)
{
Uri media = Uri.withAppendedPath(Constants.NAME_URI, Uri.encode(trackingState.roadRating + ""));
loggerServiceManager.storeMediaUri(media);
trackingState.newRoadRating = false;
}
}
private void startOpenGPSTrackerActivity()
{
try
{
startActivityForClass("nl.sogeti.android.gpstracker", "nl.sogeti.android.gpstracker.viewer.LoggerMap");
}
catch (ActivityNotFoundException e)
{
Log.i(TAG, "Cannot find activity for open-gpstracker");
// No compatible file manager was found: install openintents filemanager.
showDialog(DIALOG_INSTALL_OPENGPSTRACKER);
}
sendRoadRating();
}
private void startActivityForClass(String aPackageName, String aClassName) throws ActivityNotFoundException
{
Intent intent = new Intent();
intent.setClassName(aPackageName, aClassName);
startActivity(intent);
}
private void bindGPSLoggingService()
{
unbindGPSLoggingService();
ServiceConnection serviceConnection = new ServiceConnection()
{
public void onServiceConnected(ComponentName className, IBinder service)
{
getLoggingState();
drawTitleBar();
}
public void onServiceDisconnected(ComponentName className)
{
trackingState.loggingState = Constants.DOWN;
}
};
loggerServiceManager = new GPSLoggerServiceManager(this);
loggerServiceManager.startup(serviceConnection);
}
private void unbindGPSLoggingService()
{
if (loggerServiceManager == null)
{
return;
}
try
{
loggerServiceManager.shutdown();
} finally
{
loggerServiceManager = null;
trackingState.loggingState = Constants.DOWN;
}
}
private void getLoggingState()
{
// Get state from logger if bound
trackingState.loggingState = loggerServiceManager == null ? Constants.DOWN : loggerServiceManager.getLoggingState();
// protect for values outside array bounds (set to unknown)
if (trackingState.loggingState < 0 || trackingState.loggingState > Constants.LOGGING_STATES.length - 1)
{
trackingState.loggingState = Constants.UNKNOWN;
}
}
private String getLoggingStateStr()
{
return Constants.LOGGING_STATES[trackingState.loggingState];
}
private void drawTitleBar()
{
drawTitleBar("MT : " + trackingState.track.name + " : " + getLoggingStateStr());
}
private void drawScreen()
{
drawTitleBar();
drawTripStats();
drawRoadRating();
}
/**
* Retrieves the numbers of the measured speed and altitude
* from the most recent waypoint and
* updates UI components with this latest bit of information.
*/
private void drawTripStats()
{
try
{
waypointCountView.setText(trackingState.waypoint.count + "");
long secsDelta = 0L;
long hours = 0L;
long mins = 0L;
long secs = 0L;
if (trackingState.track.creationTime != 0)
{
secsDelta = (System.currentTimeMillis() - trackingState.track.creationTime) / 1000;
hours = secsDelta / 3600L;
mins = (secsDelta % 3600L) / 60L;
secs = ((secsDelta % 3600L) % 60);
}
timeView.setText(formatTimeNum(hours) + ":" + formatTimeNum(mins) + ":" + formatTimeNum(secs));
speedView.setText(REAL_FORMATTER1.format(3.6f * trackingState.waypoint.speed));
accuracyView.setText(REAL_FORMATTER1.format(trackingState.waypoint.accuracy));
distanceView.setText(REAL_FORMATTER2.format(trackingState.distance / 1000f));
}
finally
{
}
}
private String formatTimeNum(long n)
{
return n < 10 ? ("0" + n) : (n + "");
}
private void drawRoadRating()
{
for (int i = 0; i < roadRatingButtons.length; i++)
{
roadRatingButtons[i].setBackgroundColor(COLOR_WHITE);
}
if (trackingState.roadRating >= 0)
{
roadRatingButtons[trackingState.roadRating].setBackgroundColor(ROAD_RATING_COLORS[trackingState.roadRating]);
}
String roadRatingStr = trackingState.roadRating + "";
roadRatingView.setText(roadRatingStr);
}
private void showAlert(int aMessage)
{
new AlertDialog.Builder(this)
.setMessage(aMessage)
.setPositiveButton("Ok", null)
.show();
}
private void updateBlankingBehavior()
{
boolean disableblanking = sharedPreferences.getBoolean(Constants.DISABLEBLANKING, false);
if (disableblanking)
{
/* if (wakeLock == null)
{
PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG);
}
wakeLock.acquire();
Log.w(TAG, "Acquired lock to keep screen on!"); */
}
}
private final DialogInterface.OnClickListener mOiAboutDialogListener = new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
Uri oiDownload = Uri.parse("market://details?id=org.openintents.about");
Intent oiAboutIntent = new Intent(Intent.ACTION_VIEW, oiDownload);
try
{
startActivity(oiAboutIntent);
}
catch (ActivityNotFoundException e)
{
oiDownload = Uri.parse("http://openintents.googlecode.com/files/AboutApp-1.0.0.apk");
oiAboutIntent = new Intent(Intent.ACTION_VIEW, oiDownload);
startActivity(oiAboutIntent);
}
}
};
private final DialogInterface.OnClickListener mOpenGPSTrackerDownloadDialogListener = new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
Uri marketUri = Uri.parse("market://details?id=nl.sogeti.android.gpstracker");
Intent downloadIntent = new Intent(Intent.ACTION_VIEW, marketUri);
try
{
startActivity(downloadIntent);
}
catch (ActivityNotFoundException e)
{
showAlert(R.string.dialog_failinstallopengpstracker_message);
}
}
};
// Create an anonymous implementation of OnClickListener
private View.OnClickListener roadRatingButtonListener = new View.OnClickListener()
{
public void onClick(View v)
{
for (int i = 0; i < roadRatingButtons.length; i++)
{
if (v.getId() == roadRatingButtons[i].getId())
{
trackingState.roadRating = i;
}
}
trackingState.newRoadRating = true;
drawRoadRating();
sendRoadRating();
}
};
private final ContentObserver trackingObserver = new ContentObserver(new Handler())
{
@Override
public void onChange(boolean selfUpdate)
{
if (!selfUpdate)
{
onTrackingUpdate();
Log.d(TAG, "trackingObserver onTrackingUpdate lastWaypointId=" + trackingState.waypoint.id);
} else
{
Log.w(TAG, "trackingObserver skipping change");
}
}
};
private final SharedPreferences.OnSharedPreferenceChangeListener sharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener()
{
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
{
if (key.equals(Constants.DISABLEBLANKING))
{
updateBlankingBehavior();
}
}
};
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/activity/MainActivity.java | Java | gpl3 | 18,582 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.xml;
/**
* Implements a Visitor that does nothin'
* $Id: DefaultVisitor.java,v 1.4 2003/01/06 00:23:49 just Exp $
*
* @author $Author: just $ - Just van den Broecke - Just Objects B.V. ©
*/
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
public class DefaultVisitor implements Visitor
{
public void visitDocumentPre(Document document)
{
}
public void visitDocumentPost(Document document)
{
}
public void visitElementPre(Element element)
{
}
public void visitElementPost(Element element)
{
}
public void visitText(Text element)
{
}
}
/*
* $Log: DefaultVisitor.java,v $
* Revision 1.4 2003/01/06 00:23:49 just
* moved devenv to linux
*
* Revision 1.3 2002/11/14 20:25:20 just
* reformat of code only
*
* Revision 1.2 2000/08/10 19:26:58 just
* changes for comments only
*
*
*/
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/xml/DefaultVisitor.java | Java | gpl3 | 1,669 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.xml;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
/**
* Makes deep copy of an Element for another Document.
* $Id: ElementCopyVisitor.java,v 1.4 2003/01/06 00:23:49 just Exp $
*
* @author $Author: just $ - Just van den Broecke - Just Objects B.V. ©
*/
public class ElementCopyVisitor extends DefaultVisitor
{
Document ownerDocument;
Element elementOrig;
Element elementCopy;
Element elementPointer;
int level = 0;
public ElementCopyVisitor(Document theOwnerDocument, Element theElement)
{
ownerDocument = theOwnerDocument;
elementOrig = theElement;
}
public Element getCopy()
{
new TreeWalker(this).traverse(elementOrig);
return elementCopy;
}
public void visitDocumentPre(Document document)
{
p("visitDocumentPre: level=" + level);
}
public void visitDocumentPost(Document document)
{
p("visitDocumentPost: level=" + level);
}
public void visitElementPre(Element element)
{
p("visitElementPre: " + element.getTagName() + " level=" + level);
// Create the copy; must use target document as factory
Element newElement = ownerDocument.createElement(element.getTagName());
// If first time we need to create the copy
if (elementCopy == null)
{
elementCopy = newElement;
} else
{
elementPointer.appendChild(newElement);
}
// Always point to the last created and appended element
elementPointer = newElement;
level++;
}
public void visitElementPost(Element element)
{
p("visitElementPost: " + element.getTagName() + " level=" + level);
DOMUtil.copyAttributes(element, elementPointer);
level--;
if (level == 0) return;
// Always transfer attributes if any
if (level > 0)
{
elementPointer = (Element) elementPointer.getParentNode();
}
}
public void visitText(Text element)
{
// Create the copy; must use target document as factory
Text newText = ownerDocument.createTextNode(element.getData());
// If first time we need to create the copy
if (elementPointer == null)
{
p("ERROR no element copy");
return;
} else
{
elementPointer.appendChild(newText);
}
}
private void p(String s)
{
//System.out.println("ElementCopyVisitor: "+s);
}
}
/*
* $Log: ElementCopyVisitor.java,v $
* Revision 1.4 2003/01/06 00:23:49 just
* moved devenv to linux
*
* Revision 1.3 2002/11/14 20:25:20 just
* reformat of code only
*
* Revision 1.2 2000/08/10 19:26:58 just
* changes for comments only
*
*
*/
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/xml/ElementCopyVisitor.java | Java | gpl3 | 3,342 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.xml;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* Utility methods for working with a DOM tree.
* $Id: DOMUtil.java,v 1.18 2004/09/10 14:20:50 just Exp $
*
* @author $Author: just $ - Just van den Broecke - Just Objects B.V. ©
*/
public class DOMUtil
{
/**
* Clears all childnodes in document
*/
public static void clearDocument(Document document)
{
NodeList nodeList = document.getChildNodes();
if (nodeList == null)
{
return;
}
int len = nodeList.getLength();
for (int i = 0; i < len; i++)
{
document.removeChild(nodeList.item(i));
}
}
/**
* Create empty document TO BE DEBUGGED!.
*/
public static Document createDocument()
{
DocumentBuilder documentBuilder = null;
// System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
try
{
documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
} catch (ParserConfigurationException pce)
{
warn("ParserConfigurationException: " + pce);
return null;
}
return documentBuilder.newDocument();
}
/**
* Copies all attributes from one element to another in the official way.
*/
public static void copyAttributes(Element elementFrom, Element elementTo)
{
NamedNodeMap nodeList = elementFrom.getAttributes();
if (nodeList == null)
{
// No attributes to copy: just return
return;
}
Attr attrFrom = null;
Attr attrTo = null;
// Needed as factory to create attrs
Document documentTo = elementTo.getOwnerDocument();
int len = nodeList.getLength();
// Copy each attr by making/setting a new one and
// adding to the target element.
for (int i = 0; i < len; i++)
{
attrFrom = (Attr) nodeList.item(i);
// Create an set value
attrTo = documentTo.createAttribute(attrFrom.getName());
attrTo.setValue(attrFrom.getValue());
// Set in target element
elementTo.setAttributeNode(attrTo);
}
}
public static Element getFirstElementByTagName(Document document, String tag)
{
// Get all elements matching the tagname
NodeList nodeList = document.getElementsByTagName(tag);
if (nodeList == null)
{
p("no list of elements with tag=" + tag);
return null;
}
// Get the first if any.
Element element = (Element) nodeList.item(0);
if (element == null)
{
p("no element for tag=" + tag);
return null;
}
return element;
}
public static Element getElementById(Document document, String id)
{
return getElementById(document.getDocumentElement(), id);
}
public static Element getElementById(Element element, String id)
{
return getElementById(element.getChildNodes(), id);
}
/**
* Get Element that has attribute id="xyz".
*/
public static Element getElementById(NodeList nodeList, String id)
{
// Note we should really use the Query here !!
Element element = null;
int len = nodeList.getLength();
for (int i = 0; i < len; i++)
{
Node node = (Node) nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE)
{
element = (Element) node;
if (((Element) node).getAttribute("id").equals(id))
{
// found it !
break;
}
}
}
// returns found element or null
return element;
}
public static Document parse(InputStream anInputStream)
{
Document document;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try
{
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(anInputStream);
} catch (Exception e)
{
throw new RuntimeException(e);
}
return document;
}
/**
* Prints an XML DOM.
*/
public static void printAsXML(Document document, PrintWriter printWriter)
{
new TreeWalker(new XMLPrintVisitor(printWriter)).traverse(document);
}
/**
* Prints an XML DOM.
*/
public static String dom2String(Document document)
{
StringWriter sw = new StringWriter();
DOMUtil.printAsXML(document, new PrintWriter(sw));
return sw.toString();
}
/**
* Replaces an element in document.
*/
public static void replaceElement(Element newElement, Element oldElement)
{
// Must be 1
Node parent = oldElement.getParentNode();
if (parent == null)
{
warn("replaceElement: no parent of oldElement found");
return;
}
// Create a copy owned by the document
ElementCopyVisitor ecv = new ElementCopyVisitor(oldElement.getOwnerDocument(), newElement);
Element newElementCopy = ecv.getCopy();
// Replace the old element with the new copy
parent.replaceChild(newElementCopy, oldElement);
}
/**
* Write Document structure to XML file.
*/
static public void document2File(Document document, String fileName)
{
new TreeWalker(new XMLPrintVisitor(fileName)).traverse(document);
}
public static void warn(String s)
{
p("DOMUtil: WARNING " + s);
}
public static void p(String s)
{
// System.out.println("DOMUtil: "+s);
}
}
/*
* $Log: DOMUtil.java,v $
* Revision 1.18 2004/09/10 14:20:50 just
* expandIncludes() tab to 2 spaces
*
* Revision 1.17 2004/09/10 12:48:11 just
* ok
*
* Revision 1.16 2003/01/06 00:23:49 just
* moved devenv to linux
*
* Revision 1.15 2002/11/14 20:25:20 just
* reformat of code only
*
* Revision 1.14 2002/06/18 10:30:02 just
* no rel change
*
* Revision 1.13 2001/08/01 15:20:23 kstroke
* fix for expand includes (added rootDir)
*
* Revision 1.12 2001/02/17 14:28:16 just
* added comments and changed interface for expandIds()
*
* Revision 1.11 2000/12/09 14:35:35 just
* added parse() method with optional DTD validation
*
* Revision 1.10 2000/09/21 22:37:20 just
* removed print statements
*
* Revision 1.9 2000/08/28 00:07:46 just
* changes for introduction of EntityResolverImpl
*
* Revision 1.8 2000/08/24 10:11:12 just
* added XML file verfication
*
* Revision 1.7 2000/08/10 19:26:58 just
* changes for comments only
*
*
*/
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/xml/DOMUtil.java | Java | gpl3 | 7,126 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.xml;
/**
* This interface specifies the callbacks from the TreeWalker.
* $Id: Visitor.java,v 1.4 2003/01/06 00:23:49 just Exp $
*
* @author $Author: just $ - Just van den Broecke - Just Objects B.V. ©
*/
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
/**
* Callback methods from the TreeWalker.
*/
public interface Visitor
{
public void visitDocumentPre(Document document);
public void visitDocumentPost(Document document);
public void visitElementPre(Element element);
public void visitElementPost(Element element);
public void visitText(Text element);
}
/*
* $Log: Visitor.java,v $
* Revision 1.4 2003/01/06 00:23:49 just
* moved devenv to linux
*
* Revision 1.3 2002/11/14 20:25:20 just
* reformat of code only
*
* Revision 1.2 2000/08/10 19:26:58 just
* changes for comments only
*
*
*/
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/xml/Visitor.java | Java | gpl3 | 1,671 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.xml;
/**
* This class does a pre-order walk of a DOM tree or Node, calling an ElementVisitor
* interface as it goes.
* <p>The numbered nodes in the trees below indicate the order of traversal given
* the specified <code>startNode</code> of "1".
* <pre>
*
* 1 x x
* / \ / \ / \
* 2 6 1 x x x
* /|\ \ /|\ \ /|\ \
* 3 4 5 7 2 3 4 x x 1 x x
*
* </pre>
* $Id: TreeWalker.java,v 1.5 2003/01/06 00:23:49 just Exp $
*
* @author $Author: just $ - Just van den Broecke - Just Objects B.V. ©
*/
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
public class TreeWalker
{
private Visitor visitor;
private Node topNode;
/**
* Constructor.
*
* @param
*/
public TreeWalker(Visitor theVisitor)
{
visitor = theVisitor;
}
/**
* Disabled default constructor.
*/
private TreeWalker()
{
}
/**
* Perform a pre-order traversal non-recursive style.
*/
public void traverse(Node node)
{
// Remember the top node
if (topNode == null)
{
topNode = node;
}
while (node != null)
{
visitPre(node);
Node nextNode = node.getFirstChild();
while (nextNode == null)
{
visitPost(node);
// We are ready after post-visiting the topnode
if (node == topNode)
{
return;
}
try
{
nextNode = node.getNextSibling();
}
catch (IndexOutOfBoundsException e)
{
nextNode = null;
}
if (nextNode == null)
{
node = node.getParentNode();
if (node == null)
{
nextNode = node;
break;
}
}
}
node = nextNode;
}
}
protected void visitPre(Node node)
{
switch (node.getNodeType())
{
case Node.DOCUMENT_NODE:
visitor.visitDocumentPre((Document) node);
break;
case Node.ELEMENT_NODE:
visitor.visitElementPre((Element) node);
break;
case Node.TEXT_NODE:
visitor.visitText((Text) node);
break;
// Not yet
case Node.ENTITY_REFERENCE_NODE:
System.out.println("ENTITY_REFERENCE_NODE");
default:
break;
}
}
protected void visitPost(Node node)
{
switch (node.getNodeType())
{
case Node.DOCUMENT_NODE:
visitor.visitDocumentPost((Document) node);
break;
case Node.ELEMENT_NODE:
visitor.visitElementPost((Element) node);
break;
case Node.TEXT_NODE:
break;
default:
break;
}
}
}
/*
* $Log: TreeWalker.java,v $
* Revision 1.5 2003/01/06 00:23:49 just
* moved devenv to linux
*
* Revision 1.4 2002/11/14 20:25:20 just
* reformat of code only
*
* Revision 1.3 2000/08/10 19:26:58 just
* changes for comments only
*
*
*/
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/xml/TreeWalker.java | Java | gpl3 | 3,723 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.xml;
import org.w3c.dom.*;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
/**
* XMLPrintVisitor implements the Visitor interface in the visitor design pattern for the
* purpose of printing in HTML-like format the various DOM-Nodes.
* <p>In HTML-like printing, only the following Nodes are printed:
* <DL>
* <DT>Document</DT>
* <DD>Only the doctype provided on this constructor is written (i.e. no XML declaration, <!DOCTYPE>, or internal DTD).</DD>
* <DT>Element</DT>
* <DD>All element names are uppercased.</DD>
* <DD>Empty elements are written as <code><BR></code> instead of <code><BR/></code>.</DD>
* <DT>Attr</DT>
* <DD>All attribute names are lowercased.</DD>
* <DT>Text</DT>
* </DL>
* <p/>
* <p>The following sample code uses the XMLPrintVisitor on a hierarchy of nodes:
* <pre>
* <p/>
* PrintWriter printWriter = new PrintWriter();
* Visitor htmlPrintVisitor = new XMLPrintVisitor(printWriter);
* TreeWalker treeWalker = new TreeWalker(htmlPrintVisitor);
* treeWalker.traverse(document);
* printWriter.close();
* <p/>
* </pre>
* <p/>
* <P>By default, this doesn't print non-specified attributes.</P>
*
* @author $Author: just $ - Just van den Broecke - Just Objects B.V. ©
* @version $Id: XMLPrintVisitor.java,v 1.8 2003/01/06 00:23:49 just Exp $
* @see Visitor
* @see TreeWalker
*/
public class XMLPrintVisitor implements Visitor
{
protected Writer writer = null;
protected int level = 0;
protected String doctype = null;
/**
* Constructor for customized encoding and doctype.
*
* @param writer The character output stream to use.
* @param encoding Java character encoding in use by <VAR>writer</VAR>.
* @param doctype String to be printed at the top of the document.
*/
public XMLPrintVisitor(Writer writer, String encoding, String doctype)
{
this.writer = writer;
this.doctype = doctype;
// this.isPrintNonSpecifiedAttributes = false;
}
/**
* Constructor for customized encoding.
*
* @param writer The character output stream to use.
* @param encoding Java character encoding in use by <VAR>writer</VAR>.
*/
public XMLPrintVisitor(Writer writer, String encoding)
{
this(writer, encoding, null);
}
/**
* Constructor for default encoding.
*
* @param writer The character output stream to use.
*/
public XMLPrintVisitor(Writer writer)
{
this(writer, null, null);
}
/**
* Constructor for default encoding.
*
* @param fileName the filepath to write to
*/
public XMLPrintVisitor(String fileName)
{
try
{
writer = new FileWriter(fileName);
} catch (IOException ioe)
{
}
}
/**
* Writes the <var>doctype</var> from the constructor (if any).
*
* @param document Node print as HTML.
*/
public void visitDocumentPre(Document document)
{
}
/**
* Flush the writer.
*
* @param document Node to print as HTML.
*/
public void visitDocumentPost(Document document)
{
write("\n");
flush();
}
/**
* Creates a formatted string representation of the start of the specified <var>element</var> Node
* and its associated attributes, and directs it to the print writer.
*
* @param element Node to print as XML.
*/
public void visitElementPre(Element element)
{
this.level++;
write("<" + element.getTagName());
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++)
{
Attr attr = (Attr) attributes.item(i);
visitAttributePre(attr);
}
write(">\n");
}
/**
* Creates a formatted string representation of the end of the specified <var>element</var> Node,
* and directs it to the print writer.
*
* @param element Node to print as XML.
*/
public void visitElementPost(Element element)
{
String tagName = element.getTagName();
// if (element.hasChildNodes()) {
write("</" + tagName + ">\n");
// }
level--;
}
/**
* Creates a formatted string representation of the specified <var>attribute</var> Node
* and its associated attributes, and directs it to the print writer.
* <p>Note that TXAttribute Nodes are not parsed into the document object hierarchy by the
* XML4J parser; attributes exist as part of a Element Node.
*
* @param attr attr to print.
*/
public void visitAttributePre(Attr attr)
{
write(" " + attr.getName() + "=\"" + attr.getValue() + "\"");
}
/**
* Creates a formatted string representation of the specified <var>text</var> Node,
* and directs it to the print writer. CDATASections are respected.
*
* @param text Node to print with format.
*/
public void visitText(Text text)
{
if (this.level > 0)
{
write(text.getData());
}
}
private void write(String s)
{
try
{
writer.write(s);
} catch (IOException e)
{
}
}
private void flush()
{
try
{
writer.flush();
} catch (IOException e)
{
}
}
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/xml/XMLPrintVisitor.java | Java | gpl3 | 5,835 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker;
import android.net.Uri;
/**
* Various application wide constants
*
* @author Just van den Broecke
* @version $Id:$
*/
public class Constants
{
/**
* The authority of the track data provider
*/
public static final String AUTHORITY = "nl.sogeti.android.gpstracker";
/**
* The content:// style URL for the track data provider
*/
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
/**
* Logging states, slightly adapted from GPSService states
*/
public static final int DOWN = 0;
public static final int LOGGING = 1;
public static final int PAUSED = 2;
public static final int STOPPED = 3;
public static final int UNKNOWN = 4;
public static String[] LOGGING_STATES = {"down", "logging", "paused", "stopped", "unknown"};
public static final String DISABLEBLANKING = "disableblanking";
public static final String PREF_ENABLE_SOUND = "pref_enablesound";
public static final String PREF_SERVER_URL = "pref_server_url";
public static final String PREF_SERVER_USER = "pref_server_user";
public static final String PREF_SERVER_PASSWORD = "pref_server_password";
public static final String SERVICE_GPS_LOGGING = "nl.sogeti.android.gpstracker.intent.action.GPSLoggerService";
public static final String EXTERNAL_DIR = "/OpenGPSTracker/";
public static final Uri NAME_URI = Uri.parse("content://" + AUTHORITY + ".string");
/**
* Activity Action: Pick a file through the file manager, or let user
* specify a custom file name.
* Data is the current file name or file name suggestion.
* Returns a new file name as file URI in data.
* <p/>
* <p>Constant Value: "org.openintents.action.PICK_FILE"</p>
*/
public static final String ACTION_PICK_FILE = "org.openintents.action.PICK_FILE";
public static final int REQUEST_CODE_PICK_FILE_OR_DIRECTORY = 1;
/**
* Activity Action: Show an about dialog to display
* information about the application.
* <p/>
* The application information is retrieved from the
* application's manifest. In order to send the package
* you have to launch this activity through
* startActivityForResult().
* <p/>
* Alternatively, you can specify the package name
* manually through the extra EXTRA_PACKAGE.
* <p/>
* All data can be replaced using optional intent extras.
* <p/>
* <p>
* Constant Value: "org.openintents.action.SHOW_ABOUT_DIALOG"
* </p>
*/
public static final String OI_ACTION_SHOW_ABOUT_DIALOG =
"org.openintents.action.SHOW_ABOUT_DIALOG";
/**
* Definitions for tracks.
*
*/
public static final class Tracks implements android.provider.BaseColumns
{
/**
* The name of this table
*/
static final String TABLE = "tracks";
/**
* The end time
*/
public static final String NAME = "name";
public static final String CREATION_TIME = "creationtime";
/**
* The MIME type of a CONTENT_URI subdirectory of a single track.
*/
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.nl.sogeti.android.track";
/**
* The content:// style URL for this provider
*/
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + TABLE);
}
/**
* Definitions for segments.
*/
public static final class Segments implements android.provider.BaseColumns
{
/**
* The name of this table
*/
static final String TABLE = "segments";
/**
* The track _id to which this segment belongs
*/
public static final String TRACK = "track";
static final String TRACK_TYPE = "INTEGER NOT NULL";
static final String _ID_TYPE = "INTEGER PRIMARY KEY AUTOINCREMENT";
/**
* The MIME type of a CONTENT_URI subdirectory of a single segment.
*/
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.nl.sogeti.android.segment";
/**
* The MIME type of CONTENT_URI providing a directory of segments.
*/
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.nl.sogeti.android.segment";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + TABLE);
}
/**
* Definitions for media URI's.
*
*/
public static final class Media implements android.provider.BaseColumns
{
/**
* The track _id to which this segment belongs
*/
public static final String TRACK = "track";
public static final String SEGMENT = "segment";
public static final String WAYPOINT = "waypoint";
public static final String URI = "uri";
/**
* The name of this table
*/
public static final String TABLE = "media";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + TABLE);
}
/**
* Definitions for waypoints.
*
*/
public static final class Waypoints implements android.provider.BaseColumns
{
/**
* The name of this table
*/
public static final String TABLE = "waypoints";
/**
* The latitude
*/
public static final String LATITUDE = "latitude";
/**
* The longitude
*/
public static final String LONGITUDE = "longitude";
/**
* The recorded time
*/
public static final String TIME = "time";
/**
* The speed in meters per second
*/
public static final String SPEED = "speed";
/**
* The segment _id to which this segment belongs
*/
public static final String SEGMENT = "tracksegment";
/**
* The accuracy of the fix
*/
public static final String ACCURACY = "accuracy";
/**
* The altitude
*/
public static final String ALTITUDE = "altitude";
/**
* the bearing of the fix
*/
public static final String BEARING = "bearing";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + TABLE);
}
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/Constants.java | Java | gpl3 | 6,401 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.logger;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import nl.sogeti.android.gpstracker.logger.IGPSLoggerServiceRemote;
import org.opentraces.metatracker.Constants;
/**
* Class to interact with the service that tracks and logs the locations
*
* @author rene (c) Jan 18, 2009, Sogeti B.V. adapted by Just van den Broecke
* @version $Id: GPSLoggerServiceManager.java 455 2010-03-14 08:16:44Z rcgroot $
*/
public class GPSLoggerServiceManager
{
private static final String TAG = "MT.GPSLoggerServiceManager";
private static final String REMOTE_EXCEPTION = "REMOTE_EXCEPTION";
private Context mCtx;
private IGPSLoggerServiceRemote mGPSLoggerRemote;
private final Object mStartLock = new Object();
private boolean mStarted = false;
/**
* Class for interacting with the main interface of the service.
*/
private ServiceConnection mServiceConnection = null;
public GPSLoggerServiceManager(Context ctx)
{
this.mCtx = ctx;
}
public boolean isStarted()
{
synchronized (mStartLock)
{
return mStarted;
}
}
public int getLoggingState()
{
synchronized (mStartLock)
{
int logging = Constants.UNKNOWN;
try
{
if (this.mGPSLoggerRemote != null)
{
logging = this.mGPSLoggerRemote.loggingState();
Log.d(TAG, "mGPSLoggerRemote tells state to be " + logging);
} else
{
Log.w(TAG, "Remote interface to logging service not found. Started: " + mStarted);
}
}
catch (RemoteException e)
{
Log.e(TAG, "Could stat GPSLoggerService.", e);
}
return logging;
}
}
public boolean isMediaPrepared()
{
synchronized (mStartLock)
{
boolean prepared = false;
try
{
if (this.mGPSLoggerRemote != null)
{
prepared = this.mGPSLoggerRemote.isMediaPrepared();
} else
{
Log.w(TAG, "Remote interface to logging service not found. Started: " + mStarted);
}
}
catch (RemoteException e)
{
Log.e(TAG, "Could stat GPSLoggerService.", e);
}
return prepared;
}
}
public long startGPSLogging(String name)
{
synchronized (mStartLock)
{
if (mStarted)
{
try
{
if (this.mGPSLoggerRemote != null)
{
return this.mGPSLoggerRemote.startLogging();
}
}
catch (RemoteException e)
{
Log.e(TAG, "Could not start GPSLoggerService.", e);
}
}
return -1;
}
}
public void pauseGPSLogging()
{
synchronized (mStartLock)
{
if (mStarted)
{
try
{
if (this.mGPSLoggerRemote != null)
{
this.mGPSLoggerRemote.pauseLogging();
}
}
catch (RemoteException e)
{
Log.e(TAG, "Could not start GPSLoggerService.", e);
}
}
}
}
public long resumeGPSLogging()
{
synchronized (mStartLock)
{
if (mStarted)
{
try
{
if (this.mGPSLoggerRemote != null)
{
return this.mGPSLoggerRemote.resumeLogging();
}
}
catch (RemoteException e)
{
Log.e(TAG, "Could not start GPSLoggerService.", e);
}
}
return -1;
}
}
public void stopGPSLogging()
{
synchronized (mStartLock)
{
if (mStarted)
{
try
{
if (this.mGPSLoggerRemote != null)
{
this.mGPSLoggerRemote.stopLogging();
}
}
catch (RemoteException e)
{
Log.e(GPSLoggerServiceManager.REMOTE_EXCEPTION, "Could not stop GPSLoggerService.", e);
}
} else
{
Log.e(TAG, "No GPSLoggerRemote service connected to this manager");
}
}
}
public void storeMediaUri(Uri mediaUri)
{
synchronized (mStartLock)
{
if (mStarted)
{
try
{
if (this.mGPSLoggerRemote != null)
{
this.mGPSLoggerRemote.storeMediaUri(mediaUri);
}
}
catch (RemoteException e)
{
Log.e(GPSLoggerServiceManager.REMOTE_EXCEPTION, "Could not send media to GPSLoggerService.", e);
}
} else
{
Log.e(TAG, "No GPSLoggerRemote service connected to this manager");
}
}
}
/**
* Means by which an Activity lifecycle aware object hints about binding and unbinding
*/
public void startup(final ServiceConnection observer)
{
Log.d(TAG, "connectToGPSLoggerService()");
if (!mStarted)
{
this.mServiceConnection = new ServiceConnection()
{
public void onServiceConnected(ComponentName className, IBinder service)
{
synchronized (mStartLock)
{
Log.d(TAG, "onServiceConnected()");
GPSLoggerServiceManager.this.mGPSLoggerRemote = IGPSLoggerServiceRemote.Stub.asInterface(service);
mStarted = true;
if (observer != null)
{
observer.onServiceConnected(className, service);
}
}
}
public void onServiceDisconnected(ComponentName className)
{
synchronized (mStartLock)
{
Log.e(TAG, "onServiceDisconnected()");
GPSLoggerServiceManager.this.mGPSLoggerRemote = null;
mStarted = false;
if (observer != null)
{
observer.onServiceDisconnected(className);
}
}
}
};
this.mCtx.bindService(new Intent(Constants.SERVICE_GPS_LOGGING), this.mServiceConnection, Context.BIND_AUTO_CREATE);
} else
{
Log.w(TAG, "Attempting to connect whilst connected");
}
}
/**
* Means by which an Activity lifecycle aware object hints about binding and unbinding
*/
public void shutdown()
{
Log.d(TAG, "disconnectFromGPSLoggerService()");
try
{
this.mCtx.unbindService(this.mServiceConnection);
}
catch (IllegalArgumentException e)
{
Log.e(TAG, "Failed to unbind a service, prehaps the service disapeared?", e);
}
}
} | 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/logger/GPSLoggerServiceManager.java | Java | gpl3 | 6,466 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.net;
/**
* Generic exception wrapper. $Id: ClientException.java,v 1.2 2005/07/22 22:25:20 just Exp $
*
* @author $Author: Just van den Broecke$
* @version $Revision: $
*/
public class ClientException extends Exception
{
private int errorId;
String error;
protected ClientException()
{
}
public ClientException(String aMessage, Throwable t)
{
super(aMessage + "\n embedded exception=" + t.toString());
}
public ClientException(String aMessage)
{
super(aMessage);
}
public ClientException(int anErrorId, String anError, String someDetails)
{
super(someDetails);
errorId = anErrorId;
error = anError;
}
public ClientException(Throwable t)
{
this("ClientException: ", t);
}
public String toString()
{
return "ClientException: " + getMessage();
}
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/net/ClientException.java | Java | gpl3 | 1,533 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.net;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
/**
* Constants and utilities for the KW protocol.
*
* @author $Author: $
* @version $Id: Protocol.java,v 1.2 2005/07/22 22:25:20 just Exp $
*/
public class Protocol
{
/**
* AMUSE Protocol version.
*/
public static final String PROTOCOL_VERSION = "4.0";
/**
* Postfixes
*/
public static final String POSTFIX_REQ = "-req";
public static final String POSTFIX_RSP = "-rsp";
public static final String POSTFIX_NRSP = "-nrsp";
public static final String POSTFIX_IND = "-ind";
/**
* Service id's
*/
public static final String SERVICE_SESSION_CREATE = "ses-create";
public static final String SERVICE_LOGIN = "ses-login";
public static final String SERVICE_LOGOUT = "ses-logout";
public static final String SERVICE_SESSION_PING = "ses-ping";
public static final String SERVICE_QUERY_STORE = "query-store";
public static final String SERVICE_MAP_AVAIL = "map-avail";
public static final String SERVICE_MULTI_REQ = "multi-req";
/**
* Common Attributes *
*/
public static final String ATTR_DEVID = "devid";
public static final String ATTR_USER = "user";
public static final String ATTR_AGENT = "agent";
public static final String ATTR_AGENTKEY = "agentkey";
public static final String ATTR_SECTIONS = "sections";
public static final String ATTR_ID = "id";
public static final String ATTR_CMD = "cmd";
public static final String ATTR_ERROR = "error";
public static final String ATTR_ERRORID = "errorId"; // yes id must be Id !!
public static final String ATTR_PASSWORD = "password";
public static final String ATTR_PROTOCOLVERSION = "protocolversion";
public static final String ATTR_STOPONERROR = "stoponerror";
public static final String ATTR_T = "t";
public static final String ATTR_TIME = "time";
public static final String ATTR_DETAILS = "details";
public static final String ATTR_NAME = "name";
/**
* Error ids returned in -nrsp as attribute ATTR_ERRORID
*/
public final static int
// 4000-4999 are "user-correctable" errors (user sends wrong input)
// 5000-5999 are server failures
ERR4004_ILLEGAL_COMMAND_FOR_STATE = 4003,
ERR4004_INVALID_ATTR_VALUE = 4004,
ERR4007_AGENT_LEASE_EXPIRED = 4007,
//_Portal/Application_error_codes_(4100-4199)
ERR4100_INVALID_USERNAME = 4100,
ERR4101_INVALID_PASSWORD = 4101,
ERR4102_MAX_LOGIN_ATTEMPTS_EXCEEDED = 4102,
//_General_Server_Error_Codes
ERR5000_INTERNAL_SERVER_ERROR = 5000;
/**
* Create login protocol request.
*/
public static Element createLoginRequest(String aName, String aPassword)
{
Element request = createRequest(SERVICE_LOGIN);
request.setAttribute(ATTR_NAME, aName);
request.setAttribute(ATTR_PASSWORD, aPassword);
request.setAttribute(ATTR_PROTOCOLVERSION, PROTOCOL_VERSION);
return request;
}
/**
* Create create-session protocol request.
*/
public static Element createSessionCreateRequest()
{
return createRequest(SERVICE_SESSION_CREATE);
}
/**
* Create a positive response element.
*/
public static Element createRequest(String aService)
{
Element element = null;
try
{
DocumentBuilderFactory dFact = DocumentBuilderFactory.newInstance();
DocumentBuilder build = dFact.newDocumentBuilder();
Document doc = build.newDocument();
element = doc.createElement(aService + POSTFIX_REQ);
doc.appendChild(element);
} catch (Throwable t)
{
}
return element;
}
/**
* Return service name for a message tag.
*
* @param aMessageTag
* @return
*/
public static String getServiceName(String aMessageTag)
{
try
{
return aMessageTag.substring(0, aMessageTag.lastIndexOf('-'));
}
catch (Throwable t)
{
throw new IllegalArgumentException("getServiceName: invalid tag: " + aMessageTag);
}
}
/**
* Is message a (negative) response..
*
* @param message
* @return
*/
public static boolean isResponse(Element message)
{
String tag = message.getTagName();
return tag.endsWith(POSTFIX_RSP) || tag.endsWith(POSTFIX_NRSP);
}
/**
* Is message a positive response..
*
* @param message
* @return
*/
public static boolean isPositiveResponse(Element message)
{
return message.getTagName().endsWith(POSTFIX_RSP);
}
/**
* Is message a negative response..
*
* @param message
* @return
*/
public static boolean isNegativeResponse(Element message)
{
return message.getTagName().endsWith(POSTFIX_NRSP);
}
public static boolean isPositiveServiceResponse(Element message, String service)
{
return isPositiveResponse(message) && service.equals(getServiceName(message.getTagName()));
}
public static boolean isNegativeServiceResponse(Element message, String service)
{
return isNegativeResponse(message) && service.equals(getServiceName(message.getTagName()));
}
public static boolean isService(Element message, String service)
{
return service.equals(getServiceName(message.getTagName()));
}
protected Protocol()
{
}
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/net/Protocol.java | Java | gpl3 | 5,814 |
/*
* Copyright (C) 2010 Just Objects B.V.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.opentraces.metatracker.net;
import android.util.Log;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.opentraces.metatracker.xml.DOMUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Basic OpenTraces client using XML over HTTP.
* <p/>
* Use this class within Android HTTP clients.
*
* @author $Author: Just van den Broecke$
* @version $Revision: 3043 $ $Id: HTTPClient.java 3043 2009-01-17 16:25:21Z just $
* @see
*/
public class OpenTracesClient extends Protocol
{
private static final String LOG_TAG = "MT.OpenTracesClient";
/**
* Default KW session timeout (minutes).
*/
public static final int DEFAULT_TIMEOUT_MINS = 5;
/**
* Full KW protocol URL.
*/
private String protocolURL;
/**
* Debug flag for verbose output.
*/
private boolean debug;
/**
* Key gotten on login ack
*/
private String agentKey;
/**
* Keyworx session timeout (minutes).
*/
private int timeout;
/**
* Saved login request for session restore on timeout.
*/
private Element loginRequest;
/**
* Constructor with full protocol URL e.g. http://www.bla.com/proto.srv.
*/
public OpenTracesClient(String aProtocolURL)
{
this(aProtocolURL, DEFAULT_TIMEOUT_MINS);
}
/**
* Constructor with protocol URL and timeout.
*/
public OpenTracesClient(String aProtocolURL, int aTimeout)
{
protocolURL = aProtocolURL;
if (!protocolURL.endsWith("/proto.srv")) {
protocolURL += "/proto.srv";
}
timeout = aTimeout;
}
/**
* Create session.
*/
synchronized public Element createSession() throws ClientException
{
agentKey = null;
// Create XML request
Element request = createRequest(SERVICE_SESSION_CREATE);
// Execute request
Element response = doRequest(request);
handleResponse(request, response);
throwOnNrsp(response);
// Returns positive response
return response;
}
public String getAgentKey()
{
return agentKey;
}
public boolean hasSession()
{
return agentKey != null;
}
public boolean isLoggedIn()
{
return hasSession() && loginRequest != null;
}
/**
* Login on portal.
*/
synchronized public Element login(String aName, String aPassword) throws ClientException
{
// Create XML request
Element request = createLoginRequest(aName, aPassword);
// Execute request
Element response = doRequest(request);
// Filter session-related attrs
handleResponse(request, response);
throwOnNrsp(response);
// Returns positive response
return response;
}
/**
* Keep alive service.
*/
synchronized public Element ping() throws ClientException
{
return service(createRequest(SERVICE_SESSION_PING));
}
/**
* perform TWorx service request.
*/
synchronized public Element service(Element request) throws ClientException
{
throwOnInvalidSession();
// Execute request
Element response = doRequest(request);
// Check for session timeout
response = redoRequestOnSessionTimeout(request, response);
// Throw exception on negative response
throwOnNrsp(response);
// Positive response: return wrapped handler response
return response;
}
/**
* perform TWorx multi-service request.
*/
synchronized public List<Element> service(List<Element> requests, boolean stopOnError) throws ClientException
{
// We don't need a valid session as one of the requests
// may be a login or create-session request.
// Create multi-req request with individual requests as children
Element request = createRequest(SERVICE_MULTI_REQ);
request.setAttribute(ATTR_STOPONERROR, stopOnError + "");
for (Element req : requests)
{
request.appendChild(req);
}
// Execute request
Element response = doRequest(request);
// Check for session timeout
response = redoRequestOnSessionTimeout(request, response);
// Throw exception on negative response
throwOnNrsp(response);
// Filter child responses for session-based responses
NodeList responseList = response.getChildNodes();
List<Element> responses = new ArrayList(responseList.getLength());
for (int i = 0; i < responseList.getLength(); i++)
{
handleResponse(requests.get(i), (Element) responseList.item(i));
responses.add((Element) responseList.item(i));
}
// Positive multi-req response: return child responses
return responses;
}
/**
* Logout from portal.
*/
synchronized public Element logout() throws ClientException
{
throwOnInvalidSession();
// Create XML request
Element request = createRequest(SERVICE_LOGOUT);
// Execute request
Element response = doRequest(request);
handleResponse(request, response);
// Throw exception or return positive response
// throwOnNrsp(response);
return response;
}
/*
http://brainflush.wordpress.com/2008/10/17/talking-to-web-servers-via-http-in-android-10/
*/
public void uploadFile(String fileName)
{
try
{
DefaultHttpClient httpclient = new DefaultHttpClient();
File f = new File(fileName);
HttpPost httpost = new HttpPost("http://local.geotracing.com/tland/media.srv");
MultipartEntity entity = new MultipartEntity();
entity.addPart("myIdentifier", new StringBody("somevalue"));
entity.addPart("myFile", new FileBody(f));
httpost.setEntity(entity);
HttpResponse response;
response = httpclient.execute(httpost);
Log.d(LOG_TAG, "Upload result: " + response.getStatusLine());
if (entity != null)
{
entity.consumeContent();
}
httpclient.getConnectionManager().shutdown();
} catch (Throwable ex)
{
Log.d(LOG_TAG, "Upload failed: " + ex.getMessage() + " Stacktrace: " + ex.getStackTrace());
}
}
public void setDebug(boolean b)
{
debug = b;
}
/**
* Filter responses for session-related requests.
*/
private void handleResponse(Element request, Element response) throws ClientException
{
if (isNegativeResponse(response))
{
return;
}
String service = Protocol.getServiceName(request.getTagName());
if (service.equals(SERVICE_LOGIN))
{
// Save for later session restore
loginRequest = request;
// Save session key
agentKey = response.getAttribute(ATTR_AGENTKEY);
// if (response.hasAttribute(ATTR_TIME)) {
// DateTimeUtils.setTime(response.getLongAttr(ATTR_TIME));
// }
} else if (service.equals(SERVICE_SESSION_CREATE))
{
// Save session key
agentKey = response.getAttribute(ATTR_AGENTKEY);
} else if (service.equals(SERVICE_LOGOUT))
{
loginRequest = null;
agentKey = null;
}
}
/**
* Throw exception on negative protocol response.
*/
private void throwOnNrsp(Element anElement) throws ClientException
{
if (isNegativeResponse(anElement))
{
String details = "no details";
if (anElement.hasAttribute(ATTR_DETAILS))
{
details = anElement.getAttribute(ATTR_DETAILS);
}
throw new ClientException(Integer.parseInt(anElement.getAttribute(ATTR_ERRORID)),
anElement.getAttribute(ATTR_ERROR), details);
}
}
/**
* Throw exception when not logged in.
*/
private void throwOnInvalidSession() throws ClientException
{
if (agentKey == null)
{
throw new ClientException("Invalid tworx session");
}
}
/**
* .
*/
private Element redoRequestOnSessionTimeout(Element request, Element response) throws ClientException
{
// Check for session timeout
if (isNegativeResponse(response) && Integer.parseInt(response.getAttribute(ATTR_ERRORID)) == Protocol.ERR4007_AGENT_LEASE_EXPIRED)
{
p("Reestablishing session...");
// Reset session
agentKey = null;
// Do login if already logged in
if (loginRequest != null)
{
response = doRequest(loginRequest);
throwOnNrsp(response);
} else
{
response = createSession();
throwOnNrsp(response);
}
// Save session key
agentKey = response.getAttribute(ATTR_AGENTKEY);
// Re-issue service request and return new response
return doRequest(request);
}
// No session timeout so same response
return response;
}
/**
* Do XML over HTTP request and retun response.
*/
private Element doRequest(Element anElement) throws ClientException
{
// Create URL to use
String url = protocolURL;
if (agentKey != null)
{
url = url + "?agentkey=" + agentKey;
} else
{
// Must be login
url = url + "?timeout=" + timeout;
}
p("doRequest: " + url + " req=" + anElement.getTagName());
// Perform request/response
HttpClient httpclient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
Element replyElement = null;
try
{
// Make sure the server knows what kind of a response we will accept
httpPost.addHeader("Accept", "text/xml");
// Also be sure to tell the server what kind of content we are sending
httpPost.addHeader("Content-Type", "application/xml");
String xmlString = DOMUtil.dom2String(anElement.getOwnerDocument());
StringEntity entity = new StringEntity(xmlString, "UTF-8");
entity.setContentType("application/xml");
httpPost.setEntity(entity);
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httpPost);
// Parse response
Document replyDoc = DOMUtil.parse(response.getEntity().getContent());
replyElement = replyDoc.getDocumentElement();
p("doRequest: rsp=" + replyElement.getTagName());
}
catch (Throwable t)
{
throw new ClientException("Error in doRequest: " + t);
}
finally
{
}
return replyElement;
}
/**
* Util: print.
*/
private void p(String s)
{
if (debug)
{
Log.d(LOG_TAG, s);
}
}
/**
* Util: warn.
*/
private void warn(String s)
{
warn(s, null);
}
/**
* Util: warn with exception.
*/
private void warn(String s, Throwable t)
{
Log.e(LOG_TAG, s + " ex=" + t, t);
}
}
| 11chauhanpeeyush11-peeyush | MetaTracker/application/src/org/opentraces/metatracker/net/OpenTracesClient.java | Java | gpl3 | 10,842 |
package nl.sogeti.android.gpstracker.logger;
import android.net.Uri;
interface IGPSLoggerServiceRemote {
int loggingState();
long startLogging();
void pauseLogging();
long resumeLogging();
void stopLogging();
Uri storeMediaUri(in Uri mediaUri);
boolean isMediaPrepared();
} | 11chauhanpeeyush11-peeyush | MetaTracker/application/src/nl/sogeti/android/gpstracker/logger/IGPSLoggerServiceRemote.aidl | AIDL | gpl3 | 295 |
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Admin.Master" AutoEventWireup="true"
CodeBehind="Page3.aspx.cs" Inherits="WebsiteLab2.MasterPages.WebForm3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="javascript_extenation" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="content_header" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server">
<table border="0px">
<tr>
<td align="right">
<asp:Label ID="Label1" runat="server" Text="Link Webservices : "></asp:Label>
</td>
<td style="width: 5px;">
</td>
<td colspan="2">
<asp:TextBox ID="txtLinkWebserivces" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label6" runat="server" Text="Name Method : "></asp:Label>
</td>
<td style="width: 5px;">
</td>
<td colspan="2">
<asp:TextBox ID="txtMethodName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label2" runat="server" Text="First Param : "></asp:Label>
</td>
<td style="width: 5px;">
</td>
<td>
<asp:DropDownList ID="ddlFirstParam" runat="server">
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="txtFirstParam" runat="server"></asp:TextBox>
<asp:CheckBox ID="cbFirstParam" runat="server" />
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label3" runat="server" Text="Second Param : "></asp:Label>
</td>
<td style="width: 5px;">
</td>
<td>
<asp:DropDownList ID="ddlSecondParam" runat="server">
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="txtSecondParam" runat="server"></asp:TextBox>
<asp:CheckBox ID="cbSecondParam" runat="server" />
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label4" runat="server" Text="Third Param : "></asp:Label>
</td>
<td style="width: 5px;">
</td>
<td>
<asp:DropDownList ID="ddlThirdParam" runat="server">
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="txtThirdParam" runat="server"></asp:TextBox>
<asp:CheckBox ID="cbThirdParam" runat="server" />
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label5" runat="server" Text="Return Value : "></asp:Label>
</td>
<td style="width: 5px;">
</td>
<td>
<asp:DropDownList ID="ddlReturnValue" runat="server">
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="txtReturnValue" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<asp:Button ID="btnCallServices" runat="server" Text="Call" OnClick="btnCallServices_Click" />
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server">
<asp:Label ID="lbError" runat="server" Text=""></asp:Label>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Page3.aspx | ASP.NET | asf20 | 5,179 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Security.Permissions;
using System.Web.Services.Description;
namespace WebsiteLab2.BUS
{
internal class WsProxy
{
[SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
internal static object CallWebService(string webServiceAsmxUrl, string serviceName, string methodName, object[] args)
{
System.Net.WebClient client = new System.Net.WebClient();
// Connect To the web service
System.IO.Stream stream = client.OpenRead(webServiceAsmxUrl + "?wsdl");
// Now read the WSDL file describing a service.
ServiceDescription description = ServiceDescription.Read(stream);
///// LOAD THE DOM /////////
// Initialize a service description importer.
ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
importer.ProtocolName = "Soap12"; // Use SOAP 1.2.
importer.AddServiceDescription(description, null, null);
// Generate a proxy client.
importer.Style = ServiceDescriptionImportStyle.Client;
// Generate properties to represent primitive values.
importer.CodeGenerationOptions = System.Xml.Serialization.CodeGenerationOptions.GenerateProperties;
// Initialize a Code-DOM tree into which we will import the service.
CodeNamespace nmspace = new CodeNamespace();
CodeCompileUnit unit1 = new CodeCompileUnit();
unit1.Namespaces.Add(nmspace);
// Import the service into the Code-DOM tree. This creates proxy code that uses the service.
ServiceDescriptionImportWarnings warning = importer.Import(nmspace, unit1);
if (warning == 0) // If zero then we are good to go
{
// Generate the proxy code
CodeDomProvider provider1 = CodeDomProvider.CreateProvider("CSharp");
// Compile the assembly proxy with the appropriate references
string[] assemblyReferences = new string[5] { "System.dll", "System.Web.Services.dll", "System.Web.dll", "System.Xml.dll", "System.Data.dll" };
CompilerParameters parms = new CompilerParameters(assemblyReferences);
CompilerResults results = provider1.CompileAssemblyFromDom(parms, unit1);
// Check For Errors
if (results.Errors.Count > 0)
{
foreach (CompilerError oops in results.Errors)
{
System.Diagnostics.Debug.WriteLine("========Compiler error============");
System.Diagnostics.Debug.WriteLine(oops.ErrorText);
}
throw new System.Exception("Compile Error Occured calling webservice. Check Debug ouput window.");
}
// Finally, Invoke the web service method
object wsvcClass = results.CompiledAssembly.CreateInstance(serviceName);
MethodInfo mi = wsvcClass.GetType().GetMethod(methodName);
return mi.Invoke(wsvcClass, args);
}
else
{
return null;
}
}
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/BUS/WsProxy.cs | C# | asf20 | 3,477 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebsiteLab2.BUS
{
public class ProductBUS
{
public static OurServices.Service1 ourservices;
static ProductBUS () {
ourservices = new OurServices.Service1 ();
}
public static object createObject(string value, string type){
object result = null ;
switch (type)
{
case "int": result = int.Parse(value); break;
case "float": result = float.Parse(value); break;
case "bool": result = bool.Parse(value); break;
default: result = value; break;
}
return result;
}
public static List<OurServices.Product> getAllProductsByServices(){
List<OurServices.Product> products = new List<OurServices.Product>();
ourservices = (ourservices == null) ? ourservices = new OurServices.Service1() : ourservices;
OurServices.Product[] productsTemp = ourservices.getAllProduct();
if (productsTemp.Count() < 1) { return products; }
foreach (OurServices.Product item in productsTemp)
{
products.Add(item);
}
return products;
}
public static List<OurServices.Product> getAllProductsByTypesServices(string typeID)
{
List<OurServices.Product> products = new List<OurServices.Product>();
if (typeID == null || typeID == "") { return products; }
ourservices = (ourservices == null) ? ourservices = new OurServices.Service1() : ourservices;
OurServices.Product[] productsTemp = ourservices.getAllByType(typeID);
if (productsTemp.Count() < 1) { return products; }
foreach (OurServices.Product item in productsTemp)
{
products.Add(item);
}
return products;
}
public static List<String> getAllTypesByServices()
{
List<String> categories = new List<String>();
ourservices = (ourservices == null) ? ourservices = new OurServices.Service1() : ourservices;
String [] categoriesTemp = ourservices.getProductTypes();
if (categoriesTemp.Count() < 1) { return categories; }
foreach (String item in categoriesTemp)
{
categories.Add(item);
}
return categories;
}
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/BUS/ProductBUS.cs | C# | asf20 | 2,654 |
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Web.Services;
using System.Web.Services.Description;
using System.Web.Services.Discovery;
using System.Xml;
namespace WebsiteLab2.BUS
{
class WebServiceInvoker
{
Dictionary<string, Type> availableTypes;
/// <summary>
/// Text description of the available services within this web service.
/// </summary>
public List<string> AvailableServices
{
get{ return this.services; }
}
/// <summary>
/// Creates the service invoker using the specified web service.
/// </summary>
/// <param name="webServiceUri"></param>
public WebServiceInvoker(Uri webServiceUri)
{
this.services = new List<string>(); // available services
this.availableTypes = new Dictionary<string, Type>(); // available types
// create an assembly from the web service description
this.webServiceAssembly = BuildAssemblyFromWSDL(webServiceUri);
// see what service types are available
Type[] types = this.webServiceAssembly.GetExportedTypes();
// and save them
foreach (Type type in types)
{
services.Add(type.FullName);
availableTypes.Add(type.FullName, type);
}
}
/// <summary>
/// Gets a list of all methods available for the specified service.
/// </summary>
/// <param name="serviceName"></param>
/// <returns></returns>
public List<string> EnumerateServiceMethods(string serviceName)
{
List<string> methods = new List<string>();
if (!this.availableTypes.ContainsKey(serviceName))
throw new Exception("Service Not Available");
else
{
Type type = this.availableTypes[serviceName];
// only find methods of this object type (the one we generated)
// we don't want inherited members (this type inherited from SoapHttpClientProtocol)
foreach (MethodInfo minfo in type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly))
methods.Add(minfo.Name);
return methods;
}
}
/// <summary>
/// Invokes the specified method of the named service.
/// </summary>
/// <typeparam name="T">The expected return type.</typeparam>
/// <param name="serviceName">The name of the service to use.</param>
/// <param name="methodName">The name of the method to call.</param>
/// <param name="args">The arguments to the method.</param>
/// <returns>The return value from the web service method.</returns>
public T InvokeMethod<T>( string serviceName, string methodName, params object[] args )
{
// create an instance of the specified service
// and invoke the method
object obj = this.webServiceAssembly.CreateInstance(serviceName);
Type type = obj.GetType();
return (T)type.InvokeMember(methodName, BindingFlags.InvokeMethod, null, obj, args);
}
/// <summary>
/// Builds the web service description importer, which allows us to generate a proxy class based on the
/// content of the WSDL described by the XmlTextReader.
/// </summary>
/// <param name="xmlreader">The WSDL content, described by XML.</param>
/// <returns>A ServiceDescriptionImporter that can be used to create a proxy class.</returns>
private ServiceDescriptionImporter BuildServiceDescriptionImporter( XmlTextReader xmlreader )
{
// make sure xml describes a valid wsdl
if (!ServiceDescription.CanRead(xmlreader))
throw new Exception("Invalid Web Service Description");
// parse wsdl
ServiceDescription serviceDescription = ServiceDescription.Read(xmlreader);
// build an importer, that assumes the SOAP protocol, client binding, and generates properties
ServiceDescriptionImporter descriptionImporter = new ServiceDescriptionImporter();
descriptionImporter.ProtocolName = "Soap";
descriptionImporter.AddServiceDescription(serviceDescription, null, null);
descriptionImporter.Style = ServiceDescriptionImportStyle.Client;
descriptionImporter.CodeGenerationOptions = System.Xml.Serialization.CodeGenerationOptions.GenerateProperties;
return descriptionImporter;
}
/// <summary>
/// Compiles an assembly from the proxy class provided by the ServiceDescriptionImporter.
/// </summary>
/// <param name="descriptionImporter"></param>
/// <returns>An assembly that can be used to execute the web service methods.</returns>
private Assembly CompileAssembly(ServiceDescriptionImporter descriptionImporter)
{
// a namespace and compile unit are needed by importer
CodeNamespace codeNamespace = new CodeNamespace();
CodeCompileUnit codeUnit = new CodeCompileUnit();
codeUnit.Namespaces.Add(codeNamespace);
ServiceDescriptionImportWarnings importWarnings = descriptionImporter.Import(codeNamespace, codeUnit);
if (importWarnings == 0) // no warnings
{
// create a c# compiler
CodeDomProvider compiler = CodeDomProvider.CreateProvider("CSharp");
// include the assembly references needed to compile
string[] references = new string[2] { "System.Web.Services.dll", "System.Xml.dll" };
CompilerParameters parameters = new CompilerParameters(references);
// compile into assembly
CompilerResults results = compiler.CompileAssemblyFromDom(parameters, codeUnit);
foreach (CompilerError oops in results.Errors)
{
// trap these errors and make them available to exception object
throw new Exception("Compilation Error Creating Assembly");
}
// all done....
return results.CompiledAssembly;
}
else
{
// warnings issued from importers, something wrong with WSDL
throw new Exception("Invalid WSDL");
}
}
/// <summary>
/// Builds an assembly from a web service description.
/// The assembly can be used to execute the web service methods.
/// </summary>
/// <param name="webServiceUri">Location of WSDL.</param>
/// <returns>A web service assembly.</returns>
private Assembly BuildAssemblyFromWSDL(Uri webServiceUri)
{
if (String.IsNullOrEmpty(webServiceUri.ToString()))
throw new Exception("Web Service Not Found");
XmlTextReader xmlreader = new XmlTextReader(webServiceUri.ToString() + "?wsdl");
ServiceDescriptionImporter descriptionImporter = BuildServiceDescriptionImporter(xmlreader);
return CompileAssembly(descriptionImporter);
}
private Assembly webServiceAssembly;
private List<string> services;
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/BUS/WebServiceInvoker.cs | C# | asf20 | 7,706 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace EC2011_hk2_BT1_1041448.MasterPages
{
public partial class Admin : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/MasterPages/Admin.Master.cs | C# | asf20 | 361 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebsiteLab2.MasterPages
{
public partial class WebForm3 : System.Web.UI.Page
{
private BUS.WebServiceInvoker invoker;
private string[] allTypes = { "int", "bool", "string", "float" };
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
LoadComboBoxes();
this.lbError.Text = string.Empty;
}
}
protected void LoadComboBoxes(){
this.ddlFirstParam.DataSource = allTypes;
this.ddlFirstParam.DataBind();
this.ddlSecondParam.DataSource = allTypes;
this.ddlSecondParam.DataBind();
this.ddlThirdParam.DataSource = allTypes;
this.ddlThirdParam.DataBind();
this.ddlReturnValue.DataSource = allTypes;
this.ddlReturnValue.DataBind();
}
protected void btnCallServices_Click(object sender, EventArgs e)
{
string wsURL = string.Empty;
object[] param = null;
object fParam = null;
object sParam = null;
object tParam = null;
object result = null;
// Load webservices
try
{
wsURL = this.txtLinkWebserivces.Text;
if (String.IsNullOrEmpty(wsURL)) { throw new Exception("URL WS is empty !"); }
this.invoker = new WebsiteLab2.BUS.WebServiceInvoker(new Uri(wsURL));
}
catch (Exception ex)
{
this.lbError.Text = String.Format("Unable to load services : {0} ", ex.Message);
return;
}
if (this.invoker.AvailableServices.Count < 1)
{
this.lbError.Text = String.Format("Not exist services name ");
return;
}
string servicesName = this.invoker.AvailableServices[0];
// Method Name
string methodName = txtMethodName.Text;
// First Name
string fName = this.txtFirstParam.Text;
string fNameType = this.ddlFirstParam.Items[this.ddlFirstParam.SelectedIndex].Value;
bool fNameChecked = this.cbFirstParam.Checked;
// Second Name
string sName = this.txtSecondParam.Text;
string sNameType = this.ddlSecondParam.Items[this.ddlSecondParam.SelectedIndex].Value;
bool sNameChecked = this.cbSecondParam.Checked;
// Third Name
string tName = this.txtThirdParam.Text;
string tNameType = this.ddlThirdParam.Items[this.ddlThirdParam.SelectedIndex].Value;
bool tNameChecked = this.cbThirdParam.Checked;
// Return Type
string rNameType = this.ddlReturnValue.Items[this.ddlReturnValue.SelectedIndex].Value;
if (fNameChecked && sNameChecked && tNameChecked)
{
string fValue = this.txtFirstParam.Text;
fParam = BUS.ProductBUS.createObject(fValue, fNameType);
string sValue = this.txtSecondParam.Text;
sParam = BUS.ProductBUS.createObject(sValue, sNameType);
string tValue = this.txtThirdParam.Text;
tParam = BUS.ProductBUS.createObject(tValue, tNameType);
param = new object[] {fParam, sParam, tParam};
}
else if (fNameChecked && sNameChecked){
string fValue = this.txtFirstParam.Text;
fParam = BUS.ProductBUS.createObject(fValue, fNameType);
string sValue = this.txtSecondParam.Text;
sParam = BUS.ProductBUS.createObject(sValue, sNameType);
param = new object[]{fParam, sParam};
}
else if (fNameChecked && tNameChecked){
string fValue = this.txtFirstParam.Text;
fParam = BUS.ProductBUS.createObject(fValue, fNameType);
string tValue = this.txtThirdParam.Text;
tParam = BUS.ProductBUS.createObject(tValue, tNameType);
param = new object[] { fParam, tParam };
}
else if (sNameChecked && tNameChecked){
string sValue = this.txtSecondParam.Text;
sParam = BUS.ProductBUS.createObject(sValue, sNameType);
string tValue = this.txtThirdParam.Text;
tParam = BUS.ProductBUS.createObject(tValue, tNameType);
param = new object[] {sParam, tParam};
}
else if (fNameChecked){
string fValue = this.txtFirstParam.Text;
fParam = BUS.ProductBUS.createObject(fValue, fNameType);
param = new object[] {fParam};
}
else if (sNameChecked){
string sValue = this.txtSecondParam.Text;
sParam = BUS.ProductBUS.createObject(sValue, sNameType);
param = new object[] {sParam};
}
else if (tNameChecked){
string tValue = this.txtThirdParam.Text;
tParam = BUS.ProductBUS.createObject(tValue, tNameType);
param = new object[] {tParam};
}
try
{
this.lbError.Text = string.Empty;
if (param == null) { throw new Exception("None parameter is selected !"); }
switch (rNameType)
{
case "int": result = this.invoker.InvokeMethod<int>(servicesName, methodName, param); break;
case "float": result = this.invoker.InvokeMethod<float>(servicesName, methodName, param); break;
case "bool": result = this.invoker.InvokeMethod<bool>(servicesName, methodName, param); break;
default : result = this.invoker.InvokeMethod<string>(servicesName, methodName, param); break;
}
this.txtReturnValue.Text = result.ToString();
}
catch (Exception ex)
{
this.lbError.Text = String.Format(" Error Invoking Method : {0} ", ex.Message);
return;
}
}
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Page3.aspx.cs | C# | asf20 | 6,642 |
/* CSS */
.DynarchCalendar {
border: 1px solid #aaa;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
background: #e8e8e8;
font: 11px "lucida grande",tahoma,verdana,sans-serif;
line-height: 14px;
position: relative;
cursor: default;
}
.DynarchCalendar table {
border-collapse: collapse;
font: 11px "lucida grande",tahoma,verdana,sans-serif;
line-height: 14px;
}
.DynarchCalendar-topBar {
border-bottom: 1px solid #aaa;
background: #ddd;
padding: 5px 0 0 0;
}
table.DynarchCalendar-titleCont {
font-size: 130%; font-weight: bold;
color: #444;
text-align: center;
z-index: 9;
position: relative;
margin-top: -6px;
}
.DynarchCalendar-title div {
padding: 5px 17px;
text-shadow: 1px 1px 1px #777;
}
.DynarchCalendar-hover-title div {
background-color: #fff;
border: 1px solid #000;
padding: 4px 16px;
background-image: url("img/drop-down.gif");
background-repeat: no-repeat;
background-position: 100% 50%;
}
.DynarchCalendar-pressed-title div {
border: 1px solid #000;
padding: 4px 16px;
background-color: #777;
color: #fff;
background-image: url("img/drop-up.gif");
background-repeat: no-repeat;
background-position: 100% 50%;
}
.DynarchCalendar-bottomBar {
border-top: 1px solid #aaa;
background: #ddd;
padding: 2px;
position: relative;
text-align: center;
}
.DynarchCalendar-bottomBar-today {
padding: 2px 15px;
}
.DynarchCalendar-hover-bottomBar-today {
border: 1px solid #000;
background-color: #fff;
padding: 1px 14px;
}
.DynarchCalendar-pressed-bottomBar-today {
border: 1px solid #000;
background-color: #777;
color: #fff;
padding: 1px 14px;
}
.DynarchCalendar-body {
position: relative;
overflow: hidden;
padding-top: 5px;
padding-bottom: 5px;
}
.DynarchCalendar-first-col { padding-left: 5px; }
.DynarchCalendar-last-col { padding-right: 5px; }
.DynarchCalendar-animBody-backYear {
position: absolute;
top: -100%;
left: 0;
}
.DynarchCalendar-animBody-back {
position: absolute;
top: 5px;
left: -100%;
}
.DynarchCalendar-animBody-fwd {
position: absolute;
top: 5px;
left: 100%;
}
.DynarchCalendar-animBody-now {
position: absolute;
top: 5px;
left: 0;
}
.DynarchCalendar-animBody-fwdYear {
position: absolute;
top: 100%;
left: 0;
}
.DynarchCalendar-dayNames {
padding-left: 5px;
padding-right: 5px;
}
.DynarchCalendar-dayNames div { font-weight: bold; color: #444; text-shadow: 1px 1px 1px #777; }
.DynarchCalendar-navBtn {
position: absolute;
top: 5px;
z-index: 10;
}
.DynarchCalendar-navBtn div {
background-repeat: no-repeat;
background-position: 50% 50%;
height: 15px;
width: 16px;
padding: 1px;
}
.DynarchCalendar-hover-navBtn div {
border: 1px solid #000;
padding: 0;
background-color: #fff;
}
.DynarchCalendar-navDisabled {
opacity: 0.3;
filter: alpha(opacity=30);
}
.DynarchCalendar-pressed-navBtn div {
border: 1px solid #000;
padding: 0;
background-color: #777;
color: #fff;
}
.DynarchCalendar-prevMonth {
left: 25px;
}
.DynarchCalendar-nextMonth {
left: 100%;
margin-left: -43px;
}
.DynarchCalendar-prevYear {
left: 5px;
}
.DynarchCalendar-nextYear {
left: 100%;
margin-left: -23px;
}
.DynarchCalendar-prevMonth div {
background-image: url("img/nav-left.gif");
}
.DynarchCalendar-nextMonth div {
background-image: url("img/nav-right.gif");
}
.DynarchCalendar-prevYear div {
background-image: url("img/nav-left-x2.gif");
}
.DynarchCalendar-nextYear div {
background-image: url("img/nav-right-x2.gif");
}
.DynarchCalendar-menu {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #ddd;
overflow: hidden;
opacity: 0.85;
filter: alpha(opacity=85);
}
.DynarchCalendar-menu table td div {
text-align: center;
font-weight: bold;
padding: 3px 5px;
}
.DynarchCalendar-menu table td div.DynarchCalendar-menu-month {
width: 4em;
text-align: center;
}
.DynarchCalendar-menu table td div.DynarchCalendar-hover-navBtn {
border: 1px solid #000;
padding: 2px 4px;
background-color: #fff;
color: #000;
}
.DynarchCalendar-menu table td div.DynarchCalendar-pressed-navBtn {
border: 1px solid #000;
padding: 2px 4px;
background-color: #777;
color: #fff !important;
}
.DynarchCalendar-menu-year {
text-align: center;
font: 16px "lucida grande",tahoma,verdana,sans-serif;
font-weight: bold;
}
.DynarchCalendar-menu-sep {
height: 1px; font-size: 1px; line-height: 1px;
overflow: hidden;
border-top: 1px solid #888;
background: #fff;
margin-top: 4px; margin-bottom: 3px;
}
.DynarchCalendar-time td { font-weight: bold; font-size: 120%; }
.DynarchCalendar-time-hour, .DynarchCalendar-time-minute { padding: 1px 3px; }
.DynarchCalendar-time-down { background: url("img/time-down.png") no-repeat 50% 50%; width: 11px; height: 8px; opacity: 0.5; }
.DynarchCalendar-time-up { background: url("img/time-up.png") no-repeat 50% 50%; width: 11px; height: 8px; opacity: 0.5; }
.DynarchCalendar-time-sep { padding: 0 2px; }
.DynarchCalendar-hover-time { background-color: #444; color: #fff; opacity: 1; }
.DynarchCalendar-pressed-time { background-color: #000; color: #fff; opacity: 1; }
.DynarchCalendar-time-am { padding: 1px; width: 2.5em; text-align: center; }
/* body */
.DynarchCalendar-hover-week { background-color: #ddd; }
.DynarchCalendar-dayNames div, .DynarchCalendar-day, .DynarchCalendar-weekNumber {
width: 1.7em;
padding: 3px 4px;
text-align: center;
}
.DynarchCalendar-weekNumber {
border-right: 1px solid #aaa;
margin-right: 4px;
width: 2em !important;
padding-right: 8px !important;
}
.DynarchCalendar-day {
text-align: right; color: #222;
}
.DynarchCalendar-day-othermonth { color: #888; }
.DynarchCalendar-weekend { color: #c22; }
.DynarchCalendar-day-today { color: #00f; font-weight: bold; }
.DynarchCalendar-day-disabled {
opacity: 0.5;
text-shadow: 2px 1px 1px #fff;
}
.DynarchCalendar-hover-date {
padding: 2px 3px;
background-color: #eef;
border: 1px solid #88c;
margin: 0 !important;
color: #000;
}
.DynarchCalendar-day-othermonth.DynarchCalendar-hover-date { border-color: #aaa; color: #888; }
.DynarchCalendar-dayNames .DynarchCalendar-weekend { color: #c22; }
.DynarchCalendar-day-othermonth.DynarchCalendar-weekend { color: #d88; }
.DynarchCalendar-day-selected {
padding: 2px 3px;
margin: 1px;
background-color: #aaa;
color: #000 !important;
}
.DynarchCalendar-day-today.DynarchCalendar-day-selected { background-color: #999; }
/* focus */
.DynarchCalendar-focusLink {
position: absolute;
opacity: 0;
filter: alpha(opacity=0);
}
.DynarchCalendar-focused {
border-color: #000;
}
.DynarchCalendar-focused .DynarchCalendar-topBar, .DynarchCalendar-focused .DynarchCalendar-bottomBar {
background-color: #ccc;
border-color: #336;
}
.DynarchCalendar-focused .DynarchCalendar-hover-week {
background-color: #ccc;
}
.DynarchCalendar-tooltip {
position: absolute;
top: 100%;
width: 100%;
}
.DynarchCalendar-tooltipCont {
margin: 0 5px 0 5px;
border: 1px solid #aaa;
border-top: 0;
padding: 3px 6px;
background: #ddd;
}
.DynarchCalendar-focused .DynarchCalendar-tooltipCont {
background: #ccc;
border-color: #000;
}
@media print {
.DynarchCalendar-day-selected {
padding: 2px 3px;
border: 1px solid #000;
margin: 0 !important;
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/StyleSheet/Calendar/jscal2.css | CSS | asf20 | 7,385 |
body {
background-color: #FFF;
background-image: url(../../../Resource/Image/Guest/bg.jpg);
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
font-family: Tahoma, Geneva, sans-serif;
font-size: 12px;
color: #575757;
}
a{
outline:0;
text-decoration:none;
color: #575757;
}
a:hover{
color: #ff3300;
}
#img_lang_viet {
background-image: url(../../../Resource/Image/Guest/language.png);
background-repeat: no-repeat;
background-position: left top;
height: 12px;
width: 16px;
display: inline;
margin-left: 900px;
float: left;
margin-right: 7px;
margin-top: 4px;
cursor:pointer;
}
#img_lang_eng {
background-image: url(../../../Resource/Image/Guest/language.png);
background-repeat: no-repeat;
background-position: right top;
height: 12px;
width: 16px;
display: inline;
float: left;
margin-top: 4px;
cursor:pointer;
}
#img_but_left {
background-image: url(../../../Resource/Image/Guest/button.png);
background-repeat: no-repeat;
background-position: left top;
height: 24px;
width: 22px;
margin: 18px 0px 0px 19px;
cursor:pointer;
}
#img_but_right {
background-image: url(../../../Resource/Image/Guest/button.png);
background-repeat: no-repeat;
background-position: -22px top;
height: 24px;
width: 22px;
margin: 18px 0px 0px 19px;
cursor:pointer;
}
#img_leftHead_bullet {
height: 13px;
width: 12px;
margin-top: 14px;
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: left top;
float: left;
margin-right: 5px;
}
#img_icon_Mphone {
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: -32px top;
height: 16px;
width: 20px;
float:left;
margin-right:3px;
}
#img_icon_phone {
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: -12px top;
height: 16px;
width: 20px;
float:left;
margin-right:3px;
}
#img_icon_user {
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: -52px top;
height: 16px;
width: 20px;
float:left;
margin-right:3px;
}
#img_icon_userOnline {
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: -72px top;
height: 16px;
width: 20px;
float:left;
margin-right:3px;
}
#img_icon_star {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: left top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_rectangle {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -23px top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_panel {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -46px top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_led {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -69px top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_contact {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -92px top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_news {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -117px -6px;
height: 20px;
width: 19px;
float:left;
margin-right: 5px;
}
#img_icon_project {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -137px -6px;
height: 20px;
width: 23px;
float:left;
margin-right: 5px;
}
#img_icon_go {
background-image: url(../../../Resource/Image/Guest/logoGO.png);
background-repeat: no-repeat;
position:absolute;
height: 30px;
width: 26px;
display: inline;
margin-top: -6px;
}
#img_logo {
background-image: url(../../../Resource/Image/Guest/logo.png);
background-repeat: no-repeat;
height: 56px;
width: 250px;
}
.content {
margin: auto;
width: 960px;
}
.page_top {
line-height: 20px;
height: 20px;
width: 960px;
}
.header {
margin: auto;
height: 330px;
width: 960px;
}
.header_top {
background-image: url(../../../Resource/Image/Guest/header_buttom.png);
background-repeat: no-repeat;
background-position: left top;
height: 100px;
width: 960px;
}
.top_menu {
height: 55px;
width: 630px;
padding-left: 330px;
padding-top: 15px;
}
.top_menu_item {
height: 40px;
width: 68px;
text-align: center;
font-weight: bold;
vertical-align: middle;
cursor:pointer;
padding: 0px 14px;
}
.top_menu_item:hover {
background:url(../../../Resource/Image/Guest/menu_over.png) no-repeat left top;
color:#FFF;
}
.top_menu_active {
background:url(../../../Resource/Image/Guest/menu_over.png) no-repeat left top;
color:#FFF;
}
.top_menu_sep {
background-image: url(../../../Resource/Image/Guest/separator.gif);
background-repeat: no-repeat;
background-position: center center;
float: left;
height: 40px;
width: 4px;
}
.main_menu {
height: 30px;
width: 630px;
padding-left: 330px;
font-weight: bold;
color: #FFF;
}
.main_menu ul {
margin: 0px;
padding: 0px;
}
.main_menu ul li {
display: inline-block;
zoom:1;
*display: inline;
line-height: 20px;
height: 20px;
width: 100px;
text-align: center;
cursor:pointer;
margin-top: 6px;
}
.main_menu ul li:hover {
background:url(../../../Resource/Image/Guest/menu_over.png) -96px center;
color:#ff3300;
}
.main_menu_active {
background:url(../../../Resource/Image/Guest/menu_over.png) -96px center;
color:#ff3300;
}
.header_middle {
height: 200px;
width: 960px;
}
.imgSlide_large {
position: absolute;
z-index: 1;
}
.imgSlide_small {
position: absolute;
z-index: 100;
height: 60px;
width: 960px;
margin-top: 130px;
background-image: url(../../../Resource/Image/Guest/img_slide_bg.png);
background-repeat: repeat;
}
.imgSlide_small_but {
float: left;
height: 60px;
width: 60px;
}
.imgSlide_small_content {
height: 60px;
width: 840px;
overflow: hidden;
float: left;
}
.imgSlide_small_item {
height: 60px;
width: 280px;
float: left;
}
.imgSlide_small_image {
text-align: center;
vertical-align: middle;
height: 60px;
width: 100px;
}
.imgSlide_small_image img {
border: 2px solid #FFF;
}
.imgSlide_small_text {
width: 170px;
text-align: left;
font-weight: bold;
color: #FFF;
text-shadow:#000 2px 2px 1px;
}
.imgSlide_small_text a{
text-decoration:none;
color: #FFF;
text-shadow:#000 2px 2px 1px;
}
.header_bottom {
background-image: url(../../../Resource/Image/Guest/header_buttom.png);
background-repeat: no-repeat;
background-position: left -100px;
height: 30px;
width: 960px;
}
.center {
width: 960px;
margin-top: 10px;
}
.left {
float: left;
width: 230px;
}
.search {
height: 30px;
width: 215px;
background-image: url(../../../Resource/Image/Guest/left.png);
background-repeat: no-repeat;
background-position: left top;
padding-top: 10px;
padding-left: 15px;
margin-bottom: 10px;
}
.search_text {
width: 172px;
background:transparent;
border:none;
float: left;
padding-top: 3px;
}
.search_but {
background-image: url(../../../Resource/Image/Guest/button.png);
background-repeat: no-repeat;
background-position: right center;
height: 20px;
width: 25px;
border:none;
margin-left: 6px;
background-color:transparent;
cursor:pointer;
float: left;
margin-left: 8px;
}
.left_container {
margin-bottom: 10px;
}
.left_container_top {
line-height: 40px;
background-image: url(../../../Resource/Image/Guest/left.png);
background-repeat: no-repeat;
background-position: -230px top;
height: 40px;
width: 215px;
padding-left: 15px;
font-weight: bold;
color: #ff3300;
}
.left_container_mid {
background-image: url(../../../Resource/Image/Guest/left.png);
background-repeat: repeat-y;
background-position: -460px top;
padding-left: 20px;
line-height: 20px;
padding-top: 1px;
}
.left_container_mid_khtt {
background-image: url(../../../Resource/Image/Guest/left.png);
background-repeat: repeat-y;
background-position: -460px top;
height:450px;
overflow:hidden;
text-align:center;
}
.left_product {
margin: 0px;
padding: 0px;
list-style-type: none;
}
.left_product_menu {
background-image: url(../../../Resource/Image/Guest/product_bullet.png);
background-repeat: no-repeat;
padding-left: 10px;
}
.left_product_menu:hover{
background-position: left -20px;
}
.left_subMenu {
position: absolute;
margin-left: 200px;
margin-top: -29px;
display: none;
z-index: 1000;
}
.subMenu_TL {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: no-repeat;
background-position: left top;
height: 9px;
width: 9px;
}
.subMenu_TR {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: no-repeat;
background-position: left -9px;
height: 9px;
width: 9px;
}
.subMenu_BL {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: no-repeat;
background-position: left -18px;
height: 9px;
width: 9px;
}
.subMenu_BR {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: no-repeat;
background-position: left -27px;
height: 9px;
width: 9px;
}
.subMenu_T {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: repeat-x;
background-position: left -36px;
height: 9px;
}
.subMenu_B {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: repeat-x;
background-position: left -45px;
height: 9px;
}
.subMenu_ML {
background-image: url(../../../Resource/Image/Guest/subMenu2.png);
background-repeat: repeat-y;
background-position: left top;
width: 9px;
}
.subMenu_MR {
background-image: url(../../../Resource/Image/Guest/subMenu2.png);
background-repeat: repeat-y;
background-position: -9px top;
width: 9px;
}
.subMenu_M {
background-color:#FFF;
padding: 0px 15px 0px 5px;
}
.left_product_subMenu {
margin: 0px;
padding: 0px;
list-style-type: none;
}
.left_product_subMenu li {
background-image: url(../../../Resource/Image/Guest/product_bullet.png);
background-repeat: no-repeat;
margin-left: 5px;
padding-left: 10px;
}
.left_container_bot {
background-image: url(../../../Resource/Image/Guest/left.png);
background-position: -690px bottom;
height: 15px;
width: 230px;
}
.user_online {
color:#ff3300;
font-weight:bold;
}.main {
width: 720px;
margin-left: 10px;
float: left;
}
.main_container_header {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: no-repeat;
background-position: left top;
height: 50px;
width: 700px;
font-size: 14px;
line-height: 50px;
font-weight: bold;
color: #ff3300;
padding-left: 20px;
}
.main_container_header a {
font-weight: bold;
color: #ff3300;
}
.main_container_center {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 690px;
padding-left: 15px;
line-height: 20px;
text-align: justify;
padding-right: 15px;
}
.main_container_center_welcome {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 700px;
padding-left: 15px;
line-height: 20px;
text-align: justify;
padding-right: 5px;
}
.main_container_center_welcome a{
text-decoration:underline;
color: #ff3300;
}.main_container_footer {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: no-repeat;
background-position: -1440px bottom;
height: 15px;
width: 720px;
margin-bottom: 10px;
}
.main_container_center_product {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 704px;
padding-left: 15px;
padding-right: 1px;
}
.main_container_center_product2 {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 705px;
padding-left: 15px;
padding-right: 0px;
}
.main_container_center_productPage {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 690px;
padding-left: 15px;
padding-right: 15px;
height: 130px;
}
.product_container {
float: left;
height: 148px;
width: 168px;
margin-right: 8px;
}
.product_container_productPage {
float: left;
height: 148px;
width: 168px;
margin-left: 22px;
}
.product_container2_productPage {
float: left;
height: 148px;
width: 134px;
margin-left: 22px;
}
.product_info {
text-align: justify;
float: left;
width: 500px;
}
.product_info2 {
text-align: justify;
float: left;
width: 534px;
}
.product_container_tittle {
text-align: center;
height: 20px;
width: 160px;
}
.product_container_tittle a {
font-weight: bold;
text-align: center;
line-height: 20px;
}
.product_container_content {
height: 128px;
width: 168px;
cursor:pointer;
}
.product_container_shadow {
height: 23px;
width: 80px;
padding: 105px 8px 0 80px;
position:absolute;
z-index:100;
background-image: url(../../../Resource/Image/Guest/product_shadow.png);
background-repeat: no-repeat;
background-position: left top;
color:#FFF;
font-size:10px;
text-align:center;
line-height: 12px;
}
.product_img {
position: absolute;
z-index: 0;
}
.product_container2 {
float: left;
height: 148px;
width: 134px;
margin-right: 7px;
}
.product_container_tittle2 {
text-align: center;
height: 20px;
width: 126px;
}
.product_container_tittle2 a {
font-weight: bold;
text-align: center;
line-height: 20px;
}
.product_container_content2 {
background-image: url(../../../Resource/Image/Guest/product_shadow.png);
background-repeat: no-repeat;
background-position: left -128px;
height: 128px;
width: 134px;
cursor:pointer;
}
.product_container_shadow2 {
height: 21px;
width: 64px;
padding:107px 8px 0 62px;
position:absolute;
/*z-index:100;*/
background-image: url(../../../Resource/Image/Guest/product_shadow.png);
background-repeat: no-repeat;
background-position: left -128px;
color:#FFF;
font-size:9px;
text-align:center;
}
.end_block {
clear: both;
}
.footer_V {
background-image: url(../../../Resource/Image/Guest/header_buttom.png);
background-repeat: no-repeat;
background-position: left -130px;
height: 270px;
width: 960px;
}
.footer_E {
background-image: url(../../../Resource/Image/Guest/header_buttom.png);
background-repeat: no-repeat;
background-position: left -400px;
height: 270px;
width: 960px;
}
.footer_menu {
padding-top: 225px;
padding-right: 15px;
padding-left: 15px;
}
.footer_menu a{
padding: 0px 11px 0px 11px;
font-weight: bold;
}.footer_content {
text-align: center;
width: 960px;
padding-top: 20px;
padding-bottom: 10px;
}
.but_gui {
font-size:11px;
color: #787878;
background-color: transparent;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-image: url(../../../Resource/Image/Guest/form_but.png);
background-repeat: no-repeat;
background-position: left top;
height: 25px;
width: 52px;
font-weight: bold;
text-align: center;
cursor:pointer;
}
.but_gui:hover {
color:#ff3300;
}
.but_nhaplai {
font-size:11px;
color: #787878;
background-color: transparent;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-image: url(../../../Resource/Image/Guest/form_but.png);
background-repeat: no-repeat;
background-position: left -25px;
height: 25px;
width: 80px;
font-weight: bold;
text-align: center;
margin-left:10px;
cursor:pointer;
}
.but_nhaplai:hover {
color:#ff3300;
}
.news_tittle a{
font-weight: bold;
color: #FF3300;
}
.news_linkChiTiet {
color: #FF3300;
text-decoration: underline;
}
.paging {
float: right;
line-height: 20px;
padding-top: 25px;
}
.paging_item {
background-image: url(../../../Resource/Image/Guest/paging.png);
text-align: center;
height: 20px;
width: 20px;
float: left;
margin-left: 5px;
cursor:pointer;
}
.paging_item:hover{
font-weight: bold;
color: #FFF;
background-image: url(../../../Resource/Image/Guest/paging.png);
background-repeat: no-repeat;
background-position: left -20px;
}
.paging_item_active {
font-weight: bold;
color: #FFF;
background-image: url(../../../Resource/Image/Guest/paging.png);
background-repeat: no-repeat;
background-position: left -20px;
height: 20px;
width: 20px;
float: left;
margin-left: 5px;
cursor:pointer;
text-align: center;
}
.image_slider {
margin: auto;
width: 600px;
}
.image_slider_tittle {
line-height: 30px;
}
.image_slider_image_cotainer {
height: 300px;
width: 600px;
overflow:hidden;
}
.image_slider_image{
height: 300px;
width: 600px;
position:absolute;
}
.image_slider_butNext{
height: 46px;
width: 34px;
position:absolute;
z-index:100;
background:url(../../../Resource/Image/Guest/imageSlide_but.png) left top;
margin-top: 127px;
margin-left: 566px;
}
.image_slider_butPrev{
height: 46px;
width: 34px;
position:absolute;
z-index:100;
background:url(../../../Resource/Image/Guest/imageSlide_but.png) left -46px;
margin-top: 127px;
}
.image_slider_items {
text-align: center;
padding-top: 400px;
}
.image_slider_item_active {
background-image: url(../../../Resource/Image/Guest/imageSlide_but.png);
background-repeat: no-repeat;
background-position: left -92px;
display: inline-block;
zoom:1;
*display:inline;
height: 10px;
width: 11px;
cursor:pointer;
}
.image_slider_item {
background-image: url(../../../Resource/Image/Guest/imageSlide_but.png);
background-repeat: no-repeat;
background-position: left -102px;
display: inline-block;
zoom:1;
*display:inline;
height: 10px;
width: 11px;
cursor:pointer;
}
.project_container {
width: 704px;
padding-top: 13px;
padding-bottom: 13px;
}
.project_container_title {
font-weight: bold;
color: #ff3300;
height: 30px;
}
#img_icon_recruitment {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -164px -2px;
height: 24px;
width: 17px;
float:left;
margin-right: 5px;
margin-top: -3px;
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/StyleSheet/Guest/style.css | CSS | asf20 | 19,386 |
#AVIMControl {
background-image: url('transparent.png');
padding: 2px;
border: 1px solid #5b958e;
position: absolute;
bottom: 5px;
right: 5px;
width: 320px;
display: none;
}
body > #AVIMControl {
position: fixed;
}
.AVIMControl {
margin: 0;
padding: 0;
color: #137e70;
font-family: Verdana, Tahoma;
font-size: 10px;
font-weight: bold;
}
a.AVIMControl {
color: #b62727;
text-decoration: none;
cursor: pointer;
}
#AVIMControl input {
vertical-align: middle;
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/StyleSheet/Guest/avim.css | CSS | asf20 | 481 |
/******************************** Basic Structure ********************************/
html {
font-size: 100%;
height: 100%;
margin-bottom: 1px; /* Always show a scrollbar to avoid jumping when the scrollbar appears */
}
body {
font-family: Arial, Helvetica, sans-serif;
color: #555;
background: #f0f0f0 url('../../../Resources/Image/Admin/bg-body.gif') top left repeat-y;
font-size: 12px;
}
#body-wrapper {
background: url('../../../Resources/Image/Admin/bg-radial-gradient.gif') fixed 230px top no-repeat;
}
/******************************** Elements styling ********************************/
h1, h2, h3, h4, h5, h6 {
font-family: Helvetica, Arial, sans-serif;
color: #222;
font-weight: bold;
}
h1 { font-family: Calibri, Helvetica, Arial, sans-serif; font-size: 31px; font-weight: bold; color: #fff;
position: absolute; top: -1000px; /* Remove this line and delete the logo (in the HTML) if you don't want an image as a logo */
}
h2 { font-size: 26px; padding: 0 0 10px 0; }
h3 { font-size: 17px; padding: 0 0 10px 0; }
h4 { font-size: 16px; padding: 0 0 5px 0; }
h5 { font-size: 14px; padding: 0 0 5px 0; }
h6 { font-size: 12px; padding: 0 0 5px 0; }
a { color: #57a000; text-decoration: none; }
a:hover { color: #000; }
a:active { color: #777; }
a:focus { outline: 1px; }
strong { font-weight: bold; color: #333; }
small { font-size: 0.85em; }
pre { font-family: monospace; }
p {
padding: 5px 0 10px 0;
line-height: 1.6em;
}
/******************************** General Classes ********************************/
.clear {
clear: both;
}
.align-left {
float: left;
}
.align-right {
float: right;
}
/************ Button ************/
input[type='submit'],input[type='button'] {
font-family: Verdana, Arial, sans-serif;
display: inline-block;
background: #459300 url('../../../Resources/Image/Admin/bg-button-green.gif') top left repeat-x !important;
border: 1px solid #459300 !important;
padding: 4px 7px 4px 7px !important;
color: #fff !important;
font-size: 11px !important;
cursor: pointer;
}
input[type='submit']:hover,input[type='button']:hover {
text-decoration: underline;
}
input[type='submit']:active,input[type='button']:active {
padding: 5px 7px 3px 7px !important;
}
a.remove-link {
color: #bb0000;
}
a.remove-link:hover {
color: #000;
}
/******************************** Sidebar ********************************/
#sidebar {
background: url('../../../Resources/Image/Admin/bg-sidebar.gif') top left no-repeat;
width: 230px;
height: 100%;
position: absolute;
left: 0;
top: 0;
color: #888;
font-size: 11px;
}
#sidebar #sidebar-wrapper {
margin: 0 0 0 9px;
}
#sidebar #sidebar-wrapper img {
border: 0 none;
}
#sidebar a,
#sidebar a:active {
color:#ccc;
}
#sidebar a:hover {
color:#fff;
}
#sidebar #sidebar-title {
margin: 40px 0 40px 15px;
}
#sidebar #logo {
margin: 40px 0 40px 0;
}
#sidebar #profile-links {
padding: 0 15px 20px 15px;
text-align: right;
line-height: 1.5em;
}
/************ Sidebar Accordion Menu ************/
#sidebar #main-nav {
width: 206px;
padding: 0;
margin: 0 0 0 15px;
font-family: Helvetica, Arial, sans-serif;
}
#sidebar #main-nav li {
list-style: none;
padding-bottom: 10px;
text-align: right;
}
#sidebar #main-nav li a.nav-top-item {
background: transparent url('../../../Resources/Image/Admin/bg-menu-item-green.gif') right center no-repeat; /* Background image for default color scheme - green */
padding: 10px 15px;
color: #fff;
font-size: 14px;
cursor: pointer;
display: block;
text-decoration: none;
}
#sidebar #main-nav li a.current {
background-image: url('../../../Resources/Image/Admin/bg-menu-item-current.gif') !important;
color: #333;
font-weight: bold;
}
#sidebar #main-nav li a.current:hover {
color: #333;
}
#sidebar #main-nav ul {
padding: 0;
font-size: 12px;
margin: 0;
}
#sidebar #main-nav ul li {
list-style: none;
margin: 0;
text-align: right;
padding: 0;
}
#sidebar #main-nav ul li a {
padding: 8px 15px;
display: block;
color: #aaa;
font-size: 13px;
line-height: 1.2em;
}
#sidebar #main-nav ul li a:hover,
#sidebar #main-nav ul li a.current,
#sidebar #main-nav ul li a.current:hover {
color: #fff;
}
#sidebar #main-nav ul li a.current {
background: transparent url('../../../Resources/Image/Admin/menu-current-arrow.gif') right center no-repeat !important;
}
/******************************** Main Content ********************************/
/************ Layout ************/
#main-content {
margin: 0 30px 0 260px;
padding: 40px 0 0 0;
}
.column-left {
width: 48%;
float: left;
}
.column-right {
width: 48%;
float: right;
}
#page-intro {
font-size: 17px;
padding: 0 0 20px 0;
}
#footer {
border-top: 1px solid #ccc;
margin: 40px 0 0 0;
padding: 20px 0;
font-size: 12px;
}
/************ Lists ************/
#main-content ul,
#main-content ol {
padding: 10px 0;
}
/* Unordered List */
#main-content ul li {
background: url('../../../Resources/Image/Admin/icons/bullet_black.png') center left no-repeat;
padding: 4px 0 4px 20px;
}
/* Ordered List */
#main-content ol {
padding: 0 0 0 24px;
}
#main-content ol li {
list-style: decimal;
padding: 4px 0;
}
/*************** Content Box ***************/
.content-box {
border: 1px solid #ccc;
margin: 0 0 20px 0;
background: #fff;
}
.content-box-header {
background: #e5e5e5 url('../../../Resources/Image/Admin/bg-content-box.gif') top left repeat-x;
margin-top: 1px;
height: 40px;
}
.content-box-header h3 {
font-size : 15px;
margin-left:10px;
float: left;
}
ul.content-box-tabs {
float: right;
padding: 12px 15px 0 0 !important;
margin: 0 !important;
}
ul.content-box-tabs li {
float: left;
margin: 0;
padding: 0 !important;
background-image: none !important;
}
ul.content-box-tabs li a {
color: #333;
padding: 8px 10px;
display: block;
margin: 1px;
border-bottom: 0;
}
ul.content-box-tabs li a:hover {
color: #57a000;
}
ul.content-box-tabs li a.current {
background: #fff;
border: 1px solid #ccc;
border-bottom: 0;
margin: 0;
}
.content-box-content {
padding: 20px;
font-size: 13px;
border-top: 1px solid #ccc;
}
/************ Table ************/
#main-content table {
border-collapse: collapse;
}
#main-content table thead th {
font-weight: bold;
font-size: 15px;
border-bottom: 1px solid #ddd;
}
#main-content tbody {
border-bottom: 1px solid #ddd;
}
#main-content tbody tr {
background: #fff;
}
#main-content tbody tr.alt-row {
background: #f3f3f3;
}
#main-content table td,
#main-content table th {
padding: 10px;
line-height: 1.3em;
}
#main-content table tfoot td .bulk-actions {
padding: 15px 0 5px 0;
}
#main-content table tfoot td .bulk-actions select {
padding: 4px;
border: 1px solid #ccc;
}
/*************** Pagination ***************/
#main-content .pagination {
text-align: right;
padding: 20px 0 5px 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
.pagination a {
margin: 0 5px 0 0;
padding: 3px 6px;
}
.pagination a.number {
border: 1px solid #ddd;
}
.pagination a.current {
background: #469400 url('../../../Resources/Image/Admin/bg-button-green.gif') top left repeat-x !important;
border-color: #459300 !important;
color: #fff !important;
}
.pagination a.current:hover {
text-decoration: underline;
}
/************ Shortcut Buttons ************/
.shortcut-button {
border: 1px solid #ccc;
background: #f7f7f7 url('../../../Resources/Image/Admin/shortcut-button-bg.gif') top left no-repeat;
display: block;
width: 120px;
margin: 0 0 20px 0;
}
.shortcut-button span {
background-position: center 15px;
background-repeat: no-repeat;
border: 1px solid #fff;
display:block;
padding: 78px 10px 15px 10px;
text-align: center;
color: #555;
font-size: 13px;
line-height: 1.3em;
}
.new-article span {
background-image: url('../../../Resources/Image/Admin/icons/pencil_48.png');
}
.new-page span {
background-image: url('../../../Resources/Image/Admin/icons/paper_content_pencil_48.png');
}
.upload-image span {
background-image: url('../../../Resources/Image/Admin/icons/image_add_48.png');
}
.add-event span {
background-image: url('../../../Resources/Image/Admin/icons/clock_48.png');
}
.manage-comments span {
background-image: url('../../../Resources/Image/Admin/icons/comment_48.png');
}
.shortcut-button:hover {
background: #fff;
}
.shortcut-button span:hover {
color: #57a000;
}
ul.shortcut-buttons-set li {
float: left;
margin: 0 15px 0 0;
padding: 0 !important;
background: 0;
}
/*************** Forms ***************/
form label {
display: block;
padding: 0 0 10px;
font-weight: bold;
}
form fieldset legend {
font-weight: bold;
margin-bottom: 10px;
padding-top: 10px;
}
form p small {
font-size: 0.75em;
color: #777;
}
form input.text-input,
input,
form select,
form textarea,
form .wysiwyg {
padding: 6px;
font-size: 13px;
background: #fff url('../../../Resources/Image/Admin/bg-form-field.gif') top left repeat-x;
border: 1px solid #d5d5d5;
color: #333;
}
form .small-input {
width: 25% !important;
}
form .medium-input {
width: 50% !important;
}
form .large-input {
width: 97.5% !important;
font-size: 16px !important;
padding: 8px !important;
}
form textarea {
width: 97.5% !important;
font-family: Arial, Helvetica, sans-serif;
}
form select {
padding: 4px;
background: #fff;
}
form input[type="checkbox"],
form input[type="radio"] {
padding: 0;
background: none;
border: 0;
}
/* Notification for form inputs */
.input-notification {
background-position: left 2px;
background-repeat: no-repeat;
padding: 2px 0 2px 22px;
background-color: transparent;
margin: 0 0 0 5px;
}
/* Notification for login page */
#login-wrapper #login-content .notification {
border: 0;
background-color: #141414;
color: #fff !important;
}
/******************************** Login Page ********************************/
body#login {
color: #fff;
background: #222 url('../../../Resources/Image/Admin/bg-login.gif');
}
#login-wrapper {
background: url('../../../Resources/Image/Admin/bg-login-top.png') top left repeat-x;
}
#login-wrapper #login-top {
width: 100%;
padding: 25px 0 50px 0;
text-align: center;
}
#login-wrapper #login-content {
text-align: left;
width: 300px;
margin: 0 auto;
}
#login-wrapper #login-content label {
color: #fff;
font-weight: normal;
font-size: 14px;
font-family: Helvetica, Arial, sans-serif;
float: left;
width: 70px;
padding: 0;
}
#login-wrapper #login-content input {
width: 200px;
float: right;
margin: 0 0 20px 0;
border: 0;
background: #fff;
}
#login-wrapper #login-content p {
padding: 0;
}
#login-wrapper #login-content p#remember-password {
float: right;
}
#login-wrapper #login-content p#remember-password input {
float: none;
width: auto;
border: 0;
background: none;
margin: 0 10px 0 0;
}
#login-wrapper #login-content p .button {
width: auto;
margin-top: 20px;
}
/******************************** jQuery plugins styles ********************************/
/*************** Facebox ***************/
#facebox .b {
background:url(../../../Resources/Image/Admin/b.png);
}
#facebox .tl {
background:url(../../../Resources/Image/Admin/tl.png);
}
#facebox .tr {
background:url(../../../Resources/Image/Admin/tr.png);
}
#facebox .bl {
background:url(../../../Resources/Image/Admin/bl.png);
}
#facebox .br {
background:url(../../../Resources/Image/Admin/br.png);
}
#facebox {
position: absolute;
top: 0;
left: 0;
z-index: 100;
text-align: left;
}
#facebox .popup {
position: relative;
}
#facebox table {
border-collapse: collapse;
}
#facebox td {
border-bottom: 0;
padding: 0;
}
#facebox .body {
padding: 10px;
background: #fff;
width: 370px;
}
#facebox .loading {
text-align: center;
}
#facebox .image {
text-align: center;
}
#facebox img {
border: 0;
margin: 0;
}
#facebox .footer {
border-top: 1px solid #DDDDDD;
padding-top: 5px;
margin-top: 10px;
text-align: right;
}
#facebox .tl, #facebox .tr, #facebox .bl, #facebox .br {
height: 10px;
width: 10px;
overflow: hidden;
padding: 0;
}
#facebox_overlay {
position: fixed;
top: 0px;
left: 0px;
height:100%;
width:100%;
}
.facebox_hide {
z-index:-100;
}
.facebox_overlayBG {
background-color: #000;
z-index: 99;
}
/*************** My custom css ***************/
.content_center{
margin: auto;
}
#g1 img
{
width : 600px;
height : 500px;
}
.img_product
{
width : 200px;
height : 200px;
} | 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/StyleSheet/Admin/style.css | CSS | asf20 | 18,043 |
.button,
#main-content table tfoot td .bulk-actions select,
.pagination a.number,
form input.text-input,
input,
form textarea,
form .wysiwyg,
form select {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.content-box,
.content-box-header,
ul.content-box-tabs li a.current,
.shortcut-button,
.notification {
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
}
.content-box-header {
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.content-box-header-toggled {
-moz-border-radius-bottomleft: 6px;
-moz-border-radius-bottomright: 6px;
-webkit-border-bottom-left-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
ul.content-box-tabs li a.current {
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.shortcut-button span {
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
div.wysiwyg ul.panel li a { opacity: 0.6; }
div.wysiwyg ul.panel li a:hover, div.wysiwyg ul.panel li a.active { opacity: 0.99; }
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/StyleSheet/Admin/invalid.css | CSS | asf20 | 1,851 |
/************ Internet Explorer fixes ************/
#sidebar #main-nav ul li a {
_padding: 10px 15px; /* IE6 Hack */
_display: block; /* IE6 Hack */
_margin-bottom: -11px !important; /* IE6 Hack */
}
.content-box-header {
margin-top: 0;
}
ul.content-box-tabs { /* IE6 Hack */
_position: relative;
_top: 2px;
}
.action-button:hover {
cursor: pointer;
}
.input-notification {
position: relative;
top: -5px;
_background-position: left 6px; /* IE6 Hack */
}
#login-wrapper #login-content input {
margin: 0;
}
* html #facebox_overlay { /* IE6 Hack */
_position: absolute;
_height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
} | 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/StyleSheet/Admin/ie.css | CSS | asf20 | 987 |
Calendar.LANG("en", "English", {
fdow: 1, // first day of week for this locale; 0 = Sunday, 1 = Monday, etc.
goToday: "Go Today",
today: "Today", // appears in bottom bar
wk: "wk",
weekend: "0,6", // 0 = Sunday, 1 = Monday, etc.
AM: "am",
PM: "pm",
mn : [ "January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December" ],
smn : [ "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec" ],
dn : [ "Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday" ],
sdn : [ "Su",
"Mo",
"Tu",
"We",
"Th",
"Fr",
"Sa",
"Su" ]
});
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/Javascript/Calendar/en.js | JavaScript | asf20 | 1,321 |
/*
* AVIM JavaScript Vietnamese Input Method Source File dated 28-07-2008
*
* Copyright (C) 2004-2008 Hieu Tran Dang <lt2hieu2004 (at) users (dot) sf (dot) net
* Website: http://noname00.com/hieu
*
* You are allowed to use this software in any way you want providing:
* 1. You must retain this copyright notice at all time
* 2. You must not claim that you or any other third party is the author
* of this software in any way.
*/
var AVIMGlobalConfig = {
method: 0, //Default input method: 0=AUTO, 1=TELEX, 2=VNI, 3=VIQR, 4=VIQR*
onOff: 1, //Starting status: 0=Off, 1=On
ckSpell: 1, //Spell Check: 0=Off, 1=On
oldAccent: 1, //0: New way (oa`, oe`, uy`), 1: The good old day (o`a, o`e, u`y)
useCookie: 1, //Cookies: 0=Off, 1=On
exclude: ["email"], //IDs of the fields you DON'T want to let users type Vietnamese in
showControl: 1, //Show control panel: 0=Off, 1=On. If you turn this off, you must write your own control panel.
controlCSS: "../../../Resource/StyleSheet/Guest/avim.css" //Path to avim.css
};
//Set to true the methods which you want to be included in the AUTO method
var AVIMAutoConfig = {
telex: true,
vni: true,
viqr: false,
viqrStar: false
};
function AVIM() {
this.radioID = "avim_auto,avim_telex,avim_vni,avim_viqr,avim_viqr2,avim_off,avim_ckspell,avim_daucu".split(",");
this.attached = [];
this.changed = false;
this.agt = navigator.userAgent.toLowerCase();
this.alphabet = "QWERTYUIOPASDFGHJKLZXCVBNM\ ";
this.support = true;
this.ver = 0;
this.specialChange = false;
this.is_ie = ((this.agt.indexOf("msie") != -1) && (this.agt.indexOf("opera") == -1));
this.is_opera = false;
this.isKHTML = false;
this.kl = 0;
this.skey = [97,226,259,101,234,105,111,244,417,117,432,121,65,194,258,69,202,73,79,212,416,85,431,89];
this.fID = document.getElementsByTagName("iframe");
this.range = null;
this.whit = false;
this.db1 = [273,272];
this.ds1 = ['d','D'];
this.os1 = "o,O,ơ,Ơ,ó,Ó,ò,Ò,ọ,Ọ,ỏ,Ỏ,õ,Õ,ớ,Ớ,ờ,Ờ,ợ,Ợ,ở,Ở,ỡ,Ỡ".split(",");
this.ob1 = "ô,Ô,ô,Ô,ố,Ố,ồ,Ồ,ộ,Ộ,ổ,Ổ,ỗ,Ỗ,ố,Ố,ồ,Ồ,ộ,Ộ,ổ,Ổ,ỗ,Ỗ".split(",");
this.mocs1 = "o,O,ô,Ô,u,U,ó,Ó,ò,Ò,ọ,Ọ,ỏ,Ỏ,õ,Õ,ú,Ú,ù,Ù,ụ,Ụ,ủ,Ủ,ũ,Ũ,ố,Ố,ồ,Ồ,ộ,Ộ,ổ,Ổ,ỗ,Ỗ".split(",");
this.mocb1 = "ơ,Ơ,ơ,Ơ,ư,Ư,ớ,Ớ,ờ,Ờ,ợ,Ợ,ở,Ở,ỡ,Ỡ,ứ,Ứ,ừ,Ừ,ự,Ự,ử,Ử,ữ,Ữ,ớ,Ớ,ờ,Ờ,ợ,Ợ,ở,Ở,ỡ,Ỡ".split(",");
this.trangs1 = "a,A,â,Â,á,Á,à,À,ạ,Ạ,ả,Ả,ã,Ã,ấ,Ấ,ầ,Ầ,ậ,Ậ,ẩ,Ẩ,ẫ,Ẫ".split(",");
this.trangb1 = "ă,Ă,ă,Ă,ắ,Ắ,ằ,Ằ,ặ,Ặ,ẳ,Ẳ,ẵ,Ẵ,ắ,Ắ,ằ,Ằ,ặ,Ặ,ẳ,Ẳ,ẵ,Ẵ".split(",");
this.as1 = "a,A,ă,Ă,á,Á,à,À,ạ,Ạ,ả,Ả,ã,Ã,ắ,Ắ,ằ,Ằ,ặ,Ặ,ẳ,Ẳ,ẵ,Ẵ,ế,Ế,ề,Ề,ệ,Ệ,ể,Ể,ễ,Ễ".split(",");
this.ab1 = "â,Â,â,Â,ấ,Ấ,ầ,Ầ,ậ,Ậ,ẩ,Ẩ,ẫ,Ẫ,ấ,Ấ,ầ,Ầ,ậ,Ậ,ẩ,Ẩ,ẫ,Ẫ,é,É,è,È,ẹ,Ẹ,ẻ,Ẻ,ẽ,Ẽ".split(",");
this.es1 = "e,E,é,É,è,È,ẹ,Ẹ,ẻ,Ẻ,ẽ,Ẽ".split(",");
this.eb1 = "ê,Ê,ế,Ế,ề,Ề,ệ,Ệ,ể,Ể,ễ,Ễ".split(",");
this.english = "ĐÂĂƠƯÊÔ";
this.lowen = "đâăơưêô";
this.arA = "á,à,ả,ã,ạ,a,Á,À,Ả,Ã,Ạ,A".split(',');
this.mocrA = "ó,ò,ỏ,õ,ọ,o,ú,ù,ủ,ũ,ụ,u,Ó,Ò,Ỏ,Õ,Ọ,O,Ú,Ù,Ủ,Ũ,Ụ,U".split(',');
this.erA = "é,è,ẻ,ẽ,ẹ,e,É,È,Ẻ,Ẽ,Ẹ,E".split(',');
this.orA = "ó,ò,ỏ,õ,ọ,o,Ó,Ò,Ỏ,Õ,Ọ,O".split(',');
this.aA = "ấ,ầ,ẩ,ẫ,ậ,â,Ấ,Ầ,Ẩ,Ẫ,Ậ,Â".split(',');
this.oA = "ố,ồ,ổ,ỗ,ộ,ô,Ố,Ồ,Ổ,Ỗ,Ộ,Ô".split(',');
this.mocA = "ớ,ờ,ở,ỡ,ợ,ơ,ứ,ừ,ử,ữ,ự,ư,Ớ,Ờ,Ở,Ỡ,Ợ,Ơ,Ứ,Ừ,Ử,Ữ,Ự,Ư".split(',');
this.trangA = "ắ,ằ,ẳ,ẵ,ặ,ă,Ắ,Ằ,Ẳ,Ẵ,Ặ,Ă".split(',');
this.eA = "ế,ề,ể,ễ,ệ,ê,Ế,Ề,Ể,Ễ,Ệ,Ê".split(',');
this.oA = "ố,ồ,ổ,ỗ,ộ,ô,Ố,Ồ,Ổ,Ỗ,Ộ,Ô".split(',');
this.skey2 = "a,a,a,e,e,i,o,o,o,u,u,y,A,A,A,E,E,I,O,O,O,U,U,Y".split(',');
this.fcc = function(x) {
return String.fromCharCode(x);
}
this.getEL = function(id) {
return document.getElementById(id);
}
this.getSF = function() {
var sf = [], x;
for(x = 0; x < this.skey.length; x++) {
sf[sf.length] = this.fcc(this.skey[x]);
}
return sf;
}
if(AVIMGlobalConfig.showControl) {
this.css = document.createElement('link');
this.css.rel = 'stylesheet';
this.css.type = 'text/css';
this.css.href = AVIMGlobalConfig.controlCSS;
document.getElementsByTagName('head')[0].appendChild(this.css);
document.write('<span id="AVIMControl">');
document.write('<p class="AVIMControl"><input id="avim_auto" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(0);" />Tự động');
document.write('<input id="avim_telex" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(1);" />TELEX');
document.write('<input id="avim_vni" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(2);" />VNI');
document.write('<input id="avim_viqr" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(3);" />VIQR');
document.write('<input id="avim_viqr2" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(4);" />VIQR*');
document.write('<input id="avim_off" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(-1);" />Tắt<br />');
document.write('<a class="AVIMControl" style="float: right; position: relative; top: 3px;" onclick="document.getElementById(' + "'AVIMControl').style.display='none';" + '">[Ẩn AVIM - F12]</a>');
document.write('<input type="checkbox" id="avim_ckspell" onclick="AVIMObj.setSpell(this);" />Chính tả');
document.write('<input type="checkbox" id="avim_daucu" onclick="AVIMObj.setDauCu(this);" />Kiểu cũ</p>');
document.write('</span>');
}
if(!this.is_ie) {
if(this.agt.indexOf("opera") >= 0) {
this.operaV = this.agt.split(" ");
this.operaVersion = parseInt(this.operaV[this.operaV.length - 1]);
if(this.operaVersion >= 8) {
this.is_opera = true;
} else {
this.operaV = this.operaV[0].split("/");
this.operaVersion = parseInt(this.operaV[1]);
if(this.operaVersion >= 8) this.is_opera = true;
}
} else if(this.agt.indexOf("khtml") >= 0) {
this.isKHTML = true;
} else {
this.ver = this.agt.substr(this.agt.indexOf("rv:") + 3);
this.ver = parseFloat(this.ver.substr(0, this.ver.indexOf(" ")));
if(this.agt.indexOf("mozilla") < 0) this.ver = 0;
}
}
this.nospell = function(w, k) {
return false;
}
this.ckspell = function(w, k) {
w = this.unV(w);
var exc = "UOU,IEU".split(','), z, next = true, noE = "UU,UOU,UOI,IEU,AO,IA,AI,AY,AU,AO".split(','), noBE = "YEU";
var check = true, noM = "UE,UYE,IU,EU,UY".split(','), noMT = "AY,AU".split(','), noT = "UA", t = -1, notV2 = "IAO";
var uw = this.up(w), tw = uw, update = false, gi = "IO", noAOEW = "OE,OO,AO,EO,IA,AI".split(','), noAOE = "OA", test, a, b;
var notViet = "AA,AE,EE,OU,YY,YI,IY,EY,EA,EI,II,IO,YO,YA,OOO".split(','), uk = this.up(k), twE, uw2 = this.unV2(uw);
var vSConsonant = "B,C,D,G,H,K,L,M,N,P,Q,R,S,T,V,X".split(','), vDConsonant = "CH,GI,KH,NGH,GH,NG,NH,PH,QU,TH,TR".split(',');
var vDConsonantE = "CH,NG,NH".split(','),sConsonant = "C,P,T,CH".split(','),vSConsonantE = "C,M,N,P,T".split(',');
var noNHE = "O,U,IE,Ô,Ơ,Ư,IÊ,Ă,Â,UYE,UYÊ,UO,ƯƠ,ƯO,UƠ,UA,ƯA,OĂ,OE,OÊ".split(','),oMoc = "UU,UOU".split(',');
if(this.FRX.indexOf(uk) >= 0) {
for(a = 0; a < sConsonant.length; a++) {
if(uw.substr(uw.length - sConsonant[a].length, sConsonant[a].length) == sConsonant[a]) {
return true;
}
}
}
for(a = 0; a < uw.length; a++) {
if("FJZW1234567890".indexOf(uw.substr(a, 1)) >= 0) {
return true;
}
for(b = 0; b < notViet.length; b++) {
if(uw2.substr(a, notViet[b].length) == notViet[b]) {
for(z = 0; z < exc.length; z++) {
if(uw2.indexOf(exc[z]) >= 0) {
next=false;
}
}
if(next && ((gi.indexOf(notViet[b]) < 0) || (a <= 0) || (uw2.substr(a - 1, 1) != 'G'))) {
return true;
}
}
}
}
for(b = 0; b < vDConsonant.length; b++) {
if(tw.indexOf(vDConsonant[b]) == 0) {
tw = tw.substr(vDConsonant[b].length);
update = true;
t = b;
break;
}
}
if(!update) {
for(b = 0; b < vSConsonant.length; b++) {
if(tw.indexOf(vSConsonant[b]) == 0) {
tw=tw.substr(1);
break;
}
}
}
update=false;
twE=tw;
for(b = 0; b < vDConsonantE.length; b++) {
if(tw.substr(tw.length - vDConsonantE[b].length) == vDConsonantE[b]) {
tw = tw.substr(0, tw.length - vDConsonantE[b].length);
if(b == 2){
for(z = 0; z < noNHE.length; z++) {
if(tw == noNHE[z]) {
return true;
}
}
if((uk == this.trang) && ((tw == "OA") || (tw == "A"))) {
return true;
}
}
update = true;
break;
}
}
if(!update) {
for(b = 0; b < vSConsonantE.length; b++) {
if(tw.substr(tw.length - 1) == vSConsonantE[b]) {
tw = tw.substr(0, tw.length - 1);
break;
}
}
}
if(tw) {
for(a = 0; a < vDConsonant.length; a++) {
for(b = 0; b < tw.length; b++) {
if(tw.substr(b, vDConsonant[a].length) == vDConsonant[a]) {
return true;
}
}
}
for(a = 0; a < vSConsonant.length; a++) {
if(tw.indexOf(vSConsonant[a]) >= 0) {
return true;
}
}
}
test = tw.substr(0, 1);
if((t == 3) && ((test == "A") || (test == "O") || (test == "U") || (test == "Y"))) {
return true;
}
if((t == 5) && ((test == "E") || (test == "I") || (test == "Y"))) {
return true;
}
uw2 = this.unV2(tw);
if(uw2 == notV2) {
return true;
}
if(tw != twE) {
for(z = 0; z < noE.length; z++) {
if(uw2 == noE[z]) {
return true;
}
}
}
if((tw != uw) && (uw2 == noBE)) {
return true;
}
if(uk != this.moc) {
for(z = 0; z < oMoc.length; z++) {
if(tw == oMoc[z]) return true;
}
}
if((uw2.indexOf('UYE')>0) && (uk == 'E')) {
check=false;
}
if((this.them.indexOf(uk) >= 0) && check) {
for(a = 0; a < noAOEW.length; a++) {
if(uw2.indexOf(noAOEW[a]) >= 0) {
return true;
}
}
if(uk != this.trang) {
if(uw2 == noAOE) {
return true;
}
}
if((uk == this.trang) && (this.trang != 'W')) {
if(uw2 == noT) {
return true;
}
}
if(uk == this.moc) {
for(a = 0; a < noM.length; a++) {
if(uw2 == noM[a]) {
return true;
}
}
}
if((uk == this.moc) || (uk == this.trang)) {
for(a = 0; a < noMT.length; a++) {
if(uw2 == noMT[a]) {
return true;
}
}
}
}
this.tw5 = tw;
if((uw2.charCodeAt(0) == 272) || (uw2.charCodeAt(0) == 273)) {
if(uw2.length > 4) {
return true;
}
} else if(uw2.length > 3) {
return true;
}
return false;
}
this.noCookie = function() {}
this.doSetCookie = function() {
var exp = new Date(11245711156480).toGMTString();
document.cookie = 'AVIM_on_off=' + AVIMGlobalConfig.onOff + ';expires=' + exp;
document.cookie = 'AVIM_method=' + AVIMGlobalConfig.method + ';expires=' + exp;
document.cookie = 'AVIM_ckspell=' + AVIMGlobalConfig.ckSpell + ';expires=' + exp;
document.cookie = 'AVIM_daucu=' + AVIMGlobalConfig.oldAccent + ';expires=' + exp;
}
this.doGetCookie = function() {
var ck = document.cookie, res = /AVIM_method/.test(ck), p, i, ckA = ck.split(';');
if(!res || (ck.indexOf('AVIM_ckspell') < 0)) {
this.setCookie();
return;
}
for(i = 0; i < ckA.length; i++) {
p = ckA[i].split('=');
p[0] = p[0].replace(/^\s+/g, "");
p[1] = parseInt(p[1]);
if(p[0] == 'AVIM_on_off') {
AVIMGlobalConfig.onOff = p[1];
}
else if(p[0] == 'AVIM_method') {
AVIMGlobalConfig.method = p[1];
}
else if(p[0] == 'AVIM_ckspell') {
if(p[1] == 0) {
AVIMGlobalConfig.ckSpell=0;
this.spellerr=this.nospell;
} else {
AVIMGlobalConfig.ckSpell=1;
this.spellerr=this.ckspell;
}
} else if(p[0] == 'AVIM_daucu') {
AVIMGlobalConfig.oldAccent = parseInt(p[1]);
}
}
}
if(AVIMGlobalConfig.useCookie == 1) {
this.setCookie = this.doSetCookie;
this.getCookie = this.doGetCookie;
} else {
this.setCookie = this.noCookie;
this.getCookie = this.noCookie;
}
this.setMethod = function(m) {
if(m == -1) {
AVIMGlobalConfig.onOff = 0;
if(this.getEL(this.radioID[5])) {
this.getEL(this.radioID[5]).checked = true;
}
} else {
AVIMGlobalConfig.onOff = 1;
AVIMGlobalConfig.method = m;
if(this.getEL(this.radioID[m])) {
this.getEL(this.radioID[m]).checked = true;
}
}
this.setSpell(AVIMGlobalConfig.ckSpell);
this.setDauCu(AVIMGlobalConfig.oldAccent);
this.setCookie();
}
this.setDauCu = function(box) {
if(typeof(box) == "number") {
AVIMGlobalConfig.oldAccent = box;
if(this.getEL(this.radioID[7])) {
this.getEL(this.radioID[7]).checked = box;
}
} else {
AVIMGlobalConfig.oldAccent = (box.checked) ? 1 : 0;
}
this.setCookie();
}
this.setSpell = function(box) {
if(typeof(box) == "number") {
this.spellerr = (box == 1) ? this.ckspell : this.nospell;
if(this.getEL(this.radioID[6])) {
this.getEL(this.radioID[6]).checked = box;
}
} else {
if(box.checked) {
this.spellerr = this.ckspell;
AVIMGlobalConfig.ckSpell = 1;
} else {
this.spellerr = this.nospell;
AVIMGlobalConfig.ckSpell = 0;
}
}
this.setCookie();
}
if(this.is_ie || (this.ver >= 1.3) || this.is_opera || this.isKHTML) {
this.getCookie();
if(AVIMGlobalConfig.onOff == 0) this.setMethod(-1);
else this.setMethod(AVIMGlobalConfig.method);
this.setSpell(AVIMGlobalConfig.ckSpell);
this.setDauCu(AVIMGlobalConfig.oldAccent);
} else {
this.support = false;
}
this.mozGetText = function(obj) {
var v, pos, w = "", g = 1;
v = (obj.data) ? obj.data : obj.value;
if(v.length <= 0) {
return false;
}
if(!obj.data) {
if(!obj.setSelectionRange) {
return false;
}
pos = obj.selectionStart;
} else {
pos = obj.pos;
}
if(obj.selectionStart != obj.selectionEnd) {
return ["", pos];
}
while(1) {
if(pos - g < 0) {
break;
} else if(this.notWord(v.substr(pos - g, 1))) {
if(v.substr(pos - g, 1) == "\\") {
w = v.substr(pos - g, 1) + w;
}
break;
} else {
w = v.substr(pos - g, 1) + w;
}
g++;
}
return [w, pos];
}
this.ieGetText = function(obj) {
var caret = obj.document.selection.createRange(), w="";
if(caret.text) {
caret.text = "";
} else {
while(1) {
caret.moveStart("character", -1);
if(w.length == caret.text.length) {
break;
}
w = caret.text;
if(this.notWord(w.charAt(0))) {
if(w.charCodeAt(0) == 13) {
w=w.substr(2);
} else if(w.charAt(0) != "\\") {
w=w.substr(1);
}
break;
}
}
}
if(w.length) {
caret.collapse(false);
caret.moveStart("character", -w.length);
obj.cW = caret.duplicate();
return obj;
} else {
return false;
}
}
this.start = function(obj, key) {
var w = "", method = AVIMGlobalConfig.method, dockspell = AVIMGlobalConfig.ckSpell, uni, uni2 = false, uni3 = false, uni4 = false;
this.oc=obj;
var telex = "D,A,E,O,W,W".split(','), vni = "9,6,6,6,7,8".split(','), viqr = "D,^,^,^,+,(".split(','), viqr2 = "D,^,^,^,*,(".split(','), a, noNormC;
if(method == 0) {
var arr = [], check = [AVIMAutoConfig.telex, AVIMAutoConfig.vni, AVIMAutoConfig.viqr, AVIMAutoConfig.viqrStar];
var value1 = [telex, vni, viqr, viqr2], uniA = [uni, uni2, uni3, uni4], D2A = ["DAWEO", "6789", "D^+(", "D^*("];
for(a = 0; a < check.length; a++) {
if(check[a]) {
arr[arr.length] = value1[a];
} else {
D2A[a] = "";
}
}
for(a = 0; a < arr.length; a++) {
uniA[a] = arr[a];
}
uni = uniA[0];
uni2 = uniA[1];
uni3 = uniA[2];
uni4 = uniA[3];
this.D2 = D2A.join();
if(!uni) {
return;
}
} else if(method == 1) {
uni = telex;
this.D2 = "DAWEO";
}
else if(method == 2) {
uni = vni;
this.D2 = "6789";
}
else if(method == 3) {
uni = viqr;
this.D2 = "D^+(";
}
else if(method == 4) {
uni = viqr2;
this.D2 = "D^*(";
}
if(!this.is_ie) {
key = this.fcc(key.which);
w = this.mozGetText(obj);
if(!w || obj.sel) {
return;
}
if(this.D2.indexOf(this.up(key)) >= 0) {
noNormC = true;
} else {
noNormC = false;
}
this.main(w[0], key, w[1], uni, noNormC);
if(!dockspell) {
w = this.mozGetText(obj);
}
if(w && uni2 && !this.changed) {
this.main(w[0], key, w[1], uni2, noNormC);
}
if(!dockspell) {
w = this.mozGetText(obj);
}
if(w && uni3 && !this.changed) {
this.main(w[0], key, w[1], uni3, noNormC);
}
if(!dockspell) {
w = this.mozGetText(obj);
}
if(w && uni4 && !this.changed) {
this.main(w[0], key, w[1], uni4, noNormC);
}
} else {
obj = this.ieGetText(obj);
if(obj) {
var sT = obj.cW.text;
w = this.main(sT, key, 0, uni, false);
if(uni2 && ((w == sT) || (typeof(w) == 'undefined'))) {
w = this.main(sT, key, 0, uni2, false);
}
if(uni3 && ((w == sT) || (typeof(w) == 'undefined'))) {
w = this.main(sT, key, 0, uni3, false);
}
if(uni4 && ((w == sT) || (typeof(w) == 'undefined'))) {
w = this.main(sT, key, 0, uni4, false);
}
if(w) {
obj.cW.text = w;
}
}
}
if(this.D2.indexOf(this.up(key)) >= 0) {
if(!this.is_ie) {
w = this.mozGetText(obj);
if(!w) {
return;
}
this.normC(w[0], key, w[1]);
} else if(typeof(obj) == "object") {
obj = this.ieGetText(obj);
if(obj) {
w = obj.cW.text;
if(!this.changed) {
w += key;
this.changed = true;
}
obj.cW.text = w;
w = this.normC(w, key, 0);
if(w) {
obj = this.ieGetText(obj);
obj.cW.text = w;
}
}
}
}
}
this.findC = function(w, k, sf) {
var method = AVIMGlobalConfig.method;
if(((method == 3) || (method == 4)) && (w.substr(w.length - 1, 1) == "\\")) {
return [1, k.charCodeAt(0)];
}
var str = "", res, cc = "", pc = "", tE = "", vowA = [], s = "ÂĂÊÔƠƯêâăơôư", c = 0, dn = false, uw = this.up(w), tv, g;
var DAWEOFA = this.up(this.aA.join() + this.eA.join() + this.mocA.join() + this.trangA.join() + this.oA.join() + this.english), h, uc;
for(g = 0; g < sf.length; g++) {
if(this.nan(sf[g])) {
str += sf[g];
} else {
str += this.fcc(sf[g]);
}
}
var uk = this.up(k), uni_array = this.repSign(k), w2 = this.up(this.unV2(this.unV(w))), dont = "ƯA,ƯU".split(',');
if (this.DAWEO.indexOf(uk) >= 0) {
if(uk == this.moc) {
if((w2.indexOf("UU") >= 0) && (this.tw5 != dont[1])) {
if(w2.indexOf("UU") == (w.length - 2)) {
res=2;
} else {
return false;
}
} else if(w2.indexOf("UOU") >= 0) {
if(w2.indexOf("UOU") == (w.length-3)) {
res=2;
} else {
return false;
}
}
}
if(!res) {
for(g = 1; g <= w.length; g++) {
cc = w.substr(w.length - g, 1);
pc = this.up(w.substr(w.length - g - 1, 1));
uc = this.up(cc);
for(h = 0; h < dont.length; h++) {
if((this.tw5 == dont[h]) && (this.tw5 == this.unV(pc + uc))) {
dn = true;
}
}
if(dn) {
dn = false;
continue;
}
if(str.indexOf(uc) >= 0) {
if(((uk == this.moc) && (this.unV(uc) == "U") && (this.up(this.unV(w.substr(w.length - g + 1, 1))) == "A")) || ((uk == this.trang) && (this.unV(uc) == 'A') && (this.unV(pc) == 'U'))) {
if(this.unV(uc) == "U") {
tv=1;
} else {
tv=2;
}
var ccc = this.up(w.substr(w.length - g - tv, 1));
if(ccc != "Q") {
res = g + tv - 1;
} else if(uk == this.trang) {
res = g;
} else if(this.moc != this.trang) {
return false;
}
} else {
res = g;
}
if(!this.whit || (uw.indexOf("Ư") < 0) || (uw.indexOf("W") < 0)) {
break;
}
} else if(DAWEOFA.indexOf(uc) >= 0) {
if(uk == this.D) {
if(cc == "đ") {
res = [g, 'd'];
} else if(cc == "Đ") {
res = [g, 'D'];
}
} else {
res = this.DAWEOF(cc, uk, g);
}
if(res) break;
}
}
}
}
if((uk != this.Z) && (this.DAWEO.indexOf(uk) < 0)) {
var tEC = this.retKC(uk);
for(g = 0;g < tEC.length; g++) {
tE += this.fcc(tEC[g]);
}
}
for(g = 1; g <= w.length; g++) {
if(this.DAWEO.indexOf(uk) < 0) {
cc = this.up(w.substr(w.length - g, 1));
pc = this.up(w.substr(w.length - g - 1, 1));
if(str.indexOf(cc) >= 0) {
if(cc == 'U') {
if(pc != 'Q') {
c++;
vowA[vowA.length] = g;
}
} else if(cc == 'I') {
if((pc != 'G') || (c <= 0)) {
c++;
vowA[vowA.length] = g;
}
} else {
c++;
vowA[vowA.length] = g;
}
} else if(uk != this.Z) {
for(h = 0; h < uni_array.length; h++) if(uni_array[h] == w.charCodeAt(w.length - g)) {
if(this.spellerr(w, k)) {
return false;
}
return [g, tEC[h % 24]];
}
for(h = 0; h < tEC.length; h++) {
if(tEC[h] == w.charCodeAt(w.length - g)) {
return [g, this.fcc(this.skey[h])];
}
}
}
}
}
if((uk != this.Z) && (typeof(res) != 'object')) {
if(this.spellerr(w, k)) {
return false;
}
}
if(this.DAWEO.indexOf(uk) < 0) {
for(g = 1; g <= w.length; g++) {
if((uk != this.Z) && (s.indexOf(w.substr(w.length - g, 1)) >= 0)) {
return g;
} else if(tE.indexOf(w.substr(w.length - g, 1)) >= 0) {
for(h = 0; h < tEC.length; h++) {
if(w.substr(w.length - g, 1).charCodeAt(0) == tEC[h]) {
return [g, this.fcc(this.skey[h])];
}
}
}
}
}
if(res) {
return res;
}
if((c == 1) || (uk == this.Z)) {
return vowA[0];
} else if(c == 2) {
var v = 2;
if(w.substr(w.length - 1) == " ") {
v = 3;
}
var ttt = this.up(w.substr(w.length - v, 2));
if((AVIMGlobalConfig.oldAccent == 0) && ((ttt == "UY") || (ttt == "OA") || (ttt == "OE"))) {
return vowA[0];
}
var c2 = 0, fdconsonant, sc = "BCD" + this.fcc(272) + "GHKLMNPQRSTVX", dc = "CH,GI,KH,NGH,GH,NG,NH,PH,QU,TH,TR".split(',');
for(h = 1; h <= w.length; h++) {
fdconsonant=false;
for(g = 0; g < dc.length; g++) {
if(this.up(w.substr(w.length - h - dc[g].length + 1, dc[g].length)).indexOf(dc[g])>=0) {
c2++;
fdconsonant = true;
if(dc[g] != 'NGH') {
h++;
} else {
h+=2;
}
}
}
if(!fdconsonant) {
if(sc.indexOf(this.up(w.substr(w.length - h, 1))) >= 0) {
c2++;
} else {
break;
}
}
}
if((c2 == 1) || (c2 == 2)) {
return vowA[0];
} else {
return vowA[1];
}
} else if(c == 3) {
return vowA[1];
} else return false;
}
this.ie_replaceChar = function(w, pos, c) {
var r = "", uc = 0;
if(isNaN(c)) uc = this.up(c);
if(this.whit && (this.up(w.substr(w.length - pos - 1, 1)) == 'U') && (pos != 1) && (this.up(w.substr(w.length - pos - 2, 1)) != 'Q')) {
this.whit = false;
if((this.up(this.unV(this.fcc(c))) == "Ơ") || (uc == "O")) {
if(w.substr(w.length - pos - 1, 1) == 'u') r = this.fcc(432);
else r = this.fcc(431);
}
if(uc == "O") {
if(c == "o") {
c = 417;
} else {
c = 416;
}
}
}
if(!isNaN(c)) {
this.changed = true;
r += this.fcc(c);
return w.substr(0, w.length - pos - r.length + 1) + r + w.substr(w.length - pos + 1);
} else {
return w.substr(0, w.length - pos) + c + w.substr(w.length - pos + 1);
}
}
this.replaceChar = function(o, pos, c) {
var bb = false;
if(!this.nan(c)) {
var replaceBy = this.fcc(c), wfix = this.up(this.unV(this.fcc(c)));
this.changed = true;
} else {
var replaceBy = c;
if((this.up(c) == "O") && this.whit) {
bb=true;
}
}
if(!o.data) {
var savePos = o.selectionStart, sst = o.scrollTop;
if ((this.up(o.value.substr(pos - 1, 1)) == 'U') && (pos < savePos - 1) && (this.up(o.value.substr(pos - 2, 1)) != 'Q')) {
if((wfix == "Ơ") || bb) {
if (o.value.substr(pos-1,1) == 'u') {
var r = this.fcc(432);
} else {
var r = this.fcc(431);
}
}
if(bb) {
this.changed = true;
if(c == "o") {
replaceBy = "ơ";
} else {
replaceBy = "Ơ";
}
}
}
o.value = o.value.substr(0, pos) + replaceBy + o.value.substr(pos + 1);
if(r) o.value = o.value.substr(0, pos - 1) + r + o.value.substr(pos);
o.setSelectionRange(savePos, savePos);
o.scrollTop = sst;
} else {
if ((this.up(o.data.substr(pos - 1, 1)) == 'U') && (pos < o.pos - 1)) {
if((wfix == "Ơ") || bb) {
if (o.data.substr(pos - 1, 1) == 'u') {
var r = this.fcc(432);
} else {
var r = this.fcc(431);
}
}
if(bb) {
this.changed = true;
if(c == "o") {
replaceBy = "ơ";
} else {
replaceBy = "Ơ";
}
}
}
o.deleteData(pos, 1);
o.insertData(pos, replaceBy);
if(r) {
o.deleteData(pos - 1, 1);
o.insertData(pos - 1, r);
}
}
if(this.whit) {
this.whit=false;
}
}
this.tr = function(k, w, by, sf, i) {
var r, pos = this.findC(w, k, sf), g;
if(pos) {
if(pos[1]) {
if(this.is_ie) {
return this.ie_replaceChar(w, pos[0], pos[1]);
} else {
return this.replaceChar(this.oc, i-pos[0], pos[1]);
}
} else {
var c, pC = w.substr(w.length - pos, 1), cmp;
r = sf;
for(g = 0; g < r.length; g++) {
if(this.nan(r[g]) || (r[g] == "e")) {
cmp = pC;
} else {
cmp = pC.charCodeAt(0);
}
if(cmp == r[g]) {
if(!this.nan(by[g])) {
c = by[g];
} else {
c = by[g].charCodeAt(0);
}
if(this.is_ie) {
return this.ie_replaceChar(w, pos, c);
} else {
return this.replaceChar(this.oc, i - pos, c);
}
}
}
}
}
return false;
}
this.main = function(w, k, i, a, noNormC) {
var uk = this.up(k), bya = [this.db1, this.ab1, this.eb1, this.ob1, this.mocb1, this.trangb1], got = false, t = "d,D,a,A,a,A,o,O,u,U,e,E,o,O".split(",");
var sfa = [this.ds1, this.as1, this.es1, this.os1, this.mocs1, this.trangs1], by = [], sf = [], method = AVIMGlobalConfig.method, h, g;
if((method == 2) || ((method == 0) && (a[0] == "9"))) {
this.DAWEO = "6789";
this.SFJRX = "12534";
this.S = "1";
this.F = "2";
this.J = "5";
this.R = "3";
this.X = "4";
this.Z = "0";
this.D = "9";
this.FRX = "234";
this.AEO = "6";
this.moc = "7";
this.trang = "8";
this.them = "678";
this.A = "^";
this.E = "^";
this.O = "^";
} else if((method == 3) || ((method == 0) && (a[4] == "+"))) {
this.DAWEO = "^+(D";
this.SFJRX = "'`.?~";
this.S = "'";
this.F = "`";
this.J = ".";
this.R = "?";
this.X = "~";
this.Z = "-";
this.D = "D";
this.FRX = "`?~";
this.AEO = "^";
this.moc = "+";
this.trang = "(";
this.them = "^+(";
this.A = "^";
this.E = "^";
this.O = "^";
} else if((method == 4) || ((method == 0) && (a[4] == "*"))) {
this.DAWEO = "^*(D";
this.SFJRX = "'`.?~";
this.S = "'";
this.F = "`";
this.J = ".";
this.R = "?";
this.X = "~";
this.Z = "-";
this.D = "D";
this.FRX = "`?~";
this.AEO = "^";
this.moc = "*";
this.trang = "(";
this.them = "^*(";
this.A = "^";
this.E = "^";
this.O = "^";
} else if((method == 1) || ((method == 0) && (a[0] == "D"))) {
this.SFJRX = "SFJRX";
this.DAWEO = "DAWEO";
this.D = 'D';
this.S = 'S';
this.F = 'F';
this.J = 'J';
this.R = 'R';
this.X = 'X';
this.Z = 'Z';
this.FRX = "FRX";
this.them = "AOEW";
this.trang = "W";
this.moc = "W";
this.A = "A";
this.E = "E";
this.O = "O";
}
if(this.SFJRX.indexOf(uk) >= 0) {
var ret = this.sr(w,k,i);
got=true;
if(ret) {
return ret;
}
} else if(uk == this.Z) {
sf = this.repSign(null);
for(h = 0; h < this.english.length; h++) {
sf[sf.length] = this.lowen.charCodeAt(h);
sf[sf.length] = this.english.charCodeAt(h);
}
for(h = 0; h < 5; h++) {
for(g = 0; g < this.skey.length; g++) {
by[by.length] = this.skey[g];
}
}
for(h = 0; h < t.length; h++) {
by[by.length] = t[h];
}
got = true;
} else {
for(h = 0; h < a.length; h++) {
if(a[h] == uk) {
got = true;
by = by.concat(bya[h]);
sf = sf.concat(sfa[h]);
}
}
}
if(uk == this.moc) {
this.whit = true;
}
if(!got) {
if(noNormC) {
return;
} else {
return this.normC(w, k, i);
}
}
return this.DAWEOZ(k, w, by, sf, i, uk);
}
this.DAWEOZ = function(k, w, by, sf, i, uk) {
if((this.DAWEO.indexOf(uk) >= 0) || (this.Z.indexOf(uk) >= 0)) {
return this.tr(k, w, by, sf, i);
}
}
this.normC = function(w, k, i) {
var uk = this.up(k), u = this.repSign(null), fS, c, j, h, space = (k.charCodeAt(0) == 32) ? true : false;
if(!this.is_ie && space) {
return;
}
for(j = 1; j <= w.length; j++) {
for(h = 0; h < u.length; h++) {
if(u[h] == w.charCodeAt(w.length - j)) {
if(h <= 23) {
fS = this.S;
} else if(h <= 47) {
fS = this.F;
} else if(h <= 71) {
fS = this.J;
} else if(h <= 95) {
fS = this.R;
} else {
fS = this.X;
}
c = this.skey[h % 24];
if((this.alphabet.indexOf(uk) < 0) && (this.D2.indexOf(uk) < 0)) {
return w;
}
w = this.unV(w);
if(!space && !this.changed) {
w += k;
}
if(!this.is_ie) {
var sp = this.oc.selectionStart, pos = sp;
if(!this.changed) {
var sst = this.oc.scrollTop;
pos += k.length;
if(!this.oc.data) {
this.oc.value = this.oc.value.substr(0, sp) + k + this.oc.value.substr(this.oc.selectionEnd);
this.changed = true;
this.oc.scrollTop = sst;
} else {
this.oc.insertData(this.oc.pos, k);
this.oc.pos++;
this.range.setEnd(this.oc, this.oc.pos);
this.specialChange = true;
}
}
if(!this.oc.data) {
this.oc.setSelectionRange(pos, pos);
}
if(!this.ckspell(w, fS)) {
this.replaceChar(this.oc, i - j, c);
if(!this.oc.data) {
var a = [this.D];
this.main(w, fS, pos, a, false);
} else {
var ww = this.mozGetText(this.oc), a = [this.D];
this.main(ww[0], fS, ww[1], a, false);
}
}
} else {
var ret = this.sr(w, fS, 0);
if(space && ret) {
ret += this.fcc(32);
}
if(ret) {
return ret;
}
}
}
}
}
}
this.DAWEOF = function(cc, k, g) {
var ret = [g], kA = [this.A, this.moc, this.trang, this.E, this.O], z, a;
var ccA = [this.aA, this.mocA, this.trangA, this.eA, this.oA], ccrA = [this.arA, this.mocrA, this.arA, this.erA, this.orA];
for(a = 0; a < kA.length; a++) {
if(k == kA[a]) {
for(z = 0; z < ccA[a].length; z++) {
if(cc == ccA[a][z]) {
ret[1] = ccrA[a][z];
}
}
}
}
if(ret[1]) {
return ret;
} else {
return false;
}
}
this.retKC = function(k) {
if(k == this.S) {
return [225,7845,7855,233,7871,237,243,7889,7899,250,7913,253,193,7844,7854,201,7870,205,211,7888,7898,218,7912,221];
}
if(k == this.F) {
return [224,7847,7857,232,7873,236,242,7891,7901,249,7915,7923,192,7846,7856,200,7872,204,210,7890,7900,217,7914,7922];
}
if(k == this.J) {
return [7841,7853,7863,7865,7879,7883,7885,7897,7907,7909,7921,7925,7840,7852,7862,7864,7878,7882,7884,7896,7906,7908,7920,7924];
}
if(k == this.R) {
return [7843,7849,7859,7867,7875,7881,7887,7893,7903,7911,7917,7927,7842,7848,7858,7866,7874,7880,7886,7892,7902,7910,7916,7926];
}
if(k == this.X) {
return [227,7851,7861,7869,7877,297,245,7895,7905,361,7919,7929,195,7850,7860,7868,7876,296,213,7894,7904,360,7918,7928];
}
}
this.unV = function(w) {
var u = this.repSign(null), b, a;
for(a = 1; a <= w.length; a++) {
for(b = 0; b < u.length; b++) {
if(u[b] == w.charCodeAt(w.length - a)) {
w = w.substr(0, w.length - a) + this.fcc(this.skey[b % 24]) + w.substr(w.length - a + 1);
}
}
}
return w;
}
this.unV2 = function(w) {
var a, b;
for(a = 1; a <= w.length; a++) {
for(b = 0; b < this.skey.length; b++) {
if(this.skey[b] == w.charCodeAt(w.length - a)) {
w = w.substr(0, w.length - a) + this.skey2[b] + w.substr(w.length - a + 1);
}
}
}
return w;
}
this.repSign = function(k) {
var t = [], u = [], a, b;
for(a = 0; a < 5; a++) {
if((k == null)||(this.SFJRX.substr(a, 1) != this.up(k))) {
t = this.retKC(this.SFJRX.substr(a, 1));
for(b = 0; b < t.length; b++) u[u.length] = t[b];
}
}
return u;
}
this.sr = function(w, k, i) {
var sf = this.getSF(), pos = this.findC(w, k, sf);
if(pos) {
if(pos[1]) {
if(!this.is_ie) {
this.replaceChar(this.oc, i-pos[0], pos[1]);
} else {
return this.ie_replaceChar(w, pos[0], pos[1]);
}
} else {
var c = this.retUni(w, k, pos);
if (!this.is_ie) {
this.replaceChar(this.oc, i-pos, c);
} else {
return this.ie_replaceChar(w, pos, c);
}
}
}
return false;
}
this.retUni = function(w, k, pos) {
var u = this.retKC(this.up(k)), uC, lC, c = w.charCodeAt(w.length - pos), a, t = this.fcc(c);
for(a = 0; a < this.skey.length; a++) {
if(this.skey[a] == c) {
if(a < 12) {
lC=a;
uC=a+12;
} else {
lC = a - 12;
uC=a;
}
if(t != this.up(t)) {
return u[lC];
}
return u[uC];
}
}
}
this.ifInit = function(w) {
var sel = w.getSelection();
this.range = sel ? sel.getRangeAt(0) : document.createRange();
}
this.ifMoz = function(e) {
var code = e.which, avim = this.AVIM, cwi = e.target.parentNode.wi;
if(typeof(cwi) == "undefined") cwi = e.target.parentNode.parentNode.wi;
if(e.ctrlKey || (e.altKey && (code != 92) && (code != 126))) return;
avim.ifInit(cwi);
var node = avim.range.endContainer, newPos;
avim.sk = avim.fcc(code);
avim.saveStr = "";
if(avim.checkCode(code) || !avim.range.startOffset || (typeof(node.data) == 'undefined')) return;
node.sel = false;
if(node.data) {
avim.saveStr = node.data.substr(avim.range.endOffset);
if(avim.range.startOffset != avim.range.endOffset) {
node.sel=true;
}
node.deleteData(avim.range.startOffset, node.data.length);
}
avim.range.setEnd(node, avim.range.endOffset);
avim.range.setStart(node, 0);
if(!node.data) {
return;
}
node.value = node.data;
node.pos = node.data.length;
node.which=code;
avim.start(node, e);
node.insertData(node.data.length, avim.saveStr);
newPos = node.data.length - avim.saveStr.length + avim.kl;
avim.range.setEnd(node, newPos);
avim.range.setStart(node, newPos);
avim.kl = 0;
if(avim.specialChange) {
avim.specialChange = false;
avim.changed = false;
node.deleteData(node.pos - 1, 1);
}
if(avim.changed) {
avim.changed = false;
e.preventDefault();
}
}
this.FKeyPress = function() {
var obj = this.findF();
this.sk = this.fcc(obj.event.keyCode);
if(this.checkCode(obj.event.keyCode) || (obj.event.ctrlKey && (obj.event.keyCode != 92) && (obj.event.keyCode != 126))) {
return;
}
this.start(obj, this.sk);
}
this.checkCode = function(code) {
if(((AVIMGlobalConfig.onOff == 0) || ((code < 45) && (code != 42) && (code != 32) && (code != 39) && (code != 40) && (code != 43)) || (code == 145) || (code == 255))) {
return true;
}
}
this.notWord = function(w) {
var str = "\ \r\n#,\\;.:-_()<>+-*/=?!\"$%{}[]\'~|^\@\&\t" + this.fcc(160);
return (str.indexOf(w) >= 0);
}
this.nan = function(w) {
if (isNaN(w) || (w == 'e')) {
return true;
} else {
return false;
}
}
this.up = function(w) {
w = w.toUpperCase();
if(this.isKHTML) {
var str = "êôơâăưếốớấắứềồờầằừễỗỡẫẵữệộợậặự", rep="ÊÔƠÂĂƯẾỐỚẤẮỨỀỒỜẦẰỪỄỖỠẪẴỮỆỘỢẶỰ", z, io;
for(z = 0; z < w.length; z++) {
io = str.indexOf(w.substr(z, 1));
if(io >= 0) {
w = w.substr(0, z) + rep.substr(io, 1) + w.substr(z + 1);
}
}
}
return w;
}
this.findIgnore = function(el) {
var va = AVIMGlobalConfig.exclude, i;
for(i = 0; i < va.length; i++) {
if((el.id == va[i]) && (va[i].length > 0)) {
return true;
}
}
}
this.findF = function() {
var g;
for(g = 0; g < this.fID.length; g++) {
if(this.findIgnore(this.fID[g])) return;
this.frame = this.fID[g];
if(typeof(this.frame) != "undefined") {
try {
if (this.frame.contentWindow.document && this.frame.contentWindow.event) {
return this.frame.contentWindow;
}
} catch(e) {
if (this.frame.document && this.frame.event) {
return this.frame;
}
}
}
}
}
this.keyPressHandler = function(e) {
if(!this.support) {
return;
}
if(!this.is_ie) {
var el = e.target, code = e.which;
if(e.ctrlKey) {
return;
}
if(e.altKey && (code != 92) && (code != 126)) {
return;
}
} else {
var el = window.event.srcElement, code = window.event.keyCode;
if(window.event.ctrlKey && (code != 92) && (code != 126)) {
return;
}
}
if(((el.type != 'textarea') && (el.type != 'text')) || this.checkCode(code)) {
return;
}
this.sk = this.fcc(code);
if(this.findIgnore(el)) {
return;
}
if(!this.is_ie) {
this.start(el, e);
} else {
this.start(el, this.sk);
}
if(this.changed) {
this.changed = false;
return false;
}
return true;
}
this.attachEvt = function(obj, evt, handle, capture) {
if(this.is_ie) {
obj.attachEvent("on" + evt, handle);
} else {
obj.addEventListener(evt, handle, capture);
}
}
this.keyDownHandler = function(e) {
if(e == "iframe") {
this.frame = this.findF();
var key = this.frame.event.keyCode;
} else {
var key = (!this.is_ie) ? e.which : window.event.keyCode;
}
if (key == 123) {
document.getElementById('AVIMControl').style.display = (document.getElementById('AVIMControl').style.display == 'none') ? 'block' : 'none';
}
}
}
function AVIMInit(AVIM) {
var kkk = false;
if(AVIM.support && !AVIM.isKHTML) {
if(AVIM.is_opera) {
if(AVIM.operaVersion < 9) {
return;
}
}
for(AVIM.g = 0; AVIM.g < AVIM.fID.length; AVIM.g++) {
if(AVIM.findIgnore(AVIM.fID[AVIM.g])) {
continue;
}
if(AVIM.is_ie) {
var doc;
try {
AVIM.frame = AVIM.fID[AVIM.g];
if(typeof(AVIM.frame) != "undefined") {
if(AVIM.frame.contentWindow.document) {
doc = AVIM.frame.contentWindow.document;
} else if(AVIM.frame.document) {
doc = AVIM.frame.document;
}
}
} catch(e) {}
if(doc && ((AVIM.up(doc.designMode) == "ON") || doc.body.contentEditable)) {
for (var l = 0; l < AVIM.attached.length; l++) {
if (doc == AVIM.attached[l]) {
kkk = true;
break;
}
}
if (!kkk) {
AVIM.attached[AVIM.attached.length] = doc;
AVIM.attachEvt(doc, "keydown", function() {
AVIM.keyDownHandler("iframe");
}, false);
AVIM.attachEvt(doc, "keypress", function() {
AVIM.FKeyPress();
if(AVIM.changed) {
AVIM.changed = false;
return false;
}
}, false);
}
}
} else {
var iframedit;
try {
AVIM.wi = AVIM.fID[AVIM.g].contentWindow;
iframedit = AVIM.wi.document;
iframedit.wi = AVIM.wi;
if(iframedit && (AVIM.up(iframedit.designMode) == "ON")) {
iframedit.AVIM = AVIM;
AVIM.attachEvt(iframedit, "keypress", AVIM.ifMoz, false);
AVIM.attachEvt(iframedit, "keydown", AVIM.keyDownHandler, false);
}
} catch(e) {}
}
}
}
}
AVIMObj = new AVIM();
function AVIMAJAXFix() {
var a = 50;
while(a < 5000) {
setTimeout("AVIMInit(AVIMObj)", a);
a += 50;
}
}
AVIMAJAXFix();
AVIMObj.attachEvt(document, "mousedown", AVIMAJAXFix, false);
AVIMObj.attachEvt(document, "keydown", AVIMObj.keyDownHandler, true);
AVIMObj.attachEvt(document, "keypress", function(e) {
var a = AVIMObj.keyPressHandler(e);
if (a == false) {
if (AVIMObj.is_ie) window.event.returnValue = false;
else e.preventDefault();
}
}, true);
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/Javascript/Guest/avim.js | JavaScript | asf20 | 40,284 |
/*
* jFlip plugin for jQuery v0.4 (28/2/2009)
*
* A plugin to make a page flipping gallery
*
* Copyright (c) 2008-2009 Renato Formato (rformato@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
*/
;(function($){
var Flip = function(canvas,width,height,images,opts) {
//private vars
opts = $.extend({background:"green",cornersTop:true,scale:"noresize"},opts);
var obj = this,
el = canvas.prev(),
index = 0,
init = false,
background = opts.background,
cornersTop = opts.cornersTop,
gradientColors = opts.gradientColors || ['#4F2727','#FF8F8F','#F00'],
curlSize = opts.curlSize || 0.1,
scale = opts.scale,
patterns = [],
canvas2 = canvas.clone(),
ctx2 = $.browser.msie?null:canvas2[0].getContext("2d"),
canvas = $.browser.msie?$(G_vmlCanvasManager.initElement(canvas[0])):canvas,
ctx = canvas[0].getContext("2d"),
loaded = 0;
var images = images.each(function(i){
if(patterns[i]) return;
var img = this;
img.onload = function() {
var r = 1;
if(scale!="noresize") {
var rx = width/this.width,
ry = height/this.height;
if(scale=="fit")
r = (rx<1 || ry<1)?Math.min(rx,ry):1;
if(scale=="fill") {
r = Math.min(rx,ry);
}
};
$(img).data("flip.scale",r);
patterns[i] = ctx.createPattern(img,"no-repeat");
loaded++;
if(loaded==images.length && !init) {
init = true;
draw();
}
};
if(img.complete)
window.setTimeout(function(){img.onload()},10);
}).get();
var
width = width,height = height,mX = width,mY = height,
basemX = mX*(1-curlSize), basemY = mY*curlSize,sideLeft = false,
off = $.browser.msie?canvas.offset():null,
onCorner = false,
curlDuration=400,curling = false,
animationTimer,startDate,
flipDuration=700,flipping = false,baseFlipX,baseFlipY,
lastmX,lastmY,
inCanvas = false,
mousedown = false,
dragging = false;
$(window).scroll(function(){
//off = canvas.offset(); //update offset on scroll
});
//IE can't handle correctly mouseenter and mouseleave on VML
var c = $.browser.msie?(function(){
var div = $("<div>").width(width).height(height).css({position:"absolute",cursor:"default",zIndex:1}).appendTo("body");
//second hack for IE7 that can't handle correctly mouseenter and mouseleave if the div has no background color
if(parseInt($.browser.version)==7)
div.css({opacity:0.000001,background:"#FFF"});
var positionDiv = function() {
off = canvas.offset();
return div.css({left:off.left+'px',top:off.top+'px'});
}
$(window).resize(positionDiv);
return positionDiv();
})():canvas;
c.mousemove(function(e){
//track the mouse
/*
if(!off) off = canvas.offset(); //safari can't calculate correctly offset at DOM ready
mX = e.clientX-off.left;
mY = e.clientY-off.top;
window.setTimeout(draw,0);
return;
*/
if(!off)
off = canvas.offset(); //safari can't calculate correctly offset at DOM ready
if(mousedown && onCorner) {
if(!dragging) {
dragging = true;
window.clearInterval(animationTimer);
}
mX = !sideLeft?e.pageX-off.left:width-(e.pageX-off.left);
mY = cornersTop?e.pageY-off.top:height-(e.pageY-off.top);
window.setTimeout(draw,0);
return false;
}
lastmX = e.pageX||lastmX, lastmY = e.pageY||lastmY;
if(!flipping) {
sideLeft = (lastmX-off.left)<width/2;
//cornersTop = (lastmY-off.top)<height/2;
}
if(!flipping &&
((lastmX-off.left)>basemX || (lastmX-off.left)<(width-basemX)) &&
((cornersTop && (lastmY-off.top)<basemY) || (!cornersTop && (lastmY-off.top)>(height-basemY)))) {
if(!onCorner) {
onCorner= true;
c.css("cursor","pointer");
}
} else {
if(onCorner) {
onCorner= false;
c.css("cursor","default");
}
};
return false;
}).bind("mouseenter",function(e){
inCanvas = true;
if(flipping) return;
window.clearInterval(animationTimer);
startDate = new Date().getTime();
animationTimer = window.setInterval(cornerCurlIn,10);
return false;
}).bind("mouseleave",function(e){
inCanvas = false;
dragging = false;
mousedown = false;
if(flipping) return;
window.clearInterval(animationTimer);
startDate = new Date().getTime();
animationTimer = window.setInterval(cornerCurlOut,10);
return false;
}).click(function(){
if(onCorner && !flipping) {
flipping = true;
c.triggerHandler("mousemove");
window.clearInterval(animationTimer);
startDate = new Date().getTime();
baseFlipX = mX;
baseFlipY = mY;
animationTimer = window.setInterval(flip,10);
index += sideLeft?-1:1;
if(index<0) index = images.length-1;
if(index==images.length) index = 0;
el.trigger("flip.jflip",[index,images.length]);
}
return false;
}).mousedown(function(){
dragging = false;
mousedown = true;
return false;
}).mouseup(function(){
mousedown = false;
return false;
});
var flip = function() {
var date = new Date(),delta = date.getTime()-startDate;
if(delta>=flipDuration) {
window.clearInterval(animationTimer);
if(sideLeft) {
images.unshift(images.pop());
patterns.unshift(patterns.pop());
} else {
images.push(images.shift());
patterns.push(patterns.shift());
}
mX = width;
mY = height;
draw();
flipping = false;
//init corner move if still in Canvas
if(inCanvas) {
startDate = new Date().getTime();
animationTimer = window.setInterval(cornerCurlIn,10);
c.triggerHandler("mousemove");
}
return;
}
//da mX a -width (mX+width) in duration millisecondi
mX = baseFlipX-2*(width)*delta/flipDuration;
mY = baseFlipY+2*(height)*delta/flipDuration;
draw();
},
cornerMove = function() {
var date = new Date(),delta = date.getTime()-startDate;
mX = basemX+Math.sin(Math.PI*2*delta/1000);
mY = basemY+Math.cos(Math.PI*2*delta/1000);
drawing = true;
window.setTimeout(draw,0);
},
cornerCurlIn = function() {
var date = new Date(),delta = date.getTime()-startDate;
if(delta>=curlDuration) {
window.clearInterval(animationTimer);
startDate = new Date().getTime();
animationTimer = window.setInterval(cornerMove,10);
}
mX = width-(width-basemX)*delta/curlDuration;
mY = basemY*delta/curlDuration;
draw();
},
cornerCurlOut = function() {
var date = new Date(),delta = date.getTime()-startDate;
if(delta>=curlDuration) {
window.clearInterval(animationTimer);
}
mX = basemX+(width-basemX)*delta/curlDuration;
mY = basemY-basemY*delta/curlDuration;
draw();
},
curlShape = function(m,q) {
//cannot draw outside the viewport because of IE blurring the pattern
var intyW = m*width+q,intx0 = -q/m;
if($.browser.msie) {
intyW = Math.round(intyW);
intx0 = Math.round(intx0);
};
ctx.beginPath();
ctx.moveTo(width,Math.min(intyW,height));
ctx.lineTo(width,0);
ctx.lineTo(Math.max(intx0,0),0);
if(intx0<0) {
ctx.lineTo(0,Math.min(q,height));
if(q<height) {
ctx.lineTo((height-q)/m,height);
}
ctx.lineTo(width,height);
} else {
if(intyW<height)
ctx.lineTo(width,intyW);
else {
ctx.lineTo((height-q)/m,height);
ctx.lineTo(width,height);
}
}
},
draw = function() {
if(!init) return;
if($.browser.msie)
ctx.clearRect(0,0,width,height);
ctx.fillStyle = background;
ctx.fillRect(0,0,width,height);
var img = images[0], r = $(img).data("flip.scale");
if($.browser.msie) {
ctx.fillStyle = patterns[0];
ctx.fillStyle.width2 = ctx.fillStyle.width*r;
ctx.fillStyle.height2 = ctx.fillStyle.height*r;
ctx.fillRect(0,0,width,height);
} else {
ctx.drawImage(img,(width-img.width*r)/2,(height-img.height*r)/2,img.width*r,img.height*r);
}
if(mY && mX!=width) {
var m = 2,
q = (mY-m*(mX+width))/2;
m2 = mY/(width-mX),
q2 = mX*m2;
if(m==m2) return;
var sx=1,sy=1,tx=0,ty=0;
ctx.save();
if(sideLeft) {
tx = width;
sx = -1;
}
if(!cornersTop) {
ty = height;
sy = -1;
}
ctx.translate(tx,ty);
ctx.scale(sx,sy);
//draw page flip
//intx,inty is the intersection between the line of the curl and the line
//from the canvas corner to the curl point
var intx = (q2-q)/(m-m2);
var inty = m*intx+q;
//y=m*x+mY-m*mX line per (mX,mY) parallel to the curl line
//y=-x/m+inty+intx/m line perpendicular to the curl line
//intersection x between the 2 lines = int2x
//y of perpendicular for the intersection x = int2y
//opera do not fill a shape if gradient is finished
var int2x = (2*inty+intx+2*m*mX-2*mY)/(2*m+1);
var int2y = -int2x/m+inty+intx/m;
var d = Math.sqrt(Math.pow(intx-int2x,2)+Math.pow(inty-int2y,2));
var stopHighlight = Math.min(d*0.5,30);
var c;
if(!($.browser.mozilla && parseFloat($.browser.version)<1.9)) {
c = ctx;
} else {
c = ctx2;
c.clearRect(0,0,width,height);
c.save();
c.translate(1,0); //the curl shapes do not overlap perfeclty
}
var gradient = c.createLinearGradient(intx,inty,int2x,int2y);
gradient.addColorStop(0, gradientColors[0]);
gradient.addColorStop(stopHighlight/d, gradientColors[1]);
gradient.addColorStop(1, gradientColors[2]);
c.fillStyle = gradient;
c.beginPath();
c.moveTo(-q/m,0);
c.quadraticCurveTo((-q/m+mX)/2+0.02*mX,mY/2,mX,mY);
c.quadraticCurveTo((width+mX)/2,(m*width+q+mY)/2-0.02*(height-mY),width,m*width+q);
if(!($.browser.mozilla && parseFloat($.browser.version)<1.9)) {
c.fill();
} else {
//for ff 2.0 use a clip region on a second canvas and copy all its content (much faster)
c.save();
c.clip();
c.fillRect(0,0,width,height);
c.restore();
ctx.drawImage(canvas2[0],0,0);
c.restore();
}
//can't understand why this doesn't work on ff 2, fill is slow
/*
ctx.save();
ctx.clip();
ctx.fillRect(0,0,width,height);
ctx.restore();
*/
gradient = null;
//draw solid color background
ctx.fillStyle = background;
curlShape(m,q);
ctx.fill();
//draw back image
curlShape(m,q);
//safari and opera delete the path when doing restore
if(!$.browser.safari && !$.browser.opera)
ctx.restore();
var img = sideLeft?images[images.length-1]:images[1];
r = $(img).data("flip.scale");
if($.browser.msie) {
//excanvas does not support clip
ctx.fillStyle = sideLeft?patterns[patterns.length-1]:patterns[1];
//hack to scale the pattern on IE (modified excanvas)
ctx.fillStyle.width2 = ctx.fillStyle.width*r;
ctx.fillStyle.height2 = ctx.fillStyle.height*r;
ctx.fill();
} else {
ctx.save();
ctx.clip();
//safari and opera delete the path when doing restore
//at this point we have not reverted the trasform
if($.browser.safari || $.browser.opera) {
//revert transform
ctx.scale(1/sx,1/sy);
ctx.translate(-tx,-ty);
}
ctx.drawImage(img,(width-img.width*r)/2,(height-img.height*r)/2,img.width*r,img.height*r);
//ctx.drawImage(img,(width-img.width)/2,(height-img.height)/2);
ctx.restore();
if($.browser.safari || $.browser.opera)
ctx.restore()
}
}
}
}
$.fn.jFlip = function(width,height,opts){
return this.each(function() {
$(this).wrap("<div class='flip_gallery'>");
var images = $(this).find("img");
//cannot hide because explorer does not give the image dimensions if hidden
var canvas = $(document.createElement("canvas")).attr({width:width,height:height}).css({margin:0,width:width+"px",height:height+"px"})
$(this).css({position:"absolute",left:"-9000px",top:"-9000px"}).after(canvas);
new Flip($(this).next(),width || 300,height || 300,images,opts);
});
};
})(jQuery);
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/Javascript/Admin/jquery.jflip-0.4.js | JavaScript | asf20 | 14,143 |
$(document).ready(function() {
//Sidebar Accordion Menu:
$("#main-nav li ul").hide(); //Hide all sub menus
$("#main-nav li a.current").parent().find("ul").slideToggle("slow"); // Slide down the current menu item's sub menu
$("#main-nav li a.nav-top-item").click( // When a top menu item is clicked...
function() {
$(this).parent().siblings().find("ul").slideUp("normal"); // Slide up all sub menus except the one clicked
$(this).next().slideToggle("normal"); // Slide down the clicked sub menu
if ($(this).attr("href") == null || $(this).attr("href") == "" || $(this).attr("href") == "#") {
return false;
}
}
);
// Sidebar Accordion Menu Hover Effect:
$("#main-nav li .nav-top-item").hover(
function() {
$(this).stop();
$(this).animate({ paddingRight: "25px" }, 200);
},
function() {
$(this).stop();
$(this).animate({ paddingRight: "15px" });
}
);
//Minimize Content Box
$(".content-box-header h3").css({ "cursor": "s-resize" }); // Give the h3 in Content Box Header a different cursor
$(".content-box-header-toggled").next().hide(); // Hide the content of the header if it has the class "content-box-header-toggled"
$(".content-box-header h3").click( // When the h3 is clicked...
function() {
$(this).parent().parent().find(".content-box-content").toggle(); // Toggle the Content Box
$(this).parent().toggleClass("content-box-header-toggled"); // Give the Content Box Header a special class for styling and hiding
$(this).parent().find(".content-box-tabs").toggle(); // Toggle the tabs
}
);
// Content box tabs:
$('.content-box .content-box-content div.tab-content').hide(); // Hide the content divs
$('.content-box-content div.default-tab').show(); // Show the div with class "default-tab"
$('ul.content-box-tabs li a.default-tab').addClass('current'); // Set the class of the default tab link to "current"
$('.content-box ul.content-box-tabs li a').click( //When a tab is clicked...
function() {
$(this).parent().siblings().find("a").removeClass('current'); // Remove "current" class from all tabs
$(this).addClass('current'); // Add class "current" to clicked tab
var currentTab = $(this).attr('href'); // Set variable "currentTab" to the value of href of clicked tab
$(currentTab).siblings().hide(); // Hide all content divs
$(currentTab).show(); // Show the content div with the id equal to the id of clicked tab
return false;
}
);
// Check all checkboxes when the one in a table head is checked:
$('.check-all').click(
function() {
$(this).parent().parent().parent().parent().find("input[type='checkbox']").attr('checked', $(this).is(':checked'));
}
)
});
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Resources/Javascript/Admin/simpla.jquery.configuration.js | JavaScript | asf20 | 2,909 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebsiteLab2.MasterPages
{
public partial class WebForm2 : System.Web.UI.Page
{
private List<string> categories;
private List<OurServices.Product> products;
private string categoriesID;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadCategories();
// Get init state categories;
categoriesID = this.DropDownList1.Items[DropDownList1.SelectedIndex].Value;
LoadProducts(categoriesID);
}
}
protected void LoadCategories(){
categories = WebsiteLab2.BUS.ProductBUS.getAllTypesByServices();
this.DropDownList1.DataSource = categories;
this.DropDownList1.DataBind();
this.DropDownList1.SelectedIndex = 0;
}
protected void LoadProducts(string categoriesID){
products = WebsiteLab2.BUS.ProductBUS.getAllProductsByTypesServices(categoriesID);
this.GridView1.DataSource = products;
this.GridView1.DataBind();
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
categoriesID = this.DropDownList1.Items[DropDownList1.SelectedIndex].Value;
LoadProducts(categoriesID);
}
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Page2.aspx.cs | C# | asf20 | 1,553 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebsiteLab2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebsiteLab2")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Properties/AssemblyInfo.cs | C# | asf20 | 1,393 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebsiteLab2.MasterPages
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Default.aspx.cs | C# | asf20 | 357 |
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Admin.Master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebsiteLab2.MasterPages.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="javascript_extenation" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="content_header" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="server">
<p>
<b>Webservice: Service1.</b>
<ol style="list-style-type: decimal;">
<li><b>public string HelloWorld()</b>
<br />
Tham số:
<ul style="margin-left: 25px; list-style-type: circle;">
<li>void</li>
</ul>
Return: String "Hello world".
</li>
<br />
<br />
<li><b>public Product[] getAllProduct()</b>
<br />
Tham số:
<ul style="margin-left: 25px; list-style-type: circle;">
<li>void</li>
</ul>
Return: mảng một chiều các Product.
</li>
<br />
<br />
<li><b>public Product[] getAllByType(String type)</b>
<br />
Tham số:
<ul style="margin-left: 25px; list-style-type: circle;">
<li>String type: tên của loại sản phẩm.</li>
</ul>
Return: mảng một chiều các Product.
</li>
<li><b>public String[] getTypes()</b>
<br />
Tham số:
<ul style="margin-left: 25px; list-style-type: circle;">
<li>void</li>
</ul>
Return: mảng một chiều tên loại sản phẩm.
</li>
<li><b>public int sum(int fnums, int snums)</b>
<br />
Tham số:
<ul style="margin-left: 25px; list-style-type: circle;">
<li>int fnums</li>
<li>int snums</li>
</ul>
Return: Tổng của fnums+snums.
</li>
<li><b>public string sumAndSub(int fnums, int snums, int tnums)</b>
<br />
Tham số:
<ul style="margin-left: 25px; list-style-type: circle;">
<li>int fnums</li>
<li>int snums</li>
<li>int tnums</li>
</ul>
Return: Kết quả của phép toán (fnums+snums-tnums).
</li>
</ol>
</p>
</asp:Content>
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Default.aspx | ASP.NET | asf20 | 2,900 |
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Admin.Master" AutoEventWireup="true" CodeBehind="Page2.aspx.cs" Inherits="WebsiteLab2.MasterPages.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="javascript_extenation" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="content_header" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Categories : "></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="Name" HeaderText="Product Name" />
<asp:BoundField DataField="Price" HeaderText="Price " />
<asp:TemplateField HeaderText="Image URL">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Img") %>' CssClass="img_product" Height="100px" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/Page2.aspx | ASP.NET | asf20 | 2,460 |
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Menu.ascx.cs" Inherits="WebChamCong.Menu" %>
<ul id="main-nav">
<li>
<a href="/Default.aspx" class="nav-top-item">
Page 1
</a>
</li>
<li>
<a href="/Page2.aspx" class="nav-top-item">
Page 2
</a>
</li>
<li>
<a href="/Page3.aspx" class="nav-top-item">
Page 3
</a>
</li>
</ul> | 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/UserControls/Menu.ascx | ASP.NET | asf20 | 430 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebChamCong
{
public partial class Menu : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
} | 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebsiteLab2/UserControls/Menu.ascx.cs | C# | asf20 | 336 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebserviceLab2.Utilies
{
public class Helpers
{
public static string GetURLContext(HttpContext context){
return context.Request.Url.Scheme + "://" + context.Request.Url.Authority;
}
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebserviceLab2/Utilies/Helpers.cs | C# | asf20 | 339 |
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Collections.Generic;
namespace WebserviceLab2
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public List<Product> getAllProduct()
{
return Product.getAll();
}
[WebMethod]
public Product[] getAllByType(String type)
{
string url = Utilies.Helpers.GetURLContext(this.Context);
return Product.getAllByType(type, url);
}
[WebMethod]
public String[] getProductTypes()
{
return Product.getType();
}
[WebMethod]
public int sum(int fnums, int snums){
return fnums + snums;
}
[WebMethod]
public string sumAndSub(int fnums, int snums, int tnums){
return (fnums + snums - tnums).ToString();
}
}
}
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebserviceLab2/Service.asmx.cs | C# | asf20 | 1,624 |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
namespace WebserviceLab2
{
public class Product
{
#region "Attributes & Properties"
private String type;
private String name;
private int price;
private String img;
private string url;
public string Url
{
get { return url; }
set { url = value; }
}
public string Type
{
get { return type; }
set { type = value; }
}
public string Name
{
get { return name; }
set { name = value; }
}
public int Price
{
get { return price; }
set { price = value; }
}
public string Img
{
get { return img; }
set { img = value; }
}
#endregion
#region "Constructors"
public Product()
{
this.type = "";
this.name = "";
this.price = 0;
this.img = "";
}
public Product(string type, string name, int price, string img)
{
this.type = type;
this.name = name;
this.price = price;
this.img = img;
}
public Product(Product p)
{
this.type = p.Type;
this.name = p.Name;
this.price = p.Price;
this.img = p.Img;
}
#endregion
#region "Methods"
/// <summary>
/// Load data from XML file
/// </summary>
/// <returns></returns>
public static XmlDocument loadXML()
{
XmlDocument doc = new XmlDocument();
doc.Load(HttpContext.Current.Server.MapPath("~/App_Data/Product.xml"));
return doc;
}
/// <summary>
/// Get all product
/// </summary>
/// <returns></returns>
public static List<Product> getAll()
{
//XDocument xdoc = XDocument.Load("~\\App_Data\\Product.xml");
XmlDocument doc = loadXML();
XmlNode root = doc.DocumentElement;
List<Product> li = new List<Product>();
if (root != null)
{
int len = root.ChildNodes.Count;
for (int i = 0; i < len; i++)
{
if (root.ChildNodes[i].Attributes == null)
continue;
Product temp = new Product();
temp.Type = root.ChildNodes[i].Attributes[0].Value;
temp.Name = root.ChildNodes[i].Attributes[1].Value;
temp.Price = Int32.Parse(root.ChildNodes[i].Attributes[2].Value);
temp.Img = root.ChildNodes[i].Attributes[3].Value;
li.Add(temp);
}
}
return li;
}
/// <summary>
/// Get all product of a type.
/// </summary>
/// <param name="type">Type name</param>
/// <returns></returns>
public static Product[] getAllByType(string type, string url)
{
//XDocument xdoc = XDocument.Load("~\\App_Data\\Product.xml");
XmlDocument doc = loadXML();
XmlNode root = doc.DocumentElement;
List<Product> li = new List<Product>();
if (root != null)
{
int len = root.ChildNodes.Count;
for (int i = 0; i < len; i++)
{
if (root.ChildNodes[i].Attributes == null)
continue;
if (root.ChildNodes[i].Attributes[0].Value != type)
continue;
Product temp = new Product();
temp.Type = root.ChildNodes[i].Attributes[0].Value;
temp.Name = root.ChildNodes[i].Attributes[1].Value;
temp.Price = Int32.Parse(root.ChildNodes[i].Attributes[2].Value);
temp.Img = url + "/"+root.ChildNodes[i].Attributes[3].Value;
li.Add(temp);
}
}
return li.ToArray();
}
public static String[] getType()
{
XmlDocument doc = loadXML();
XmlNode root = doc.DocumentElement;
List<String> li = new List<String>();
if (root != null)
{
int len = root.ChildNodes.Count;
for (int i = 0; i < len; i++)
{
if (root.ChildNodes[i].Attributes == null)
continue;
if (li.Contains(root.ChildNodes[i].Attributes[0].Value))
continue;
li.Add(root.ChildNodes[i].Attributes[0].Value);
}
}
return li.ToArray();
}
#endregion
}
} | 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebserviceLab2/Product.cs | C# | asf20 | 5,392 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebserviceLab2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebserviceLab2")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebserviceLab2/Properties/AssemblyInfo.cs | C# | asf20 | 1,399 |
<%@ WebService Language="C#" CodeBehind="Service.asmx.cs" Class="WebserviceLab2.Service1" %> | 1041448-ec-daily-practices | trunk/EC2011-hk1-BT2-1041373-1041448/WebserviceLab2/Service.asmx | ASP.NET | asf20 | 95 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace EC2011_hk2_BT1_1041448.MasterPages
{
public partial class Admin : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/MasterPages/Admin.Master.cs | C# | asf20 | 361 |
/* CSS */
.DynarchCalendar {
border: 1px solid #aaa;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
background: #e8e8e8;
font: 11px "lucida grande",tahoma,verdana,sans-serif;
line-height: 14px;
position: relative;
cursor: default;
}
.DynarchCalendar table {
border-collapse: collapse;
font: 11px "lucida grande",tahoma,verdana,sans-serif;
line-height: 14px;
}
.DynarchCalendar-topBar {
border-bottom: 1px solid #aaa;
background: #ddd;
padding: 5px 0 0 0;
}
table.DynarchCalendar-titleCont {
font-size: 130%; font-weight: bold;
color: #444;
text-align: center;
z-index: 9;
position: relative;
margin-top: -6px;
}
.DynarchCalendar-title div {
padding: 5px 17px;
text-shadow: 1px 1px 1px #777;
}
.DynarchCalendar-hover-title div {
background-color: #fff;
border: 1px solid #000;
padding: 4px 16px;
background-image: url("img/drop-down.gif");
background-repeat: no-repeat;
background-position: 100% 50%;
}
.DynarchCalendar-pressed-title div {
border: 1px solid #000;
padding: 4px 16px;
background-color: #777;
color: #fff;
background-image: url("img/drop-up.gif");
background-repeat: no-repeat;
background-position: 100% 50%;
}
.DynarchCalendar-bottomBar {
border-top: 1px solid #aaa;
background: #ddd;
padding: 2px;
position: relative;
text-align: center;
}
.DynarchCalendar-bottomBar-today {
padding: 2px 15px;
}
.DynarchCalendar-hover-bottomBar-today {
border: 1px solid #000;
background-color: #fff;
padding: 1px 14px;
}
.DynarchCalendar-pressed-bottomBar-today {
border: 1px solid #000;
background-color: #777;
color: #fff;
padding: 1px 14px;
}
.DynarchCalendar-body {
position: relative;
overflow: hidden;
padding-top: 5px;
padding-bottom: 5px;
}
.DynarchCalendar-first-col { padding-left: 5px; }
.DynarchCalendar-last-col { padding-right: 5px; }
.DynarchCalendar-animBody-backYear {
position: absolute;
top: -100%;
left: 0;
}
.DynarchCalendar-animBody-back {
position: absolute;
top: 5px;
left: -100%;
}
.DynarchCalendar-animBody-fwd {
position: absolute;
top: 5px;
left: 100%;
}
.DynarchCalendar-animBody-now {
position: absolute;
top: 5px;
left: 0;
}
.DynarchCalendar-animBody-fwdYear {
position: absolute;
top: 100%;
left: 0;
}
.DynarchCalendar-dayNames {
padding-left: 5px;
padding-right: 5px;
}
.DynarchCalendar-dayNames div { font-weight: bold; color: #444; text-shadow: 1px 1px 1px #777; }
.DynarchCalendar-navBtn {
position: absolute;
top: 5px;
z-index: 10;
}
.DynarchCalendar-navBtn div {
background-repeat: no-repeat;
background-position: 50% 50%;
height: 15px;
width: 16px;
padding: 1px;
}
.DynarchCalendar-hover-navBtn div {
border: 1px solid #000;
padding: 0;
background-color: #fff;
}
.DynarchCalendar-navDisabled {
opacity: 0.3;
filter: alpha(opacity=30);
}
.DynarchCalendar-pressed-navBtn div {
border: 1px solid #000;
padding: 0;
background-color: #777;
color: #fff;
}
.DynarchCalendar-prevMonth {
left: 25px;
}
.DynarchCalendar-nextMonth {
left: 100%;
margin-left: -43px;
}
.DynarchCalendar-prevYear {
left: 5px;
}
.DynarchCalendar-nextYear {
left: 100%;
margin-left: -23px;
}
.DynarchCalendar-prevMonth div {
background-image: url("img/nav-left.gif");
}
.DynarchCalendar-nextMonth div {
background-image: url("img/nav-right.gif");
}
.DynarchCalendar-prevYear div {
background-image: url("img/nav-left-x2.gif");
}
.DynarchCalendar-nextYear div {
background-image: url("img/nav-right-x2.gif");
}
.DynarchCalendar-menu {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #ddd;
overflow: hidden;
opacity: 0.85;
filter: alpha(opacity=85);
}
.DynarchCalendar-menu table td div {
text-align: center;
font-weight: bold;
padding: 3px 5px;
}
.DynarchCalendar-menu table td div.DynarchCalendar-menu-month {
width: 4em;
text-align: center;
}
.DynarchCalendar-menu table td div.DynarchCalendar-hover-navBtn {
border: 1px solid #000;
padding: 2px 4px;
background-color: #fff;
color: #000;
}
.DynarchCalendar-menu table td div.DynarchCalendar-pressed-navBtn {
border: 1px solid #000;
padding: 2px 4px;
background-color: #777;
color: #fff !important;
}
.DynarchCalendar-menu-year {
text-align: center;
font: 16px "lucida grande",tahoma,verdana,sans-serif;
font-weight: bold;
}
.DynarchCalendar-menu-sep {
height: 1px; font-size: 1px; line-height: 1px;
overflow: hidden;
border-top: 1px solid #888;
background: #fff;
margin-top: 4px; margin-bottom: 3px;
}
.DynarchCalendar-time td { font-weight: bold; font-size: 120%; }
.DynarchCalendar-time-hour, .DynarchCalendar-time-minute { padding: 1px 3px; }
.DynarchCalendar-time-down { background: url("img/time-down.png") no-repeat 50% 50%; width: 11px; height: 8px; opacity: 0.5; }
.DynarchCalendar-time-up { background: url("img/time-up.png") no-repeat 50% 50%; width: 11px; height: 8px; opacity: 0.5; }
.DynarchCalendar-time-sep { padding: 0 2px; }
.DynarchCalendar-hover-time { background-color: #444; color: #fff; opacity: 1; }
.DynarchCalendar-pressed-time { background-color: #000; color: #fff; opacity: 1; }
.DynarchCalendar-time-am { padding: 1px; width: 2.5em; text-align: center; }
/* body */
.DynarchCalendar-hover-week { background-color: #ddd; }
.DynarchCalendar-dayNames div, .DynarchCalendar-day, .DynarchCalendar-weekNumber {
width: 1.7em;
padding: 3px 4px;
text-align: center;
}
.DynarchCalendar-weekNumber {
border-right: 1px solid #aaa;
margin-right: 4px;
width: 2em !important;
padding-right: 8px !important;
}
.DynarchCalendar-day {
text-align: right; color: #222;
}
.DynarchCalendar-day-othermonth { color: #888; }
.DynarchCalendar-weekend { color: #c22; }
.DynarchCalendar-day-today { color: #00f; font-weight: bold; }
.DynarchCalendar-day-disabled {
opacity: 0.5;
text-shadow: 2px 1px 1px #fff;
}
.DynarchCalendar-hover-date {
padding: 2px 3px;
background-color: #eef;
border: 1px solid #88c;
margin: 0 !important;
color: #000;
}
.DynarchCalendar-day-othermonth.DynarchCalendar-hover-date { border-color: #aaa; color: #888; }
.DynarchCalendar-dayNames .DynarchCalendar-weekend { color: #c22; }
.DynarchCalendar-day-othermonth.DynarchCalendar-weekend { color: #d88; }
.DynarchCalendar-day-selected {
padding: 2px 3px;
margin: 1px;
background-color: #aaa;
color: #000 !important;
}
.DynarchCalendar-day-today.DynarchCalendar-day-selected { background-color: #999; }
/* focus */
.DynarchCalendar-focusLink {
position: absolute;
opacity: 0;
filter: alpha(opacity=0);
}
.DynarchCalendar-focused {
border-color: #000;
}
.DynarchCalendar-focused .DynarchCalendar-topBar, .DynarchCalendar-focused .DynarchCalendar-bottomBar {
background-color: #ccc;
border-color: #336;
}
.DynarchCalendar-focused .DynarchCalendar-hover-week {
background-color: #ccc;
}
.DynarchCalendar-tooltip {
position: absolute;
top: 100%;
width: 100%;
}
.DynarchCalendar-tooltipCont {
margin: 0 5px 0 5px;
border: 1px solid #aaa;
border-top: 0;
padding: 3px 6px;
background: #ddd;
}
.DynarchCalendar-focused .DynarchCalendar-tooltipCont {
background: #ccc;
border-color: #000;
}
@media print {
.DynarchCalendar-day-selected {
padding: 2px 3px;
border: 1px solid #000;
margin: 0 !important;
}
}
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/StyleSheet/Calendar/jscal2.css | CSS | asf20 | 7,385 |
body {
background-color: #FFF;
background-image: url(../../../Resource/Image/Guest/bg.jpg);
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
font-family: Tahoma, Geneva, sans-serif;
font-size: 12px;
color: #575757;
}
a{
outline:0;
text-decoration:none;
color: #575757;
}
a:hover{
color: #ff3300;
}
#img_lang_viet {
background-image: url(../../../Resource/Image/Guest/language.png);
background-repeat: no-repeat;
background-position: left top;
height: 12px;
width: 16px;
display: inline;
margin-left: 900px;
float: left;
margin-right: 7px;
margin-top: 4px;
cursor:pointer;
}
#img_lang_eng {
background-image: url(../../../Resource/Image/Guest/language.png);
background-repeat: no-repeat;
background-position: right top;
height: 12px;
width: 16px;
display: inline;
float: left;
margin-top: 4px;
cursor:pointer;
}
#img_but_left {
background-image: url(../../../Resource/Image/Guest/button.png);
background-repeat: no-repeat;
background-position: left top;
height: 24px;
width: 22px;
margin: 18px 0px 0px 19px;
cursor:pointer;
}
#img_but_right {
background-image: url(../../../Resource/Image/Guest/button.png);
background-repeat: no-repeat;
background-position: -22px top;
height: 24px;
width: 22px;
margin: 18px 0px 0px 19px;
cursor:pointer;
}
#img_leftHead_bullet {
height: 13px;
width: 12px;
margin-top: 14px;
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: left top;
float: left;
margin-right: 5px;
}
#img_icon_Mphone {
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: -32px top;
height: 16px;
width: 20px;
float:left;
margin-right:3px;
}
#img_icon_phone {
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: -12px top;
height: 16px;
width: 20px;
float:left;
margin-right:3px;
}
#img_icon_user {
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: -52px top;
height: 16px;
width: 20px;
float:left;
margin-right:3px;
}
#img_icon_userOnline {
background-image: url(../../../Resource/Image/Guest/icon_left.png);
background-repeat: no-repeat;
background-position: -72px top;
height: 16px;
width: 20px;
float:left;
margin-right:3px;
}
#img_icon_star {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: left top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_rectangle {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -23px top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_panel {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -46px top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_led {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -69px top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_contact {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -92px top;
height: 26px;
width: 23px;
float:left;
margin-top: 8px;
margin-right: 5px;
}
#img_icon_news {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -117px -6px;
height: 20px;
width: 19px;
float:left;
margin-right: 5px;
}
#img_icon_project {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -137px -6px;
height: 20px;
width: 23px;
float:left;
margin-right: 5px;
}
#img_icon_go {
background-image: url(../../../Resource/Image/Guest/logoGO.png);
background-repeat: no-repeat;
position:absolute;
height: 30px;
width: 26px;
display: inline;
margin-top: -6px;
}
#img_logo {
background-image: url(../../../Resource/Image/Guest/logo.png);
background-repeat: no-repeat;
height: 56px;
width: 250px;
}
.content {
margin: auto;
width: 960px;
}
.page_top {
line-height: 20px;
height: 20px;
width: 960px;
}
.header {
margin: auto;
height: 330px;
width: 960px;
}
.header_top {
background-image: url(../../../Resource/Image/Guest/header_buttom.png);
background-repeat: no-repeat;
background-position: left top;
height: 100px;
width: 960px;
}
.top_menu {
height: 55px;
width: 630px;
padding-left: 330px;
padding-top: 15px;
}
.top_menu_item {
height: 40px;
width: 68px;
text-align: center;
font-weight: bold;
vertical-align: middle;
cursor:pointer;
padding: 0px 14px;
}
.top_menu_item:hover {
background:url(../../../Resource/Image/Guest/menu_over.png) no-repeat left top;
color:#FFF;
}
.top_menu_active {
background:url(../../../Resource/Image/Guest/menu_over.png) no-repeat left top;
color:#FFF;
}
.top_menu_sep {
background-image: url(../../../Resource/Image/Guest/separator.gif);
background-repeat: no-repeat;
background-position: center center;
float: left;
height: 40px;
width: 4px;
}
.main_menu {
height: 30px;
width: 630px;
padding-left: 330px;
font-weight: bold;
color: #FFF;
}
.main_menu ul {
margin: 0px;
padding: 0px;
}
.main_menu ul li {
display: inline-block;
zoom:1;
*display: inline;
line-height: 20px;
height: 20px;
width: 100px;
text-align: center;
cursor:pointer;
margin-top: 6px;
}
.main_menu ul li:hover {
background:url(../../../Resource/Image/Guest/menu_over.png) -96px center;
color:#ff3300;
}
.main_menu_active {
background:url(../../../Resource/Image/Guest/menu_over.png) -96px center;
color:#ff3300;
}
.header_middle {
height: 200px;
width: 960px;
}
.imgSlide_large {
position: absolute;
z-index: 1;
}
.imgSlide_small {
position: absolute;
z-index: 100;
height: 60px;
width: 960px;
margin-top: 130px;
background-image: url(../../../Resource/Image/Guest/img_slide_bg.png);
background-repeat: repeat;
}
.imgSlide_small_but {
float: left;
height: 60px;
width: 60px;
}
.imgSlide_small_content {
height: 60px;
width: 840px;
overflow: hidden;
float: left;
}
.imgSlide_small_item {
height: 60px;
width: 280px;
float: left;
}
.imgSlide_small_image {
text-align: center;
vertical-align: middle;
height: 60px;
width: 100px;
}
.imgSlide_small_image img {
border: 2px solid #FFF;
}
.imgSlide_small_text {
width: 170px;
text-align: left;
font-weight: bold;
color: #FFF;
text-shadow:#000 2px 2px 1px;
}
.imgSlide_small_text a{
text-decoration:none;
color: #FFF;
text-shadow:#000 2px 2px 1px;
}
.header_bottom {
background-image: url(../../../Resource/Image/Guest/header_buttom.png);
background-repeat: no-repeat;
background-position: left -100px;
height: 30px;
width: 960px;
}
.center {
width: 960px;
margin-top: 10px;
}
.left {
float: left;
width: 230px;
}
.search {
height: 30px;
width: 215px;
background-image: url(../../../Resource/Image/Guest/left.png);
background-repeat: no-repeat;
background-position: left top;
padding-top: 10px;
padding-left: 15px;
margin-bottom: 10px;
}
.search_text {
width: 172px;
background:transparent;
border:none;
float: left;
padding-top: 3px;
}
.search_but {
background-image: url(../../../Resource/Image/Guest/button.png);
background-repeat: no-repeat;
background-position: right center;
height: 20px;
width: 25px;
border:none;
margin-left: 6px;
background-color:transparent;
cursor:pointer;
float: left;
margin-left: 8px;
}
.left_container {
margin-bottom: 10px;
}
.left_container_top {
line-height: 40px;
background-image: url(../../../Resource/Image/Guest/left.png);
background-repeat: no-repeat;
background-position: -230px top;
height: 40px;
width: 215px;
padding-left: 15px;
font-weight: bold;
color: #ff3300;
}
.left_container_mid {
background-image: url(../../../Resource/Image/Guest/left.png);
background-repeat: repeat-y;
background-position: -460px top;
padding-left: 20px;
line-height: 20px;
padding-top: 1px;
}
.left_container_mid_khtt {
background-image: url(../../../Resource/Image/Guest/left.png);
background-repeat: repeat-y;
background-position: -460px top;
height:450px;
overflow:hidden;
text-align:center;
}
.left_product {
margin: 0px;
padding: 0px;
list-style-type: none;
}
.left_product_menu {
background-image: url(../../../Resource/Image/Guest/product_bullet.png);
background-repeat: no-repeat;
padding-left: 10px;
}
.left_product_menu:hover{
background-position: left -20px;
}
.left_subMenu {
position: absolute;
margin-left: 200px;
margin-top: -29px;
display: none;
z-index: 1000;
}
.subMenu_TL {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: no-repeat;
background-position: left top;
height: 9px;
width: 9px;
}
.subMenu_TR {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: no-repeat;
background-position: left -9px;
height: 9px;
width: 9px;
}
.subMenu_BL {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: no-repeat;
background-position: left -18px;
height: 9px;
width: 9px;
}
.subMenu_BR {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: no-repeat;
background-position: left -27px;
height: 9px;
width: 9px;
}
.subMenu_T {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: repeat-x;
background-position: left -36px;
height: 9px;
}
.subMenu_B {
background-image: url(../../../Resource/Image/Guest/subMenu1.png);
background-repeat: repeat-x;
background-position: left -45px;
height: 9px;
}
.subMenu_ML {
background-image: url(../../../Resource/Image/Guest/subMenu2.png);
background-repeat: repeat-y;
background-position: left top;
width: 9px;
}
.subMenu_MR {
background-image: url(../../../Resource/Image/Guest/subMenu2.png);
background-repeat: repeat-y;
background-position: -9px top;
width: 9px;
}
.subMenu_M {
background-color:#FFF;
padding: 0px 15px 0px 5px;
}
.left_product_subMenu {
margin: 0px;
padding: 0px;
list-style-type: none;
}
.left_product_subMenu li {
background-image: url(../../../Resource/Image/Guest/product_bullet.png);
background-repeat: no-repeat;
margin-left: 5px;
padding-left: 10px;
}
.left_container_bot {
background-image: url(../../../Resource/Image/Guest/left.png);
background-position: -690px bottom;
height: 15px;
width: 230px;
}
.user_online {
color:#ff3300;
font-weight:bold;
}.main {
width: 720px;
margin-left: 10px;
float: left;
}
.main_container_header {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: no-repeat;
background-position: left top;
height: 50px;
width: 700px;
font-size: 14px;
line-height: 50px;
font-weight: bold;
color: #ff3300;
padding-left: 20px;
}
.main_container_header a {
font-weight: bold;
color: #ff3300;
}
.main_container_center {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 690px;
padding-left: 15px;
line-height: 20px;
text-align: justify;
padding-right: 15px;
}
.main_container_center_welcome {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 700px;
padding-left: 15px;
line-height: 20px;
text-align: justify;
padding-right: 5px;
}
.main_container_center_welcome a{
text-decoration:underline;
color: #ff3300;
}.main_container_footer {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: no-repeat;
background-position: -1440px bottom;
height: 15px;
width: 720px;
margin-bottom: 10px;
}
.main_container_center_product {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 704px;
padding-left: 15px;
padding-right: 1px;
}
.main_container_center_product2 {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 705px;
padding-left: 15px;
padding-right: 0px;
}
.main_container_center_productPage {
background-image: url(../../../Resource/Image/Guest/right.png);
background-repeat: repeat-y;
background-position: -720px top;
width: 690px;
padding-left: 15px;
padding-right: 15px;
height: 130px;
}
.product_container {
float: left;
height: 148px;
width: 168px;
margin-right: 8px;
}
.product_container_productPage {
float: left;
height: 148px;
width: 168px;
margin-left: 22px;
}
.product_container2_productPage {
float: left;
height: 148px;
width: 134px;
margin-left: 22px;
}
.product_info {
text-align: justify;
float: left;
width: 500px;
}
.product_info2 {
text-align: justify;
float: left;
width: 534px;
}
.product_container_tittle {
text-align: center;
height: 20px;
width: 160px;
}
.product_container_tittle a {
font-weight: bold;
text-align: center;
line-height: 20px;
}
.product_container_content {
height: 128px;
width: 168px;
cursor:pointer;
}
.product_container_shadow {
height: 23px;
width: 80px;
padding: 105px 8px 0 80px;
position:absolute;
z-index:100;
background-image: url(../../../Resource/Image/Guest/product_shadow.png);
background-repeat: no-repeat;
background-position: left top;
color:#FFF;
font-size:10px;
text-align:center;
line-height: 12px;
}
.product_img {
position: absolute;
z-index: 0;
}
.product_container2 {
float: left;
height: 148px;
width: 134px;
margin-right: 7px;
}
.product_container_tittle2 {
text-align: center;
height: 20px;
width: 126px;
}
.product_container_tittle2 a {
font-weight: bold;
text-align: center;
line-height: 20px;
}
.product_container_content2 {
background-image: url(../../../Resource/Image/Guest/product_shadow.png);
background-repeat: no-repeat;
background-position: left -128px;
height: 128px;
width: 134px;
cursor:pointer;
}
.product_container_shadow2 {
height: 21px;
width: 64px;
padding:107px 8px 0 62px;
position:absolute;
/*z-index:100;*/
background-image: url(../../../Resource/Image/Guest/product_shadow.png);
background-repeat: no-repeat;
background-position: left -128px;
color:#FFF;
font-size:9px;
text-align:center;
}
.end_block {
clear: both;
}
.footer_V {
background-image: url(../../../Resource/Image/Guest/header_buttom.png);
background-repeat: no-repeat;
background-position: left -130px;
height: 270px;
width: 960px;
}
.footer_E {
background-image: url(../../../Resource/Image/Guest/header_buttom.png);
background-repeat: no-repeat;
background-position: left -400px;
height: 270px;
width: 960px;
}
.footer_menu {
padding-top: 225px;
padding-right: 15px;
padding-left: 15px;
}
.footer_menu a{
padding: 0px 11px 0px 11px;
font-weight: bold;
}.footer_content {
text-align: center;
width: 960px;
padding-top: 20px;
padding-bottom: 10px;
}
.but_gui {
font-size:11px;
color: #787878;
background-color: transparent;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-image: url(../../../Resource/Image/Guest/form_but.png);
background-repeat: no-repeat;
background-position: left top;
height: 25px;
width: 52px;
font-weight: bold;
text-align: center;
cursor:pointer;
}
.but_gui:hover {
color:#ff3300;
}
.but_nhaplai {
font-size:11px;
color: #787878;
background-color: transparent;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-image: url(../../../Resource/Image/Guest/form_but.png);
background-repeat: no-repeat;
background-position: left -25px;
height: 25px;
width: 80px;
font-weight: bold;
text-align: center;
margin-left:10px;
cursor:pointer;
}
.but_nhaplai:hover {
color:#ff3300;
}
.news_tittle a{
font-weight: bold;
color: #FF3300;
}
.news_linkChiTiet {
color: #FF3300;
text-decoration: underline;
}
.paging {
float: right;
line-height: 20px;
padding-top: 25px;
}
.paging_item {
background-image: url(../../../Resource/Image/Guest/paging.png);
text-align: center;
height: 20px;
width: 20px;
float: left;
margin-left: 5px;
cursor:pointer;
}
.paging_item:hover{
font-weight: bold;
color: #FFF;
background-image: url(../../../Resource/Image/Guest/paging.png);
background-repeat: no-repeat;
background-position: left -20px;
}
.paging_item_active {
font-weight: bold;
color: #FFF;
background-image: url(../../../Resource/Image/Guest/paging.png);
background-repeat: no-repeat;
background-position: left -20px;
height: 20px;
width: 20px;
float: left;
margin-left: 5px;
cursor:pointer;
text-align: center;
}
.image_slider {
margin: auto;
width: 600px;
}
.image_slider_tittle {
line-height: 30px;
}
.image_slider_image_cotainer {
height: 300px;
width: 600px;
overflow:hidden;
}
.image_slider_image{
height: 300px;
width: 600px;
position:absolute;
}
.image_slider_butNext{
height: 46px;
width: 34px;
position:absolute;
z-index:100;
background:url(../../../Resource/Image/Guest/imageSlide_but.png) left top;
margin-top: 127px;
margin-left: 566px;
}
.image_slider_butPrev{
height: 46px;
width: 34px;
position:absolute;
z-index:100;
background:url(../../../Resource/Image/Guest/imageSlide_but.png) left -46px;
margin-top: 127px;
}
.image_slider_items {
text-align: center;
padding-top: 400px;
}
.image_slider_item_active {
background-image: url(../../../Resource/Image/Guest/imageSlide_but.png);
background-repeat: no-repeat;
background-position: left -92px;
display: inline-block;
zoom:1;
*display:inline;
height: 10px;
width: 11px;
cursor:pointer;
}
.image_slider_item {
background-image: url(../../../Resource/Image/Guest/imageSlide_but.png);
background-repeat: no-repeat;
background-position: left -102px;
display: inline-block;
zoom:1;
*display:inline;
height: 10px;
width: 11px;
cursor:pointer;
}
.project_container {
width: 704px;
padding-top: 13px;
padding-bottom: 13px;
}
.project_container_title {
font-weight: bold;
color: #ff3300;
height: 30px;
}
#img_icon_recruitment {
background-image: url(../../../Resource/Image/Guest/icon_right.png);
background-repeat: no-repeat;
background-position: -164px -2px;
height: 24px;
width: 17px;
float:left;
margin-right: 5px;
margin-top: -3px;
}
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/StyleSheet/Guest/style.css | CSS | asf20 | 19,386 |
#AVIMControl {
background-image: url('transparent.png');
padding: 2px;
border: 1px solid #5b958e;
position: absolute;
bottom: 5px;
right: 5px;
width: 320px;
display: none;
}
body > #AVIMControl {
position: fixed;
}
.AVIMControl {
margin: 0;
padding: 0;
color: #137e70;
font-family: Verdana, Tahoma;
font-size: 10px;
font-weight: bold;
}
a.AVIMControl {
color: #b62727;
text-decoration: none;
cursor: pointer;
}
#AVIMControl input {
vertical-align: middle;
}
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/StyleSheet/Guest/avim.css | CSS | asf20 | 481 |
/******************************** Basic Structure ********************************/
html {
font-size: 100%;
height: 100%;
margin-bottom: 1px; /* Always show a scrollbar to avoid jumping when the scrollbar appears */
}
body {
font-family: Arial, Helvetica, sans-serif;
color: #555;
background: #f0f0f0 url('../../../Resources/Image/Admin/bg-body.gif') top left repeat-y;
font-size: 12px;
}
#body-wrapper {
background: url('../../../Resources/Image/Admin/bg-radial-gradient.gif') fixed 230px top no-repeat;
}
/******************************** Elements styling ********************************/
h1, h2, h3, h4, h5, h6 {
font-family: Helvetica, Arial, sans-serif;
color: #222;
font-weight: bold;
}
h1 { font-family: Calibri, Helvetica, Arial, sans-serif; font-size: 31px; font-weight: bold; color: #fff;
position: absolute; top: -1000px; /* Remove this line and delete the logo (in the HTML) if you don't want an image as a logo */
}
h2 { font-size: 26px; padding: 0 0 10px 0; }
h3 { font-size: 17px; padding: 0 0 10px 0; }
h4 { font-size: 16px; padding: 0 0 5px 0; }
h5 { font-size: 14px; padding: 0 0 5px 0; }
h6 { font-size: 12px; padding: 0 0 5px 0; }
a { color: #57a000; text-decoration: none; }
a:hover { color: #000; }
a:active { color: #777; }
a:focus { outline: 1px; }
strong { font-weight: bold; color: #333; }
small { font-size: 0.85em; }
pre { font-family: monospace; }
p {
padding: 5px 0 10px 0;
line-height: 1.6em;
}
/******************************** General Classes ********************************/
.clear {
clear: both;
}
.align-left {
float: left;
}
.align-right {
float: right;
}
/************ Button ************/
input[type='submit'],input[type='button'] {
font-family: Verdana, Arial, sans-serif;
display: inline-block;
background: #459300 url('../../../Resources/Image/Admin/bg-button-green.gif') top left repeat-x !important;
border: 1px solid #459300 !important;
padding: 4px 7px 4px 7px !important;
color: #fff !important;
font-size: 11px !important;
cursor: pointer;
}
input[type='submit']:hover,input[type='button']:hover {
text-decoration: underline;
}
input[type='submit']:active,input[type='button']:active {
padding: 5px 7px 3px 7px !important;
}
a.remove-link {
color: #bb0000;
}
a.remove-link:hover {
color: #000;
}
/******************************** Sidebar ********************************/
#sidebar {
background: url('../../../Resources/Image/Admin/bg-sidebar.gif') top left no-repeat;
width: 230px;
height: 100%;
position: absolute;
left: 0;
top: 0;
color: #888;
font-size: 11px;
}
#sidebar #sidebar-wrapper {
margin: 0 0 0 9px;
}
#sidebar #sidebar-wrapper img {
border: 0 none;
}
#sidebar a,
#sidebar a:active {
color:#ccc;
}
#sidebar a:hover {
color:#fff;
}
#sidebar #sidebar-title {
margin: 40px 0 40px 15px;
}
#sidebar #logo {
margin: 40px 0 40px 0;
}
#sidebar #profile-links {
padding: 0 15px 20px 15px;
text-align: right;
line-height: 1.5em;
}
/************ Sidebar Accordion Menu ************/
#sidebar #main-nav {
width: 206px;
padding: 0;
margin: 0 0 0 15px;
font-family: Helvetica, Arial, sans-serif;
}
#sidebar #main-nav li {
list-style: none;
padding-bottom: 10px;
text-align: right;
}
#sidebar #main-nav li a.nav-top-item {
background: transparent url('../../../Resources/Image/Admin/bg-menu-item-green.gif') right center no-repeat; /* Background image for default color scheme - green */
padding: 10px 15px;
color: #fff;
font-size: 14px;
cursor: pointer;
display: block;
text-decoration: none;
}
#sidebar #main-nav li a.current {
background-image: url('../../../Resources/Image/Admin/bg-menu-item-current.gif') !important;
color: #333;
font-weight: bold;
}
#sidebar #main-nav li a.current:hover {
color: #333;
}
#sidebar #main-nav ul {
padding: 0;
font-size: 12px;
margin: 0;
}
#sidebar #main-nav ul li {
list-style: none;
margin: 0;
text-align: right;
padding: 0;
}
#sidebar #main-nav ul li a {
padding: 8px 15px;
display: block;
color: #aaa;
font-size: 13px;
line-height: 1.2em;
}
#sidebar #main-nav ul li a:hover,
#sidebar #main-nav ul li a.current,
#sidebar #main-nav ul li a.current:hover {
color: #fff;
}
#sidebar #main-nav ul li a.current {
background: transparent url('../../../Resources/Image/Admin/menu-current-arrow.gif') right center no-repeat !important;
}
/******************************** Main Content ********************************/
/************ Layout ************/
#main-content {
margin: 0 30px 0 260px;
padding: 40px 0 0 0;
}
.column-left {
width: 48%;
float: left;
}
.column-right {
width: 48%;
float: right;
}
#page-intro {
font-size: 17px;
padding: 0 0 20px 0;
}
#footer {
border-top: 1px solid #ccc;
margin: 40px 0 0 0;
padding: 20px 0;
font-size: 12px;
}
/************ Lists ************/
#main-content ul,
#main-content ol {
padding: 10px 0;
}
/* Unordered List */
#main-content ul li {
background: url('../../../Resources/Image/Admin/icons/bullet_black.png') center left no-repeat;
padding: 4px 0 4px 20px;
}
/* Ordered List */
#main-content ol {
padding: 0 0 0 24px;
}
#main-content ol li {
list-style: decimal;
padding: 4px 0;
}
/*************** Content Box ***************/
.content-box {
border: 1px solid #ccc;
margin: 0 0 20px 0;
background: #fff;
}
.content-box-header {
background: #e5e5e5 url('../../../Resources/Image/Admin/bg-content-box.gif') top left repeat-x;
margin-top: 1px;
height: 40px;
}
.content-box-header h3 {
font-size : 15px;
margin-left:10px;
float: left;
}
ul.content-box-tabs {
float: right;
padding: 12px 15px 0 0 !important;
margin: 0 !important;
}
ul.content-box-tabs li {
float: left;
margin: 0;
padding: 0 !important;
background-image: none !important;
}
ul.content-box-tabs li a {
color: #333;
padding: 8px 10px;
display: block;
margin: 1px;
border-bottom: 0;
}
ul.content-box-tabs li a:hover {
color: #57a000;
}
ul.content-box-tabs li a.current {
background: #fff;
border: 1px solid #ccc;
border-bottom: 0;
margin: 0;
}
.content-box-content {
padding: 20px;
font-size: 13px;
border-top: 1px solid #ccc;
}
/************ Table ************/
#main-content table {
border-collapse: collapse;
}
#main-content table thead th {
font-weight: bold;
font-size: 15px;
border-bottom: 1px solid #ddd;
}
#main-content tbody {
border-bottom: 1px solid #ddd;
}
#main-content tbody tr {
background: #fff;
}
#main-content tbody tr.alt-row {
background: #f3f3f3;
}
#main-content table td,
#main-content table th {
padding: 10px;
line-height: 1.3em;
}
#main-content table tfoot td .bulk-actions {
padding: 15px 0 5px 0;
}
#main-content table tfoot td .bulk-actions select {
padding: 4px;
border: 1px solid #ccc;
}
/*************** Pagination ***************/
#main-content .pagination {
text-align: right;
padding: 20px 0 5px 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
.pagination a {
margin: 0 5px 0 0;
padding: 3px 6px;
}
.pagination a.number {
border: 1px solid #ddd;
}
.pagination a.current {
background: #469400 url('../../../Resources/Image/Admin/bg-button-green.gif') top left repeat-x !important;
border-color: #459300 !important;
color: #fff !important;
}
.pagination a.current:hover {
text-decoration: underline;
}
/************ Shortcut Buttons ************/
.shortcut-button {
border: 1px solid #ccc;
background: #f7f7f7 url('../../../Resources/Image/Admin/shortcut-button-bg.gif') top left no-repeat;
display: block;
width: 120px;
margin: 0 0 20px 0;
}
.shortcut-button span {
background-position: center 15px;
background-repeat: no-repeat;
border: 1px solid #fff;
display:block;
padding: 78px 10px 15px 10px;
text-align: center;
color: #555;
font-size: 13px;
line-height: 1.3em;
}
.new-article span {
background-image: url('../../../Resources/Image/Admin/icons/pencil_48.png');
}
.new-page span {
background-image: url('../../../Resources/Image/Admin/icons/paper_content_pencil_48.png');
}
.upload-image span {
background-image: url('../../../Resources/Image/Admin/icons/image_add_48.png');
}
.add-event span {
background-image: url('../../../Resources/Image/Admin/icons/clock_48.png');
}
.manage-comments span {
background-image: url('../../../Resources/Image/Admin/icons/comment_48.png');
}
.shortcut-button:hover {
background: #fff;
}
.shortcut-button span:hover {
color: #57a000;
}
ul.shortcut-buttons-set li {
float: left;
margin: 0 15px 0 0;
padding: 0 !important;
background: 0;
}
/*************** Forms ***************/
form label {
display: block;
padding: 0 0 10px;
font-weight: bold;
}
form fieldset legend {
font-weight: bold;
margin-bottom: 10px;
padding-top: 10px;
}
form p small {
font-size: 0.75em;
color: #777;
}
form input.text-input,
input,
form select,
form textarea,
form .wysiwyg {
padding: 6px;
font-size: 13px;
background: #fff url('../../../Resources/Image/Admin/bg-form-field.gif') top left repeat-x;
border: 1px solid #d5d5d5;
color: #333;
}
form .small-input {
width: 25% !important;
}
form .medium-input {
width: 50% !important;
}
form .large-input {
width: 97.5% !important;
font-size: 16px !important;
padding: 8px !important;
}
form textarea {
width: 97.5% !important;
font-family: Arial, Helvetica, sans-serif;
}
form select {
padding: 4px;
background: #fff;
}
form input[type="checkbox"],
form input[type="radio"] {
padding: 0;
background: none;
border: 0;
}
/* Notification for form inputs */
.input-notification {
background-position: left 2px;
background-repeat: no-repeat;
padding: 2px 0 2px 22px;
background-color: transparent;
margin: 0 0 0 5px;
}
/* Notification for login page */
#login-wrapper #login-content .notification {
border: 0;
background-color: #141414;
color: #fff !important;
}
/******************************** Login Page ********************************/
body#login {
color: #fff;
background: #222 url('../../../Resources/Image/Admin/bg-login.gif');
}
#login-wrapper {
background: url('../../../Resources/Image/Admin/bg-login-top.png') top left repeat-x;
}
#login-wrapper #login-top {
width: 100%;
padding: 25px 0 50px 0;
text-align: center;
}
#login-wrapper #login-content {
text-align: left;
width: 300px;
margin: 0 auto;
}
#login-wrapper #login-content label {
color: #fff;
font-weight: normal;
font-size: 14px;
font-family: Helvetica, Arial, sans-serif;
float: left;
width: 70px;
padding: 0;
}
#login-wrapper #login-content input {
width: 200px;
float: right;
margin: 0 0 20px 0;
border: 0;
background: #fff;
}
#login-wrapper #login-content p {
padding: 0;
}
#login-wrapper #login-content p#remember-password {
float: right;
}
#login-wrapper #login-content p#remember-password input {
float: none;
width: auto;
border: 0;
background: none;
margin: 0 10px 0 0;
}
#login-wrapper #login-content p .button {
width: auto;
margin-top: 20px;
}
/******************************** jQuery plugins styles ********************************/
/*************** Facebox ***************/
#facebox .b {
background:url(../../../Resources/Image/Admin/b.png);
}
#facebox .tl {
background:url(../../../Resources/Image/Admin/tl.png);
}
#facebox .tr {
background:url(../../../Resources/Image/Admin/tr.png);
}
#facebox .bl {
background:url(../../../Resources/Image/Admin/bl.png);
}
#facebox .br {
background:url(../../../Resources/Image/Admin/br.png);
}
#facebox {
position: absolute;
top: 0;
left: 0;
z-index: 100;
text-align: left;
}
#facebox .popup {
position: relative;
}
#facebox table {
border-collapse: collapse;
}
#facebox td {
border-bottom: 0;
padding: 0;
}
#facebox .body {
padding: 10px;
background: #fff;
width: 370px;
}
#facebox .loading {
text-align: center;
}
#facebox .image {
text-align: center;
}
#facebox img {
border: 0;
margin: 0;
}
#facebox .footer {
border-top: 1px solid #DDDDDD;
padding-top: 5px;
margin-top: 10px;
text-align: right;
}
#facebox .tl, #facebox .tr, #facebox .bl, #facebox .br {
height: 10px;
width: 10px;
overflow: hidden;
padding: 0;
}
#facebox_overlay {
position: fixed;
top: 0px;
left: 0px;
height:100%;
width:100%;
}
.facebox_hide {
z-index:-100;
}
.facebox_overlayBG {
background-color: #000;
z-index: 99;
}
/*************** My custom css ***************/
.content_center{
margin: auto;
}
#g1 img
{
width : 600px;
height : 500px;
} | 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/StyleSheet/Admin/style.css | CSS | asf20 | 17,986 |
.button,
#main-content table tfoot td .bulk-actions select,
.pagination a.number,
form input.text-input,
input,
form textarea,
form .wysiwyg,
form select {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.content-box,
.content-box-header,
ul.content-box-tabs li a.current,
.shortcut-button,
.notification {
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
}
.content-box-header {
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.content-box-header-toggled {
-moz-border-radius-bottomleft: 6px;
-moz-border-radius-bottomright: 6px;
-webkit-border-bottom-left-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
ul.content-box-tabs li a.current {
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.shortcut-button span {
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
div.wysiwyg ul.panel li a { opacity: 0.6; }
div.wysiwyg ul.panel li a:hover, div.wysiwyg ul.panel li a.active { opacity: 0.99; }
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/StyleSheet/Admin/invalid.css | CSS | asf20 | 1,851 |
/************ Internet Explorer fixes ************/
#sidebar #main-nav ul li a {
_padding: 10px 15px; /* IE6 Hack */
_display: block; /* IE6 Hack */
_margin-bottom: -11px !important; /* IE6 Hack */
}
.content-box-header {
margin-top: 0;
}
ul.content-box-tabs { /* IE6 Hack */
_position: relative;
_top: 2px;
}
.action-button:hover {
cursor: pointer;
}
.input-notification {
position: relative;
top: -5px;
_background-position: left 6px; /* IE6 Hack */
}
#login-wrapper #login-content input {
margin: 0;
}
* html #facebox_overlay { /* IE6 Hack */
_position: absolute;
_height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
} | 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/StyleSheet/Admin/ie.css | CSS | asf20 | 987 |
Calendar.LANG("en", "English", {
fdow: 1, // first day of week for this locale; 0 = Sunday, 1 = Monday, etc.
goToday: "Go Today",
today: "Today", // appears in bottom bar
wk: "wk",
weekend: "0,6", // 0 = Sunday, 1 = Monday, etc.
AM: "am",
PM: "pm",
mn : [ "January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December" ],
smn : [ "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec" ],
dn : [ "Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday" ],
sdn : [ "Su",
"Mo",
"Tu",
"We",
"Th",
"Fr",
"Sa",
"Su" ]
});
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/Javascript/Calendar/en.js | JavaScript | asf20 | 1,321 |
/*
* AVIM JavaScript Vietnamese Input Method Source File dated 28-07-2008
*
* Copyright (C) 2004-2008 Hieu Tran Dang <lt2hieu2004 (at) users (dot) sf (dot) net
* Website: http://noname00.com/hieu
*
* You are allowed to use this software in any way you want providing:
* 1. You must retain this copyright notice at all time
* 2. You must not claim that you or any other third party is the author
* of this software in any way.
*/
var AVIMGlobalConfig = {
method: 0, //Default input method: 0=AUTO, 1=TELEX, 2=VNI, 3=VIQR, 4=VIQR*
onOff: 1, //Starting status: 0=Off, 1=On
ckSpell: 1, //Spell Check: 0=Off, 1=On
oldAccent: 1, //0: New way (oa`, oe`, uy`), 1: The good old day (o`a, o`e, u`y)
useCookie: 1, //Cookies: 0=Off, 1=On
exclude: ["email"], //IDs of the fields you DON'T want to let users type Vietnamese in
showControl: 1, //Show control panel: 0=Off, 1=On. If you turn this off, you must write your own control panel.
controlCSS: "../../../Resource/StyleSheet/Guest/avim.css" //Path to avim.css
};
//Set to true the methods which you want to be included in the AUTO method
var AVIMAutoConfig = {
telex: true,
vni: true,
viqr: false,
viqrStar: false
};
function AVIM() {
this.radioID = "avim_auto,avim_telex,avim_vni,avim_viqr,avim_viqr2,avim_off,avim_ckspell,avim_daucu".split(",");
this.attached = [];
this.changed = false;
this.agt = navigator.userAgent.toLowerCase();
this.alphabet = "QWERTYUIOPASDFGHJKLZXCVBNM\ ";
this.support = true;
this.ver = 0;
this.specialChange = false;
this.is_ie = ((this.agt.indexOf("msie") != -1) && (this.agt.indexOf("opera") == -1));
this.is_opera = false;
this.isKHTML = false;
this.kl = 0;
this.skey = [97,226,259,101,234,105,111,244,417,117,432,121,65,194,258,69,202,73,79,212,416,85,431,89];
this.fID = document.getElementsByTagName("iframe");
this.range = null;
this.whit = false;
this.db1 = [273,272];
this.ds1 = ['d','D'];
this.os1 = "o,O,ơ,Ơ,ó,Ó,ò,Ò,ọ,Ọ,ỏ,Ỏ,õ,Õ,ớ,Ớ,ờ,Ờ,ợ,Ợ,ở,Ở,ỡ,Ỡ".split(",");
this.ob1 = "ô,Ô,ô,Ô,ố,Ố,ồ,Ồ,ộ,Ộ,ổ,Ổ,ỗ,Ỗ,ố,Ố,ồ,Ồ,ộ,Ộ,ổ,Ổ,ỗ,Ỗ".split(",");
this.mocs1 = "o,O,ô,Ô,u,U,ó,Ó,ò,Ò,ọ,Ọ,ỏ,Ỏ,õ,Õ,ú,Ú,ù,Ù,ụ,Ụ,ủ,Ủ,ũ,Ũ,ố,Ố,ồ,Ồ,ộ,Ộ,ổ,Ổ,ỗ,Ỗ".split(",");
this.mocb1 = "ơ,Ơ,ơ,Ơ,ư,Ư,ớ,Ớ,ờ,Ờ,ợ,Ợ,ở,Ở,ỡ,Ỡ,ứ,Ứ,ừ,Ừ,ự,Ự,ử,Ử,ữ,Ữ,ớ,Ớ,ờ,Ờ,ợ,Ợ,ở,Ở,ỡ,Ỡ".split(",");
this.trangs1 = "a,A,â,Â,á,Á,à,À,ạ,Ạ,ả,Ả,ã,Ã,ấ,Ấ,ầ,Ầ,ậ,Ậ,ẩ,Ẩ,ẫ,Ẫ".split(",");
this.trangb1 = "ă,Ă,ă,Ă,ắ,Ắ,ằ,Ằ,ặ,Ặ,ẳ,Ẳ,ẵ,Ẵ,ắ,Ắ,ằ,Ằ,ặ,Ặ,ẳ,Ẳ,ẵ,Ẵ".split(",");
this.as1 = "a,A,ă,Ă,á,Á,à,À,ạ,Ạ,ả,Ả,ã,Ã,ắ,Ắ,ằ,Ằ,ặ,Ặ,ẳ,Ẳ,ẵ,Ẵ,ế,Ế,ề,Ề,ệ,Ệ,ể,Ể,ễ,Ễ".split(",");
this.ab1 = "â,Â,â,Â,ấ,Ấ,ầ,Ầ,ậ,Ậ,ẩ,Ẩ,ẫ,Ẫ,ấ,Ấ,ầ,Ầ,ậ,Ậ,ẩ,Ẩ,ẫ,Ẫ,é,É,è,È,ẹ,Ẹ,ẻ,Ẻ,ẽ,Ẽ".split(",");
this.es1 = "e,E,é,É,è,È,ẹ,Ẹ,ẻ,Ẻ,ẽ,Ẽ".split(",");
this.eb1 = "ê,Ê,ế,Ế,ề,Ề,ệ,Ệ,ể,Ể,ễ,Ễ".split(",");
this.english = "ĐÂĂƠƯÊÔ";
this.lowen = "đâăơưêô";
this.arA = "á,à,ả,ã,ạ,a,Á,À,Ả,Ã,Ạ,A".split(',');
this.mocrA = "ó,ò,ỏ,õ,ọ,o,ú,ù,ủ,ũ,ụ,u,Ó,Ò,Ỏ,Õ,Ọ,O,Ú,Ù,Ủ,Ũ,Ụ,U".split(',');
this.erA = "é,è,ẻ,ẽ,ẹ,e,É,È,Ẻ,Ẽ,Ẹ,E".split(',');
this.orA = "ó,ò,ỏ,õ,ọ,o,Ó,Ò,Ỏ,Õ,Ọ,O".split(',');
this.aA = "ấ,ầ,ẩ,ẫ,ậ,â,Ấ,Ầ,Ẩ,Ẫ,Ậ,Â".split(',');
this.oA = "ố,ồ,ổ,ỗ,ộ,ô,Ố,Ồ,Ổ,Ỗ,Ộ,Ô".split(',');
this.mocA = "ớ,ờ,ở,ỡ,ợ,ơ,ứ,ừ,ử,ữ,ự,ư,Ớ,Ờ,Ở,Ỡ,Ợ,Ơ,Ứ,Ừ,Ử,Ữ,Ự,Ư".split(',');
this.trangA = "ắ,ằ,ẳ,ẵ,ặ,ă,Ắ,Ằ,Ẳ,Ẵ,Ặ,Ă".split(',');
this.eA = "ế,ề,ể,ễ,ệ,ê,Ế,Ề,Ể,Ễ,Ệ,Ê".split(',');
this.oA = "ố,ồ,ổ,ỗ,ộ,ô,Ố,Ồ,Ổ,Ỗ,Ộ,Ô".split(',');
this.skey2 = "a,a,a,e,e,i,o,o,o,u,u,y,A,A,A,E,E,I,O,O,O,U,U,Y".split(',');
this.fcc = function(x) {
return String.fromCharCode(x);
}
this.getEL = function(id) {
return document.getElementById(id);
}
this.getSF = function() {
var sf = [], x;
for(x = 0; x < this.skey.length; x++) {
sf[sf.length] = this.fcc(this.skey[x]);
}
return sf;
}
if(AVIMGlobalConfig.showControl) {
this.css = document.createElement('link');
this.css.rel = 'stylesheet';
this.css.type = 'text/css';
this.css.href = AVIMGlobalConfig.controlCSS;
document.getElementsByTagName('head')[0].appendChild(this.css);
document.write('<span id="AVIMControl">');
document.write('<p class="AVIMControl"><input id="avim_auto" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(0);" />Tự động');
document.write('<input id="avim_telex" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(1);" />TELEX');
document.write('<input id="avim_vni" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(2);" />VNI');
document.write('<input id="avim_viqr" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(3);" />VIQR');
document.write('<input id="avim_viqr2" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(4);" />VIQR*');
document.write('<input id="avim_off" type="radio" name="AVIMMethod" onclick="AVIMObj.setMethod(-1);" />Tắt<br />');
document.write('<a class="AVIMControl" style="float: right; position: relative; top: 3px;" onclick="document.getElementById(' + "'AVIMControl').style.display='none';" + '">[Ẩn AVIM - F12]</a>');
document.write('<input type="checkbox" id="avim_ckspell" onclick="AVIMObj.setSpell(this);" />Chính tả');
document.write('<input type="checkbox" id="avim_daucu" onclick="AVIMObj.setDauCu(this);" />Kiểu cũ</p>');
document.write('</span>');
}
if(!this.is_ie) {
if(this.agt.indexOf("opera") >= 0) {
this.operaV = this.agt.split(" ");
this.operaVersion = parseInt(this.operaV[this.operaV.length - 1]);
if(this.operaVersion >= 8) {
this.is_opera = true;
} else {
this.operaV = this.operaV[0].split("/");
this.operaVersion = parseInt(this.operaV[1]);
if(this.operaVersion >= 8) this.is_opera = true;
}
} else if(this.agt.indexOf("khtml") >= 0) {
this.isKHTML = true;
} else {
this.ver = this.agt.substr(this.agt.indexOf("rv:") + 3);
this.ver = parseFloat(this.ver.substr(0, this.ver.indexOf(" ")));
if(this.agt.indexOf("mozilla") < 0) this.ver = 0;
}
}
this.nospell = function(w, k) {
return false;
}
this.ckspell = function(w, k) {
w = this.unV(w);
var exc = "UOU,IEU".split(','), z, next = true, noE = "UU,UOU,UOI,IEU,AO,IA,AI,AY,AU,AO".split(','), noBE = "YEU";
var check = true, noM = "UE,UYE,IU,EU,UY".split(','), noMT = "AY,AU".split(','), noT = "UA", t = -1, notV2 = "IAO";
var uw = this.up(w), tw = uw, update = false, gi = "IO", noAOEW = "OE,OO,AO,EO,IA,AI".split(','), noAOE = "OA", test, a, b;
var notViet = "AA,AE,EE,OU,YY,YI,IY,EY,EA,EI,II,IO,YO,YA,OOO".split(','), uk = this.up(k), twE, uw2 = this.unV2(uw);
var vSConsonant = "B,C,D,G,H,K,L,M,N,P,Q,R,S,T,V,X".split(','), vDConsonant = "CH,GI,KH,NGH,GH,NG,NH,PH,QU,TH,TR".split(',');
var vDConsonantE = "CH,NG,NH".split(','),sConsonant = "C,P,T,CH".split(','),vSConsonantE = "C,M,N,P,T".split(',');
var noNHE = "O,U,IE,Ô,Ơ,Ư,IÊ,Ă,Â,UYE,UYÊ,UO,ƯƠ,ƯO,UƠ,UA,ƯA,OĂ,OE,OÊ".split(','),oMoc = "UU,UOU".split(',');
if(this.FRX.indexOf(uk) >= 0) {
for(a = 0; a < sConsonant.length; a++) {
if(uw.substr(uw.length - sConsonant[a].length, sConsonant[a].length) == sConsonant[a]) {
return true;
}
}
}
for(a = 0; a < uw.length; a++) {
if("FJZW1234567890".indexOf(uw.substr(a, 1)) >= 0) {
return true;
}
for(b = 0; b < notViet.length; b++) {
if(uw2.substr(a, notViet[b].length) == notViet[b]) {
for(z = 0; z < exc.length; z++) {
if(uw2.indexOf(exc[z]) >= 0) {
next=false;
}
}
if(next && ((gi.indexOf(notViet[b]) < 0) || (a <= 0) || (uw2.substr(a - 1, 1) != 'G'))) {
return true;
}
}
}
}
for(b = 0; b < vDConsonant.length; b++) {
if(tw.indexOf(vDConsonant[b]) == 0) {
tw = tw.substr(vDConsonant[b].length);
update = true;
t = b;
break;
}
}
if(!update) {
for(b = 0; b < vSConsonant.length; b++) {
if(tw.indexOf(vSConsonant[b]) == 0) {
tw=tw.substr(1);
break;
}
}
}
update=false;
twE=tw;
for(b = 0; b < vDConsonantE.length; b++) {
if(tw.substr(tw.length - vDConsonantE[b].length) == vDConsonantE[b]) {
tw = tw.substr(0, tw.length - vDConsonantE[b].length);
if(b == 2){
for(z = 0; z < noNHE.length; z++) {
if(tw == noNHE[z]) {
return true;
}
}
if((uk == this.trang) && ((tw == "OA") || (tw == "A"))) {
return true;
}
}
update = true;
break;
}
}
if(!update) {
for(b = 0; b < vSConsonantE.length; b++) {
if(tw.substr(tw.length - 1) == vSConsonantE[b]) {
tw = tw.substr(0, tw.length - 1);
break;
}
}
}
if(tw) {
for(a = 0; a < vDConsonant.length; a++) {
for(b = 0; b < tw.length; b++) {
if(tw.substr(b, vDConsonant[a].length) == vDConsonant[a]) {
return true;
}
}
}
for(a = 0; a < vSConsonant.length; a++) {
if(tw.indexOf(vSConsonant[a]) >= 0) {
return true;
}
}
}
test = tw.substr(0, 1);
if((t == 3) && ((test == "A") || (test == "O") || (test == "U") || (test == "Y"))) {
return true;
}
if((t == 5) && ((test == "E") || (test == "I") || (test == "Y"))) {
return true;
}
uw2 = this.unV2(tw);
if(uw2 == notV2) {
return true;
}
if(tw != twE) {
for(z = 0; z < noE.length; z++) {
if(uw2 == noE[z]) {
return true;
}
}
}
if((tw != uw) && (uw2 == noBE)) {
return true;
}
if(uk != this.moc) {
for(z = 0; z < oMoc.length; z++) {
if(tw == oMoc[z]) return true;
}
}
if((uw2.indexOf('UYE')>0) && (uk == 'E')) {
check=false;
}
if((this.them.indexOf(uk) >= 0) && check) {
for(a = 0; a < noAOEW.length; a++) {
if(uw2.indexOf(noAOEW[a]) >= 0) {
return true;
}
}
if(uk != this.trang) {
if(uw2 == noAOE) {
return true;
}
}
if((uk == this.trang) && (this.trang != 'W')) {
if(uw2 == noT) {
return true;
}
}
if(uk == this.moc) {
for(a = 0; a < noM.length; a++) {
if(uw2 == noM[a]) {
return true;
}
}
}
if((uk == this.moc) || (uk == this.trang)) {
for(a = 0; a < noMT.length; a++) {
if(uw2 == noMT[a]) {
return true;
}
}
}
}
this.tw5 = tw;
if((uw2.charCodeAt(0) == 272) || (uw2.charCodeAt(0) == 273)) {
if(uw2.length > 4) {
return true;
}
} else if(uw2.length > 3) {
return true;
}
return false;
}
this.noCookie = function() {}
this.doSetCookie = function() {
var exp = new Date(11245711156480).toGMTString();
document.cookie = 'AVIM_on_off=' + AVIMGlobalConfig.onOff + ';expires=' + exp;
document.cookie = 'AVIM_method=' + AVIMGlobalConfig.method + ';expires=' + exp;
document.cookie = 'AVIM_ckspell=' + AVIMGlobalConfig.ckSpell + ';expires=' + exp;
document.cookie = 'AVIM_daucu=' + AVIMGlobalConfig.oldAccent + ';expires=' + exp;
}
this.doGetCookie = function() {
var ck = document.cookie, res = /AVIM_method/.test(ck), p, i, ckA = ck.split(';');
if(!res || (ck.indexOf('AVIM_ckspell') < 0)) {
this.setCookie();
return;
}
for(i = 0; i < ckA.length; i++) {
p = ckA[i].split('=');
p[0] = p[0].replace(/^\s+/g, "");
p[1] = parseInt(p[1]);
if(p[0] == 'AVIM_on_off') {
AVIMGlobalConfig.onOff = p[1];
}
else if(p[0] == 'AVIM_method') {
AVIMGlobalConfig.method = p[1];
}
else if(p[0] == 'AVIM_ckspell') {
if(p[1] == 0) {
AVIMGlobalConfig.ckSpell=0;
this.spellerr=this.nospell;
} else {
AVIMGlobalConfig.ckSpell=1;
this.spellerr=this.ckspell;
}
} else if(p[0] == 'AVIM_daucu') {
AVIMGlobalConfig.oldAccent = parseInt(p[1]);
}
}
}
if(AVIMGlobalConfig.useCookie == 1) {
this.setCookie = this.doSetCookie;
this.getCookie = this.doGetCookie;
} else {
this.setCookie = this.noCookie;
this.getCookie = this.noCookie;
}
this.setMethod = function(m) {
if(m == -1) {
AVIMGlobalConfig.onOff = 0;
if(this.getEL(this.radioID[5])) {
this.getEL(this.radioID[5]).checked = true;
}
} else {
AVIMGlobalConfig.onOff = 1;
AVIMGlobalConfig.method = m;
if(this.getEL(this.radioID[m])) {
this.getEL(this.radioID[m]).checked = true;
}
}
this.setSpell(AVIMGlobalConfig.ckSpell);
this.setDauCu(AVIMGlobalConfig.oldAccent);
this.setCookie();
}
this.setDauCu = function(box) {
if(typeof(box) == "number") {
AVIMGlobalConfig.oldAccent = box;
if(this.getEL(this.radioID[7])) {
this.getEL(this.radioID[7]).checked = box;
}
} else {
AVIMGlobalConfig.oldAccent = (box.checked) ? 1 : 0;
}
this.setCookie();
}
this.setSpell = function(box) {
if(typeof(box) == "number") {
this.spellerr = (box == 1) ? this.ckspell : this.nospell;
if(this.getEL(this.radioID[6])) {
this.getEL(this.radioID[6]).checked = box;
}
} else {
if(box.checked) {
this.spellerr = this.ckspell;
AVIMGlobalConfig.ckSpell = 1;
} else {
this.spellerr = this.nospell;
AVIMGlobalConfig.ckSpell = 0;
}
}
this.setCookie();
}
if(this.is_ie || (this.ver >= 1.3) || this.is_opera || this.isKHTML) {
this.getCookie();
if(AVIMGlobalConfig.onOff == 0) this.setMethod(-1);
else this.setMethod(AVIMGlobalConfig.method);
this.setSpell(AVIMGlobalConfig.ckSpell);
this.setDauCu(AVIMGlobalConfig.oldAccent);
} else {
this.support = false;
}
this.mozGetText = function(obj) {
var v, pos, w = "", g = 1;
v = (obj.data) ? obj.data : obj.value;
if(v.length <= 0) {
return false;
}
if(!obj.data) {
if(!obj.setSelectionRange) {
return false;
}
pos = obj.selectionStart;
} else {
pos = obj.pos;
}
if(obj.selectionStart != obj.selectionEnd) {
return ["", pos];
}
while(1) {
if(pos - g < 0) {
break;
} else if(this.notWord(v.substr(pos - g, 1))) {
if(v.substr(pos - g, 1) == "\\") {
w = v.substr(pos - g, 1) + w;
}
break;
} else {
w = v.substr(pos - g, 1) + w;
}
g++;
}
return [w, pos];
}
this.ieGetText = function(obj) {
var caret = obj.document.selection.createRange(), w="";
if(caret.text) {
caret.text = "";
} else {
while(1) {
caret.moveStart("character", -1);
if(w.length == caret.text.length) {
break;
}
w = caret.text;
if(this.notWord(w.charAt(0))) {
if(w.charCodeAt(0) == 13) {
w=w.substr(2);
} else if(w.charAt(0) != "\\") {
w=w.substr(1);
}
break;
}
}
}
if(w.length) {
caret.collapse(false);
caret.moveStart("character", -w.length);
obj.cW = caret.duplicate();
return obj;
} else {
return false;
}
}
this.start = function(obj, key) {
var w = "", method = AVIMGlobalConfig.method, dockspell = AVIMGlobalConfig.ckSpell, uni, uni2 = false, uni3 = false, uni4 = false;
this.oc=obj;
var telex = "D,A,E,O,W,W".split(','), vni = "9,6,6,6,7,8".split(','), viqr = "D,^,^,^,+,(".split(','), viqr2 = "D,^,^,^,*,(".split(','), a, noNormC;
if(method == 0) {
var arr = [], check = [AVIMAutoConfig.telex, AVIMAutoConfig.vni, AVIMAutoConfig.viqr, AVIMAutoConfig.viqrStar];
var value1 = [telex, vni, viqr, viqr2], uniA = [uni, uni2, uni3, uni4], D2A = ["DAWEO", "6789", "D^+(", "D^*("];
for(a = 0; a < check.length; a++) {
if(check[a]) {
arr[arr.length] = value1[a];
} else {
D2A[a] = "";
}
}
for(a = 0; a < arr.length; a++) {
uniA[a] = arr[a];
}
uni = uniA[0];
uni2 = uniA[1];
uni3 = uniA[2];
uni4 = uniA[3];
this.D2 = D2A.join();
if(!uni) {
return;
}
} else if(method == 1) {
uni = telex;
this.D2 = "DAWEO";
}
else if(method == 2) {
uni = vni;
this.D2 = "6789";
}
else if(method == 3) {
uni = viqr;
this.D2 = "D^+(";
}
else if(method == 4) {
uni = viqr2;
this.D2 = "D^*(";
}
if(!this.is_ie) {
key = this.fcc(key.which);
w = this.mozGetText(obj);
if(!w || obj.sel) {
return;
}
if(this.D2.indexOf(this.up(key)) >= 0) {
noNormC = true;
} else {
noNormC = false;
}
this.main(w[0], key, w[1], uni, noNormC);
if(!dockspell) {
w = this.mozGetText(obj);
}
if(w && uni2 && !this.changed) {
this.main(w[0], key, w[1], uni2, noNormC);
}
if(!dockspell) {
w = this.mozGetText(obj);
}
if(w && uni3 && !this.changed) {
this.main(w[0], key, w[1], uni3, noNormC);
}
if(!dockspell) {
w = this.mozGetText(obj);
}
if(w && uni4 && !this.changed) {
this.main(w[0], key, w[1], uni4, noNormC);
}
} else {
obj = this.ieGetText(obj);
if(obj) {
var sT = obj.cW.text;
w = this.main(sT, key, 0, uni, false);
if(uni2 && ((w == sT) || (typeof(w) == 'undefined'))) {
w = this.main(sT, key, 0, uni2, false);
}
if(uni3 && ((w == sT) || (typeof(w) == 'undefined'))) {
w = this.main(sT, key, 0, uni3, false);
}
if(uni4 && ((w == sT) || (typeof(w) == 'undefined'))) {
w = this.main(sT, key, 0, uni4, false);
}
if(w) {
obj.cW.text = w;
}
}
}
if(this.D2.indexOf(this.up(key)) >= 0) {
if(!this.is_ie) {
w = this.mozGetText(obj);
if(!w) {
return;
}
this.normC(w[0], key, w[1]);
} else if(typeof(obj) == "object") {
obj = this.ieGetText(obj);
if(obj) {
w = obj.cW.text;
if(!this.changed) {
w += key;
this.changed = true;
}
obj.cW.text = w;
w = this.normC(w, key, 0);
if(w) {
obj = this.ieGetText(obj);
obj.cW.text = w;
}
}
}
}
}
this.findC = function(w, k, sf) {
var method = AVIMGlobalConfig.method;
if(((method == 3) || (method == 4)) && (w.substr(w.length - 1, 1) == "\\")) {
return [1, k.charCodeAt(0)];
}
var str = "", res, cc = "", pc = "", tE = "", vowA = [], s = "ÂĂÊÔƠƯêâăơôư", c = 0, dn = false, uw = this.up(w), tv, g;
var DAWEOFA = this.up(this.aA.join() + this.eA.join() + this.mocA.join() + this.trangA.join() + this.oA.join() + this.english), h, uc;
for(g = 0; g < sf.length; g++) {
if(this.nan(sf[g])) {
str += sf[g];
} else {
str += this.fcc(sf[g]);
}
}
var uk = this.up(k), uni_array = this.repSign(k), w2 = this.up(this.unV2(this.unV(w))), dont = "ƯA,ƯU".split(',');
if (this.DAWEO.indexOf(uk) >= 0) {
if(uk == this.moc) {
if((w2.indexOf("UU") >= 0) && (this.tw5 != dont[1])) {
if(w2.indexOf("UU") == (w.length - 2)) {
res=2;
} else {
return false;
}
} else if(w2.indexOf("UOU") >= 0) {
if(w2.indexOf("UOU") == (w.length-3)) {
res=2;
} else {
return false;
}
}
}
if(!res) {
for(g = 1; g <= w.length; g++) {
cc = w.substr(w.length - g, 1);
pc = this.up(w.substr(w.length - g - 1, 1));
uc = this.up(cc);
for(h = 0; h < dont.length; h++) {
if((this.tw5 == dont[h]) && (this.tw5 == this.unV(pc + uc))) {
dn = true;
}
}
if(dn) {
dn = false;
continue;
}
if(str.indexOf(uc) >= 0) {
if(((uk == this.moc) && (this.unV(uc) == "U") && (this.up(this.unV(w.substr(w.length - g + 1, 1))) == "A")) || ((uk == this.trang) && (this.unV(uc) == 'A') && (this.unV(pc) == 'U'))) {
if(this.unV(uc) == "U") {
tv=1;
} else {
tv=2;
}
var ccc = this.up(w.substr(w.length - g - tv, 1));
if(ccc != "Q") {
res = g + tv - 1;
} else if(uk == this.trang) {
res = g;
} else if(this.moc != this.trang) {
return false;
}
} else {
res = g;
}
if(!this.whit || (uw.indexOf("Ư") < 0) || (uw.indexOf("W") < 0)) {
break;
}
} else if(DAWEOFA.indexOf(uc) >= 0) {
if(uk == this.D) {
if(cc == "đ") {
res = [g, 'd'];
} else if(cc == "Đ") {
res = [g, 'D'];
}
} else {
res = this.DAWEOF(cc, uk, g);
}
if(res) break;
}
}
}
}
if((uk != this.Z) && (this.DAWEO.indexOf(uk) < 0)) {
var tEC = this.retKC(uk);
for(g = 0;g < tEC.length; g++) {
tE += this.fcc(tEC[g]);
}
}
for(g = 1; g <= w.length; g++) {
if(this.DAWEO.indexOf(uk) < 0) {
cc = this.up(w.substr(w.length - g, 1));
pc = this.up(w.substr(w.length - g - 1, 1));
if(str.indexOf(cc) >= 0) {
if(cc == 'U') {
if(pc != 'Q') {
c++;
vowA[vowA.length] = g;
}
} else if(cc == 'I') {
if((pc != 'G') || (c <= 0)) {
c++;
vowA[vowA.length] = g;
}
} else {
c++;
vowA[vowA.length] = g;
}
} else if(uk != this.Z) {
for(h = 0; h < uni_array.length; h++) if(uni_array[h] == w.charCodeAt(w.length - g)) {
if(this.spellerr(w, k)) {
return false;
}
return [g, tEC[h % 24]];
}
for(h = 0; h < tEC.length; h++) {
if(tEC[h] == w.charCodeAt(w.length - g)) {
return [g, this.fcc(this.skey[h])];
}
}
}
}
}
if((uk != this.Z) && (typeof(res) != 'object')) {
if(this.spellerr(w, k)) {
return false;
}
}
if(this.DAWEO.indexOf(uk) < 0) {
for(g = 1; g <= w.length; g++) {
if((uk != this.Z) && (s.indexOf(w.substr(w.length - g, 1)) >= 0)) {
return g;
} else if(tE.indexOf(w.substr(w.length - g, 1)) >= 0) {
for(h = 0; h < tEC.length; h++) {
if(w.substr(w.length - g, 1).charCodeAt(0) == tEC[h]) {
return [g, this.fcc(this.skey[h])];
}
}
}
}
}
if(res) {
return res;
}
if((c == 1) || (uk == this.Z)) {
return vowA[0];
} else if(c == 2) {
var v = 2;
if(w.substr(w.length - 1) == " ") {
v = 3;
}
var ttt = this.up(w.substr(w.length - v, 2));
if((AVIMGlobalConfig.oldAccent == 0) && ((ttt == "UY") || (ttt == "OA") || (ttt == "OE"))) {
return vowA[0];
}
var c2 = 0, fdconsonant, sc = "BCD" + this.fcc(272) + "GHKLMNPQRSTVX", dc = "CH,GI,KH,NGH,GH,NG,NH,PH,QU,TH,TR".split(',');
for(h = 1; h <= w.length; h++) {
fdconsonant=false;
for(g = 0; g < dc.length; g++) {
if(this.up(w.substr(w.length - h - dc[g].length + 1, dc[g].length)).indexOf(dc[g])>=0) {
c2++;
fdconsonant = true;
if(dc[g] != 'NGH') {
h++;
} else {
h+=2;
}
}
}
if(!fdconsonant) {
if(sc.indexOf(this.up(w.substr(w.length - h, 1))) >= 0) {
c2++;
} else {
break;
}
}
}
if((c2 == 1) || (c2 == 2)) {
return vowA[0];
} else {
return vowA[1];
}
} else if(c == 3) {
return vowA[1];
} else return false;
}
this.ie_replaceChar = function(w, pos, c) {
var r = "", uc = 0;
if(isNaN(c)) uc = this.up(c);
if(this.whit && (this.up(w.substr(w.length - pos - 1, 1)) == 'U') && (pos != 1) && (this.up(w.substr(w.length - pos - 2, 1)) != 'Q')) {
this.whit = false;
if((this.up(this.unV(this.fcc(c))) == "Ơ") || (uc == "O")) {
if(w.substr(w.length - pos - 1, 1) == 'u') r = this.fcc(432);
else r = this.fcc(431);
}
if(uc == "O") {
if(c == "o") {
c = 417;
} else {
c = 416;
}
}
}
if(!isNaN(c)) {
this.changed = true;
r += this.fcc(c);
return w.substr(0, w.length - pos - r.length + 1) + r + w.substr(w.length - pos + 1);
} else {
return w.substr(0, w.length - pos) + c + w.substr(w.length - pos + 1);
}
}
this.replaceChar = function(o, pos, c) {
var bb = false;
if(!this.nan(c)) {
var replaceBy = this.fcc(c), wfix = this.up(this.unV(this.fcc(c)));
this.changed = true;
} else {
var replaceBy = c;
if((this.up(c) == "O") && this.whit) {
bb=true;
}
}
if(!o.data) {
var savePos = o.selectionStart, sst = o.scrollTop;
if ((this.up(o.value.substr(pos - 1, 1)) == 'U') && (pos < savePos - 1) && (this.up(o.value.substr(pos - 2, 1)) != 'Q')) {
if((wfix == "Ơ") || bb) {
if (o.value.substr(pos-1,1) == 'u') {
var r = this.fcc(432);
} else {
var r = this.fcc(431);
}
}
if(bb) {
this.changed = true;
if(c == "o") {
replaceBy = "ơ";
} else {
replaceBy = "Ơ";
}
}
}
o.value = o.value.substr(0, pos) + replaceBy + o.value.substr(pos + 1);
if(r) o.value = o.value.substr(0, pos - 1) + r + o.value.substr(pos);
o.setSelectionRange(savePos, savePos);
o.scrollTop = sst;
} else {
if ((this.up(o.data.substr(pos - 1, 1)) == 'U') && (pos < o.pos - 1)) {
if((wfix == "Ơ") || bb) {
if (o.data.substr(pos - 1, 1) == 'u') {
var r = this.fcc(432);
} else {
var r = this.fcc(431);
}
}
if(bb) {
this.changed = true;
if(c == "o") {
replaceBy = "ơ";
} else {
replaceBy = "Ơ";
}
}
}
o.deleteData(pos, 1);
o.insertData(pos, replaceBy);
if(r) {
o.deleteData(pos - 1, 1);
o.insertData(pos - 1, r);
}
}
if(this.whit) {
this.whit=false;
}
}
this.tr = function(k, w, by, sf, i) {
var r, pos = this.findC(w, k, sf), g;
if(pos) {
if(pos[1]) {
if(this.is_ie) {
return this.ie_replaceChar(w, pos[0], pos[1]);
} else {
return this.replaceChar(this.oc, i-pos[0], pos[1]);
}
} else {
var c, pC = w.substr(w.length - pos, 1), cmp;
r = sf;
for(g = 0; g < r.length; g++) {
if(this.nan(r[g]) || (r[g] == "e")) {
cmp = pC;
} else {
cmp = pC.charCodeAt(0);
}
if(cmp == r[g]) {
if(!this.nan(by[g])) {
c = by[g];
} else {
c = by[g].charCodeAt(0);
}
if(this.is_ie) {
return this.ie_replaceChar(w, pos, c);
} else {
return this.replaceChar(this.oc, i - pos, c);
}
}
}
}
}
return false;
}
this.main = function(w, k, i, a, noNormC) {
var uk = this.up(k), bya = [this.db1, this.ab1, this.eb1, this.ob1, this.mocb1, this.trangb1], got = false, t = "d,D,a,A,a,A,o,O,u,U,e,E,o,O".split(",");
var sfa = [this.ds1, this.as1, this.es1, this.os1, this.mocs1, this.trangs1], by = [], sf = [], method = AVIMGlobalConfig.method, h, g;
if((method == 2) || ((method == 0) && (a[0] == "9"))) {
this.DAWEO = "6789";
this.SFJRX = "12534";
this.S = "1";
this.F = "2";
this.J = "5";
this.R = "3";
this.X = "4";
this.Z = "0";
this.D = "9";
this.FRX = "234";
this.AEO = "6";
this.moc = "7";
this.trang = "8";
this.them = "678";
this.A = "^";
this.E = "^";
this.O = "^";
} else if((method == 3) || ((method == 0) && (a[4] == "+"))) {
this.DAWEO = "^+(D";
this.SFJRX = "'`.?~";
this.S = "'";
this.F = "`";
this.J = ".";
this.R = "?";
this.X = "~";
this.Z = "-";
this.D = "D";
this.FRX = "`?~";
this.AEO = "^";
this.moc = "+";
this.trang = "(";
this.them = "^+(";
this.A = "^";
this.E = "^";
this.O = "^";
} else if((method == 4) || ((method == 0) && (a[4] == "*"))) {
this.DAWEO = "^*(D";
this.SFJRX = "'`.?~";
this.S = "'";
this.F = "`";
this.J = ".";
this.R = "?";
this.X = "~";
this.Z = "-";
this.D = "D";
this.FRX = "`?~";
this.AEO = "^";
this.moc = "*";
this.trang = "(";
this.them = "^*(";
this.A = "^";
this.E = "^";
this.O = "^";
} else if((method == 1) || ((method == 0) && (a[0] == "D"))) {
this.SFJRX = "SFJRX";
this.DAWEO = "DAWEO";
this.D = 'D';
this.S = 'S';
this.F = 'F';
this.J = 'J';
this.R = 'R';
this.X = 'X';
this.Z = 'Z';
this.FRX = "FRX";
this.them = "AOEW";
this.trang = "W";
this.moc = "W";
this.A = "A";
this.E = "E";
this.O = "O";
}
if(this.SFJRX.indexOf(uk) >= 0) {
var ret = this.sr(w,k,i);
got=true;
if(ret) {
return ret;
}
} else if(uk == this.Z) {
sf = this.repSign(null);
for(h = 0; h < this.english.length; h++) {
sf[sf.length] = this.lowen.charCodeAt(h);
sf[sf.length] = this.english.charCodeAt(h);
}
for(h = 0; h < 5; h++) {
for(g = 0; g < this.skey.length; g++) {
by[by.length] = this.skey[g];
}
}
for(h = 0; h < t.length; h++) {
by[by.length] = t[h];
}
got = true;
} else {
for(h = 0; h < a.length; h++) {
if(a[h] == uk) {
got = true;
by = by.concat(bya[h]);
sf = sf.concat(sfa[h]);
}
}
}
if(uk == this.moc) {
this.whit = true;
}
if(!got) {
if(noNormC) {
return;
} else {
return this.normC(w, k, i);
}
}
return this.DAWEOZ(k, w, by, sf, i, uk);
}
this.DAWEOZ = function(k, w, by, sf, i, uk) {
if((this.DAWEO.indexOf(uk) >= 0) || (this.Z.indexOf(uk) >= 0)) {
return this.tr(k, w, by, sf, i);
}
}
this.normC = function(w, k, i) {
var uk = this.up(k), u = this.repSign(null), fS, c, j, h, space = (k.charCodeAt(0) == 32) ? true : false;
if(!this.is_ie && space) {
return;
}
for(j = 1; j <= w.length; j++) {
for(h = 0; h < u.length; h++) {
if(u[h] == w.charCodeAt(w.length - j)) {
if(h <= 23) {
fS = this.S;
} else if(h <= 47) {
fS = this.F;
} else if(h <= 71) {
fS = this.J;
} else if(h <= 95) {
fS = this.R;
} else {
fS = this.X;
}
c = this.skey[h % 24];
if((this.alphabet.indexOf(uk) < 0) && (this.D2.indexOf(uk) < 0)) {
return w;
}
w = this.unV(w);
if(!space && !this.changed) {
w += k;
}
if(!this.is_ie) {
var sp = this.oc.selectionStart, pos = sp;
if(!this.changed) {
var sst = this.oc.scrollTop;
pos += k.length;
if(!this.oc.data) {
this.oc.value = this.oc.value.substr(0, sp) + k + this.oc.value.substr(this.oc.selectionEnd);
this.changed = true;
this.oc.scrollTop = sst;
} else {
this.oc.insertData(this.oc.pos, k);
this.oc.pos++;
this.range.setEnd(this.oc, this.oc.pos);
this.specialChange = true;
}
}
if(!this.oc.data) {
this.oc.setSelectionRange(pos, pos);
}
if(!this.ckspell(w, fS)) {
this.replaceChar(this.oc, i - j, c);
if(!this.oc.data) {
var a = [this.D];
this.main(w, fS, pos, a, false);
} else {
var ww = this.mozGetText(this.oc), a = [this.D];
this.main(ww[0], fS, ww[1], a, false);
}
}
} else {
var ret = this.sr(w, fS, 0);
if(space && ret) {
ret += this.fcc(32);
}
if(ret) {
return ret;
}
}
}
}
}
}
this.DAWEOF = function(cc, k, g) {
var ret = [g], kA = [this.A, this.moc, this.trang, this.E, this.O], z, a;
var ccA = [this.aA, this.mocA, this.trangA, this.eA, this.oA], ccrA = [this.arA, this.mocrA, this.arA, this.erA, this.orA];
for(a = 0; a < kA.length; a++) {
if(k == kA[a]) {
for(z = 0; z < ccA[a].length; z++) {
if(cc == ccA[a][z]) {
ret[1] = ccrA[a][z];
}
}
}
}
if(ret[1]) {
return ret;
} else {
return false;
}
}
this.retKC = function(k) {
if(k == this.S) {
return [225,7845,7855,233,7871,237,243,7889,7899,250,7913,253,193,7844,7854,201,7870,205,211,7888,7898,218,7912,221];
}
if(k == this.F) {
return [224,7847,7857,232,7873,236,242,7891,7901,249,7915,7923,192,7846,7856,200,7872,204,210,7890,7900,217,7914,7922];
}
if(k == this.J) {
return [7841,7853,7863,7865,7879,7883,7885,7897,7907,7909,7921,7925,7840,7852,7862,7864,7878,7882,7884,7896,7906,7908,7920,7924];
}
if(k == this.R) {
return [7843,7849,7859,7867,7875,7881,7887,7893,7903,7911,7917,7927,7842,7848,7858,7866,7874,7880,7886,7892,7902,7910,7916,7926];
}
if(k == this.X) {
return [227,7851,7861,7869,7877,297,245,7895,7905,361,7919,7929,195,7850,7860,7868,7876,296,213,7894,7904,360,7918,7928];
}
}
this.unV = function(w) {
var u = this.repSign(null), b, a;
for(a = 1; a <= w.length; a++) {
for(b = 0; b < u.length; b++) {
if(u[b] == w.charCodeAt(w.length - a)) {
w = w.substr(0, w.length - a) + this.fcc(this.skey[b % 24]) + w.substr(w.length - a + 1);
}
}
}
return w;
}
this.unV2 = function(w) {
var a, b;
for(a = 1; a <= w.length; a++) {
for(b = 0; b < this.skey.length; b++) {
if(this.skey[b] == w.charCodeAt(w.length - a)) {
w = w.substr(0, w.length - a) + this.skey2[b] + w.substr(w.length - a + 1);
}
}
}
return w;
}
this.repSign = function(k) {
var t = [], u = [], a, b;
for(a = 0; a < 5; a++) {
if((k == null)||(this.SFJRX.substr(a, 1) != this.up(k))) {
t = this.retKC(this.SFJRX.substr(a, 1));
for(b = 0; b < t.length; b++) u[u.length] = t[b];
}
}
return u;
}
this.sr = function(w, k, i) {
var sf = this.getSF(), pos = this.findC(w, k, sf);
if(pos) {
if(pos[1]) {
if(!this.is_ie) {
this.replaceChar(this.oc, i-pos[0], pos[1]);
} else {
return this.ie_replaceChar(w, pos[0], pos[1]);
}
} else {
var c = this.retUni(w, k, pos);
if (!this.is_ie) {
this.replaceChar(this.oc, i-pos, c);
} else {
return this.ie_replaceChar(w, pos, c);
}
}
}
return false;
}
this.retUni = function(w, k, pos) {
var u = this.retKC(this.up(k)), uC, lC, c = w.charCodeAt(w.length - pos), a, t = this.fcc(c);
for(a = 0; a < this.skey.length; a++) {
if(this.skey[a] == c) {
if(a < 12) {
lC=a;
uC=a+12;
} else {
lC = a - 12;
uC=a;
}
if(t != this.up(t)) {
return u[lC];
}
return u[uC];
}
}
}
this.ifInit = function(w) {
var sel = w.getSelection();
this.range = sel ? sel.getRangeAt(0) : document.createRange();
}
this.ifMoz = function(e) {
var code = e.which, avim = this.AVIM, cwi = e.target.parentNode.wi;
if(typeof(cwi) == "undefined") cwi = e.target.parentNode.parentNode.wi;
if(e.ctrlKey || (e.altKey && (code != 92) && (code != 126))) return;
avim.ifInit(cwi);
var node = avim.range.endContainer, newPos;
avim.sk = avim.fcc(code);
avim.saveStr = "";
if(avim.checkCode(code) || !avim.range.startOffset || (typeof(node.data) == 'undefined')) return;
node.sel = false;
if(node.data) {
avim.saveStr = node.data.substr(avim.range.endOffset);
if(avim.range.startOffset != avim.range.endOffset) {
node.sel=true;
}
node.deleteData(avim.range.startOffset, node.data.length);
}
avim.range.setEnd(node, avim.range.endOffset);
avim.range.setStart(node, 0);
if(!node.data) {
return;
}
node.value = node.data;
node.pos = node.data.length;
node.which=code;
avim.start(node, e);
node.insertData(node.data.length, avim.saveStr);
newPos = node.data.length - avim.saveStr.length + avim.kl;
avim.range.setEnd(node, newPos);
avim.range.setStart(node, newPos);
avim.kl = 0;
if(avim.specialChange) {
avim.specialChange = false;
avim.changed = false;
node.deleteData(node.pos - 1, 1);
}
if(avim.changed) {
avim.changed = false;
e.preventDefault();
}
}
this.FKeyPress = function() {
var obj = this.findF();
this.sk = this.fcc(obj.event.keyCode);
if(this.checkCode(obj.event.keyCode) || (obj.event.ctrlKey && (obj.event.keyCode != 92) && (obj.event.keyCode != 126))) {
return;
}
this.start(obj, this.sk);
}
this.checkCode = function(code) {
if(((AVIMGlobalConfig.onOff == 0) || ((code < 45) && (code != 42) && (code != 32) && (code != 39) && (code != 40) && (code != 43)) || (code == 145) || (code == 255))) {
return true;
}
}
this.notWord = function(w) {
var str = "\ \r\n#,\\;.:-_()<>+-*/=?!\"$%{}[]\'~|^\@\&\t" + this.fcc(160);
return (str.indexOf(w) >= 0);
}
this.nan = function(w) {
if (isNaN(w) || (w == 'e')) {
return true;
} else {
return false;
}
}
this.up = function(w) {
w = w.toUpperCase();
if(this.isKHTML) {
var str = "êôơâăưếốớấắứềồờầằừễỗỡẫẵữệộợậặự", rep="ÊÔƠÂĂƯẾỐỚẤẮỨỀỒỜẦẰỪỄỖỠẪẴỮỆỘỢẶỰ", z, io;
for(z = 0; z < w.length; z++) {
io = str.indexOf(w.substr(z, 1));
if(io >= 0) {
w = w.substr(0, z) + rep.substr(io, 1) + w.substr(z + 1);
}
}
}
return w;
}
this.findIgnore = function(el) {
var va = AVIMGlobalConfig.exclude, i;
for(i = 0; i < va.length; i++) {
if((el.id == va[i]) && (va[i].length > 0)) {
return true;
}
}
}
this.findF = function() {
var g;
for(g = 0; g < this.fID.length; g++) {
if(this.findIgnore(this.fID[g])) return;
this.frame = this.fID[g];
if(typeof(this.frame) != "undefined") {
try {
if (this.frame.contentWindow.document && this.frame.contentWindow.event) {
return this.frame.contentWindow;
}
} catch(e) {
if (this.frame.document && this.frame.event) {
return this.frame;
}
}
}
}
}
this.keyPressHandler = function(e) {
if(!this.support) {
return;
}
if(!this.is_ie) {
var el = e.target, code = e.which;
if(e.ctrlKey) {
return;
}
if(e.altKey && (code != 92) && (code != 126)) {
return;
}
} else {
var el = window.event.srcElement, code = window.event.keyCode;
if(window.event.ctrlKey && (code != 92) && (code != 126)) {
return;
}
}
if(((el.type != 'textarea') && (el.type != 'text')) || this.checkCode(code)) {
return;
}
this.sk = this.fcc(code);
if(this.findIgnore(el)) {
return;
}
if(!this.is_ie) {
this.start(el, e);
} else {
this.start(el, this.sk);
}
if(this.changed) {
this.changed = false;
return false;
}
return true;
}
this.attachEvt = function(obj, evt, handle, capture) {
if(this.is_ie) {
obj.attachEvent("on" + evt, handle);
} else {
obj.addEventListener(evt, handle, capture);
}
}
this.keyDownHandler = function(e) {
if(e == "iframe") {
this.frame = this.findF();
var key = this.frame.event.keyCode;
} else {
var key = (!this.is_ie) ? e.which : window.event.keyCode;
}
if (key == 123) {
document.getElementById('AVIMControl').style.display = (document.getElementById('AVIMControl').style.display == 'none') ? 'block' : 'none';
}
}
}
function AVIMInit(AVIM) {
var kkk = false;
if(AVIM.support && !AVIM.isKHTML) {
if(AVIM.is_opera) {
if(AVIM.operaVersion < 9) {
return;
}
}
for(AVIM.g = 0; AVIM.g < AVIM.fID.length; AVIM.g++) {
if(AVIM.findIgnore(AVIM.fID[AVIM.g])) {
continue;
}
if(AVIM.is_ie) {
var doc;
try {
AVIM.frame = AVIM.fID[AVIM.g];
if(typeof(AVIM.frame) != "undefined") {
if(AVIM.frame.contentWindow.document) {
doc = AVIM.frame.contentWindow.document;
} else if(AVIM.frame.document) {
doc = AVIM.frame.document;
}
}
} catch(e) {}
if(doc && ((AVIM.up(doc.designMode) == "ON") || doc.body.contentEditable)) {
for (var l = 0; l < AVIM.attached.length; l++) {
if (doc == AVIM.attached[l]) {
kkk = true;
break;
}
}
if (!kkk) {
AVIM.attached[AVIM.attached.length] = doc;
AVIM.attachEvt(doc, "keydown", function() {
AVIM.keyDownHandler("iframe");
}, false);
AVIM.attachEvt(doc, "keypress", function() {
AVIM.FKeyPress();
if(AVIM.changed) {
AVIM.changed = false;
return false;
}
}, false);
}
}
} else {
var iframedit;
try {
AVIM.wi = AVIM.fID[AVIM.g].contentWindow;
iframedit = AVIM.wi.document;
iframedit.wi = AVIM.wi;
if(iframedit && (AVIM.up(iframedit.designMode) == "ON")) {
iframedit.AVIM = AVIM;
AVIM.attachEvt(iframedit, "keypress", AVIM.ifMoz, false);
AVIM.attachEvt(iframedit, "keydown", AVIM.keyDownHandler, false);
}
} catch(e) {}
}
}
}
}
AVIMObj = new AVIM();
function AVIMAJAXFix() {
var a = 50;
while(a < 5000) {
setTimeout("AVIMInit(AVIMObj)", a);
a += 50;
}
}
AVIMAJAXFix();
AVIMObj.attachEvt(document, "mousedown", AVIMAJAXFix, false);
AVIMObj.attachEvt(document, "keydown", AVIMObj.keyDownHandler, true);
AVIMObj.attachEvt(document, "keypress", function(e) {
var a = AVIMObj.keyPressHandler(e);
if (a == false) {
if (AVIMObj.is_ie) window.event.returnValue = false;
else e.preventDefault();
}
}, true);
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/Javascript/Guest/avim.js | JavaScript | asf20 | 40,284 |
/*
* jFlip plugin for jQuery v0.4 (28/2/2009)
*
* A plugin to make a page flipping gallery
*
* Copyright (c) 2008-2009 Renato Formato (rformato@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
*/
;(function($){
var Flip = function(canvas,width,height,images,opts) {
//private vars
opts = $.extend({background:"green",cornersTop:true,scale:"noresize"},opts);
var obj = this,
el = canvas.prev(),
index = 0,
init = false,
background = opts.background,
cornersTop = opts.cornersTop,
gradientColors = opts.gradientColors || ['#4F2727','#FF8F8F','#F00'],
curlSize = opts.curlSize || 0.1,
scale = opts.scale,
patterns = [],
canvas2 = canvas.clone(),
ctx2 = $.browser.msie?null:canvas2[0].getContext("2d"),
canvas = $.browser.msie?$(G_vmlCanvasManager.initElement(canvas[0])):canvas,
ctx = canvas[0].getContext("2d"),
loaded = 0;
var images = images.each(function(i){
if(patterns[i]) return;
var img = this;
img.onload = function() {
var r = 1;
if(scale!="noresize") {
var rx = width/this.width,
ry = height/this.height;
if(scale=="fit")
r = (rx<1 || ry<1)?Math.min(rx,ry):1;
if(scale=="fill") {
r = Math.min(rx,ry);
}
};
$(img).data("flip.scale",r);
patterns[i] = ctx.createPattern(img,"no-repeat");
loaded++;
if(loaded==images.length && !init) {
init = true;
draw();
}
};
if(img.complete)
window.setTimeout(function(){img.onload()},10);
}).get();
var
width = width,height = height,mX = width,mY = height,
basemX = mX*(1-curlSize), basemY = mY*curlSize,sideLeft = false,
off = $.browser.msie?canvas.offset():null,
onCorner = false,
curlDuration=400,curling = false,
animationTimer,startDate,
flipDuration=700,flipping = false,baseFlipX,baseFlipY,
lastmX,lastmY,
inCanvas = false,
mousedown = false,
dragging = false;
$(window).scroll(function(){
//off = canvas.offset(); //update offset on scroll
});
//IE can't handle correctly mouseenter and mouseleave on VML
var c = $.browser.msie?(function(){
var div = $("<div>").width(width).height(height).css({position:"absolute",cursor:"default",zIndex:1}).appendTo("body");
//second hack for IE7 that can't handle correctly mouseenter and mouseleave if the div has no background color
if(parseInt($.browser.version)==7)
div.css({opacity:0.000001,background:"#FFF"});
var positionDiv = function() {
off = canvas.offset();
return div.css({left:off.left+'px',top:off.top+'px'});
}
$(window).resize(positionDiv);
return positionDiv();
})():canvas;
c.mousemove(function(e){
//track the mouse
/*
if(!off) off = canvas.offset(); //safari can't calculate correctly offset at DOM ready
mX = e.clientX-off.left;
mY = e.clientY-off.top;
window.setTimeout(draw,0);
return;
*/
if(!off)
off = canvas.offset(); //safari can't calculate correctly offset at DOM ready
if(mousedown && onCorner) {
if(!dragging) {
dragging = true;
window.clearInterval(animationTimer);
}
mX = !sideLeft?e.pageX-off.left:width-(e.pageX-off.left);
mY = cornersTop?e.pageY-off.top:height-(e.pageY-off.top);
window.setTimeout(draw,0);
return false;
}
lastmX = e.pageX||lastmX, lastmY = e.pageY||lastmY;
if(!flipping) {
sideLeft = (lastmX-off.left)<width/2;
//cornersTop = (lastmY-off.top)<height/2;
}
if(!flipping &&
((lastmX-off.left)>basemX || (lastmX-off.left)<(width-basemX)) &&
((cornersTop && (lastmY-off.top)<basemY) || (!cornersTop && (lastmY-off.top)>(height-basemY)))) {
if(!onCorner) {
onCorner= true;
c.css("cursor","pointer");
}
} else {
if(onCorner) {
onCorner= false;
c.css("cursor","default");
}
};
return false;
}).bind("mouseenter",function(e){
inCanvas = true;
if(flipping) return;
window.clearInterval(animationTimer);
startDate = new Date().getTime();
animationTimer = window.setInterval(cornerCurlIn,10);
return false;
}).bind("mouseleave",function(e){
inCanvas = false;
dragging = false;
mousedown = false;
if(flipping) return;
window.clearInterval(animationTimer);
startDate = new Date().getTime();
animationTimer = window.setInterval(cornerCurlOut,10);
return false;
}).click(function(){
if(onCorner && !flipping) {
flipping = true;
c.triggerHandler("mousemove");
window.clearInterval(animationTimer);
startDate = new Date().getTime();
baseFlipX = mX;
baseFlipY = mY;
animationTimer = window.setInterval(flip,10);
index += sideLeft?-1:1;
if(index<0) index = images.length-1;
if(index==images.length) index = 0;
el.trigger("flip.jflip",[index,images.length]);
}
return false;
}).mousedown(function(){
dragging = false;
mousedown = true;
return false;
}).mouseup(function(){
mousedown = false;
return false;
});
var flip = function() {
var date = new Date(),delta = date.getTime()-startDate;
if(delta>=flipDuration) {
window.clearInterval(animationTimer);
if(sideLeft) {
images.unshift(images.pop());
patterns.unshift(patterns.pop());
} else {
images.push(images.shift());
patterns.push(patterns.shift());
}
mX = width;
mY = height;
draw();
flipping = false;
//init corner move if still in Canvas
if(inCanvas) {
startDate = new Date().getTime();
animationTimer = window.setInterval(cornerCurlIn,10);
c.triggerHandler("mousemove");
}
return;
}
//da mX a -width (mX+width) in duration millisecondi
mX = baseFlipX-2*(width)*delta/flipDuration;
mY = baseFlipY+2*(height)*delta/flipDuration;
draw();
},
cornerMove = function() {
var date = new Date(),delta = date.getTime()-startDate;
mX = basemX+Math.sin(Math.PI*2*delta/1000);
mY = basemY+Math.cos(Math.PI*2*delta/1000);
drawing = true;
window.setTimeout(draw,0);
},
cornerCurlIn = function() {
var date = new Date(),delta = date.getTime()-startDate;
if(delta>=curlDuration) {
window.clearInterval(animationTimer);
startDate = new Date().getTime();
animationTimer = window.setInterval(cornerMove,10);
}
mX = width-(width-basemX)*delta/curlDuration;
mY = basemY*delta/curlDuration;
draw();
},
cornerCurlOut = function() {
var date = new Date(),delta = date.getTime()-startDate;
if(delta>=curlDuration) {
window.clearInterval(animationTimer);
}
mX = basemX+(width-basemX)*delta/curlDuration;
mY = basemY-basemY*delta/curlDuration;
draw();
},
curlShape = function(m,q) {
//cannot draw outside the viewport because of IE blurring the pattern
var intyW = m*width+q,intx0 = -q/m;
if($.browser.msie) {
intyW = Math.round(intyW);
intx0 = Math.round(intx0);
};
ctx.beginPath();
ctx.moveTo(width,Math.min(intyW,height));
ctx.lineTo(width,0);
ctx.lineTo(Math.max(intx0,0),0);
if(intx0<0) {
ctx.lineTo(0,Math.min(q,height));
if(q<height) {
ctx.lineTo((height-q)/m,height);
}
ctx.lineTo(width,height);
} else {
if(intyW<height)
ctx.lineTo(width,intyW);
else {
ctx.lineTo((height-q)/m,height);
ctx.lineTo(width,height);
}
}
},
draw = function() {
if(!init) return;
if($.browser.msie)
ctx.clearRect(0,0,width,height);
ctx.fillStyle = background;
ctx.fillRect(0,0,width,height);
var img = images[0], r = $(img).data("flip.scale");
if($.browser.msie) {
ctx.fillStyle = patterns[0];
ctx.fillStyle.width2 = ctx.fillStyle.width*r;
ctx.fillStyle.height2 = ctx.fillStyle.height*r;
ctx.fillRect(0,0,width,height);
} else {
ctx.drawImage(img,(width-img.width*r)/2,(height-img.height*r)/2,img.width*r,img.height*r);
}
if(mY && mX!=width) {
var m = 2,
q = (mY-m*(mX+width))/2;
m2 = mY/(width-mX),
q2 = mX*m2;
if(m==m2) return;
var sx=1,sy=1,tx=0,ty=0;
ctx.save();
if(sideLeft) {
tx = width;
sx = -1;
}
if(!cornersTop) {
ty = height;
sy = -1;
}
ctx.translate(tx,ty);
ctx.scale(sx,sy);
//draw page flip
//intx,inty is the intersection between the line of the curl and the line
//from the canvas corner to the curl point
var intx = (q2-q)/(m-m2);
var inty = m*intx+q;
//y=m*x+mY-m*mX line per (mX,mY) parallel to the curl line
//y=-x/m+inty+intx/m line perpendicular to the curl line
//intersection x between the 2 lines = int2x
//y of perpendicular for the intersection x = int2y
//opera do not fill a shape if gradient is finished
var int2x = (2*inty+intx+2*m*mX-2*mY)/(2*m+1);
var int2y = -int2x/m+inty+intx/m;
var d = Math.sqrt(Math.pow(intx-int2x,2)+Math.pow(inty-int2y,2));
var stopHighlight = Math.min(d*0.5,30);
var c;
if(!($.browser.mozilla && parseFloat($.browser.version)<1.9)) {
c = ctx;
} else {
c = ctx2;
c.clearRect(0,0,width,height);
c.save();
c.translate(1,0); //the curl shapes do not overlap perfeclty
}
var gradient = c.createLinearGradient(intx,inty,int2x,int2y);
gradient.addColorStop(0, gradientColors[0]);
gradient.addColorStop(stopHighlight/d, gradientColors[1]);
gradient.addColorStop(1, gradientColors[2]);
c.fillStyle = gradient;
c.beginPath();
c.moveTo(-q/m,0);
c.quadraticCurveTo((-q/m+mX)/2+0.02*mX,mY/2,mX,mY);
c.quadraticCurveTo((width+mX)/2,(m*width+q+mY)/2-0.02*(height-mY),width,m*width+q);
if(!($.browser.mozilla && parseFloat($.browser.version)<1.9)) {
c.fill();
} else {
//for ff 2.0 use a clip region on a second canvas and copy all its content (much faster)
c.save();
c.clip();
c.fillRect(0,0,width,height);
c.restore();
ctx.drawImage(canvas2[0],0,0);
c.restore();
}
//can't understand why this doesn't work on ff 2, fill is slow
/*
ctx.save();
ctx.clip();
ctx.fillRect(0,0,width,height);
ctx.restore();
*/
gradient = null;
//draw solid color background
ctx.fillStyle = background;
curlShape(m,q);
ctx.fill();
//draw back image
curlShape(m,q);
//safari and opera delete the path when doing restore
if(!$.browser.safari && !$.browser.opera)
ctx.restore();
var img = sideLeft?images[images.length-1]:images[1];
r = $(img).data("flip.scale");
if($.browser.msie) {
//excanvas does not support clip
ctx.fillStyle = sideLeft?patterns[patterns.length-1]:patterns[1];
//hack to scale the pattern on IE (modified excanvas)
ctx.fillStyle.width2 = ctx.fillStyle.width*r;
ctx.fillStyle.height2 = ctx.fillStyle.height*r;
ctx.fill();
} else {
ctx.save();
ctx.clip();
//safari and opera delete the path when doing restore
//at this point we have not reverted the trasform
if($.browser.safari || $.browser.opera) {
//revert transform
ctx.scale(1/sx,1/sy);
ctx.translate(-tx,-ty);
}
ctx.drawImage(img,(width-img.width*r)/2,(height-img.height*r)/2,img.width*r,img.height*r);
//ctx.drawImage(img,(width-img.width)/2,(height-img.height)/2);
ctx.restore();
if($.browser.safari || $.browser.opera)
ctx.restore()
}
}
}
}
$.fn.jFlip = function(width,height,opts){
return this.each(function() {
$(this).wrap("<div class='flip_gallery'>");
var images = $(this).find("img");
//cannot hide because explorer does not give the image dimensions if hidden
var canvas = $(document.createElement("canvas")).attr({width:width,height:height}).css({margin:0,width:width+"px",height:height+"px"})
$(this).css({position:"absolute",left:"-9000px",top:"-9000px"}).after(canvas);
new Flip($(this).next(),width || 300,height || 300,images,opts);
});
};
})(jQuery);
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/Javascript/Admin/jquery.jflip-0.4.js | JavaScript | asf20 | 14,143 |
$(document).ready(function() {
//Sidebar Accordion Menu:
$("#main-nav li ul").hide(); //Hide all sub menus
$("#main-nav li a.current").parent().find("ul").slideToggle("slow"); // Slide down the current menu item's sub menu
$("#main-nav li a.nav-top-item").click( // When a top menu item is clicked...
function() {
$(this).parent().siblings().find("ul").slideUp("normal"); // Slide up all sub menus except the one clicked
$(this).next().slideToggle("normal"); // Slide down the clicked sub menu
if ($(this).attr("href") == null || $(this).attr("href") == "" || $(this).attr("href") == "#") {
return false;
}
}
);
// Sidebar Accordion Menu Hover Effect:
$("#main-nav li .nav-top-item").hover(
function() {
$(this).stop();
$(this).animate({ paddingRight: "25px" }, 200);
},
function() {
$(this).stop();
$(this).animate({ paddingRight: "15px" });
}
);
//Minimize Content Box
$(".content-box-header h3").css({ "cursor": "s-resize" }); // Give the h3 in Content Box Header a different cursor
$(".content-box-header-toggled").next().hide(); // Hide the content of the header if it has the class "content-box-header-toggled"
$(".content-box-header h3").click( // When the h3 is clicked...
function() {
$(this).parent().parent().find(".content-box-content").toggle(); // Toggle the Content Box
$(this).parent().toggleClass("content-box-header-toggled"); // Give the Content Box Header a special class for styling and hiding
$(this).parent().find(".content-box-tabs").toggle(); // Toggle the tabs
}
);
// Content box tabs:
$('.content-box .content-box-content div.tab-content').hide(); // Hide the content divs
$('.content-box-content div.default-tab').show(); // Show the div with class "default-tab"
$('ul.content-box-tabs li a.default-tab').addClass('current'); // Set the class of the default tab link to "current"
$('.content-box ul.content-box-tabs li a').click( //When a tab is clicked...
function() {
$(this).parent().siblings().find("a").removeClass('current'); // Remove "current" class from all tabs
$(this).addClass('current'); // Add class "current" to clicked tab
var currentTab = $(this).attr('href'); // Set variable "currentTab" to the value of href of clicked tab
$(currentTab).siblings().hide(); // Hide all content divs
$(currentTab).show(); // Show the content div with the id equal to the id of clicked tab
return false;
}
);
// Check all checkboxes when the one in a table head is checked:
$('.check-all').click(
function() {
$(this).parent().parent().parent().parent().find("input[type='checkbox']").attr('checked', $(this).is(':checked'));
}
)
});
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Resources/Javascript/Admin/simpla.jquery.configuration.js | JavaScript | asf20 | 2,909 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace EC2011_hk2_BT1_1041448.MasterPages
{
public partial class WebForm4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Contact.aspx.cs | C# | asf20 | 358 |
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Admin.Master" AutoEventWireup="true" CodeBehind="Contact.aspx.cs" Inherits="EC2011_hk2_BT1_1041448.MasterPages.WebForm4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_title" runat="server">
Contact page
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="javascript_extenation" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="content_header" runat="server">
Contact page
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="server">
<asp:Panel ID="Panel1" runat="server">
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/ads.xml" Target="_blank"/>
</asp:Panel>
</asp:Content>
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Contact.aspx | ASP.NET | asf20 | 786 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EC2011_hk2_BT1_1041448")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("EC2011_hk2_BT1_1041448")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Properties/AssemblyInfo.cs | C# | asf20 | 1,433 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace EC2011_hk2_BT1_1041448.MasterPages
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Default.aspx.cs | C# | asf20 | 358 |
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Admin.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EC2011_hk2_BT1_1041448.MasterPages.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_title" runat="server">
Home page
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="javascript_extenation" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="content_header" runat="server">
My Informations
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="server">
<asp:Panel ID="Panel1" runat="server" CssClass="content_center">
<asp:BulletedList ID="BulletedList1" runat="server" BulletStyle="Numbered" >
<asp:ListItem>Fullname : Hoàng Nguyễn Minh Tuấn.</asp:ListItem>
<asp:ListItem>Student id : 1041448.</asp:ListItem>
<asp:ListItem>Class : 10HC.</asp:ListItem>
<asp:ListItem>Specialized : Information systems.</asp:ListItem>
<asp:ListItem>Birth of day : 16/10/1988.</asp:ListItem>
<asp:ListItem>Gender : Male.</asp:ListItem>
<asp:ListItem>Interestings : Football, Classical Music, Computer Books, Adventure Books.</asp:ListItem>
</asp:BulletedList>
</asp:Panel>
</asp:Content>
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Default.aspx | ASP.NET | asf20 | 1,345 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace EC2011_hk2_BT1_1041448.MasterPages
{
public partial class WebForm3 : System.Web.UI.Page
{
private Label _response;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.Calendar1.SelectedDate = DateTime.Now;
}
}
protected void Calendar1OnChanged(object sender, EventArgs e){
_response = new Label();
_response.Text = "My activities on day : " + this.Calendar1.SelectedDate.ToLongDateString();
this.Panel2.Controls.Add(_response);
}
}
}
| 1041448-ec-daily-practices | trunk/Week01/EC2011-hk2-BT1-1041448/EC2011-hk2-BT1-1041448/Activities.aspx.cs | C# | asf20 | 811 |