R35156 - in /trunk/felamimail: inc/class.uiwidgets.inc.php js/jscode/viewMainScreen.js templates/default/app.css

Author: igel457
New Revision: 35156

URL: http://www.egroupware.org/viewvc/egroupware?rev=35156&view=rev
Log:
Cleaned up code, added delay before previewing windows, rewrote row css style handling, using new possibility to change the css class of an grid row

Modified:
trunk/felamimail/inc/class.uiwidgets.inc.php
trunk/felamimail/js/jscode/viewMainScreen.js
trunk/felamimail/templates/default/app.css

Modified: trunk/felamimail/inc/class.uiwidgets.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/felamimail/inc/class.uiwidgets.inc.php?rev=35156&r1=35155&r2=35156&view=diff

— trunk/felamimail/inc/class.uiwidgets.inc.php (original)
+++ trunk/felamimail/inc/class.uiwidgets.inc.php Fri Jun 3 16:22:39 2011
@@ -865,21 +865,20 @@
$data[“status”] = $status; // ein icon

			// the css for this row
  •   		if($header['deleted']) {
    
  •   			$css_style = 'header_row_D';
    
  •   		} elseif($header['recent'] && !$header['seen']) {
    
  •   			$css_style = 'header_row_R';
    
  •   		} elseif($header['flagged']) {
    
  •   			if($header['seen']) {
    
  •   				$css_style = 'header_row_FS';
    
  •   			} else {
    
  •   				$css_style = 'header_row_F';
    
  •   			}
    
  •   		} elseif($header['seen']) {
    
  •   			$css_style = 'header_row_S';
    
  •   		} else {
    
  •   			$css_style = 'header_row_';
    
  •   		}
    
  •   		$css_styles = array();
    
  •   		if ($header['deleted']) {
    
  •   			$css_styles[] = 'deleted';
    
  •   		}
    
  •   		if ($header['recent']) {
    
  •   			$css_styles[] = 'recent';
    
  •   		}
    
  •   		if ($header['flagged']) {
    
  •   			$css_styles[] = 'flagged';
    
  •   		}
    
  •   		if (!$header['seen']) {
    
  •   			$css_styles[] = 'unseen';
    
  •   		}
    
  •   		//if (in_array("check", $cols))
      		// don't overwrite check with "false" as this forces the grid to
      		// deselect the row - sending "0" doesn't do that
    

@@ -1032,7 +1031,7 @@
$sender_name = $header[‘to_address’];
$full_address = $header[‘to_address’];
}

  •   			$data["toaddress"] = "<nobr><a class=\"".$css_style."\" href=\"#\" onclick=\"fm_handleComposeClick(false,'".$GLOBALS['egw']->link('/index.php',$linkData)."', '".$windowName."', this); return false;\" title=\"".@htmlspecialchars($full_address, ENT_QUOTES | ENT_IGNORE, $this->charset,false)."\">".@htmlspecialchars($sender_name, ENT_QUOTES | ENT_IGNORE, $this->charset,false)."</a></nobr>";
    
  •   			$data["toaddress"] = "<nobr><a href=\"#\" onclick=\"fm_handleComposeClick(false,'".$GLOBALS['egw']->link('/index.php',$linkData)."', '".$windowName."', this); return false;\" title=\"".@htmlspecialchars($full_address, ENT_QUOTES | ENT_IGNORE, $this->charset,false)."\">".@htmlspecialchars($sender_name, ENT_QUOTES | ENT_IGNORE, $this->charset,false)."</a></nobr>";
      		}
    
      		//fromaddress
    

