Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Input Tabs
#51
(2012-11-01, 12:09:05)stevenatherton42 Wrote: Sorry, I disabled exec-php while I was messing around with something else. I've enabled it again if you want to try the link to see what I mean, but it really doesn't effect me.

I think I'm going to try my hand at plugin development. There's a couple of things that would come in useful.

Ahh... after seeing it now, I think I understand the problem. The exec-php plugin is prematurely outputting the content to page, then returning "nothing" back to the system for the next plugin to process. So when it gets to Simple Input Tabs's turn to output content, the "nothing" is interpreted as there being no content, and an error message is shown.

I think I could make it compatible... But I might wait and see if anyone else is using it and needs compatibility.

---

Yeah make some plugins! Go for it! It's not too hard and pretty useful knowing how to manipulate the system. What sort of ideas have you got floating around in that head of yours?
Reply
#52
(2012-11-01, 15:04:04)jason.dixon.email Wrote: Yeah make some plugins! Go for it! It's not too hard and pretty useful knowing how to manipulate the system. What sort of ideas have you got floating around in that head of yours?

It'd be useful if I could have certain pages or tabs locked to prevent editing. I make websites for small businesses and plan on using this cms for them to edit parts of their content but would prefer to have certain tabs locked such as the header and footer, until they decide to unlock it.
Reply
#53
They would have the option to unlock it themselves?

You could possibly do that now, with this plugin.

I'm thinking, making the header and footer of the template look like this:

Code:
<span style="display:none"><?php insert_page_content("header"); ?></span><?php insert_page_content("somepage->header"); ?>

So the tab for header exists, but is permanently hidden. Meanwhile we display the header tab from the page "somepage" on all pages.

ie: The header tabs on their pages will do nothing unless they are editing the page named "somepage".
Reply
#54
Or better yet... Just name a page and tab and have the plugin create it for you on that one page only.

Dunn dunn duuuuuuun... new in 1.7! Cool

1.7
DOWNLOAD IT HERE!

Since I cannot upload anything to extend at the moment. I'll have to host the file elsewhere for a little while.

Changes 1.7 - Fixed a bug where compatibility mode would not turn on if this plugin loaded before the plugin needing compatilibity.
Added a quick and nasty way to hide tabs in the template: Prefix your tab name with a "#" and even though it will be hidden for having illegal characters, the "#" it will suppress the warning message.
Went through and broke up the code a lot more.
Added a duplicate "display tab location" link above the edit box.
Added a compatibility mode for the plugin "Small Plugin Toolbox".
Specific tab requests (using "->") will now create a tab on the requested page if one does not already exist.
Added a config option in the php file to choose placement of page tabs: Above or below the edit box.
Added a config option in the php file to turn off warnings and 404 errors.
Added an option to have config options placed in the external language files. Configurations in a language file will take priority over the built in ones. If you do not want config items in the language file, simply delete them.
Reply
#55
Extend should be fine now. Please report if you have any trouble.
Reply
#56
Updated to 1.8 Woooo!

Changed the config options for tab locations. Instead of true/false, it is now a number system that can select one of four options. To change it, open this plugin file in a text editor and change the number on this code section:

Code:
$SIT_OPTIONS['tab-location'] = 3;
Added a new Tab layout using Javascript. This layout is special in that it does not need a page reload each time you change a tab. It also fully uses the admin CSS styles. If you do not like this layout or you prefer the button style. Change the config option (above) to either 1 or 2.

Added a new filter that will put content into an 'extra' tab. Either in your own plugin, or in a plugin you want to modify, make/change the filter with your desired tab name followed by a dash and "tab-content". ie for a tab named "sidebar":

Code:
add_filter("sidebar-tab-content","myfunction");
Reply
#57
Question 
Hello Jason,

I am having a minor problem with your new version.
The new tabs show up, but the buttons are still displayed below the tabs, as well as at the bottom of the page. Also, I tried changing 0-3 in the config., but did not notice any change to the buttons or tabs.

   
Reply
#58
Hmm... hmmmmmm...

I guess my first thought is... Do you have an external language file for the plugin, and if so does it have config options in there?
Reply
#59
At the moment, no. But I do have other plugins, so let me create a clean install with just your plug, and I will report back shortly.

Edit.: After adding it to a clean install, everything works as intended.
Added all plugs from previous install, everything works fine.

