Jump to content

Download: IP.Board Notices System


Enkidu

Recommended Posts


Hi,



Is it possible to display a message only on certain IPC pages? I see the option for all ICP pages, but not specific ones. If not, can I suggest it as a feature please. That'd pretty much be the icing on the cake for this app :smile:




I've been thinking about how to add full support to IPC. Right now the idea is to add an option to IPC that will allow you to create a notice system block that you can parse any where you like. That would give you virtually an absolute freedom about where to parse your notices.

It is one of the secrete features of the next version though.
Link to comment
  • Replies 573
  • Created
  • Last Reply

No, that doesn't work. So I just changed it to display on all pages, rather than a URL. That doesn't work either? I've got it set to show all primary usergroups, so that rules out that issue.




ah so the issue is elsewhere. It's not because of the requested url but because of some other criteria that could never be met. I suspect that you're selecting all of the primary usergroup and all skins.

if you want the notice to be displayed to all usergroup then don't select any usergroup. if you want it to show on all skins then don't select any skin.

if I where you I would only fill the requested URL criterion and see what happens.
Link to comment

I will continue to expand and improve it in the next version



I have made small change to your script that prevents loading notices and then suppressing them if they are dismissed. It is ugly on large board because the notices show first, till the page loaded and then disappear.

Add to the template

<div class="viewport" style="display:none">[/CODE]

And then activate the viewport if something can be shown:

[CODE]this.elViewport.show(); this.viewportDimension=this.getViewportDimension();



Smart and very easy. No images or anything are loaded till viewport gets active. :)

Link to comment

I have made small change to your script that prevents loading notices and then suppressing them if they are dismissed. It is ugly on large board because the notices show first, till the page loaded and then disappear.



Add to the template


<div class="viewport" style="display:none">[/CODE]

And then activate the viewport if something can be shown:

[CODE]this.elViewport.show(); this.viewportDimension=this.getViewportDimension();



Smart and very easy. No images or anything are loaded till viewport gets active. :smile:



thank you

yeah I remember someone asked for the same thing. I'm glad that you decided to share with us :)

thanks
Link to comment

Enkidu, I have looked into the hook. The selection of the group cannot work in your mod. As you use in_array for multidimensional array with buggy index. I was also suprised to see that you save criterias as BLOB in database. Any reason for this? Your mod produces a lot of PHP warnings because of buggy arrays. E. g. you save group criteria like this


 [1] => Array

        (

            [] => 2

            [1] => 3

            [2] => 4

        )



