Changeset 2767
- Timestamp:
- 08/09/2005 08:16:29 AM (20 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-header.php
r2763 r2767 77 77 </script> 78 78 <script type="text/javascript" src="fat.js"></script> 79 <?php if ( isset( $editing ) ) : ?> 79 80 <?php if ( get_option('rich_editing') ) :?> 80 81 <script type="text/javascript" src="tinymce/tiny_mce_src.js"></script> … … 98 99 </script> 99 100 <?php endif; ?> 100 <?php if ( isset( $editing ) ) : ?>101 101 <script type="text/javascript" src="dbx.js"></script> 102 102 <script type="text/javascript" src="dbx-key.js"></script> 103 <script type="text/javascript" src="tw-sack.js"></script> 104 <script type="text/javascript"> 105 var ajaxCat = new sack(); 106 107 function getResponseElement() { 108 var p = document.getElementById('ajaxcatresponse'); 109 if (!p) { 110 p = document.createElement('p'); 111 document.getElementById('categorydiv').appendChild(p); 112 p.id = 'ajaxcatresponse'; 113 } 114 return p; 115 } 116 117 function newCatLoading() { 118 var p = getResponseElement(); 119 p.innerHTML = 'Sending Data...'; 120 } 121 122 function newCatLoaded() { 123 var p = getResponseElement(); 124 p.innerHTML = 'Data Sent...'; 125 } 126 127 function newCatInteractive() { 128 var p = getResponseElement(); 129 p.innerHTML = 'Processing Data...'; 130 } 131 132 function newCatCompletion() { 133 var p = getResponseElement(); 134 var id = ajaxCat.response; 135 if ( id == '-1' ) { 136 p.innerHTML = "You don't have permission to do that."; 137 return; 138 } 139 if ( id == '0' ) { 140 p.innerHTML = "That category name is invalid. Try something else."; 141 return; 142 } 143 p.parentNode.removeChild(p); 144 var exists = document.getElementById('category-' + id); 145 if (exists) { 146 exists.checked = 'checked'; 147 exists.parentNode.setAttribute('id', 'new-category-' + id); 148 var nowClass = exists.parentNode.getAttribute('class'); 149 exists.parentNode.setAttribute('class', nowClass + ' fade'); 150 Fat.fade_all(); 151 exists.parentNode.setAttribute('class', nowClass); 152 } else { 153 var catDiv = document.getElementById('categorychecklist'); 154 var newLabel = document.createElement('label'); 155 catDiv.insertBefore(newLabel, catDiv.firstChild); 156 newLabel.setAttribute('for', 'category-' + id); 157 newLabel.setAttribute('id', 'new-category-' + id); 158 newLabel.setAttribute('class', 'selectit fade'); 159 160 var newCheck = document.createElement('input'); 161 newLabel.appendChild(newCheck); 162 newCheck.value = id; 163 newCheck.type = 'checkbox'; 164 newCheck.checked = 'checked'; 165 newCheck.name = 'post_category[]'; 166 newCheck.id = 'category-' + id; 167 168 var newLabelText = document.createTextNode(' ' + document.getElementById('newcat').value); 169 newLabel.appendChild(newLabelText); 170 Fat.fade_all(); 171 newLabel.setAttribute('class', 'selectit'); 172 } 173 } 174 175 function ajaxNewCatKeyUp(e) { 176 if (!e) { 177 if (window.event) { 178 e = window.event; 179 } else { 180 return; 181 } 182 } 183 if (e.keyCode == 13) { 184 ajaxNewCat(); 185 } 186 } 187 188 function ajaxNewCat() { 189 var newcat = document.getElementById('newcat'); 190 var catString = 'ajaxnewcat=' + newcat.value; 191 ajaxCat.requestFile = 'edit-form-ajax-cat.php'; 192 ajaxCat.method = 'GET'; 193 ajaxCat.onLoading = newCatLoading; 194 ajaxCat.onLoaded = newCatLoaded; 195 ajaxCat.onInteractive = newCatInteractive; 196 ajaxCat.onCompletion = newCatCompletion; 197 ajaxCat.runAJAX(catString); 198 } 199 </script> 103 200 <?php endif; ?> 104 201 -
trunk/wp-admin/edit-form-advanced.php
r2762 r2767 84 84 <fieldset id="categorydiv" class="dbx-box"> 85 85 <h3 class="dbx-handle"><?php _e('Categories') ?></h3> 86 <div class="dbx-content"><div ><?php dropdown_categories(get_settings('default_category')); ?></div>86 <div class="dbx-content"><div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div> 87 87 <p id="ajaxcat"> 88 <input type="text" name="newcat" id="newcat" size="16" />89 <input type="button" name="Button" value="+" >88 <input type="text" name="newcat" id="newcat" size="16" onkeyup="ajaxNewCatKeyUp(event);" /> 89 <input type="button" name="Button" value="+" onclick="ajaxNewCat();" /> 90 90 </p> 91 91 </div>
Note: See TracChangeset
for help on using the changeset viewer.