@@ -1066,7 +1065,7 @@
);
$windowName = ‘compose’.$header[‘uid’];

  •   			$data["fromaddress"] = "<nobr><a class=\"".$css_style."\" href=\"#\" onclick=\"fm_handleComposeClick(false,'".$GLOBALS['egw']->link('/index.php',$linkData)."', '".$windowName."', this); return false;\" title=\"".@htmlspecialchars($full_address, ENT_QUOTES | ENT_IGNORE, $this->charset,false)."\">".@htmlspecialchars($sender_name, ENT_QUOTES | ENT_IGNORE, $this->charset,false)."</a></nobr>";
    
  •   			$data["fromaddress"] = "<nobr><a href=\"#\" onclick=\"fm_handleComposeClick(false,'".$GLOBALS['egw']->link('/index.php',$linkData)."', '".$windowName."', this); return false;\" title=\"".@htmlspecialchars($full_address, ENT_QUOTES | ENT_IGNORE, $this->charset,false)."\">".@htmlspecialchars($sender_name, ENT_QUOTES | ENT_IGNORE, $this->charset,false)."</a></nobr>";
      		}
      		if (in_array("date", $cols))
      		{
    

@@ -1092,7 +1091,7 @@

			//$this->t->set_var('phpgw_images',EGW_IMAGES);
			$result["data"] = $data;
  •   		$result["rowClass"] = $css_style;
    
  •   		$result["rowClass"] = implode(' ', $css_styles);
      		$rv[] = $result;
      		//error_log(__METHOD__.__LINE__.array2string($result));
      	}
    

Modified: trunk/felamimail/js/jscode/viewMainScreen.js
URL: http://www.egroupware.org/viewvc/egroupware/trunk/felamimail/js/jscode/viewMainScreen.js?rev=35156&r1=35155&r2=35156&view=diff

— trunk/felamimail/js/jscode/viewMainScreen.js (original)
+++ trunk/felamimail/js/jscode/viewMainScreen.js Fri Jun 3 16:22:39 2011
@@ -1,35 +1,3 @@
-/*$(document).ready(function() {

  • if (typeof CopyOrMove == ‘undefined’
  •   var CopyOrMove = egw_appWindow('felamimail').CopyOrMove;
    
  • if (typeof prefAskForMove == ‘undefined’)
  •   var prefAskForMove = egw_appWindow('felamimail').prefAskForMove; 
    
  • if (typeof prefAskForMultipleForward == ‘undefined’) var prefAskForMultipleForward = egw_appWindow(‘felamimail’).prefAskForMove;
  • if (typeof sURL == ‘undefined’) var sURL = window.sURL;
  • if (typeof copyingMessages == ‘undefined’) var MessageBuffer;
  • // global vars to store server and active folder info
  • //var activeServerID = ‘{activeServerID}’;
  • if (typeof activeFolder == ‘undefined’) var activeFolder = egw_appWindow(‘felamimail’).activeFolder;
  • if (typeof activeFolderB64 == ‘undefined’) var activeFolderB64 = egw_appWindow(‘felamimail’).activeFolderB64;
  • if (typeof activityImagePath == ‘undefined’) var activityImagePath = egw_appWindow(‘felamimail’).activityImagePath;
  • if (typeof actionManager == ‘undefined’) var actionManager = egw_appWindow(‘felamimail’).actionManager;
  • if (typeof objectManager == ‘undefined’) var objectManager = egw_appWindow(‘felamimail’).objectManager;
  • if (typeof mailGrid == ‘undefined’) var mailGrid = egw_appWindow(‘felamimail’).mailGrid;
  • // how many row are selected currently
  • if (typeof checkedCounter == ‘undefined’) var checkedCounter=egw_appWindow(‘felamimail’).checkedCounter;
  • // the refreshtimer objects
  • if (typeof aktiv == ‘undefined’) var aktiv = window.aktiv;
  • if (typeof fm_timerFolderStatus == ‘undefined’) var fm_timerFolderStatus = egw_appWindow(‘felamimail’).fm_timerFolderStatus;
  • if (typeof fm_previewMessageID == ‘undefined’) var fm_previewMessageID = egw_appWindow(‘felamimail’).fm_previewMessageID;
  • if (typeof fm_previewMessageFolderType == ‘undefined’) var fm_previewMessageFolderType = egw_appWindow(‘felamimail’).fm_previewMessageFolderType;
    -});

-// refresh time for mailboxview
-if (typeof refreshTimeOut == ‘undefined’) var refreshTimeOut = egw_appWindow(‘felamimail’).refreshTimeOut;*/

function egw_email_fetchDataProc(_elems, _columns, _callback, _context)
{
var request = new egw_json_request(“felamimail.uiwidgets.ajax_fetch_data”,
@@ -870,89 +838,90 @@
}
}

-var felamimail_messageUrls = {};
-var felamimail_dblclick_speed = 300;

