1

(90 replies, posted in Third party plugins)

well, what a foolish question... hmm
thanks for your input, mentor. works like a charm now.
bambi

2

(90 replies, posted in Third party plugins)

hi

is there a possibility to give a form input field focus within a modal window?

my form:

$output = '
    <div class="modal_content_container">
      <form name="f_register" id="f_register" method="post" action="">
        <label for="register_email">Email</label>
        <input id="register_email" type="text" name="register_email" />
        <input id="register_submit" type="submit" name="register_submit" value="Submit" onclick="xajax_ModalLogin('2', xajax.getFormValues('f_register')); return false;" />
      </form>
    </div>';

$objResponse->clsmodalWindow->addWindow( $output, array('color' => '#000000', 'opacity'    => 60, 'frame' => 'parent', 'bOverlay' => true));

i've tried:

$objResponse->script("setTimeout(xajax.$('register_email').focus, 1);");

-> i get the following error in firebug:
uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0" data: no]

$objResponse->script('document.getElementById("register_email").focus');

-> no error but no focus at all

$objResponse->script("xajax.$('register_email').focus");

-> no error but no focus at all

any help would be appreciated!! many thanks in advance
bambi

3

(90 replies, posted in Third party plugins)

works great! many thanks, metric!

4

(90 replies, posted in Third party plugins)

would be great, thanks mentor!

5

(90 replies, posted in Third party plugins)

hi mentor

here we go: http://www.zunzun.ch/xajax_test/

this is the unchanged modal window plugin example with xajax 0.5.

to reproduce the error:
- click on "Open in Document with Document function."
- select "close window" from the dropdown
- click on "submit formdata"

-> nothing happens!

many thanks for your help :-)

bambi

6

(90 replies, posted in Third party plugins)

hi! :-)

i've updated xajax to 0.5 final (standard) and to the actual modal window plugin (modalWindow_0.9.0_b1).
unfortunately, the code "$objResponse->clsmodalWindow->closeWindow();" doesn't work anymore.

the modal window plugin script comes with an example (index.php). when i select "close window" and submit the form, i get the following error:

xajax debug output
Fri Apr 10 2009 10:36:09 GMT+0200

DONE [1049ms]

Fri Apr 10 2009 10:36:09 GMT+0200

