Permalink
Browse files

Convert <button> links to <a href> to function when javascript is dis…

…abled
  • Loading branch information...
haraldpdl committed Oct 28, 2010
1 parent 7b9063c commit 9269eddc849d019a07bcd4f8e37e70a253602413
Showing with 23 additions and 7 deletions.
  1. +17 −7 catalog/includes/functions/html_output.php
  2. +6 −0 catalog/stylesheet.css
@@ -357,21 +357,31 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
$priority = 'secondary';
}
- $button = '<button id="tdb' . $button_counter . '" type="' . tep_output_string($params['type']) . '"';
+ $button = '<span class="tdbLink">';
+
+ if ( ($params['type'] == 'button') && isset($link) ) {
+ $button .= '<a id="tdb' . $button_counter . '" href="' . $link . '"';
- if ( isset($link) ) {
if ( isset($params['newwindow']) ) {
- $button .= ' onclick="window.open(\'' . $link . '\');"';
- } else {
- $button .= ' onclick="document.location.href=\'' . $link . '\';"';
+ $button .= ' target="_blank"';
}
+ } else {
+ $button .= '<button id="tdb' . $button_counter . '" type="' . tep_output_string($params['type']) . '"';
}
if ( isset($params['params']) ) {
$button .= ' ' . $params['params'];
}
- $button .= '>' . $title . '</button><script>$("#tdb' . $button_counter . '").button(';
+ $button .= '>' . $title;
+
+ if ( ($params['type'] == 'button') && isset($link) ) {
+ $button .= '</a>';
+ } else {
+ $button .= '</button>';
+ }
+
+ $button .= '</span><script>$("#tdb' . $button_counter . '").button(';
$args = array();
@@ -395,7 +405,7 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
$button .= '{' . implode(',', $args) . '}';
}
- $button .= ').addClass("ui-priority-' . $priority . '");</script>';
+ $button .= ').addClass("ui-priority-' . $priority . '").parent().removeClass("tdbLink");</script>';
$button_counter++;
View
@@ -386,6 +386,12 @@ SPAN.errorText {
.inputRequirement { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ff0000; }
+/* buttons */
+
+.tdbLink a { }
+
+.tdbLink button { }
+
/* account link list */
.accountLinkList {

0 comments on commit 9269edd

Please sign in to comment.