-/**

    • Handles message clicks and distinguishes between double clicks and single clicks
  • */
    -function fm_handleMessageClick(_double, _url, _windowName, _node)
    -{
  • if (_double)
  • {
  •   // Unset the given message url - the timeout which was triggered in the
    
  •   // click handler will now no longer call the fm_readMessage function
    
  •   delete (felamimail_messageUrls[_url]);
    
  •   window.setTimeout(function () {
    
  •   if (typeof felamimail_messageUrls[_url] == "undefined")
    
  •   {
    
  •   	fm_readMessage(_url, _windowName, _node);
    
  •   	//alert('fm_handleMessageClick:'+' is double');
    
  •   	}
    
  •   }, felamimail_dblclick_speed);
    
  •   //mailGrid.dataRoot.actionObject.setAllSelected(false);
    
  • }
  • else
  • {
  •   // Check whether the given url is already queued. Only continue if this
    
  •   // is not the case
    
  •   if (typeof felamimail_messageUrls[_url] == "undefined")
    
  •   {
    
  •   	// Queue the url
    
  •   	felamimail_messageUrls[_url] = true;
    
  •   	// Wait "felamimail_dblclick_speed" milliseconds. Only if the doubleclick
    
  •   	// event doesn't occur in this time, trigger the single click function
    
  •   	window.setTimeout(function () {
    
  •   		if (typeof felamimail_messageUrls[_url] == "boolean")
    

+var felamimail_queuedMessage = null;
+var felamimail_rm_timeout = 300;
+
+function fm_msg_addClass(_id, _class) {

  • // Set the opened message read
  • var dataObject = mailGrid.dataRoot.getElementById(_id);
  • if (dataObject)
  • {
  •   dataObject.addClass(_class);
    
  • }
    +}

+function fm_msg_removeClass(_id, _class) {

  • // Set the opened message read
  • var dataObject = mailGrid.dataRoot.getElementById(_id);
  • if (dataObject)
  • {
  •   dataObject.removeClass(_class);
    
  • }
    +}

+function fm_readMessage(_url, _windowName, _node) {
+

  • var windowArray = windowName.split(’’);
  • if (windowArray[0] == ‘MessagePreview’)
  • {
  •   // Check whether this mail has not already be queued and the message
    
  •   // preview is actuall displayed
    
  •   if (felamimail_queuedMessage != windowArray[1] && !isNaN(felamimail_iframe_height)) {
    
  •   	// Set the url as queueud
    
  •   	felamimail_queuedMessage = windowArray[1];
    
  •   	// Wait felamimail_rm_timeout seconds before opening the email in the
    
  •   	// preview iframe
    
  •   	window.setTimeout(function() {
    
  •   		// Abort if another mail should be displayed
    
  •   		if (windowArray[1] != felamimail_queuedMessage)
      		{
    
  •   			fm_readMessage(_url, _windowName, _node);
    
  •   			delete (felamimail_messageUrls[_url]);
    
  •   			//alert('fm_handleMessageClick:'+' is single');
    
  •   			return false;
      		}
    
  •   	}, felamimail_dblclick_speed);
    
  •   }
    
  • }
  • var allSelected = mailGrid.dataRoot.actionObject.getSelectedObjects();
  • // allSelected[i].id hält die id
  • // zurückseten iteration über allSelected (getSelectedObjects) und dann allSelected[i].setSelected(false);
  • for (var i=0; i<allSelected.length; i++)
  • {
  •   if (allSelected[i].id.length>0) 
    
  •   {
    
  •   	allSelected[i].setSelected(false);
    
  •   	allSelected[i].setFocused(true);
    
  •   	//alert('fm_handleMessageClick:'+allSelected[i].id);
    
  •   }
    
  • }
    -}

-function fm_readMessage(_url, _windowName, _node) {
-//alert(‘url to open’+_url);

  • var windowArray = windowName.split(’’);
  • var tableElement =_node.parentNode.parentNode.parentNode.parentNode;
  • var allRows = tableElement.getElementsByTagName(“tr”);
  • for(i=0; i< allRows.length; i++) {
  •   allRows[i].style.backgroundColor = "#FFFFFF";
    
  • }
  • if (windowArray[0] == ‘MessagePreview’) {
  •   if (document.getElementById('messageCounter').innerHTML.search(eval('/'+egw_appWindow('felamimail').lang_updating_view+'/'))<0 ) {MessageBuffer = document.getElementById('messageCounter').innerHTML;}
    
  •   egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">'+ egw_appWindow('felamimail').lang_updating_view +'</span>');
    
  •   fm_previewMessageID = windowArray[1];
    
  •   fm_previewMessageFolderType = windowArray[2];
    
  •   // refreshMessagePreview now also refreshes the folder state
    
  •   egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.refreshMessagePreview",windowArray[1],windowArray[2]);
    
  •   		// Copy the old status message TODO. Make this an own function
    
  •   		if (document.getElementById('messageCounter').innerHTML.search(
    
  •   			eval('/'+egw_appWindow('felamimail').lang_updating_view+'/')) < 0 )
    
  •   		{
    
  •   			MessageBuffer = document.getElementById('messageCounter').innerHTML;
    
  •   		}
    
  •   		// Set the "updating view" message
    
  •   		egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">'+ egw_appWindow('felamimail').lang_updating_view +'</span>');
    
  •   		fm_previewMessageID = windowArray[1];
    
  •   		fm_previewMessageFolderType = windowArray[2];
    
  •   		// refreshMessagePreview now also refreshes the folder state
    
  •   		egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.refreshMessagePreview", windowArray[1], windowArray[2]);
    
  •   		felamimail_queuedMessage = null;
    
  •   		fm_msg_removeClass(windowArray[1], 'unseen');
    
  •   	}, felamimail_rm_timeout);
    
  •   }
    
    } else {
  •   // Remove the url which shall be opened as we do not want to open this
    
  •   // message in the preview window
    
  •   if (felamimail_queuedMessage == windowArray[1]) {
    
  •   	// Wait a short moment as the code above might be executed after
    
  •   	// an double click
    
  •   	window.setTimeout(function() {
    
  •   		felamimail_queuedMessage = null;
    
  •   	}, 100);
    
  •   }
    
  •   egw_openWindowCentered(_url, _windowName, 750, egw_getWindowOuterHeight());
    
      // Refresh the folder state (count of unread emails)
      egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.refreshFolder");
    
  • }
  • //alert(‘after opening’);
  • mailGrid.dataRoot.actionObject.setAllSelected(false);
  • _node.style.fontWeight=‘normal’;
  • _node.style.backgroundColor = “#ddddFF”;
  •   fm_msg_removeClass(windowArray[1], 'unseen');
    
  • }
  • // TODO class
    var aElements = _node.getElementsByTagName(“a”);
    aElements[0].style.fontWeight=‘normal’;
    }
    @@ -1099,60 +1068,6 @@
    egw_appWindow(‘felamimail’).xajax_doXMLHTTP(‘felamimail.ajaxfelamimail.changeActiveAccount’,_accountSelection.value);
    }

