r1564 + give Collapsible Textareas a try
authorDenis Ovsienko <infrastation@yandex.ru>
Sat, 19 Jan 2008 14:05:41 +0000 (14:05 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Sat, 19 Jan 2008 14:05:41 +0000 (14:05 +0000)
COPYING
inc/interface.php
index.php
js/collapsible_textareas.js [new file with mode: 0644]
pi.css

diff --git a/COPYING b/COPYING
index 49f497e3fc56e15e0860068bb0375ef25c36ee36..582c6d5a4d459b82dc0c9979c39970170b46abda 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-
-
+----------------------8<----------------------8<----------------------
 
 RackTables includes "Live Validator", which is licensed under
 the BSD license:
@@ -48,10 +47,15 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-
-
+----------------------8<----------------------8<----------------------
 
 RackTables includes an enhanced derivative of "Form.Element.Resize"
 JavaScript class, which is licensed under the Artistic license:
 
 Copyright (c) 2007 Edoardo Sabadelli. All rights reserved.
+
+----------------------8<----------------------8<----------------------
+
+RackTables includes Collapsible Textareas 1.0, which is licensed under
+Creative Commons Attribution 3.0 License and is copyright (c) 2007
+SiteCrafting, Inc. <service@sitecrafting.com>
index 81966b2a4746ccfd95acf7f681f46847e01b2fec..5b144644e87432dc2d6d3cb0b915f75139c7c6e0 100644 (file)
@@ -3789,7 +3789,7 @@ function renderRSPoolServerForm ($pool_id = 0)
        $order = 'odd';
        foreach ($poolInfo['rslist'] as $rsid => $rs)
        {
-               echo "<form action='${root}process.php'>";
+               echo "<form class=collapse_tareas action='${root}process.php'>";
                echo "<input type=hidden name=page value='${pageno}'>\n";
                echo "<input type=hidden name=tab value='${tabno}'>\n";
                echo "<input type=hidden name=op value=updRS>";
@@ -3860,7 +3860,7 @@ function renderRSPoolLBForm ($pool_id = 0)
                foreach ($vslist as $vs_id => $configs)
                {
                        $oi = getObjectInfo ($object_id);
-                       echo "<form action='${root}process.php'>";
+                       echo "<form class=collapse_tareas action='${root}process.php'>";
                        echo "<input type=hidden name=page value='${pageno}'>\n";
                        echo "<input type=hidden name=tab value='${tabno}'>\n";
                        echo "<input type=hidden name=op value=updLB>";
@@ -4007,7 +4007,7 @@ function renderVSListEditForm ()
        $order = 'odd';
        foreach (getVSList() as $vsid => $vsinfo)
        {
-               echo "<form method=post action='${root}process.php'>\n";
+               echo "<form class=collapse_tareas method=post action='${root}process.php'>\n";
                echo "<input type=hidden name=page value=${pageno}>\n";
                echo "<input type=hidden name=tab value=${tabno}>\n";
                echo "<input type=hidden name=op value=upd>\n";
@@ -4098,7 +4098,7 @@ function editRSPools ()
        $order='odd';
        foreach ($pool_list as $pool_id => $pool_info)
        {
-               echo "<form method=post action='${root}process.php'>\n";
+               echo "<form class=collapse_tareas method=post action='${root}process.php'>\n";
                echo "<input type=hidden name=page value=${pageno}>\n";
                echo "<input type=hidden name=tab value=${tabno}>\n";
                echo "<input type=hidden name=op value=upd>\n";
@@ -4213,8 +4213,10 @@ function renderRSPoolRSInServiceForm ($pool_id = 0)
        echo "</table>\n</form>";
 }
 
+// Disabled at the moment.
 function printResizeJS ($elementid)
 {
+       return;
 ?>
                <script type="text/javascript">
                new Form.Element.Resize
index b510449a1ae4b0d205e2731d41e32a33aac82d46..711e1e2073acd0bcfb9eb90b1dd2884974965540 100644 (file)
--- a/index.php
+++ b/index.php
@@ -29,6 +29,7 @@ foreach (array ('F', 'A', 'U', 'T', 'Th', 'Tw', 'Thw') as $statecode)
        </style>
        <script language='javascript' type='text/javascript' src='js/live_validation.js'></script>
        <script language='javascript' type='text/javascript' src='js/Resize.js'></script>
+       <script language='javascript' type='text/javascript' src='js/collapsible_textareas.js'></script>
        <script type="text/javascript">
        function init() {
                document.add_new_range.range.setAttribute('match', "^\\d\\d?\\d?\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\/\\d\\d?$");
diff --git a/js/collapsible_textareas.js b/js/collapsible_textareas.js
new file mode 100644 (file)
index 0000000..2cac26f
--- /dev/null
@@ -0,0 +1,43 @@
+/*  Collapsible Textareas, version 1.0
+ *  (c) 2007 SiteCrafting, Inc. <service@sitecrafting.com>
+ *
+ *  Collapsible Textareas is available under the Creative Commons Attribution
+ *  3.0 License (http://creativecommons.org/licenses/by/3.0/).
+ *
+/*--------------------------------------------------------------------------*/
+
+
+// find all the forms with textareas we want to allow to collapse
+function setupTextareas() {
+       var pageForms = document.getElementsByTagName("form");
+
+       for( var j=0; j<pageForms.length; j++) {
+               var formArea = pageForms[j];
+
+               if( formArea.className.indexOf("collapse_tareas") > -1 ) {
+                       var txtAreas = formArea.getElementsByTagName("textarea");
+                       for( var i=0; i<txtAreas.length; i++ ) {
+                               var thisTxtArea = txtAreas[i];
+
+                               if( thisTxtArea.addEventListener ) {
+                                       thisTxtArea.addEventListener("focus", bigSmlTextarea, false);
+                                       thisTxtArea.addEventListener("blur", bigSmlTextarea, false);
+                               } else { // IE
+                                       thisTxtArea.attachEvent("onfocus", bigSmlTextarea);
+                                       thisTxtArea.attachEvent("onblur", bigSmlTextarea);
+                               }
+                       }
+               }
+       }
+}
+
+// collapse or expand a textarea
+function bigSmlTextarea(e)
+{
+       var node = ( e.target ? e.target : e.srcElement );
+
+       if( node.className.indexOf("expanded") == -1 )
+               node.className += " expanded";
+       else
+               node.className = node.className.replace(/expanded/gi, "");
+}
diff --git a/pi.css b/pi.css
index eb51522c42226ca1213327cab15b4c4fb90663a8..03caca5c3cea3c56030d431db5442a9c84ba85e2 100644 (file)
--- a/pi.css
+++ b/pi.css
@@ -533,3 +533,9 @@ div.commentblock {
 .port_unknown {
        background-color: #ff0000;
 }
+
+/* Collapsible Textareas classes */
+.collapse_tareas input, .collapse_tareas textarea { font: 10pt arial, sans-serif; border: 1px solid #888; }
+.collapse_tareas textarea { height: 1.45em; }
+.collapse_tareas textarea.compact { height: 1.45em !important; }
+.collapse_tareas textarea.expanded { height: 5em !important; }