<div id="preferences-dialog" style="display: none" xmlns="http://www.w3.org/1999/html"> <div class="widget"> <div class="widget-title"> <div class="icon"> <i class="icon20 i-cube"></i></div> <h4>Agent preferences</h4> <i id="close_preferences" class="i-close close_dialog"></i> </div> <div id="content_preferences" class="widget-content" style="overflow: scroll"> <form class="form-horizontal" action="#"> <div class="control-group"> <label class="control-label" for="preferences_agentname"> Agent name </label> <div class="controls controls-row"> <input class="span4" type="text" id="preferences_agentname"> </div> </div> <div class="control-group"> <label class="control-label" for="Description">Description</label> <div class="controls controls-row"> <textarea id="Description_preferences" name="textarea" class="span4" rows="4"></textarea> </div> </div> <div class="control-group"> <label class="control-label" for="inputlimit">When an error occurs</label> <div class="controls controls-row"> <div class="option_preferences"> <table> <tr> <td> <select id="ErrorOccurs" style='width: 300px;'> <option value="ignore"> Ignore the error and continue running the Agent</option> <option value="stop"> Stop the Agent so the error can be fixed using the Agent Builder </option> <option value="cancel"> Cancel the Agent so that it starts from the beginning the next time it runs</option> </select> </td> </tr> <tr> <td> <input style="float: left" type="checkbox" name="postpone" id="postpone"/> <label style="float: left; margin-left: 10px" for="postpone">Postpone the job for </label> <select class="span1" style="float: left ; margin-left: 10px" id="postponetime"> <option value="5"> 5 min </option> <option value="15"> 15 min </option> <option value="30"> 30 min </option> <option value="60"> 60 min </option> </select> </td> </tr> <tr> <td> <input style="float: left" type="checkbox" name="ignore" id="ignore"/> <label style="float: left; margin-left: 10px" for="ignore">Ignore all website errors</label> </td> </tr> </table> </div> </div><!-- sdssd--> </div> <div class="control-group"> <label class="control-label" for="inputlimit">Settings</label> <div class="controls controls-row"> <table> <tr> <td> <input style="float: left" type="checkbox" name="DeleteOldItems" id="DeleteOldItems"/> <label style="float: left; margin-left: 10px" for="DeleteOldItems">Delete old items after completing successfully</label> </td> </tr> <tr> <td> <input style="float: left" type="checkbox" name="RunAnonymously" id="RunAnonymously"/> <label style="float: left; margin-left: 10px" for="RunAnonymously">Run anonymously</label> </td> </tr> <tr> <td> <input style="float: left" type="checkbox" name="DontCreate" id="DontCreate"/> <label style="float: left; margin-left: 10px" for="DontCreate">Do not create image/file packages</label> </td> </tr> </table> </div><!-- sdssd--> </div> <!-- End settign--> <div class="control-group"> <label class="control-label" for="inputlimit">Advanced Processing</label> <div class="controls controls-row"> <table> <tr> <td> <input style="float: left" type="checkbox" name="StopProcessing" id="StopProcessing"/> <label style="float: left; margin-left: 10px" for="StopProcessing">Stop processing a list when a duplicate item is found in the collection</label> </td> </tr> <tr> <td> <input style="float: left" type="checkbox" name="DontProcessMultiple" id="DontProcessMultiple"/> <label style="float: left; margin-left: 10px" for="DontProcessMultiple">Do not process multiple list items concurrently</label> </td> </tr> <tr> <td> <input style="float: left" type="checkbox" name="ImagesProcessing" id="ImagesProcessing"/> <label style="float: left; margin-left: 10px" for="ImagesProcessing">Request web page images during processing</label> </td> </tr> </table> </div><!-- sdssd--> </div> <!-- End settign--> </form> <div class="form-actions "> <div class="center"> <button id="save_preferences_2" class="btn btn-primary btn-small center"> <i aria-hidden="true" class="fa fa-save font17"></i>Save </button> <button id="close_preferences2" type="button" class="btn">Cancel</button> </div> </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function() { $( "#preferences-dialog" ).dialog({ autoOpen: false, height: 650, width: 720, modal: true }); $('#preferences').click(function(event) { // /preferences click //reset value preferences $('#postponetime').prop('disabled', true); $('#postpone').prop("checked", false); $('#ignore').prop("checked", false); $('#DeleteOldItems').prop("checked", false); $('#RunAnonymously').prop("checked", false); $('#DontCreate').prop("checked", false); $('#StopProcessing').prop("checked", false) $('#DontProcessMultiple').prop("checked", false); $('#ImagesProcessing').prop("checked", false); //Open dialig $( "#preferences-dialog" ).dialog( "open" ); var project_name = "<?php echo $n ?>"; var AccountID = "<?php echo $accID ?>"; var tablename_p = "<?php echo $tbname ?>"; //Ajax get description $.ajax({ type: "post", url: "preferences.ajax.action.php", data: { action: "get-description", name : project_name, AccountID : AccountID }, cache: false, success: function(data){ var data_project = JSON.parse(data); $('#Description_preferences').text(data_project.Description); $('#preferences_agentname').val(data_project.DisplayName); } }); //get detail description $.ajax({ type: "post", url: "preferences.ajax.action.php", data: { action: "show_detail_preferences_table", name : "<?php echo $n ?>", AccountID : "<?php echo $accID ?>" }, cache: false, success: function(data){ var data_preferences = JSON.parse(data); if(data_preferences != "") { $('#ErrorOccurs').val(data_preferences.ErrorOccurs); //When an error occurs if (data_preferences.Postpone != 0 ) { $('#postpone').prop("checked", true); $('#postponetime').val(data_preferences.Postpone); $("#postponetime").prop('disabled', false); } if (data_preferences.Ignores == 1) { $('#ignore').prop("checked", true); } //Settings if (data_preferences.DeleteOldItems == 1) { $('#DeleteOldItems').prop("checked", true); } if (data_preferences.RunAnonymously == 1) { $('#RunAnonymously').prop("checked", true); } if (data_preferences.DontCreate == 1) { $('#DontCreate').prop("checked", true); } //Advanced Processing if (data_preferences.StopProcessing == 1) { $('#StopProcessing').prop("checked", true); } if (data_preferences.DontProcessMultiple == 1) { $('#DontProcessMultiple').prop("checked", true); } if (data_preferences.ImagesProcessing == 1) { $('#ImagesProcessing').prop("checked", true); } } } }); }); $('#close_preferences, #close_preferences2').click(function(event) { $( "#preferences-dialog" ).dialog( "close" ); }); }); $("#postponetime").prop('disabled', true); $("#postpone").change(function(event) { if( $('#postpone').is(':checked') ) { $("#postponetime").prop('disabled', false); } else { $("#postponetime").prop('disabled', true); } });//end event change $("#save_preferences_2").click(function(event) { //agent name var preferences_name = $('#preferences_agentname').val(); var description= $('#Description_preferences').val(); //get value of preferences before event save var ErrorOccurs = $('#ErrorOccurs').val(); if( $('#postpone').is(':checked') ) { time = $('#postponetime').val(); } else { time = '0'; } if( $('#ignore').is(':checked') ) { Ignores = "1"; } else { Ignores = '0'; } if( $('#DeleteOldItems').is(':checked') ) { DeleteOldItems = "1"; } else { DeleteOldItems = '0'; } if( $('#RunAnonymously').is(':checked') ) { RunAnonymously = "1"; } else { RunAnonymously = "0"; } if( $('#DontCreate').is(':checked') ) { DontCreate = "1"; } else { DontCreate = '0'; } if( $('#StopProcessing').is(':checked') ) { StopProcessing = "1"; } else { StopProcessing = '0'; } if( $('#DontProcessMultiple').is(':checked') ) { DontProcessMultiple = "1"; } else { DontProcessMultiple = '0'; } if( $('#ImagesProcessing').is(':checked') ) { ImagesProcessing = "1"; } else { ImagesProcessing = '0'; } var tablename_new = $("#preferences_agentname").val(); var accountid = "<?php echo $accID ?>"; var name = "<?php echo $n ?>"; //event save data $.ajax({ type: "post", url: "preferences.ajax.action.php", data: { action: "update_preferences_table", preferences_name : preferences_name, description : description, ErrorOccurs : ErrorOccurs, Postpone:time, Ignores:Ignores, DeleteOldItems:DeleteOldItems, RunAnonymously:RunAnonymously, DontCreate:DontCreate, StopProcessing:StopProcessing, DontProcessMultiple:DontProcessMultiple, ImagesProcessing:ImagesProcessing, AccountID:accountid,//acc id name:name,//table name DisplayName :preferences_name }, cache: false, success: function(data){ alert(data); } }); }); </script>