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
#ifndef HAND_H #define HAND_H #include "includes.h" #include "Card.h" class Hand : public QList<CardID> { public: explicit Hand(); private: }; #endif // HAND_H
1000-bornes
trunk/src/engine/Hand.h
C++
gpl3
180
#include "Player.h" Player::Player(QString name) { this->name = name; } QString Player::getName() const { return name; } Hand Player::getHand() const { return hand; }
1000-bornes
trunk/src/engine/Player.cpp
C++
gpl3
188
#include "Team.h" Team::Team() { tableau = new Tableau(this); } Team::~Team() { // Deleting players and tableau qDebug() << "~Team()"; for (int i=0; i<size(); i++) { delete this->at(i); } //foreach(Player* player, this) { // delete player; //} delete tableau; } Tableau* Team::getTableau() { return tableau; } /** * Add a player to the team. * (proxy for native method, if further restrictions are needed) */ void Team::addPlayer(Player* player) { //if (this->size() < 3) this->append(player); }
1000-bornes
trunk/src/engine/Team.cpp
C++
gpl3
566
#ifndef DRAWPILE_H #define DRAWPILE_H #include "includes.h" #include "Card.h" class DrawPile : public QList<CardID> { public: explicit DrawPile(); }; #endif // DRAWPILE_H
1000-bornes
trunk/src/engine/DrawPile.h
C++
gpl3
187
#include <QtGui/QApplication> #include "includes.h" #include "Tableau.h" #include "CardInfo.h" #include "Skin.h" #include "MainWindow.h" #include "RaceInfo.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); /* RaceInfo info; qDebug() << info; info.numberOfCards = 42; info.extensionAllowed = true; info.normalDistance = 700; qDebug() << info; QByteArray data; //data.append("Lol"); QDataStream out(&data, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_6); out << info; RaceInfo n; qDebug() << n; QDataStream in(data); // in(&data,QIODevice::ReadOnly); in >> n; qDebug() << n; */ /*CardID id = Card::cardForProperties(CardInfo::Function_Safety, CardInfo::Nature_Light); CardInfo* nfo = Card::getInfo(id); if (nfo != NULL) qDebug() << nfo->getName(); else qDebug() << "NULL"; */ Team team; Tableau* t = team.getTableau(); Player *p1, *p2; p1 = new Player("Ore-sama"); p2 = new Player("Temee"); team.addPlayer(p1); t->setWinDistance(500); /* t->play(Card::CardID_Distance_200); t->play(Card::CardID_Distance_100); t->play(Card::CardID_Distance_25); qDebug() << t->canPlay(p1,Card::CardID_Hazard_Accident) << t->canPlay(p2,Card::CardID_Hazard_Accident); t->play(Card::CardID_Remedy_Roll); t->play(Card::CardID_Hazard_); t->play(Card::CardID_Safety_DrivingAce); t->play(Card::CardID_Safety_DrivingAce); qDebug() << t->canPlay(p1,Card::CardID_Hazard_Accident) << t->canPlay(p2,Card::CardID_Hazard_Accident); */ //qDebug() << "Roll: " << t->canRollDistance(); return a.exec(); }
1000-bornes
trunk/src/main.cpp
C++
gpl3
1,732
#include "Properties.h" // Application const QString Properties::ORGANIZATION = "SGC"; const QString Properties::APPLICATION = "1000 Bornes"; const QString Properties::SETTINGS = "settings.ini"; // Networking const quint16 Properties::DEFAULT_LISTENPORT = 1313; // Cards informations const QString Properties::DEFAULT_EXTENSION = "png"; const QString Properties::DEFAULT_CARDPATH = ":/cards/"; const QString Properties::CARD_APPEND = "_t"; const QString Properties::SKINSPATH = "skins/"; const QString Properties::SKINSNFO = "info.ini"; // Cards file basenames const QString Properties::FILENAME_Distance_25 = "Distance_25"; const QString Properties::FILENAME_Distance_50 = "Distance_50"; const QString Properties::FILENAME_Distance_75 = "Distance_75"; const QString Properties::FILENAME_Distance_100 = "Distance_100"; const QString Properties::FILENAME_Distance_200 = "Distance_200"; const QString Properties::FILENAME_Hazard_OutOfGas = "Hazard_OutOfGas"; const QString Properties::FILENAME_Hazard_FlatTire = "Hazard_FlatTire"; const QString Properties::FILENAME_Hazard_Accident = "Hazard_Accident"; const QString Properties::FILENAME_Hazard_SpeedLimit = "Hazard_SpeedLimit"; const QString Properties::FILENAME_Hazard_Stop = "Hazard_Stop"; const QString Properties::FILENAME_Remedy_Gasoline = "Remedy_Gasoline"; const QString Properties::FILENAME_Remedy_SpareTire = "Remedy_SpareTire"; const QString Properties::FILENAME_Remedy_Repair = "Remedy_Repair"; const QString Properties::FILENAME_Remedy_EndOfLimit = "Remedy_EndOfLimit"; const QString Properties::FILENAME_Remedy_Roll = "Remedy_Roll"; const QString Properties::FILENAME_Safety_ExtraTank = "Safety_ExtraTank"; const QString Properties::FILENAME_Safety_PunctureProof = "Safety_PunctureProof"; const QString Properties::FILENAME_Safety_DrivingAce = "Safety_DrivingAce"; const QString Properties::FILENAME_Safety_RightOfWay = "Safety_RightOfWay"; const QString Properties::FILENAME_CardBack = "cardback"; const QString Properties::FILENAME_CoupFourre = "coupfourre";
1000-bornes
trunk/src/Properties.cpp
C++
gpl3
2,082
package com.google.gwt.sample.stockwatcher.client.service; import java.util.List; import com.google.gwt.sample.stockwatcher.client.shared.StockBuy; import com.google.gwt.sample.stockwatcher.client.shared.StockPrice; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath("stockPrices") public interface StockPriceService extends RemoteService { StockPrice[] getPrices(List<String> symbols); StockBuy buyStock(StockBuy stockBuy); List<StockBuy> getStockBuyingHistory(); }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/service/StockPriceService.java
Java
gpl3
586
package com.google.gwt.sample.stockwatcher.client.service; import java.util.List; import com.google.gwt.sample.stockwatcher.client.shared.StockBuy; import com.google.gwt.sample.stockwatcher.client.shared.StockPrice; import com.google.gwt.user.client.rpc.AsyncCallback; public interface StockPriceServiceAsync { void getPrices(List<String> symbol, AsyncCallback<StockPrice[]> callback); void buyStock(StockBuy stockBuy, AsyncCallback<StockBuy> callback); void getStockBuyingHistory(AsyncCallback<List<StockBuy>> callback); }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/service/StockPriceServiceAsync.java
Java
gpl3
549
package com.google.gwt.sample.stockwatcher.client.presenter; public interface BuyStockPresenter extends Presenter<BuyStockPresenter.Display> { public interface Display extends com.google.gwt.sample.stockwatcher.client.view.Display { void displaySymbol(String symbol); void displayPrice(String price); void setPresenter(BuyStockPresenter presenter); } void onSaveButtonClicked(Long amount); void onCancelButtonClicked(); }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/presenter/BuyStockPresenter.java
Java
gpl3
445
package com.google.gwt.sample.stockwatcher.client.presenter; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.sample.stockwatcher.client.view.Display; /** * */ public abstract class BasePresenter<D extends Display> implements Presenter<D> { protected final HandlerManager eventBus; protected final D display; public BasePresenter(HandlerManager eventBus, D display) { this.eventBus = eventBus; this.display = display; } @Override public void bind() { onBind(); postBind(); } /** * Do actually event binding. */ protected abstract void onBind(); /** * Override in case data init after bind. */ protected void postBind() { } public D getDisplay() { return this.display; } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/presenter/BasePresenter.java
Java
gpl3
740
package com.google.gwt.sample.stockwatcher.client.presenter; import java.util.ArrayList; import java.util.List; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.sample.stockwatcher.client.event.BuyStockEvent; import com.google.gwt.sample.stockwatcher.client.service.StockPriceServiceAsync; import com.google.gwt.sample.stockwatcher.client.shared.StockBuy; import com.google.gwt.sample.stockwatcher.client.shared.StockPrice; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; public class StockWatcherPresenterImpl extends BasePresenter<StockWatcherPresenter.Display> implements StockWatcherPresenter { private List<String> symbolList = new ArrayList<String>(); private StockPriceServiceAsync rpcService; public StockWatcherPresenterImpl(StockPriceServiceAsync rpcService, HandlerManager eventBus, Display view) { super(eventBus, view); this.rpcService = rpcService; } @Override protected void onBind() { } private void addStock(final String symbol) { if (!symbol.matches("^[0-9a-zA-Z\\.]{1,10}$")) { Window.alert("'" + symbol + "' is not a valid symbol."); return; } if (symbolList.contains(symbol)) { Window.alert("Unique constraint of symbol."); return; } symbolList.add(symbol); display.addNewRow(symbol); refreshWatchList(); display.getRemoveButton(symbol).addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { display.removeRow(symbol); symbolList.remove(symbol); } }); display.getBuyButton(symbol).addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final double price = Double.parseDouble(display .getPrice(symbol)); StockPrice stockPrice = new StockPrice(symbol, price); eventBus.fireEvent(new BuyStockEvent(stockPrice)); } }); } private void refreshWatchList() { this.rpcService.getPrices(this.symbolList, new AsyncCallback<StockPrice[]>() { @Override public void onFailure(Throwable caught) { Window.alert("refreshWatchList error"); } @Override public void onSuccess(StockPrice[] result) { for (int i = 0; i < result.length; i++) { int row = i + 1; display.updatePrice(row, result[i].getPrice()); display.updateChangePercent(row, result[i] .getChange(), result[i].getChangePercent()); } } }); } /** * TODO: duplicated row. */ private void refreshBuyingHistory() { this.rpcService .getStockBuyingHistory(new AsyncCallback<List<StockBuy>>() { @Override public void onFailure(Throwable caught) { Window.alert("refreshBuyingHistory error" + caught.getMessage()); } @Override public void onSuccess(List<StockBuy> result) { for (StockBuy stockBuy : result) { display.addNewBuyingHistory(stockBuy.getSymbol(), String.valueOf(stockBuy.getPrice()), String .valueOf(stockBuy.getCount())); } } }); } @Override protected void postBind() { refreshWatchList(); refreshBuyingHistory(); } @Override public void onAddButtonClicked(String value) { addStock(value); } @Override public void onInputBoxEnterKeyPressed(String value) { addStock(value); } // private void scheduleTimeRefresh() { // // Setup timer to refresh list automatically. // Timer refreshTimer = new Timer() { // @Override // public void run() { // refreshWatchList(); // } // }; // refreshTimer.scheduleRepeating(REFRESH_INTERVAL); // } // private static final int REFRESH_INTERVAL = 2000; }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/presenter/StockWatcherPresenterImpl.java
Java
gpl3
3,739
package com.google.gwt.sample.stockwatcher.client.presenter; import com.google.gwt.event.dom.client.HasClickHandlers; public interface StockWatcherPresenter extends Presenter<StockWatcherPresenter.Display> { public interface Display extends com.google.gwt.sample.stockwatcher.client.view.Display { /** * Get the Remove button for <code>symbol<code>. */ HasClickHandlers getRemoveButton(String symbol); HasClickHandlers getBuyButton(String symbol); /** * Add new Row that has the <code>symbol<code> into Table */ void addNewRow(String symbol); /** * Remove the Row that has the <code>symbol<code> in the Table */ void removeRow(String symbol); /** * Get price of current row. */ String getPrice(String symbol); /** * TODO: Add a single API to update Price and ChangePercentage. */ void updateChangePercent(int row, double change, double changePercent); void updatePrice(int row, double value); void addNewBuyingHistory(String symbol, String price, String count); void setPresenter(StockWatcherPresenter presenter); } // void refreshWatchList(); // void refreshBuyingHistory(); void onAddButtonClicked(String value); void onInputBoxEnterKeyPressed(String value); }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/presenter/StockWatcherPresenter.java
Java
gpl3
1,249
package com.google.gwt.sample.stockwatcher.client.presenter; import com.google.gwt.sample.stockwatcher.client.view.Display; /** * Presenter Interface. */ public interface Presenter<D extends Display> { void bind(); D getDisplay(); }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/presenter/Presenter.java
Java
gpl3
241
package com.google.gwt.sample.stockwatcher.client.presenter; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.sample.stockwatcher.client.event.ShowStockWaterEvent; import com.google.gwt.sample.stockwatcher.client.service.StockPriceServiceAsync; import com.google.gwt.sample.stockwatcher.client.shared.StockBuy; import com.google.gwt.sample.stockwatcher.client.shared.StockPrice; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; public class BuyStockPresenterImpl extends BasePresenter<BuyStockPresenter.Display> implements BuyStockPresenter { private StockPriceServiceAsync rpcService; private StockPrice stockPrice; public BuyStockPresenterImpl(StockPriceServiceAsync rpcService, HandlerManager eventBus, Display view, StockPrice stockPrice) { super(eventBus, view); this.rpcService = rpcService; this.stockPrice = stockPrice; displayValue(stockPrice); } private void displayValue(StockPrice stockPrice) { display.displaySymbol(stockPrice.getSymbol()); display.displayPrice(String.valueOf(stockPrice.getPrice())); } @Override public void onCancelButtonClicked() { eventBus.fireEvent(new ShowStockWaterEvent()); } @Override public void onSaveButtonClicked(Long amount) { StockBuy stockBuy = new StockBuy(this.stockPrice.getSymbol(), this.stockPrice.getPrice(), amount); rpcService.buyStock(stockBuy, new AsyncCallback<StockBuy>() { @Override public void onSuccess(StockBuy result) { eventBus.fireEvent(new ShowStockWaterEvent()); } @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } }); } @Override protected void onBind() { } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/presenter/BuyStockPresenterImpl.java
Java
gpl3
1,721
package com.google.gwt.sample.stockwatcher.client.view; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.HasClickHandlers; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.i18n.client.NumberFormat; import com.google.gwt.sample.stockwatcher.client.presenter.StockWatcherPresenter; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.uibinder.client.UiTemplate; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.Widget; /** * */ public class StockWatcherView extends Composite implements StockWatcherPresenter.Display { /** * FlexTable is used when you have content added/removed dynamically - which * means you won't be adding stuff via UiBinder templates (that doesn't even * makes sense). */ @UiField FlexTable stocksFlexTable = new FlexTable(); @UiField FlexTable buyingHistory = new FlexTable(); @UiField TextBox newSymbolTextBox; @UiField Button addButton; private StockWatcherPresenter presenter; @UiTemplate("StockWatcherView.ui.xml") interface StockWatcherViewUiBinder extends UiBinder<Widget, StockWatcherView> { } private static StockWatcherViewUiBinder uiBinder = GWT .create(StockWatcherViewUiBinder.class); public StockWatcherView() { initWidget(uiBinder.createAndBindUi(this)); buildStocksTable(); buildBuyingHistoryTable(); // this.newSymbolTextBox.setFocus(true); } private void buildBuyingHistoryTable() { buyingHistory.setText(0, 0, "Symbol"); buyingHistory.setText(0, 1, "Price"); buyingHistory.setText(0, 2, "Count"); // stocksFlexTable.setCellPadding(6); buyingHistory.getRowFormatter().addStyleName(0, "watchListHeader"); buyingHistory.addStyleName("watchList"); buyingHistory.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn"); buyingHistory.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn"); } private void buildStocksTable() { // Create table for stock data. stocksFlexTable.setText(0, 0, "Symbol"); stocksFlexTable.setText(0, 1, "Price"); stocksFlexTable.setText(0, 2, "Change"); stocksFlexTable.setText(0, 3, "Remove"); stocksFlexTable.setText(0, 4, "Buy"); // Add styles to elements in the stock list table. stocksFlexTable.setCellPadding(6); stocksFlexTable.getRowFormatter().addStyleName(0, "watchListHeader"); stocksFlexTable.addStyleName("watchList"); stocksFlexTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn"); stocksFlexTable.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn"); stocksFlexTable.getCellFormatter().addStyleName(0, 3, "watchListButtonColumn"); stocksFlexTable.getCellFormatter().addStyleName(0, 4, "watchListButtonColumn"); } @UiHandler("addButton") void onAddButtonClicked(ClickEvent event) { if (presenter != null) { presenter.onAddButtonClicked(newSymbolTextBox.getValue()); } } @UiHandler("newSymbolTextBox") void onInputBoxEnterKeyPressed(KeyPressEvent event) { if (presenter != null && event.getCharCode() == KeyCodes.KEY_ENTER) { presenter.onInputBoxEnterKeyPressed(newSymbolTextBox.getValue()); } } // ============================================== // ========================= Override // ============================================== @Override public void setPresenter(StockWatcherPresenter presenter) { this.presenter = presenter; } @Override public Widget asWidget() { return this; } @Override public HasClickHandlers getRemoveButton(String symbol) { return (HasClickHandlers) stocksFlexTable.getWidget( findRowNumberOfSymbol(symbol), 3); } @Override public HasClickHandlers getBuyButton(String symbol) { return (HasClickHandlers) stocksFlexTable.getWidget( findRowNumberOfSymbol(symbol), 4); } @Override public void updatePrice(int row, double value) { String priceText = NumberFormat.getFormat("#,##0.00").format(value); stocksFlexTable.setText(row, 1, priceText); } @Override public String getPrice(String symbol) { return stocksFlexTable.getText(findRowNumberOfSymbol(symbol), 1); } @Override public void updateChangePercent(int row, double change, double changePercent) { NumberFormat changeFormat = NumberFormat .getFormat("+#,##0.00;-#,##0.00"); String changeText = changeFormat.format(change); String changePercentText = changeFormat.format(changePercent); Label changeWidget = (Label) stocksFlexTable.getWidget(row, 2); changeWidget.setText(changeText + " (" + changePercentText + "%)"); String changeStyleName = "noChange"; if (changePercent < -0.1f) { changeStyleName = "negativeChange"; } else if (changePercent > 0.1f) { changeStyleName = "positiveChange"; } changeWidget.setStyleName(changeStyleName); } @Override public void addNewRow(String symbol) { int row = stocksFlexTable.getRowCount(); stocksFlexTable.setText(row, 0, symbol); stocksFlexTable.setWidget(row, 2, new Label()); stocksFlexTable.getCellFormatter().addStyleName(row, 1, "watchListNumericColumn"); stocksFlexTable.getCellFormatter().addStyleName(row, 2, "watchListNumericColumn"); stocksFlexTable.getCellFormatter().addStyleName(row, 3, "watchListRemoveColumn"); Button removeStockButton = new Button("x"); removeStockButton.addStyleDependentName("remove"); stocksFlexTable.setWidget(row, 3, removeStockButton); Button buyButton = new Button("$"); buyButton.addStyleDependentName("Buy"); stocksFlexTable.setWidget(row, 4, buyButton); this.newSymbolTextBox.setText(""); } @Override public void addNewBuyingHistory(String symbol, String price, String count) { buyingHistory.clear(); int row = buyingHistory.getRowCount(); buyingHistory.setText(row, 0, symbol); buyingHistory.setText(row, 1, price); buyingHistory.setText(row, 2, count); } @Override public void removeRow(String symbol) { stocksFlexTable.removeRow(findRowNumberOfSymbol(symbol)); } private int findRowNumberOfSymbol(String symbol) { for (int row = 1; row < stocksFlexTable.getRowCount(); row++) { if (this.stocksFlexTable.getText(row, 0).equals(symbol)) { return row; } } return 0; } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/view/StockWatcherView.java
Java
gpl3
6,563
package com.google.gwt.sample.stockwatcher.client.view; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.sample.stockwatcher.client.presenter.BuyStockPresenter; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.uibinder.client.UiTemplate; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.DecoratorPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.Widget; public class BuyStockView extends Composite implements BuyStockPresenter.Display { @UiTemplate("BuyStockView.ui.xml") interface BuyStockViewUiBinder extends UiBinder<DecoratorPanel, BuyStockView> { } private static BuyStockViewUiBinder uiBinder = GWT .create(BuyStockViewUiBinder.class); @UiField TextBox symbol; @UiField TextBox price; @UiField TextBox amount; @UiField Button saveButton; @UiField Button cancelButton; private BuyStockPresenter presenter; public BuyStockView() { initWidget(uiBinder.createAndBindUi(this)); } @UiHandler("saveButton") void onSaveButtonClicked(ClickEvent event) { if (presenter != null) { presenter.onSaveButtonClicked(Long.valueOf(amount.getValue())); } } @UiHandler("cancelButton") void onCancelButtonClicked(ClickEvent event) { if (presenter != null) { presenter.onCancelButtonClicked(); } } @Override public void setPresenter(BuyStockPresenter presenter) { this.presenter = presenter; } @Override public Widget asWidget() { return this; } @Override public void displaySymbol(String value) { symbol.setText(value); } @Override public void displayPrice(String price) { this.price.setText(price); } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/view/BuyStockView.java
Java
gpl3
1,871
package com.google.gwt.sample.stockwatcher.client.view; import com.google.gwt.user.client.ui.Widget; public interface Display { Widget asWidget(); }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/view/Display.java
Java
gpl3
152
package com.google.gwt.sample.stockwatcher.client.shared; import java.io.Serializable; public class StockPrice implements Serializable { /** */ private static final long serialVersionUID = 8040259246828316386L; private String symbol; private double price; private double change; public StockPrice() { } public StockPrice(String symbol, double price, double change) { this.symbol = symbol; this.price = price; this.change = change; } public StockPrice(String symbol, double price) { this.symbol = symbol; this.price = price; } public String getSymbol() { return this.symbol; } public double getPrice() { return this.price; } public double getChange() { return this.change; } public double getChangePercent() { return 100.0 * this.change / this.price; } public void setSymbol(String symbol) { this.symbol = symbol; } public void setPrice(double price) { this.price = price; } public void setChange(double change) { this.change = change; } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/shared/StockPrice.java
Java
gpl3
1,002
package com.google.gwt.sample.stockwatcher.client.shared; import java.io.Serializable; public class StockBuy implements Serializable { /** */ private static final long serialVersionUID = -5423954446375892903L; private String symbol; private Double price; private Long count; public StockBuy() { } public StockBuy(String symbol, Double price, Long count) { this.symbol = symbol; this.price = price; this.count = count; } public String getSymbol() { return this.symbol; } public double getPrice() { return this.price; } public long getCount() { return count; } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/shared/StockBuy.java
Java
gpl3
597
package com.google.gwt.sample.stockwatcher.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.sample.stockwatcher.client.event.BuyStockEvent; import com.google.gwt.sample.stockwatcher.client.event.BuyStockEventHandler; import com.google.gwt.sample.stockwatcher.client.event.ShowStockWaterEvent; import com.google.gwt.sample.stockwatcher.client.event.ShowStockWaterEventHandler; import com.google.gwt.sample.stockwatcher.client.presenter.BuyStockPresenter; import com.google.gwt.sample.stockwatcher.client.presenter.BuyStockPresenterImpl; import com.google.gwt.sample.stockwatcher.client.presenter.Presenter; import com.google.gwt.sample.stockwatcher.client.presenter.StockWatcherPresenter; import com.google.gwt.sample.stockwatcher.client.presenter.StockWatcherPresenterImpl; import com.google.gwt.sample.stockwatcher.client.service.StockPriceService; import com.google.gwt.sample.stockwatcher.client.service.StockPriceServiceAsync; import com.google.gwt.sample.stockwatcher.client.view.BuyStockView; import com.google.gwt.sample.stockwatcher.client.view.Display; import com.google.gwt.sample.stockwatcher.client.view.StockWatcherView; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.RootPanel; public class StockWatcherMVP implements EntryPoint { private StockPriceServiceAsync stockPriceSvc = GWT .create(StockPriceService.class); private static HandlerManager eventBus = new HandlerManager(null); /** * Entry point method. */ public void onModuleLoad() { bind(); openStockWater(); } private void openStockWater() { StockWatcherView view = new StockWatcherView(); StockWatcherPresenter presenter = new StockWatcherPresenterImpl(stockPriceSvc, eventBus, view); presenter.bind(); view.setPresenter(presenter); displayView(presenter, RootPanel.get("stockList")); } private void displayView(Presenter<? extends Display> presenter, HasWidgets container) { container.clear(); container.add(presenter.getDisplay().asWidget()); } private void bind() { eventBus.addHandler(BuyStockEvent.TYPE, new BuyStockEventHandler() { @Override public void onBuyStock(BuyStockEvent event) { BuyStockView view = new BuyStockView(); BuyStockPresenter presenter = new BuyStockPresenterImpl( stockPriceSvc, eventBus, view, event.getStockPrice()); presenter.bind(); view.setPresenter(presenter); displayView(presenter, RootPanel.get("stockList")); } }); eventBus.addHandler(ShowStockWaterEvent.TYPE, new ShowStockWaterEventHandler() { @Override public void onShowStockWater(ShowStockWaterEvent event) { openStockWater(); } }); } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/StockWatcherMVP.java
Java
gpl3
2,776
package com.google.gwt.sample.stockwatcher.client.event; import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.sample.stockwatcher.client.shared.StockPrice; public class BuyStockEvent extends GwtEvent<BuyStockEventHandler> { private StockPrice stockPrice; public BuyStockEvent(StockPrice stockPrice) { super(); this.stockPrice = stockPrice; } public static Type<BuyStockEventHandler> TYPE = new Type<BuyStockEventHandler>(); @Override protected void dispatch(BuyStockEventHandler handler) { handler.onBuyStock(this); } @Override public com.google.gwt.event.shared.GwtEvent.Type<BuyStockEventHandler> getAssociatedType() { // TODO Auto-generated method stub return TYPE; } public StockPrice getStockPrice() { return stockPrice; } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/event/BuyStockEvent.java
Java
gpl3
777
package com.google.gwt.sample.stockwatcher.client.event; import com.google.gwt.event.shared.EventHandler; public interface BuyStockEventHandler extends EventHandler { void onBuyStock(BuyStockEvent event); }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/event/BuyStockEventHandler.java
Java
gpl3
211
package com.google.gwt.sample.stockwatcher.client.event; import com.google.gwt.event.shared.GwtEvent; public class ShowStockWaterEvent extends GwtEvent<ShowStockWaterEventHandler> { public ShowStockWaterEvent() { super(); } public static Type<ShowStockWaterEventHandler> TYPE = new Type<ShowStockWaterEventHandler>(); @Override protected void dispatch(ShowStockWaterEventHandler handler) { handler.onShowStockWater(this); } @Override public com.google.gwt.event.shared.GwtEvent.Type<ShowStockWaterEventHandler> getAssociatedType() { // TODO Auto-generated method stub return TYPE; } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/event/ShowStockWaterEvent.java
Java
gpl3
609
package com.google.gwt.sample.stockwatcher.client.event; import com.google.gwt.event.shared.EventHandler; public interface ShowStockWaterEventHandler extends EventHandler { void onShowStockWater(ShowStockWaterEvent event); }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/client/event/ShowStockWaterEventHandler.java
Java
gpl3
229
package com.google.gwt.sample.stockwatcher.server; import java.util.LinkedList; import java.util.List; import java.util.Random; import com.google.gwt.sample.stockwatcher.client.service.StockPriceService; import com.google.gwt.sample.stockwatcher.client.shared.StockBuy; import com.google.gwt.sample.stockwatcher.client.shared.StockPrice; import com.google.gwt.user.server.rpc.RemoteServiceServlet; public class StockPriceServiceImpl extends RemoteServiceServlet implements StockPriceService { /** */ private static final long serialVersionUID = 155669477848585224L; private static final double MAX_PRICE = 100.0; // $100.00 private static final double MAX_PRICE_CHANGE = 0.02; // +/- 2% private static List<StockBuy> buyingHistory = new LinkedList<StockBuy>(); @Override public StockPrice[] getPrices(List<String> symbols) { Random rnd = new Random(); StockPrice[] prices = new StockPrice[symbols.size()]; for (int i = 0; i < symbols.size(); i++) { double price = rnd.nextDouble() * MAX_PRICE; double change = price * MAX_PRICE_CHANGE * (rnd.nextDouble() * 2f - 1f); prices[i] = new StockPrice(symbols.get(i), price, change); } return prices; } // ===================================================== @Override public StockBuy buyStock(StockBuy stockBuy) { buyingHistory.add(stockBuy); return stockBuy; } @Override public List<StockBuy> getStockBuyingHistory() { return buyingHistory; } }
100arun-stock
java/src/com/google/gwt/sample/stockwatcher/server/StockPriceServiceImpl.java
Java
gpl3
1,504
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- The HTML 4.01 Transitional DOCTYPE declaration--> <!-- above set at the top of the file will set --> <!-- the browser's rendering engine into --> <!-- "Quirks Mode". Replacing this declaration --> <!-- with a "Standards Mode" doctype is supported, --> <!-- but may lead to some differences in layout. --> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link type="text/css" rel="stylesheet" href="StockWatcherMVP.css"> <title>StockWatcher</title> <script type="text/javascript" language="javascript" src="stockwatchermvp/stockwatchermvp.nocache.js"></script> </head> <body> <div id="mainBody"> <img src="images/GoogleCode.png" /> <h1>StockWatcher</h1> <div id="stockList"></div> <!-- OPTIONAL: include this if you want history support --> <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> <img src="http://code.google.com/appengine/images/appengine-noborder-120x30.gif" alt="Powered by Google App Engine" /> </div> </body> </html>
100arun-stock
java/war/StockWatcherMVP.html
HTML
gpl3
1,188
/* Formatting specific to the StockWatcher application */ div#mainBody { margin: 10px 0 0 10px; } body { padding: 10px; } /* stock list header row */ .watchListHeader { background-color: #2062B8; color: white; font-style: italic; } /* stock list flex table */ .watchList { border: 1px solid silver; padding: 2px; margin-bottom: 6px; } /* stock list Price and Change fields */ .watchListNumericColumn { text-align: right; width: 8em; } /* stock list Remove column */ .watchListRemoveColumn { text-align: center; } .watchListButtonColumn { text-align: center; } /* Add Stock panel */ .addPanel { margin: 10px 0px 15px 0px; } /* stock list, the Remove button */ .gwt-Button-remove { width: 50px; } /* Dynamic color changes for the Change field */ .noChange { color: black; } .positiveChange { color: green; } .negativeChange { color: red; }
100arun-stock
java/war/StockWatcherMVP.css
CSS
gpl3
866
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import com.farproc.wifi.connecter.R; import android.app.Activity; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.TextView; /** * A dialog-like floating activity * @author Kevin Yuan * */ public class Floating extends Activity { private static final int[] BUTTONS = {R.id.button1, R.id.button2, R.id.button3}; private View mView; private ViewGroup mContentViewContainer; private Content mContent; @Override public void onCreate(Bundle savedInstanceState) { // It will not work if we setTheme here. // Please add android:theme="@android:style/Theme.Dialog" to any descendant class in AndroidManifest.xml! // See http://code.google.com/p/android/issues/detail?id=4394 // setTheme(android.R.style.Theme_Dialog); getWindow().requestFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); mView = View.inflate(this, R.layout.floating, null); final DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); mView.setMinimumWidth(Math.min(dm.widthPixels, dm.heightPixels) - 20); setContentView(mView); mContentViewContainer = (ViewGroup) mView.findViewById(R.id.content); } private void setDialogContentView(final View contentView) { mContentViewContainer.removeAllViews(); mContentViewContainer.addView(contentView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); } public void setContent(Content content) { mContent = content; refreshContent(); } public void refreshContent() { setDialogContentView(mContent.getView()); ((TextView)findViewById(R.id.title)).setText(mContent.getTitle()); final int btnCount = mContent.getButtonCount(); if(btnCount > BUTTONS.length) { throw new RuntimeException(String.format("%d exceeds maximum button count: %d!", btnCount, BUTTONS.length)); } findViewById(R.id.buttons_view).setVisibility(btnCount > 0 ? View.VISIBLE : View.GONE); for(int buttonId:BUTTONS) { final Button btn = (Button) findViewById(buttonId); btn.setOnClickListener(null); btn.setVisibility(View.GONE); } for(int btnIndex = 0; btnIndex < btnCount; btnIndex++){ final Button btn = (Button)findViewById(BUTTONS[btnIndex]); btn.setText(mContent.getButtonText(btnIndex)); btn.setVisibility(View.VISIBLE); btn.setOnClickListener(mContent.getButtonOnClickListener(btnIndex)); } } public void onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { if(mContent != null) { mContent.onCreateContextMenu(menu, v, menuInfo); } } public boolean onContextItemSelected (MenuItem item) { if(mContent != null) { return mContent.onContextItemSelected(item); } return false; } public interface Content { CharSequence getTitle(); View getView(); int getButtonCount(); CharSequence getButtonText(int index); OnClickListener getButtonOnClickListener(int index); void onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo); boolean onContextItemSelected (MenuItem item); } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/Floating.java
Java
mit
4,689
package com.farproc.wifi.connecter; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration.AuthAlgorithm; import android.net.wifi.WifiConfiguration.GroupCipher; import android.net.wifi.WifiConfiguration.KeyMgmt; import android.net.wifi.WifiConfiguration.PairwiseCipher; import android.net.wifi.WifiConfiguration.Protocol; import android.text.TextUtils; import android.util.Log; public class ConfigurationSecuritiesOld extends ConfigurationSecurities { // Constants used for different security types public static final String WPA2 = "WPA2"; public static final String WPA = "WPA"; public static final String WEP = "WEP"; public static final String OPEN = "Open"; // For EAP Enterprise fields public static final String WPA_EAP = "WPA-EAP"; public static final String IEEE8021X = "IEEE8021X"; public static final String[] EAP_METHOD = { "PEAP", "TLS", "TTLS" }; public static final int WEP_PASSWORD_AUTO = 0; public static final int WEP_PASSWORD_ASCII = 1; public static final int WEP_PASSWORD_HEX = 2; static final String[] SECURITY_MODES = { WEP, WPA, WPA2, WPA_EAP, IEEE8021X }; private static final String TAG = "ConfigurationSecuritiesOld"; @Override public String getWifiConfigurationSecurity(WifiConfiguration wifiConfig) { if (wifiConfig.allowedKeyManagement.get(KeyMgmt.NONE)) { // If we never set group ciphers, wpa_supplicant puts all of them. // For open, we don't set group ciphers. // For WEP, we specifically only set WEP40 and WEP104, so CCMP // and TKIP should not be there. if (!wifiConfig.allowedGroupCiphers.get(GroupCipher.CCMP) && (wifiConfig.allowedGroupCiphers.get(GroupCipher.WEP40) || wifiConfig.allowedGroupCiphers.get(GroupCipher.WEP104))) { return WEP; } else { return OPEN; } } else if (wifiConfig.allowedProtocols.get(Protocol.RSN)) { return WPA2; } else if (wifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_EAP)) { return WPA_EAP; } else if (wifiConfig.allowedKeyManagement.get(KeyMgmt.IEEE8021X)) { return IEEE8021X; } else if (wifiConfig.allowedProtocols.get(Protocol.WPA)) { return WPA; } else { Log.w(TAG, "Unknown security type from WifiConfiguration, falling back on open."); return OPEN; } } @Override public String getScanResultSecurity(ScanResult scanResult) { final String cap = scanResult.capabilities; for (int i = SECURITY_MODES.length - 1; i >= 0; i--) { if (cap.contains(SECURITY_MODES[i])) { return SECURITY_MODES[i]; } } return OPEN; } @Override public String getDisplaySecirityString(final ScanResult scanResult) { return getScanResultSecurity(scanResult); } private static boolean isHexWepKey(String wepKey) { final int len = wepKey.length(); // WEP-40, WEP-104, and some vendors using 256-bit WEP (WEP-232?) if (len != 10 && len != 26 && len != 58) { return false; } return isHex(wepKey); } private static boolean isHex(String key) { for (int i = key.length() - 1; i >= 0; i--) { final char c = key.charAt(i); if (!(c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f')) { return false; } } return true; } @Override public void setupSecurity(WifiConfiguration config, String security, final String password) { config.allowedAuthAlgorithms.clear(); config.allowedGroupCiphers.clear(); config.allowedKeyManagement.clear(); config.allowedPairwiseCiphers.clear(); config.allowedProtocols.clear(); if (TextUtils.isEmpty(security)) { security = OPEN; Log.w(TAG, "Empty security, assuming open"); } if (security.equals(WEP)) { int wepPasswordType = WEP_PASSWORD_AUTO; // If password is empty, it should be left untouched if (!TextUtils.isEmpty(password)) { if (wepPasswordType == WEP_PASSWORD_AUTO) { if (isHexWepKey(password)) { config.wepKeys[0] = password; } else { config.wepKeys[0] = Wifi.convertToQuotedString(password); } } else { config.wepKeys[0] = wepPasswordType == WEP_PASSWORD_ASCII ? Wifi.convertToQuotedString(password) : password; } } config.wepTxKeyIndex = 0; config.allowedAuthAlgorithms.set(AuthAlgorithm.OPEN); config.allowedAuthAlgorithms.set(AuthAlgorithm.SHARED); config.allowedKeyManagement.set(KeyMgmt.NONE); config.allowedGroupCiphers.set(GroupCipher.WEP40); config.allowedGroupCiphers.set(GroupCipher.WEP104); } else if (security.equals(WPA) || security.equals(WPA2)){ config.allowedGroupCiphers.set(GroupCipher.TKIP); config.allowedGroupCiphers.set(GroupCipher.CCMP); config.allowedKeyManagement.set(KeyMgmt.WPA_PSK); config.allowedPairwiseCiphers.set(PairwiseCipher.CCMP); config.allowedPairwiseCiphers.set(PairwiseCipher.TKIP); config.allowedProtocols.set(security.equals(WPA2) ? Protocol.RSN : Protocol.WPA); // If password is empty, it should be left untouched if (!TextUtils.isEmpty(password)) { if (password.length() == 64 && isHex(password)) { // Goes unquoted as hex config.preSharedKey = password; } else { // Goes quoted as ASCII config.preSharedKey = Wifi.convertToQuotedString(password); } } } else if (security.equals(OPEN)) { config.allowedKeyManagement.set(KeyMgmt.NONE); } else if (security.equals(WPA_EAP) || security.equals(IEEE8021X)) { config.allowedGroupCiphers.set(GroupCipher.TKIP); config.allowedGroupCiphers.set(GroupCipher.CCMP); if (security.equals(WPA_EAP)) { config.allowedKeyManagement.set(KeyMgmt.WPA_EAP); } else { config.allowedKeyManagement.set(KeyMgmt.IEEE8021X); } if (!TextUtils.isEmpty(password)) { config.preSharedKey = Wifi.convertToQuotedString(password); } } } @Override public boolean isOpenNetwork(String security) { return OPEN.equals(security); } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/ConfigurationSecuritiesOld.java
Java
mit
7,074
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import com.farproc.wifi.connecter.R; import android.net.wifi.ScanResult; import android.net.wifi.WifiManager; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import android.view.View.OnClickListener; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class NewNetworkContent extends BaseContent { private boolean mIsOpenNetwork = false; public NewNetworkContent(final Floating floating, final WifiManager wifiManager, ScanResult scanResult) { super(floating, wifiManager, scanResult); mView.findViewById(R.id.Status).setVisibility(View.GONE); mView.findViewById(R.id.Speed).setVisibility(View.GONE); mView.findViewById(R.id.IPAddress).setVisibility(View.GONE); if(Wifi.ConfigSec.isOpenNetwork(mScanResultSecurity)) { mIsOpenNetwork = true; mView.findViewById(R.id.Password).setVisibility(View.GONE); } else { ((TextView)mView.findViewById(R.id.Password_TextView)).setText(R.string.please_type_passphrase); } } private OnClickListener mConnectOnClick = new OnClickListener() { @Override public void onClick(View v) { boolean connResult; if(mIsOpenNetwork) { connResult = Wifi.connectToNewNetwork(mFloating, mWifiManager, mScanResult, null, mNumOpenNetworksKept); } else { connResult = Wifi.connectToNewNetwork(mFloating, mWifiManager, mScanResult , ((EditText)mView.findViewById(R.id.Password_EditText)).getText().toString() , mNumOpenNetworksKept); } if(!connResult) { Toast.makeText(mFloating, R.string.toastFailed, Toast.LENGTH_LONG).show(); } mFloating.finish(); } }; private OnClickListener mOnClickListeners[] = {mConnectOnClick, mCancelOnClick}; @Override public int getButtonCount() { return 2; } @Override public OnClickListener getButtonOnClickListener(int index) { return mOnClickListeners[index]; } @Override public CharSequence getButtonText(int index) { switch(index) { case 0: return mFloating.getText(R.string.connect); case 1: return getCancelString(); default: return null; } } @Override public CharSequence getTitle() { return mFloating.getString(R.string.wifi_connect_to, mScanResult.SSID); } @Override public boolean onContextItemSelected(MenuItem item) { return false; } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/NewNetworkContent.java
Java
mit
3,822
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import com.farproc.wifi.connecter.R; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import android.view.View.OnClickListener; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class ChangePasswordContent extends BaseContent { private ChangingAwareEditText mPasswordEditText; public ChangePasswordContent(Floating floating, WifiManager wifiManager, ScanResult scanResult) { super(floating, wifiManager, scanResult); mView.findViewById(R.id.Status).setVisibility(View.GONE); mView.findViewById(R.id.Speed).setVisibility(View.GONE); mView.findViewById(R.id.IPAddress).setVisibility(View.GONE); mPasswordEditText = ((ChangingAwareEditText)mView.findViewById(R.id.Password_EditText)); ((TextView)mView.findViewById(R.id.Password_TextView)).setText(R.string.please_type_passphrase); ((EditText)mView.findViewById(R.id.Password_EditText)).setHint(R.string.wifi_password_unchanged); } @Override public int getButtonCount() { return 2; } @Override public OnClickListener getButtonOnClickListener(int index) { return mOnClickListeners[index]; } @Override public CharSequence getButtonText(int index) { switch(index) { case 0: return mFloating.getString(R.string.wifi_save_config); case 1: return getCancelString(); default: return null; } } @Override public CharSequence getTitle() { return mScanResult.SSID; } private OnClickListener mSaveOnClick = new OnClickListener() { @Override public void onClick(View v) { if(mPasswordEditText.getChanged()) { final WifiConfiguration config = Wifi.getWifiConfiguration(mWifiManager, mScanResult, mScanResultSecurity); boolean saveResult = false; if(config != null) { saveResult = Wifi.changePasswordAndConnect(mFloating, mWifiManager, config , mPasswordEditText.getText().toString() , mNumOpenNetworksKept); } if(!saveResult) { Toast.makeText(mFloating, R.string.toastFailed, Toast.LENGTH_LONG).show(); } } mFloating.finish(); } }; OnClickListener mOnClickListeners[] = {mSaveOnClick, mCancelOnClick}; @Override public boolean onContextItemSelected(MenuItem item) { return false; } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/ChangePasswordContent.java
Java
mit
3,871
package com.farproc.wifi.connecter; import java.lang.reflect.Field; import android.os.Build.VERSION;; /** * Get Android version in different Android versions. :) * @author yuanxiaohui * */ public class Version { public final static int SDK = get(); private static int get() { final Class<VERSION> versionClass = VERSION.class; try { // First try to read the recommended field android.os.Build.VERSION.SDK_INT. final Field sdkIntField = versionClass.getField("SDK_INT"); return sdkIntField.getInt(null); }catch (NoSuchFieldException e) { // If SDK_INT does not exist, read the deprecated field SDK. return Integer.valueOf(VERSION.SDK); } catch (Exception e) { throw new RuntimeException(e); } } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/Version.java
Java
mit
741
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import com.farproc.wifi.connecter.R; import android.net.wifi.ScanResult; import android.net.wifi.WifiManager; import android.provider.Settings; import android.text.InputType; import android.view.View; import android.view.View.OnClickListener; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.TextView; import android.widget.CompoundButton.OnCheckedChangeListener; public abstract class BaseContent implements Floating.Content, OnCheckedChangeListener { protected final WifiManager mWifiManager; protected final Floating mFloating; protected final ScanResult mScanResult; protected final String mScanResultSecurity; protected final boolean mIsOpenNetwork ; protected int mNumOpenNetworksKept; protected View mView; protected OnClickListener mCancelOnClick = new OnClickListener() { @Override public void onClick(View v) { mFloating.finish(); } }; protected String getCancelString() { return mFloating.getString(android.R.string.cancel); } private static final int[] SIGNAL_LEVEL = {R.string.wifi_signal_0, R.string.wifi_signal_1, R.string.wifi_signal_2, R.string.wifi_signal_3}; public BaseContent(final Floating floating, final WifiManager wifiManager, final ScanResult scanResult) { super(); mWifiManager = wifiManager; mFloating = floating; mScanResult = scanResult; mScanResultSecurity = Wifi.ConfigSec.getScanResultSecurity(mScanResult); mIsOpenNetwork = Wifi.ConfigSec.isOpenNetwork(mScanResultSecurity); mView = View.inflate(mFloating, R.layout.base_content, null); ((TextView)mView.findViewById(R.id.SignalStrength_TextView)).setText(SIGNAL_LEVEL[WifiManager.calculateSignalLevel(mScanResult.level, SIGNAL_LEVEL.length)]); final String rawSecurity = Wifi.ConfigSec.getDisplaySecirityString(mScanResult); final String readableSecurity = Wifi.ConfigSec.isOpenNetwork(rawSecurity) ? mFloating.getString(R.string.wifi_security_open) : rawSecurity; ((TextView)mView.findViewById(R.id.Security_TextView)).setText(readableSecurity); ((CheckBox)mView.findViewById(R.id.ShowPassword_CheckBox)).setOnCheckedChangeListener(this); mNumOpenNetworksKept = Settings.Secure.getInt(floating.getContentResolver(), Settings.Secure.WIFI_NUM_OPEN_NETWORKS_KEPT, 10); } @Override public View getView() { return mView; } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { ((EditText)mView.findViewById(R.id.Password_EditText)).setInputType( InputType.TYPE_CLASS_TEXT | (isChecked ? InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :InputType.TYPE_TEXT_VARIATION_PASSWORD)); } public OnClickListener mChangePasswordOnClick = new OnClickListener() { @Override public void onClick(View v) { changePassword(); } }; public void changePassword() { mFloating.setContent(new ChangePasswordContent(mFloating, mWifiManager, mScanResult)); } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/BaseContent.java
Java
mit
4,299
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import android.content.Context; import android.util.AttributeSet; import android.widget.EditText; public class ChangingAwareEditText extends EditText { public ChangingAwareEditText(Context context, AttributeSet attrs) { super(context, attrs); } private boolean mChanged = false; public boolean getChanged() { return mChanged; } protected void onTextChanged (CharSequence text, int start, int before, int after) { mChanged = true; } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/ChangingAwareEditText.java
Java
mit
1,707
package com.farproc.wifi.connecter; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; public abstract class ConfigurationSecurities { /** * @return The security of a given {@link WifiConfiguration}. */ public abstract String getWifiConfigurationSecurity(WifiConfiguration wifiConfig); /** * @return The security of a given {@link ScanResult}. */ public abstract String getScanResultSecurity(ScanResult scanResult); /** * Fill in the security fields of WifiConfiguration config. * @param config The object to fill. * @param security If is OPEN, password is ignored. * @param password Password of the network if security is not OPEN. */ public abstract void setupSecurity(WifiConfiguration config, String security, final String password); public abstract String getDisplaySecirityString(final ScanResult scanResult); public abstract boolean isOpenNetwork(final String security); public static ConfigurationSecurities newInstance() { if(Version.SDK < 8) { return new ConfigurationSecuritiesOld(); } else { return new ConfigurationSecuritiesV8(); } } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/ConfigurationSecurities.java
Java
mit
1,151
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import java.util.List; import android.app.Activity; import android.app.ListActivity; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.net.wifi.ScanResult; import android.net.wifi.WifiManager; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Toast; import android.widget.TwoLineListItem; import android.widget.AdapterView.OnItemClickListener; public class TestWifiScan extends ListActivity { private WifiManager mWifiManager; private List<ScanResult> mScanResults; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWifiManager = (WifiManager)getSystemService(WIFI_SERVICE); setListAdapter(mListAdapter); getListView().setOnItemClickListener(mItemOnClick); } @Override public void onResume() { super.onResume(); final IntentFilter filter = new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); registerReceiver(mReceiver, filter); mWifiManager.startScan(); } @Override public void onPause() { super.onPause(); unregisterReceiver(mReceiver); } private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) { mScanResults = mWifiManager.getScanResults(); mListAdapter.notifyDataSetChanged(); mWifiManager.startScan(); } } }; private BaseAdapter mListAdapter = new BaseAdapter() { @Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null || !(convertView instanceof TwoLineListItem)) { convertView = View.inflate(getApplicationContext(), android.R.layout.simple_list_item_2, null); } final ScanResult result = mScanResults.get(position); ((TwoLineListItem)convertView).getText1().setText(result.SSID); ((TwoLineListItem)convertView).getText2().setText( String.format("%s %d", result.BSSID, result.level) ); return convertView; } @Override public long getItemId(int position) { return position; } @Override public Object getItem(int position) { return null; } @Override public int getCount() { return mScanResults == null ? 0 : mScanResults.size(); } }; private OnItemClickListener mItemOnClick = new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final ScanResult result = mScanResults.get(position); launchWifiConnecter(TestWifiScan.this, result); } }; /** * Try to launch Wifi Connecter with {@link #hostspot}. Prompt user to download if Wifi Connecter is not installed. * @param activity * @param hotspot */ private static void launchWifiConnecter(final Activity activity, final ScanResult hotspot) { final Intent intent = new Intent("com.farproc.wifi.connecter.action.CONNECT_OR_EDIT"); intent.putExtra("com.farproc.wifi.connecter.extra.HOTSPOT", hotspot); try { activity.startActivity(intent); } catch(ActivityNotFoundException e) { // Wifi Connecter Library is not installed. Toast.makeText(activity, "Wifi Connecter is not installed.", Toast.LENGTH_LONG).show(); downloadWifiConnecter(activity); } } private static void downloadWifiConnecter(final Activity activity) { Intent downloadIntent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse("market://details?id=com.farproc.wifi.connecter")); try { activity.startActivity(downloadIntent); Toast.makeText(activity, "Please install this app.", Toast.LENGTH_LONG).show(); } catch (ActivityNotFoundException e) { // Market app is not available in this device. // Show download page of this project. try { downloadIntent.setData(Uri.parse("http://code.google.com/p/android-wifi-connecter/downloads/list")); activity.startActivity(downloadIntent); Toast.makeText(activity, "Please download the apk and install it manully.", Toast.LENGTH_LONG).show(); } catch (ActivityNotFoundException e2) { // Even the Browser app is not available!!!!! // Show a error message! Toast.makeText(activity, "Fatel error! No web browser app in your device!!!", Toast.LENGTH_LONG).show(); } } } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/TestWifiScan.java
Java
mit
5,979
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import com.farproc.wifi.connecter.R; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import android.view.View.OnClickListener; import android.widget.Toast; public class ConfiguredNetworkContent extends BaseContent { public ConfiguredNetworkContent(Floating floating, WifiManager wifiManager, ScanResult scanResult) { super(floating, wifiManager, scanResult); mView.findViewById(R.id.Status).setVisibility(View.GONE); mView.findViewById(R.id.Speed).setVisibility(View.GONE); mView.findViewById(R.id.IPAddress).setVisibility(View.GONE); mView.findViewById(R.id.Password).setVisibility(View.GONE); } @Override public int getButtonCount() { return 3; } @Override public OnClickListener getButtonOnClickListener(int index) { switch(index) { case 0: return mConnectOnClick; case 1: if(mIsOpenNetwork) { return mForgetOnClick; } else { return mOpOnClick; } case 2: return mCancelOnClick; default: return null; } } @Override public CharSequence getButtonText(int index) { switch(index) { case 0: return mFloating.getString(R.string.connect); case 1: if(mIsOpenNetwork) { return mFloating.getString(R.string.forget_network); } else { return mFloating.getString(R.string.buttonOp); } case 2: return getCancelString(); default: return null; } } @Override public CharSequence getTitle() { return mFloating.getString(R.string.wifi_connect_to, mScanResult.SSID); } private OnClickListener mConnectOnClick = new OnClickListener() { @Override public void onClick(View v) { final WifiConfiguration config = Wifi.getWifiConfiguration(mWifiManager, mScanResult, mScanResultSecurity); boolean connResult = false; if(config != null) { connResult = Wifi.connectToConfiguredNetwork(mFloating, mWifiManager, config, false); } if(!connResult) { Toast.makeText(mFloating, R.string.toastFailed, Toast.LENGTH_LONG).show(); } mFloating.finish(); } }; private OnClickListener mOpOnClick = new OnClickListener() { @Override public void onClick(View v) { mFloating.registerForContextMenu(v); mFloating.openContextMenu(v); mFloating.unregisterForContextMenu(v); } }; private OnClickListener mForgetOnClick = new OnClickListener() { @Override public void onClick(View v) { forget(); } }; private void forget() { final WifiConfiguration config = Wifi.getWifiConfiguration(mWifiManager, mScanResult, mScanResultSecurity); boolean result = false; if(config != null) { result = mWifiManager.removeNetwork(config.networkId) && mWifiManager.saveConfiguration(); } if(!result) { Toast.makeText(mFloating, R.string.toastFailed, Toast.LENGTH_LONG).show(); } mFloating.finish(); } private static final int MENU_FORGET = 0; private static final int MENU_CHANGE_PASSWORD = 1; @Override public boolean onContextItemSelected(MenuItem item) { switch(item.getItemId()) { case MENU_FORGET: forget(); break; case MENU_CHANGE_PASSWORD: changePassword(); break; } return false; } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.add(Menu.NONE, MENU_FORGET, Menu.NONE, R.string.forget_network); menu.add(Menu.NONE, MENU_CHANGE_PASSWORD, Menu.NONE, R.string.wifi_change_password); } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/ConfiguredNetworkContent.java
Java
mit
4,962
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import java.util.List; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.NetworkInfo; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.os.IBinder; public class ReenableAllApsWhenNetworkStateChanged { public static void schedule(final Context ctx) { ctx.startService(new Intent(ctx, BackgroundService.class)); } private static void reenableAllAps(final Context ctx) { final WifiManager wifiMgr = (WifiManager)ctx.getSystemService(Context.WIFI_SERVICE); final List<WifiConfiguration> configurations = wifiMgr.getConfiguredNetworks(); if(configurations != null) { for(final WifiConfiguration config:configurations) { wifiMgr.enableNetwork(config.networkId, false); } } } public static class BackgroundService extends Service { private boolean mReenabled; private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if(WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) { final NetworkInfo networkInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); final NetworkInfo.DetailedState detailed = networkInfo.getDetailedState(); if(detailed != NetworkInfo.DetailedState.DISCONNECTED && detailed != NetworkInfo.DetailedState.DISCONNECTING && detailed != NetworkInfo.DetailedState.SCANNING) { if(!mReenabled) { mReenabled = true; reenableAllAps(context); stopSelf(); } } } } }; private IntentFilter mIntentFilter; @Override public IBinder onBind(Intent intent) { return null; // We need not bind to it at all. } @Override public void onCreate() { super.onCreate(); mReenabled = false; mIntentFilter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION); registerReceiver(mReceiver, mIntentFilter); } @Override public void onDestroy() { super.onDestroy(); unregisterReceiver(mReceiver); } } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/ReenableAllApsWhenNetworkStateChanged.java
Java
mit
3,500
package com.farproc.wifi.connecter; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration.AuthAlgorithm; import android.net.wifi.WifiConfiguration.KeyMgmt; import android.util.Log; public class ConfigurationSecuritiesV8 extends ConfigurationSecurities { static final int SECURITY_NONE = 0; static final int SECURITY_WEP = 1; static final int SECURITY_PSK = 2; static final int SECURITY_EAP = 3; enum PskType { UNKNOWN, WPA, WPA2, WPA_WPA2 } private static final String TAG = "ConfigurationSecuritiesV14"; private static int getSecurity(WifiConfiguration config) { if (config.allowedKeyManagement.get(KeyMgmt.WPA_PSK)) { return SECURITY_PSK; } if (config.allowedKeyManagement.get(KeyMgmt.WPA_EAP) || config.allowedKeyManagement.get(KeyMgmt.IEEE8021X)) { return SECURITY_EAP; } return (config.wepKeys[0] != null) ? SECURITY_WEP : SECURITY_NONE; } private static int getSecurity(ScanResult result) { if (result.capabilities.contains("WEP")) { return SECURITY_WEP; } else if (result.capabilities.contains("PSK")) { return SECURITY_PSK; } else if (result.capabilities.contains("EAP")) { return SECURITY_EAP; } return SECURITY_NONE; } @Override public String getWifiConfigurationSecurity(WifiConfiguration wifiConfig) { return String.valueOf(getSecurity(wifiConfig)); } @Override public String getScanResultSecurity(ScanResult scanResult) { return String.valueOf(getSecurity(scanResult)); } @Override public void setupSecurity(WifiConfiguration config, String security, String password) { config.allowedAuthAlgorithms.clear(); config.allowedGroupCiphers.clear(); config.allowedKeyManagement.clear(); config.allowedPairwiseCiphers.clear(); config.allowedProtocols.clear(); final int sec = security == null ? SECURITY_NONE : Integer.valueOf(security); final int passwordLen = password == null ? 0 : password.length(); switch (sec) { case SECURITY_NONE: config.allowedKeyManagement.set(KeyMgmt.NONE); break; case SECURITY_WEP: config.allowedKeyManagement.set(KeyMgmt.NONE); config.allowedAuthAlgorithms.set(AuthAlgorithm.OPEN); config.allowedAuthAlgorithms.set(AuthAlgorithm.SHARED); if (passwordLen != 0) { // WEP-40, WEP-104, and 256-bit WEP (WEP-232?) if ((passwordLen == 10 || passwordLen == 26 || passwordLen == 58) && password.matches("[0-9A-Fa-f]*")) { config.wepKeys[0] = password; } else { config.wepKeys[0] = '"' + password + '"'; } } break; case SECURITY_PSK: config.allowedKeyManagement.set(KeyMgmt.WPA_PSK); if (passwordLen != 0) { if (password.matches("[0-9A-Fa-f]{64}")) { config.preSharedKey = password; } else { config.preSharedKey = '"' + password + '"'; } } break; case SECURITY_EAP: config.allowedKeyManagement.set(KeyMgmt.WPA_EAP); config.allowedKeyManagement.set(KeyMgmt.IEEE8021X); // config.eap.setValue((String) mEapMethodSpinner.getSelectedItem()); // // config.phase2.setValue((mPhase2Spinner.getSelectedItemPosition() == 0) ? "" : // "auth=" + mPhase2Spinner.getSelectedItem()); // config.ca_cert.setValue((mEapCaCertSpinner.getSelectedItemPosition() == 0) ? "" : // KEYSTORE_SPACE + Credentials.CA_CERTIFICATE + // (String) mEapCaCertSpinner.getSelectedItem()); // config.client_cert.setValue((mEapUserCertSpinner.getSelectedItemPosition() == 0) ? // "" : KEYSTORE_SPACE + Credentials.USER_CERTIFICATE + // (String) mEapUserCertSpinner.getSelectedItem()); // config.private_key.setValue((mEapUserCertSpinner.getSelectedItemPosition() == 0) ? // "" : KEYSTORE_SPACE + Credentials.USER_PRIVATE_KEY + // (String) mEapUserCertSpinner.getSelectedItem()); // config.identity.setValue((mEapIdentityView.length() == 0) ? "" : // mEapIdentityView.getText().toString()); // config.anonymous_identity.setValue((mEapAnonymousView.length() == 0) ? "" : // mEapAnonymousView.getText().toString()); // if (mPasswordView.length() != 0) { // config.password.setValue(mPasswordView.getText().toString()); // } break; default: Log.e(TAG, "Invalid security type: " + sec); } // config.proxySettings = mProxySettings; // config.ipAssignment = mIpAssignment; // config.linkProperties = new LinkProperties(mLinkProperties); } private static PskType getPskType(ScanResult result) { boolean wpa = result.capabilities.contains("WPA-PSK"); boolean wpa2 = result.capabilities.contains("WPA2-PSK"); if (wpa2 && wpa) { return PskType.WPA_WPA2; } else if (wpa2) { return PskType.WPA2; } else if (wpa) { return PskType.WPA; } else { Log.w(TAG, "Received abnormal flag string: " + result.capabilities); return PskType.UNKNOWN; } } @Override public String getDisplaySecirityString(final ScanResult scanResult) { final int security = getSecurity(scanResult); if(security == SECURITY_PSK) { switch(getPskType(scanResult)) { case WPA: return "WPA"; case WPA_WPA2: case WPA2: return "WPA2"; default: return "?"; } } else { switch(security) { case SECURITY_NONE: return "OPEN"; case SECURITY_WEP: return "WEP"; case SECURITY_EAP: return "EAP"; } } return "?"; } @Override public boolean isOpenNetwork(String security) { return String.valueOf(SECURITY_NONE).equals(security); } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/ConfigurationSecuritiesV8.java
Java
mit
6,321
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import java.util.Comparator; import java.util.List; import android.content.Context; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.text.TextUtils; import android.util.Log; public class Wifi { public static final ConfigurationSecurities ConfigSec = ConfigurationSecurities.newInstance(); private static final String TAG = "Wifi Connecter"; /** * Change the password of an existing configured network and connect to it * @param wifiMgr * @param config * @param newPassword * @return */ public static boolean changePasswordAndConnect(final Context ctx, final WifiManager wifiMgr, final WifiConfiguration config, final String newPassword, final int numOpenNetworksKept) { ConfigSec.setupSecurity(config, ConfigSec.getWifiConfigurationSecurity(config), newPassword); final int networkId = wifiMgr.updateNetwork(config); if(networkId == -1) { // Update failed. return false; } // Force the change to apply. wifiMgr.disconnect(); return connectToConfiguredNetwork(ctx, wifiMgr, config, true); } /** * Configure a network, and connect to it. * @param wifiMgr * @param scanResult * @param password Password for secure network or is ignored. * @return */ public static boolean connectToNewNetwork(final Context ctx, final WifiManager wifiMgr, final ScanResult scanResult, final String password, final int numOpenNetworksKept) { final String security = ConfigSec.getScanResultSecurity(scanResult); if(ConfigSec.isOpenNetwork(security)) { checkForExcessOpenNetworkAndSave(wifiMgr, numOpenNetworksKept); } WifiConfiguration config = new WifiConfiguration(); config.SSID = convertToQuotedString(scanResult.SSID); config.BSSID = scanResult.BSSID; ConfigSec.setupSecurity(config, security, password); int id = -1; try { id = wifiMgr.addNetwork(config); } catch(NullPointerException e) { Log.e(TAG, "Weird!! Really!! What's wrong??", e); // Weird!! Really!! // This exception is reported by user to Android Developer Console(https://market.android.com/publish/Home) } if(id == -1) { return false; } if(!wifiMgr.saveConfiguration()) { return false; } config = getWifiConfiguration(wifiMgr, config, security); if(config == null) { return false; } return connectToConfiguredNetwork(ctx, wifiMgr, config, true); } /** * Connect to a configured network. * @param wifiManager * @param config * @param numOpenNetworksKept Settings.Secure.WIFI_NUM_OPEN_NETWORKS_KEPT * @return */ public static boolean connectToConfiguredNetwork(final Context ctx, final WifiManager wifiMgr, WifiConfiguration config, boolean reassociate) { final String security = ConfigSec.getWifiConfigurationSecurity(config); int oldPri = config.priority; // Make it the highest priority. int newPri = getMaxPriority(wifiMgr) + 1; if(newPri > MAX_PRIORITY) { newPri = shiftPriorityAndSave(wifiMgr); config = getWifiConfiguration(wifiMgr, config, security); if(config == null) { return false; } } // Set highest priority to this configured network config.priority = newPri; int networkId = wifiMgr.updateNetwork(config); if(networkId == -1) { return false; } // Do not disable others if(!wifiMgr.enableNetwork(networkId, false)) { config.priority = oldPri; return false; } if(!wifiMgr.saveConfiguration()) { config.priority = oldPri; return false; } // We have to retrieve the WifiConfiguration after save. config = getWifiConfiguration(wifiMgr, config, security); if(config == null) { return false; } ReenableAllApsWhenNetworkStateChanged.schedule(ctx); // Disable others, but do not save. // Just to force the WifiManager to connect to it. if(!wifiMgr.enableNetwork(config.networkId, true)) { return false; } final boolean connect = reassociate ? wifiMgr.reassociate() : wifiMgr.reconnect(); if(!connect) { return false; } return true; } private static void sortByPriority(final List<WifiConfiguration> configurations) { java.util.Collections.sort(configurations, new Comparator<WifiConfiguration>() { @Override public int compare(WifiConfiguration object1, WifiConfiguration object2) { return object1.priority - object2.priority; } }); } /** * Ensure no more than numOpenNetworksKept open networks in configuration list. * @param wifiMgr * @param numOpenNetworksKept * @return Operation succeed or not. */ private static boolean checkForExcessOpenNetworkAndSave(final WifiManager wifiMgr, final int numOpenNetworksKept) { final List<WifiConfiguration> configurations = wifiMgr.getConfiguredNetworks(); sortByPriority(configurations); boolean modified = false; int tempCount = 0; for(int i = configurations.size() - 1; i >= 0; i--) { final WifiConfiguration config = configurations.get(i); if(ConfigSec.isOpenNetwork(ConfigSec.getWifiConfigurationSecurity(config))) { tempCount++; if(tempCount >= numOpenNetworksKept) { modified = true; wifiMgr.removeNetwork(config.networkId); } } } if(modified) { return wifiMgr.saveConfiguration(); } return true; } private static final int MAX_PRIORITY = 99999; private static int shiftPriorityAndSave(final WifiManager wifiMgr) { final List<WifiConfiguration> configurations = wifiMgr.getConfiguredNetworks(); sortByPriority(configurations); final int size = configurations.size(); for(int i = 0; i < size; i++) { final WifiConfiguration config = configurations.get(i); config.priority = i; wifiMgr.updateNetwork(config); } wifiMgr.saveConfiguration(); return size; } private static int getMaxPriority(final WifiManager wifiManager) { final List<WifiConfiguration> configurations = wifiManager.getConfiguredNetworks(); int pri = 0; for(final WifiConfiguration config : configurations) { if(config.priority > pri) { pri = config.priority; } } return pri; } public static WifiConfiguration getWifiConfiguration(final WifiManager wifiMgr, final ScanResult hotsopt, String hotspotSecurity) { final String ssid = convertToQuotedString(hotsopt.SSID); if(ssid.length() == 0) { return null; } final String bssid = hotsopt.BSSID; if(bssid == null) { return null; } if(hotspotSecurity == null) { hotspotSecurity = ConfigSec.getScanResultSecurity(hotsopt); } final List<WifiConfiguration> configurations = wifiMgr.getConfiguredNetworks(); if(configurations == null) { return null; } for(final WifiConfiguration config : configurations) { if(config.SSID == null || !ssid.equals(config.SSID)) { continue; } if(config.BSSID == null || bssid.equals(config.BSSID)) { final String configSecurity = ConfigSec.getWifiConfigurationSecurity(config); if(hotspotSecurity.equals(configSecurity)) { return config; } } } return null; } public static WifiConfiguration getWifiConfiguration(final WifiManager wifiMgr, final WifiConfiguration configToFind, String security) { final String ssid = configToFind.SSID; if(ssid.length() == 0) { return null; } final String bssid = configToFind.BSSID; if(security == null) { security = ConfigSec.getWifiConfigurationSecurity(configToFind); } final List<WifiConfiguration> configurations = wifiMgr.getConfiguredNetworks(); for(final WifiConfiguration config : configurations) { if(config.SSID == null || !ssid.equals(config.SSID)) { continue; } if(config.BSSID == null || bssid == null || bssid.equals(config.BSSID)) { final String configSecurity = ConfigSec.getWifiConfigurationSecurity(config); if(security.equals(configSecurity)) { return config; } } } return null; } public static String convertToQuotedString(String string) { if (TextUtils.isEmpty(string)) { return ""; } final int lastPos = string.length() - 1; if(lastPos > 0 && (string.charAt(0) == '"' && string.charAt(lastPos) == '"')) { return string; } return "\"" + string + "\""; } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/Wifi.java
Java
mit
9,745
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import android.content.Intent; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Bundle; import android.widget.Toast; public class MainActivity extends Floating { public static final String EXTRA_HOTSPOT = "com.farproc.wifi.connecter.extra.HOTSPOT"; private ScanResult mScanResult; private Floating.Content mContent; private WifiManager mWifiManager; @Override protected void onNewIntent (Intent intent) { setIntent(intent); // This activity has "singleInstance" launch mode. // Update content to reflect the newest intent. doNewIntent(intent); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWifiManager = (WifiManager)getSystemService(WIFI_SERVICE); doNewIntent(getIntent()); } private boolean isAdHoc(final ScanResult scanResule) { return scanResule.capabilities.indexOf("IBSS") != -1; } private void doNewIntent(final Intent intent) { mScanResult = intent.getParcelableExtra(EXTRA_HOTSPOT); if(mScanResult == null) { Toast.makeText(this, "No data in Intent!", Toast.LENGTH_LONG).show(); finish(); return; } if(isAdHoc(mScanResult)) { Toast.makeText(this, R.string.adhoc_not_supported_yet, Toast.LENGTH_LONG).show(); finish(); return; } final String security = Wifi.ConfigSec.getScanResultSecurity(mScanResult); final WifiConfiguration config = Wifi.getWifiConfiguration(mWifiManager, mScanResult, security); if(config == null) { mContent = new NewNetworkContent(this, mWifiManager, mScanResult); } else { final boolean isCurrentNetwork_ConfigurationStatus = config.status == WifiConfiguration.Status.CURRENT; final WifiInfo info = mWifiManager.getConnectionInfo(); final boolean isCurrentNetwork_WifiInfo = info != null && android.text.TextUtils.equals(info.getSSID(), mScanResult.SSID) && android.text.TextUtils.equals(info.getBSSID(), mScanResult.BSSID); if(isCurrentNetwork_ConfigurationStatus || isCurrentNetwork_WifiInfo) { mContent = new CurrentNetworkContent(this, mWifiManager, mScanResult); } else { mContent = new ConfiguredNetworkContent(this, mWifiManager, mScanResult); } } setContent(mContent); } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/MainActivity.java
Java
mit
3,635
/* * Wifi Connecter * * Copyright (c) 20101 Kevin Yuan (farproc@gmail.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **/ package com.farproc.wifi.connecter; import com.farproc.wifi.connecter.R; import android.net.NetworkInfo; import android.net.wifi.ScanResult; import android.net.wifi.SupplicantState; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import android.view.View.OnClickListener; import android.widget.TextView; import android.widget.Toast; public class CurrentNetworkContent extends BaseContent { public CurrentNetworkContent(Floating floating, WifiManager wifiManager, ScanResult scanResult) { super(floating, wifiManager, scanResult); mView.findViewById(R.id.Status).setVisibility(View.GONE); mView.findViewById(R.id.Speed).setVisibility(View.GONE); mView.findViewById(R.id.IPAddress).setVisibility(View.GONE); mView.findViewById(R.id.Password).setVisibility(View.GONE); final WifiInfo wifiInfo = mWifiManager.getConnectionInfo(); if(wifiInfo == null) { Toast.makeText(mFloating, R.string.toastFailed, Toast.LENGTH_LONG).show(); } else { final SupplicantState state = wifiInfo.getSupplicantState(); final NetworkInfo.DetailedState detailedState = WifiInfo.getDetailedStateOf(state); if(detailedState == NetworkInfo.DetailedState.CONNECTED || (detailedState == NetworkInfo.DetailedState.OBTAINING_IPADDR && wifiInfo.getIpAddress() != 0)) { mView.findViewById(R.id.Status).setVisibility(View.VISIBLE); mView.findViewById(R.id.Speed).setVisibility(View.VISIBLE); mView.findViewById(R.id.IPAddress).setVisibility(View.VISIBLE); ((TextView)mView.findViewById(R.id.Status_TextView)).setText(R.string.status_connected); ((TextView)mView.findViewById(R.id.LinkSpeed_TextView)).setText(wifiInfo.getLinkSpeed() + " " + WifiInfo.LINK_SPEED_UNITS); ((TextView)mView.findViewById(R.id.IPAddress_TextView)).setText(getIPAddress(wifiInfo.getIpAddress())); } else if(detailedState == NetworkInfo.DetailedState.AUTHENTICATING || detailedState == NetworkInfo.DetailedState.CONNECTING || detailedState == NetworkInfo.DetailedState.OBTAINING_IPADDR) { mView.findViewById(R.id.Status).setVisibility(View.VISIBLE); ((TextView)mView.findViewById(R.id.Status_TextView)).setText(R.string.status_connecting); } } } @Override public int getButtonCount() { // No Modify button for open network. return mIsOpenNetwork ? 2 : 3; } @Override public OnClickListener getButtonOnClickListener(int index) { if(mIsOpenNetwork && index == 1) { // No Modify button for open network. // index 1 is Cancel(index 2). return mOnClickListeners[2]; } return mOnClickListeners[index]; } @Override public CharSequence getButtonText(int index) { switch(index) { case 0: return mFloating.getString(R.string.forget_network); case 1: if(mIsOpenNetwork) { // No Modify button for open network. // index 1 is Cancel. return getCancelString(); } return mFloating.getString(R.string.button_change_password); case 2: return getCancelString(); default: return null; } } @Override public CharSequence getTitle() { return mScanResult.SSID; } private OnClickListener mForgetOnClick = new OnClickListener() { @Override public void onClick(View v) { final WifiConfiguration config = Wifi.getWifiConfiguration(mWifiManager, mScanResult, mScanResultSecurity); boolean result = false; if(config != null) { result = mWifiManager.removeNetwork(config.networkId) && mWifiManager.saveConfiguration(); } if(!result) { Toast.makeText(mFloating, R.string.toastFailed, Toast.LENGTH_LONG).show(); } mFloating.finish(); } }; private OnClickListener mOnClickListeners[] = {mForgetOnClick, mChangePasswordOnClick, mCancelOnClick}; private String getIPAddress(int address) { StringBuilder sb = new StringBuilder(); sb.append(address & 0x000000FF).append(".") .append((address & 0x0000FF00) >> 8).append(".") .append((address & 0x00FF0000) >> 16).append(".") .append((address & 0xFF000000L) >> 24); return sb.toString(); } @Override public boolean onContextItemSelected(MenuItem item) { return false; } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { } }
0xt00m-wifiproject
src/com/farproc/wifi/connecter/CurrentNetworkContent.java
Java
mit
5,714
<?php function sitemap_after_process() { if (isset ( $_GET ['p'] ) && $_GET ['p'] == 'sitemap.xml') { global $main_menu; $out = '<?xml version="1.0" encoding="UTF-8"?>'; $out .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; foreach ( $main_menu->items as $item ) { $out.="<url>"; $out.="<loc>".$item->link."</loc>"; $out.="<changefreq>weekly</changefreq>"; $out.='<priority>1</priority>'; $out.="</url>"; } $out .= '</urlset>'; header ( "Content-Type: application/xml" ); echo $out; exit (); } }
0query
trunk/0query/plugins/sitemap.php
PHP
gpl2
563
<h2 class="contact">Contact Me</h2> <p>At has veri feugait placerat, in semper offendit praesent his. Omnium impetus facilis sed at, ex viris tincidunt ius. Unum eirmod dignissim id quo. Sit te atomorum quaerendum neglegentur, his primis tamquam et. Eu quo quot veri alienum, ea eos nullam luptatum accusamus. Ea mel causae phaedrum reprimique, at vidisse dolores ocurreret nam.</p> <form method ="POST" id="contactform"> <p><label for="name">Name</label></p> <input type="text" id=name name=name placeholder="First and last name" required tabindex="1" /> <p><label for="email">Email</label></p> <input type="text" id=email name=email placeholder="example@domain.com" required tabindex="2" /> <p><label for="comment">Your Message</label></p> <textarea name="comment" id="comment" tabindex="4"></textarea> <input name="submit" type="submit" id="submit" tabindex="5" value="Send Message" /> </form>
0query
trunk/0query/content/pages/3. Contact/index.php
Hack
gpl2
986
<h2 class="intro"> <strong>Just</strong> a simple <strong>website</strong> framework <span class="sub">.. and Anything more</span> </h2> <div class="clear"></div> <p> Ea mei nullam facete, omnis oratio offendit ius cu. Doming takimata repudiandae usu an, mei dicant takimata id, pri eleifend inimicus euripidis at. His vero singulis ea, quem euripidis abhorreant mei ut, et populo iriure vix. Usu ludus affert voluptaria ei, vix ea error definitiones, movet fastidii signiferumque in qui. </p>
0query
trunk/0query/content/pages/1. Home/index.php
Hack
gpl2
504
<h2 class="intro"> <strong>Just</strong> a simple <strong>website</strong> framework <span class="sub">.. and Anything more</span> Optimized for your mobile </h2> <div class="clear"></div> <p> Mobile Content </p>
0query
trunk/0query/content/pages/1. Home/index.mobile.php
Hack
gpl2
228
<li class="<?php if ($this->active) echo "active" ?>"> <a href="<?php echo $this->link?>"><?php echo $this->title ?></a> </li>
0query
trunk/0query/templates/gelsheet/menu-item.php
PHP
gpl2
129
$(document).ready(function() { $('#home-slide').cycle('fade'); });
0query
trunk/0query/templates/gelsheet/js/gelsheet.js
JavaScript
gpl2
75
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> <head> <title>Gelsheet: The opensource web spreadsheet</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="keywords" content="PHP Spreadsheet, Web spreadsheet, Online spreadsheet, Worpress spreadsheet, Opengoo spreadsheet, Gelsheet, AJAX Spreadsheet, Opensorce web spreadsheet, Opensource spreadsheet, Opensource google docs" /> <meta name="description" content="GelSheet is a free and open source web spreadsheet that allow users to create, edit and export in many formats your everyday work. It's intended to run either standalone or integrated within another web tool. It was born as a part of Opengoo web office" /> <link rel="stylesheet" href="<?php echo TEMPLATE_PATH ?>style.css" type="text/css" media="screen"> <?php $page->css();?> <script src="<?php echo TEMPLATE_PATH ?>js/jquery-1.4.2.min.js"></script> <script src="<?php echo TEMPLATE_PATH ?>js/jquery.cycle.all.min.js"></script> <script src="<?php echo TEMPLATE_PATH ?>js/gelsheet.js"></script> <?php $page->js() ?> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-20197577-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <meta name="google-site-verification" content="hVHPQY0v01fGvaOHBGhZSIvNWNeYWPlXgKfUQeONoMc" /> </head> <body class="home page page-id-1052 page-template page-template-page-home-2-php"> <div id="page" class="fix"> <div id="header" class="fix"> <div class="content"> <ul id="nav" class="fix"> <?php $main_menu->output() ?> </ul> </div> </div> <div class="clear"></div> <div id="main_content" class="fix" > <div class="content fix">
0query
trunk/0query/templates/gelsheet/header.php
PHP
gpl2
2,207
Not found
0query
trunk/0query/templates/gelsheet/404.php
Hack
gpl2
9
je ul, ol {list-style-type: none;} table, tbody, fieldset {margin:0;padding:0;border:none;} p,.p {text-align: left;margin-bottom: 1em;} p.halfp, .halfp{margin-bottom:.5em;} hr{ margin: 1.5em 0; border:none; border-bottom: 1px dashed #ccc;} strong,b, th, label, .fboxes h4{font-weight: bold; font-family: palatino,'palatino linotype',georgia,serif;} strong a{border-bottom: 1px dotted #bbb;} strong a:hover{ text-decoration: none; border-bottom: 1px dotted #000; } label small{font-weight: normal;} em{font-style: italic;} .tab {padding-left:30px;} body{ font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:normal; line-height:21px; font-size: 14px; color:#000; font-family:palatino, 'palatino linotype', serif; letter-spacing:-.01em; background: #000 ; } /* LINKS */ a{ color: #000; text-decoration: none; } .billboard a { text-decoration: underline; } .section a, .illustration a{border-bottom: 1px dotted #bbb;} .section a, .illustration a{border-bottom: none;} a:hover{ color:#3399CC; cursor:pointer; } .banner a, .notfound a{color:#3399CC;text-decoration:underline;} a img{border:none;} /* HEADERS */ h1,h2,h3,h4,h5,h6{ line-height: 1.2em; font-weight: normal; font-family: palatino,'palatino linotype',georgia,serif; color:#000; display: block; position: relative; z-index:10; } h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .section h1 a, .section h2 a, .section h3 a, .section h4 a, .section h5 a{border: none;} h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover h6 a:hover{ text-decoration: underline; color: #000; } h1{font-size: 34px;} h2{font-size: 24px;} h3{font-size: 18px;} h4{font-size: 16px; padding-bottom:8px;} h5{font-size: 14px;} h1, h2 { letter-spacing:-.050em; width:100%; text-align: center; line-height: 1.2em; } h1.headline { font-size: 45px; line-height: 1em; display: block; } h1.feat_headline { font-size:55px; line-height: 1em; display:block; text-align:left; width:500px; } h2.comm { border-bottom:1px dotted; display:block; float:left; font-size:35px; line-height:1em; margin-bottom:5px; padding:10px 0; text-align:left; width:570px; } h3.fsub{ text-align: center; } h3.fsub em{ font-style: normal; } .dcap { display:inline; float:left; font-size:3.1em; line-height:0.8em; margin:0.07em 0.1em 0 0; text-transform:uppercase; } .a_post_content h3{ margin-bottom:1em; } #related h3{margin-bottom:none;} .a_post_content p a{color:#3399cc;} .a_post_content p a:hover{text-decoration: underline;} #mainlogo { float: left ; } #header { background: #000; padding: 10px 0; color: #fff; } #header a {color: #fff;} /* NAVIGATION */ /* Main Navigation */ #nav { list-style: none; padding:0; line-height: 8px; padding-left: 3px; float: left; margin-top: 5px; margin-left: 20px; } #nav li, .subnav li, .sides li{ margin: 0px 0px 0px 0px; padding: 0px; float: left; } /* Header */ .inline li a{padding: 0 10px;} #nav li a, .headericon{ font-family: georgia, times, serif; background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 0; border: 1px solid #000; border-left: 1px solid #333; border-top: 1px solid #333; text-shadow: #000 0px -1px 0; line-height: .7em; padding: 9px 13px; margin-right: 20px; text-decoration: none; display: block; color:#eee; font-size: 1.1em; text-transform: capitalize; } .headericon, .headertext{ display: block; float:right; margin: 5px 0px 0 0; } .headericon span.loginicon{ display: block; background: url(../img/arrow-white.png) no-repeat center right; padding-right: 10px; } #nav li a:hover, .headericon:hover{ background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 -72px; border: 1px solid #064271; border-left: 1px solid #74AFD7; border-top: 1px solid #74AFD7; text-shadow: #064271 0px -1px 0; color: #fff; display: block; } #nav li a:active, .headericon:active{ background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 -108px; border: 1px solid #2480B2; border-left: 1px solid #064271; border-top: 1px solid #064271; } #nav .current_page_item a, #nav .current_page_ancestor a, #nav .current_page_parent a{ border: 1px solid #222; border-left: 1px solid #aaa; border-top: 1px solid #aaa; background: #666 url(../img/bg_nav_sprite.png) repeat-x 0 -36px; text-shadow: #222 0px -1px 0; color: #fff; } #nav li a small{ display: none; } #nav li a:hover small{color: #FFF;} #nav .on a small, #nav .on a:hover small{ text-decoration: none; color: #444; font-style: normal; } #main_content { color: #000; background: #fff; border-top:1px solid #eee; padding-top: .6em; padding-bottom: 3.5em; min-height: 600px; } /* Feature Nav 2 */ #home-slide { height:100%; width:100%; overflow:hidden ; } #home_page{ padding: 5px 0; } #home_page .splash_left{ padding-left:25px; padding-right: 25px; width: 372px; font-size: 1.34em; line-height: 1.5em } #home_page .splash_left h2{ font-size: 1.6em; } #home_page .featurenav-contain{ background: #fff; padding: 30px 0px 30px 0px; margin-top: 1px; } #home_page .thelatest{ float: left; line-height: 60px; margin:0 240px 0 50px; font-size: 2.5em; font-style: italic; color:#aaa; } #home_page #featurenav a{ float: left; display: block; border: 1px solid #ddd; padding: 3px; background: #fff; overflow:hidden; margin-right: 30px } #home_page #featurenav a:hover { border: 1px solid #bbb; } #home_page #featurenav a:hover span span{ } #home_page #featurenav span{ display:block; width: 60px; height: 60px; } #home_page #featurenav span span { background: url(../img/nav-overlay.png) no-repeat 0 0; } #home_page #featurenav a.activeSlide span span { background: url(../img/nav-overlay.png) no-repeat 0 -60px; } /* Footer */ #footer { clear:both; font-size:0.9em; overflow:hidden; padding: 10px 10px 60px 10px; background: transparent url(../img/bg-leaf.gif) no-repeat center bottom; color: #fff; text-align: center ; } #footer a{ color: #fff; } #footer a:hover{ text-decoration: underline; color: #fff; } #footer #footnav, #footer #footnav li{display:inline;} #footer #footnav small{display: none;} #footer #footnav {margin-left: 20px;} #footnav li a{ padding: 3px 2px; line-height: 1em; margin-right: 10px; border-top:1px solid transparent; border-bottom: 1px solid transparent; text-decoration:none; } #footnav li a:hover{ border-top:1px solid #666; border-bottom: 1px solid #666;} #footnav li.on a{border-top:1px solid #666; border-bottom: 1px solid #666;} .updated{color: #999;font-size: 10px;display: block;text-align: center;} .updated a{color:#999} /**** Home Splash ****/ .homepage-title{ line-height: 1.4em; } #feature_splash { border-bottom: 1px solid #ddd; padding-top: 30px; height: 400px; /*overflow:hidden;*/ position:relative; } #feature_splash.theme_splash { padding-top: 30px; height: 320px; } #feature_splash.theme_splash .splash_left { padding: 30px 40px 30px; } #feature_splash h1{ font-size: 37px; margin: 15px 0 28px; } #feature_splash .splash_left h2, #feature_splash .splash_left h1{ text-align: left; font-family: palatino, 'palatino linotype', georgia; margin-bottom: .5em; } #feature_splash .splash_left h2{font-size: 25px;} #feature_splash .splash_left { padding: 0px 40px 30px; width: 350px; margin-right: 30px; font-size: 1.2em; color: #555; float: left; } .splash_actioncall{ margin: 1em 0 1em; font-size: 1.4em; color: #aaa; font-style: italic; } .splash_actioncall span{margin: 0 12px;} #feature_splash .splash_button img, #feature_splash img{ vertical-align: middle; } #feature_splash .splash_right{ -moz-box-shadow: 01px 1px 15px 1px #CCCCCC ; height: 375px; width: 570px; overflow:hidden; float: left; position: relative; z-index: 0; } #feature_splash .viewimage{ border: 1px solid #333; border-bottom: 2px solid #000; border-right: 2px solid #000; background: #000; padding: 2px; margin-bottom: 12px; } #feature_splash .viewinfo{ display: block; position: absolute; right: 180px; top: 110px; width: 160px; z-index: 100; text-align: center; color: #aaa; font-size: 1.2em; text-shadow: #000 0 -1px 0; } #feature_splash .viewinfo:hover{color: #fff;} .column_left { float:left; width: 150px ; margin-right: 30px; color: #555; } .column_left ul { margin-right: 20px; } .column_left h1, .column_left h2 { text-align: left; } .column_right { float: left ; } .gelsheet-container{ width: 800px; -moz-box-shadow: 01px 1px 15px 1px #CCCCCC ; } /* IMAGES */ .thumb {padding: 4px;border:1px solid #bbb;} .preload{display:none;} .content{ width:1050px; margin-left:auto; margin-right:auto; } /* FLOATING AND ALIGNMENT */ .alignleft, .floatleft{float:left;margin:0em 1em .3em 0;clear:left;} .alignright, .floatright{float:right;margin:0em 0em .3em 1em;} .right{float:right;} .left{float:left;} .clear{clear:both;} .aligncenter {margin-left: auto;margin-right: auto;} .center, .center p{text-align: center;} .hidden {display: none;} /** hacks **/ .fix:after{content:".";display:block;height:0;clear:both;visibility:hidden;} .fix{display:inline-block;} * html .fix{height:1%;} .fix{display:block;}
0query
trunk/0query/templates/gelsheet/style.css
CSS
gpl2
9,758
<div id="footer" class="fix"><br> <div class="footcols_container"> <div class="content fix"> Powered by <a href="#">MinCMS</a> | Designed by <a href="http://www.gelsheet.org">Home</a>Designed By Powered by <a href="http://www.gelsheet.org">Gelsheet - The opensource online spreadsheet</a> About | Contact --> </div> </div> </div> </div> </body> </html>
0query
trunk/0query/templates/gelsheet/footer.php
Hack
gpl2
389
<?php include_once 'header.php' ?> <div id="main_content" class="fix" > <div class="content fix"> <?php $page->output() ;?> </div> <!-- end .content --> </div> <?php include_once 'footer.php' ?>
0query
trunk/0query/templates/gelsheet/index.php
PHP
gpl2
214
<li> <a class="wintrolink wanchorLink <?php if ($this->active) echo "active" ?>" href="<?php echo $this->link?>"><?php echo $this->title ?></a> </li>
0query
trunk/0query/templates/portfolio/menu-item.php
PHP
gpl2
156
div#fancy_overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: none; z-index: 30; } div#fancy_loading { position: absolute; height: 40px; width: 40px; cursor: pointer; display: none; overflow: hidden; background: transparent; z-index: 100; } div#fancy_loading div { position: absolute; top: 0; left: 0; width: 40px; height: 480px; background: transparent url('fancy_progress.png') no-repeat; } div#fancy_outer { position: absolute; top: 0; left: 0; z-index: 90; padding: 20px 20px 40px 20px; margin: 0; background: transparent; display: none; } div#fancy_inner { position: relative; width:100%; height:100%; background: #FFF; } div#fancy_content { margin: 0; z-index: 100; position: absolute; } div#fancy_div { background: #000; color: #FFF; height: 100%; width: 100%; z-index: 100; } img#fancy_img { position: absolute; top: 0; left: 0; border:0; padding: 0; margin: 0; z-index: 100; width: 100%; height: 100%; } div#fancy_close { position: absolute; top: -12px; right: -15px; height: 30px; width: 30px; background: url('fancy_closebox.png') top left no-repeat; cursor: pointer; z-index: 181; display: none; } #fancy_frame { position: relative; width: 100%; height: 100%; display: none; } #fancy_ajax { width: 100%; height: 100%; overflow: auto; } a#fancy_left, a#fancy_right { position: absolute; bottom: 0px; height: 100%; width: 35%; cursor: pointer; z-index: 111; display: none; background-image: url("data:image/gif;base64,AAAA"); outline: none; overflow: hidden; } a#fancy_left { left: 0px; } a#fancy_right { right: 0px; } span.fancy_ico { position: absolute; top: 50%; margin-top: -15px; width: 30px; height: 30px; z-index: 112; cursor: pointer; display: block; } span#fancy_left_ico { left: -9999px; background: transparent url('fancy_left.png') no-repeat; } span#fancy_right_ico { right: -9999px; background: transparent url('fancy_right.png') no-repeat; } a#fancy_left:hover, a#fancy_right:hover { visibility: visible; background-color: transparent; } a#fancy_left:hover span { left: 20px; } a#fancy_right:hover span { right: 20px; } #fancy_bigIframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; } div#fancy_bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 70; border: 0; padding: 0; margin: 0; } div.fancy_bg { position: absolute; display: block; z-index: 70; border: 0; padding: 0; margin: 0; } div#fancy_bg_n { top: -20px; left: 0; width: 100%; height: 20px; background: transparent url('fancy_shadow_n.png') repeat-x; } div#fancy_bg_ne { top: -20px; right: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_ne.png') no-repeat; } div#fancy_bg_e { right: -20px; height: 100%; width: 20px; background: transparent url('fancy_shadow_e.png') repeat-y; } div#fancy_bg_se { bottom: -20px; right: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_se.png') no-repeat; } div#fancy_bg_s { bottom: -20px; left: 0; width: 100%; height: 20px; background: transparent url('fancy_shadow_s.png') repeat-x; } div#fancy_bg_sw { bottom: -20px; left: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_sw.png') no-repeat; } div#fancy_bg_w { left: -20px; height: 100%; width: 20px; background: transparent url('fancy_shadow_w.png') repeat-y; } div#fancy_bg_nw { top: -20px; left: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_nw.png') no-repeat; } div#fancy_title { position: absolute; z-index: 100; display: none; } div#fancy_title div { color: #FFF; font: bold 12px Arial; padding-bottom: 3px; white-space: nowrap; } div#fancy_title table { margin: 0 auto; } div#fancy_title table td { padding: 0; vertical-align: middle; } td#fancy_title_left { height: 32px; width: 15px; background: transparent url('fancy_title_left.png') repeat-x; } td#fancy_title_main { height: 32px; background: transparent url('fancy_title_main.png') repeat-x; } td#fancy_title_right { height: 32px; width: 15px; background: transparent url('fancy_title_right.png') repeat-x; }
0query
trunk/0query/templates/portfolio/js/jquery.fancybox-1.2.6.css
CSS
gpl2
4,579
/******* *** Anchor Slider by Cedric Dugas *** *** Http://www.position-absolute.com *** Never have an anchor jumping your content, slide it. Don't forget to put an id to your anchor ! You can use and modify this script for any project you want, but please leave this comment as credit. *****/ $(document).ready(function() { $("a.anchorLink").anchorAnimate() }); jQuery.fn.anchorAnimate = function(settings) { settings = jQuery.extend({ speed : 1100 }, settings); return this.each(function(){ var caller = this $(caller).click(function (event) { event.preventDefault() var locationHref = window.location.href var elementClick = $(caller).attr("href") var destination = $(elementClick).offset().top; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() { window.location.hash = elementClick }); return false; }) }) }
0query
trunk/0query/templates/portfolio/js/jquery.anchor.js
JavaScript
gpl2
975
<!DOCTYPE html> <html lang="en"> <head> <title>Zero query - No Database CMS</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" href="ie7.css" type="text/css" media="screen" /> <![endif]--> <link rel="stylesheet" href="<?php echo TEMPLATE_PATH ?>style.css" type="text/css" media="screen" /> <?php $page->css();?> <!-- Include page specific css --> <script src="<?php echo TEMPLATE_PATH ?>js/jquery.min.js" type="text/javascript"></script> <?php $page->js() ?> <!-- include page specific js --> </head> <body> <header> <!-- HTML5 header tag --> <div id="headercontainer"> <h1><a class="introlink anchorLink" href="">Zero Query - NO Database CMS</a></h1> <nav> <!-- HTML5 navigation tag --> <ul> <?php get_menu() ?> </ul> </nav> </div> </header> <section id="contentcontainer"> <!-- HTML5 section tag for the content 'section' --> <section id="<?php get_page_id();?>">
0query
trunk/0query/templates/portfolio/header.php
PHP
gpl2
1,203
<?php get_header()?> <h2>Not found</h2> <?php get_footer()?>
0query
trunk/0query/templates/portfolio/404.php
PHP
gpl2
62
header { position: absolute; left: 0; } #intro h2 { margin-bottom: 100px; } h2.work { width: 800px; }
0query
trunk/0query/templates/portfolio/ie7.css
CSS
gpl2
102
* { margin: 0; padding: 0; outline: 0; } /* HTML5 tags */ header, section, footer, aside, nav, article, figure { display: block; } @font-face { font-family: Keffeesatz; src: url(YanoneKaffeesatz-Light.otf) format("opentype") } @font-face { font-family: KeffeesatzBold; src: url(YanoneKaffeesatz-Bold.otf) format("opentype") } body { font-family: Keffeesatz, Arial; color: #4b4b4b; background: url(images/pattern.gif); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2); } ::selection { background-color: rgba(122, 192, 0, 0.2); } ::-moz-selection { background-color: rgba(122, 192, 0, 0.2); border: 10px solid red; } h1 { color: #fff; font-size: 40px; position: relative; top: 15px; } h1 a { color: #fff; font-size: 40px; background-color: #ff5400; padding: 5px 25px 10px 25px; width: 300px; -webkit-border-radius: 10px; -moz-border-radius: 10px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6); border-bottom: 1px solid rgba(0, 0, 0, 0.4); border-top: 1px solid rgba(255, 255, 255, 0.6); background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #c34000), color-stop(0.62, #ff5400) ); background: -moz-linear-gradient( center bottom, #c34000 23%, #ff5400 62% ); } h1 a:hover { color: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.4); padding-bottom: 10px; background-color: #7ac000; background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #619702), color-stop(0.62, #7ac000) ); background: -moz-linear-gradient( center bottom, #619702 23%, #7ac000 62% ); } h2 { padding-left: 125px; font-size: 66px; color: #ff5400; height: 105px; } h2 span.sub { font-size: 48px; float: left; color: #4b4b4b; } h2.intro { background: url(images/intro.png) no-repeat -10px -10px; height: 170px } h2.work { background: url(images/portfolio.png) no-repeat -10px -10px; } h2.about { background: url(images/about.png) no-repeat -10px -10px; } h2.contact { background: url(images/contact.png) no-repeat -10px -10px; } a { color: #7ac000; text-decoration: none; border-bottom: 1px solid #7ac000; padding-bottom: 2px; } a:hover { color: #ff5400; text-decoration: none; border-bottom: 1px solid #ff5400; padding-bottom: 2px; } a:active { color: #ff5400; text-decoration: none; border-bottom: 1px solid #ff5400; padding-bottom: 2px; position: relative; top: 1px; } p { font-size: 24px; margin-bottom: 15px; line-height: 36px; } strong { font-family: KeffeesatzBold, Arial; } header { padding: 5px 0; width: 100%; background-color: #000; margin-bottom: 25px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); position: fixed; z-index: 10; float: left; } #headercontainer, #contentcontainer { width: 960px; margin: 0 auto; position: relative; } #contentcontainer { float: none; padding-top: 0px; } nav { width: auto; float: left; } nav ul { position: absolute; right: 0; display: block; margin-top: -37px; } nav ul li { display: inline; margin-left: 50px; } nav ul li a { font-size: 24px; border-bottom: none; } section { padding-top: 150px; } #intro h2 a { padding-bottom: 0px; } #intro a.featured { padding-bottom: 0px; border-bottom: none; } #intro a img { border: 5px solid rgba(122, 192, 0, 0.15); -webkit-border-radius: 5px; margin-top: 40px; margin-bottom: 5px; } #intro a img:hover, #portfolio .work a img:hover, input:hover, textarea:hover { border: 5px solid rgba(122, 192, 0, 1); -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.4); } #intro a img:active, #portfolio .work a img:active { -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); } #portfolio ul.work a { border-bottom: none; } #portfolio ul.work a img { border: 5px solid rgba(122, 192, 0, 0.15); -webkit-border-radius: 5px; } #portfolio ul.work { float: left; margin-left: -15px; width: 975px; } #portfolio ul.work li { list-style: none; float: left; margin-left: 15px; margin-bottom: 15px; } #contact { margin-bottom: 0px; } input[type="text"] { width: 400px; } textarea { width: 750px; height: 275px; } label { color: #ff5400; } input, textarea { background-color: rgba(255, 255, 255, 0.4); border: 5px solid rgba(122, 192, 0, 0.15); padding: 10px; font-family: Keffeesatz, Arial; color: #4b4b4b; font-size: 24px; -webkit-border-radius: 5px; margin-bottom: 15px; margin-top: -10px; } input:focus, textarea:focus { border: 5px solid #ff5400; background-color: rgba(255, 255, 255, 1); } input[type="submit"]{ border: none; cursor: pointer; color: #fff; font-size: 24px; background-color: #7ac000; padding: 5px 36px 8px 36px; -webkit-border-radius: 10px; -moz-border-radius: 10px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6); border-bottom: 1px solid rgba(0, 0, 0, 0.4); border-top: 1px solid rgba(255, 255, 255, 0.6); background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #619702), color-stop(0.62, #7ac000) ); background: -moz-linear-gradient( center bottom, #619702 23%, #7ac000 62% ); } input[type="submit"]:hover { color: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.4); background-color: #ff5400; background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #c34000), color-stop(0.62, #ff5400) ); background: -moz-linear-gradient( center bottom, #c34000 23%, #ff5400 62% ); } input[type="submit"]:active { position: relative; top: 1px; } footer {margin-top: 50px; } footer ul { margin-bottom: 150px; } footer ul li { display: inline; margin-right: 50px; } footer ul li a { font-size: 24px; margin-left: 10px; } footer ul li img { vertical-align: bottom; position: relative; top: 2px; } div.clear { clear: both }
0query
trunk/0query/templates/portfolio/style.css
CSS
gpl2
5,803
</section> <footer> <ul> <li>Powered by <a href="http://code.google.com/p/0query/"> 0Query </a> </ul> </footer> </section> </body> </html>
0query
trunk/0query/templates/portfolio/footer.php
Hack
gpl2
179
<?php get_header() ?> <?php get_page() ?> <?php get_footer() ?>
0query
trunk/0query/templates/portfolio/index.php
PHP
gpl2
64
<header> Zero query Mobile </header> <?php get_page() ?> <footer> <?php get_footer() ?> </footer>
0query
trunk/0query/templates/portfolio/index.mobile.php
PHP
gpl2
102
<?php /** * Mobile Detect * $Id: Mobile_Detect.php 44 2012-05-03 21:45:00Z serbanghita@gmail.com $ * * @usage require_once 'Mobile_Detect.php'; * $detect = new Mobile_Detect(); * $detect->isMobile() or $detect->isTablet() * * For more specific usage see the documentation navigate to: * http://code.google.com/p/php-mobile-detect/wiki/Mobile_Detect * * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ class Mobile_Detect { protected $detectionRules; protected $userAgent = null; protected $accept = null; // Assume the visitor has a desktop environment. protected $isMobile = false; protected $isTablet = false; protected $phoneDeviceName = null; protected $tabletDevicename = null; protected $operatingSystemName = null; protected $userAgentName = null; // List of mobile devices (phones) protected $phoneDevices = array( 'iPhone' => '(iPhone.*Mobile|iPod|iTunes)', 'BlackBerry' => 'BlackBerry|rim[0-9]+', 'HTC' => 'HTC|HTC.*(6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090', 'Nexus' => 'Nexus One|Nexus S', 'DellStreak' => 'Dell Streak', 'Motorola' => '\bDroid\b.*Build|HRI39|MOT\-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT909|XT910|XT912|XT928', 'Samsung' => 'Samsung|GT-I9100|GT-I9000|GT-I9020|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-LC11|SCH-N150|SCH-N300|SCH-R300|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-C207|SGH-C225|SGH-C417|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D807|SGH-E105|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E635|SGH-E715|SGH-I577|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I717|SGH-I727|SGH-I777|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-N105|SGH-N625|SGH-P107|SGH-P207|SGH-P735|SGH-P777|SGH-Q105|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T919|SGH-T929|SGH-T939|SGH-T939|SGH-T959|SGH-T989|SGH-V205|SGH-V206|SGH-X105|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-ZX10|SGH-ZX20|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500I|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100', 'Sony' => 'E10i|SonyEricsson|SonyEricssonLT15iv', 'Asus' => 'Asus.*Galaxy', 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino 'GenericPhone' => '(mmp|pocket|psp|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|wap|nokia|Series40|Series60|S60|SonyEricsson|N900|PPC;|MAUI.*WAP.*Browser|LG-P500)' ); // List of tablet devices. protected $tabletDevices = array( 'BlackBerryTablet' => 'PlayBook|RIM Tablet', 'iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic. 'Kindle' => 'Kindle|Silk.*Accelerated', 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|GT-P1000|GT-P1010|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I777|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SGH-T989|SPH-D710|SPH-P100', 'HTCtablet' => 'HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200', 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617', 'AsusTablet' => 'Transformer|TF101', 'NookTablet' => 'NookColor|nook browser|BNTV250A|LogicPD Zoom2', 'AcerTablet' => 'Android.*(A100|A101|A200|A500|A501|A510|W500|W500P|W501|W501P)', 'YarvikTablet' => 'Android.*(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468)', 'GenericTablet' => 'Tablet(?!.*PC)|ViewPad7|LG-V909|MID7015|BNTV250A|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b', ); // List of mobile Operating Systems. protected $operatingSystems = array( 'AndroidOS' => '(android.*mobile|android(?!.*mobile))', 'BlackBerryOS' => '(blackberry|rim tablet os)', 'PalmOS' => '(avantgo|blazer|elaine|hiptop|palm|plucker|xiino)', 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|\bS60\b', 'WindowsMobileOS' => 'IEMobile|Windows Phone|Windows CE.*(PPC|Smartphone)|MSIEMobile|Window Mobile|XBLWP7', 'iOS' => '(iphone|ipod|ipad)', 'FlashLiteOS' => '', 'JavaOS' => '', 'NokiaOS' => '', 'webOS' => '', 'badaOS' => '\bBada\b', 'BREWOS' => '', ); // List of mobile User Agents. protected $userAgents = array( 'Chrome' => '\bCrMo\b|Chrome\/[.0-9]* Mobile', 'Dolfin' => '\bDolfin\b', 'Opera' => 'Opera.*Mini|Opera.*Mobi', 'Skyfire' => 'skyfire', 'IE' => 'IEMobile', 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile', 'Bolt' => 'bolt', 'TeaShark' => 'teashark', 'Blazer' => 'Blazer', 'Safari' => 'Mobile.*Safari|Safari.*Mobile', 'Midori' => 'midori', 'GenericBrowser' => 'NokiaBrowser|OviBrowser|SEMC.*Browser' ); function __construct(){ // Merge all rules together. $this->detectionRules = array_merge( $this->phoneDevices, $this->tabletDevices, $this->operatingSystems, $this->userAgents ); $this->userAgent = $_SERVER['HTTP_USER_AGENT']; $this->accept = $_SERVER['HTTP_ACCEPT']; if ( isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_X_WAP_CLIENTID']) || isset($_SERVER['HTTP_WAP_CONNECTION']) || isset($_SERVER['HTTP_PROFILE']) || isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) || // Reported by Nokia devices (eg. C3) isset($_SERVER['HTTP_X_NOKIA_IPADDRESS']) || isset($_SERVER['HTTP_X_NOKIA_GATEWAY_ID']) || isset($_SERVER['HTTP_X_ORANGE_ID']) || isset($_SERVER['HTTP_X_VODAFONE_3GPDPCONTEXT']) || isset($_SERVER['HTTP_X_HUAWEI_USERID']) || isset($_SERVER['HTTP_UA_OS']) || // Reported by Windows Smartphones (isset($_SERVER['HTTP_UA_CPU']) && $_SERVER['HTTP_UA_CPU'] == 'ARM') // Seen this on a HTC ) { $this->isMobile = true; } elseif (!empty($this->accept) && (strpos($this->accept, 'text/vnd.wap.wml') !== false || strpos($this->accept, 'application/vnd.wap.xhtml+xml') !== false)) { $this->isMobile = true; } else { $this->_detect(); } } public function getRules() { return $this->detectionRules; } /** * Magic overloading method. * * @method boolean is[...]() * @param string $name * @param array $arguments * @return mixed */ public function __call($name, $arguments) { $key = substr($name, 2); return $this->_detect($key); } /** * Private method that does the detection of the * mobile devices. * * @param type $key * @return boolean|null */ private function _detect($key='') { if(empty($key)){ // Begin general search. foreach($this->detectionRules as $_regex){ if(empty($_regex)){ continue; } if(preg_match('/'.$_regex.'/is', $this->userAgent)){ $this->isMobile = true; return true; } } return false; } else { // Search for a certain key. // Make the keys lowecase so we can match: isIphone(), isiPhone(), isiphone(), etc. $key = strtolower($key); $_rules = array_change_key_case($this->detectionRules); if(array_key_exists($key, $_rules)){ if(empty($_rules[$key])){ return null; } if(preg_match('/'.$_rules[$key].'/is', $this->userAgent)){ $this->isMobile = true; return true; } else { return false; } } else { trigger_error("Method $key is not defined", E_USER_WARNING); } return false; } } /** * Check if the device is mobile. * Returns true if any type of mobile device detected, including special ones * @return bool */ public function isMobile() { return $this->isMobile; } /** * Check if the device is a tablet. * Return true if any type of tablet device is detected. * @return boolean */ public function isTablet() { foreach($this->tabletDevices as $_regex){ if(preg_match('/'.$_regex.'/is', $this->userAgent)){ $this->isTablet = true; return true; } } return false; } }
0query
trunk/0query/libraries/Mobile_Detect.php
PHP
gpl2
11,622
<?php // TODO Move all core functions to here and deprecate plugin_engine function baseurl() { $protocol = ! empty ( $_SERVER ['HTTPS'] ) ? "https" : "http"; return rtrim ( $protocol . "://" . $_SERVER ['HTTP_HOST'] . dirname ( $_SERVER ['SCRIPT_NAME'] ), "/" ); } function load_libraries() { global $CONF; if (! empty ( $CONF ['libraries'] )) { foreach ( $CONF ['libraries'] as $library ) { $file = ROOT . "/libraries/$library.php"; if (file_exists ( $file )) { include_once $file; } } } } function is_mobile() { static $is_mobile = null ; if ( $is_mobile === null ) { if (isset($_REQUEST['nomobile'])){ $_SESSION['nomobile'] = true; header("Location:". BASE_URL ); }else if ( isset($_SESSION['nomobile']) ){ return false ; }else{ if ( class_exists("Mobile_Detect") ) { $detect = new Mobile_Detect(); $is_mobile = $detect->isMobile() ; }else{ $is_mobile = false ; } } } return $is_mobile ; } function url($path) { echo (!empty($_SERVER['FRIENDLY_URLS'])) ? BASE_URL."/".strtolower($path) : BASE_URL."?p=".$path ; }
0query
trunk/0query/core/functions.php
PHP
gpl2
1,133
<?php function get_header() { global $page ; if ( file_exists(TEMPLATE_PATH."header.php") ){ include_once TEMPLATE_PATH."header.php"; } } function get_footer() { global $page ; if ( file_exists(TEMPLATE_PATH."footer.php") ){ include_once TEMPLATE_PATH."footer.php"; } } function get_sidebar(){} function get_search_form(){} function get_page(){ global $page ; $page->output() ; } function get_menu() { global $main_menu ; $main_menu->output() ; } function get_page_id() { global $page ; echo $page->id ; }
0query
trunk/0query/core/template_engine.php
PHP
gpl2
568
<?php function fire($event){ global $CONF ; if (!empty($CONF['plugins'])){ foreach ($CONF['plugins'] as $plgname) { include_once ROOT."/plugins/".$plgname.".php"; $functionName = $plgname."_".$event; if ( function_exists($functionName) ) { return call_user_func($functionName); } } } }
0query
trunk/0query/core/plugin_engine.php
PHP
gpl2
313
<?php session_start(); global $CONF ; global $page ; define ('TEMPLATES_PATH',"templates/") ; define ('TEMPLATE_PATH', TEMPLATES_PATH."/".$CONF['template']."/") ; define ('BASE_URL', baseurl()); load_libraries(); fire('before_process'); $pages_dir = "content/pages/" ; $content = new Content (); $main_menu = new Menu(); $main_menu->name = "mainMenu" ; // Scan pages files $first = true ; // If some elem needs special code if ($handle = opendir ( $pages_dir )) { while ( false !== ($file = readdir ( $handle )) ) { if (is_dir($pages_dir.$file) && $file != "." && $file != ".." && substr($file,0,1) != "." ) { $title = trim(substr(strstr($file,'.'),1)); $alias = strtolower($title); $order = (int)substr($file,0,strpos($file,".")); $link = (!empty($_SERVER['FRIENDLY_URLS'])) ? BASE_URL."/".strtolower($alias) : BASE_URL."?p=".$alias ; if ( strtolower($alias) == $CONF['home'] ) { $link = BASE_URL ; }; $item = new MenuItem ($file, $title, $link, $alias , 0 , $order ); $main_menu->addItem( $item ); $first = false; } } closedir ( $handle ); } fire('after_process'); // Load Template $menu_item = $main_menu->getItem($content->getCurrentPage()); $menu_item->active = true; if ($menu_item) { $page = $menu_item->getPage() ; if (is_mobile() && file_exists( TEMPLATE_PATH."/index.mobile.php" )){ include_once TEMPLATE_PATH."/index.mobile.php" ; }else{ include_once TEMPLATE_PATH."/index.php" ; } }else { $page = new Page(); include_once TEMPLATE_PATH."/404.php" ; }
0query
trunk/0query/core/bootstrap.php
PHP
gpl2
1,648
<?php /** * * Enter description here ... * @author pepe * */ class Content { /** * * Enter description here ... * @var Page */ var $current_page = null ; /** * * Enter description here ... * @var unknown_type */ var $home = null ; /** * * Enter description here ... * @var Menu */ var $main_menu ; /** * @return the $current_page */ public function getCurrentPage() { global $CONF ; if ($this->current_page) { return $this->current_page ; }elseif ($CONF['home']){ return $CONF['home']; }else { return "home" ; } } /** * @return the $home */ public function getHome() { return $this->home; } /** * @return the $main_menu */ public function getMainMenu() { return $this->main_menu; } /** * @param Page $current_page */ public function setCurrentPage($current_page) { $this->current_page = $current_page; } /** * @param unknown_type $home */ public function setHome($home) { $this->home = $home; } /** * @param Menu $main_menu */ public function setMainMenu($main_menu) { $this->main_menu = $main_menu; } function __construct() { if(!isset($_GET['p'])) return ; $args = explode("/", $_GET['p'] ) ; if ( count($args) ){ $this->current_page = $args[0] ; } } }
0query
trunk/0query/core/classes/Content.class.php
PHP
gpl2
1,408
<?php class Page { var $path ; var $alias ; var $id ; var $css = null ; var $content ; function __construct($path = null , $alias = null, $id = null ) { $this->alias = $alias ; $this->path = "content/pages/$path/"; $this->id = ($id) ? $id : $alias ; } function output() { if (is_mobile() && file_exists($this->path."index.mobile.php")) { include_once $this->path."index.mobile.php" ; }else{ include_once $this->path."index.php" ; } } function css() { $dir = $this->path."css"; if (is_dir($dir)) { if ($handle = opendir ( $dir )) { while ( false !== ($file = readdir ( $handle )) ) { $parts = explode(".", $file) ; if ( $file != "." && $file != ".." && end($parts) == "css") { echo '<link rel="stylesheet" href="'.$dir."/".$file .'" type="text/css" media="screen">'; } } closedir ( $handle ); } } } function js() { $dir = $this->path."js"; if (is_dir($dir)) { if ($handle = opendir ( $dir )) { while ( false !== ($file = readdir ( $handle )) ) { $parts = explode(".", $file) ; if ( $file != "." && $file != ".." && end($parts) == "js") { echo '<script src="'.$dir.'/'.$file.'"></script> '; } } closedir ( $handle ); } } } }
0query
trunk/0query/core/classes/Page.class.php
PHP
gpl2
1,372
<?php class Menu { var $output ; /** * * Enter description here ... * @var unknown_type */ var $items = array (); /** * Identifier of the menu */ var $name = null ; private $_items_index = array (); function output() { if ($this->output) return $this->output; usort($this->items, "MenuItem::compare") ; foreach ( $this->items as $item ) { if ($item->order !== false ){ $this->output .= $item->buildOutput (); } } return $this->output; } /** * * Enter description here ... * @param $i * @return MenuItem */ function getItem($i) { if (isset($this->items[$i])){ return $this->items[$i]; }else{ return null; } } /** * * Enter description here ... * @param $item MenuItem */ function addItem(&$item) { global $CONF ; $this->items [$item->alias] = $item; $item->menu = $this ; } }
0query
trunk/0query/core/classes/Menu.class.php
PHP
gpl2
945
<?php class MenuItem { /** * * Enter description here ... * @param MenuItem $a * @param MenuItem $b */ static function compare($a, $b ) { if ($a->order == $b->order) { return 0; } return ($a->order < $b->order) ? -1 : 1; } /** * Identifier like 'home' , 'about' * @var string */ var $title; /** * * Url to be linked. Can be absolute or relative. * @var string */ var $link; /** * * If is the current page, active = true * @var unknown_type */ var $active; /** * * Enter description here ... * @var unknown_type */ var $order = null ; /** * * Pointer to corresponding Page object * @var Page */ var $page; /** * Pointer to parent menu */ var $menu ; function getPage() { return $this->page; } function __construct($file , $title, $link, $alias , $active = false, $order = null ) { global $CONF ; $this->file = $file ; $this->title = $title; $this->link = $link; $this->alias = $alias; $this->active = $active; $this->order = $order ; /** * * Pointer to corresponding Page object * @var Page */ $this->page = new Page ( $file, $alias ); } function buildOutput() { include TEMPLATE_PATH . "menu-item.php"; } }
0query
trunk/0query/core/classes/MenuItem.class.php
PHP
gpl2
1,369
<?php $CONF['home']= "home" ; $CONF['cleanurls'] = true ; $CONF['template'] = 'portfolio' ; $CONF['plugins'] = array('sitemap'); $CONF['libraries'] = array('Mobile_Detect');
0query
trunk/0query/config.php
PHP
gpl2
181
<?php /* * @author Ignacio Vazquez - ivazquez at adooxen.com * @version 1.4 Beta * */ define ('ROOT',dirname(__FILE__)); include_once "config.php" ; include_once 'core/functions.php'; include_once 'core/classes/Content.class.php'; include_once "core/classes/MenuItem.class.php" ; include_once "core/classes/Menu.class.php" ; include_once "core/classes/Page.class.php" ; include_once "core/template_engine.php"; include_once "core/plugin_engine.php"; include_once "core/bootstrap.php";
0query
trunk/0query/index.php
PHP
gpl2
526
<?php function sitemap_after_process() { if (isset ( $_GET ['p'] ) && $_GET ['p'] == 'sitemap.xml') { global $main_menu; $out = '<?xml version="1.0" encoding="UTF-8"?>'; $out .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; foreach ( $main_menu->items as $item ) { $out.="<url>"; $out.="<loc>".$item->link."</loc>"; $out.="<changefreq>weekly</changefreq>"; $out.='<priority>1</priority>'; $out.="</url>"; } $out .= '</urlset>'; header ( "Content-Type: application/xml" ); echo $out; exit (); } }
0query
tags/1.4/0query/plugins/sitemap.php
PHP
gpl2
563
<h2 class="contact">Contact Me</h2> <p>At has veri feugait placerat, in semper offendit praesent his. Omnium impetus facilis sed at, ex viris tincidunt ius. Unum eirmod dignissim id quo. Sit te atomorum quaerendum neglegentur, his primis tamquam et. Eu quo quot veri alienum, ea eos nullam luptatum accusamus. Ea mel causae phaedrum reprimique, at vidisse dolores ocurreret nam.</p> <form method ="POST" id="contactform"> <p><label for="name">Name</label></p> <input type="text" id=name name=name placeholder="First and last name" required tabindex="1" /> <p><label for="email">Email</label></p> <input type="text" id=email name=email placeholder="example@domain.com" required tabindex="2" /> <p><label for="comment">Your Message</label></p> <textarea name="comment" id="comment" tabindex="4"></textarea> <input name="submit" type="submit" id="submit" tabindex="5" value="Send Message" /> </form>
0query
tags/1.4/0query/content/pages/3. Contact/index.php
Hack
gpl2
986
<h2 class="intro"> <strong>Just</strong> a simple <strong>website</strong> framework <span class="sub">.. and Anything more</span> </h2> <div class="clear"></div> <p> Ea mei nullam facete, omnis oratio offendit ius cu. Doming takimata repudiandae usu an, mei dicant takimata id, pri eleifend inimicus euripidis at. His vero singulis ea, quem euripidis abhorreant mei ut, et populo iriure vix. Usu ludus affert voluptaria ei, vix ea error definitiones, movet fastidii signiferumque in qui. </p>
0query
tags/1.4/0query/content/pages/1. Home/index.php
Hack
gpl2
504
<li class="<?php if ($this->active) echo "active" ?>"> <a href="<?php echo $this->link?>"><?php echo $this->title ?></a> </li>
0query
tags/1.4/0query/templates/gelsheet/menu-item.php
PHP
gpl2
129
$(document).ready(function() { $('#home-slide').cycle('fade'); });
0query
tags/1.4/0query/templates/gelsheet/js/gelsheet.js
JavaScript
gpl2
75
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> <head> <title>Gelsheet: The opensource web spreadsheet</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="keywords" content="PHP Spreadsheet, Web spreadsheet, Online spreadsheet, Worpress spreadsheet, Opengoo spreadsheet, Gelsheet, AJAX Spreadsheet, Opensorce web spreadsheet, Opensource spreadsheet, Opensource google docs" /> <meta name="description" content="GelSheet is a free and open source web spreadsheet that allow users to create, edit and export in many formats your everyday work. It's intended to run either standalone or integrated within another web tool. It was born as a part of Opengoo web office" /> <link rel="stylesheet" href="<?php echo TEMPLATE_PATH ?>style.css" type="text/css" media="screen"> <?php $page->css();?> <script src="<?php echo TEMPLATE_PATH ?>js/jquery-1.4.2.min.js"></script> <script src="<?php echo TEMPLATE_PATH ?>js/jquery.cycle.all.min.js"></script> <script src="<?php echo TEMPLATE_PATH ?>js/gelsheet.js"></script> <?php $page->js() ?> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-20197577-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <meta name="google-site-verification" content="hVHPQY0v01fGvaOHBGhZSIvNWNeYWPlXgKfUQeONoMc" /> </head> <body class="home page page-id-1052 page-template page-template-page-home-2-php"> <div id="page" class="fix"> <div id="header" class="fix"> <div class="content"> <ul id="nav" class="fix"> <?php $main_menu->output() ?> </ul> </div> </div> <div class="clear"></div> <div id="main_content" class="fix" > <div class="content fix">
0query
tags/1.4/0query/templates/gelsheet/header.php
PHP
gpl2
2,207
Not found
0query
tags/1.4/0query/templates/gelsheet/404.php
Hack
gpl2
9
je ul, ol {list-style-type: none;} table, tbody, fieldset {margin:0;padding:0;border:none;} p,.p {text-align: left;margin-bottom: 1em;} p.halfp, .halfp{margin-bottom:.5em;} hr{ margin: 1.5em 0; border:none; border-bottom: 1px dashed #ccc;} strong,b, th, label, .fboxes h4{font-weight: bold; font-family: palatino,'palatino linotype',georgia,serif;} strong a{border-bottom: 1px dotted #bbb;} strong a:hover{ text-decoration: none; border-bottom: 1px dotted #000; } label small{font-weight: normal;} em{font-style: italic;} .tab {padding-left:30px;} body{ font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:normal; line-height:21px; font-size: 14px; color:#000; font-family:palatino, 'palatino linotype', serif; letter-spacing:-.01em; background: #000 ; } /* LINKS */ a{ color: #000; text-decoration: none; } .billboard a { text-decoration: underline; } .section a, .illustration a{border-bottom: 1px dotted #bbb;} .section a, .illustration a{border-bottom: none;} a:hover{ color:#3399CC; cursor:pointer; } .banner a, .notfound a{color:#3399CC;text-decoration:underline;} a img{border:none;} /* HEADERS */ h1,h2,h3,h4,h5,h6{ line-height: 1.2em; font-weight: normal; font-family: palatino,'palatino linotype',georgia,serif; color:#000; display: block; position: relative; z-index:10; } h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .section h1 a, .section h2 a, .section h3 a, .section h4 a, .section h5 a{border: none;} h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover h6 a:hover{ text-decoration: underline; color: #000; } h1{font-size: 34px;} h2{font-size: 24px;} h3{font-size: 18px;} h4{font-size: 16px; padding-bottom:8px;} h5{font-size: 14px;} h1, h2 { letter-spacing:-.050em; width:100%; text-align: center; line-height: 1.2em; } h1.headline { font-size: 45px; line-height: 1em; display: block; } h1.feat_headline { font-size:55px; line-height: 1em; display:block; text-align:left; width:500px; } h2.comm { border-bottom:1px dotted; display:block; float:left; font-size:35px; line-height:1em; margin-bottom:5px; padding:10px 0; text-align:left; width:570px; } h3.fsub{ text-align: center; } h3.fsub em{ font-style: normal; } .dcap { display:inline; float:left; font-size:3.1em; line-height:0.8em; margin:0.07em 0.1em 0 0; text-transform:uppercase; } .a_post_content h3{ margin-bottom:1em; } #related h3{margin-bottom:none;} .a_post_content p a{color:#3399cc;} .a_post_content p a:hover{text-decoration: underline;} #mainlogo { float: left ; } #header { background: #000; padding: 10px 0; color: #fff; } #header a {color: #fff;} /* NAVIGATION */ /* Main Navigation */ #nav { list-style: none; padding:0; line-height: 8px; padding-left: 3px; float: left; margin-top: 5px; margin-left: 20px; } #nav li, .subnav li, .sides li{ margin: 0px 0px 0px 0px; padding: 0px; float: left; } /* Header */ .inline li a{padding: 0 10px;} #nav li a, .headericon{ font-family: georgia, times, serif; background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 0; border: 1px solid #000; border-left: 1px solid #333; border-top: 1px solid #333; text-shadow: #000 0px -1px 0; line-height: .7em; padding: 9px 13px; margin-right: 20px; text-decoration: none; display: block; color:#eee; font-size: 1.1em; text-transform: capitalize; } .headericon, .headertext{ display: block; float:right; margin: 5px 0px 0 0; } .headericon span.loginicon{ display: block; background: url(../img/arrow-white.png) no-repeat center right; padding-right: 10px; } #nav li a:hover, .headericon:hover{ background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 -72px; border: 1px solid #064271; border-left: 1px solid #74AFD7; border-top: 1px solid #74AFD7; text-shadow: #064271 0px -1px 0; color: #fff; display: block; } #nav li a:active, .headericon:active{ background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 -108px; border: 1px solid #2480B2; border-left: 1px solid #064271; border-top: 1px solid #064271; } #nav .current_page_item a, #nav .current_page_ancestor a, #nav .current_page_parent a{ border: 1px solid #222; border-left: 1px solid #aaa; border-top: 1px solid #aaa; background: #666 url(../img/bg_nav_sprite.png) repeat-x 0 -36px; text-shadow: #222 0px -1px 0; color: #fff; } #nav li a small{ display: none; } #nav li a:hover small{color: #FFF;} #nav .on a small, #nav .on a:hover small{ text-decoration: none; color: #444; font-style: normal; } #main_content { color: #000; background: #fff; border-top:1px solid #eee; padding-top: .6em; padding-bottom: 3.5em; min-height: 600px; } /* Feature Nav 2 */ #home-slide { height:100%; width:100%; overflow:hidden ; } #home_page{ padding: 5px 0; } #home_page .splash_left{ padding-left:25px; padding-right: 25px; width: 372px; font-size: 1.34em; line-height: 1.5em } #home_page .splash_left h2{ font-size: 1.6em; } #home_page .featurenav-contain{ background: #fff; padding: 30px 0px 30px 0px; margin-top: 1px; } #home_page .thelatest{ float: left; line-height: 60px; margin:0 240px 0 50px; font-size: 2.5em; font-style: italic; color:#aaa; } #home_page #featurenav a{ float: left; display: block; border: 1px solid #ddd; padding: 3px; background: #fff; overflow:hidden; margin-right: 30px } #home_page #featurenav a:hover { border: 1px solid #bbb; } #home_page #featurenav a:hover span span{ } #home_page #featurenav span{ display:block; width: 60px; height: 60px; } #home_page #featurenav span span { background: url(../img/nav-overlay.png) no-repeat 0 0; } #home_page #featurenav a.activeSlide span span { background: url(../img/nav-overlay.png) no-repeat 0 -60px; } /* Footer */ #footer { clear:both; font-size:0.9em; overflow:hidden; padding: 10px 10px 60px 10px; background: transparent url(../img/bg-leaf.gif) no-repeat center bottom; color: #fff; text-align: center ; } #footer a{ color: #fff; } #footer a:hover{ text-decoration: underline; color: #fff; } #footer #footnav, #footer #footnav li{display:inline;} #footer #footnav small{display: none;} #footer #footnav {margin-left: 20px;} #footnav li a{ padding: 3px 2px; line-height: 1em; margin-right: 10px; border-top:1px solid transparent; border-bottom: 1px solid transparent; text-decoration:none; } #footnav li a:hover{ border-top:1px solid #666; border-bottom: 1px solid #666;} #footnav li.on a{border-top:1px solid #666; border-bottom: 1px solid #666;} .updated{color: #999;font-size: 10px;display: block;text-align: center;} .updated a{color:#999} /**** Home Splash ****/ .homepage-title{ line-height: 1.4em; } #feature_splash { border-bottom: 1px solid #ddd; padding-top: 30px; height: 400px; /*overflow:hidden;*/ position:relative; } #feature_splash.theme_splash { padding-top: 30px; height: 320px; } #feature_splash.theme_splash .splash_left { padding: 30px 40px 30px; } #feature_splash h1{ font-size: 37px; margin: 15px 0 28px; } #feature_splash .splash_left h2, #feature_splash .splash_left h1{ text-align: left; font-family: palatino, 'palatino linotype', georgia; margin-bottom: .5em; } #feature_splash .splash_left h2{font-size: 25px;} #feature_splash .splash_left { padding: 0px 40px 30px; width: 350px; margin-right: 30px; font-size: 1.2em; color: #555; float: left; } .splash_actioncall{ margin: 1em 0 1em; font-size: 1.4em; color: #aaa; font-style: italic; } .splash_actioncall span{margin: 0 12px;} #feature_splash .splash_button img, #feature_splash img{ vertical-align: middle; } #feature_splash .splash_right{ -moz-box-shadow: 01px 1px 15px 1px #CCCCCC ; height: 375px; width: 570px; overflow:hidden; float: left; position: relative; z-index: 0; } #feature_splash .viewimage{ border: 1px solid #333; border-bottom: 2px solid #000; border-right: 2px solid #000; background: #000; padding: 2px; margin-bottom: 12px; } #feature_splash .viewinfo{ display: block; position: absolute; right: 180px; top: 110px; width: 160px; z-index: 100; text-align: center; color: #aaa; font-size: 1.2em; text-shadow: #000 0 -1px 0; } #feature_splash .viewinfo:hover{color: #fff;} .column_left { float:left; width: 150px ; margin-right: 30px; color: #555; } .column_left ul { margin-right: 20px; } .column_left h1, .column_left h2 { text-align: left; } .column_right { float: left ; } .gelsheet-container{ width: 800px; -moz-box-shadow: 01px 1px 15px 1px #CCCCCC ; } /* IMAGES */ .thumb {padding: 4px;border:1px solid #bbb;} .preload{display:none;} .content{ width:1050px; margin-left:auto; margin-right:auto; } /* FLOATING AND ALIGNMENT */ .alignleft, .floatleft{float:left;margin:0em 1em .3em 0;clear:left;} .alignright, .floatright{float:right;margin:0em 0em .3em 1em;} .right{float:right;} .left{float:left;} .clear{clear:both;} .aligncenter {margin-left: auto;margin-right: auto;} .center, .center p{text-align: center;} .hidden {display: none;} /** hacks **/ .fix:after{content:".";display:block;height:0;clear:both;visibility:hidden;} .fix{display:inline-block;} * html .fix{height:1%;} .fix{display:block;}
0query
tags/1.4/0query/templates/gelsheet/style.css
CSS
gpl2
9,758
<div id="footer" class="fix"><br> <div class="footcols_container"> <div class="content fix"> Powered by <a href="#">MinCMS</a> | Designed by <a href="http://www.gelsheet.org">Home</a>Designed By Powered by <a href="http://www.gelsheet.org">Gelsheet - The opensource online spreadsheet</a> About | Contact --> </div> </div> </div> </div> </body> </html>
0query
tags/1.4/0query/templates/gelsheet/footer.php
Hack
gpl2
389
<?php include_once 'header.php' ?> <div id="main_content" class="fix" > <div class="content fix"> <?php $page->output() ;?> </div> <!-- end .content --> </div> <?php include_once 'footer.php' ?>
0query
tags/1.4/0query/templates/gelsheet/index.php
PHP
gpl2
214
<li> <a class="wintrolink wanchorLink <?php if ($this->active) echo "active" ?>" href="<?php echo $this->link?>"><?php echo $this->title ?></a> </li>
0query
tags/1.4/0query/templates/portfolio/menu-item.php
PHP
gpl2
156
div#fancy_overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: none; z-index: 30; } div#fancy_loading { position: absolute; height: 40px; width: 40px; cursor: pointer; display: none; overflow: hidden; background: transparent; z-index: 100; } div#fancy_loading div { position: absolute; top: 0; left: 0; width: 40px; height: 480px; background: transparent url('fancy_progress.png') no-repeat; } div#fancy_outer { position: absolute; top: 0; left: 0; z-index: 90; padding: 20px 20px 40px 20px; margin: 0; background: transparent; display: none; } div#fancy_inner { position: relative; width:100%; height:100%; background: #FFF; } div#fancy_content { margin: 0; z-index: 100; position: absolute; } div#fancy_div { background: #000; color: #FFF; height: 100%; width: 100%; z-index: 100; } img#fancy_img { position: absolute; top: 0; left: 0; border:0; padding: 0; margin: 0; z-index: 100; width: 100%; height: 100%; } div#fancy_close { position: absolute; top: -12px; right: -15px; height: 30px; width: 30px; background: url('fancy_closebox.png') top left no-repeat; cursor: pointer; z-index: 181; display: none; } #fancy_frame { position: relative; width: 100%; height: 100%; display: none; } #fancy_ajax { width: 100%; height: 100%; overflow: auto; } a#fancy_left, a#fancy_right { position: absolute; bottom: 0px; height: 100%; width: 35%; cursor: pointer; z-index: 111; display: none; background-image: url("data:image/gif;base64,AAAA"); outline: none; overflow: hidden; } a#fancy_left { left: 0px; } a#fancy_right { right: 0px; } span.fancy_ico { position: absolute; top: 50%; margin-top: -15px; width: 30px; height: 30px; z-index: 112; cursor: pointer; display: block; } span#fancy_left_ico { left: -9999px; background: transparent url('fancy_left.png') no-repeat; } span#fancy_right_ico { right: -9999px; background: transparent url('fancy_right.png') no-repeat; } a#fancy_left:hover, a#fancy_right:hover { visibility: visible; background-color: transparent; } a#fancy_left:hover span { left: 20px; } a#fancy_right:hover span { right: 20px; } #fancy_bigIframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; } div#fancy_bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 70; border: 0; padding: 0; margin: 0; } div.fancy_bg { position: absolute; display: block; z-index: 70; border: 0; padding: 0; margin: 0; } div#fancy_bg_n { top: -20px; left: 0; width: 100%; height: 20px; background: transparent url('fancy_shadow_n.png') repeat-x; } div#fancy_bg_ne { top: -20px; right: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_ne.png') no-repeat; } div#fancy_bg_e { right: -20px; height: 100%; width: 20px; background: transparent url('fancy_shadow_e.png') repeat-y; } div#fancy_bg_se { bottom: -20px; right: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_se.png') no-repeat; } div#fancy_bg_s { bottom: -20px; left: 0; width: 100%; height: 20px; background: transparent url('fancy_shadow_s.png') repeat-x; } div#fancy_bg_sw { bottom: -20px; left: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_sw.png') no-repeat; } div#fancy_bg_w { left: -20px; height: 100%; width: 20px; background: transparent url('fancy_shadow_w.png') repeat-y; } div#fancy_bg_nw { top: -20px; left: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_nw.png') no-repeat; } div#fancy_title { position: absolute; z-index: 100; display: none; } div#fancy_title div { color: #FFF; font: bold 12px Arial; padding-bottom: 3px; white-space: nowrap; } div#fancy_title table { margin: 0 auto; } div#fancy_title table td { padding: 0; vertical-align: middle; } td#fancy_title_left { height: 32px; width: 15px; background: transparent url('fancy_title_left.png') repeat-x; } td#fancy_title_main { height: 32px; background: transparent url('fancy_title_main.png') repeat-x; } td#fancy_title_right { height: 32px; width: 15px; background: transparent url('fancy_title_right.png') repeat-x; }
0query
tags/1.4/0query/templates/portfolio/js/jquery.fancybox-1.2.6.css
CSS
gpl2
4,579
/******* *** Anchor Slider by Cedric Dugas *** *** Http://www.position-absolute.com *** Never have an anchor jumping your content, slide it. Don't forget to put an id to your anchor ! You can use and modify this script for any project you want, but please leave this comment as credit. *****/ $(document).ready(function() { $("a.anchorLink").anchorAnimate() }); jQuery.fn.anchorAnimate = function(settings) { settings = jQuery.extend({ speed : 1100 }, settings); return this.each(function(){ var caller = this $(caller).click(function (event) { event.preventDefault() var locationHref = window.location.href var elementClick = $(caller).attr("href") var destination = $(elementClick).offset().top; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() { window.location.hash = elementClick }); return false; }) }) }
0query
tags/1.4/0query/templates/portfolio/js/jquery.anchor.js
JavaScript
gpl2
975
<!DOCTYPE html> <html lang="en"> <head> <title>MinCMS - The easyest way to build your site</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" href="ie7.css" type="text/css" media="screen" /> <![endif]--> <link rel="stylesheet" href="<?php echo TEMPLATE_PATH ?>style.css" type="text/css" media="screen" /> <?php $page->css();?> <!-- Include page specific css --> <script src="<?php echo TEMPLATE_PATH ?>js/jquery.min.js" type="text/javascript"></script> <?php $page->js() ?> <!-- include page specific js --> </head> <body> <header> <!-- HTML5 header tag --> <div id="headercontainer"> <h1><a class="introlink anchorLink" href="">MINCMS - Min Is Not CMS</a></h1> <nav> <!-- HTML5 navigation tag --> <ul> <?php get_menu() ?> </ul> </nav> </div> </header> <section id="contentcontainer"> <!-- HTML5 section tag for the content 'section' --> <section id="<?php get_page_id();?>">
0query
tags/1.4/0query/templates/portfolio/header.php
PHP
gpl2
1,213
<?php get_header()?> <h2>Not found</h2> <?php get_footer()?>
0query
tags/1.4/0query/templates/portfolio/404.php
PHP
gpl2
62
header { position: absolute; left: 0; } #intro h2 { margin-bottom: 100px; } h2.work { width: 800px; }
0query
tags/1.4/0query/templates/portfolio/ie7.css
CSS
gpl2
102
* { margin: 0; padding: 0; outline: 0; } /* HTML5 tags */ header, section, footer, aside, nav, article, figure { display: block; } @font-face { font-family: Keffeesatz; src: url(YanoneKaffeesatz-Light.otf) format("opentype") } @font-face { font-family: KeffeesatzBold; src: url(YanoneKaffeesatz-Bold.otf) format("opentype") } body { font-family: Keffeesatz, Arial; color: #4b4b4b; background: url(images/pattern.gif); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2); } ::selection { background-color: rgba(122, 192, 0, 0.2); } ::-moz-selection { background-color: rgba(122, 192, 0, 0.2); border: 10px solid red; } h1 { color: #fff; font-size: 40px; position: relative; top: 15px; } h1 a { color: #fff; font-size: 40px; background-color: #ff5400; padding: 5px 25px 10px 25px; width: 300px; -webkit-border-radius: 10px; -moz-border-radius: 10px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6); border-bottom: 1px solid rgba(0, 0, 0, 0.4); border-top: 1px solid rgba(255, 255, 255, 0.6); background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #c34000), color-stop(0.62, #ff5400) ); background: -moz-linear-gradient( center bottom, #c34000 23%, #ff5400 62% ); } h1 a:hover { color: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.4); padding-bottom: 10px; background-color: #7ac000; background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #619702), color-stop(0.62, #7ac000) ); background: -moz-linear-gradient( center bottom, #619702 23%, #7ac000 62% ); } h2 { padding-left: 125px; font-size: 66px; color: #ff5400; height: 105px; } h2 span.sub { font-size: 48px; float: left; color: #4b4b4b; } h2.intro { background: url(images/intro.png) no-repeat -10px -10px; height: 170px } h2.work { background: url(images/portfolio.png) no-repeat -10px -10px; } h2.about { background: url(images/about.png) no-repeat -10px -10px; } h2.contact { background: url(images/contact.png) no-repeat -10px -10px; } a { color: #7ac000; text-decoration: none; border-bottom: 1px solid #7ac000; padding-bottom: 2px; } a:hover { color: #ff5400; text-decoration: none; border-bottom: 1px solid #ff5400; padding-bottom: 2px; } a:active { color: #ff5400; text-decoration: none; border-bottom: 1px solid #ff5400; padding-bottom: 2px; position: relative; top: 1px; } p { font-size: 24px; margin-bottom: 15px; line-height: 36px; } strong { font-family: KeffeesatzBold, Arial; } header { padding: 5px 0; width: 100%; background-color: #000; margin-bottom: 25px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); position: fixed; z-index: 10; float: left; } #headercontainer, #contentcontainer { width: 960px; margin: 0 auto; position: relative; } #contentcontainer { float: none; padding-top: 0px; } nav { width: auto; float: left; } nav ul { position: absolute; right: 0; display: block; margin-top: -37px; } nav ul li { display: inline; margin-left: 50px; } nav ul li a { font-size: 24px; border-bottom: none; } section { padding-top: 150px; } #intro h2 a { padding-bottom: 0px; } #intro a.featured { padding-bottom: 0px; border-bottom: none; } #intro a img { border: 5px solid rgba(122, 192, 0, 0.15); -webkit-border-radius: 5px; margin-top: 40px; margin-bottom: 5px; } #intro a img:hover, #portfolio .work a img:hover, input:hover, textarea:hover { border: 5px solid rgba(122, 192, 0, 1); -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.4); } #intro a img:active, #portfolio .work a img:active { -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); } #portfolio ul.work a { border-bottom: none; } #portfolio ul.work a img { border: 5px solid rgba(122, 192, 0, 0.15); -webkit-border-radius: 5px; } #portfolio ul.work { float: left; margin-left: -15px; width: 975px; } #portfolio ul.work li { list-style: none; float: left; margin-left: 15px; margin-bottom: 15px; } #contact { margin-bottom: 0px; } input[type="text"] { width: 400px; } textarea { width: 750px; height: 275px; } label { color: #ff5400; } input, textarea { background-color: rgba(255, 255, 255, 0.4); border: 5px solid rgba(122, 192, 0, 0.15); padding: 10px; font-family: Keffeesatz, Arial; color: #4b4b4b; font-size: 24px; -webkit-border-radius: 5px; margin-bottom: 15px; margin-top: -10px; } input:focus, textarea:focus { border: 5px solid #ff5400; background-color: rgba(255, 255, 255, 1); } input[type="submit"]{ border: none; cursor: pointer; color: #fff; font-size: 24px; background-color: #7ac000; padding: 5px 36px 8px 36px; -webkit-border-radius: 10px; -moz-border-radius: 10px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6); border-bottom: 1px solid rgba(0, 0, 0, 0.4); border-top: 1px solid rgba(255, 255, 255, 0.6); background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #619702), color-stop(0.62, #7ac000) ); background: -moz-linear-gradient( center bottom, #619702 23%, #7ac000 62% ); } input[type="submit"]:hover { color: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.4); background-color: #ff5400; background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #c34000), color-stop(0.62, #ff5400) ); background: -moz-linear-gradient( center bottom, #c34000 23%, #ff5400 62% ); } input[type="submit"]:active { position: relative; top: 1px; } footer {margin-top: 50px; } footer ul { margin-bottom: 150px; } footer ul li { display: inline; margin-right: 50px; } footer ul li a { font-size: 24px; margin-left: 10px; } footer ul li img { vertical-align: bottom; position: relative; top: 2px; } div.clear { clear: both }
0query
tags/1.4/0query/templates/portfolio/style.css
CSS
gpl2
5,803
</section> <footer> <ul> <li>Powered by <a href="http://code.google.com/p/0query/"> 0Query </a> <li>Designed by: <a href="http://www.inspectelement.com">Inspect Element</a> </ul> </footer> </section> </body> </html>
0query
tags/1.4/0query/templates/portfolio/footer.php
Hack
gpl2
262
<?php get_header() ?> <?php get_page() ?> <?php get_footer() ?>
0query
tags/1.4/0query/templates/portfolio/index.php
PHP
gpl2
64
<?php function baseurl() { $protocol = !empty($_SERVER ['HTTPS']) ? "https" : "http"; return rtrim($protocol . "://" . $_SERVER ['HTTP_HOST'] .dirname($_SERVER ['SCRIPT_NAME']),"/"); }
0query
tags/1.4/0query/core/functions.php
PHP
gpl2
191
<?php function get_header() { global $page ; if ( file_exists(TEMPLATE_PATH."header.php") ){ include_once TEMPLATE_PATH."header.php"; } } function get_footer() { global $page ; if ( file_exists(TEMPLATE_PATH."footer.php") ){ include_once TEMPLATE_PATH."footer.php"; } } function get_sidebar(){} function get_search_form(){} function get_page(){ global $page ; $page->output() ; } function get_menu() { global $main_menu ; $main_menu->output() ; } function get_page_id() { global $page ; echo $page->id ; }
0query
tags/1.4/0query/core/template_engine.php
PHP
gpl2
568
<?php function fire($event){ global $CONF ; if (!empty($CONF['plugins'])){ foreach ($CONF['plugins'] as $plgname) { include_once ROOT."/plugins/".$plgname.".php"; $functionName = $plgname."_".$event; if ( function_exists($functionName) ) { return call_user_func($functionName); } } } }
0query
tags/1.4/0query/core/plugin_engine.php
PHP
gpl2
313
<?php global $CONF ; global $page ; define ('TEMPLATES_PATH',"templates/") ; define ('TEMPLATE_PATH', TEMPLATES_PATH."/".$CONF['template']."/") ; define ('BASE_URL', baseurl()); fire('before_process'); $pages_dir = "content/pages/" ; $content = new Content (); $main_menu = new Menu(); $main_menu->name = "mainMenu" ; // Scan pages files $first = true ; // If some elem needs special code if ($handle = opendir ( $pages_dir )) { while ( false !== ($file = readdir ( $handle )) ) { if (is_dir($pages_dir.$file) && $file != "." && $file != ".." && substr($file,0,1) != "." ) { $title = trim(substr(strstr($file,'.'),1)); $alias = strtolower($title); $order = (int)substr($file,0,strpos($file,".")); $link = (!empty($_SERVER['FRIENDLY_URLS'])) ? BASE_URL."/".strtolower($alias) : BASE_URL."?p=".$alias ; if ( strtolower($alias) == $CONF['home'] ) { $link = BASE_URL ; }; $item = new MenuItem ($file, $title, $link, $alias , 0 , $order ); $main_menu->addItem( $item ); $first = false; } } closedir ( $handle ); } fire('after_process'); // Load Template $menu_item = $main_menu->getItem($content->getCurrentPage()); $menu_item->active = true; if ($menu_item) { $page = $menu_item->getPage() ; include_once TEMPLATE_PATH."/index.php" ; }else { $page = new Page(); include_once TEMPLATE_PATH."/404.php" ; }
0query
tags/1.4/0query/core/bootstrap.php
PHP
gpl2
1,470
<?php /** * * Enter description here ... * @author pepe * */ class Content { /** * * Enter description here ... * @var Page */ var $current_page = null ; /** * * Enter description here ... * @var unknown_type */ var $home = null ; /** * * Enter description here ... * @var Menu */ var $main_menu ; /** * @return the $current_page */ public function getCurrentPage() { global $CONF ; if ($this->current_page) { return $this->current_page ; }elseif ($CONF['home']){ return $CONF['home']; }else { return "home" ; } } /** * @return the $home */ public function getHome() { return $this->home; } /** * @return the $main_menu */ public function getMainMenu() { return $this->main_menu; } /** * @param Page $current_page */ public function setCurrentPage($current_page) { $this->current_page = $current_page; } /** * @param unknown_type $home */ public function setHome($home) { $this->home = $home; } /** * @param Menu $main_menu */ public function setMainMenu($main_menu) { $this->main_menu = $main_menu; } function __construct() { if(!isset($_GET['p'])) return ; $args = explode("/", $_GET['p'] ) ; if ( count($args) ){ $this->current_page = $args[0] ; } } }
0query
tags/1.4/0query/core/classes/Content.class.php
PHP
gpl2
1,408
<?php class Page { var $path ; var $alias ; var $id ; var $css = null ; var $content ; function __construct($path = null , $alias = null, $id = null ) { $this->alias = $alias ; $this->path = "content/pages/$path/"; $this->id = ($id) ? $id : $alias ; } function output() { include_once $this->path."index.php" ; } function css() { $dir = $this->path."css"; if (is_dir($dir)) { if ($handle = opendir ( $dir )) { while ( false !== ($file = readdir ( $handle )) ) { $parts = explode(".", $file) ; if ( $file != "." && $file != ".." && end($parts) == "css") { echo '<link rel="stylesheet" href="'.$dir."/".$file .'" type="text/css" media="screen">'; } } closedir ( $handle ); } } } function js() { $dir = $this->path."js"; if (is_dir($dir)) { if ($handle = opendir ( $dir )) { while ( false !== ($file = readdir ( $handle )) ) { $parts = explode(".", $file) ; if ( $file != "." && $file != ".." && end($parts) == "js") { echo '<script src="'.$dir.'/'.$file.'"></script> '; } } closedir ( $handle ); } } } }
0query
tags/1.4/0query/core/classes/Page.class.php
PHP
gpl2
1,231
<?php class Menu { var $output ; /** * * Enter description here ... * @var unknown_type */ var $items = array (); /** * Identifier of the menu */ var $name = null ; private $_items_index = array (); function output() { if ($this->output) return $this->output; usort($this->items, "MenuItem::compare") ; foreach ( $this->items as $item ) { if ($item->order !== false ){ $this->output .= $item->buildOutput (); } } return $this->output; } /** * * Enter description here ... * @param $i * @return MenuItem */ function getItem($i) { if (isset($this->items[$i])){ return $this->items[$i]; }else{ return null; } } /** * * Enter description here ... * @param $item MenuItem */ function addItem(&$item) { global $CONF ; $this->items [$item->alias] = $item; $item->menu = $this ; } }
0query
tags/1.4/0query/core/classes/Menu.class.php
PHP
gpl2
945