Possibly upgrading Simple Tabs had it stuck in debug mode?
Or maybe just a random hiccup.

Either way, it looks to be working now. And your new tabs above the editor are pretty slick looking. Thanks for the update.
Reply
#60
Not sure if this was your issue just now. But it just brought to light something I should change. So I just made a small hotfix. See if it works? Big Grin
Reply
#61
Hello,

Looks pretty useful at first glance – thanks! It should make things easier when explaining the site admin. to lay editors.

A couple of points:
- there's a lot of redundant Mac stuff in the distributed .zip;
- with debug on, there are several 'Uninitialized string offset' and 'Undefined index' notices from PHP in simple_input_tabs.php.

I'm using GS 3.1.2, PHP 5.3.3 and SIT 1.8c. Several other plugins are installed, but disabled.

Edit to add:
Just changing (Simple Input) tabs on the Edit page marks the page content as changed, so there's a warning if the page edit is aborted, even if none of the content has been changed. This means that just going to look at/check a site page's content in the editor can lead to unnecessary pop-ups. Not a big deal, but a bit clunky.

For a new page, is there any way to get a change of page template without having to save the page first? Again, not really a big deal, except that it's necessary to have a page title before saving, which no-one will know until they get the error message. So then they enter the page title and click 'Save Page' again, not realising that their previous template change has been reset by the save error. This will take some explaining (and troubleshooting effort from the user). (Any content will also be lost, but that's not a fault of SIT.)
--
Nick.
Reply
#62
(2012-11-08, 18:32:08)hameau Wrote: Hello,

Looks pretty useful at first glance – thanks! It should make things easier when explaining the site admin. to lay editors.

A couple of points:
- there's a lot of redundant Mac stuff in the distributed .zip;
- with debug on, there are several 'Uninitialized string offset' and 'Undefined index' notices from PHP in simple_input_tabs.php.

I'm using GS 3.1.2, PHP 5.3.3 and SIT 1.8c. Several other plugins are installed, but disabled.

Hmm. By redundant mac stuff, are you referring to "hidden" spotlight files or some such? I could have sworn I didn't put any in there, but I could be wrong. Files like .DS_store?

I'll have to check out your errors.

Quote:Edit to add:
Just changing (Simple Input) tabs on the Edit page marks the page content as changed, so there's a warning if the page edit is aborted, even if none of the content has been changed. This means that just going to look at/check a site page's content in the editor can lead to unnecessary pop-ups. Not a big deal, but a bit clunky.

For a new page, is there any way to get a change of page template without having to save the page first? Again, not really a big deal, except that it's necessary to have a page title before saving, which no-one will know until they get the error message. So then they enter the page title and click 'Save Page' again, not realising that their previous template change has been reset by the save error. This will take some explaining (and troubleshooting effort from the user). (Any content will also be lost, but that's not a fault of SIT.)

Yeah I know what you're saying. This was an executive decision I had to make and it may not have been the correct one. Tongue
For a reason I have yet to fully grasp. When changing the content via Javascript (ie tab switch), the process breaks the CMS's ability to check for changes on that field. So if you changed a tab then typed in something, it would not register the changes anymore in the main content field and would not warn you that content had been changed (though changes anywhere else still work fine, like changing the title etc). So I have some good news. That warning is actually added in there manually and can be easily deleted if you like.
To remove it navigate to this section at around line 478:

Code:
warnme = true;// As content changing breaks the ability to bind actions. Set warnings for tab changes.
$('#pagechangednotify').show();
$('#pagechangednotify').text('Page has unsaved changes');
$('input[type=submit]').css('border-color','#CC0000');
$('#cancel-updates').show();

If you delete all that then it will no longer warn you when changing tabs. If you delete only the "warnme = true" part then the popup will be gone and the red border around the save button and "page unsaved changes" will still turn on upon changing tabs.

There is a secondary warning too, which you can choose to leave or delete (turn off). When clicking on the magnifying glass to bring up the tab locations, and then clicking on a tab. It will warn you before redirecting the page to that tabs location. To remove that warning navigate to this part of the code at line 204:

Code:
$link_begin = '<element'.$hand.'onClick="window.opener.location.reload(true);window.opener.warnme=true;window.opener.location.href=\''.get_site_url(false).'/admin/edit.php?id=';

