mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
remember window sizes, fix popup bug, smart window start position
This commit is contained in:
parent
210e5621be
commit
58b5f14d43
@ -13,6 +13,7 @@ body, html{
|
||||
left: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding-top: 2px;
|
||||
background-color: #C6C6C6;
|
||||
font-family: Verdana, Arial, sans-serif, Helvetica; font-style: normal; text-decoration: none; color: #000000;
|
||||
font-size: 11px;
|
||||
@ -446,7 +447,7 @@ a.textSidebox
|
||||
width:99%;
|
||||
}
|
||||
|
||||
.toolbar
|
||||
.idots2toolbar
|
||||
{
|
||||
background-color: #e5e5e5;
|
||||
display: block;
|
||||
@ -459,7 +460,7 @@ a.textSidebox
|
||||
z-index: 49;
|
||||
border-bottom: 1px solid #9c9c9c;
|
||||
}
|
||||
.toolbar a
|
||||
.idots2toolbar a
|
||||
{
|
||||
background-color: #e5e5e5;
|
||||
display: block;
|
||||
|
@ -1,9 +1,3 @@
|
||||
// If x-desktop is not loaded go somewhere else
|
||||
if(!(window.parent && window.parent.xDT))
|
||||
{
|
||||
document.location = '../index.php?cd=yes';
|
||||
}
|
||||
|
||||
var curmenu;
|
||||
/*
|
||||
* document.onclick
|
||||
|
@ -83,14 +83,28 @@ function getWindowHeight() {
|
||||
|
||||
function openX(idotsname, url)
|
||||
{
|
||||
if(scrHeight =="")
|
||||
{
|
||||
scrHeight = 400;
|
||||
}
|
||||
if(scrWidth == "")
|
||||
{
|
||||
scrWidth = 600;
|
||||
scrWidth2 = 600;
|
||||
}
|
||||
else {
|
||||
scrWidth2 = scrWidth;
|
||||
}
|
||||
if(scrHeight =="")
|
||||
{
|
||||
scrHeight2 = 400;
|
||||
}
|
||||
else {
|
||||
scrHeight2 = scrHeight;
|
||||
}
|
||||
for(i = 0; i < aTitle.length; i++)
|
||||
{
|
||||
if(aTitle[i] != "" && aTitle[i] == idotsname) {
|
||||
scrWidth2 = aWidth[i];
|
||||
scrHeight2 = aHeight[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(document.getElementById('context'))
|
||||
{
|
||||
@ -101,13 +115,65 @@ function openX(idotsname, url)
|
||||
{
|
||||
document.getElementById('launchmenu').style.display = "none";
|
||||
}
|
||||
|
||||
|
||||
startX = Math.round((getWindowWidth() / 2) - (scrWidth2 / 2));
|
||||
startY = Math.round((getWindowHeight() / 2) - (scrHeight2 / 2));
|
||||
|
||||
|
||||
idotsW = "xD" + new Date().getUTCMilliseconds();
|
||||
xDT.addWindow(idotsW, idotsname, scrWidth, scrHeight, 'center', 'IDOTS2');
|
||||
for (var i=0;i<=xDT.maxWindow();i++) {
|
||||
winName = xDT.wName(i);
|
||||
|
||||
if (typeof(winName) != "undefined" && i >= xDTwin.syswin && winName != "")
|
||||
{
|
||||
oldPos = xDT.window.pos(winName);
|
||||
posArray = oldPos.split("," );
|
||||
if(posArray[0] == startX)
|
||||
startX+=20;
|
||||
|
||||
if(posArray[1] == startY)
|
||||
startY+=20;
|
||||
|
||||
if(Math.round(startX)+Math.round(scrWidth2) > getWindowWidth() && Math.round(startY)+Math.round(scrHeight2) > getWindowHeight())
|
||||
{
|
||||
startX = 0;
|
||||
startY = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xDT.addWindow(idotsW, idotsname, scrWidth2, scrHeight2, '' + startX + ',' + startY, 'IDOTS2');
|
||||
xDT.url(idotsW, url);
|
||||
xDT.show(idotsW);
|
||||
xDT.window.onClose(idotsW, "saveSize('" + idotsW + "');");
|
||||
correctPNG();
|
||||
}
|
||||
function saveSize(idotsName) {
|
||||
title = xDT.prop(idotsName, 'wTitle');
|
||||
w = xDT.prop(idotsName, 'wWidth');
|
||||
h = xDT.prop(idotsName, 'wHeight');
|
||||
|
||||
url = strXmlUrl + "/write_size.php?title=" + title + "&w=" + w + "&h=" + h;
|
||||
var found = false;
|
||||
for(i = 0; i < aTitle.length; i++)
|
||||
{
|
||||
if(aTitle[i] != "" && aTitle[i] == title) {
|
||||
aWidth[i] = w;
|
||||
aHeight[i] = h;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
aTitle[aTitle.length] = title;
|
||||
aWidth[aWidth.length] = w;
|
||||
aHeight[aHeight.length] = h;
|
||||
}
|
||||
|
||||
loadXMLDoc(url);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function findPosX(obj)
|
||||
{
|
||||
|
@ -1,13 +1,22 @@
|
||||
var LastClick;
|
||||
var strXmlUrl;
|
||||
document.onselectstart = function()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function showShortcuts(appTitles, appUrls, appImgs, appTop, appLeft, appType, appName, xmlUrl)
|
||||
var aTitle;
|
||||
var aWidth;
|
||||
var aHeight;
|
||||
|
||||
function initSizes(titles, w, h) {
|
||||
aTitle = titles.split(',');
|
||||
aWidth = w.split(',');
|
||||
aHeight = h.split(',');
|
||||
}
|
||||
|
||||
|
||||
function showShortcuts(appTitles, appUrls, appImgs, appTop, appLeft, appType, appName)
|
||||
{
|
||||
strXmlUrl = xmlUrl;
|
||||
var aTitle = appTitles.split(',');
|
||||
var aUrl = appUrls.split(',');
|
||||
var aImg = appImgs.split(',');
|
||||
@ -238,7 +247,7 @@ function remShort(id)
|
||||
id = mObj.parentNode.id;
|
||||
}
|
||||
|
||||
strXmlRemUrl2 = strXmlRemUrl + "?id=";
|
||||
strXmlRemUrl2 = strXmlUrl + "remove_shortcut.php?id=";
|
||||
strXmlRemUrl2 = strXmlRemUrl2 + id;
|
||||
if (window.XMLHttpRequest)
|
||||
{
|
||||
@ -298,12 +307,7 @@ function mouseUp(id,e)
|
||||
y2 = findPosY(mObj);
|
||||
x2 = findPosX(mObj);
|
||||
mObj.onmousemove = "";
|
||||
strXmlUrl2 = strXmlUrl + "?id=";
|
||||
strXmlUrl2 = strXmlUrl2 + id;
|
||||
strXmlUrl2 = strXmlUrl2 + "&top=";
|
||||
strXmlUrl2 = strXmlUrl2 + y2;
|
||||
strXmlUrl2 = strXmlUrl2 + "&left=";
|
||||
strXmlUrl2 = strXmlUrl2 + x2;
|
||||
strXmlUrl2 = strXmlUrl + "write_shortcut_setting.php?id=" + id + "&top=" + y2 + "&left=" + x2;
|
||||
createPos(mObj, x2,y2);
|
||||
if (window.XMLHttpRequest)
|
||||
{
|
||||
@ -346,7 +350,7 @@ document.oncontextmenu = function(e)
|
||||
}
|
||||
if (source.className != "shortcut" && source.parentNode.className != "shortcut")
|
||||
{
|
||||
createContext(true, addShorcutUrl,e.clientX,e.clientY);
|
||||
createContext(true, strXmlUrl + "/add_shortcut.php",e.clientY);
|
||||
}
|
||||
e.cancelBubble = true;
|
||||
if(e.stopPropagation)
|
||||
|
@ -117,37 +117,56 @@
|
||||
$var["dIcons"] = "";
|
||||
$var["urlpref"] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
|
||||
$first = true;
|
||||
$first2 = true;
|
||||
if($GLOBALS['phpgw_info']['user']['preferences']['phpgwapi'])
|
||||
{
|
||||
foreach($GLOBALS['phpgw_info']['user']['preferences']['phpgwapi'] as $shortcut => $shortcut_data)
|
||||
{
|
||||
if($first)
|
||||
{
|
||||
$var["appTitles"] = $GLOBALS['phpgw_info']['user']['apps'][$shortcut_data['title']]['title'];
|
||||
// $shortcut_data['title'];
|
||||
$var["appImgs"] = $shortcut_data['icon'];
|
||||
$var["appUrls"] = $shortcut_data['link'];
|
||||
$var["appTop"] = $shortcut_data['top'];
|
||||
$var["appLeft"] = $shortcut_data['left'];
|
||||
$var["appType"] = $shortcut_data['type'];
|
||||
$var["appName"] = $shortcut_data['title'];
|
||||
$first= false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strpos($shortcut, "size_") === false) {
|
||||
if($first)
|
||||
{
|
||||
$var["appTitles"] = $GLOBALS['phpgw_info']['user']['apps'][$shortcut_data['title']]['title'];
|
||||
|
||||
$var["appTitles"] .=','. $GLOBALS['phpgw_info']['user']['apps'][$shortcut_data['title']]['title'];
|
||||
$var["appImgs"] .=','. $shortcut_data['icon'];
|
||||
$var["appUrls"] .=','. $shortcut_data['link'];
|
||||
$var["appTop"] .=','. $shortcut_data['top'];
|
||||
$var["appLeft"] .=','. $shortcut_data['left'];
|
||||
$var["appType"] .=','. $shortcut_data['type'];
|
||||
$var["appName"] .=','. $shortcut_data['title'];
|
||||
|
||||
}
|
||||
$var["appImgs"] = $shortcut_data['icon'];
|
||||
$var["appUrls"] = $shortcut_data['link'];
|
||||
$var["appTop"] = $shortcut_data['top'];
|
||||
$var["appLeft"] = $shortcut_data['left'];
|
||||
$var["appType"] = $shortcut_data['type'];
|
||||
$var["appName"] = $shortcut_data['title'];
|
||||
$first= false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$var["appTitles"] .=','. $GLOBALS['phpgw_info']['user']['apps'][$shortcut_data['title']]['title'];
|
||||
$var["appImgs"] .=','. $shortcut_data['icon'];
|
||||
$var["appUrls"] .=','. $shortcut_data['link'];
|
||||
$var["appTop"] .=','. $shortcut_data['top'];
|
||||
$var["appLeft"] .=','. $shortcut_data['left'];
|
||||
$var["appType"] .=','. $shortcut_data['type'];
|
||||
$var["appName"] .=','. $shortcut_data['title'];
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($first2)
|
||||
{
|
||||
$var["sizeTitles"] = $GLOBALS['phpgw_info']['user']['apps'][$shortcut_data['name']]['title'];
|
||||
$var["sizeWidth"] = $shortcut_data['width'];
|
||||
$var["sizeHeight"] = $shortcut_data['height'];
|
||||
$first2= false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$var["sizeTitles"] .=','. $GLOBALS['phpgw_info']['user']['apps'][$shortcut_data['name']]['title'];
|
||||
$var["sizeWidth"] .=','. $shortcut_data['width'];
|
||||
$var["sizeHeight"] .=','. $shortcut_data['height'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$var["back_shortcut"] = $GLOBALS['phpgw_info']['user']['preferences']['common']['back_icons'];
|
||||
|
||||
@ -171,10 +190,8 @@
|
||||
|
||||
|
||||
$var["appTitles"] = addslashes($var["appTitles"]);
|
||||
$var["xmlUrl"] = $template_dir."/write_shortcut_setting.php";
|
||||
$var["strXmlRemUrl"] = $template_dir."/remove_shortcut.php";
|
||||
$var["addShorcutUrl"] = $template_dir . '/add_shortcut.php';
|
||||
//$var["addShorcutUrl"] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/add_shortcut.php';
|
||||
$var["strXmlUrl"] = "phpgwapi/templates/" . $GLOBALS['phpgw_info']['server']['template_set'];
|
||||
|
||||
if(empty($GLOBALS['phpgw_info']['user']['preferences']['common']['scrWidth']))
|
||||
{
|
||||
$var["scrWidth"] = "600";
|
||||
|
@ -7,8 +7,7 @@ var clock_show = '{clock_show}';
|
||||
var url_pref = '{urlpref}';
|
||||
var default_app = '{default_app}';
|
||||
var default_title = '{default_title}';
|
||||
var addShorcutUrl = '{addShorcutUrl}';
|
||||
var strXmlRemUrl = '{strXmlRemUrl}';
|
||||
var strXmlUrl = '{strXmlUrl}';
|
||||
var scrWidth = '{scrWidth}';
|
||||
var scrHeight = '{scrHeight}';
|
||||
var titleAdd = '{titleAdd}';
|
||||
@ -19,7 +18,9 @@ var programs = '{programs}';
|
||||
var back_shortcut = '{back_shortcut}';
|
||||
var color_shortcut = '{color_shortcut}';
|
||||
var color_text_sc = '{color_text_sc}';
|
||||
showShortcuts('{appTitles}', '{appUrls}', '{appImgs}','{appTop}','{appLeft}','{appType}','{appName}','{xmlUrl}');
|
||||
showShortcuts('{appTitles}', '{appUrls}', '{appImgs}','{appTop}','{appLeft}','{appType}','{appName}','{strXmlUrl}');
|
||||
initSizes('{sizeTitles}', '{sizeWidth}', '{sizeHeight}');
|
||||
|
||||
|
||||
function start() {
|
||||
xDT.resPath('{template_dir}/js/x-desktop/xDT/');
|
||||
@ -132,7 +133,7 @@ function start() {
|
||||
<!-- BEGIN begin_toolbar -->
|
||||
</ul>
|
||||
|
||||
<div class="toolbar">
|
||||
<div class="idots2toolbar">
|
||||
|
||||
<!-- END begin_toolbar -->
|
||||
|
||||
|
53
phpgwapi/templates/idots2/write_size.php
Executable file
53
phpgwapi/templates/idots2/write_size.php
Executable file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare *
|
||||
* http://www.egroupware.org *
|
||||
* This file is written by Edo van Bruggen <edovanbruggen@raketnet.nl> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
|
||||
|
||||
$phpgw_info = array();
|
||||
$GLOBALS['phpgw_info']['flags'] = array(
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'disable_Template_class' => True,
|
||||
'currentapp' => 'notifywindow'
|
||||
);
|
||||
include('../../../header.inc.php');
|
||||
header("Content-type: text/xml");
|
||||
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
|
||||
header( "Cache-Control: no-cache, must-revalidate" );
|
||||
header( "Pragma: no-cache" );
|
||||
echo '<?xml version="1.0" encoding="UTF-8"
|
||||
standalone="yes"?>';
|
||||
echo "\r\n<response>\r\n";
|
||||
|
||||
|
||||
$title = $_GET["title"];
|
||||
$width = $_GET["w"];
|
||||
$height= $_GET["h"];
|
||||
echo $title." ".$width." ".$height;
|
||||
$GLOBALS['phpgw']->preferences->read_repository();
|
||||
|
||||
foreach($GLOBALS['phpgw_info']['user']['apps'] as $name => $data)
|
||||
{
|
||||
if($data['title'] == $title) {
|
||||
$size['name'] = $name;
|
||||
$size['width'] = $width;
|
||||
$size['height'] = $height;
|
||||
$GLOBALS['phpgw']->preferences->change('phpgwapi','size_'.$name,$size);
|
||||
$GLOBALS['phpgw']->preferences->save_repository(True);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
echo "</response>";
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user