NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/Chameleon/trunk/Chameleon/RulerResult/RulerResult.widget.php

Revision 13 (checked in by jcleary, 17 years ago)

Latest Chameleon code checkout from previous repository

Line 
1 <?php
2 /**
3  * Ruler result Widget class
4  *
5  * @project     CWC2
6  * @revision    $Id: RulerResult.widget.php,v 1.6 2004/12/20 20:16:58 pspencer Exp $
7  * @purpose     Ruler result Widget class
8  * @author      DM Solutions Group (assefa@dmsolutions.ca)
9  * @copyright
10  * <b>Copyright (c) 2002, DM Solutions Group Inc.</b>
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  */
29
30 include_once(dirname(__FILE__)."/../Widget.php");
31 include_once(dirname(__FILE__)."/../Label.php");
32
33 /**
34  * RulerResult
35  *
36  * @desc RulerResult widget.
37  *       Creates a text input field REULER_RESULT. This field will be
38  *       used by the Ruler widget to display the value. If this field
39  *       is not available the window.status will be used.
40  */
41 class RulerResult extends CWCWidget
42 {
43     var $moLabel;
44     var $mnDefaultTextFieldSize = 20;
45     var $mszClass = "CWCRulerResultWidgetClass";
46     var $mszStyle = "";
47
48     function RulerResult()
49     {
50         // invoke constructor of parent
51         parent::CWCWidget();
52
53         // set the description for this widget
54         $this->szWidgetDescription = <<<EOT
55 The RulerResults widget allows the results of the users distance measurements
56 to be displayed in a stylable HTML INPUT box.
57 EOT;
58
59         $this->moLabel = new CWCLabel( $this );
60         $this->maAttributes["WIDGETCLASS"] = new StringAttribute( "WIDGETCLASS", false );
61         $this->maAttributes["WIDGETSTYLE"] = new StringAttribute( "WIDGETSTYLE", false );
62         $this->maAttributes["TEXTFIELDSIZE"] = new IntegerAttribute( "TEXTFIELDSIZE", false, 0 );
63         $this->mnMaturityLevel = MATURITY_BETA;
64     }
65
66     function InitDefaults()
67     {
68         parent::InitDefaults();
69         if (isset($this->maParams["WIDGETCLASS"]))
70             $this->mszClass = $this->maParams["WIDGETCLASS"];
71         if (isset($this->maParams["WIDGETSTYLE"]))
72             $this->mszStyle = $this->maParams["WIDGETSTYLE"];
73         if (isset($this->maParams["TEXTFIELDSIZE"]))
74             $this->mnDefaultTextFieldSize = strtoupper($this->maParams["TEXTFIELDSIZE"]);
75     }
76
77
78     /**
79      * DrawPublish.
80      */
81     function DrawPublish()
82     {
83         $nSize = $this->mnDefaultTextFieldSize;
84         if (isset($this->maParams["TextFieldSize"]))
85             $nSize = strtoupper($this->maParams["TextFieldSize"]);
86
87         $szClass = "";
88         if ( strlen($this->mszClass) > 0 )
89             $szClass = " CLASS=\"$this->mszClass\"";
90         $szStyle = "";
91         if ( strlen($this->mszStyle) > 0 )
92             $szStyle = " STYLE=\"$this->mszStyle\"";
93
94         $szContents="<input$szClass$szStyle type=\"text\" name=\"RULER_RESULT\" value=\"\"  size=\"$nSize\" readonly>";
95
96         return $this->moLabel->DrawPublish( $szContents );
97
98     }
99 }
100 ?>
101
Note: See TracBrowser for help on using the browser.