Changeset 1824958
- Timestamp:
- 02/20/2018 03:26:13 AM (8 years ago)
- Location:
- image-snippet/trunk
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
assets/js/isnippet.js (modified) (1 diff)
-
image-snippet.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
image-snippet/trunk
-
Property
svn:ignore
set to
nbproject
-
Property
svn:ignore
set to
-
image-snippet/trunk/assets/js/isnippet.js
r1330652 r1824958 23 23 24 24 // create new gallery 25 $(document).on("submit", "#snippet-settings, #update-snippet-settings", function (e) {25 $(document).on("submit", "#snippet-settings, .update-snippet-settings", function (e) { 26 26 27 27 e.preventDefault(); 28 29 var directory = $("# directory").val(),30 username = $("# username").val(),31 property = $("# property").val(),32 object = $("# object").val(),28 var formId = $(this).attr("id"); 29 var directory = $("#" + formId + "-directory").val(), 30 username = $("#" + formId + "-username").val(), 31 property = $("#" + formId + "-property1").val(), 32 object = $("#" + formId + "-object1").val(), 33 33 button_id = $(this).attr("id"); 34 34 -
image-snippet/trunk/image-snippet.php
r1824902 r1824958 187 187 } 188 188 wp_enqueue_script('timepicker-js', IS_URL.'/assets/js/jquery.timepicker.min.js', array('jquery'), '1.0', true); 189 wp_enqueue_script('functions-js', IS_URL.'/assets/js/isnippet.js', array('jquery'), ' 1.0', true);189 wp_enqueue_script('functions-js', IS_URL.'/assets/js/isnippet.js', array('jquery'), '', true); 190 190 wp_localize_script( 'functions-js', 'snippetrequest', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); 191 191 } … … 243 243 $objValue = $postdata['object'.$matches[1]]; 244 244 error_log("object value: ".$objValue); 245 $propertyArray = ['property' => $value, 'object' => $objValue]; 246 array_push($properties, $propertyArray); 247 $sPropertyArray = ['property' => fix_url_for_sparql($value), 'object' => fix_url_for_sparql($objValue)]; 248 array_push($sparql_props, $sPropertyArray); 245 if (!empty($value) && !empty($objValue)) { 246 $propertyArray = ['property' => $value, 'object' => $objValue]; 247 array_push($properties, $propertyArray); 248 $sPropertyArray = ['property' => fix_url_for_sparql($value), 'object' => fix_url_for_sparql($objValue)]; 249 array_push($sparql_props, $sPropertyArray); 250 } 249 251 } 250 252 else { … … 758 760 <tr> 759 761 <td colspan="7"> 760 <div id="toggle-form-container-<?php echo $row->is_id; ?>" class="toggle-form-container" style="display:<?php echo $display ;?>"> 761 <form method="POST" id="update-snippet-settings">762 <div id="toggle-form-container-<?php echo $row->is_id; ?>" class="toggle-form-container" style="display:<?php echo $display ;?>"> 763 <form method="POST" class="update-snippet-settings" id="<?php $formId = "form-".$row->is_id; echo $formId; ?>"> 762 764 <div class="meta-box-sortables"> 763 765 <div class="postbox"> … … 765 767 <p> 766 768 <label for="anps_subtitle">Gallery Name :</label> 767 <input type="text" name="directory" id=" directory" value="<?php echo $row->is_directory; ?>" style="width: 100%">769 <input type="text" name="directory" id="<?php echo $formId; ?>-directory" value="<?php echo $row->is_directory; ?>" style="width: 100%"> 768 770 </p> 769 771 </div> … … 772 774 <p> 773 775 <label for="anps_subtitle">ImageSnippets Username:</label> 774 <input type="text" name="username" id=" username" value="<?php echo $row->is_username; ?>" style="width: 100%">776 <input type="text" name="username" id="<?php echo $formId; ?>-username" value="<?php echo $row->is_username; ?>" style="width: 100%"> 775 777 </p> 776 778 </div> 777 <?php $filterCount = ''; foreach ($properties as $property): ?> 778 <fieldset class="galleryProperty"> 779 <legend>Filter <?php echo $filterCount; ?></legend> 780 <div class="inside"> 781 <p> 782 <label for="anps_subtitle">Property (URI or CURI):</label> 783 <input type="text" name="property<?php echo $filterCount; ?>" id="property<?php echo $filterCount; ?>" autocomplete="whatever" list="propertyList" value="<?php echo $property['property']; ?>" style="width: 100%"> 779 <div class="galleryProperties"> 784 780 <datalist id="propertyList"> 785 781 <option label="depicts" value="lio:depicts"> … … 798 794 <option label="technique" value="lio:technique"> 799 795 </datalist> 796 <?php $filterCount = 1; foreach ($properties as $property): ?> 797 <div class="inside"> 798 <fieldset class="galleryProperty"> 799 <legend>Filter <?php echo $filterCount; ?></legend> 800 <div class="inside"> 801 <p> 802 <label for="anps_subtitle">Property (URI or CURI):</label> 803 <input type="text" name="property<?php echo $filterCount; ?>" id="<?php echo $formId."-property".$filterCount; ?>" autocomplete="whatever" list="propertyList" value="<?php echo $property['property']; ?>" style="width: 100%"> 800 804 801 805 </p> … … 805 809 <p> 806 810 <label>Object (URI or CURI):</label> 807 <input type="text" name="object<?php echo $filterCount; ?>" id=" object<?php echo$filterCount; ?>" value="<?php echo preg_replace($patterns, $replacements, $property['object']); ?>" style="width: 100%">811 <input type="text" name="object<?php echo $filterCount; ?>" id="<?php echo $formId."-object".$filterCount; ?>" value="<?php echo preg_replace($patterns, $replacements, $property['object']); ?>" style="width: 100%"> 808 812 </p> 809 813 </div> 810 814 </fieldset> 811 <?php if ($filterCount == '') $filterCount = 1; else $filterCount++; endforeach; ?> 815 </div> 816 <?php $filterCount++; endforeach; ?> 817 </div> 818 <div class="inside" style="text-align:right"> 819 <button type="button" class="button button-primary button-large btn-disabled addPropertyBtn">Add Filter</button> 820 </div> 821 812 822 <div class="inside"> 813 823 <p> … … 826 836 <div class="inside" style="text-align:right"> 827 837 <p> 828 <input type="submit" value="Update" class="button button-primary button-large btn-disabled " id="update">838 <input type="submit" value="Update" class="button button-primary button-large btn-disabled updateSettingsBtn"> 829 839 <input type="hidden" name="graph_action" value="Update"> 830 840 <input type="hidden" name="cronservice" value="off"> … … 851 861 852 862 </div> 863 <script type="text/javascript" defer="defer"> 864 jQuery(document).ready(function($){ 865 var propUniqueIdx = <?php $filterCount++; echo $filterCount; ?>; 866 $(".addPropertyBtn").click(function() { 867 console.log("click!"); 868 var html = '<div class="inside"><fieldset class="galleryProperty"><legend>Filter ' + propUniqueIdx + '</legend><div class="inside"><p><label>Property (URI or CURI):</label><input type="text" name="property' + propUniqueIdx + '" style="width: 100%" autocomplete="whatever" list="propertyList"></p></div>'; 869 html += '<div class="inside"><p><label>Object (URI or CURI):</label><input type="text" name="object' + propUniqueIdx + '" style="width: 100%"></p></div></fieldset></div>'; 870 propUniqueIdx++; 871 872 var siblings = $(this).parent().siblings(".galleryProperties"); 873 $(html).appendTo(siblings.eq(0)); 874 }); 875 }); 876 </script> 877 853 878 <?php } 854 879
Note: See TracChangeset
for help on using the changeset viewer.