• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: RedirectToAdminTab not working as expected
PostPosted: Sat Jan 28, 2017 10:11 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Apr 18, 2008 9:34 pm
Posts: 315
Location: Nimbin, Australia
I'm working on my first module and have an issue with RedirectToAdminTab() - it does not redirect to the current tab, or any other specified tab that I name. It always goes back to the first tab. From the API Docs:
Quote:
RedirectToAdminTab(string $tab = '', mixed|null $params = '', string $action = '')

Redirect to the specified tab.
...
string $tab

The tab name. If empty, the current tab is used. ...


the defaultadmin contains
Code:
echo $this->StartTabHeaders();
   echo $this->SetTabHeader('transfer', $this->Lang('transfer'));
   echo $this->SetTabHeader('merge', $this->Lang('merge'));
   echo $this->SetTabHeader('issue', $this->Lang('issue'));
echo $this->EndTabHeaders();

echo $this->StartTabContent();
   echo $this->StartTab('transfer');
      include 'function.transfer_tab.php';
   echo $this->EndTab();

   echo $this->StartTab('merge');
      include 'function.merge_tab.php';
   echo $this->EndTab();

   echo $this->StartTab('issue');
      include 'function.issue_tab.php';
   echo $this->EndTab();
echo $this->EndTabContent();
Here's an example of a function.xxx_tab file
Code:
$smarty->assign('start_mergeform', $this->CreateFormStart(
   $id,
   'admin_merge',
   $returnid
   )
   );
$smarty->assign('end_mergeform',$this->CreateFormEnd());

$tpl_merge = $smarty->CreateTemplate(
$this->GetTemplateResource('merge.tpl'),null,null,$smarty);
$tpl_merge->display();
and an action.admin_xxx file looks like this:
Code:
$issue = new IssueShares();
if( isset($params['cancel']) ) {
   $this->RedirectToAdminTab();
}
else if( isset($params['submit']) ) {
 ...
   $this->SetMessage($this->Lang('share_issued'));
   $this->RedirectToAdminTab();
}
$tpl = $smarty->CreateTemplate($this->GetTemplateResource('issue.tpl'),null,null,$smarty);
$tpl->assign('issue',$issue);
$tpl->display();

Any idea why CMSMS does not recognise the current tab?



----------------------------------------------

Cms Version: 2.1.6

Installed Modules:

CGBlog: 1.14.1
CGExtensions: 1.53.13
CGFeedback: 1.8
CGSimpleSmarty: 2.1.4
CGSmartImage: 1.21.5
CMSContentManager: 1.1.4
CMSMailer: 6.2.14
Captcha: 0.5.3
DesignManager: 1.1.1
FileManager: 1.5.2
FormBuilder: 0.8.1.4
JQueryTools: 1.3.9
LinkMgr: 2.1.1
MSShares: 0.1
ModuleManager: 2.0.5
Navigator: 1.0.3
News: 2.50.6
Search: 1.50.2


Config Information:

php_memory_limit:
max_upload_size: 2000000
url_rewriting: mod_rewrite
page_extension: .html
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Australia/Sydney
permissive_smarty: false


Php Information:

phpversion: 5.6.29-0+deb8u1
md5_function: On (True)
json_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_ALL: 22527
E_STRICT: 0
E_DEPRECATED: 0
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 128M
max_execution_time: 30
register_globals: Off (False)
output_buffering: 4096
disable_functions: pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority,
open_basedir:
test_remote_url: Success
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 2M
session_save_path: /var/lib/php5/sessions (1733)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
check_ini_set: On (True)
curl: On


Performance Information:

allow_browser_cache: Off (False)
browser_cache_expiry: 0
php_opcache: On (True)
smarty_cache: Off (False)
smarty_compilecheck: Off (False)
smarty_cache_udt: Off (False)
auto_clear_cache_age: On (True)

Server Information:

Server Software: Apache/2.4.10 (Debian)
Server Api: apache2handler
Server Os: Linux 3.16.0-4-amd64 On x86_64
Server Db Type: MySQL (mysqli)
Server Db Version: 5.5.53
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable


Permission Information:

tmp: /var/www/cmsms/tmp (0777)
tmp_cache: /var/www/cmsms/tmp/cache (0777)
templates_c: /var/www/cmsms/tmp/templates_c (0777)
modules: /var/www/cmsms/modules (0777)
uploads: /var/www/cmsms/uploads (0777)
File Creation Mask (umask): /var/www/cmsms/tmp/cache (0777)
config_file: 0644

----------------------------------------------


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: RedirectToAdminTab not working as expected
PostPosted: Sat Jan 28, 2017 11:26 am 
Offline
Support Guru
Support Guru
User avatar

Joined: Wed Sep 05, 2007 8:03 pm
Posts: 3999
Location: The Netherlands
Uhm.. because you didn't specify the tab in RedirectToAdminTab('tabname')?

_________________


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: RedirectToAdminTab not working as expected
PostPosted: Sat Jan 28, 2017 12:52 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Apr 18, 2008 9:34 pm
Posts: 315
Location: Nimbin, Australia
No, I tried that
Quote:
it does not redirect to the current tab, or any other specified tab that I name.
Also, if I understand the documentation correctly, I should not have to name it to get to the same tab.
Quote:
string $tab
The tab name. If empty, the current tab is used.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: RedirectToAdminTab not working as expected
PostPosted: Sat Jan 28, 2017 3:03 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 7925
Location: Fernie British Columbia, Canada
1. The 'action' handling your form has no knowledge of what the 'current' tab is. so you need to use the SetCurrentTab() method, or specify a tab name when using RedirectToAdminTab().

i.e:

Code:
<?php
if( !defined('CMS_VERSION') ) exit;
$this->SetCurrentTab('foo');
...
$this->RedirectToAdminTab();


2. We are discouraging use of all of the CreateInput* and CreateForm* methods. it's much better to put all of that into the template directly. There are smarty plugins to help:
Code:
{form_start}
<input type="text" name="{$actionid}textfield" value="{$something}"/>
<input type="submit" name="{$actionid}submit" value="Submit"/>
{form_end}

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: RedirectToAdminTab not working as expected
PostPosted: Sat Jan 28, 2017 9:12 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Apr 18, 2008 9:34 pm
Posts: 315
Location: Nimbin, Australia
Thank you.
Quote:
you need to use the SetCurrentTab() method, or specify a tab name when using RedirectToAdminTab().

SetCurrentTab('foo') and RedirectToAdminTab() works for me, but only RedirectToAdminTab('foo') does not.

BTW, the module tutorial has a link to a skeleton module which is marked as stale. Is it still relevant?
http://dev.cmsmadesimple.org/projects/skeleton


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting