Javascript in detail pages

M

Mark

Guest
Hello,

First I want to thank everyone who creates the best software.
It's really great!! Now I use it to manager our papers.

May I have a request of details page?
I'd like to open a new window without menubar and toolbar when the details display. (Also without the header)
Cause I want to show only the title, author, abstract, and download link in the display page.
How should I put the javascript into the php file ?

What I want is just like the example page of Yale University.
This may be simple to somebody, but I just need help.
Thank you very much.

With Regrads,
Mark

 
D

Debbie S

Guest
Mark

Search the internet for a simple window open script that works for what you need (you can start at http://javascript.internet.com/). Once you have the script, you can add that to the header.php file inside the <head></head> tags.

Then to add the javascript command (the script will normally instruct you how you should form your link for it), you will need to edit the details link in the results_table function located in business_logic.php (in my file, it starts on line 2365 with the text if ($enable_details == "1"){ // display the details icon).

To not have the header info for your DaDaBIK installation display in the details window, you could include all the display text in your header inside an if statement something like:

<?
if (function != "details") {
-- header information normally displayed --
-- make sure you change the code contained here compatible with php --
-- use echo ""; statements --
}
?>

Hope this helps!

Debbie
(Latest version of DaDaBIK when this message was posted: 3.1 Beta)
 
M

Mark

Guest
Dear Debbie S,

Thanks for your help and I should post my question more clearly. :D
I edited the business_logic.php as

$results_table .= "<a href=\"javascript://" onClick="window.open('http://nanosioe.ee.ntu.edu.tw','','menubar=no')\">123</a>";

just a simply try and somethings have been removed like class, target, and urlencode.
It displays like

Parse error: parse error, unexpected T_STRING
and I don't know what's the problem.
And if i just put the href=\"....> into the location above, does it compatible?
I'm sorry that I am really poor at PHP.
Thanks again and with regards.

Mark

 
D

Debbie S

Guest
Mark

What pop-up javascript are you trying to incorporate into your installation? Did you modify only the link that points to the details icon in results view?

Most likely your link will have to be formed like this (with the javascript command added in bold):

if ($enable_details == "1"){ // display the details icon
$results_table .= "<a class=\"onlyscreen\" target=\"_".$edit_target_window."\" href=\"javascript:window.open('".$dadabik_main_file."?table_name=".urlencode($table_name)."&function=details&where_field=".urlencode($where_field)."&where_value=".urlencode($where_value)."');\"><img border=\"0\" src=\"".$details_icon."\" alt=\"".$submit_buttons_ar["details"]."\" title=\"".$submit_buttons_ar["details"]."\"></a>";
} // end if

The easiest way to incorporate this into your installation is to find a window script that includes all the settings in the javascript function itself instead of listing them inside link text.

Without seeing your code, there isn't anything else I can suggest at this time.

Debbie
(Latest version of DaDaBIK when this message was posted: 3.1 Beta)

 
M

Mark

Guest
Debbie S wrote:

> Mark
> <?
> if (function != "details") {
> -- header information normally displayed --
> -- make sure you change the code contained here compatible with php --
> -- use echo ""; statements --
> }
> ?>

> The easiest way to incorporate this into your installation is
> to find a window script that includes all the settings in the
> javascript function itself instead of listing them inside link
> text.
>

Dear Debbie,

Thanks for you help and the detail page display well.
I think that I forgot to add ; between ') and \"
But there is still a question that another page open together with the content [object]
is it correct ?
And I search all php files but I can't find the code list above. What I mean is that when I wrote
<?
if (function != "details") {
<img src="http://faust.sytes.net/1.gif">
}
else {
<img src="http://faust.sytes.net/2.gif">
} // end if
?>

It doesn't work and I don't know what's the problem.
Thank you again and I really appreciate your patience.
With Regards,
Mark

 
D

Debbie S

Guest
Mark

You won't find that anywhere because that is code that I instructed you would have to write into the header (and footer if you don't want that displayed either). I did not test it until now and it does not work if it is placed into the header.php file.

On one of my installations, the users wanted a small window to open for links inside the results table, so for that I just created a details.php page (made a copy of index.php). I also created separate header/footer files which I referenced in details.php (instead of referencing header.php/footer.php, my install references header1.php/footer1.php).

In details.php, I included only the code to display the details view -- from line 164 (which begins with switch($function){. The code I have in my details.php page is this:

switch($function){
case "details":
if ($enable_details == "1" && ($enable_authentication === 0 || $enable_browse_authorization === 0 || current_user_is_owner($where_field, $where_value, $table_name, $fields_labels_ar))){
// build the details select query
//$sql = "select * from ".$quote.$table_name.$quote." where ".$quote.$where_field.$quote." = '".$where_value."'";

$sql = build_select_part($fields_labels_ar, $table_name);

$sql .= " where ".$quote.$where_field.$quote." = '".$where_value."' LIMIT 1";

display_sql($sql);

txt_out("<h3>".$normal_messages_ar["details_of_record"]."</h3>");

// execute the select query
$res_details = execute_db("$sql", $conn);

// build the HTML details table
$details_table = build_details_table($fields_labels_ar, $res_details);

// display the HTML details table
echo $details_table;
} // end if
else {
txt_out("<p>".$error_messages_ar["no_authorization_view"]."</p>");
} // end else
break;
} // end swtich ($function)

// include footer
include ("./include/footer1.php");
?>

In my results display, I simply had the pop-up window link point to the details.php page instead of the databik_main_file and all works fine. There may be an easier way to do this, but this worked for me and only took me a couple of minutes to set up. Since it's using the default details call from index.php, it is easy to update this details.php with the updated code (by copying from index.php) when an updated version of DaDaBIK is implemented.

Hope this helps.
Debbie
(Latest version of DaDaBIK when this message was posted: 3.1 Beta)
 
M

Mark

Guest
Dear Debbie,

It's really amazing.
Thank you very much and it works well!!!

With Regards,

Mark
 
Top