Ejemplo n.º 1
0
DomElement *WFileUpload::createDomElement()
{
  if (methodIframe_) {
    DomElement *form = DomElement::createNew(DomElement::FORM);
    form->setId(this, true);
    form->setAttribute("method", "post");
    form->setAttribute("action", generateUrl());
    form->setAttribute("enctype", "multipart/form-data");
    form->setAttribute("style", "margin:0;padding:0;display:inline");

    DomElement *input = DomElement::createNew(DomElement::INPUT);
    input->setAttribute("type", "file");
    input->setAttribute("name", "data");
    input->setAttribute("size", boost::lexical_cast<std::string>(textSize_));
    input->setId("in" + formName());

    updateSignalConnection(*input, changed, "change", true);

    form->addChild(input);

    updateDom(*form, true);

    return form;
  } else {
    DomElement *result = DomElement::createNew(DomElement::INPUT);
    result->setAttribute("type", "file");
    result->setAttribute("size", boost::lexical_cast<std::string>(textSize_));
    result->setId(this, true);
    updateSignalConnection(*result, changed, "change", true);

    updateDom(*result, true);

    return result;
  }
}
Ejemplo n.º 2
0
std::string DataStore::jsCreateStore()
{
  std::string store;

  switch (dataLocation_) {
  case ClientSide:
    store += "new Ext.data.SimpleStore({fields:[";

    for (unsigned i = 0; i < columns_.size(); ++i) {
      if (i != 0)
	store += ",";
      store += "{name:'c" + boost::lexical_cast<std::string>(i) + "',"
	"mapping:" + boost::lexical_cast<std::string>(i+1) + "}";
    }

    store += "],data:[";

    for (int i = 0; i < model_->rowCount(); ++i) {
      if (i != 0)
	store += ",";
      store += "[" + boost::lexical_cast<std::string>(getRecordId(i));
      for (unsigned j = 0; j < columns_.size(); ++j)
	store += "," + dataAsJSLiteral(i, columns_[j].modelColumn);
      store += "]";
    }

    store += "],id:0})";

    break;
  case ServerSide:
    store = "new Ext.data.Store({"
      "proxy: new Ext.data.HttpProxy({"
        "url:'" + generateUrl() + "'"
      "}),"
      "reader: new Ext.data.JsonReader({"
        "totalProperty:'count',"
        "root:'data',"
        "id:'id'"
      "},[";

    for (unsigned i = 0; i < columns_.size(); ++i) {
      if (i != 0)
	store += ",";
      store += "{name:'c" + boost::lexical_cast<std::string>(i) + "'}";
    }

    store +="])})";
  }

  rowsInserted_ = false;
  rowsDeleted_.clear();
  jsChanges_.clear();

  return store;
}
Ejemplo n.º 3
0
void DataOnline::onLoaded(WRemoteData * data)
{
    _version    = QString();
    _messageUrl = QString();

    QXmlStreamReader stream(data->reply());

    while (stream.atEnd() == false)
    {
        QXmlStreamReader::TokenType type = stream.readNext();

        if (type != QXmlStreamReader::StartElement) continue;

        if (stream.name() == "version")
        {
            _version = WControllerXml::readNextString(&stream);
        }
        else if (stream.name() == "messageUrl")
        {
            _messageUrl = generateUrl(WControllerXml::readNextString(&stream));
        }
        else if (stream.name() == "messageIcon")
        {
            _messageIcon = generateUrl(WControllerXml::readNextString(&stream));
        }
        else if (stream.name() == "messageTitle")
        {
            _messageTitle = WControllerXml::readNextString(&stream);
        }
        else if (stream.name() == "messageCover")
        {
            _messageCover = generateUrl(WControllerXml::readNextString(&stream));
        }
        else if (stream.name() == "messageText")
        {
            _messageText = generateUrl(WControllerXml::readNextString(&stream));
        }
    }

    emit dataChanged();
}
Ejemplo n.º 4
0
Archivo: WResource.C Proyecto: bend/wt
void WResource::setChanged()
{
  generateUrl();

  dataChanged_.emit();
}
Ejemplo n.º 5
0
/* Q_INVOKABLE */ void DataOnline::loadFile()
{
    WRemoteData * data = wControllerDownload->getData(generateUrl("data.xml"), this);

    connect(data, SIGNAL(loaded(WRemoteData *)), this, SLOT(onLoaded(WRemoteData *)));
}