And remove this section from within there:

Code:
window.opener.warnme=true;

As to the template thing. Yeah I know that is a pain. There is one semi-work around, which is to use "insert_page_content();" with empty brackets for your main content as that will follow through to any other template that uses it. Should be noted that information is never really deleted, but hidden. If a page has information filled in and the template is swapped to a new one without that tab name. The info will sit there dormant until a template with the tab name is made active again. I'm thinking about adding a config screen with a "clear all unused tabs" button at some stage, just to clear out extra information.

Fear not. Sorting out that dropdown is on my todo list. Definitely. Any development tips would be great too!

Thanks a lot for the feedback! I'm glad you're liking this. Let me know if you have any more suggestions or ideas. Smile
Reply
#63
(2012-11-08, 21:12:49)jason.dixon.email Wrote: Files like .DS_store?

Top-level directory __MACOSX (containing old revisions? Dunno, not a Mac person. Tongue ). It may be hidden under OSX by default.

(2012-11-08, 21:12:49)jason.dixon.email Wrote: As to the template thing. Yeah I know that is a pain. There is one semi-work around, which is to use "insert_page_content();" with empty brackets for your main content as that will follow through to any other template that uses it. Should be noted that information is never really deleted ...

You misunderstood. In a bare GS install, if content is written and the page saved without entering a page title, everything is lost as GS refreshes the page to default (i.e., empty and with default page options) with the save error ("Error: You cannot save a page with an empty title or slug."). Not a SIT problem, but the risk is increased if it's necessary to change the template and then save before the tabs are shown. I can't offer a solution. I understand that you save all the tab text in a single file, so it's not lost if the template changes or if the SIT plugin is disabled.

Thanks for the other workaround tips – I may or may not try them! I should add that none of my comments concern real show-stoppers.

Edit to add (off topic): Apparently, you need to look at ZipCleaner or BetterZip (maybe others) to address the shortcomings of OSX's context-menu archive tool. Wink
--
Nick.
Reply
#64
(2012-11-08, 22:22:50)hameau Wrote:
(2012-11-08, 21:12:49)jason.dixon.email Wrote: Files like .DS_store?

Top-level directory __MACOSX (containing old revisions? Dunno, not a Mac person. Tongue ). It may be hidden under OSX by default.

(2012-11-08, 21:12:49)jason.dixon.email Wrote: As to the template thing. Yeah I know that is a pain. There is one semi-work around, which is to use "insert_page_content();" with empty brackets for your main content as that will follow through to any other template that uses it. Should be noted that information is never really deleted ...

You misunderstood. In a bare GS install, if content is written and the page saved without entering a page title, everything is lost as GS refreshes the page to default (i.e., empty and with default page options) with the save error ("Error: You cannot save a page with an empty title or slug."). Not a SIT problem, but the risk is increased if it's necessary to change the template and then save before the tabs are shown. I can't offer a solution. I understand that you save all the tab text in a single file, so it's not lost if the template changes or if the SIT plugin is disabled.

Thanks for the other workaround tips – I may or may not try them! I should add that none of my comments concern real show-stoppers.

Made a quick update to 1.8d. Fixed those debug errors. Added in a config option for you, or anyone else to toggle the pop up (true/false) till I can figure out a better work around. Angel

I don't think I can do anything about the whole content entering and disappearing thing that the CMS does. Might have to make a request to the developers about that one. I agree with you too that it is a pain (hence why the welcome message has a little comment alluding to the need to put in a page title. Tongue )

The show must go on!
Reply
#65
(2012-11-08, 22:39:37)jason.dixon.email Wrote: Made a quick update to 1.8d. Fixed those debug errors. Added in a config option for you, or anyone else to toggle the pop up (true/false) till I can figure out a better work around.

Most of the string offsets are now clean, but I get this in each of the SIT fields on the public web pages:
Code:
Notice: Undefined index: display in /var/www/gs312/plugins/simple_input_tabs.php on line 211 Notice: Undefined index: display in /var/www/gs312/plugins/simple_input_tabs.php on line 191

and this in the Page Options of the Edit Page screen in the admin:
Code:
Notice: Undefined offset: 1 in /var/www/gs31/plugins/simple_input_tabs.php on line 561

SIT is working correctly and all content fields are rendered along with the debug notices.

