diff --git a/ReleaseNotes.html b/ReleaseNotes.html index 27e2a36bd8..7cec0087cf 100644 --- a/ReleaseNotes.html +++ b/ReleaseNotes.html @@ -22,7 +22,7 @@

Wt Release notes

the way you build Wt, the way you configure Wt or the Wt API and behaviour. -

Release 3.3.5 (Nov X, 2015)

+

Release 3.3.5 (Dec 31, 2015)

This release has a focus on bug fixes but also one or two new features:

diff --git a/examples/widgetgallery/examples/ComboBoxModel.cpp b/examples/widgetgallery/examples/ComboBoxModel.cpp index 2eaba4c337..7fb33aa892 100644 --- a/examples/widgetgallery/examples/ComboBoxModel.cpp +++ b/examples/widgetgallery/examples/ComboBoxModel.cpp @@ -21,6 +21,7 @@ model->addString("United States"); model->setData(3, 0, std::string("US"), Wt::UserRole); model->setFlags(3, 0); +cb->setNoSelectionEnabled(true); cb->setModel(model); Wt::WText *out = new Wt::WText(container); diff --git a/src/Wt/Render/WTextRenderer b/src/Wt/Render/WTextRenderer index ffcfa6aeb9..ecd8d3fd50 100644 --- a/src/Wt/Render/WTextRenderer +++ b/src/Wt/Render/WTextRenderer @@ -64,9 +64,7 @@ struct LayoutBox; * * This class is an abstract class. A concrete class implements the * pure virtual methods to create an appropriate WPaintDevice for each - * page and to provide page dimension information. The paint device - * needs to support font metrics, which currently is only implemented - * by WPdfImage or WRasterImage. + * page and to provide page dimension information. * * All coordinates and dimensions in the API below are pixel coordinates. * diff --git a/src/Wt/Test/WTestEnvironment b/src/Wt/Test/WTestEnvironment index 325d8df0ec..ab3bd969d8 100644 --- a/src/Wt/Test/WTestEnvironment +++ b/src/Wt/Test/WTestEnvironment @@ -155,7 +155,13 @@ public: /*! \brief Sets the locale. * + * \if cpp * The default value is WLocale("en"). + * \endif + * + * \if java + * The default value is the English locale ("en"). + * \endif * * \sa locale() */ diff --git a/src/Wt/WAbstractItemView b/src/Wt/WAbstractItemView index c97cfdc61a..86a22117fc 100644 --- a/src/Wt/WAbstractItemView +++ b/src/Wt/WAbstractItemView @@ -805,7 +805,7 @@ public: */ Signal& headerMouseWentUp() { return headerMouseWentUp_; } - /*! \brief Signals when scrolling. + /*! \brief %Signal emitted when scrolling. * * \note Works only if ajax is available. */ diff --git a/src/Wt/WApplication b/src/Wt/WApplication index 774bde52ad..9328d241bf 100644 --- a/src/Wt/WApplication +++ b/src/Wt/WApplication @@ -2033,7 +2033,7 @@ public: * in the current URL, this session ID does not leak to the refenced * URL. * - * Wt will safely handle URLs in the API (in WImage and WAnchor) but + * %Wt will safely handle URLs in the API (in WImage and WAnchor) but * you may want to use this function to encode URLs which you use in * WTemplate texts. */ diff --git a/src/Wt/WBootstrapTheme.C b/src/Wt/WBootstrapTheme.C index 3bd3df98e0..cb69986e97 100644 --- a/src/Wt/WBootstrapTheme.C +++ b/src/Wt/WBootstrapTheme.C @@ -297,7 +297,7 @@ void WBootstrapTheme::apply(WWidget *widget, DomElement& element, WAbstractItemView *itemView = dynamic_cast(widget); if (itemView) { - element.addPropertyWord(PropertyClass, "form-horizontal"); + element.addPropertyWord(PropertyClass, "form-inline"); return; } diff --git a/src/Wt/WCalendar b/src/Wt/WCalendar index f29ee3f097..bdabdef508 100644 --- a/src/Wt/WCalendar +++ b/src/Wt/WCalendar @@ -186,9 +186,7 @@ public: /*! \brief Sets the first day of the week. * - * Possible values or 1 to 7, as accepted by WDate::shortDayName(). - * - * The default value is 1 ("Monday"). + * Possible values are 1 to 7. The default value is 1 ("Monday"). */ void setFirstDayOfWeek(int dayOfWeek); diff --git a/src/Wt/WComboBox b/src/Wt/WComboBox index eecf1271d2..cefea00f60 100644 --- a/src/Wt/WComboBox +++ b/src/Wt/WComboBox @@ -218,6 +218,24 @@ public: */ Signal& sactivated() { return sactivated_; } + /*! \brief Enables the ability to have 'no currently selected' item. + * + * The setting may only be changed for a combo box (and not for a + * selection box). When enabled, the currentIndex() may be '-1' also + * when the combo box contains values. The user can however not + * select this option, it is thus only useful as a default value. + * + * By default, no selection is \c false for a combo-box and \c true + * for a selection box. + */ + void setNoSelectionEnabled(bool enabled); + + /*! \brief Returns whether 'no selection' is a valid state. + * + * \sa setNoSelectionEnabled() + */ + bool noSelectionEnabled() const { return noSelectionEnabled_; } + private: WAbstractItemModel *model_; int modelColumn_; @@ -227,6 +245,7 @@ private: bool itemsChanged_; bool selectionChanged_; bool currentlyConnected_; + bool noSelectionEnabled_; std::vector modelConnections_; @@ -254,6 +273,9 @@ protected: virtual bool isSelected(int index) const; friend class WSelectionBox; + +private: + void makeCurrentIndexValid(); }; } diff --git a/src/Wt/WComboBox.C b/src/Wt/WComboBox.C index ef66ddb494..5d0dd371a0 100644 --- a/src/Wt/WComboBox.C +++ b/src/Wt/WComboBox.C @@ -26,6 +26,7 @@ WComboBox::WComboBox(WContainerWidget *parent) itemsChanged_(false), selectionChanged_(true), currentlyConnected_(false), + noSelectionEnabled_(false), activated_(this), sactivated_(this) { @@ -82,10 +83,8 @@ void WComboBox::rowsRemoved(const WModelIndex &index, int from, int to) if (currentIndex_ > to) // shift up the selection by amount of removed rows currentIndex_ -= count; else if (currentIndex_ >= from) { - if (supportsNoSelection()) - currentIndex_ = -1; - else - currentIndex_ = model_->rowCount() > 0 ? 0 : -1; + currentIndex_ = -1; + makeCurrentIndexValid(); } } @@ -96,10 +95,9 @@ void WComboBox::rowsInserted(const WModelIndex &index, int from, int to) int count = to - from + 1; - if (currentIndex_ == -1) { - if (model_->rowCount() == count && !supportsNoSelection()) - setCurrentIndex(0); - } else if (currentIndex_ >= from) + if (currentIndex_ == -1) + makeCurrentIndexValid(); + else if (currentIndex_ >= from) currentIndex_ += count; } @@ -135,10 +133,7 @@ void WComboBox::insertItem(int index, const WString& text) { if (model_->insertRow(index)) { setItemText(index, text); - if (model_->rowCount() == 1 && - currentIndex_ == -1 && - !supportsNoSelection()) - setCurrentIndex(0); + makeCurrentIndexValid(); } } @@ -151,7 +146,7 @@ void WComboBox::removeItem(int index) { model_->removeRow(index); - setCurrentIndex(currentIndex_); + makeCurrentIndexValid(); } void WComboBox::setCurrentIndex(int index) @@ -160,6 +155,7 @@ void WComboBox::setCurrentIndex(int index) if (currentIndex_ != newIndex) { currentIndex_ = newIndex; + makeCurrentIndexValid(); validate(); @@ -177,7 +173,7 @@ void WComboBox::clear() { model_->removeRows(0, count()); - setCurrentIndex(currentIndex_); + makeCurrentIndexValid(); } void WComboBox::propagateChange() @@ -196,11 +192,9 @@ void WComboBox::propagateChange() activated_.emit(currentIndex_); if (!guard.deleted()) { - if (myCurrentIndex != - 1) sactivated_.emit(myCurrentValue); } - } bool WComboBox::isSelected(int index) const @@ -208,17 +202,28 @@ bool WComboBox::isSelected(int index) const return index == currentIndex_; } -bool WComboBox::supportsNoSelection() const +void WComboBox::setNoSelectionEnabled(bool enabled) { - /* - * Actually, these days, all browsers support 'no selection' for - * combo-boxes, but we keep it like this to avoid breaking our - * behavior - * - * See http://stackoverflow.com/questions/6223865/blank-html-select-without-blank-item-in-dropdown-list - */ + if (noSelectionEnabled_ != enabled) { + noSelectionEnabled_ = enabled; - return false; + makeCurrentIndexValid(); + } +} + +void WComboBox::makeCurrentIndexValid() +{ + int c = count(); + + if (currentIndex_ > c - 1) + setCurrentIndex(c - 1); + else if (c > 0 && currentIndex_ == -1 && !supportsNoSelection()) + setCurrentIndex(0); +} + +bool WComboBox::supportsNoSelection() const +{ + return noSelectionEnabled_; } void WComboBox::updateDom(DomElement& element, bool all) @@ -349,6 +354,8 @@ void WComboBox::setFormData(const FormData& formData) } } else currentIndex_ = -1; + + makeCurrentIndexValid(); } } @@ -388,8 +395,7 @@ void WComboBox::itemsChanged() itemsChanged_ = true; repaint(RepaintSizeAffected); - if (currentIndex_ > count() - 1) - currentIndex_ = count() - 1; + makeCurrentIndexValid(); } void WComboBox::saveSelection() @@ -412,6 +418,8 @@ void WComboBox::restoreSelection() } else currentIndex_ = -1; + makeCurrentIndexValid(); + currentIndexRaw_ = 0; } diff --git a/src/Wt/WDateValidator b/src/Wt/WDateValidator index 3bbb75916d..d70107c848 100644 --- a/src/Wt/WDateValidator +++ b/src/Wt/WDateValidator @@ -19,10 +19,10 @@ namespace Wt { * This validator accepts input in the given date format, and * optionally checks if the date is within a given range. * + * \if cpp * The format string used for validating user input are the same as * those used by WDate::fromString(). * - * \if cpp * Usage example: * \code * Wt::WLineEdit *lineEdit = new Wt::WLineEdit(this); @@ -33,6 +33,10 @@ namespace Wt { * \endcode * \endif * + * \if java + * The format string used are the ones accepted by java.text.SimpleDateFormat + * \endif + * *

i18n

* * The strings used in the WDateValidator can be translated by overriding @@ -66,7 +70,9 @@ public: * * The validator will accept dates in the date format \p format. * + * \if cpp * The syntax for \p format is as in WDate::fromString() + * \endif */ WDateValidator(const WT_USTRING& format, WObject *parent = 0); @@ -75,7 +81,9 @@ public: * The validator will accept only dates within the indicated range * bottom to top, in the date format \p format. * + * \if cpp * The syntax for \p format is as in WDate::fromString() + * \endif */ WDateValidator(const WT_USTRING& format, const WDate& bottom, diff --git a/src/Wt/WFileUpload b/src/Wt/WFileUpload index 62b3a1ac39..fa42802c9d 100644 --- a/src/Wt/WFileUpload +++ b/src/Wt/WFileUpload @@ -317,7 +317,6 @@ public: private: static const char *CHANGE_SIGNAL; static const char *UPLOADED_SIGNAL; - static const char *FILETOOLARGE_SIGNAL; static const int BIT_DO_UPLOAD = 0; static const int BIT_ENABLE_AJAX = 1; @@ -355,8 +354,11 @@ protected: virtual void propagateSetEnabled(bool enabled); private: - EventSignal<>& fileTooLargeImpl(); - void handleFileTooLargeImpl(); + void handleFileTooLarge(int fileSize); + + JSignal< ::int64_t > tooLarge_; + + void onUploaded(); ::int64_t tooLargeSize_; diff --git a/src/Wt/WFileUpload.C b/src/Wt/WFileUpload.C index cbb348c0ca..4c00d5438f 100644 --- a/src/Wt/WFileUpload.C +++ b/src/Wt/WFileUpload.C @@ -66,19 +66,25 @@ protected: if (triggerUpdate || request.tooLarge()) { if (triggerUpdate) { - LOG_DEBUG("Resource handleRequest(): signaling uploaded"); - - o << "window.parent.postMessage(" - << "{ fu: '" << fileUpload_->id() << "'," - << " signal: '" - << fileUpload_->uploaded().encodeCmd() << "'}, '*');"; + LOG_DEBUG("Resource handleRequest(): signaling uploaded"); + + WEnvironment::UserAgent agent = + WApplication::instance()->environment().agent(); + if (agent == WEnvironment::IE6 || agent == WEnvironment::IE7){ + o << "window.parent." + << WApplication::instance()->javaScriptClass() + << "._p_.update(null, '" + << fileUpload_->uploaded().encodeCmd() << "', null, true);"; + } else { + o << "window.parent.postMessage(" + << "{ fu: '" << fileUpload_->id() << "'," + << " signal: '" + << fileUpload_->uploaded().encodeCmd() << "'}, '*');"; + } } else if (request.tooLarge()) { - LOG_DEBUG("Resource handleRequest(): signaling file-too-large"); + LOG_DEBUG("Resource handleRequest(): signaling file-too-large"); - o << "window.parent.postMessage(" - << "{ fu: '" << fileUpload_->id() << "'," - << " signal: '" - << fileUpload_->fileTooLargeImpl().encodeCmd() << "'}, '*');"; + o << fileUpload_->tooLarge_.createCall(); } } else { LOG_DEBUG("Resource handleRequest(): no signal"); @@ -101,7 +107,6 @@ private: const char *WFileUpload::CHANGE_SIGNAL = "M_change"; const char *WFileUpload::UPLOADED_SIGNAL = "M_uploaded"; -const char *WFileUpload::FILETOOLARGE_SIGNAL = "M_filetoolarge"; /* * Supporting the file API: @@ -116,10 +121,11 @@ WFileUpload::WFileUpload(WContainerWidget *parent) fileTooLarge_(this), dataReceived_(this), progressBar_(0), + tooLarge_(this, "tooLargeSignal"), tooLargeSize_(0) { setInline(true); - fileTooLargeImpl().connect(this, &WFileUpload::handleFileTooLargeImpl); + tooLarge_.connect(boost::bind(&WFileUpload::handleFileTooLarge, this, _1)); create(); } @@ -171,10 +177,12 @@ void WFileUpload::onData(::uint64_t current, ::uint64_t total) h->setRequest(0, 0); // so that triggerUpdate() will work if (dataExceeded) { + doJavaScript(WT_CLASS ".$('if" + id() + "').src='" + + fileUploadTarget_->url() + "';"); if (flags_.test(BIT_UPLOADING)) { flags_.reset(BIT_UPLOADING); tooLargeSize_ = dataExceeded; - handleFileTooLargeImpl(); + handleFileTooLarge(dataExceeded); WApplication *app = WApplication::instance(); app->triggerUpdate(); @@ -229,14 +237,9 @@ EventSignal<>& WFileUpload::changed() return *voidEventSignal(CHANGE_SIGNAL, true); } -EventSignal<>& WFileUpload::fileTooLargeImpl() -{ - return *voidEventSignal(FILETOOLARGE_SIGNAL, true); -} - -void WFileUpload::handleFileTooLargeImpl() +void WFileUpload::handleFileTooLarge(int fileSize) { - fileTooLarge().emit(tooLargeSize_); + fileTooLarge().emit(fileSize); } void WFileUpload::setFileTextSize(int chars) @@ -306,7 +309,25 @@ void WFileUpload::updateDom(DomElement& element, bool all) // Reset the action and generate a new URL for the target, // because the session id may have changed in the meantime element.setAttribute("action", fileUploadTarget_->generateUrl()); - element.callMethod("submit()"); + + std::string maxFileSize = + boost::lexical_cast( + WApplication::instance()->maximumRequestSize()); + + std::string command = + "{" + "debugger; \n" + "var x = " WT_CLASS ".$('in" + id() + "') \n" + " if (x.files != null) \n" + " for (var i = 0; i < x.files.length; i++) { \n" + " var f = x.files[i];" + " if(f.size < " + maxFileSize + ") \n" + " " + jsRef() + ".submit() \n" + " else \n" + " " + tooLarge_.createCall("f.size") + + " }};"; + + element.callJavaScript(command); flags_.reset(BIT_DO_UPLOAD); if (containsProgress) { @@ -480,13 +501,14 @@ void WFileUpload::upload() { if (fileUploadTarget_ && !flags_.test(BIT_UPLOADING)) { flags_.set(BIT_DO_UPLOAD); + repaint(); if (progressBar_) { if (progressBar_->parent() != this) - hide(); + hide(); else - progressBar_->show(); + progressBar_->show(); } WApplication::instance()->enableUpdates(); diff --git a/src/Wt/WGLWidget b/src/Wt/WGLWidget index e0d177247a..ad4898acbb 100644 --- a/src/Wt/WGLWidget +++ b/src/Wt/WGLWidget @@ -102,7 +102,7 @@ enum JsArrayType { * specialization of this class. The purpose of these functions is * to register what JavaScript code has to be executed to render a * scene. Through invocations of the WebGL functions documented below, - * Wt records the JavaScript calls that have to be invoked in the + * %Wt records the JavaScript calls that have to be invoked in the * browser. *
    *
  • initializeGL(): this function is executed after the GL @@ -123,7 +123,7 @@ enum JsArrayType { * and after the first initializeGL() invocation. Additional invocations * may be triggered by calling repaint() with the RESIZE_GL flag. *
  • paintGL(): this is the main scene drawing function. Through - * its execution, Wt records what has to be done to render a scene, + * its execution, %Wt records what has to be done to render a scene, * and it is executed every time that the scene is to be redrawn. You * can use the VBO's and shaders prepared in the initializeGL() phase. * Usually, this function sets uniforms and attributes, links @@ -1564,8 +1564,16 @@ public: /*! \brief returns an paintdevice that can be used to paint a GL texture * * If the client has a webGL enabled browser this function returns a - * WCanvasPaintDevice. If server-side rendering is used as fallback then - * this function returns a WRasterImage + * WCanvasPaintDevice. + * + * \if cpp + * If server-side rendering is used as fallback then + * this function returns a WRasterImage. + * \endif + * \if java + * If server-side rendering is used as fallback then + * this function returns a {@link WRasterPaintDevice}. + * \endif */ WPaintDevice *createPaintDevice(const WLength& width, const WLength& height); @@ -2884,7 +2892,7 @@ setClientSideMouseHandler("new " + mouseHandler + "(" + cameraMatrix.jsRef() + " /*! \brief Sets the content to be displayed when WebGL is not available. * - * If Wt cannot create a working WebGL context, this content will be + * If %Wt cannot create a working WebGL context, this content will be * shown to the user. This may be a text explanation, or a pre-rendered * image, or a video, a flash movie, ... * diff --git a/src/Wt/WImage.C b/src/Wt/WImage.C index 1ab8eb3888..7718f54d95 100644 --- a/src/Wt/WImage.C +++ b/src/Wt/WImage.C @@ -356,7 +356,9 @@ std::string WImage::updateAreaCoordsJSON() const } } js << "]"; - } + } else + js << "null"; + return js.str(); } diff --git a/src/Wt/WJavaScriptHandle b/src/Wt/WJavaScriptHandle index 826ba51977..7ad307818b 100644 --- a/src/Wt/WJavaScriptHandle +++ b/src/Wt/WJavaScriptHandle @@ -37,7 +37,6 @@ namespace Wt { * * \sa WJavaScriptExposableObject, WPaintedWidget */ -// T must be a WJavaScriptExposableObject! template class WJavaScriptHandle { diff --git a/src/Wt/WJavaScriptPreamble b/src/Wt/WJavaScriptPreamble index 88872e8dfc..d65c3be010 100644 --- a/src/Wt/WJavaScriptPreamble +++ b/src/Wt/WJavaScriptPreamble @@ -15,7 +15,7 @@ namespace Wt { #ifdef WT_TARGET_JAVA /*! \brief Enumeration for a JavaScript object type. * - * This is an internal Wt type. + * This is an internal %Wt type. */ #endif enum JavaScriptObjectType { @@ -28,7 +28,7 @@ enum JavaScriptObjectType { #ifdef WT_TARGET_JAVA /*! \brief Enumeration for a JavaScript object scope. * - * This is an internal Wt type. + * This is an internal %Wt type. */ #endif enum JavaScriptScope { @@ -39,7 +39,7 @@ enum JavaScriptScope { #ifdef WT_TARGET_JAVA /*! \brief Javascript preamble. * - * This is an internal Wt type. + * This is an internal %Wt type. */ #endif class WT_API WJavaScriptPreamble diff --git a/src/Wt/WRectF b/src/Wt/WRectF index bfb6103683..e69cf88657 100644 --- a/src/Wt/WRectF +++ b/src/Wt/WRectF @@ -42,9 +42,17 @@ class WT_API WRectF : public WJavaScriptExposableObject public: /*! \brief Default constructor. * + * \if cpp * Constructs a \p null rectangle. * * \sa isNull() + * \endif + * + * \if java + * Constructs an empty rectangle. + * + * \sa isEmpty() + * \endif */ WRectF(); diff --git a/src/Wt/WSelectionBox.C b/src/Wt/WSelectionBox.C index 48499d1020..539875d675 100644 --- a/src/Wt/WSelectionBox.C +++ b/src/Wt/WSelectionBox.C @@ -21,7 +21,9 @@ WSelectionBox::WSelectionBox(WContainerWidget *parent) verticalSize_(5), selectionMode_(SingleSelection), configChanged_(false) -{ } +{ + noSelectionEnabled_ = true; +} void WSelectionBox::setVerticalSize(int items) { diff --git a/src/Wt/WString b/src/Wt/WString index 6e68ab43d9..a3648548b0 100644 --- a/src/Wt/WString +++ b/src/Wt/WString @@ -520,7 +520,7 @@ public: */ bool operator!= (const WString& rhs) const { return !(*this == rhs); } - /** \brief An empty string. + /*! \brief An empty string. */ static const WString Empty; @@ -715,6 +715,12 @@ extern WT_API std::ostream& operator<< (std::ostream& lhs, const WString& rhs); typedef WString WMessage; #endif // WT_DEPRECATED_3_0_0 +#ifdef WT_TARGET_JAVA +/* To emit javadoc links */ +const WString WString::Empty; +WString WString::tr(const char *key) { } +#endif + } #endif // WSTRING_H_ diff --git a/src/Wt/WTemplate b/src/Wt/WTemplate index d829d218d2..2d7d7dee2d 100644 --- a/src/Wt/WTemplate +++ b/src/Wt/WTemplate @@ -341,7 +341,7 @@ public: /*! * Use setObjectName() to prefix the ID with the varName. This is - * a safe choice since Wt still guarantees that the IDs are + * a safe choice since %Wt still guarantees that the IDs are * unique. */ SetWidgetObjectName, diff --git a/src/Wt/WTimeEdit b/src/Wt/WTimeEdit index 39dd468c3f..02b9329b8b 100644 --- a/src/Wt/WTimeEdit +++ b/src/Wt/WTimeEdit @@ -1,3 +1,9 @@ +// This may look like C code, but it's really -*- C++ -*- +/* + * Copyright (C) 2015 Emweb bvba, Kessel-Lo, Belgium. + * + * See the LICENSE file for terms of use. + */ #ifndef WTIME_EDIT_H_ #define WTIME_EDIT_H_ @@ -9,14 +15,13 @@ namespace Wt { /*! \class WTimeEdit Wt/WTimeEdit Wt/WTimeEdit - * \brief A Time field editor + * \brief A Time field editor * * \sa WTimePicker * \sa WTime * \sa WTimeValidator * * Styling through CSS is not applicable. - * */ class WT_API WTimeEdit : public WLineEdit { @@ -36,48 +41,48 @@ public: /*! \brief Returns the time. * * Returns an invalid time (for which WTime::isValid() returns - * \c false) if the time coult not be parsed using the current format().
    + * \c false) if the time could not be parsed using the current + * format(). * * \sa setTime(), WTime::fromString(), WLineEdit::text() */ WTime time() const; - /*! \brief Returns the validator - * - * \sa WTimeValidator - */ + /*! \brief Returns the validator + * + * \sa WTimeValidator + */ virtual WTimeValidator *validator() const; - /*! \brief Sets the format of the Time - */ + /*! \brief Sets the format of the Time + */ void setFormat(const WT_USTRING& format); - /*! \brief returns the format - */ + /*! \brief Returns the format. + */ WT_USTRING format() const; - /*! \brief set the hidden status - */ + /*! \brief set the hidden status + */ virtual void setHidden(bool hidden, const WAnimation& animation = WAnimation()); - /*! \brief returns the minutes step - */ + /*! \brief returns the minutes step + */ int minuteStep() const { return timePicker_->minuteStep(); } - /*! \brief sets the minute step - */ + /*! \brief sets the minute step + */ void setMinuteStep(int step) { timePicker_->setMinuteStep(step); } protected: - - /*! - * \brief render the widget - */ + /*! + * \brief render the widget + */ virtual void render(WFlags flags); - /*! - * \brief enable or disable propagation - */ + /*! + * \brief enable or disable propagation + */ virtual void propagateSetEnabled(bool enabled); /*! \brief Sets the value from the time scroller to the line edit. @@ -88,11 +93,10 @@ protected: */ virtual void setFromLineEdit(); - /*! \brief sets the text - */ + /*! \brief sets the text + */ virtual void setText(const WString &text) { WLineEdit::setText(text); } - private: WPopupWidget *popup_; WTimePicker *timePicker_; diff --git a/src/Wt/WWebWidget.C b/src/Wt/WWebWidget.C index dba3281288..0e92da9989 100644 --- a/src/Wt/WWebWidget.C +++ b/src/Wt/WWebWidget.C @@ -1846,7 +1846,7 @@ void WWebWidget::declareJavaScriptMember(DomElement& element, element.callMethod(combined.str()); } else { - if (value.length() > 1) + if (value.length() > 0) element.callMethod(name + "=" + value); else element.callMethod(name + "=null"); diff --git a/src/Wt/WWidget b/src/Wt/WWidget index 8f9025d3d1..54884bb222 100644 --- a/src/Wt/WWidget +++ b/src/Wt/WWidget @@ -732,9 +732,9 @@ public: * * Sets the value for an HTML attribute. * - * This is only useful for HTML features that are not supported directly in - * Wt (and beware that browsers have non-consisten support for many more - * exotic HTML features). + * This is only useful for HTML features that are not supported + * directly in %Wt (and beware that browsers have non-consistent + * support for many more exotic HTML features). * * \sa JSlot, doJavaScript() */ diff --git a/src/js/StdGridLayoutImpl2.js b/src/js/StdGridLayoutImpl2.js index 820afddaee..1cebd3f694 100644 --- a/src/js/StdGridLayoutImpl2.js +++ b/src/js/StdGridLayoutImpl2.js @@ -1353,14 +1353,8 @@ WT_DECLARE_WT_MEMBER if (!hidden && (setSize || ts != ps || item.layout)) { if (setCss(w, DC.size, tsm + 'px')) { /* - * Setting a size cancels the built-in margin! + * Setting a size no longer cancels the built-in margin! */ - if (!WT.isIE && (WT.hasTag(w, 'TEXTAREA') || - WT.hasTag(w, 'INPUT'))) { - setCss(w, 'margin-' + DC.left, item.margin[dir]/2 + 'px'); - setCss(w, 'margin-' + OC.left, item.margin[!dir]/2 + 'px'); - } - setItemDirty(item, 1); item.set[dir] = true; } diff --git a/src/js/StdGridLayoutImpl2.min.js b/src/js/StdGridLayoutImpl2.min.js index 8ceeb21c42..bac7944541 100644 --- a/src/js/StdGridLayoutImpl2.min.js +++ b/src/js/StdGridLayoutImpl2.min.js @@ -1,33 +1,33 @@ -WT_DECLARE_WT_MEMBER(1,JavaScriptConstructor,"StdLayout2",function(F,D,K,U,V,W,Z,q,E,z,A){function x(a){var b,c;b=0;for(c=C.items.length;be.clientWidth||k+j==e.clientWidth&&f.isGecko&&e.parentNode.parentNode.style.visibility==="hidden"){u=a.style[l.left];v(a,l.left,"-1000000px");k=b?a.scrollHeight: -a.scrollWidth}}e=b?a.clientHeight:a.clientWidth;if(f.isGecko&&!a.style[l.size]&&b==0&&i(f.css(a,"overflow"))){d=a.style[l.size];v(a,l.size,"")}j=b?a.offsetHeight:a.offsetWidth;u&&v(a,l.left,u);d&&v(a,l.size,d);if(e>=1E6)e-=1E6;if(k>=1E6)k-=1E6;if(j>=1E6)j-=1E6;if(k===0){k=f.pxself(a,l.size);if(k!==0&&!f.isOpera&&!f.isGecko)k-=f.px(a,"border"+l.Left+"Width")+f.px(a,"border"+l.Right+"Width")}if(f.isIE&&(f.hasTag(a,"BUTTON")||f.hasTag(a,"TEXTAREA")||f.hasTag(a,"INPUT")||f.hasTag(a,"SELECT")))k=e;if(k> +WT_DECLARE_WT_MEMBER(1,JavaScriptConstructor,"StdLayout2",function(F,D,K,U,V,W,Z,q,E,z,A){function w(a){var b,c;b=0;for(c=C.items.length;be.clientWidth||k+j==e.clientWidth&&f.isGecko&&e.parentNode.parentNode.style.visibility==="hidden"){u=a.style[l.left];x(a,l.left,"-1000000px");k=b?a.scrollHeight: +a.scrollWidth}}e=b?a.clientHeight:a.clientWidth;if(f.isGecko&&!a.style[l.size]&&b==0&&i(f.css(a,"overflow"))){d=a.style[l.size];x(a,l.size,"")}j=b?a.offsetHeight:a.offsetWidth;u&&x(a,l.left,u);d&&x(a,l.size,d);if(e>=1E6)e-=1E6;if(k>=1E6)k-=1E6;if(j>=1E6)j-=1E6;if(k===0){k=f.pxself(a,l.size);if(k!==0&&!f.isOpera&&!f.isGecko)k-=f.px(a,"border"+l.Left+"Width")+f.px(a,"border"+l.Right+"Width")}if(f.isIE&&(f.hasTag(a,"BUTTON")||f.hasTag(a,"TEXTAREA")||f.hasTag(a,"INPUT")||f.hasTag(a,"SELECT")))k=e;if(k> j)if(f.pxself(a,l.size)==0)k=e;else{var m=false;$(a).find(".Wt-popup").each(function(){if(this.style.display!=="none")m=true});if(m)k=e}d=f.px(a,"border"+l.Left+"Width")+f.px(a,"border"+l.Right+"Width");u=j-(e+d)!=0;if(c)return[k,scrollBar];if(f.isGecko&&b==0&&a.getBoundingClientRect().width!=Math.ceil(a.getBoundingClientRect().width))k+=1;if(!f.boxSizing(a)&&!f.isOpera)k+=d;k+=f.px(a,"margin"+l.Left)+f.px(a,"margin"+l.Right);if(!f.boxSizing(a)&&!f.isIE)k+=f.px(a,"padding"+l.Left)+f.px(a,"padding"+ l.Right);k+=j-(e+d);if(k0)k=Math.min(a,k);return[Math.round(k),u]}function y(a,b){b=s[b];if(a.style.display==="none")return 0;else if(a["layoutMin"+b.Size])return a["layoutMin"+b.Size];else{var c=f.px(a,"min"+b.Size);f.boxSizing(a)||(c+=f.px(a,"padding"+b.Left)+f.px(a,"padding"+b.Right));return c}}function O(a,b){b=s[b];var c=f.px(a,"margin"+b.Left)+f.px(a,"margin"+b.Right);if(!f.boxSizing(a)&&!(f.isIE&&!f.isIElt9&&f.hasTag(a,"BUTTON")))c+=f.px(a,"border"+b.Left+ "Width")+f.px(a,"border"+b.Right+"Width")+f.px(a,"padding"+b.Left)+f.px(a,"padding"+b.Right);return c}function M(a,b){b=s[b];return f.px(a,"padding"+b.Left)+f.px(a,"padding"+b.Right)}function ga(a,b){if(f.boxSizing(a)){b=s[b];return f.px(a,"border"+b.Left+"Width")+f.px(a,"border"+b.Right+"Width")+f.px(a,"padding"+b.Left)+f.px(a,"padding"+b.Right)}else return 0}function aa(a,b){b=s[b];return Math.round(f.px(a,"border"+b.Left+"Width")+f.px(a,"border"+b.Right+"Width")+f.px(a,"margin"+b.Left)+f.px(a, -"margin"+b.Right)+f.px(a,"padding"+b.Left)+f.px(a,"padding"+b.Right))}function X(a,b,c){a.dirty=Math.max(a.dirty,b);P=true;c&&F.layouts2.scheduleAdjust()}function v(a,b,c){if(a.style[b]!==c){a.style[b]=c;return true}else return false}function ma(a){return a.style.display==="none"&&!a.ed||$(a).hasClass("Wt-hidden")}function ua(a,b,c){var e=s[a],i=e.config.length,l=s[a^1].config.length,k=e.measures.slice();if(k.length==5){k[0]=k[0].slice();k[1]=k[1].slice()}if(P){if(c&&typeof e.minSize=="undefined"){e.minSize= -f.px(c,"min"+e.Size);if(e.minSize>0)e.minSize-=ga(c,a)}var u=[],d=[],j=0,m=0,g,G,r=false;for(g=0;g1){var n=$("#"+h.id),w=n.get(0);if(!w){e.setItem(g,G,null);continue}if(w!=h.w){h.w=w;n.find("img").add(n.filter("img")).bind("load",{item:h},function(S){X(S.data.item,1,true)})}}if(!W&&h.w.style.position!="absolute"){h.w.style.position="absolute";h.w.style.visibility="hidden"}if(!h.ps)h.ps=[];if(!h.sc)h.sc= -[];if(!h.ms)h.ms=[];if(!h.size)h.size=[];if(!h.psize)h.psize=[];if(!h.fs)h.fs=[];if(!h.margin)h.margin=[];n=!h.set;if(!h.set)h.set=[false,false];if(ma(h.w))h.ps[a]=h.ms[a]=0;else if(h.w){if(f.isIE)h.w.style.visibility="";if(h.dirty){if(h.dirty>1){w=y(h.w,a);h.ms[a]=w}else w=h.ms[a];if(w>t)t=w;if(h.dirty>1)h.margin[a]=O(h.w,a);if(!h.set[a])if(a==0||!n){n=f.pxself(h.w,e.size);h.fs[a]=n?n+h.margin[a]:0}else{n=Math.round(f.px(h.w,e.size));h.fs[a]=n>Math.max(ga(h.w,a),w)?n+h.margin[a]:0}n=h.fs[a];if(h.layout){if(n== -0)n=h.ps[a];h.ps[a]=n}else{if(h.wasLayout){h.wasLayout=false;h.set=[false,false];h.ps=[];h.w.wtResize&&h.w.wtResize(h.w,-1,-1,true);v(h.w,s[1].size,"")}w=B(h.w,a,false,b);var H=w[0],ba=h.set[a];if(ba)if(h.psize[a]>8)ba=H>=h.psize[a]-4&&H<=h.psize[a]+4;var ca=typeof h.ps[a]!=="undefined"&&e.config[g][0]>0&&h.set[a];n=ba||ca?Math.max(n,h.ps[a]):Math.max(n,H);h.ps[a]=n;h.sc[a]=w[1]}if(!h.span||h.span[a]==1){if(n>p)p=n}else r=true}else if(!h.span||h.span[a]==1){if(h.ps[a]>p)p=h.ps[a];if(h.ms[a]>t)t=h.ms[a]}else r= -true;if(!ma(h.w)&&(!h.span||h.span[a]==1))o=false}}}if(o)t=p=-1;else if(t>p)p=t;u[g]=p;d[g]=t;if(t>-1){j+=p;m+=t}}if(r){function ha(S,ia){for(g=0;g1){var da=S(Y),ja=0,ka=0,I;for(I=0;I0)ka+=e.config[g+I][0]}}if(da>=0)if(ja>0){if(ka>0)ja=ka;for(I=0;I0?e.config[g+I][0]:1;if(Q>0){var qa=Math.round(da/Q);da-=qa;ja-=Q;ia[g+I]+= -qa}}}}else ia[g]=da}}}ha(function(S){return S.ps[a]},u);ha(function(S){return S.ms[a]},d)}b=0;n=true;r=false;for(g=0;g-1){if(n){b+=e.margins[1];n=false}else{b+=e.margins[0];if(r)b+=4}r=e.config[g][1]!==0}n||(b+=e.margins[2]);j+=b;m+=b;e.measures=[u,d,j,m,b]}if(ea||k[2]!=e.measures[2])ra.updateSizeInParent(a);c&&e.minSize==0&&k[3]!=e.measures[3]&&c.parentNode.className!="Wt-domRoot"&&v(c,"min"+e.Size,e.measures[3]+"px");c&&a==0&&c&&f.hasTag(c,"TD")&&v(c,e.size,e.measures[2]+"px")}function va(a, +"margin"+b.Right)+f.px(a,"padding"+b.Left)+f.px(a,"padding"+b.Right))}function X(a,b,c){a.dirty=Math.max(a.dirty,b);P=true;c&&F.layouts2.scheduleAdjust()}function x(a,b,c){if(a.style[b]!==c){a.style[b]=c;return true}else return false}function ma(a){return a.style.display==="none"&&!a.ed||$(a).hasClass("Wt-hidden")}function ua(a,b,c){var e=s[a],i=e.config.length,l=s[a^1].config.length,k=e.measures.slice();if(k.length==5){k[0]=k[0].slice();k[1]=k[1].slice()}if(P){if(c&&typeof e.minSize=="undefined"){e.minSize= +f.px(c,"min"+e.Size);if(e.minSize>0)e.minSize-=ga(c,a)}var u=[],d=[],j=0,m=0,h,G,r=false;for(h=0;h1){var n=$("#"+g.id),v=n.get(0);if(!v){e.setItem(h,G,null);continue}if(v!=g.w){g.w=v;n.find("img").add(n.filter("img")).bind("load",{item:g},function(S){X(S.data.item,1,true)})}}if(!W&&g.w.style.position!="absolute"){g.w.style.position="absolute";g.w.style.visibility="hidden"}if(!g.ps)g.ps=[];if(!g.sc)g.sc= +[];if(!g.ms)g.ms=[];if(!g.size)g.size=[];if(!g.psize)g.psize=[];if(!g.fs)g.fs=[];if(!g.margin)g.margin=[];n=!g.set;if(!g.set)g.set=[false,false];if(ma(g.w))g.ps[a]=g.ms[a]=0;else if(g.w){if(f.isIE)g.w.style.visibility="";if(g.dirty){if(g.dirty>1){v=y(g.w,a);g.ms[a]=v}else v=g.ms[a];if(v>t)t=v;if(g.dirty>1)g.margin[a]=O(g.w,a);if(!g.set[a])if(a==0||!n){n=f.pxself(g.w,e.size);g.fs[a]=n?n+g.margin[a]:0}else{n=Math.round(f.px(g.w,e.size));g.fs[a]=n>Math.max(ga(g.w,a),v)?n+g.margin[a]:0}n=g.fs[a];if(g.layout){if(n== +0)n=g.ps[a];g.ps[a]=n}else{if(g.wasLayout){g.wasLayout=false;g.set=[false,false];g.ps=[];g.w.wtResize&&g.w.wtResize(g.w,-1,-1,true);x(g.w,s[1].size,"")}v=B(g.w,a,false,b);var H=v[0],ba=g.set[a];if(ba)if(g.psize[a]>8)ba=H>=g.psize[a]-4&&H<=g.psize[a]+4;var ca=typeof g.ps[a]!=="undefined"&&e.config[h][0]>0&&g.set[a];n=ba||ca?Math.max(n,g.ps[a]):Math.max(n,H);g.ps[a]=n;g.sc[a]=v[1]}if(!g.span||g.span[a]==1){if(n>p)p=n}else r=true}else if(!g.span||g.span[a]==1){if(g.ps[a]>p)p=g.ps[a];if(g.ms[a]>t)t=g.ms[a]}else r= +true;if(!ma(g.w)&&(!g.span||g.span[a]==1))o=false}}}if(o)t=p=-1;else if(t>p)p=t;u[h]=p;d[h]=t;if(t>-1){j+=p;m+=t}}if(r){function ha(S,ia){for(h=0;h1){var da=S(Y),ja=0,ka=0,I;for(I=0;I0)ka+=e.config[h+I][0]}}if(da>=0)if(ja>0){if(ka>0)ja=ka;for(I=0;I0?e.config[h+I][0]:1;if(Q>0){var qa=Math.round(da/Q);da-=qa;ja-=Q;ia[h+I]+= +qa}}}}else ia[h]=da}}}ha(function(S){return S.ps[a]},u);ha(function(S){return S.ms[a]},d)}b=0;n=true;r=false;for(h=0;h-1){if(n){b+=e.margins[1];n=false}else{b+=e.margins[0];if(r)b+=4}r=e.config[h][1]!==0}n||(b+=e.margins[2]);j+=b;m+=b;e.measures=[u,d,j,m,b]}if(ea||k[2]!=e.measures[2])ra.updateSizeInParent(a);c&&e.minSize==0&&k[3]!=e.measures[3]&&c.parentNode.className!="Wt-domRoot"&&x(c,"min"+e.Size,e.measures[3]+"px");c&&a==0&&c&&f.hasTag(c,"TD")&&x(c,e.size,e.measures[2]+"px")}function va(a, b,c){a=s[a];if(fa)c=-c;if(a.config[b][0]>0&&a.config[b+1][0]==0){++b;c=-c}a.fixedSize[b]=a.sizes[b]+c;F.layouts2.scheduleAdjust()}function wa(a,b,c){var e=b.di,i=s[a],l=s[a^1],k,u=f.getElement(D),d;for(d=e-1;d>=0;--d)if(i.sizes[d]>=0){k=-(i.sizes[d]-i.measures[1][d]);break}e=i.sizes[e]-i.measures[1][e];if(fa){var j=k;k=-e;e=-j}new f.SizeHandle(f,i.resizeDir,f.pxself(b,i.size),f.pxself(b,l.size),k,e,i.resizerClass,function(m){va(a,d,m)},b,u,c,0,0)}function sa(a,b){var c=a.config.length,e;if(a.config[b][1]!== 0)for(e=b+1;e-1)return true;for(e=b-1;e>=0;--e)if(a.measures[1][e]>-1)return a.config[e][1]!==0;return false}function xa(a,b){var c=s[a],e=s[a^1],i=c.measures,l=0,k=false,u=false,d=false,j=la?b.parentNode:null;if(c.maxSize===0)if(j){var m=f.css(j,"position");d=a==1&&typeof j.nativeHeight!=="undefined";if(m==="absolute")l=d?f.parsePx(j.nativeHeight):f.pxself(j,c.size);if(l===0){if(!c.initialized){if(a===0&&(m==="absolute"||m==="fixed")){j.style.display="none";l=j.clientWidth; -j.style.display=""}d||(l=a?j.clientHeight:j.clientWidth);k=true;if(a==0&&l==0&&f.isIElt9){l=j.offsetWidth;k=false}var g;if((f.hasTag(j,"TD")||f.hasTag(j,"TH")||$(j.parentNode).hasClass("Wt-domRoot"))&&!(f.isIE&&!f.isIElt9)){d=0;g=1}else{d=c.minSize?c.minSize:i[3];g=0}function G(ca,ha){return ca-ha<=1}if(f.isIElt9&&G(l,g)||G(l,d+M(j,a)))c.maxSize=999999}if(l===0&&c.maxSize===0){l=a?j.clientHeight:j.clientWidth;k=true}}}else{l=f.pxself(b,c.size);u=true}else if(c.sizeSet){l=f.pxself(j,c.size);u=true}var r= -0;if(j&&j.wtGetPS&&a==1)r=j.wtGetPS(j,b,a,0);d=i[2];if(d=i[3]-r){r=l-i[4];g=[];var p=[0,0],t=[0,0],o=0;for(d=0;d-1){m=-1;sa(c,d)||(c.fixedSize[d]=undefined);if(typeof c.fixedSize[d]!=="undefined"&&(d+1==k||i[1][d+1]>-1))m=c.fixedSize[d];else if(sa(c,d)&&c.config[d][1]!==0&&c.config[d][1][0]>=0){m=c.config[d][1][0];if(c.config[d][1][1])m=(l-i[4])*m/100}if(m>=0){g[d]=-1;j[d]=m;r-=j[d]}else{if(c.config[d][0]>0){m=1;g[d]=c.config[d][0];o+=g[d]}else{m=0;g[d]=0}p[m]+=i[1][d];t[m]+=i[0][d];j[d]=i[0][d]}}else{g[d]= --2;j[d]=-1}if(c.fixedSize.length>k)c.fixedSize.length=k;if(o==0){for(d=0;dt[0]+p[1]){r-=t[0];if(r>t[1]){if(c.fitSize){r-=t[1];r=r/o;for(d=0;d0){j[d]+=Math.round(g[d]*r);c.stretched[d]=true}}}else{m=1;if(r0?(r-p[m])/(t[m]-p[m]):0;for(d=0;d0){p=i[0][d]-i[1][d];j[d]=i[1][d]+Math.round(p*r)}}}else{for(d=0;d0)j[d]=i[1][d];r-=p[1];m=0;if(r0? -(r-p[m])/(t[m]-p[m]):0;for(d=0;d-1){var h=p;if(p){p=D+"-rs"+a+"-"+d;g=f.getElement(p);if(!g){c.resizeHandles[d]=p;g=document.createElement("div");g.setAttribute("id",p);g.di=d;g.style.position="absolute";g.style[e.left]=e.margins[1]+"px";g.style[c.size]=c.margins[0]+"px";if(e.cSize)g.style[e.size]=e.cSize-e.margins[2]-e.margins[1]+"px";g.className=c.handleClass; -b.insertBefore(g,b.firstChild);g.onmousedown=g.ontouchstart=function(ca){wa(a,this,ca||window.event)}}i+=2;v(g,c.left,i+"px");i+=2}else if(c.resizeHandles[d]){g=f.getElement(c.resizeHandles[d]);g.parentNode.removeChild(g);c.resizeHandles[d]=undefined}p=c.config[d][1]!==0;if(r)r=false;else i+=c.margins[0]}else if(c.resizeHandles[d]){g=f.getElement(c.resizeHandles[d]);g.parentNode.removeChild(g);c.resizeHandles[d]=undefined}for(t=0;t=j.length)break;if(w)m+=4;w=c.config[d+n][1]!==0;if(j[d+n-1]>-1&&j[d+n]>-1)m+=c.margins[0];m+=j[d+n]}}var H;v(g,"visibility","");w=o.align>>c.alignBits&15;n=o.ps[a];if(m=n&&o.set[a]){v(g,c.size,n+"px")&&X(o,1);o.set[a]=false}o.size[a]=n;o.psize[a]=n}else{H=o.margin[a];w=Math.max(0,m-H);var ba=a==0&& -o.sc[a];if(!ma(g)&&(ba||m!=n||o.layout)){if(v(g,c.size,w+"px")){if(!f.isIE&&(f.hasTag(g,"TEXTAREA")||f.hasTag(g,"INPUT"))){v(g,"margin-"+c.left,o.margin[a]/2+"px");v(g,"margin-"+e.left,o.margin[!a]/2+"px")}X(o,1);o.set[a]=true}}else if(o.fs[a])a==0&&v(g,c.size,o.fs[a]-H+"px");else{v(g,c.size,"")&&X(o,1);if(o.set)o.set[a]=false}H=i;o.size[a]=w;o.psize[a]=m}if(W)if(h){v(g,c.left,"4px");m=f.css(g,"position");if(m!=="absolute")g.style.position="relative"}else v(g,c.left,"0px");else v(g,c.left,H+"px"); -if(a==1){if(g.wtResize)g.wtResize(g,o.set[0]?Math.round(o.size[0]):-1,o.set[1]?Math.round(o.size[1]):-1,true);o.dirty=0}}if(j[d]>-1)i+=j[d]}if(c.resizeHandles.length>k){for(h=k;h0)b=Math.min(c.maxSize,b);if(pa){c=f.getElement(D);if(!c)return;for(var e=c,i=e.parentNode;;){if(i.wtGetPS)b=i.wtGetPS(i,e,a,b);b+=aa(i,a);if(i==J)break;if(a==1&&i==c.parentNode&&!i.lh&&i.offsetHeight>b)b=i.offsetHeight;e=i;i=e.parentNode}}else b+=T[a];N.setChildSize(J,a,b)}};this.setConfig=function(a){var b=C;C=a;s[0].config=C.cols;s[1].config=C.rows;s[0].stretched=[];s[1].stretched=[];var c;a=0;for(c=b.items.length;a< -c;++a){var e=b.items[a];if(e){var i=x(e.id);if(i){i.ps=e.ps;i.sc=e.sc;i.ms=e.ms;i.size=e.size;i.psize=e.psize;i.fs=e.fs;i.margin=e.margin;i.set=e.set}else if(e.set){e.set[0]&&v(e.w,s[0].size,"");e.set[1]&&v(e.w,s[1].size,"")}}}P=ea=true;F.layouts2.scheduleAdjust()};this.getId=function(){return D};this.setElDirty=function(a){if(a=x(a.id)){a.dirty=2;P=true;F.layouts2.scheduleAdjust()}};this.setItemsDirty=function(a){var b,c,e=s[0].config.length;b=0;for(c=a.length;b>i.alignBits&15||!i.stretched[e]){if(!a.ps)a.ps=[];a.ps[b]=c}a.layout=true;X(a,1)}};this.measure=function(a){var b=f.getElement(D);if(b)if(!f.isHidden(b)){ta|| -na();if(P||ea)ua(a,b,la?b.parentNode:null);if(a==1)P=ea=false}};this.setMaxSize=function(a,b){s[0].maxSize=a;s[1].maxSize=b};this.apply=function(a){var b=f.getElement(D);if(!b)return false;if(f.isHidden(b))return true;xa(a,b);return true};this.contains=function(a){var b=f.getElement(D);a=f.getElement(a.getId());return b&&a?f.contains(b,a):false};this.WT=f}); +j.style.display=""}d||(l=a?j.clientHeight:j.clientWidth);k=true;if(a==0&&l==0&&f.isIElt9){l=j.offsetWidth;k=false}var h;if((f.hasTag(j,"TD")||f.hasTag(j,"TH")||$(j.parentNode).hasClass("Wt-domRoot"))&&!(f.isIE&&!f.isIElt9)){d=0;h=1}else{d=c.minSize?c.minSize:i[3];h=0}function G(ca,ha){return ca-ha<=1}if(f.isIElt9&&G(l,h)||G(l,d+M(j,a)))c.maxSize=999999}if(l===0&&c.maxSize===0){l=a?j.clientHeight:j.clientWidth;k=true}}}else{l=f.pxself(b,c.size);u=true}else if(c.sizeSet){l=f.pxself(j,c.size);u=true}var r= +0;if(j&&j.wtGetPS&&a==1)r=j.wtGetPS(j,b,a,0);d=i[2];if(d=i[3]-r){r=l-i[4];h=[];var p=[0,0],t=[0,0],o=0;for(d=0;d-1){m=-1;sa(c,d)||(c.fixedSize[d]=undefined);if(typeof c.fixedSize[d]!=="undefined"&&(d+1==k||i[1][d+1]>-1))m=c.fixedSize[d];else if(sa(c,d)&&c.config[d][1]!==0&&c.config[d][1][0]>=0){m=c.config[d][1][0];if(c.config[d][1][1])m=(l-i[4])*m/100}if(m>=0){h[d]=-1;j[d]=m;r-=j[d]}else{if(c.config[d][0]>0){m=1;h[d]=c.config[d][0];o+=h[d]}else{m=0;h[d]=0}p[m]+=i[1][d];t[m]+=i[0][d];j[d]=i[0][d]}}else{h[d]= +-2;j[d]=-1}if(c.fixedSize.length>k)c.fixedSize.length=k;if(o==0){for(d=0;dt[0]+p[1]){r-=t[0];if(r>t[1]){if(c.fitSize){r-=t[1];r=r/o;for(d=0;d0){j[d]+=Math.round(h[d]*r);c.stretched[d]=true}}}else{m=1;if(r0?(r-p[m])/(t[m]-p[m]):0;for(d=0;d0){p=i[0][d]-i[1][d];j[d]=i[1][d]+Math.round(p*r)}}}else{for(d=0;d0)j[d]=i[1][d];r-=p[1];m=0;if(r0? +(r-p[m])/(t[m]-p[m]):0;for(d=0;d-1){var g=p;if(p){p=D+"-rs"+a+"-"+d;h=f.getElement(p);if(!h){c.resizeHandles[d]=p;h=document.createElement("div");h.setAttribute("id",p);h.di=d;h.style.position="absolute";h.style[e.left]=e.margins[1]+"px";h.style[c.size]=c.margins[0]+"px";if(e.cSize)h.style[e.size]=e.cSize-e.margins[2]-e.margins[1]+"px";h.className=c.handleClass; +b.insertBefore(h,b.firstChild);h.onmousedown=h.ontouchstart=function(ca){wa(a,this,ca||window.event)}}i+=2;x(h,c.left,i+"px");i+=2}else if(c.resizeHandles[d]){h=f.getElement(c.resizeHandles[d]);h.parentNode.removeChild(h);c.resizeHandles[d]=undefined}p=c.config[d][1]!==0;if(r)r=false;else i+=c.margins[0]}else if(c.resizeHandles[d]){h=f.getElement(c.resizeHandles[d]);h.parentNode.removeChild(h);c.resizeHandles[d]=undefined}for(t=0;t=j.length)break;if(v)m+=4;v=c.config[d+n][1]!==0;if(j[d+n-1]>-1&&j[d+n]>-1)m+=c.margins[0];m+=j[d+n]}}var H;x(h,"visibility","");v=o.align>>c.alignBits&15;n=o.ps[a];if(m=n&&o.set[a]){x(h,c.size,n+"px")&&X(o,1);o.set[a]=false}o.size[a]=n;o.psize[a]=n}else{H=o.margin[a];v=Math.max(0,m-H);var ba=a==0&& +o.sc[a];if(!ma(h)&&(ba||m!=n||o.layout)){if(x(h,c.size,v+"px")){X(o,1);o.set[a]=true}}else if(o.fs[a])a==0&&x(h,c.size,o.fs[a]-H+"px");else{x(h,c.size,"")&&X(o,1);if(o.set)o.set[a]=false}H=i;o.size[a]=v;o.psize[a]=m}if(W)if(g){x(h,c.left,"4px");m=f.css(h,"position");if(m!=="absolute")h.style.position="relative"}else x(h,c.left,"0px");else x(h,c.left,H+"px");if(a==1){if(h.wtResize)h.wtResize(h,o.set[0]?Math.round(o.size[0]):-1,o.set[1]?Math.round(o.size[1]):-1,true);o.dirty=0}}if(j[d]>-1)i+=j[d]}if(c.resizeHandles.length> +k){for(g=k;g0)b=Math.min(c.maxSize,b);if(pa){c=f.getElement(D);if(!c)return;for(var e=c,i=e.parentNode;;){if(i.wtGetPS)b= +i.wtGetPS(i,e,a,b);b+=aa(i,a);if(i==J)break;if(a==1&&i==c.parentNode&&!i.lh&&i.offsetHeight>b)b=i.offsetHeight;e=i;i=e.parentNode}}else b+=T[a];N.setChildSize(J,a,b)}};this.setConfig=function(a){var b=C;C=a;s[0].config=C.cols;s[1].config=C.rows;s[0].stretched=[];s[1].stretched=[];var c;a=0;for(c=b.items.length;a>i.alignBits&15||!i.stretched[e]){if(!a.ps)a.ps=[];a.ps[b]=c}a.layout=true;X(a,1)}};this.measure=function(a){var b=f.getElement(D);if(b)if(!f.isHidden(b)){ta||na();if(P||ea)ua(a,b,la?b.parentNode:null);if(a==1)P=ea=false}};this.setMaxSize=function(a,b){s[0].maxSize=a;s[1].maxSize=b};this.apply=function(a){var b=f.getElement(D); +if(!b)return false;if(f.isHidden(b))return true;xa(a,b);return true};this.contains=function(a){var b=f.getElement(D);a=f.getElement(a.getId());return b&&a?f.contains(b,a):false};this.WT=f}); WT_DECLARE_APP_MEMBER(1,JavaScriptObject,"layouts2",new (function(){var F=[],D=false,K=this,U=false;this.find=function(q){return(q=document.getElementById(q))?jQuery.data(q,"layout"):null};this.setDirty=function(q){if(q=this.find(q)){q.setDirty();K.scheduleAdjust()}};this.setElementDirty=function(q){var E=q;for(q=q.parentNode;q&&q!=document.body;){var z=jQuery.data(q,"layout");z&&z.setElDirty(E);E=q;q=q.parentNode}};this.setChildLayoutsDirty=function(q,E){var z,A;z=0;for(A=q.descendants.length;z< -A;++z){var x=q.descendants[z];if(E){var B=q.WT.getElement(x.getId());if(B&&!q.WT.contains(E,B))continue}x.setDirty()}};this.add=function(q){function E(z,A){var x,B;x=0;for(B=z.length;x=6)){V=true;setTimeout(function(){K.adjust()},0)}}};this.adjust=function(q,E){function z(x,B){var y,O;y=0;for(O=x.length;y=6)){V=true;setTimeout(function(){K.adjust()},0)}}};this.adjust=function(q,E){function z(w,B){var y,O;y=0;for(O=w.length;y 0) layoutContainer.style.width = w + @@ -170,6 +222,9 @@ WT_DECLARE_WT_MEMBER el.style['zIndex'] = maxz + 1; }; + /* + * The user resizes the dialog using the resize handle + */ this.onresize = function(w, h, done) { centerX = centerY = false; diff --git a/src/js/WDialog.min.js b/src/js/WDialog.min.js index 1ca6fe477f..9161250426 100644 --- a/src/js/WDialog.min.js +++ b/src/js/WDialog.min.js @@ -1,6 +1,6 @@ -WT_DECLARE_WT_MEMBER(1,JavaScriptConstructor,"WDialog",function(h,a,g,k,l,r,s){function t(){if(r){var b=d.pxself(a,"left"),c=d.pxself(a,"top");if(b!=m||c!=n){m=b;n=c;h.emit(a,r,m,n)}}}function u(b,c){if(!v&&s)if(b!=o||c!=p){o=b;p=c;h.emit(a,s,o,p)}}function w(b){var c=b||window.event;b=d.pageCoordinates(c);c=d.windowCoordinates(c);var e=d.windowSize();if(c.x>0&&c.x0&&c.y0)f.style.width=c+d.parsePx($(f).css("borderLeftWidth"))+ -d.parsePx($(f).css("borderRightWidth"))+"px";if(e>0)f.style.height=e+d.parsePx($(f).css("borderTopWidth"))+d.parsePx($(f).css("borderBottomWidth"))+"px";q.centerDialog();a.wtResize&&a.wtResize(a,c,e)}function z(){h.layouts2.adjust()}jQuery.data(a,"obj",this);var q=this,f=$(a).find(".dialog-layout").get(0),d=h.WT,i,j,m=-1,n=-1,o=-1,p=-1,v=false;if(g){g.onmousedown=function(b){b=b||window.event;d.capture(g);b=d.pageCoordinates(b);i=b.x;j=b.y;g.onmousemove=w};g.onmouseup=function(){g.onmousemove=null; -t();d.capture(null)}}this.centerDialog=function(){if(a.parentNode==null)a=g=null;else if(a.style.display!="none"&&a.style.visibility!="hidden"){var b=d.windowSize(),c=a.offsetWidth,e=a.offsetHeight;if(k){a.style.left=Math.round((b.x-c)/2+(d.isIE6?document.documentElement.scrollLeft:0))+"px";a.style.marginLeft="0px"}if(l){a.style.top=Math.round((b.y-e)/2+(d.isIE6?document.documentElement.scrollTop:0))+"px";a.style.marginTop="0px"}if(a.style.position!="")a.style.visibility="visible";t()}};this.bringToFront= -function(){var b=0;$(".Wt-dialog, .modal, .modal-dialog").each(function(c,e){b=Math.max(b,$(e).css("z-index"))});if(b>a.style.zIndex)a.style.zIndex=b+1};this.onresize=function(b,c,e){k=l=false;v=!e;y(a,b,c);jQuery.data(f.firstChild,"layout").setMaxSize(0,0);h.layouts2.scheduleAdjust();e&&u(b,c)};f.wtResize=x;a.wtPosition=z;if(a.style.width!="")f.style.width=d.parsePx(a.style.width)>0?a.style.width:a.offsetWidth+"px";if(a.style.height!="")f.style.height=d.parsePx(a.style.height)>0?a.style.height:a.offsetHeight+ -"px";q.centerDialog()}); +WT_DECLARE_WT_MEMBER(1,JavaScriptConstructor,"WDialog",function(i,a,g,l,m,v,w){function x(){if(v){var b=c.pxself(a,"left"),d=c.pxself(a,"top");if(b!=r||d!=s){r=b;s=d;i.emit(a,v,r,s)}}}function y(b,d){if(!z)if(b!=t||d!=u){t=b;u=d;w&&i.emit(a,w,t,u)}}function D(b){var d=b||window.event;b=c.pageCoordinates(d);d=c.windowCoordinates(d);var e=c.windowSize();if(d.x>0&&d.x0&&d.y0)f.style.width=d+c.parsePx($(f).css("borderLeftWidth"))+c.parsePx($(f).css("borderRightWidth"))+"px";if(e>0)f.style.height=e+c.parsePx($(f).css("borderTopWidth"))+c.parsePx($(f).css("borderBottomWidth"))+"px";h.centerDialog();a.wtResize&&a.wtResize(a,d, +e)}function G(){i.layouts2.adjust()}jQuery.data(a,"obj",this);var h=this,f=$(a).find(".dialog-layout").get(0),c=i.WT,n,o,r=-1,s=-1,t=-1,u=-1,z=false,k=-1,j=-1,p=-1,q=-1;if(g){g.onmousedown=function(b){b=b||window.event;c.capture(g);b=c.pageCoordinates(b);n=b.x;o=b.y;g.onmousemove=D};g.onmouseup=function(){g.onmousemove=null;x();c.capture(null)}}this.centerDialog=function(){if(a.parentNode==null)a=g=null;else if(a.style.display!="none"&&a.style.visibility!="hidden"){var b=c.windowSize(),d=a.offsetWidth, +e=a.offsetHeight;if(k!=-1)l=true;if(j!=-1)m=true;if(l){a.style.left=Math.round((b.x-d)/2+(c.isIE6?document.documentElement.scrollLeft:0))+"px";a.style.marginLeft="0px"}if(m){a.style.top=Math.round((b.y-e)/2+(c.isIE6?document.documentElement.scrollTop:0))+"px";a.style.marginTop="0px"}if(a.style.position!="")a.style.visibility="visible";x()}};this.bringToFront=function(){var b=0;$(".Wt-dialog, .modal, .modal-dialog").each(function(d,e){b=Math.max(b,$(e).css("z-index"))});if(b>a.style.zIndex)a.style.zIndex= +b+1};this.onresize=function(b,d,e){l=m=false;z=!e;F(a,b,d);jQuery.data(f.firstChild,"layout").setMaxSize(0,0);i.layouts2.scheduleAdjust();e&&y(b,d)};f.wtResize=E;a.wtPosition=G;if(a.style.width!="")f.style.width=c.parsePx(a.style.width)>0?a.style.width:a.offsetWidth+"px";if(a.style.height!="")f.style.height=c.parsePx(a.style.height)>0?a.style.height:a.offsetHeight+"px";h.centerDialog()}); diff --git a/src/web/DomElement.C b/src/web/DomElement.C index 6dac989cac..052606847d 100644 --- a/src/web/DomElement.C +++ b/src/web/DomElement.C @@ -1577,7 +1577,8 @@ void DomElement::setJavaScriptProperties(EscapeOStream& out, out << var_ << ".selected=" << i->second << ';'; break; case PropertySelectedIndex: - out << var_ << ".selectedIndex=" << i->second << ';'; + out << "setTimeout(function() { " + << var_ << ".selectedIndex=" << i->second << ";}, 0);"; break; case PropertyMultiple: out << var_ << ".multiple=" << i->second << ';'; diff --git a/src/web/base64.cpp b/src/web/base64.cpp index 4d507f0cbb..234be4b0b1 100644 --- a/src/web/base64.cpp +++ b/src/web/base64.cpp @@ -18,7 +18,7 @@ namespace base64 const char* to_table_end = _to_table + sizeof(_to_table); - const char _from_table[128] = + const signed char _from_table[128] = { -1, -1, -1, -1, -1, -1, -1, -1, // 0 -1, -1, -1, -1, -1, -1, -1, -1, // 8 @@ -37,5 +37,5 @@ namespace base64 41, 42, 43, 44, 45, 46, 47, 48, // 112 49, 50, 51, -1, -1, -1, -1, -1 // 120 }; - const char* from_table = _from_table; + const signed char* from_table = _from_table; } diff --git a/src/web/base64.h b/src/web/base64.h index 7a91981ba1..22ee04bf76 100644 --- a/src/web/base64.h +++ b/src/web/base64.h @@ -61,7 +61,7 @@ namespace base64 extern WT_API const char* to_table; extern WT_API const char* to_table_end; - extern WT_API const char* from_table; + extern WT_API const signed char* from_table; template void encode(const InputIterator& begin, diff --git a/src/web/skeleton/Wt.js b/src/web/skeleton/Wt.js index 356358e799..1bd908074d 100644 --- a/src/web/skeleton/Wt.js +++ b/src/web/skeleton/Wt.js @@ -1098,7 +1098,7 @@ this.parsePx = function(v) { return parseCss(v, /^\s*(-?\d+(?:\.\d+)?)\s*px\s*$/i, 0); }; -function parsePct(v, defaultValue) { +this.parsePct = function(v, defaultValue) { return parseCss(v, /^\s*(-?\d+(?:\.\d+)?)\s*\%\s*$/i, defaultValue); } @@ -1113,7 +1113,7 @@ this.pxself = function(c, s) { }; this.pctself = function(c, s) { - return parsePct(c.style[s], 0); + return WT.parsePct(c.style[s], 0); }; // Convert from css property to element attribute (possibly a vendor name) @@ -1193,8 +1193,8 @@ this.IEwidth = function(c, min, max) { - WT.px(c.parentNode, 'paddingLeft') - WT.px(c.parentNode, 'paddingRight'); - min = parsePct(min, 0); - max = parsePct(max, 100000); + min = WT.parsePct(min, 0); + max = WT.parsePct(max, 100000); if (r < min) return min-1; diff --git a/src/web/skeleton/Wt.min.js b/src/web/skeleton/Wt.min.js index 3f1238905d..bc50c5a84d 100644 --- a/src/web/skeleton/Wt.min.js +++ b/src/web/skeleton/Wt.min.js @@ -14,21 +14,21 @@ http://developer.yahoo.net/yui/license.txt version: 2.5.2 */ -_$_$if_DYNAMIC_JS_$_();window.JavaScriptFunction=1;window.JavaScriptConstructor=2;window.JavaScriptObject=3;window.JavaScriptPrototype=4;window.WT_DECLARE_WT_MEMBER=function(P,Q,G,K){if(Q==JavaScriptPrototype){P=G.indexOf(".prototype");_$_WT_CLASS_$_[G.substr(0,P)].prototype[G.substr(P+11)]=K}else _$_WT_CLASS_$_[G]=Q==JavaScriptFunction?function(){return K.apply(_$_WT_CLASS_$_,arguments)}:K}; -window.WT_DECLARE_APP_MEMBER=function(P,Q,G,K){var Y=window.currentApp;if(Q==JavaScriptPrototype){P=G.indexOf(".prototype");Y[G.substr(0,P)].prototype[G.substr(P+11)]=K}else Y[G]=Q==JavaScriptFunction?function(){return K.apply(Y,arguments)}:K};_$_$endif_$_(); -if(!window._$_WT_CLASS_$_)window._$_WT_CLASS_$_=new (function(){function P(a){return a.split("/")[2]}function Q(a,b,c){if(a=="auto"||a==null)return c;return(a=(a=b.exec(a))&&a.length==2?a[1]:null)?parseFloat(a):c}function G(a,b){return Q(a,/^\s*(-?\d+(?:\.\d+)?)\s*\%\s*$/i,b)}function K(a){if(M==null)return null;if(!a)a=window.event;if(a){for(var b=a=h.target(a);b&&b!=M;)b=b.parentNode;return b==M?h.isIElt9?a:null:M}else return M}function Y(a){var b=K(a);if(b&&!fa){if(!a)a=window.event;fa=true;if(h.isIElt9){h.firedTarget= -a.srcElement||b;b.fireEvent("onmousemove",a);h.firedTarget=null}else h.condCall(b,"onmousemove",a);return fa=false}else return true}function ga(a){var b=K(a);h.capture(null);if(b){if(!a)a=window.event;if(h.isIElt9){h.firedTarget=a.srcElement||b;b.fireEvent("onmouseup",a);h.firedTarget=null}else h.condCall(b,"onmouseup",a);h.cancelEvent(a,h.CancelPropagate);return false}else return true}function na(a){if(a.addEventListener){a.addEventListener("mousemove",Y,true);a.addEventListener("mouseup",ga,true); -h.isGecko&&window.addEventListener("mouseout",function(b){!b.relatedTarget&&h.hasTag(b.target,"HTML")&&ga(b)},true)}else{a.attachEvent("onmousemove",Y);a.attachEvent("onmouseup",ga)}}function oa(){if(!wa){wa=true;na(document.body)}}function xa(){if(!ba){var a,b,c=document.styleSheets;a=0;for(b=c.length;a2};this.drag=function(){++qa};this.arrayRemove=function(a,b,c){c=a.slice((c||b)+1||a.length);a.length=b<0?a.length+b:b;return a.push.apply(a,c)};this.addAll=function(a,b){for(var c=0,g=b.length;c< -g;++c)a.push(b[c])};var ha=function(){for(var a,b=3,c=document.createElement("div"),g=c.getElementsByTagName("i");c.innerHTML="