public static function get_pref_tab($json_conf, $test_conf) { $tab = ''; $rm = new RecipeManager(); $rm->loadAvailableRecipes(); $tab .= '<div data-dojo-type="dijit/layout/TabContainer" style="width: 100%; height:100%">'; /* Config tab */ $tab .= '<div data-dojo-type="dijit/layout/ContentPane" title="Configuration" data-dojo-props="selected:true" id="config">'; $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 .= '<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 .= '<label for="addrecipe">' . __("Add recipe") . ': </label>'; $tab .= '<select dojoType="dijit.form.Select" name="addrecipe">'; foreach ($rm->getRecipes() as $key => $recipe) { $tab .= '<option value="' . $recipe . '">' . $key . '</option>'; } $tab .= '</select> '; $tab .= '<button dojoType="dijit.form.Button" type="submit">' . __("Add") . '</button>'; $tab .= '</form><p /><div id="json_error"></div><br />'; $tab .= __("Save after adding config!") . '<br />'; $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); dojo.query("#json_export_wrapper").attr("class","notice"); '); $tab .= '<label for="recipe">' . __("Export") . ': </label>'; $tab .= '<select dojoType="dijit.form.Select" name="recipe">'; foreach (json_decode($json_conf, true) as $key => $config) { if ($key != 'debug') { $tab .= '<option value="' . $key . '">' . (isset($config['name']) ? $config['name'] : $key) . '</option>'; } } $tab .= '</select> '; $tab .= '<button dojoType="dijit.form.Button" type="submit">' . __("Export") . '</button>'; $tab .= '</form><p />'; $tab .= '<div id="json_export_wrapper"><pre id="json_export"></pre></div>'; $tab .= '</div>'; /* Testing tab */ $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 .= __("Save before you test!") . '<br />'; $tab .= '<table width="100%">'; $tab .= '<tr><td>'; $tab .= 'URL:'; $tab .= '</td></tr>'; $tab .= '<tr><td>'; $tab .= '<input dojoType="dijit.form.TextBox" name="test_url" style="font-size: 12px; width: 99%;" />'; $tab .= '</td></tr>'; $tab .= '<tr><td>'; $tab .= 'Config (optional, will override default configuration):<button dojoType="dijit.form.Button" type="button">' . __("Restore last config") . '<script type="dojo/on" event="click" args="evt"> evt.preventDefault(); dojo.query("#test_conf").attr("value", ' . json_encode($test_conf) . '); </script> </button>'; $tab .= '</td></tr>'; $tab .= '<tr><td><textarea dojoType="dijit.form.SimpleTextarea" id="test_conf" name="test_conf" style="font-size: 12px; width: 99%; height: 150px;"></textarea>'; $tab .= '</td></tr>'; $tab .= '</table>'; $tab .= '<p><button dojoType="dijit.form.Button" type="submit">' . __("Test") . '</button> <input id="verbose" dojoType="dijit.form.CheckBox" name="verbose" /><label for="verbose">' . __("Show every step") . '</label> </p>'; $tab .= '</form>'; $tab .= '<div data-dojo-type="dijit/layout/TabContainer" style="width: 100%; height: 75%">'; $tab .= '<div data-dojo-type="dijit/layout/ContentPane" title="log" data-dojo-props="selected:true" id="test_log"></div>'; $tab .= '<div data-dojo-type="dijit/layout/ContentPane" title="result" data-dojo-props="selected:true" id="test_result"></div>'; $tab .= '<div data-dojo-type="dijit/layout/ContentPane" title="url" data-dojo-props="selected:true" id="test_url"></div>'; $tab .= '</div>'; $tab .= '</div>'; $tab .= '</div>'; return $tab; }
<?php require_once "includes/header.php"; require_once "includes/recipeManager.php"; require_once "includes/productManager.php"; $aAllRecipes = RecipeManager::getAllRecipes(); $aAllProducts = ProductManager::getAllProducts(); ?> <h1 class="textAlignCenter">"Get In My Belly!"</h1> <ul class="header1Home textAlignCenter marginBottom50"> <li class="bodyTextItalic">1. a phrase one says to express enjoyment of good food.</li> <li class="marginNone bodyTextItalic">2. the go-to healthy (gr)hub to satisfy the rumblings of a hungry belly.</li> </ul> <!-- main call-to-actions section --> <div class="mainImageHome eight columns floatLeft"> <img src="images/homeCookImage.jpg" alt="recipes-call-to-action-image" /> <div class="overlay"> <i class="fa fa-cutlery displayBlock headerIcon colour3A paddingTop50"></i> <h2 class="textAlignCenter paddingTop10">Make</h2> <p class="textAlignCenter colour44">A collection of healthy recipes, fit for hungry tastebuds.</p> <div class="blueButton bgBlue textAlignCenter"><a href="recipesLanding.php">See Recipes</a></div> </div> </div> <div class="mainImageHome eight columns floatLeft"> <img src="images/homeBuyImage.jpg" alt="shop-call-to-action-image" /> <div class="overlay"> <i class="fa fa-tag displayBlock headerIcon colour3A paddingTop50"></i> <h2 class="textAlignCenter paddingTop10">Buy</h2> <p class="textAlignCenter colour44">Feel-good eats to satisfy cravings.</p> <div class="blueButton bgBlue textAlignCenter"><a href="shop.php">Shop Now</a></div> </div>
function add() { $conf = $this->getConfig(); $recipe2add = $_POST['addrecipe']; Feediron_Logger::get()->log(Feediron_Logger::LOG_TTRSS, "recipe: " . $recipe2add); $rm = new RecipeManager(); $recipe = $rm->getRecipe($recipe2add); header('Content-Type: application/json'); if (!isset($recipe['match'])) { $json_reply['success'] = false; $json_reply['errormessage'] = __('Github API message: ') . $recipe['message']; $json_reply['data'] = Feediron_Json::format(json_encode($recipe)); echo json_encode($json_reply); return false; } if (isset($conf[$recipe['match']])) { $conf[$recipe['match'] . '_orig'] = $conf[$recipe['match']]; } $conf[$recipe['match']] = $recipe['config']; $json_reply['success'] = true; $json_reply['message'] = __('Configuration updated.'); $json_reply['json_conf'] = Feediron_Json::format(json_encode($conf)); echo json_encode($json_reply); }