-// stuff to change row background color
-function HexToR(h) {return parseInt((cutHex(h)).substring(0,2),16)}
-function HexToG(h) {return parseInt((cutHex(h)).substring(2,4),16)}
-function HexToB(h) {return parseInt((cutHex(h)).substring(4,6),16)}
-function cutHex(h) {return (h.charAt(0)=="#") ? h.substring(1,7):h}
-function RGBtoHex(R,G,B) {return toHex®+toHex(G)+toHex(B)}
-function toHex(N) {

  • if (N==null) return “00”;
  • N=parseInt(N); if (N==0 || isNaN(N)) return “00”;
  • N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
  • return “0123456789ABCDEF”.charAt((N-N%16)/16)
  •  + "0123456789ABCDEF".charAt(N%16);
    

-}
-function compareColor(colorA, colorB)
-{

  • var cA = colorA.search(/#/);
  • var cA2C = colorA;
  • var cB2C = colorB;
  • if (cA != -1)
  • {
  •   cA2C = "rgb("+HexToR(colorA)+", "+HexToG(colorA)+", "+HexToB(colorA)+")";
    
  • }
  • var cB = colorB.search(/#/);
  • if (cB != -1)
  • {
  •   cB2C = "rgb("+HexToR(colorB)+", "+HexToG(colorB)+", "+HexToB(colorB)+")";
    
  • }
  • if (cA2C == cB2C)
  • {
  •   //alert("match:"+colorA+cA2C+" == "+colorB+cB2C);
    
  •   return true;
    
  • }
  • else
  • {
  •   //alert("not match:"+colorA+cA2C+" == "+colorB+cB2C);
    
  •   return false;
    
  • }
    -}
    -function onChangeColor(el,direction)
    -{
  • if (!compareColor(el.style.backgroundColor,"#ddddFF") && !compareColor(el.style.backgroundColor,"#eeeddd"))
  • {
  •   if (direction == 'in') el.style.backgroundColor="#dddddd";
    
  •   if (direction == 'out') el.style.backgroundColor="#FFFFFF";
    
  • }
  • else
  • {
  •   if (direction == 'in') el.style.backgroundColor="#eeeddd";
    
  •   if (direction == 'out') el.style.backgroundColor="#ddddFF";
    
  • }
  • return true;
    -}

function handleResize()
{
var MIN_TABLE_HEIGHT = 100;
@@ -1166,6 +1081,12 @@
// Calculate how many space is actually there for the whole mail view
var outerContainer = $(’#divMessageList’);
var mainViewArea = $(’#divMainView’);
+

  • // Exit if the felamimail containers do not exist
  • if (!outerContainer || !mainViewArea) {
  •   return;
    
  • }
  • var viewportHeight = $(window).height();
    var documentHeight = $(“body”).height() == 0 ? $(document).height() : $(“body”).height();
    var containerHeight = $(outerContainer).height();
    @@ -1473,3 +1394,4 @@
    egw_appWindow(‘felamimail’).xajax_doXMLHTTP(
    “felamimail.ajaxfelamimail.copyMessages”, target, messages);
    }

Modified: trunk/felamimail/templates/default/app.css
URL: http://www.egroupware.org/viewvc/egroupware/trunk/felamimail/templates/default/app.css?rev=35156&r1=35155&r2=35156&view=diff

— trunk/felamimail/templates/default/app.css (original)
+++ trunk/felamimail/templates/default/app.css Fri Jun 3 16:22:39 2011
@@ -42,174 +42,23 @@
.quoted4 { color:#000099; }
.quoted5 { color:#bb6600; }

-TR.header_row_ {

  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • font-weight : bold;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_ {

  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
  • font-weight : bold;
    -}

-TR.header_row_D {

  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
    +tr.recent div,
    +tr.recent a,
    +tr.unseen div,
    +tr.unseen a {
  • color: #003075;
  • font-weight: bold;
    +}

+tr.flagged div,
+tr.flagged a {

  • color: #ac0000 !important;
    +}

+tr.deleted div,
+tr.deleted a {
color: silver;
text-decoration : line-through;

  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_D {

  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
  • color: silver;
  • text-decoration : line-through;
  • font-weight : bold;
    -}

-TR.header_row_F {

  • color: red;
  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • font-weight : bold;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_F {

  • color: red;
  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
  • font-weight : bold;
    -}

-TR.header_row_FS {

  • color: red;
  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_FS {

  • color: red;
  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
    -}
    -TR.header_row_R {
  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • font-weight : bold;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_R {

  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
  • font-weight : bold;
    -}

-TR.header_row_S {

  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_S {

  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
    -}

-TR.header_row_DS, TR.header_row_ADS
-{

  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • color: silver;
  • text-decoration : line-through;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_DS, A.header_row_ADS
-{

  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
  • color: silver;
  • text-decoration : line-through;
    -}

-TR.header_row_RS
-{

  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_RS
-{

  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
    -}

-TR.header_row_AS,TR.header_row_RAS
-{

  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_AS, A.header_row_RAS
-{

  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
    -}

-TR.header_row_FAS, TR.header_row_FS
-{

  • color: red;
  • FONT-SIZE: 11px;
  • height : 20px;
  • padding: 0;
  • background : White;
  • white-space: nowrap;
    -}

-A.header_row_FAS, A.header_row_FS
-{

  • color: red;
  • FONT-SIZE: 11px;
  • height : 14px;
  • padding: 0;
    }

.subjectBold


Simplify data backup and recovery for your virtual environment with vRanger.
Installation’s a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering’s about.
Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs