BigCommerce - Hosted Ecommerce Software by Interspire

Interspire Forum

 
Go Back   Interspire Forum > Interspire Email Marketer Community Forum > Customization and Integration

Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2008, 12:48 AM
aaryn015 + aaryn015 is offline
Interspire Customer
 
Join Date: Dec 2007
Posts: 42
Default Version 1.4 - Changes to Admin Types?

Hi Interspire,

I made a mod to my copy of 1.3.3 so that I can have a custom admin type when adding/editing users. This admin type was present in the dropdown box and when selected, would use the same javascript function used to select/deselect certain permissions on the list as the standard types. (I customized this javascript to suit).

It actually worked perfectly.

After installing 1.4, I get an error when I go to the User Accounts page:
Langvar 'AdministratorType_' doesn't exist (Called from users.php, line 527)

I commented all my mods with an id so I could easily find them and merge them using WinMerge. So I did this (carefully). While doing this, I noticed that the javascript in question (on user_form.tpl) was totally missing in 1.4 (the main function is 'ChangeAdminPermissions(obj)')

So I reverted to a completely clean copy of 1.4. However the error persists - I assume because I have users of AdminGroup 'e' in the database - which was the code I used for my custom group.

So I have assumed that this part of the system has changed heavily. I did a search in the Changelog for 'Administrator' and 'Type' but found nothing.

Can some one give me a starting point to get this mod functioning again? In essence it is a saved custom AdminisratorGroup that we plan on giving all of our clients so we can make it a simple selection rather than making sure the correct check boxes are checked.

Regards
Aaron

Last edited by aaryn015; 03-07-2008 at 12:51 AM..
Reply With Quote
  #2  
Old 03-07-2008, 01:49 AM
Chris S Chris S is offline
Senior Member
 
Join Date: Feb 2004
Posts: 4,642
Default

Hi Aaron,

Quote:
Originally Posted by aaryn015
After installing 1.4, I get an error when I go to the User Accounts page:
Langvar 'AdministratorType_' doesn't exist (Called from users.php, line 527)
Did you update the admin/functions/api/user.php file with your changes from 1.3.3 again?

Because the api checks that it's getting a valid user type (lines 1358-1358):

PHP Code:
        if (!in_array($admintypearray_keys($this->AdminTypes))) {
            return 
false;
        } 
The javascript changes in the user_form.tpl file are due to us starting to use jquery for javascript checks etc instead of the old style 'document.getElementById' stuff. If you need a hand understanding it let me know.

Quote:
Originally Posted by aaryn015
Hi Interspire,

I made a mod to my copy of 1.3.3 so that I can have a custom admin type when adding/editing users. This admin type was present in the dropdown box and when selected, would use the same javascript function used to select/deselect certain permissions on the list as the standard types. (I customized this javascript to suit).

It actually worked perfectly.

After installing 1.4, I get an error when I go to the User Accounts page:
Langvar 'AdministratorType_' doesn't exist (Called from users.php, line 527)

I commented all my mods with an id so I could easily find them and merge them using WinMerge. So I did this (carefully). While doing this, I noticed that the javascript in question (on user_form.tpl) was totally missing in 1.4 (the main function is 'ChangeAdminPermissions(obj)')

So I reverted to a completely clean copy of 1.4. However the error persists - I assume because I have users of AdminGroup 'e' in the database - which was the code I used for my custom group.

So I have assumed that this part of the system has changed heavily. I did a search in the Changelog for 'Administrator' and 'Type' but found nothing.

Can some one give me a starting point to get this mod functioning again? In essence it is a saved custom AdminisratorGroup that we plan on giving all of our clients so we can make it a simple selection rather than making sure the correct check boxes are checked.

Regards
Aaron
Reply With Quote
  #3  
Old 03-07-2008, 03:33 AM
aaryn015 + aaryn015 is offline
Interspire Customer
 
Join Date: Dec 2007
Posts: 42
Default

Hi Chris, thanks for the quick answer.

Yes I had modified that file. It was on my list of 5 files:

/admin/functions/senstudio_functions.php
/admin/functions/users.php
/admin/functions/api/user.php
/admin/includes/templates/user_form.tpl
/admin/language/users.php

There is no modification to that line you show. The only mod in api/user.php is

PHP Code:
// MODADC - Add Our Client type to the Administrator Type Drop down (below is the original)
    //var $AdminTypes = array('a' => 'SystemAdministrator', 'l' => 'ListAdministrator', 'n' => 'NewsletterAdministrator', 't' => 'TemplateAdministrator', 'u' => 'UserAdministrator', 'c' => 'Custom');
  
var $AdminTypes = array('a' => 'SystemAdministrator''l' => 'ListAdministrator''n' => 'NewsletterAdministrator''t' => 'TemplateAdministrator''u' => 'UserAdministrator''c' => 'Custom''e' => 'DefaultClient');
  
// MODADC - Add Our Client type to the Administrator Type Drop down 
But thanks for pointing out that piece of code. As even though I have modified the above, when I print_r($this->AdminTypes), my custom additions is missing.

Strange. I'll have to have a play with that one.

On the JS, can you just tell me WHERE the other selections/deselections are being made on that form now so I can follow suit in the same place for my custom type?

Cheers
Aaron
Reply With Quote
  #4  
Old 03-07-2008, 04:16 AM
Chris S Chris S is offline
Senior Member
 
Join Date: Feb 2004
Posts: 4,642
Default

Hi Aaron,

Quote:
Originally Posted by aaryn015
But thanks for pointing out that piece of code. As even though I have modified the above, when I print_r($this->AdminTypes), my custom additions is missing.
Did you just modify it or was it done before you logged in?

Most of the api/user.php file is loaded when you log in and stored in the session, so if you just made the change now, log out & re-log in to get the change.

I did that to save it hitting the DB with every request to reload permissions.

Quote:
Originally Posted by aaryn015
On the JS, can you just tell me WHERE the other selections/deselections are being made on that form now so I can follow suit in the same place for my custom type?
This section I think:

PHP Code:
        $(document.users.admintype).change(function() {
            $(
'.CustomPermissionOptions')[(this.selectedIndex == 5'show' 'hide')]();

            $(
'.PermissionOptionItems').each(function() {
                switch(
document.users.admintype.selectedIndex) {
                    case 
0this.checked true; break;
                    case 
1this.checked = !!this.name.match(/list/); break;
                    case 
2this.checked = !!this.name.match(/newsletter/); break;
                    case 
3this.checked = !!this.name.match(/template/); break;
                    case 
4this.checked = !!this.name.match(/user/); break;
                }
            });
        }); 
Reply With Quote
  #5  
Old 03-07-2008, 04:20 AM
aaryn015 + aaryn015 is offline
Interspire Customer
 
Join Date: Dec 2007
Posts: 42
Default

Problem 1 - That's it alright. Logout and log back in again and it's fine. I was just hitting refresh. Your method makes sense though.

Cheers for the pointer to the select/deselect code. I'll get cracking on that next week.

Thanks for your help again Chris. Have a good weekend.

Aaron
Reply With Quote
  #6  
Old 03-07-2008, 05:13 AM
Chris S Chris S is offline
Senior Member
 
Join Date: Feb 2004
Posts: 4,642
Default

Hi Aaron,

Glad that sorted it out

Let me know if you need anything else.

Quote:
Originally Posted by aaryn015
Problem 1 - That's it alright. Logout and log back in again and it's fine. I was just hitting refresh. Your method makes sense though.

Cheers for the pointer to the select/deselect code. I'll get cracking on that next week.

Thanks for your help again Chris. Have a good weekend.

Aaron
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump