A tumblelog CMS built on AJAX, PHP and MySQL.

template_add_photo_bm.htm 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <div id="photo_upload">
  2. </div>
  3. <div id="photo_url">
  4. <label for="description">Photo URL</label>
  5. <br /><input class="input-text" type="text" name="url" id="url" size="80" value="{editUrl}" />
  6. </div>
  7. <div>
  8. <label for="description" style="display:block;">Caption <span class="option">(optional)</span></label>
  9. <br /><textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
  10. </div>
  11. <input type="hidden" name="title" id="title" value="" />
  12. <input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
  13. <input type="hidden" name="type" id="type" value="{type}" />
  14. <input type="hidden" name="date" id="date" value="{date}" />
  15. <input type="hidden" name="id_user" id="id_user" value="{id_user}" />
  16. <script>
  17. $('#photo_upload').css('display','none');
  18. $("#autosave").validate({
  19. rules: {
  20. photo: {
  21. required: function() {
  22. return ($('#photo_upload').css('display')!= 'none') ? true : false;
  23. },
  24. accept: "(jpe?g|gif|png)"
  25. },
  26. url: {
  27. required: function() {
  28. return ($('#photo_url').css('display')!= 'none') ? true : false;
  29. },
  30. url: true
  31. }
  32. },
  33. errorElement: "span",
  34. errorClass: "validate_span",
  35. errorPlacement: function(label, element) {
  36. label.prependTo(element.prev())
  37. }
  38. });
  39. $("#photo_upload a.linkFrm").click( function() {
  40. $('#photo_upload').css('display','none');
  41. $('#photo_url').css('display','block');
  42. $('#photo').val('');
  43. return false;
  44. }
  45. );
  46. $("#photo_url a.linkFrm").click( function() {
  47. $('#photo_url').css('display','none');
  48. $('#photo_upload').css('display','block');
  49. $('#url').val('');
  50. return false;
  51. }
  52. );
  53. </script>