2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

98_weekprofile: change edit on own page remove url parameter

git-svn-id: https://svn.fhem.de/fhem/trunk@10840 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
risiko79 2016-02-14 13:17:05 +00:00
parent 14803f9c53
commit 4fe84ac7bb
2 changed files with 12 additions and 16 deletions

View File

@ -1057,11 +1057,10 @@ sub weekprofile_SummaryFn()
############################################## ##############################################
sub weekprofile_editOnNewpage(@) sub weekprofile_editOnNewpage(@)
{ {
my ($device, $prf,$backurl) = @_; my ($device, $prf) = @_;
my $hash = $defs{$device}; my $hash = $defs{$device};
$backurl="?" if(!defined($backurl)); my $args = "weekprofile,MODE:EDIT,JMPBACK:1";
my $args = "weekprofile,MODE:EDIT,BACKURL:$backurl";
my $html; my $html;
$html .= "<html>"; $html .= "<html>";
@ -1113,9 +1112,8 @@ sub weekprofile_getEditLNK_MasterDev($$)
my $editIcon = FW_iconName($iconName) ? FW_makeImage($iconName,$iconName,"icon") : ""; my $editIcon = FW_iconName($iconName) ? FW_makeImage($iconName,$iconName,"icon") : "";
my $script = '<script type="text/javascript">'; my $script = '<script type="text/javascript">';
$script.= "function jump_edit_weekprofile_$aszDev() {"; $script.= "function jump_edit_weekprofile_$aszDev() {";
$script.= 'var url;var pos = location.href.indexOf("?"); if (pos>=0) {url = location.href.substr(pos);}';
$script.= "window.location.assign('$FW_ME?cmd={weekprofile_editOnNewpage("; $script.= "window.location.assign('$FW_ME?cmd={weekprofile_editOnNewpage(";
$script.= "\"$device\",\"$prf\",\"'+url+'\");;}')};"; $script.= "\"$device\",\"$prf\");;}')};";
$script.= "</script>"; $script.= "</script>";
my $lnk = "$script<a onclick=\"jump_edit_weekprofile_$aszDev()\" href=\"javascript:void(0)\">$editIcon</a>"; my $lnk = "$script<a onclick=\"jump_edit_weekprofile_$aszDev()\" href=\"javascript:void(0)\">$editIcon</a>";

View File

@ -137,13 +137,7 @@ function weekprofile_DoEditWeek(devName,newPage)
var widget = $('div[informid="'+devName+'"]').get(0); var widget = $('div[informid="'+devName+'"]').get(0);
if (newPage == 1) { if (newPage == 1) {
var url = location.href; window.location.assign(FW_root+'?cmd={weekprofile_editOnNewpage("'+widget.DEVICE+'","'+widget.CURTOPIC+':'+widget.CURPRF+'");;}');
var pos = url.indexOf('?');
if (pos >=0)
url = url.substr(pos);
else
url='';
window.location.assign(FW_root+'?cmd={weekprofile_editOnNewpage("'+widget.DEVICE+'","'+widget.CURTOPIC+':'+widget.CURPRF+'","'+url+'");;}');
} else { } else {
widget.MODE = 'EDIT'; widget.MODE = 'EDIT';
$(widget.MENU.BASE).hide(); $(widget.MENU.BASE).hide();
@ -655,8 +649,12 @@ function FW_weekprofilePrepAndSendProf(devName)
function FW_weekprofileBack(widget) function FW_weekprofileBack(widget)
{ {
if (widget.SHOWURL){ if (widget.JMPBACK){
window.location.assign(FW_root+widget.SHOWURL); var isInIframe = (window.location != window.parent.location) ? true : false;
if (isInIframe) {
parent.history.back();
} else
window.history.back();
} }
else { else {
widget.MODE = "SHOW"; widget.MODE = "SHOW";
@ -784,7 +782,7 @@ FW_weekprofileCreate(elName, devName, vArr, currVal, set, params, cmd)
$(widget.MENU.BASE.parentElement.parentElement).append(menuContent); $(widget.MENU.BASE.parentElement.parentElement).append(menuContent);
widget.MENU.CONTENT = $(widget.HEADER).find('div[id*="menu.content"]').get(0); widget.MENU.CONTENT = $(widget.HEADER).find('div[id*="menu.content"]').get(0);
widget.SHOWURL = null; widget.JMPBACK = null;
widget.MODE = 'SHOW'; widget.MODE = 'SHOW';
widget.USETOPICS = 0; widget.USETOPICS = 0;
@ -792,7 +790,7 @@ FW_weekprofileCreate(elName, devName, vArr, currVal, set, params, cmd)
var arg = vArr[i].split(':'); var arg = vArr[i].split(':');
switch (arg[0]) { switch (arg[0]) {
case "MODE": widget.MODE = arg[1]; break; case "MODE": widget.MODE = arg[1]; break;
case "BACKURL": widget.SHOWURL = arg[1]; break; case "JMPBACK": widget.JMPBACK = arg[1]; break;
case "MASTERDEV": widget.MASTERDEV = arg[1]; break; case "MASTERDEV": widget.MASTERDEV = arg[1]; break;
case "USETOPICS": widget.USETOPICS = arg[1]; break; case "USETOPICS": widget.USETOPICS = arg[1]; break;
} }