fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9697] api : uicommon


From: Sigurd Nes
Subject: [Fmsystem-commits] [9697] api : uicommon
Date: Thu, 28 Jun 2012 10:57:50 +0000

Revision: 9697
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9697
Author:   sigurdne
Date:     2012-06-28 10:57:50 +0000 (Thu, 28 Jun 2012)
Log Message:
-----------
api : uicommon

Modified Paths:
--------------
    trunk/phpgwapi/js/yahoo/common.js
    trunk/phpgwapi/js/yahoo/datatable.js
    trunk/phpgwapi/templates/base/datatable_common.xsl

Modified: trunk/phpgwapi/js/yahoo/common.js
===================================================================
--- trunk/phpgwapi/js/yahoo/common.js   2012-06-28 09:52:17 UTC (rev 9696)
+++ trunk/phpgwapi/js/yahoo/common.js   2012-06-28 10:57:50 UTC (rev 9697)
@@ -922,3 +922,37 @@
                return cnt;
        };
 
+
+// parseUri 1.2.2
+// (c) Steven Levithan <stevenlevithan.com>
+// MIT License
+
+function parseUri (str) {
+       var     o   = parseUri.options,
+               m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
+               uri = {},
+               i   = 14;
+
+       while (i--) uri[o.key[i]] = m[i] || "";
+
+       uri[o.q.name] = {};
+       uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
+               if ($1) uri[o.q.name][$1] = $2;
+       });
+
+       return uri;
+};
+
+parseUri.options = {
+       strictMode: false,
+       key: 
["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
+       q:   {
+               name:   "queryKey",
+               parser: /(?:^|&)([^&=]*)=?([^&]*)/g
+       },
+       parser: {
+               strict: 
/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
+               loose:  
/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
+       }
+};
+

Modified: trunk/phpgwapi/js/yahoo/datatable.js
===================================================================
--- trunk/phpgwapi/js/yahoo/datatable.js        2012-06-28 09:52:17 UTC (rev 
9696)
+++ trunk/phpgwapi/js/yahoo/datatable.js        2012-06-28 10:57:50 UTC (rev 
9697)
@@ -251,6 +251,69 @@
 //             YAHOO.util.Dom.getElementsByClassName( 'yui-dt-resizerliner', 
'div' )[0].style.textAlign = 'center';
        }
 
+
+       var delete_record = function(sUrl)
+       {
+               var callback =  {       success: function(o){
+                                                                       
message_delete = o.responseText.toString().replace("\"","").replace("\"","");
+                                                                       //shown 
message if delete records
+                                                                       
delete_content_div("message",1);
+                                                                       
if(message_delete != "")
+                                                                       {
+                                                                               
oDiv=document.createElement("DIV");
+                                                                               
txtNode = document.createTextNode(message_delete);
+                                                                               
oDiv.appendChild(txtNode);
+                                                                               
oDiv.style.color = '#009900';
+                                                                               
oDiv.style.fontWeight = 'bold';
+                                                                               
div_message.appendChild(oDiv);
+                                                                               
message_delete = "";
+                                                                       }
+
+                                                                       var 
state = YAHOO.util.History.getCurrentState('state');
+                                                                       
handleHistoryNavigation(state);
+                                                                       },
+                                                       failure: 
function(o){window.alert('Server or your connection is dead.')},
+                                                       timeout: 10000
+                                               };
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+       }
+
+ 
/********************************************************************************
+ * Delete all message un DIV 'message'
+ * type == 1   always delete div content
+ * type == 2   depende of if exists  "values_ds.message" values
+ */
+       var delete_content_div = function(mydiv,type)
+       {
+               div_message= YAHOO.util.Dom.get(mydiv);
+               //flag borrar
+               borrar = false;
+               //depende of values_ds.message
+               if(type == 2)
+               {
+                       //FIXME
+                       if(window.values_ds.message && 
window.values_ds.message.length)
+                       {
+                               //delete content
+                               borrar = true;
+                       }
+               }
+
+               //always delete div content
+               if(type == 1 || borrar)
+               {
+                       if ( div_message.hasChildNodes() )
+                       {
+                               while ( div_message.childNodes.length >= 1 )
+                           {
+                               div_message.removeChild( div_message.firstChild 
);
+                           }
+                       }
+               }
+       }
+
+
+
        /* End from Property*/
 
     var handlePagination = function(state) {
@@ -340,36 +403,37 @@
        onDownloadClick = function()
        {
                var state = YAHOO.util.History.getCurrentState('state');
-alert(state);
-               //store actual values
-               actuall_funct = path_values.menuaction;
+               uri = parseUri(YAHOO.portico.dataSourceUrl);
 
-               if(config_values.particular_download)
+               var oArgs = uri.queryKey;
+               oArgs.phpgw_return_as = '';
+               oArgs.click_history = '';
+
+               donwload_func = oArgs.menuaction;
+               // modify actual function for "download" in path_values
+               // for example: property.uilocation.index --> 
property.uilocation.download
+               tmp_array= donwload_func.split(".")
+               tmp_array[2]="download"; //set function DOWNLOAD
+               donwload_func = tmp_array.join('.');
+               oArgs.menuaction=donwload_func;
+               oArgs.allrows=1;
+               oArgs.start=0;
+
+
+               if(typeof(config_values) != 'undefined' && 
config_values.particular_download != 'undefined' && 
config_values.particular_download)
                {
-                       path_values.menuaction = 
config_values.particular_download;
+                       oArgs.menuaction = config_values.particular_download;
                }
-               else
-               {
-                       donwload_func = path_values.menuaction;
-                       // modify actual function for "download" in path_values
-                       // for example: property.uilocation.index --> 
property.uilocation.download
-                       tmp_array= donwload_func.split(".")
-                       tmp_array[2]="download"; //set function DOWNLOAD
-                       donwload_func = tmp_array.join('.');
-                       path_values.menuaction=donwload_func;
-               }
 
-               ds_download = phpGWLink('index.php',path_values);
-               //show all records since the first
-               ds_download+="&allrows=1&start=0";
-               //return to "function index"
-               path_values.menuaction=actuall_funct;
-               window.open(ds_download,'window');
+               var requestUrl = phpGWLink('index.php', oArgs);
+               
+               requestUrl += '&' + state;
+
+               window.open(requestUrl,'window');
    }
 
 
 
-
 YAHOO.util.Event.addListener(window, "load", 
YAHOO.portico.initializeDataTable);
 
 

Modified: trunk/phpgwapi/templates/base/datatable_common.xsl
===================================================================
--- trunk/phpgwapi/templates/base/datatable_common.xsl  2012-06-28 09:52:17 UTC 
(rev 9696)
+++ trunk/phpgwapi/templates/base/datatable_common.xsl  2012-06-28 10:57:50 UTC 
(rev 9697)
@@ -212,6 +212,7 @@
 </xsl:template>
 
 <xsl:template match="datatable">
+       <div id="message"/>
     <div id="paginator"/>
     <div id="datatable-container"/>
        <xsl:call-template name="datasource-definition" />




reply via email to

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