ERROR: ExecuteCommand (#0, ):
TypeError: parent.frames[args] is undefined

Fri Apr 10 2009 10:36:09 GMT+0200

RECEIVED [status: 200, size: 142 bytes, time: 1043ms]:
<?xml version="1.0" encoding="utf-8" ?>
<xjx>
<cmd cmd="mw:cw" plg="clsmodalWindow">
<xjxobj>
<e><k>N0</k><v>*</v></e>
</xjxobj>
</cmd>
</xjx>

Fri Apr 10 2009 10:36:08 GMT+0200

SENT [201 bytes]

Fri Apr 10 2009 10:36:08 GMT+0200

SENDING REQUEST

Fri Apr 10 2009 10:36:08 GMT+0200

CALLING:
xjxfun: actionClose
URI:
http://localhost/Web/modalWindow/

Fri Apr 10 2009 10:36:08 GMT+0200

POST: xjxfun=actionClose
&xjxr=1239352568549
&xjxargs[]=
<xjxobj>
<e><k>windowoption</k><v>S2</v></e>
<e><k>testinput</k><v>S</v></e>
</xjxobj>

Fri Apr 10 2009 10:36:08 GMT+0200

PREPARING REQUEST

Fri Apr 10 2009 10:36:08 GMT+0200

OBJECT TO XML: size = 2

Fri Apr 10 2009 10:36:08 GMT+0200

OBJECT TO XML: maxDepth = 20, maxSize = 2000

Fri Apr 10 2009 10:36:08 GMT+0200

PROCESSING PARAMETERS [1]

Fri Apr 10 2009 10:36:08 GMT+0200

INITIALIZING REQUEST

Fri Apr 10 2009 10:36:08 GMT+0200

STARTING XAJAX REQUEST


many thanks in advance for your help and best regards from switzerland smile
bambi

Hi

I have fogotten to post the really simple solution smile

<a href="http://www.xajaxproject.org" target="_blank" onclick="xajax_CountExternalLink('555');">Xajax</a>

Best regards
Bambi

You are right, q_no. smile

But the new window is blocked by the browser as a popup, if I use window.open ($objResponse->call('window.open', $link, '_blank'); ). And this is a no go... sad

Any other ideas?

Many thanks
Bambi

Hi xajax community smile

I would like to count the clicks on external links and save this information in a database before the external site is shown.

As long as the external website can be loaded in the same browser window, I simply can insert this little xajax function:

function CountExternalLink($id, $link)
{
  // increment count
  // ...
 
  // Redirect to external website
  $objResponse = new xajaxResponse();
  $objResponse->redirect($link);
  return $objResponse;
}

(Link: <a href="javascript:void(0)" onclick="xajax_CountExternalLink('555', 'http://www.xajaxproject.org');">Xajax</a>)


My problem is, that all external links should load in a new browser tab or browser window.

Is there a simple way to open a certain URL in a new browser tab/window with xajax?

Many thanks in advance for any help!

Bambi

I can't wait for the next release! :-)
Thank you!!!

Thanks, Joe. It would be wonderful, if you could implement this optional parameter in a coming xajax version.

Bambi

Hi

I use the function includeCSS() to include a stylesheet on the fly:

$objResponse->includeCSS('screen.css');

This works fine.

But now I'm searching for a solution to include a stylesheet only for the print media type, resulting in the code:
<link rel="stylesheet" type="text/css" media="print" href="print.css" />

As it is not possible to add a parameter for the media type to includeCSS(), I've tried to make a workaround with includeScript():
$objResponse->includeScript('script.js');


script.js:

var cssLocation = "print.css";
function getCss(){
    // IE
  if(document.createStyleSheet) document.createStyleSheet(cssLocation);
    // other
  else{
    var objStyle = document.createElement("style");
    var objText = document.createTextNode("@import url("+cssLocation+") screen;");
    objStyle.appendChild(objText);
    document.getElementsByTagName("body")[0].appendChild(objStyle);
  }
}

window.onload=getCss();

But unfortunately this is not working, too.

Many thanks in advance for any help!
Bambi

hi xajax community

i have xajax running with the modalWindow plugin (http://community.xajaxproject.org/viewtopic.php?id=6131).

today i got a mail from a user that he gets the following error messages:

- could not create xajax.ext.namespace
- could not create xajax.ext.modalWindow.namespace

unfortunately i do not know which browser he uses and after which action the error messages appear.

has anybody any idea what i have to change to fix this problem?

many thanks in advance!
bambi

Hi holtkamp

Just disable the option "Break on All Errors" within the Script tag in Firebug. :-)

Good luck, Bambi

15

(90 replies, posted in Third party plugins)

Hi Oliver

Sorry that I have to come back with another question... It is about the positioning of the modal window DIV...

I will make an example, because this is a little bit complicated to describe...

Let's assume, that the viewport has a width of 1600px and a height of 800px. The displayed window BEFORE I click on a link to open the modal window has a height of 1000px, so it has a vertical scrollbar. The DIV in the modal window itself has a fixed width of 500px and flexible height which depends on the content. Let's assume that it can have a height of 500px to 2000px.

The problem is, that if the height of the modal window DIV (e.g. 1500px) is larger than the height of the original window displayed in the background (e.g. 1000px), the browser-window gets a height of 1500px (that's correct), but the half-transparent overlay is not enlarged so that the bottom part of the original window remains white (as white is my background-color). Is there any possibility to prevent this misrepresentation?

I hope that you are able to follow my description... :-)

As a work-around, I have written a little JS-Function which I call directly before returning the response-object:

function wpSetModalBackgroundHeight (modal_divname)
{
  var height_modal = document.getElementById(modal_divname).offsetHeight;
  var height_target = height_modal + 100;
  var height_actual_px = document.getElementById('lb_layer1').style.height;
  var height_actual = height_actual_px.substring(0,height_actual_px.length-2); // remove "px"
 
  if (height_actual < height_target)
  {
    var height_target_px = height_target + "px";
    document.getElementById('lb_layer1').style.height = height_target_px;
  }
}

This seems to work fine, but I can't imagine that this is the best solution...?

What do you think?


Many thanks!
Michelle

Hi Joe

Thank you for your reply! I think I've understood now... big_smile
But it does not work anyway... I've sent you an email with the link to the website (I shouldn't publish it...).

