fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9598] controller: register control til component


From: Sigurd Nes
Subject: [Fmsystem-commits] [9598] controller: register control til component
Date: Thu, 14 Jun 2012 18:15:27 +0000

Revision: 9598
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9598
Author:   sigurdne
Date:     2012-06-14 18:15:26 +0000 (Thu, 14 Jun 2012)
Log Message:
-----------
controller: register control til component

Modified Paths:
--------------
    trunk/controller/inc/class.uicontrol_location.inc.php
    trunk/controller/js/yahoo/register_control_to_component2.js
    
trunk/controller/templates/base/control_location/register_control_to_component.xsl

Modified: trunk/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_location.inc.php       2012-06-14 
13:27:19 UTC (rev 9597)
+++ trunk/controller/inc/class.uicontrol_location.inc.php       2012-06-14 
18:15:26 UTC (rev 9598)
@@ -799,16 +799,16 @@
 
                        if(!$entity_id && !$cat_id)
                        {
-                               return json_encode(array());
+                               $values = array();
                        }
+                       else
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
+                               $boentity       = 
CreateObject('property.boentity',false, 'entity');
+                               $boentity->results = phpgw::get_var('results', 
'int');
+                               $values = $boentity->read();
+                       }               
 
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
-                       $boentity       = 
CreateObject('property.boentity',false, 'entity');
-//                     $boentity->allrows = true;
-                       
-                       $values = $boentity->read();
-
-                       $results = array();
                        foreach($values as &$entry)
                        {
                                $checked = '';
@@ -818,7 +818,6 @@
                                        $entry['delete'] = "<input class 
=\"mychecks_delete\" type =\"checkbox\" name=\"values[delete][]\" 
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
                                }
                                $entry['select'] = "<input class 
=\"mychecks_add\" type =\"checkbox\" $checked 
name=\"values[register_component][]\" 
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
-                               $results['records'][]= $entry;
                        }
 
                        $results['recordsReturned'] = count($values);
@@ -827,6 +826,7 @@
                        $results['sort'] = 'location_code';
                        $results['dir'] = "ASC";
                        $results['pageSize'] = 10;
+                       $results['records'] = $values;
 
                        return $results;
                }

Modified: trunk/controller/js/yahoo/register_control_to_component2.js
===================================================================
--- trunk/controller/js/yahoo/register_control_to_component2.js 2012-06-14 
13:27:19 UTC (rev 9597)
+++ trunk/controller/js/yahoo/register_control_to_component2.js 2012-06-14 
18:15:26 UTC (rev 9598)
@@ -36,20 +36,11 @@
         var startIndex = (oState.pagination) ? oState.pagination.recordOffset 
: 0;
         var results = (oState.pagination) ? oState.pagination.rowsPerPage : 25;
 
-        var total = YAHOO.util.Dom.get("total").value *1;
-        // Validate input
-        if(!YAHOO.lang.isNumber(total) || total < 0 || total > 1000) {
-            YAHOO.util.Dom.get("total").value = 0;
-            total = 0;
-            alert("Total must be between 0 and 1000.");
-        }
-
         // Build custom request
         return  "&order=" + sort +
                 "&sort=" + dir +
                 "&start=" + startIndex +
-                "&results=" + (startIndex + results) +
-                "&total=" + total;
+                "&results=" + (startIndex + results);
     };
 
     // DataTable configuration
@@ -58,7 +49,18 @@
         initialRequest: generateRequest(), // Initial request for first page 
of data
         dynamicData: true, // Enables dynamic server-driven data
         sortedBy : {key:"id", dir:YAHOO.widget.DataTable.CLASS_ASC}, // Sets 
UI initial sort arrow
-        paginator: new YAHOO.widget.Paginator({ rowsPerPage:25 }) // Enables 
pagination 
+        paginator: new YAHOO.widget.Paginator({ 
+                               rowsPerPage: 10,
+//                             alwaysVisible: true,
+//                             rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
+//                             firstPageLinkLabel: "&lt;&lt; first",
+//                             previousPageLinkLabel: "&lt; previous",
+//                             nextPageLinkLabel: "next &gt;",
+//                             lastPageLinkLabel: "last &gt;&gt;",
+                               template                        : 
"{CurrentPageReport}<br/>  {FirstPageLink} {PreviousPageLink} {PageLinks} 
{NextPageLink} {LastPageLink}",
+                               pageReportTemplate      : "shows_from 
{startRecord} to {endRecord} of_total {totalRecords}."
+
+               }) // Enables pagination 
     };
     
     // DataTable instance
@@ -78,4 +80,36 @@
 };
 //YAHOO.util.Event.onDOMReady( YAHOO.example.DynamicData );
 
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
+       }       
 
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+
+
+       function checkAll(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+                       
+                               if(controls[i].checked)
+                               {
+                                       controls[i].checked = false;
+                               }
+                               else
+                               {
+                                       controls[i].checked = true;
+                               }
+                       }
+               }
+       }
+
+

Modified: 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
===================================================================
--- 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
  2012-06-14 13:27:19 UTC (rev 9597)
+++ 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
  2012-06-14 18:15:26 UTC (rev 9598)
@@ -62,10 +62,7 @@
                                                        <table align = "center" 
width="95%">
                                                                <tr>
                                                                        <td 
colspan = '6'>
-                                                                               
<xsl:apply-templates select="paging"/>
                                                                                
<xsl:apply-templates select="datatable"/>
-                                                                               
<p>Total records (between 0 and 1000): <input type="text" id="total" 
value="1000"/> <input type="button" id="update" value="Update"/></p>
-                                                                               
<div id="dynamicdata"></div>
                                                                        </td>
                                                                </tr>
                                                        </table>
@@ -187,9 +184,8 @@
 
 
 <xsl:template match="datatable" xmlns:php="http://php.net/xsl";>
-       <div id="paging_0"/>
-       <div id="datatable-container_0"/>
-       
+       <div id="dynamicdata"></div>
+
        <xsl:call-template name="datasource-definition" />
        <div id="receipt"></div>
        <xsl:variable name="label_submit"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]