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-06-28 10:23:07

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

Do not save the window positions

How not to save the positions of the windows default ?

eyex.xml is not in system/conf/skel/conf/exex

Offline

#2 2014-07-22 15:43:17

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

Re: Do not save the window positions

You can disable saving window positions in System preferences -> Desktop -> Settings.


Best regards,
Lars Knickrehm

The oneye project.

Offline

#3 2014-07-24 11:00:43

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

Re: Do not save the window positions

I can not get a posted php code, I have a 403 error!
Well I used the code tag
I'm trying to make a script that will re-initialize the potion of windows if the screen size changes.
I intend to store the value in a cookie afterwards.

Last edited by sazearte (2014-07-24 11:03:56)

Offline

#4 2014-07-24 11:18:56

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

Re: Do not save the window positions

Sorry, I don't understand.

When do you get a 403 error?
Where do you want to use a "code" tag and what kind of "tag" do you use?
What value do you like to store in the cookies?

To update the window positions when changing the browser's screen size, I recommend you to create a JavaScript function, which listens to the window's resize event and then checks the window's positions.
The idea to reposition windows, which might be outside of the reachable area seems to be quite a nice one.

PS: Did you read my comment at https://github.com/sazearte/oneye/commi … nt-6962920 ?


Best regards,
Lars Knickrehm

The oneye project.

Offline

#5 2014-07-24 15:53:58

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

Re: Do not save the window positions

Yes, i read your comment.
I can not have posted in this forum my php code, I have a 403 error

Offline

#6 2014-07-24 17:54:15

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

Re: Do not save the window positions

Sorry, you need to use a pastebin service for such code. Just paste it at http://pastebin.com/ and insert the link here.


Best regards,
Lars Knickrehm

The oneye project.

Offline

#7 2014-07-24 19:09:36

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

Re: Do not save the window positions

I'm trying to make a script that will re-initialize the potion of windows if the screen size changes.
I intend to store the value in a cookie afterwards.

http://pastebin.com/aNTA5v3N


If the user uses a different terminal, the windows will be reinitialized.
In which file should I put this code?

Last edited by sazearte (2014-07-24 19:14:58)

Offline

#8 2014-07-25 10:58:26

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

Re: Do not save the window positions

I have a problem when I want to declare a directory
Why its not working?

		$path = '/' . CONF_USER_DIR . '/eyex/';
	$files = vfs('real_getDirContent',array($path,'*.xml'));
	foreach ($files as $file) {
		if ( strtolower(basename($file)) !== 'eyex.xml') {
			vfs('real_delete',array($file));
		}
	} 

I want to remove all xml files contained in eyeX except exeX.xml

Last edited by sazearte (2014-07-25 11:11:08)

Offline

#9 2014-07-28 00:47:36

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

Re: Do not save the window positions

There's a wrong path. Here's the corrected (but untested!) code:

	$path = um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/eyex/';
	$files = vfs('real_getDirContent', array($path, '*.xml'));
	
	foreach ($files as $file) {
		if (strtolower(basename($file)) !== 'eyex.xml') { // utf8
			vfs('real_delete', array($file));
		}
	}

Even though this just removes all saved window positions. This does not automatically refresh the window positions in the browser!

Additionally you could use an oneye feature to automatically remove those files whenever the user resizes the browser window:
1. Put the following code in app.eyecode:

function APPNAME_run($params = array()) {
	addListenerServiceCall('onResizedBrowser', 'eyex', 'resizedBrowser');
}

2. Place the following code in com.eyecode:

function APPNAME_com_onResizedBrowser($params = array()) {
	$path = um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/eyex/';
	$files = vfs('real_getDirContent', array($path, '*.xml'));
	
	foreach ($files as $file) {
		if (strtolower(basename($file)) !== 'eyex.xml') { // utf8
			vfs('real_delete', array($file));
		}
	}
}

Best regards,
Lars Knickrehm

The oneye project.

Offline

#10 2014-07-28 09:07:41

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

Re: Do not save the window positions

I thought back then the size of the browser in an xml file, then if the size was not the same I change the value of the xml file and removes any xml file from eyeX

Offline

#11 2014-08-10 10:46:51

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

Re: Do not save the window positions

I have a question:

How to create a folder?

I want to create a file:

$path = um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/';
$path .= 'myfolder/myfile.xml';
service('vfs','real_create',array($path));

and Why this code does not work?

$myXml ="
<eyeUser>
<username> main </username>
<createDate> 20/02/2007 </createDate>
</eyeUser>";