Many thanks
Bambi

Hi CtC

Many thanks for your reply.
I added to every onsubmit, onchange, etc. "return false;", but now it's worse than before... I do not get the yellow marked line again (edit -- I still get this yellow marked line sometimes -- end edit), but the undefined-function-error comes up every time I click on a link with onchange-event - except for the very first time I click on such a link, after deleting browser-cache and reloading website...

Well... help! smile

Thanks! Bambi

p.s. It seems that IE7 hasn't this problem - all works fine so far...?

Hi

When I browse to my website and click on a link which has a xajax-function, all works fine and Firebug is happy (as I am...).

But sometimes, when I click through the website and then click on the same link as the above mentioned, Firebug marks the first line of the generated JavaScript-Code in yellow:

try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };

Unfortunately I do not understand, what this line is doing and why it is marked in yellow sometimes.
If this warning is displayed, this results in the error "xajax_Functionname is not defined" and the xajax-function is not executed.

Do you have any idea, why I get this error? What can I change?

Many thanks in advance and greetings
bambi

Hi Joe

Many thanks for your answer! I have tested this with two links (I haven't more yet) and it seems to work! :-) Thank you so much!

But something seems to be wrong with my little application and the xajax implementation... As I have described in my previous posting, I sometimes get back the Firebug error "xajax_FUNCTIONNAME is not defined". And in addition, Firebug sometimes marks the following line (the first line of the generated JavaScript) in yellow:

try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };

I may have misunderstood an important point concerning the configuration of xajax...? As above-mentioned, I have an index.php file where I register the functions and include the requested content-files. Here comes a simplified version of my index.php:

<?php
ini_set('session.use_trans_sid', 1);
define('PFAD_PHP', './php/');
@session_start();

require (PFAD_PHP . 'cookie_check.php');  // checks whether cookies are enabled ore not
require (PFAD_PHP . 'config.php');        // define some constants
require (PFAD_PHP . 'functions.php');     // collection of functions
require (PFAD_PHP . 'code_setup.php');    // DB connection, get value of $status, check whether user is logged in or not, set some variables...

// Ajax Setup
require_once (PFAD_XAJAX_CORE . 'xajax.inc.php');

$xajax = new xajax();

require_once (PFAD_XAJAX_CORE . 'xajaxPlugin.inc.php');
require_once (PFAD_XAJAX_CORE . 'xajaxPluginManager.inc.php');
require_once (PFAD_XAJAX_PLUGINS . 'modalWindow/modalWindow.inc.php');
require_once (PFAD_PHP . 'functions_xajax.php');

if ($_SESSION['cookie_check'] == false)
{
  $requestURI = PFAD_BASIS . '?' . SID;
  $xajax->configure('requestURI', $requestURI);
}

$xajax->configure('javascript URI', 'xajax/');

$xajax->registerFunction('wpModalLogin');
$xajax->registerFunction('wpModalLoginSubmit');
$xajax->registerFunction('wpModalRegister');
$xajax->registerFunction('wpModalRegisterSubmit');
$xajax->registerFunction('wpLogout');

$xajax->processRequest();

// status

switch ($status)
{
    case 1:
      require (PFAD_PHP . 'file1.php');
      break;
    
    case 2:
    require (PFAD_PHP . 'file2.php');
    break;
    
  case 3:
    require (PFAD_PHP . 'file3.php');
    break;

  default:
    break;
}  
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>TITLE</title>
    <link rel="stylesheet" type="text/css" href="css/stil.css" />
  <script src="js/script.js" type="text/javascript"></script>
  <?php
    $xajax->printJavascript();
  ?>
</head>

<body>
<?php

include (PFAD_PHP . 'navigation.php');

