How to handle unattended mode in custom form components? - install4j

I finally created my first custom form component and it works like a charm in GUI mode. Now I have to fullfill a requirement that also the silent installation should work. The documentation said to override the handleUnattended() method. But there is not mentioned which other methods will be called during the lifecycle of the custom form.
I implemented the validation of the user input inside the checkComplete() method and depending on the validation result I set a variable to the installer context and switch to the next screen. Will this method also be called after the handleUnattended() method or is this only a method for the GUI mode installation?
And how to get the "user input" from the varfile-file? I suppose to get the variable from the installer context like context.getVariable("some-input"). Is it correct?
Thanks in advance
Hardie

During my research I can answer some questions by myself:
1) checkComplete() is also called independed of the implementation of handleUnattended()
2) vafile arguments are reachable from the installer context
3) with context.isUnattended() it is possible to check, whether you have to display an error dialog or exit the installer process.
Please correct me, if there are any missunderstandings.

Related

Course completion report is not working properly it showing the wrong output

i am trying to implement the course completion status block in my moodle to check this i made a student account in that status is showing pending and also other status is not working correctly i give the course completion setting and activity completion setting. And if i click on "More Details" this page is opening (picture 2) in which it also showing incomplete and complete the quiz and pass also still it showing incomplete.
And after this i check in admin from course report so this also reflecting there, in (picture 3) self completion and course complete is unmarked.
I need this to check the student is complete the task properly so i can provide the certificate to him "not custom certificate".
So Anyone could please suggest something?
First of all you have to check that your cron file is working or not for that go to administration>server>scheduled task in that check for the completion regular task is working if not then first work for you cron then it will automatically work.
And your self completion is still not responding after that this is because you didn't add the self completion so add this block and manually complete the course and then it will properly.
For cron i suggest you only go for moodle docs only and then implement it.

Automatic handling of errors/warnings

On a linking error, I can raise appropriate diagnostic (say MyDSL.MY_APPROPRIATE_DIAGNOSTIC) and then write, in MyDSLQuickfixProvider, a quick fix for it by annotating it in this way:
#Fix(MyDSL.MY_APPROPRIATE_DIAGNOSTIC)
public void fixMyAppropriateDiagnostic(final Issue issue, final IssueResolutionAcceptor acceptor) {
...
}
What about if I wanted to automatically resolve a diagnostic, i.e. automatically execute an IModification without propose it to the user as quick fix (imagine the quick fix for the diagnostic is unique)?
Is there a way to associate a (immediate) handling code to a diagnostic in a similar manner to what happens for (user-proposed) quick fixes?
Thanks in advance,
Marco
There is no way to set a quick fix to be executed automatically. Your alternatives are:
Invoke the marker resolution code from somewhere else in your code. I.e. while marker resolutions are typically triggered explicitly on user request using the problems view, ruler buttons and similar UI, you could invoke them from anywhere. Be sure that you don't interfere with quickfixes, which are not from your plugin and make sure your users are not surprised by this non-eclipse workflow.
For some issues you may be able to instead create code completion rules or templates. Those are still not fully automatic as requested, but basically you can already "correct" partial user input that way and avoid flagging a violation for the complete input.

How to check my action is being executed in Zend Framework

In zend framework, what is the best way to be sure that my controller action is being executed and how can i check different values of the variables in the actions. (Without using debugger)
var_dump() (see manual page)
or
Zend_Log to any number of destinations. See: http://framework.zend.com/manual/en/zend.log.writers.html
or
Zend_Log_Writer_Firebug() for FireBug/FirePHP logging is my favourite. See: http://www.christophdorn.com/Blog/2008/09/02/firephp-and-zend-framework-16/
Put die(Zend_Debug::dump($anyVariable)); on the line you want to make sure is executed :)
As an addition to the other answers (using die() & var_dump/Zend_debug), I'll advise you ZFDebug toolbar
It can show you some relevant informations about the current request.

ZEND plugin running twice. Why or how to simulate it?

Im hours and hours finding why one of my ZEND plugin sometimes running twice (depends on URL)
Note that my plugin has preDispatch and postDispatch methods and when I debugging the code it works like this:
MY_Plugin:preDispatch (echo $_SESSION['DBG'] has value)
MY_Plugin:postDispatch (unset($_SESSION['DBG']))
and then again
MY_Plugin:preDispatch (echo $_SESSION['DBG'] not exist)
MY_Plugin:postDispatch
This is part of bootstrap code
$_SESSION['DBG'] = 'value';
$MYrouter = new MY_Router_MyRouter();
$frontController->setRouter($MYrouter);
$frontController->registerPlugin(new MY_Plugin());
Do you have any suggestion how this could occur or how can I simulate this.
Thanks for any suggestion
Cervenak
Thanks guys for lot of valuable hints.
Now watch my story :)
First I had turned off showing exceptions (parameter False). So I switch them ON to see exception notification.
$frontController->throwExceptions(true);
Than I saw that I dont have uploaded controller and view files. After uploading them ZEND started to work corectly.
Good to know to have this direction set ON during debugging. You could probably save hours.
The dispatcher loop most likely running twice (the controller is dispatched twice). Possible causes:
using action view helper
calling _forward
redirector action helper
manually calling dispatch()
dispatch loop aborted and started again (eg. resetting request params)
Also, take a look at this ZF flow diagram (hotlinked from php-professionals.com)
Another reason could be an missing favicon.ico :-)
If the Apache cant find it, it fires a second request.

Periodically calling TinyMCE's triggerSave function

If anyone knows TinyMCE well, do you know if it has built-in support for periodically calling its triggerSave function?
(This function copies it's content to its "parent" textarea. I want to observe said textarea for changes so I can implement autosave.)
Thanks
Don't try autosave, trust me on this one. triggerSave is buggy and when it fails it fails silently so you think that your content got posted, but in reality it didn't. After it fails once it will no longer work for the rest of the session, as in until the page is manually reloaded and tinymce does another full init().
Just got bit by this one badly, again. Never again trust triggerSave.
You could easily do this yourself by using JavaScript's setTimeout() function.
See http://www.w3schools.com/js/js_timing.asp.