I'm not sure what you mean about the pop-up. I never get any pop-up with tab clicks, only when I move away from the page without saving changes (even though no actual changes to content have been made). I haven't fully explored the config aspects yet.

The disappearing content is not a SIT issue. See this thread.
--
Nick.
Reply
#66
(2012-11-09, 01:50:38)hameau Wrote:
(2012-11-08, 22:39:37)jason.dixon.email Wrote: Made a quick update to 1.8d. Fixed those debug errors. Added in a config option for you, or anyone else to toggle the pop up (true/false) till I can figure out a better work around.

Most of the string offsets are now clean, but I get this in each of the SIT fields on the public web pages:
Code:
Notice: Undefined index: display in /var/www/gs312/plugins/simple_input_tabs.php on line 211 Notice: Undefined index: display in /var/www/gs312/plugins/simple_input_tabs.php on line 191

and this in the Page Options of the Edit Page screen in the admin:
Code:
Notice: Undefined offset: 1 in /var/www/gs31/plugins/simple_input_tabs.php on line 561

SIT is working correctly and all content fields are rendered along with the debug notices.

I'm not sure what you mean about the pop-up. I never get any pop-up with tab clicks, only when I move away from the page without saving changes (even though no actual changes to content have been made). I haven't fully explored the config aspects yet.

The disappearing content is not a SIT issue. See this thread.

Yeah that is what I meant by popups. Smile

Anyway I managed to work around the issue with save data. It should work as expected now. No more config option. Those notices should all be sorted too, and can you do me a favour? If you download this version 1.8e. Can you let me know if those invisible mac files still exist? I can't tell, haha. Big Grin

1.8e release.
Reply
#67
(2012-11-09, 02:14:57)jason.dixon.email Wrote: Anyway I managed to work around the issue with save data. It should work as expected now. No more config option. Those notices should all be sorted too, and can you do me a favour? If you download this version 1.8e. Can you let me know if those invisible mac files still exist?

In reverse order:
- .zip archives are now clean. Smile
- debug notices have gone. Smile
- 'content changed' flag (for want of the correct term) ... read on. Sad

If I change content in the 'Main' tag, the 'Save Changes' button is highlighted and I need to save before leaving the page, so that bit works okay.

If I only change tabs, without changing any content, I can leave the page without warning and without having to save, also correct.

However, if I only change content in tabs other than 'Main', there is no button highlighting and I can leave the page without saving the changes and with no warning – not so good.
--
Nick.
Reply
#68
Hmm... that isn't happening for me. Works perfectly on my machine.

What are your tab names? Other plugins in use?

On line 481 do you have this line of code:

Code:
CKEDITOR.instances['post-content'].document.on("keyup", function () {
$('#editform').trigger('change');});//        Reactivate the save changes warning system.

Just making sure I didn't accidentally upload an incorrect version. Tongue
Reply
#69
(2012-11-09, 11:24:00)jason.dixon.email Wrote: What are your tab names? Other plugins in use?

On line 481 do you have this line of code ...
Okay, it gets complicated now.

First: yes, I have that code at lines 481-482.

On a clean install of GS3.1.2, with only SIT enabled (Innovation and Anonymous Data plugins have been uninstalled). Debian LAMP server with PHP 5.3.3-7+squeeze14. Modified the Cardinal theme with insert_page_content() (Main) and insert_page_content('sidebar') (Sidebar). No other changes to the template.

Open page for editing, type anything in the WYSIWYG (insert or delete) and the page is flagged for saving – correct.

Open page for editing, change to a different tab (even if the tab is then changed back to the initial display) and the page is never flagged for saving, no matter what changes are made – wrong.

Open page for saving, change tab, do whatever. Then change the editor view to 'Source' and make changes: the page is immediately flagged for saving.

If changes are made without setting the save flag, the revised content is saved correctly on clicking 'Save Updates'.

Over to you. Wink
--
Nick.
Reply
#70
(2012-11-10, 04:58:50)hameau Wrote: Over to you. Wink

Ah bugger. Tongue

Righto I'm on it.

EDIT: ok maybe some progress on the problem hunting. Are you using Firefox by any chance?
Reply
#71
1.8f