Will look into this deeper but it seems that a lot of rewriting is needed before using your mod on production site. Still it is very very nice idea, I like it really. But the quality of the code... Sorry, you should improve it :(

Link to comment

Enkidu, I have looked into the hook. The selection of the group cannot work in your mod. As you use [u]in_array[/u] for multidimensional array with buggy index. I was also suprised to see that you save criterias as BLOB in database. Any reason for this? Your mod produces a lot of PHP warnings because of buggy arrays. E. g. you save group criteria like this




[1] => Array

		(

			[] => 2

			[1] => 3

			[2] => 4

		)



Will look into this deeper but it seems that a lot of rewriting is needed before using your mod on production site. Still it is very very nice idea, I like it really. But the quality of the code... Sorry, you should improve it :sad:



1- We used BLOB because there is no way you can know the size of the criteria. I started this mod with a handful of criteria and now they are 20+ and will continue to increase. yet I haven't have to care about upgrade issues from this side of the code. There are other considerations regarding performance and future criteria types which might as well be binary based such as image based criterion.

2- IPB has its framework of checking whether a user is part of group or not. However, this mod is unique in that it will allow you to distinguish between primary and secondary group based matching. This will give more control to you albeit the code may look redundant.

3- Why do you need to re-write the mod? I mean looking at your reasoning, I couldn't see where you're having a performance or a security concern that will prevent you from using it on a production environment like all of the boards the mod is currently installed on.

While mods developers like me can't afford to write 5 stars code as production time equals money equals risk and you need to calculate the risk of spending more time in development vs how much sales you anticipate the mod to generate. But once the mod has succeeded you start improving.

Sorry but I did business and it is really not a good idea to start big in a risky environment such as mod writing. You can't pay the bills by selling apps and you can't be 100% sure that you succeed.

I know that all of the above doesn't apply to you but I could lie to you and give you ridiculous reasons as to why I choose this over that but I would lying, The main reason is risky to spend hundreds of hours writing the perfect mod as if I'm writing for a big company. By the end of the day, my clients won't see the difference.

finally, what are the php warnings you're having?
Link to comment

Enkidu,


1- We used BLOB because there is no way you can know the size of the criteria. I started this mod with a handful of criteria and now they are 20+ and will continue to increase. yet I haven't have to care about upgrade issues from this side of the code. There are other considerations regarding performance and future criteria types which might as well be binary based such as image based criterion.



Wrong. You can use serialized field. See the field ips_members.members_cache as example if you do not know what serialized means.


2- IPB has its framework of checking whether a user is part of group or not. However, this mod is unique in that it will allow you to distinguish between primary and secondary group based matching. This will give more control to you albeit the code may look redundant.



Wrong. IPS has a framework to check primary AND secondary group (true/false), see the API for IPSMember::isInGroup. This has nothing to do with be unique. Just with not using standard API :smile:. It is enough to have a checkbox for secondary groups Yes/No.


3- Why do you need to re-write the mod? I mean looking at your reasoning, I couldn't see where you're having a performance or a security concern that will prevent you from using it on a production environment like all of the boards the mod is currently installed on.



We have to get rid of errors (e. g. group restriction does not work). We have to get rid of PHP warnings. In my previous post I have written how to improve the performance. There is also a problem that new notices do not show once user dismisses the old notices. Performance issue. If you "open" the dismissed notices, the page is reloaded - it is additional call and not needed. We have also to change template to ensure that large images and text do not overlay and scrolling bar is shown in this case.


While mods developers like me can't afford to write 5 stars code as production time equals money equals risk and you need to calculate the risk of spending more time in development vs how much sales you anticipate the mod to generate. But once the mod has succeeded you start improving.



It is not about improving, it is about a code quality. You can start to write clean code from the very beginning or release your mod as alpha or beta, if it is of poor quality or not tested. This is the way how development normally done. Alpha means - there are issues and I am aware of. Beta means - I believe there are no issues, but it must be tested. Stable means - there are no issues, tested and released.


By the end of the day, my clients won't see the difference.



Well, if restrictions of the group in your mod does not work, but suggested as feature and your clients do not see the difference, it's may be OK for you, but not for me :smile: If there is a performance issue with needless reloading of the page, it may be no difference for the small boards, but not for me :smile: But I am happy to hear that your clients are satisfied.


finally, what are the php warnings you're having?



You should use error_reporting while developing and not ask your clients what warnings they see.

Enkidu, again. The idea of your mod is perfect and I like it very much. It is not about money here. The price is fair for me. It is just about code quality.
Link to comment

Apparently it was my fault that I replied to you. Please provide your paypal email so I can refund your money and you can keep the app.

I'm sorry but you don't get to be destructive especially with your shallow understanding of php, IPB framework and development cycle in general.

Link to comment

with your shallow understanding of php, IPB framework and development cycle in general.




Just some words about your deep understanding of PHP and IPB Framework.
1. Are you aware that there is a DB API in IPB? Yes? Then explain the purpose of the function SaveToDB() in your code. Sensless.
2. Please explain me what this function does with your perfect understanding of PHP:


	public function AddNotice($ErrorString, $Notice_ID, $form) {

		if (!strlen($ErrorString)) {

			$this->registry->output->html .= $this->html->AddNotices($Notice_ID, $form, $ErrorString);

		} else {

			$this->registry->output->html .= $this->html->AddNotices($Notice_ID, $form, $ErrorString);

		}

	}

3. Why using API if we can write a long and funny code like this:



// get current skins and their IDs

$this->DB->build( array( 'select' => 'set_id, set_name,set_master_key',

'from'   => 'skin_collections',

'order'  => 'set_id'

) );

$SkinQuery = $this->DB->execute();

$RowSize = $this->DB->GetTotalRows($SkinQuery);

$SkinList = '<SELECT class="dropdown" NAME="SkinMultiSel[]"  multiple="multiple" SIZE=' . $RowSize . '>';

if ($form['SkinMultiSel'] && in_array(0, $form['SkinMultiSel'])) {

$SkinList .= '<OPTION SELECTED="SELECTED" VALUE="0"> default';

} else {

$SkinList .= '<OPTION  VALUE="0"> default';

}

while ( $row = $this->DB->fetch() )

{

if ($row['set_master_key'] != 'mobile') {

if ($form['SkinMultiSel'] && in_array($row['set_id'], $form['SkinMultiSel'])) {

$SkinList .= '<OPTION SELECTED="SELECTED" VALUE="' . $row['set_id'] . '">' . $row['set_name'];

} else {

$SkinList .= '<OPTION  VALUE="' . $row['set_id'] . '">' . $row['set_name'];

}

}

}

$SkinList .= '</SELECT>';

It would be too easy to use API and just not so much fun. The pretty code above would be just one line:


$SkinList = ipsRegistry::getClass('output')->formMultiDropdown('SkinMultiSel[]', ipsRegistry::getClass('output')->generateSkinDropdown(), $form['SkinMultiSel'] ? explode(',', $form['SkinMultiSel']) : '');


I can give you another 10 examples in your code where you do the same senseless stuff.

4. Ask yourself why you write HTML in PHP and PHP in templates? Surely, because you are PHP expert and experts do not need to know about separation of different layers.

5. Ask yourself why notice is not displayed if Birthday is selected and member's birthday is today? Or in February or in March? Try to figure it out yourself.

6. Ask yourself why message is not shown if skin is selected as criteria. A small tip $this->memberData['skin'] does not contain loaded skin.

7. Ask yourself why profile member field criteria does not work. A big tip, because you do not check it all.

....


Should I attach here rewritten and clean version of your mod, just for free, you, expert? :wink:

Link to comment

please, this is a support topic. If you don't require support, then please stop wasting my time and the time of others.



I will not waste your time any more. You had 2 ways: admit that your mod is not perfect and accept my free help or say I have "shallow understanding of php, IPB framework and development cycle in general". You have choosen the second way. I had just to defend myself and my knowledge. This was the purpose of my last post here. I wish you a nice day :)
Link to comment
  • 4 weeks later...

