Fork me on GitHub

Announcement

The oneye project has been discontinued. You might not expect further fixes and support from us. All community related systems are set to read-only mode. Though feel free to download and use oneye as-is or even fork it over at GitHub.

#1 2014-08-12 17:05:51

sazearte
Member
From: France
Registered: 2013-10-23
Posts: 234

refresh icons and window size

I finished my application, it refreshes the positions of icons and the size of the window if the user uses a device with a larger or smaller screen.

app.eyecode

<?php

function window_run($params=null) {

	$path = um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/window/resize.xml';
	$browserwidth= $_SESSION['SCREEN']['eyeApps']['width'];
	$browserheight= $_SESSION['SCREEN']['eyeApps']['height'];
	if (file_exists($path)) { 
		$parametres = simplexml_load_file($path);
		$datawidth = $parametres->sizewidth[0];
		$dataheight = $parametres->sizeheight[0];
		if ($datawidth/2>$browserwidth || $datawidth*2<$browserwidth) {
			refresh($path);
			create($browserwidth, $browserheight, $path);
		}
		if ($dataheight/2>$browserheight || $dataheight*2<$browserheight) {
			refresh($path);
			create($browserwidth, $browserheight, $path);
		}

	} else {
	create($browserwidth, $browserheight, $path);
	}
}

function create($browserwidth, $browserheight, $path) {
		service('vfs','real_delete',array($path));
		$folder = 'window';
		$file = 'resize.xml';

		$data = array(
			'resize' => array(array(
			'sizewidth' => array($browserwidth),
			'sizeheight' => array($browserheight)
			))
		);
		eyeXML('setXMLconfig', array($folder, $file, $data));
	}

function refresh($path) {
	$files = vfs('real_getDirContent', array($path, '*.xml'));
	
	foreach ($files as $file) {
		if (strtolower(basename($file)) !== 'eyex.xml') { // utf8
			vfs('real_delete', array($file));
		}
	}
	
	global $currentUser;
	$pathicons = um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/eyeDesk/icons.xml';
	vfs('real_delete',array($pathicons));
	$desk_checknum = proc('findChecknumByName',array('eyeDesk'));
	if ($desk_checknum) {
		eyex('rawjs',array('js' => 'sendMsg(' . $desk_checknum . ',"OpenPath","");'));
	}
}

function window_end($params=null) {
	reqLib('eyeWidgets','unserialize');
}
?>
 

events.eyecode

<?php
/*                            eyeOS project
                     Internet Based Operating System
                               Version 1.0
                     www.eyeOS.org - www.eyeOS.info
       -----------------------------------------------------------------
                                 eyeOS Team
                        http://www.eyeos.org/whoarewe
       -----------------------------------------------------------------
          eyeOS is released under the GNU General Public License - GPL
               provided with this release in license.txt
                   or via web at www.gnu.org/licenses/gpl.txt

                Copyright 2005-2007 eyeOS Team (team@eyeos.org)

          To help continued development please consider a donation at
            http://www.eyeos.org/donations         
*/

function window_on_Message($params="") {
	reqLib('eyeWidgets','updateContent',$params);
}

function window_on_Resize($params=null) {
	$width = $params['arg'][0];
	$height = $params['arg'][1];
	$width = intval($width);
	$height = intval($height);
	$GLOBALS['GmailFrame']->setWidth($width-10);
	$GLOBALS['GmailFrame']->setHeight($height-28);
}

function window_on_Close(){
	global $myPid;
	service('proc','close',array($myPid));
}

?>

We need to create a "window" folder in the app directory.
It should also automatically start the session.

Offline

#2 2014-08-17 12:27:50

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: refresh icons and window size

You can create an installable eyePackage quite easily by creating a tar.gz file and renaming ist extension to eyepackage. The folder structure inside that package begins with the "apps" folder. You should know the rest.

Just as an example, here's your application, packaged as eyePackage: http://projects.lars-sh.de/window.eyepackage

Finally you can add that application via System Preferences to the list of auto run applications.

PS: Better use some pseudo private function names instead of short ones like "refresh", that'd be like "private_window_refresh" wink .


Best regards,
Lars Knickrehm

The oneye project.

Offline

Board footer

Powered by FluxBB