I managed to replicate the issues you had by using Firefox. Maybe you were using it? I don't know but this update fixes the problems I found. It seems sorted to me. Let me know if it is working for you. Smile
Reply
#72
(2012-11-10, 21:58:05)jason.dixon.email Wrote: Let me know if it is working for you.

Yes, that's it. Really sorry for not double-checking in a different browser.

Okay, now on to the feature requests. Big Grin
--
Nick.
Reply
#73
Silently following this thread
(I am building a two column layout site, so this is very helpfull)

I was having some problems losing data from all but active tab after saving sometimes. But that seems solved! (Will do some more testing.)

Small other thing (I use a custom css for the backend)
-Active-tab-colour's not working (an .active-tab class would be nice)

Great work,
<º)))><
Reply
#74
Some early requests.

* Option to disable default content in empty tabs, including that in the 'Main' tab for an empty page. It's okay the first time or two, but quickly becomes a nuisance having to remove it (especially as the Main field has a non-obvious empty paragraph at the beginning).

* Following on from above, allow empty tabs. It may not be necessary to fill all places for all pages. As a further refinement, the ability to tag an entry field as required (so must have content) or optional (so can be empty). This could be in addition to or (my preference) in place of the existing 'content not found' error.

* A (PHP level) signal to show that content was not available to render (e.g., a field is empty or a redirected tab is not available/missing/empty). Perhaps something like the return value seen in many of mvlcek's I18N_ series plugins, where return true indicates successful output. See for example the function outputContent in i18n_base/frontend.class.php and the mention here. This allows quick and elegant logical content selection.

In all, I think this plugin is much more useful than might first appear (to the doubters). Although its features can already be achieved by other means, it is really easy to use and certainly fits well with the ideals of GetSimple, imo. Thank you.

Edit: typo.
--
Nick.
Reply
#75
(2012-11-10, 23:42:15)uitdecom Wrote: Silently following this thread
(I am building a two column layout site, so this is very helpfull)

I was having some problems losing data from all but active tab after saving sometimes. But that seems solved! (Will do some more testing.)

Small other thing (I use a custom css for the backend)
-Active-tab-colour's not working (an .active-tab class would be nice)

Great work,
Hmm little worried about data loss. Let me know if you have any issues.

Ah yeah. The active tab colour config option is (currently) for the non-javascript style. This plugin is using the same tab CSS colours (in reverse) as the page tabs along the top navigation.

I can add another CSS for the active tab. No problem. Smile

(2012-11-11, 01:54:51)hameau Wrote: Some early requests.

* Option to disable default content in empty tabs, including that in the 'Main' tab for an empty page. It's okay the first time or two, but quickly becomes a nuisance having to remove it (especially as the Main field has a non-obvious empty paragraph at the beginning).
The empty paragraph is intentional. Otherwise you end up typing in Header 1 size after deleting everything. Tongue
I'm thinking it might be time to add a proper settings menu. Didn't really have enough cosmetic options to warrant it before but this would be a perfect candidate.

Quote:* Following on from above, allow empty tabs. It may not be necessary to fill all places for all pages. As a further refinement, the ability to tag an entry field as required (so must have content) or optional (so can be empty). This could be in addition to or (my preference) in place of the existing 'content not found' error.
You can turn off the content not found error currently. There is an option in the code if you open it with a text editor, near the top. You can specify the default content in the template, so could leave a message mentioning content is optional. I'll need to make sure that it doesn't save that default text though.

Quote:* A (PHP level) signal to show that content was not available to render (e.g., a field is empty or a redirected tab is not available/missing/empty). Perhaps something like the return value seen in many of mvlcek's I18N_ series plugins, where return true indicates successful output. See for example the function outputContent in i18n_base/frontend.class.php and the mention here. This allows quick and elegant logical content selection.

I'll check that out. If it outputs nothing (ie no error) though, isn't that enough to get a true/false reading?
EDIT: You can use return_tab_content("tabname"); to get the content already. I imagine this would also work to check if content exists or not:
Code:
<?php if(return_tab_content("mytab")){ echo "Content exists!"; } else { echo "There is no content."; } ?>

Quote:In all, I think this plugin is much more useful than might first appear (to the doubters). Although its features can already be achieved by other means, it is really easy to use and certainly fits well with the ideals of GetSimple, imo. Thank you.

Edit: typo.

There are doubters? Cool
Reply




Users browsing this thread: 2 Guest(s)