Enkidu - feature suggestion - be able to set the height of specific noticed would be handy. The more I use this having different notices dotted around, the more I notice that this would be extremely useful in keeping everything tidy. Some of my notices are just a couple of lines long, some are ten, but I can only set the overall height for all notices (which must be high enough to cater for ten lines, the others just have a lot of blank space).

Link to comment

Enkidu - feature suggestion - be able to set the height of specific noticed would be handy. The more I use this having different notices dotted around, the more I notice that this would be extremely useful in keeping everything tidy. Some of my notices are just a couple of lines long, some are ten, but I can only set the overall height for all notices (which must be high enough to cater for ten lines, the others just have a lot of blank space).




this is easy done however, the JS will resize itself on every notice which may look awkward
Link to comment

Resize itself? In what way, if it resized it self height wise, then that'd be fine surely? I don't fully understand what you're saying, sorry.




example:

1- notice 1: height 100px
2- notice 2: height 200px

now when you rotate these two notices, the initial height will be 100px but as soon as the second notice enters the viewport, the javascript needs to resize the view port in order to accommodate for the new height.

as a result, you will see an awkward resizing going on each transition. Here is an example of JS slider that does exactly that. You can see how awkward it is when you rotate the slides.

http://css-tricks.com/examples/AnythingSlider/

(see the second example)
Link to comment

Hi Enkidu,



There is an issue with the notices area when you resize the browser window, as one of my members reported

here

. As you resize the window, the notices area extends further and further downwards. Could this be fixed?




sorry to hear that, please download the file attached. Unpack it, then upload the contents of the upload directory to your board leaving the directory structure intact. it should overwrite the JS file already there.


cheers

upload.zip
Link to comment

sorry to hear that, please download the file attached. Unpack it, then upload the contents of the upload directory to your board leaving the directory structure intact. it should overwrite the JS file already there.




cheers



upload.zip


Thanks for fixing this so quickly!

I ran into another problem, actually - I tried to give super moderators access to the notices module in the ACP so they could set notices up as well, but it gives them a 404 error. Could you look into this as well, please?

I also have a few suggestions for future updates to the mod. It's extremely useful already, but these additions would make it even better:
  • more granular ACP restrictions - adding/changing, enabling/disabling, and deleting notices should be separate restrictions, like in many of IP.Board's own apps
  • a dismiss button on the 1.x-style template
  • an option to use the database to store the dismissal of a notice - this way, a user won't see a notice they dismissed when they log in from another computer
Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...