Skip to content

Commit

Permalink
TTRSS JS compatability changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dugite-code committed Jan 14, 2019
1 parent 71f3e4a commit 2e83ce0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions PrefTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ public static function get_pref_tab($json_conf, $test_conf){
$tab .= '<h3>Configuration</h3>';
$tab .= '<a href="https://github.com/m42e/ttrss_plugin-feediron/blob/master/README.md">Configuration help</a>';
$tab .= self::get_form_start('save');
$tab .= self::get_script(' notify_info(transport.responseJSON.message); dojo.query("#json_conf").attr("value",transport.responseJSON.json_conf); dojo.query("#json_error").attr("innerHTML", "").attr("class",""); ','dojo.query("#json_error").attr("innerHTML", transport.responseJSON.json_error).attr("class","error");');
$tab .= self::get_script(' Notify.info(transport.responseJSON.message); dojo.query("#json_conf").attr("value",transport.responseJSON.json_conf); dojo.query("#json_error").attr("innerHTML", "").attr("class",""); ','dojo.query("#json_error").attr("innerHTML", transport.responseJSON.json_error).attr("class","error");');

$tab .= '<textarea dojoType="dijit.form.SimpleTextarea" id="json_conf" name="json_conf" style="font-size: 12px; width: 99%; height: 400px;">'.$json_conf.'</textarea>';

$tab .= '<p /><button dojoType="dijit.form.Button" type="submit">'.__("Save").'</button>';
$tab .= '</form>';


$tab .= '<h3>Add predefined rules</h3>';
$tab .= self::get_form_start('add');
$tab .= self::get_script('notify_info(transport.responseJSON.message); dojo.query("#json_conf").attr("value",transport.responseJSON.json_conf); ');
$tab .= self::get_script('Notify.info(transport.responseJSON.message); dojo.query("#json_conf").attr("value",transport.responseJSON.json_conf); ');

$tab .= '<label for="addrecipe">'.__("Add recipe").': </label>';
$tab .= '<select dojoType="dijit.form.Select" name="addrecipe">';
Expand All @@ -36,7 +36,7 @@ public static function get_pref_tab($json_conf, $test_conf){

$tab .= '<h3>Export rules</h3>';
$tab .= self::get_form_start('export');
$tab .= self::get_script('notify_info(transport.responseJSON.message); console.log(transport); dojo.query("#json_export").attr("innerHTML",transport.responseJSON.json_export);
$tab .= self::get_script('Notify.info(transport.responseJSON.message); console.log(transport); dojo.query("#json_export").attr("innerHTML",transport.responseJSON.json_export);
dojo.query("#json_export_wrapper").attr("class","notice"); ');

$tab .= '<label for="recipe">'.__("Export").': </label>';
Expand All @@ -56,7 +56,7 @@ public static function get_pref_tab($json_conf, $test_conf){
$tab .= '<div data-dojo-type="dijit/layout/ContentPane" title="Testing" data-dojo-props="selected:true" id="testing">';
$tab .= self::get_form_start('test');

$tab .= self::get_script('notify_info("Updated"); dojo.query("#test_url").attr("innerHTML", "<pre>"+transport.responseJSON.url+"</pre>"); dojo.query("#test_result").attr("innerHTML", transport.responseJSON.content); dojo.query("#test_log").attr("innerHTML", transport.responseJSON.log.join("\n")); dojo.query("#test_conf").attr("value", transport.responseJSON.config);');
$tab .= self::get_script('Notify.info("Updated"); dojo.query("#test_url").attr("innerHTML", "<pre>"+transport.responseJSON.url+"</pre>"); dojo.query("#test_result").attr("innerHTML", transport.responseJSON.content); dojo.query("#test_log").attr("innerHTML", transport.responseJSON.log.join("\n")); dojo.query("#test_conf").attr("value", transport.responseJSON.config);');

$tab .= __("Save before you test!").'<br />';
$tab .= '<table width="100%">';
Expand Down Expand Up @@ -87,7 +87,7 @@ public static function get_pref_tab($json_conf, $test_conf){
$tab .= '</div>';
$tab .= '</div>';
return $tab;
}
}
private static function get_script($successaction,$failaction=''){
$script = '<script type="dojo/method" event="onSubmit" args="evt">
evt.preventDefault();
Expand All @@ -96,7 +96,7 @@ private static function get_script($successaction,$failaction=''){
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
if (transport.responseJSON.success == false){
notify_error(transport.responseJSON.errormessage);
Notify.error(transport.responseJSON.errormessage);
'.$failaction.'
}else{
'.$successaction.'
Expand Down

0 comments on commit 2e83ce0

Please sign in to comment.