commit 5143208bdddb0b4efb6d16d241164b589bfd97eb
parent d2e07430d00f501f85e01c4cab31114424709829
Author: Jan Dankert <devnull@localhost>
Date: Wed, 17 Oct 2012 21:15:43 +0200
Links erhalten kein 'onclick'-Attribut, sondern sind über eine übergeordnetes Tag mit der CSS-Klasse 'clickable' anklickbar. Ein neues Jquery-Plugin 'orLinkify' sucht sich dann die Daten aus dem a-Tag und kümmert sich um den Aufruf der Verknüpfung.
Diffstat:
12 files changed, 92 insertions(+), 44 deletions(-)
diff --git a/themes/default/css/openrat.css.php b/themes/default/css/openrat.css.php
@@ -381,7 +381,7 @@ a:active,
a:hover
{
font-weight:normal;
- text-decoration:underline;
+ text-decoration:none;
}
@@ -645,7 +645,8 @@ textarea.editor
}
label,
-fieldset.open > legend
+fieldset.open > legend,
+.clickable
{
cursor: pointer;
}
diff --git a/themes/default/include/html/header.inc.php b/themes/default/include/html/header.inc.php
@@ -8,9 +8,9 @@
<img src="<?php echo $image_dir ?>icon/window/down.gif" />
<div class="headermenu">
<?php foreach( explode(',',$attr_views) as $attr_tmp_view ) { ?>
- <a class="entry" href="javascript:void(0);" onclick="javascript:startView(this,'<?php echo $attr_tmp_view ?>');">
- <img src="<?php echo $image_dir ?>icon/<?php echo $attr_tmp_view ?>.png" /><?php echo lang('MENU_'.$attr_tmp_view) ?>
- </a>
+ <a href="javascript:void(0);" data-type="view" data-method="<?php echo $attr_tmp_view ?>">
+ <img src="<?php echo $image_dir ?>icon/<?php echo $attr_tmp_view ?>.png" /><?php echo lang('MENU_'.$attr_tmp_view) ?>
+ </a>
<?php } ?>
</div>
<?php } ?>
diff --git a/themes/default/include/html/link.inc.php b/themes/default/include/html/link.inc.php
@@ -43,30 +43,11 @@
$tmp_data = $json->encode( array('action'=>!empty($attr_action)?$attr_action:$this->actionName,'subaction'=>!empty($attr_subaction)?$attr_subaction:$this->subActionName,'id'=>!empty($attr_id)?$attr_id:$this->getRequestId())
+array(REQ_PARAM_TOKEN=>token())
+$params );
- $tmp_function_call = "submitLink(this,'".str_replace("\n",'',str_replace('"','"',$tmp_data))."');";
+ $tmp_data = str_replace("\n",'',str_replace('"','"',$tmp_data));
break;
-
- case 'view':
- $tmp_function_call = "startView(this,'".(!empty($attr_subaction)?$attr_subaction:$this->subActionName)."');";
- break;
-
- case 'url':
- $tmp_function_call = "submitUrl(this,'".($attr_url)."');";
- break;
-
- case 'external':
- $tmp_function_call = "location.href='".$attr_url."';";
- break;
-
- case 'popup':
- $tmp_function_call = "window.open('".$attr_url."', 'Popup', 'location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes');";
- break;
-
- default:
- $tmp_function_call = "alert('Link-attribute type required');";
}
// if ( substr($tmp_url,0,10) != 'javascript' )
// $tmp_url = "javascript:loadViewByName('".$attr_target."','".$tmp_url.(isset($attr_anchor)?'#'.$attr_anchor:'')."'); return false;";
-?><a target="<?php echo $attr_frame ?>"<?php if (isset($attr_name)) { ?> name="<?php echo $attr_name ?>"<?php }else{ ?> href="javascript:void(0);" onclick="<?php echo $tmp_function_call ?>" <?php } ?> class="<?php echo $attr_class ?>"<?php if (isset($attr_accesskey)) echo ' accesskey="'.$attr_accesskey.'"' ?> title="<?php echo encodeHtml($attr_title) ?>">-
\ No newline at end of file
+?><a target="<?php echo $attr_frame ?>"<?php if (isset($attr_name)) { ?> name="<?php echo $attr_name ?>"<?php }else{ ?> href="javascript:void(0);" <?php } ?> class="<?php echo $attr_class ?>" data-id="<?php echo $attr_id ?>" data-type="<?php echo $attr_type ?>" data-action="<?php echo $attr_action ?>" data-method="<?php echo $attr_subaction ?>" data-data="<?php echo $tmp_data ?>" <?php if (isset($attr_accesskey)) echo ' accesskey="'.$attr_accesskey.'"' ?> title="<?php echo encodeHtml($attr_title) ?>">+
\ No newline at end of file
diff --git a/themes/default/js/openrat.js b/themes/default/js/openrat.js
@@ -355,15 +355,13 @@ function loadView(jo, url )
// Eingabefeld-Hints aktivieren...
$(jo).find('input[data-hint]').orHint();
-
-
// Untermenüpunkte aus der View in das Fenstermenü kopieren...
$(jo).closest('div.frame').find('div.menu div.dropdown div.entry.perview').remove(); // Alte Einträge löschen
$(jo).find('div.headermenu > a').each( function(idx,el)
{
// Jeden Untermenüpunkt zum Fenstermenü hinzufügen.
- $(el).wrap('<div class="entry perview" />').parent().appendTo( $(jo).closest('div.frame').find('div.menu div.dropdown').first() );
+ $(el).wrap('<div class="entry clickable perview" />').parent().appendTo( $(jo).closest('div.frame').find('div.menu div.dropdown').first() );
} );
$(jo).find('div.header > a.back').each( function(idx,el)
@@ -381,6 +379,8 @@ function loadView(jo, url )
$(this).parent().find('div').first().toggleClass('invisible');
});
+ // Links aktivieren...
+ $(jo).closest('div.frame').find('.clickable').orLinkify();
});
}
@@ -388,6 +388,9 @@ function loadView(jo, url )
function registerHeaderEvents()
{
+ // Links aktivieren...
+ $('div#title').find('.clickable').orLinkify();
+
// S u c h e
$('div.search input').blur( function(){
$('div.search input div.dropdown').fadeOut();
diff --git a/themes/default/js/plugin/jquery-plugin-orLinkify.js b/themes/default/js/plugin/jquery-plugin-orLinkify.js
@@ -0,0 +1,60 @@
+/**
+ * Input-Hints
+ */
+jQuery.fn.orLinkify = function()
+{
+
+ return $(this).click(function()
+ {
+ $(this).find('a').first().each( function() {
+
+ var type = $(this).attr('data-type');
+
+ if ( type == 'post' )
+ {
+ //alert('data: '+$(this).attr('data-data'))
+ submitLink(this,$(this).attr('data-data') );
+ }
+
+ else if ( type == 'view' )
+ {
+ startView(this, $(this).attr('data-method') );
+ }
+
+ else if ( type == 'url' )
+ {
+ submitUrl(this,$(this).attr('data-url') );
+ }
+
+ else if ( type == 'external' )
+ {
+ location.href = $(this).attr('data-url');
+ }
+
+ else if ( type == 'popup' )
+ {
+ window.open( $(this).attr('data-url'), 'Popup', 'location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes');
+ }
+
+ else if ( type == 'help' )
+ {
+ help(this,$(this).attr('data-url'),$(this).attr('data-suffix') );
+ }
+
+ else if ( type == 'fullscreen' )
+ {
+ //alert('fullscreen fuer: '+$(this).html() );
+ fullscreen(this);
+ }
+
+ else if ( type == 'open' )
+ {
+ openNewAction( $(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-id'),0);
+ }
+ else
+ {
+ alert('Fatal: Cannot open link: '+$(this).html() );
+ }
+ } );
+ });
+};+
\ No newline at end of file
diff --git a/themes/default/js/plugin/jquery-plugin-orSearch.js b/themes/default/js/plugin/jquery-plugin-orSearch.js
@@ -22,8 +22,9 @@ jQuery.fn.orSearch = function( options )
var result = data.result[id];
// Suchergebnis-Zeile in das Ergebnis schreiben.
- $(settings.dropdown).append('<div class="entry" title="'+result.desc+'"><a href="javascript:openNewAction(\''+result.name+'\',\''+result.type+'\','+id+',0);"><img src="'+OR_THEMES_EXT_DIR+'default/images/icon_'+result.type+'.png" />'+result.name+'</a></div>');
+ $(settings.dropdown).append('<div class="entry clickable" title="'+result.desc+'"><a href="javascript:void(0);" data-type="open" data-name="'+result.name+'" data-action="'+result.type+'" data-id="'+id+'"><img src="'+OR_THEMES_EXT_DIR+'default/images/icon_'+result.type+'.png" />'+result.name+'</a></div>');
}
+ $(settings.dropdown).orLinkify();
} } );
$(settings.dropdown).fadeIn();
diff --git a/themes/default/layout/index.php b/themes/default/layout/index.php
@@ -37,6 +37,7 @@
<script src="<?php echo OR_THEMES_EXT_DIR ?>default/js/openrat.js"></script>
<script src="<?php echo OR_THEMES_EXT_DIR ?>default/js/plugin/jquery-plugin-orHint.js"></script>
<script src="<?php echo OR_THEMES_EXT_DIR ?>default/js/plugin/jquery-plugin-orSearch.js"></script>
+ <script src="<?php echo OR_THEMES_EXT_DIR ?>default/js/plugin/jquery-plugin-orLinkify.js"></script>
<!--
<script src="<?php echo OR_THEMES_EXT_DIR ?>../editor/wymeditor/wymeditor/jquery.wymeditor.min.js"></script>
-->
diff --git a/themes/default/layout/perspective/header.php b/themes/default/layout/perspective/header.php
@@ -38,7 +38,7 @@ function view_header( $name )
}
if ( /* Deaktiviert */ false && @$conf['help']['enabled'] )
{
- ?><a class="help" href="javascript:help(this,'<?php echo $conf['help']['url'] ?>','<?php echo @$conf['help']['suffix'] ?> " title="<?php echo langHtml('MENU_HELP_DESC') ?>"><img src="<?php echo $image_dir.'icon/help.png' ?>" /><?php echo @$conf['help']['only_question_mark']?'?':langHtml('MENU_HELP') ?></a><?php
+ ?><a class="help" data-url="<?php echo $conf['help']['url'] ?>" data-suffix="<?php echo @$conf['help']['suffix'] ?>" title="<?php echo langHtml('MENU_HELP_DESC') ?>"><img src="<?php echo $image_dir.'icon/help.png' ?>" /><?php echo @$conf['help']['only_question_mark']?'?':langHtml('MENU_HELP') ?></a><?php
}
?><?php
@@ -52,11 +52,11 @@ function view_header( $name )
<?php if (!empty($viewlist)) { /* Fenster-Menü anzeigen (sofern Views vorhanden) */ ?>
<img class="icon" src="<?php echo OR_THEMES_EXT_DIR.'default/images/icon/menu.gif' ?>" />
<div class="dropdown dropdownalignright">
-<div class="entry"><a href="javascript:void(0);" class="fullscreen" onClick="javascript:fullscreen( this );"><img src="<?php echo OR_THEMES_EXT_DIR.'default/images/icon/window/maximize.gif' ?>" title="<?php echo langHtml('window_fullscreen') ?>" /><?php echo langHtml('window_fullscreen') ?></a></div>
+<div class="entry clickable"><a href="javascript:void(0);" class="fullscreen" data-type="fullscreen"><img src="<?php echo OR_THEMES_EXT_DIR.'default/images/icon/window/maximize.gif' ?>" title="<?php echo langHtml('window_fullscreen') ?>" /><?php echo langHtml('window_fullscreen') ?></a></div>
<?php
if ( @$conf['help']['enabled'] )
{
- ?><div class="entry"><a onclick="help(this,'<?php echo $conf['help']['url'] ?>','<?php echo @$conf['help']['suffix'] ?>');" title="<?php echo langHtml('MENU_HELP_DESC') ?>"><img src="<?php echo OR_THEMES_EXT_DIR.'default/images/icon/help.png' ?>" /><?php echo langHtml('MENU_HELP') ?></a></div><?php
+ ?><div class="entry clickable"><a href="javascript:void(0);" data-type="help" data-url="<?php echo $conf['help']['url'] ?>" data-suffix="<?php echo @$conf['help']['suffix'] ?>" title="<?php echo langHtml('MENU_HELP_DESC') ?>"><img src="<?php echo OR_THEMES_EXT_DIR.'default/images/icon/help.png' ?>" /><?php echo langHtml('MENU_HELP') ?></a></div><?php
}
?>
</div>
diff --git a/themes/default/templates/start/projectmenu.tpl.src.xml b/themes/default/templates/start/projectmenu.tpl.src.xml
@@ -8,7 +8,7 @@
</row>
<list list="projects" extract="true">
<row>
- <column colspan="2">
+ <column colspan="2" class="clickable">
<group title="var:name">
<link type="post" id="var:id" title="message:TREE_CHOOSE_PROJECT">
<set var="project" value="project"></set>
diff --git a/themes/default/templates/start/projecttimeline.tpl.src.xml b/themes/default/templates/start/projecttimeline.tpl.src.xml
@@ -18,7 +18,7 @@
</row>
<list list="timeline" extract="true">
<row class="data">
- <column>
+ <column class="clickable">
<link url="var:url">
<text var="name"></text>
</link>
diff --git a/themes/default/templates/start/timeline.tpl.src.xml b/themes/default/templates/start/timeline.tpl.src.xml
@@ -1,5 +1,5 @@
<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.openrat.de/template ../template.xsd">
+ xsi:schemaLocation="http://www.openrat.de/template ../template.xsd">
<table>
<row class="headline">
<column>
@@ -18,8 +18,8 @@
<list list="timeline" extract="true">
<row class="data">
- <column>
- <link url="var:url">
+ <column class="clickable">
+ <link type="post" id="var:projectid">
<text var="projectname"></text>
</link>
</column>
diff --git a/themes/default/templates/title/show.tpl.src.xml b/themes/default/templates/title/show.tpl.src.xml
@@ -22,14 +22,14 @@
<text class="titletext" var="userfullname" maxlength="25"></text>
<image fileext="icon/menu.gif" align="left"></image>
<part class="dropdown">
- <part class="entry">
+ <part class="entry clickable">
<link type="post" title="message:USER_PROFILE_DESC" action="start"
subaction="profile">
<image icon="user" align="left"></image>
<text key="profile"></text>
</link>
</part>
- <part class="entry">
+ <part class="entry clickable">
<link type="post" title="message:start" action="start"
subaction="start">
<image icon="start" align="left"></image>
@@ -37,7 +37,7 @@
</link>
</part>
<if true="method:userIsAdmin">
- <part class="entry">
+ <part class="entry clickable">
<link type="post" class="entry" action="start" subaction="administration"
target="tree" id="-1">
<image icon="administration" align="left"></image>
@@ -45,7 +45,7 @@
</link>
</part>
</if>
- <part class="entry">
+ <part class="entry clickable">
<link type="post" class="entry" title="message:USER_LOGOUT_DESC"
action="login" subaction="logout">
<image icon="close" align="left"></image>
@@ -66,7 +66,7 @@
<text class="titletext" key="GLOBAL_CHANGE_TO"></text>
<part class="dropdown">
<list list="projects" key="id" value="name">
- <part class="entry">
+ <part class="entry clickable">
<image icon="project"></image>
<link type="post" action="start" subaction="projectmenu" id="var:id">
<text var="name" maxlength="45"></text>