$myArray=redLib('eyeXML','xml2array',array($myXml));

Last edited by sazearte (2014-08-10 11:02:41)

Offline

#12 2014-08-10 11:19:09

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

Re: Do not save the window positions

At first I recommend you to Change the EYEOS_DEBUG_MODE in "system/conf/system.xml" to "2". Now you will get those nice PHP Warnings, Notices etc. Use Firebug or other web debug software to check the results of your requests. It's not recommended to be activated in production use.

To create a folder you can use the function "real_mkDir".

You do not need to use those "service" and "reqLib" (with "q", not "d"!) functions: vfs('real_create', array($path)) is all you need.

To read and write user configuration files it's highly recommended to use the following code. It creates all required folders etc.

eyeXML('setXMLconfig', array('myfolder', 'myfile'));

Edit: Added missing closing parathesis.

Last edited by lars-sh (2014-08-10 11:20:01)


Best regards,
Lars Knickrehm

The oneye project.

Offline

#13 2014-08-10 12:01:31

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

Re: Do not save the window positions

Here is my code to create my file :

$path = um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/';
$path .= 'resize';
service('vfs','real_mkDir',array($path));
$path .= '/rezise.xml';
service('vfs','real_create',array($path));

$myfolder = um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/rezise/';
$myfile .= um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/rezise/rezise.xml';
eyeXML('setXMLconfig', array('$myfolder', '$myfile'));

is there any documentation eyeXML ?
the developer-manual does not help me much, and I have found nothing in the wiki.

I want to create an XML file that contains the size of the browser window.
for example :
<resize>
<size> 500 </size>
</resize>

If this file exists, then I look at the value, if it is different, I delete the files in the folder eyeX.

Last edited by sazearte (2014-08-10 12:03:10)

Offline

#14 2014-08-10 15:34:25

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

Re: Do not save the window positions

  • There's no new developer documentation, sorry. The one we provide is quite outdated. Sadly!

  • When using "setXMLconfig" you do not need to create that folder yourself.

  • Do not pass the full folder and file path. Instead you just need to pass the app's name and the xml file name.

  • When using single quotes, variables are not replaced. The clean way is to use variables directly and eventually concatenate manually instead of using them in string literals!

$app = 'folder';
$file = 'resize.xml';

$data = array(
	'resize' => array(array(
		'size' => array('500')
	))
);

eyeXML('setXMLconfig', array($folder, $file, $data));

Best regards,
Lars Knickrehm

The oneye project.

Offline

#15 2014-08-10 15:51:25

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

Re: Do not save the window positions

Okay, thank you,

it there's an error in first line
$app = 'folder';
$folder = 'name_of_my_app';

What are the commands to read or delete the value of 'size'?

Last edited by sazearte (2014-08-10 15:52:36)

Offline

#16 2014-08-10 15:52:17

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

Re: Do not save the window positions

Sorry, I don't get it.


Best regards,
Lars Knickrehm

The oneye project.

Offline

#17 2014-08-10 15:53:38

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

Re: Do not save the window positions

I want to put the 500 (the value of 'size') in a variable.

Last edited by sazearte (2014-08-10 15:54:07)

Offline

#18 2014-08-10 15:55:54

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

Re: Do not save the window positions

When reading:

$data = eyeXML('getXMLconfig', array($folder, $file));

if (is_array($data)) {
	$resize = $data['resize'][0]['size'][0];
}

Best regards,
Lars Knickrehm

The oneye project.

Offline

#19 2014-08-10 16:05:42

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

Re: Do not save the window positions

I tried this:
$var= $myarray['rezise'][0]['size'][0];

Ok thank you very much !

Offline

#20 2014-08-10 16:17:02

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

Re: Do not save the window positions

Excuse me, this is not what I wanted to do:
I want to read the content value in the xml file, not that of the $data

Offline

#21 2014-08-10 18:47:52

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

Re: Do not save the window positions

I use php to read xml file.

	$path = um('getCurrentUserDir') . '/' . CONF_USER_DIR . '/window/resize.xml';
	$browserwidth= $_SESSION['SCREEN']['eyeApps']['width'];

	if (file_exists($path)) { 
		$parametres = simplexml_load_file($path);
		$site_root = $parametres->size[0];
		service('eyex','messageBox',array('content'=> $site_root));

	} else { 
		$folder = 'window';
		$file = 'resize.xml';

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

it works great!

Last edited by sazearte (2014-08-10 18:49:07)

Offline

#22 2014-08-12 17:07:01

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

Re: Do not save the window positions

Offline

Board footer

Powered by FluxBB