switch ($status)
{
  case 1:
    include (PFAD_PHP . 'file11.php');
    break;
  
  case 2:
    include (PFAD_PHP . 'file22.php');
    break;
  
  case 3:
    include (PFAD_PHP . 'file33.php');
    break;
  
  default:
    include (PFAD_PHP . 'file11.php');
    break;
}

?>
</body>
</html>

In the navigation file, I have "ajax-links" like this one: <a href="javascript:void(0)" onclick="xajax_wpModalRegister();">Register</a>
or non-ajax-links like this one: <a href="index.php?status=1">Home</a>

In fact, I implement "$xajax = new xajax();", the registration of xajax-functions and "$xajax->processRequest();" only once in the top of the index-file. Is this the correct way or am I misusing xajax? And if this is the correct way, what do I have to change to ensure that my xajax-functions are correctly registered?

Many thanks in advance for your help and for this forum!

Greetings, Bambi

hi everybody

i have a question concerning session-management and cookies. my web-application works well, as long as cookies are enabled. but it should work as well with disabled cookies.
i have enabled the php.ini session.use_trans_sid option, so i have no problems with disabled cookies as long as the user is in the ajax-free part of the website. but after an interaction with ajax, the session id is lost.

i think i have to add the session id as an argument to every ajax function, if cookies are disabled. on my website, i check, whether cookies are enabled or disabled and write the result to the session variable $_SESSION['cookie_check']. if this variable is true, then cookies are enabled; otherwise the variable is set to false.

now instead of this link:

<a href="javascript:void(0)" onclick="xajax_wpModalLogin();">Login</a>

i could write:

<?php
if ($_SESSION['cookie_check'] == false)
{
  $sendSID = SID;
}
else { $sendSID = ""; }
?>
<a href="javascript:void(0)" onclick="xajax_wpModalLogin('<?php echo $sendSID; ?>');">Login</a>

and in the wpModalLogin function, i think i have to add the session id to my response object. but i do not know yet, how i best do this.

i think, this approach is kind of complicated... does anybody knows a better solution to keep the session id? can i use any function to automate this issue?


and a little further question:
while clicking through my website and then clicking on the above link, i sometimes get back the firebug error "xajax_wpModalLogin is not defined". sometimes it works, sometimes i get the error...
i have an index.php file where i register the functions and do some other config stuff. and after the config-part, i include the requested content-file. that's why i think (and hope...) that the registered functions should be available at every time... i register the xajax-functions in my index.php file with

$xajax->registerFunction('wpModalLoginSubmit', 'php/functions_xajax.php');

i also tried these two ways:

require_once ('php/functions_xajax.php');
$xajax->register(XAJAX_FUNCTION,"wpModalLogin");
// or
$xajax->registerFunction('wpModalLogin');

but the error still comes up sometimes. has anybody a solution for this?

many thanks in advance for any answer!

best regards, bambi

21

(90 replies, posted in Third party plugins)

hi oliver

merci! :-)

lg, bambi

22

(90 replies, posted in Third party plugins)

hi!

in the meantime i found a solution for my second question: since the modal window is a simple div, i just added overflow: auto in the css-stlye.

i think i've also found a solution for my first problem, but i'm not shure...
i added the following line to modalWindow.inc.php after line 94 in the configure-function:
if (!isset($this->sDefer)) { $this->sDefer = ''; }

after this change, no warning is displayed anymore. but i'm not sure, if this line of code impacts the rest of the plugin in any negative way...
it would be great to hear from you (m[e]ntor), whether this is a good solution for my problem or you have a better one.

many thanks! bambi

23

(90 replies, posted in Third party plugins)

hi m[e]ntor

thanks very much for this plugin!

i have two litte questions:

1) after copying your plugin (without any changes) and the script from the index-file to my website, i get the following warning:
Notice: Undefined property: clsmodalWindow::$sDefer in /..../xajax/xajax_plugins/response/modalWindow/modalWindow.inc.php on line 118
as i am not familiar with object oriented programming and xajax as well, i do not know how to get rid of this warning. can you help me?

2) is there a possibility to make the modal window scrollable?

sorry if these are stupid questions... (deutsch w