Changeset 2160
- Timestamp:
- 09/08/10 18:16:25 (17 months ago)
- Location:
- plugins/apostrophePlugin/trunk
- Files:
-
- 1 added
- 7 modified
-
modules/a/templates/_area.php (modified) (3 diffs)
-
modules/a/templates/_createPage.php (modified) (3 diffs)
-
modules/a/templates/_globalJavascripts.php (added)
-
modules/a/templates/_variant.php (modified) (2 diffs)
-
modules/a/templates/layout.php (modified) (2 diffs)
-
modules/a/templates/settingsSuccess.php (modified) (2 diffs)
-
web/js/a.js (modified) (5 diffs)
-
web/js/aUI.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostrophePlugin/trunk/modules/a/templates/_area.php
r2152 r2160 94 94 <?php if ($infinite): ?> 95 95 <li class="a-move"> 96 <a href="# " class="a-btn icon a-arrow-up no-label" title="<?php echo a_('Move Up') ?>"><span class="icon"></span><?php echo a_('Move Up') ?></a>96 <a href="#move-up" class="a-btn icon a-arrow-up no-label" title="<?php echo a_('Move Up') ?>" onclick="return false;"><span class="icon"></span><?php echo a_('Move Up') ?></a> 97 97 </li> 98 98 <li class="a-move"> 99 <a href="# " class="a-btn icon a-arrow-down no-label" title="<?php echo a_('Move Down') ?>"><span class="icon"></span><?php echo a_('Move Down') ?></a>99 <a href="#move-down" class="a-btn icon a-arrow-down no-label" title="<?php echo a_('Move Down') ?>" onclick="return false;"><span class="icon"></span><?php echo a_('Move Down') ?></a> 100 100 </li> 101 101 <?php endif ?> … … 150 150 151 151 <?php if ($infinite): ?> 152 aMenuToggle('#a-add-slot-<?php echo $pageid.'-'.$name ?>', $('#a-add-slot-<?php echo $pageid.'-'.$name ?>').parent(), 'a-options-open', false);153 154 152 var newSlot = $('#a-area-<?php echo "$pageid-$name" ?>').find('.a-new-slot'); 155 153 if (newSlot.length) { … … 180 178 </script> 181 179 <?php a_js_call('apostrophe.areaUpdateMoveButtons(?, ?, ?)', url_for('a/moveSlot'), $pageid, $name) ?> 180 <?php a_js_call('apostrophe.menuToggle(?)', array('button' => '#a-add-slot-'.$pageid.'-'.$name, 'classname' => 'a-options-open', 'overlay' => false)) ?> 182 181 <?php endif ?> -
plugins/apostrophePlugin/trunk/modules/a/templates/_createPage.php
r2149 r2160 48 48 <ul class="a-ui a-controls"> 49 49 <li><input type="submit" class="a-btn a-submit" value="<?php echo __('Create Page', null, 'apostrophe') ?>" /></li> 50 <li><a href="# " onclick="return false;" class="a-btn icon a-cancel"><?php echo __("Cancel", null, 'apostrophe') ?></a></li>50 <li><a href="#cancel" onclick="return false;" class="a-btn icon a-cancel a-options-cancel" title="<?php echo __('Cancel', null, 'apostrophe') ?>"><?php echo __("Cancel", null, 'apostrophe') ?></a></li> 51 51 </ul> 52 52 </div> … … 82 82 aInputSelfLabel('#a-create-page-title', <?php echo json_encode(__('Page Title', null, 'apostrophe')) ?>); 83 83 84 aMenuToggle($('#a-create-page-button'), $('#a-create-page-button').parent(), '', true);85 86 84 $('#a-create-page-button').click(function(){ 87 85 $('#a-create-page-title').focus(); … … 89 87 }); 90 88 </script> 89 90 <?php a_js_call('apostrophe.menuToggle(?)', array('button' => '#a-create-page-button', 'classname' => '', 'overlay' => true)) ?> -
plugins/apostrophePlugin/trunk/modules/a/templates/_variant.php
r2079 r2160 43 43 }); 44 44 $('<?php echo "#a-$pageid-$name-$permid-variant" ?>').children("ul.a-variant-options").hide(); 45 aMenuToggle('#a-<?php echo $pageid ?>-<?php echo $name ?>-<?php echo $permid ?>-variant-options-toggle', $('#a-<?php echo $pageid ?>-<?php echo $name ?>-<?php echo $permid ?>-variant-options-toggle').parent(), 'a-options-open', false);46 45 }); 47 46 </script> … … 50 49 </li> 51 50 <?php endif ?> 51 52 <?php a_js_call('apostrophe.menuToggle(?)', array('button' => '#a-'.$pageid.'-'.$name.'-'.$permid.'-variant-options-toggle', 'classname' => 'a-options-open', 'overlay' => false)) ?> -
plugins/apostrophePlugin/trunk/modules/a/templates/layout.php
r2149 r2160 1 <?php use_helper(' I18N') ?>1 <?php use_helper('a') ?> 2 2 <?php // This is a copy of apostrophePlugin/modules/a/templates/layout.php ?> 3 3 <?php // It also makes a fine site-wide layout, which gives you global slots on non-page templates ?> 4 4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 5 5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 6 <?php use_helper('a') ?>7 6 <?php // If this page is an admin page we don't want to present normal navigation relative to it. ?> 8 7 <?php $page = aTools::getCurrentNonAdminPage() ?> … … 96 95 </div> 97 96 97 <?php include_partial('a/globalJavascripts') ?> 98 98 99 <?php // Drop in the document.ready stuff at the bottom. ?> 99 100 <?php // If we try to do this sooner, it works for the template but ?> -
plugins/apostrophePlugin/trunk/modules/a/templates/settingsSuccess.php
r2154 r2160 142 142 <ul class="a-ui a-controls"> 143 143 <li><input type="submit" name="submit" value="<?php echo htmlspecialchars(__('Save Changes', null, 'apostrophe')) ?>" class="a-btn a-submit" id="a-page-settings-submit" /></li> 144 <li>< ?php echo jq_link_to_function(__('Cancel', null, 'apostrophe'), '', array('class' => 'a-btn icon a-cancel', 'title' => __('Cancel', null, 'apostrophe'))) ?></li>144 <li><a href="#cancel" onclick="return false;" class="a-btn icon a-cancel a-options-cancel" title="<?php echo __('Cancel', null, 'apostrophe') ?>"><?php echo __('Cancel', null, 'apostrophe') ?></a></li> 145 145 <?php if ($page->userHasPrivilege('manage')): ?> 146 146 <?php $childMessage = ''; ?> … … 157 157 <script src="/sfJqueryReloadedPlugin/js/plugins/jquery.autocomplete.js"></script> 158 158 <script src="/sfDoctrineActAsTaggablePlugin/js/pkTagahead.js"></script> 159 159 160 <?php a_include_js_calls() ?> 161 160 162 <script type="text/javascript" charset="utf-8"> 161 163 $(document).ready(function() { -
plugins/apostrophePlugin/trunk/web/js/a.js
r2158 r2160 382 382 $('#a-slots-' + id + '-' + name).html(result); 383 383 historyBtn.removeClass('a-disabled'); 384 aCloseHistory();384 _closeHistory(); 385 385 aUI(targetArea, 'history-revert'); 386 386 } … … 396 396 $('#a-slots-' + id + '-' + name).html(result); 397 397 historyBtn.removeClass('a-disabled'); 398 aCloseHistory();398 _closeHistory(); 399 399 aUI(targetArea); 400 400 } … … 410 410 } 411 411 412 this.enableBrowseHistoryButtons = function(options) 413 { 414 var historyBtn = $(options['history_buttons']); 415 historyBtn.unbind("click").click(function(event){ 416 event.preventDefault(); 417 _closeHistory(); 418 _browseHistory(historyBtn.closest('div.a-area')); 419 }); 420 } 421 422 this.enableCloseHistoryButtons = function(options) 423 { 424 var closeHistoryBtns = $(options['close_history_buttons']); 425 closeHistoryBtns.click(function(){ 426 _closeHistory(); 427 }); 428 } 429 430 function _browseHistory(area) 431 { 432 var areaControls = area.find('ul.a-area-controls'); 433 var areaControlsTop = areaControls.offset().top; 434 435 $('.a-page-overlay').show(); 436 437 // Clear Old History from the Browser 438 if (!area.hasClass('browsing-history')) 439 { 440 $('.a-history-browser .a-history-items').html('<tr class="a-history-item"><td class="date"><img src="\/apostrophePlugin\/images\/a-icon-loader.gif"><\/td><td class="editor"><\/td><td class="preview"><\/td><\/tr>'); 441 area.addClass('browsing-history'); 442 } 443 444 // Positioning the History Browser 445 $('.a-history-browser').css('top',(areaControlsTop-5)+"px"); //21 = height of buttons plus one margin 446 $('.a-history-browser').fadeIn(); 447 $('.a-page-overlay').click(function(){ 448 _closeHistory(); 449 $(this).unbind('click'); 450 }); 451 452 $('#a-history-preview-notice-toggle').click(function(){ 453 $('.a-history-preview-notice').children(':not(".a-history-options")').slideUp(); 454 }); 455 } 456 457 function _closeHistory() 458 { 459 $('a.a-history-btn').parents('.a-area').removeClass('browsing-history'); 460 $('a.a-history-btn').parents('.a-area').removeClass('previewing-history'); 461 $('.a-history-browser, .a-history-preview-notice').hide(); 462 $('body').removeClass('history-preview'); 463 $('.a-page-overlay').fadeOut(); 464 } 465 412 466 this.pageSettings = function(options) 413 467 { … … 415 469 var aPageSettingsButton = $('#a-page-settings-button'); 416 470 417 aMenuToggle('#a-page-settings-button', $('#a-page-settings-button').parent(), '', true);471 _menuToggle('#a-page-settings-button', '', true); 418 472 419 473 aPageSettingsButton.click(function() { … … 578 632 aUI(editBtn.parents('.a-slot').attr('id')); // Refresh the UI scoped to this Slot 579 633 } 634 635 this.menuToggle = function(options) 636 { 637 var button = options['button']; 638 var classname = options['classname']; 639 var overlay = options['overlay']; 640 _menuToggle(button, classname, overlay); 641 } 642 643 644 function _menuToggle(button, classname, overlay) 645 { 646 /* Usage: aMenuToggle(Object|ID Selector, Object|ID Selector, Undefined|String, Undefined|True|False) */ 647 648 if (typeof button == "string") { button = $(button); } /* button that toggles the menu open & closed */ 649 if (typeof classname == "undefined" || classname == '') { classname = "show-options"; } /* optional classname override to use for toggle & styling */ 650 if (typeof overlay != "undefined" && overlay) { overlay = $('.a-page-overlay'); } /* optional full overlay */ 651 var menu = $(button).parent(); // Use the parent of the button as the menu container 652 653 if (menu.attr('id') == '') { 654 // We need an ID for the menu. If the menu doesn't have one, we create it by appending 'menu' to the Button ID 655 newID = button.attr('id')+'-menu'; 656 menu.attr('id', newID); 657 } 658 659 button.unbind('click').click(function() 660 { 661 // Button Toggle 662 if (!button.hasClass('aActiveMenu')) 663 { 664 menu.trigger('toggleOpen'); 665 } 666 else 667 { 668 menu.trigger('toggleClosed'); 669 } 670 }); 671 672 menu.bind('toggleOpen', function(){ 673 // Open Menu, Create Listener 674 button.addClass('aActiveMenu'); 675 menu.addClass(classname); 676 if (overlay) { overlay.stop().show(); } 677 $(document).click(function(e){ 678 var target = e.target; 679 target = $(target); 680 if (target.hasClass('.a-page-overlay') || target.hasClass('.a-cancel')) { 681 menu.trigger('toggleClosed'); 682 } 683 if (!target.parents().is('#'+menu.attr('id'))) { 684 menu.trigger('toggleClosed'); 685 } 686 }); 687 }); 688 689 menu.bind('toggleClosed', function(){ 690 // Close Menu, Destroy Listener 691 button.removeClass('aActiveMenu'); 692 menu.removeClass(classname); 693 if (overlay) { overlay.fadeOut(); } 694 $(document).unbind('click'); // Clear out click event 695 }); 696 697 $('.a-options-cancel').live('click', function(){ 698 // console.log(menu); 699 $(this).closest(menu).trigger('toggleClosed'); 700 }); 701 702 } 703 580 704 } 581 705 -
plugins/apostrophePlugin/trunk/web/js/aUI.js
r2089 r2160 1 1 function aUI(target) 2 2 { 3 4 3 // Grab Target if Passed Through 5 4 if (typeof(target) == 'undefined') // If Not Set … … 45 44 }); 46 45 } 47 48 // Area History Buttons49 $('a.a-history-btn').unbind("click").click(function(event){50 event.preventDefault();51 aCloseHistory();52 aBrowseHistory($(this).parents('div.a-area'));53 });54 55 // Close History Browser56 $('#a-history-close-button, #a-history-heading-button').click(function(){57 aCloseHistory();58 });59 46 60 47 // Variants … … 99 86 } 100 87 101 function aMenuToggle(button, menu, classname, overlay)102 {103 /* Usage: aMenuToggle(Object|ID(String), Object|ID(String), Undefined|String, Undefined|True|False) */104 if (typeof button == "string") { button = $(button); }105 if (typeof menu == "string") { menu = $(menu); }106 if (typeof classname == "undefined" || classname == '') { classname = "show-options"; }107 if (typeof overlay != "undefined" && overlay) { overlay = $('.a-page-overlay'); }108 109 if (menu.attr('id') == '') {110 // We need an ID for the menu. If the menu doesn't have one, we create it by appending 'menu' to the Button ID111 newID = button.attr('id')+'-menu';112 menu.attr('id', newID);113 }114 115 button.unbind('click').click(function()116 {117 // Button Toggle118 if (!button.hasClass('aActiveMenu'))119 {120 menu.trigger('toggleOpen');121 }122 else123 {124 menu.trigger('toggleClosed');125 }126 });127 128 menu.bind('toggleOpen', function(){129 // Open Menu, Create Listener130 button.addClass('aActiveMenu');131 menu.addClass(classname);132 if (overlay) { overlay.stop().show(); }133 $(document).click(function(e){134 var target = e.target;135 target = $(target);136 if (target.hasClass('.a-page-overlay') || target.hasClass('.a-cancel')) {137 menu.trigger('toggleClosed');138 }139 if (!target.parents().is('#'+menu.attr('id'))) {140 menu.trigger('toggleClosed');141 }142 });143 });144 145 menu.bind('toggleClosed', function(){146 // Close Menu, Destroy Listener147 button.removeClass('aActiveMenu');148 menu.removeClass(classname);149 if (overlay) { overlay.fadeOut(); }150 $(document).unbind('click'); // Clear out click event151 });152 153 }154 155 88 function aAccordion(heading) 156 89 { … … 168 101 } 169 102 170 171 function aBrowseHistory(area)172 {173 var areaControls = area.find('ul.a-area-controls');174 var areaControlsTop = areaControls.offset().top;175 176 $('.a-page-overlay').show();177 178 // Clear Old History from the Browser179 if (!area.hasClass('browsing-history'))180 {181 $('.a-history-browser .a-history-items').html('<tr class="a-history-item"><td class="date"><img src="\/apostrophePlugin\/images\/a-icon-loader.gif"><\/td><td class="editor"><\/td><td class="preview"><\/td><\/tr>');182 area.addClass('browsing-history');183 }184 185 // Positioning the History Browser186 $('.a-history-browser').css('top',(areaControlsTop-5)+"px"); //21 = height of buttons plus one margin187 $('.a-history-browser').fadeIn();188 $('.a-page-overlay').click(function(){189 aCloseHistory();190 $(this).unbind('click');191 });192 193 $('#a-history-preview-notice-toggle').click(function(){194 $('.a-history-preview-notice').children(':not(".a-history-options")').slideUp();195 });196 }197 198 function aCloseHistory()199 {200 $('a.a-history-btn').parents('.a-area').removeClass('browsing-history');201 $('a.a-history-btn').parents('.a-area').removeClass('previewing-history');202 $('.a-history-browser, .a-history-preview-notice').hide();203 $('body').removeClass('history-preview');204 $('.a-page-overlay').fadeOut();205 }206 207 103 $(document).ready(function(){ 208 104 aUI();

