001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/widgets/CmsPasswordWidget.java,v $
003: * Date : $Date: 2008-02-27 12:05:44 $
004: * Version: $Revision: 1.7 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.widgets;
033:
034: import org.opencms.file.CmsObject;
035: import org.opencms.i18n.CmsEncoder;
036:
037: /**
038: * Provides a standard HTML form password widget, for use on a widget dialog.<p>
039: *
040: * @author Michael Moossen
041: *
042: * @version $Revision: 1.7 $
043: *
044: * @since 6.0.0
045: */
046: public class CmsPasswordWidget extends A_CmsWidget {
047:
048: /**
049: * Creates a new password widget.<p>
050: */
051: public CmsPasswordWidget() {
052:
053: // empty constructor is required for class registration
054: this ("");
055: }
056:
057: /**
058: * Creates a new password widget with the given configuration.<p>
059: *
060: * @param configuration the configuration to use
061: */
062: public CmsPasswordWidget(String configuration) {
063:
064: super (configuration);
065: }
066:
067: /**
068: * @see org.opencms.widgets.I_CmsWidget#getDialogWidget(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter)
069: */
070: public String getDialogWidget(CmsObject cms,
071: I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) {
072:
073: String id = param.getId();
074:
075: StringBuffer result = new StringBuffer(16);
076:
077: result
078: .append("<td class=\"xmlTd\"><input type=\"password\" class=\"xmlInput textInput");
079: if (param.hasError()) {
080: result.append(" xmlInputError");
081: }
082: result.append("\" name=\"");
083: result.append(id);
084: result.append("\" id=\"");
085: result.append(id);
086: result.append("\" value=\"");
087: result.append(CmsEncoder.escapeXml(param.getStringValue(cms)));
088: result.append("\">");
089: result.append("</td>");
090:
091: return result.toString();
092: }
093:
094: /**
095: * @see org.opencms.widgets.I_CmsWidget#newInstance()
096: */
097: public I_CmsWidget newInstance() {
098:
099: return new CmsPasswordWidget(getConfiguration());
100: }
101: }
|