Changeset 463 in products


Ignore:
Timestamp:
Aug 14, 2006 12:44:42 PM (13 years ago)
Author:
piv
Message:

added ajax congiglet with necessary functionality (but not sufficient)

Location:
qPloneDropDownMenu/branches/0.2
Files:
27 added
6 edited

Legend:

Unmodified
Added
Removed
  • qPloneDropDownMenu/branches/0.2/Extensions/Install.py

    r59 r463  
    44from Products.CMFCore.utils import getToolByName 
    55from Products.CMFCore.DirectoryView import addDirectoryViews 
    6  
    7 from Products.CMFPlone.migrations.migration_util import safeEditProperty 
    8 from Products.CMFCore.Expression import Expression, createExprContext 
     6from Products.CMFCore.CMFCorePermissions import ManagePortal 
    97 
    108from Products.qPloneDropDownMenu.config import * 
    119 
    12 configlets = ({'id':PROJECT_NAME, 
     10configlets = ({'id':PROJECTNAME, 
    1311    'name':'Drop Down Menu', 
    1412    'action':'string:${portal_url}/prefs_dropdownmenu_edit_form', 
     
    1614    'category':'Products', 
    1715    'visible':1, 
    18     'appId':PROJECT_NAME, 
    19     'permission':VIEW_PERMISSION, 
    20     'imageUrl':'qplonedropdownmenu.gif'}, 
    21    {'id':'csshover', 
    22     'name':'CSS Hover', 
    23     'action':'string:${portal_url}/prefs_csshover_edit_form', 
    24     'condition':'', 
    25     'category':'Products', 
    26     'visible':1, 
    27     'appId':'csshover', 
    28     'permission':VIEW_PERMISSION},) 
     16    'appId':PROJECTNAME, 
     17    'permission':ManagePortal, 
     18    'imageUrl':'qplonedropdownmenu.gif'},) 
     19 
     20def setupConfiglets(self, out): 
     21    configTool = getToolByName(self, 'portal_controlpanel', None) 
     22    if configTool: 
     23        for conf in configlets: 
     24            configTool.registerConfiglet(**conf) 
     25            out.write('Added configlet %s\n' % conf['id']) 
     26 
     27def removeConfiglets(self, out): 
     28    configTool = getToolByName(self, 'portal_controlpanel', None) 
     29    if configTool: 
     30        for conf in configlets: 
     31            configTool.unregisterConfiglet(conf['id']) 
     32            out.write('Removed configlet %s\n' % conf['id']) 
    2933 
    3034def registerCSS(self, out): 
    31  
    3235    qi = getToolByName(self, 'portal_quickinstaller', None) 
    3336    if qi is not None: 
     
    4952 
    5053def unregisterCSS(self, out): 
    51  
    5254    qi = getToolByName(self, 'portal_quickinstaller', None) 
    5355    if qi is not None: 
     
    6567            pass 
    6668 
    67 def updateMenu(self): 
    68     out = '' 
    69  
    70     pu = getToolByName(self, 'plone_utils') 
    71  
    72     if hasattr(pu, 'createTopLevelTabs'): 
    73         pactions = getToolByName(self, 'portal_actions').listFilteredActionsFor(self) 
    74         tl_tabs = pu.createTopLevelTabs(pactions) 
    75  
    76         for act in tl_tabs: 
    77                 out += '<li id="portaltab-%s" class="plain"><a href="%s" accesskey="t">' % \ 
    78                     (act['id'], act['url']) + act['name'] + '</a></li>\n' 
    79     else: 
    80         portal = getToolByName(self, 'portal_url').getPortalObject() 
    81  
    82         portal_act = getToolByName(self, 'portal_actions') 
    83         actions=portal_act._cloneActions() 
    84  
    85         for act in actions: 
    86             if act.category == 'portal_tabs': 
    87                 out += '<li id="portaltab-%s" class="plain"><a href="%s" accesskey="t">%s</a></li>\n' % \ 
    88                     (act.id, \ 
    89                      Expression(act.getActionExpression())(createExprContext(portal, portal, portal)), \ 
    90                      act.title) 
    91  
    92     portal_props = getToolByName(self, 'portal_properties') 
    93     if not hasattr(portal_props, PROPERTY_SHEET): 
    94         portal_props.addPropertySheet(PROPERTY_SHEET, 'DropDown Menu Properties') 
    95     ap = getattr(portal_props, PROPERTY_SHEET) 
    96     safeEditProperty(ap, 'menu', out, 'text') 
    97  
    9869def setupSkin(self, out, skinFolder): 
    99  
    10070    skinstool=getToolByName(self, 'portal_skins') 
    101  
    102     addDirectoryViews(skinstool, SKINS_DIR, GLOBALS) 
    103  
    10471    for skin in skinstool.getSkinSelections(): 
    10572        path = skinstool.getSkinPath(skin) 
    106         path = map( string.strip, string.split( path,',' ) ) 
    107  
     73        path = map(string.strip, string.split(path,',')) 
    10874        if not skinFolder in path: 
    10975            try: 
    110                 path.insert( path.index( 'custom')+1, skinFolder ) 
     76                path.insert(path.index('custom')+1, skinFolder) 
    11177            except ValueError: 
    11278                path.append(skinFolder) 
    113             path = string.join( path, ', ' ) 
    114             skinstool.addSkinSelection( skin, path ) 
     79            path = string.join(path, ', ') 
     80            skinstool.addSkinSelection(skin, path) 
    11581            out.write('  %s layer sucessfully installed into skin %s.\n' % (skinFolder, skin)) 
    11682        else: 
    11783            out.write('  %s layer was already installed into skin %s.\n' % (skinFolder, skin)) 
    11884 
    119 def setupTool(self): 
     85def removeSkin(self, skins=[]): 
     86    if skins: 
     87        skinstool = getToolByName(self, 'portal_skins') 
     88        for skinName in skinstool.getSkinSelections(): 
     89            path = skinstool.getSkinPath(skinName) 
     90            path = [i.strip() for i in  path.split(',')] 
     91            for s in skins: 
     92                if s in path: 
     93                    path.remove(s) 
     94                s += '/' 
     95                for layer in path: 
     96                    if layer.startswith(s): 
     97                        path.remove(layer) 
     98            path = ','.join(path) 
     99            skinstool.addSkinSelection(skinName, path) 
    120100 
     101def setupTool(self, out): 
     102    if hasattr(self, UNIQUE_ID): 
     103        self.manage_delObjects([UNIQUE_ID]) 
     104        out.write('Deleting old %s\n' % (UNIQUE_ID)) 
    121105    portal_url = getToolByName(self, 'portal_url') 
    122106    p = portal_url.getPortalObject() 
    123     x = p.manage_addProduct[PROJECT_NAME].manage_addTool(type='DropDownMenu Tool') 
     107    x = p.manage_addProduct[PROJECTNAME].manage_addTool(type='DropDownMenu Tool') 
     108 
     109def deleteTool(self, out): 
     110    if hasattr(self, UNIQUE_ID): 
     111        self.manage_delObjects([UNIQUE_ID]) 
     112        out.write('Deleted %s tool\n' % (UNIQUE_ID)) 
    124113 
    125114def install(self): 
    126115    out = StringIO() 
    127  
    128116    registerCSS(self, out) 
    129  
    130     configTool = getToolByName(self, 'portal_controlpanel', None) 
    131     if configTool: 
    132         for conf in configlets: 
    133             configTool.registerConfiglet(**conf) 
    134             out.write('Added configlet %s\n' % conf['id']) 
    135  
    136     if hasattr(self, UNIQUE_ID): 
    137         self.manage_delObjects([UNIQUE_ID]) 
    138         out.write('Deleting old %s\n' % (UNIQUE_ID)) 
    139     setupTool(self) 
     117    out.write('setupSkin... \n') 
     118    skinstool=getToolByName(self, 'portal_skins') 
     119    addDirectoryViews(skinstool, SKINS_DIR, GLOBALS) 
     120    setupSkin(self, out, 'qPloneDropDownMenu') 
     121    mtool = getToolByName(self, 'portal_migration') 
     122    plone_version = mtool.getFileSystemVersion() 
     123    if plone_version == '2.0.5': 
     124         setupSkin(self, out, PROJECTNAME+'/2.0.5') 
     125         out.write('Added %s/2.0.5 Layer to portal_skins\n' % PROJECTNAME) 
     126    setupConfiglets(self, out) 
    140127    out.write('Added %s to the portal root folder\n' % (UNIQUE_ID)) 
    141  
    142     portal_props = getToolByName(self, 'portal_properties') 
    143     if not hasattr(portal_props, PROPERTY_SHEET): 
    144         out.write('updateMenu... \n') 
    145         updateMenu(self) 
    146     else: 
    147         out.write('skipping updateMenu... \n') 
    148  
    149     out.write('setupSkin... \n') 
    150     setupSkin(self, out, 'qPloneDropDownMenu') 
    151  
     128    setupTool(self, out) 
    152129    return out.getvalue() 
    153130 
    154131def uninstall(self): 
    155132    out = StringIO() 
    156  
    157133    unregisterCSS(self, out) 
    158  
    159     configTool = getToolByName(self, 'portal_controlpanel', None) 
    160     if configTool: 
    161         for conf in configlets: 
    162             configTool.unregisterConfiglet(conf['id']) 
    163             out.write('Removed configlet %s\n' % conf['id']) 
    164  
     134    removeConfiglets(self, out) 
     135    removeSkin(self, [PROJECTNAME, PROJECTNAME+'/2.0.5']) 
     136    deleteTool(self, out) 
    165137    return out.getvalue() 
  • qPloneDropDownMenu/branches/0.2/README.txt

    r59 r463  
    2626Usage 
    2727 
    28   You have a list of items of your top level menu, which you can edit in 
    29   'drop down menu' configlet form. Now, to add submenu to the certain  
    30   menu item, you need to add unordered list inside of top level menu  
    31   item ('<li>...</li>') after its title ('<a></a>'):: 
    32  
    33    <ul><li>...</li>...<li>...</li></ul> 
    34  
    35   To make your changes live click 'save' button. 
    36  
    37   Sample menu with 2 submenus:: 
    38   
    39    <li id="portaltab-index_html" class="plain"><a href="http://example.com/" accesskey="t">Home</a></li> 
    40    <li id="portaltab-Members" class="plain"><a href="http://example.com/Members" accesskey="t">Members</a> 
    41        <ul> 
    42            <li><a href="http://example.com/Members/jdoe">John Doe</a><li> 
    43            <li><a href="http://example.com/Members/mmajor">Mary Major</a><li> 
    44        </ul> 
    45    </li> 
    46    <li id="portaltab-news" class="plain"><a href="http://example.com/news" accesskey="t">News</a></li> 
    47    <li id="portaltab-events" class="plain"><a href="http://example.com/events" accesskey="t">Events</a> 
    48        <ul> 
    49            <li><a href="http://example.com/events/previous">Past Events</a><li> 
    50            <li><a href="http://example.com/calendar">Calendar</a><li> 
    51        </ul> 
    52    </li> 
    53  
    54   In this example we added submenus to our 'Members', and 'Events' tabs. 
    55  
    56  
    57   Customize the following elements in your's css files to 
    58   changed the appearance of drop down menu: 
    59  
    60     * #portal-globalnav - global navigation bar 
    61     * #portal-globalnav .csshover li.plain a, #portal-globalnav li a - global navigation link 
    62     * #portal-globalnav .csshover li.plain a:hover, #portal-globalnav li a:hover - global navigation link hover 
    63     * #portal-globalnav .csshover li.plain ul, #portal-globalnav li ul - global navigation drop-down box 
    64     * #portal-globalnav .csshover li.plain ul li a, #portal-globalnav li ul li a - global navigation drop-down link 
    65     * #portal-globalnav .csshover li.plain ul li a:hover, #portal-globalnav li ul li a:hover - global navigation 
    66       drop-down link hover 
    67  
    68  
    69 You can click  button on 'drop down menu' configlet form to reset menu. 
    70 This can be usefull in case  broken html of menu code. Generated code is based 
    71 on status of 'Automatically generate tabs' in your 'Navigation settings'  
    72 (in Plone 2.1+). However you will lose your previous code of menu with all submenus  
    73 after click on 'regenerate menu'.  
    74  
    75 If you want to 'regenerate menu' you should pay attention to status of  
    76 'Automatically generate tabs' in your 'Navigation settings' (in Plone 2.1+). 
    77  
    7828 
    7929Authors 
  • qPloneDropDownMenu/branches/0.2/__init__.py

    r59 r463  
    1 from AccessControl import allow_module 
    21from Products.CMFCore import utils 
    32from Products.CMFCore.DirectoryView import registerDirectory 
    43 
    54from Products.qPloneDropDownMenu.DropDownMenuTool import DropDownMenuTool 
    6 from Products.qPloneDropDownMenu.config import PROJECT_NAME, SKINS_DIR, GLOBALS, VIEW_PERMISSION 
    7  
    8 allow_module('Products.qPloneDropDownMenu.utils') 
     5from Products.qPloneDropDownMenu.config import * 
    96 
    107registerDirectory(SKINS_DIR, GLOBALS) 
    11   
     8 
    129tools = (DropDownMenuTool,) 
    13   
     10 
    1411def initialize(context): 
    15     utils.ToolInit( PROJECT_NAME, 
    16                     tools = tools, 
    17                     product_name = PROJECT_NAME, 
    18                     icon='tool.gif' 
    19                     ).initialize(context) 
     12    utils.ToolInit(PROJECTNAME, 
     13                   tools = tools, 
     14                   product_name = PROJECTNAME, 
     15                   icon='tool.gif' 
     16                   ).initialize(context) 
  • qPloneDropDownMenu/branches/0.2/config.py

    r59 r463  
    1 from Products.CMFCore import CMFCorePermissions 
    2   
    3 VIEW_PERMISSION = CMFCorePermissions.ManagePortal 
     1PROJECTNAME = 'qPloneDropDownMenu' 
    42 
    5 PROJECT_NAME = 'qPloneDropDownMenu' 
    63UNIQUE_ID = "portal_dropdownmenu" 
    74SKINS_DIR = 'skins' 
     
    96GLOBALS = globals() 
    107 
    11 PROPERTY_SHEET = 'dropdownmenu_properties' 
    12 MENU_HTML = '''<ul><li><a class="first-item" href="http://www.bmc.com">Home</a></li><li><a href="http://www.bmc.com/products/">Solutions &amp; Products</a><ul> 
    13         <li><a href="http://www.bmc.com/BMC/Common/Templates/hou_generic_tab/0,,19052_34957721,00.html">Business Service Management</a></li> 
    14         <li><a href="http://www.bmc.com/BMC/Common/Templates/hou_generic_tab/0,,19052_34829607,00.html">Best Practices &amp; Compliance</a></li> 
    15         <li><a href="http://www.bmc.com/BMC/Common/Templates/hou_generic_tab/0,,19052_34830527,00.html">Small &amp; Mid-Sized Business </a></li> 
    16         <li><a href="http://www.bmc.comBMC/Common/Templates/hou_generic_tab/0,3846,19052_34818399,00.html">Industry Solutions</a></li> 
    17         <li><a href="http://www.bmc.com/BMC/Products/CDA/hou_Products_Index/0,2830,19052_23655657,00.html">Product Families</a></li> 
    18         <li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Generic/0,3465,19052_19432,00.html">Services</a></li> 
    19         <li><a href="http://www.bmc.com/products/productlist/0,,19052,00.html">Product List A to Z</a></li> 
    20         <li><a href="http://www.bmc.com/BMC/Products/CDA/hou_Products_Index/0,2830,19052_23655660,00.html">Downloads &amp; Resources</a></li> 
    21         <li><a href="http://www.bmc.com/pricelist/">Global Pricing</a></li>        
    22       </ul></li><li><a href="http://www.bmc.com/partners/">Partners</a><ul> 
    23         <li><a href="http://www.bmc.com/BMC/Partners/CDA/hou_Partner_Generic/0,3319,5377102_5379132,00.html">Find a Partner</a></li> 
    24         <li><a href="http://www.bmc.com/BMC/Partners/CDA/hou_Partner_Generic/0,3319,5377102_5379134,00.html">Become a Partner</a></li> 
    25         <li><a href="http://www.bmc.com/BMC/Partners/CDA/hou_Partner_Generic/0,3317,5377102_5379136,00.html">Find a Market Zone Product</a></li> 
    26       </ul></li><li><a href="http://www.bmc.com/support_home">Support</a><ul> 
    27         <li><a href="http://www.bmc.com/info_center_support/overview/0,3252,19097_4736148,00.html">Case Tracking &amp; Reporting</a></li> 
    28         <li><a href="http://www.bmc.com/support/vantive_bridge.cfm?path=http://selfserve.bmc.com/support/Forms/frmResolutionSearch.asp">Knowledge Database</a></li> 
    29         <li><a href="http://www.bmc.com/info_center_support/overview/0,3252,19097_4736152,00.html">My Support Admin</a></li> 
    30         <li><a href="http://www.bmc.com/info_center_support/overview/0,3252,19097_4736150,00.html">PTFs, FTP &amp; Installation</a></li> 
    31         <li><a href="http://www.bmc.com/info_center_support/overview/0,3252,19097_4736154,00.html">Policies &amp; Guidelines</a></li> 
    32         <li><a href="http://www.bmc.com/info_center_support/overview/0,3252,19097_4736144,00.html">Product Lists &amp; Manuals</a></li> 
    33         <li><a href="http://www.bmc.com/info_center_support/overview/0,3252,19097_4718041,00.html">Support Contacts</a></li> 
    34         <li><a href="http://www.bmc.com/info_center_support/All_News/0,2560,19097,00.html">Support News</a></li> 
    35       </ul></li><li><a href="http://shop.bmc.com/">Store</a><ul> 
    36         <li><a href="http://shop.bmc.com/shopping_support.cfm">Shopping Support</a></li> 
    37         <li><a href="http://shop.bmc.com/licensing.cfm">Licensing Information</a></li> 
    38         <li><a href="http://shop.bmc.com/download.cfm">Download Facility</a></li> 
    39         <li><a href="http://shop.bmc.com/retrieve_cart.cfm">Retrieve Your Quote</a></li> 
    40       </ul></li><li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Generic/0,,11629550_11650861_11651561,00.html?c=products_header&amp;n=education_linksupport_homet=11503">Education</a><ul> 
    41         <li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Generic/0,3465,11629550_11650863,00.html">Certification Program</a></li> 
    42         <li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Generic/0,3465,11629550_11681301,00.html">Placement Tests</a></li> 
    43         <li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Generic/0,3465,11629550_11651556,00.html">Product Education</a></li> 
    44       </ul></li><li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Detail/0,3464,9926222_10667925,00.html">Communities</a><ul> 
    45         <li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Detail/0,3464,9926222_10636326,00.html">Thought Leadership Council</a></li> 
    46         <li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Generic/0,3465,9926222_33961809,00.html">Enterprise Leadership</a></li> 
    47         <li><a href="http://talk.bmc.com/">Blogs &amp; Podcasts @TalkBMC</a></li> 
    48         <li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Detail/0,3464,9926222_33455235,00.html">External Communities</a></li> 
    49         <li><a href="http://www.bmc.com/BMC/Common/CDA/hou_Page_Detail/0,3464,9926222_10636328,00.html">User Groups</a></li> 
    50         <li><a href="http://devcon.bmc.com/">Developer Connection</a></li> 
    51         <li><a href="http://www.bmc.com/BMC/Common/Views/hou_vw_redirect_url/0,3411,9926222_34207904,00.html">Partner Network Login</a></li> 
    52       </ul></li></ul>''' 
     8#PROPERTY_SHEET = 'dropdownmenu_properties' 
  • qPloneDropDownMenu/branches/0.2/skins/qPloneDropDownMenu/drop_down.css.dtml

    r122 r463  
    22/* <dtml-call "REQUEST.set('portal_url', portal_url())"> (not this either :) */ 
    33 
    4 body { 
    5   behavior:url("&dtml-portal_url;/csshover.htc"); 
    6 } 
     4/*body { 
     5    behavior:url("&dtml-portal_url;/csshover.htc"); 
     6}*/ 
    77 
    88 
     
    6969        visibility: visible; 
    7070} 
    71 #portal-globalnav .csshover li:hover li ul, #portal-globalnav .csshover li:hover li:hover li ul, #portal-globalnav .csshover li:hover li:hover li:hover li ul, #portal-globalnav .csshover li:hover li:hover li:hover li:hover li ul {  
     71#portal-globalnav .csshover li:hover li ul, #portal-globalnav .csshover li:hover li:hover li ul, #portal-globalnav .csshover li:hover li:hover li:hover li ul, #portal-globalnav .csshover li:hover li:hover li:hover li:hover li ul { 
    7272        visibility: hidden; 
    7373} 
     
    7878} 
    7979 
    80 /*     ------   Make-up --------            */ 
     80/*     ------   Make-up --------            */ 
    8181 
    8282#portal-globalnav li.invisibleHeightKeeper { 
     
    9494 
    9595#portal-globalnav .csshover ul li:hover ul a { 
    96         background-color: &dtml-backgroundColor;; 
     96        background-color: &dtml-backgroundColor; 
    9797} 
    9898 
     
    188188} 
    189189 
    190 /*Configlet styles************************************************************/ 
    191  
    192 .ieVisible {display:none;} 
    193  
    194 * html .ieHidden {display: none;} 
    195  
    196 * html .ieVisible {display: block;} 
    197  
    198  
    199190/* </dtml-with> (do not remove this either :) */ 
  • qPloneDropDownMenu/branches/0.2/skins/qPloneDropDownMenu/prefs_dropdownmenu_edit_form.cpt.metadata

    r59 r463  
    55title=Edit Drop Down Menu 
    66 
    7 [validators] 
    8 validators..Save=validate_dropdownmenu_edit 
    9 validators..Regenerate=validate_dropdownmenu_edit 
    10  
    117[actions] 
    12 action.success..Save=traverse_to:string:dropdownmenu_edit 
    13 action.success..Regenerate=redirect_to:string:dropdownmenu_update 
    14 action.failure..Save=traverse_to:string:prefs_dropdownmenu_edit_form 
    15 action.failure..Regenerate=traverse_to:string:prefs_dropdownmenu_edit_form 
     8action.success=redirect_to:string:prefs_dropdownmenu_edit_form 
     9action.failure=traverse_to:string:prefs_dropdownmenu_edit_form 
Note: See TracChangeset for help on using the changeset viewer.