Grayside.Org's Syndication Island http://grayside.org/feed/atrium-planet/rss.xml en Adding a Content Type to the Open Atrium Calendar Views http://grayside.org/2010/09/adding-content-type-open-atrium-calendar-views <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>People often seem to wonder how they can get their new date-specified content types to show up on the Atrium Calendar. The following Views snippet makes it happen for a content type called &#8220;example_type&#8221; in module &#8220;custom&#8221;. Note that this code is specific to the Views as they were renamed for <a href="http://drupal.org/project/kit">Kit</a>-compatibility in Open Atrium 1.0-beta8.</p> <h3>Step 1</h3> <p>Build your &#8220;example_type&#8221; content type. You can build this out however you want, but for the purpose of this post you need to add the same <em>field_date</em> that the Event type uses.</p> <h3>Step 2</h3> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_views_default_views_alter(). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_views_default_views_alter<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$views</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$views</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'calendar_listing'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filters'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'example_type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'example_type'</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #000088;">$views</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'calendar_upcoming'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filters'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'example_type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'example_type'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <h2>Why Not Override the View with Views <span class="caps">UI</span>?</h2> <p>Once you have overridden the core Views in Atrium, you take a potentially stressful upgrade/maintenance path and make it vaguely nightmarish. Your changes will disappear into the ether when you upgrade. Restoring your changes would require building out a site based on a backup database to grab the key pieces of your override.</p> <p>By keeping these changes in code, you can much more easily determine how to fix them&#8230; assuming any changes are even necessary!</p> <p>Happy calendar&nbsp;hooking.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item odd"><a href="/category/terms/views">views</a></div><div class="field-item even"><a href="/category/terms/calendar">calendar</a></div></div></div> Wed, 08 Sep 2010 23:04:50 +0000 Grayside 89 at http://grayside.org http://grayside.org/2010/09/adding-content-type-open-atrium-calendar-views#comments Adding Items to the Open Atrium Settings Menu http://grayside.org/2010/08/adding-items-open-atrium-settings-menu <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>Recently I dusted off <a href="http://drupal.org/project/og_vocab"><span class="caps">OG</span> Vocabularies</a> with an eye toward integration with OpenAtrium. To my mild surprise, there was really not much that needed to be done. The menu path (node/%node/og/vocab) isn&#8217;t great, but that can be tackled later.</p> <p>All I wanted was to avoid another hidden tab that can only be reached by clicking on <strong>Settings &gt; Customize Features</strong>. I wanted the group vocabularies to be accessible directly in the Settings menu.</p> <p>It turns out it&#8217;s really simple. There is a hook.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_atrium_admin_links_alter(). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_atrium_admin_links_alter<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$links</span><span style="color: #339933;">,</span> <span style="color: #000088;">$space</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$space</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'og'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> menu_get_item<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;node/<span style="color: #006699; font-weight: bold;">{$space-&gt;id}</span>/og/vocab&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'access'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$links</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'og_vocab'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Manage Taxonomy'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'href'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'href'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item odd"><a href="/category/terms/interface">interface</a></div></div></div> Tue, 24 Aug 2010 16:55:07 +0000 Grayside 84 at http://grayside.org http://grayside.org/2010/08/adding-items-open-atrium-settings-menu#comments Kicking Off OG Privacy http://grayside.org/2010/08/kicking-og-privacy <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>I&#8217;ve just published the <a href="http://drupal.org/project/og_privacy">Organic Groups Privacy</a> module to Drupal.Org. It&#8217;s an <span class="caps">API</span> module intended to help give developers an easy and flexible way to define public access to Organic Groups posts. It exists specifically so I can convince <a href="http://drupal.org/project/spaces">Spaces</a> that I really mean it when I say an arbitrary 90% of an Organic Group should be private.</p> <p>It is bundled with a Feature that demonstrates how you might integrate it with an Open Atrium site, but the core of <span class="caps">OG</span> Privacy can be useful even without Spaces being in the mix at all.</p> <p>With it, you can do such neat things as declare all Blog posts private to group members with a simple hook implementation:</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_og_privacy_policy_info(). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_og_privacy_policy_info<span style="color: #009900;">&#40;</span><span style="color: #000088;">$node</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$policies</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #000088;">$policies</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'private_blog_type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; <span style="color: #0000ff;">'access callback'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'custom_private_blog_policy'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; <span style="color: #0000ff;">'reason'</span> <span style="color: #339933;">=&gt;</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Blog posts are only viewable by group members.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$policies</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #009933; font-style: italic;">/** &nbsp;* Blog type privacy policy callback. &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> og_privacy_blog_type_policy<span style="color: #009900;">&#40;</span><span style="color: #000088;">$node</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$node</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">type</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'blog'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <p>If you read through the <a href="http://drupalcode.org/viewvc/drupal/contributions/modules/og_privacy/og_privacy.api.php?view=markup"><span class="caps">API</span> documentation</a>, you will see that the above policy is <em>implicitly non-exclusive</em> meaning any old module could come along with it&#8217;s own policy to make a blog post visible.</p> <p>For an example of an exclusive policy, which exercises supreme executive veto power to guarantee the privacy of, say, all the content from your Atrium Casetracker feature, it might look like this:</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_og_privacy_policy_info(). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_og_privacy_policy_info<span style="color: #009900;">&#40;</span><span style="color: #000088;">$node</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$policies</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #000088;">$policies</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'private_atrium_casetracker'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; <span style="color: #0000ff;">'access callback'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'custom_private_atrium_casetracker_policy'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; <span style="color: #0000ff;">'reason'</span> <span style="color: #339933;">=&gt;</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content types created by the casetracker feature are viewable only by group members.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> &nbsp; &nbsp; <span style="color: #0000ff;">'exclusive'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;"><span class="caps">TRUE</span></span><span style="color: #339933;">,</span> &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$policies</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #009933; font-style: italic;">/** &nbsp;* Atrium Case Tracker privacy policy callback. &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> og_privacy_atrium_casetracker_policy<span style="color: #009900;">&#40;</span><span style="color: #000088;">$node</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$map</span> <span style="color: #339933;">=</span> features_get_component_map<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'node'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$map</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$node</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">type</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #000088;">$feature</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/reset"><span style="color: #990000;">reset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$map</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$node</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">type</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$feature</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'atrium_casetracker'</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;"><span class="caps">TRUE</span></span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <p>By building your own selection of exportables and <em>hook_form_alter()</em> implementations around such policy definitions you can control public access very easily.</p> <p>For a somewhat more detailed explanation of the guts of how this works, <a href="http://drupalcode.org/viewvc/drupal/contributions/modules/og_privacy/<span class="caps">README</span>.txt?view=markup">check out the&nbsp;<span class="caps">README</span></a>.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/modules">modules</a></div><div class="field-item odd"><a href="/category/terms/spaces">spaces</a></div><div class="field-item even"><a href="/category/terms/og">og</a></div><div class="field-item odd"><a href="/category/terms/access">access</a></div></div></div> Mon, 16 Aug 2010 20:38:15 +0000 Grayside 87 at http://grayside.org http://grayside.org/2010/08/kicking-og-privacy#comments Spaces Integrating a CCK Field http://grayside.org/2010/07/spaces-integrating-cck-field <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>I wanted to make a <span class="caps">CCK</span> Field available only when a given feature was enabled. It turns out it&#8217;s really easy.</p> <p><span class="caps">CCK</span> comes with a <em>hook_field_access()</em> hook (see <a href="http://api.lullabot.com/content_access">content_access()</a>). Any implementation of this function that returns <span class="caps">FALSE</span> for a given field results in that field being denied to the user.</p> <p>By implementing this function with a <a href="http://drupal.org/project/spaces">Spaces</a> <span class="caps">API</span> call instead of the content_permissions module approach of a new, field-specific permission, all kinds of magic becomes possible.</p> <p>Read on for demonstration code.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_field_access(). &nbsp;* Allow View/Edit access to 'field_my_cck_field' only when 'feature_name' is enabled. &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_field_access<span style="color: #009900;">&#40;</span><span style="color: #000088;">$op</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #000088;">$account</span><span style="color: #339933;">,</span> <span style="color: #000088;">$node</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;"><span class="caps">NULL</span></span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #666666; font-style: italic;">// Be sure not to affect other fields.</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'field_my_cck_field'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;"><span class="caps">TRUE</span></span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; &nbsp; <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$op</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'edit'</span><span style="color: #339933;">:</span> &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'view'</span><span style="color: #339933;">:</span> &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Make access contingent on whether a given feature is enabled in the current space, such as atrium_book.</span> &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> spaces_access_feature<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'view'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'feature_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <p><strong><span class="caps">EDIT</span>: <a href="http://drupal.org/node/887272">Issue posted</a> to the Spaces queue with patch to add this functionality generically for all&nbsp;fields.</strong></p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/cck">cck</a></div><div class="field-item odd"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item even"><a href="/category/terms/access-control">access control</a></div><div class="field-item odd"><a href="/category/terms/spaces">spaces</a></div></div></div> Mon, 26 Jul 2010 20:25:09 +0000 Grayside 86 at http://grayside.org http://grayside.org/2010/07/spaces-integrating-cck-field#comments Integrating Some Other Feature with Spaces http://grayside.org/2010/07/integrating-some-other-feature-spaces <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>I have found more than once a situation in which I had a basic feature that could be used on any site which I would like to see integrated with Spaces (for OpenAtrium magic). It usually runs like this:</p> <ol> <li>I have the FeatureServer feature.</li> <li>I want it in OpenAtrium.</li> <li>Here&#8217;s a new Feature that provides some Contexts and some Groups variables.</li> <li>Here&#8217;s a patch that you must apply to FeatureServer to make Spaces aware of it. (And other stuff).</li> </ol> <p>&#35;4 is a pain, but I&#8217;ve recently discovered how to shrink it down a little more: hook_system_info_alter().</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_system_info_alter(). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> my_atrium_savvy_feature_system_info_alter<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$info</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'some_other_feature'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'spaces'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'types'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'og'</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <p>This hook is called from <em>features_get_info()</em> in features.module. The hook allows you to changes all the info files settings of a feature. Note: Row is apparently a huge variable to dump to the&nbsp;screen.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item odd"><a href="/category/terms/spaces">spaces</a></div><div class="field-item even"><a href="/category/terms/features">features</a></div></div></div> Fri, 23 Jul 2010 16:10:17 +0000 Grayside 85 at http://grayside.org http://grayside.org/2010/07/integrating-some-other-feature-spaces#comments Modifying Contexts the Old-Fashioned Way http://grayside.org/2010/06/modifying-contexts-old-fashioned-way <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>There are two ways to change <a href="http://drupal.org/project/context">contexts</a>. The new awesomeness is to use <a href="http://drupal.org/project/features">Features</a> or other exportable techniques to create a new version of your modified contexts, and push the old ones out of the way.</p> <p>However, when I avoid hacking [atrium] core, I prefer the old way&#8211;today that&#8217;s alter hooks.</p> <p>Alter hooks in Context allow you to do zany things like modifying the <em>conditions</em> or <em>reactions</em> associated with a given context. Naturally, if the original context slides out from under your original assumptions you&#8217;ll have to make some changes. In the meantime, just remember that using such powerful things as hook_context_load_alter() you can completely break a context if you are not careful.</p> <p>Below are some examples of context manipulations I&#8217;ve learned through a bit of code trawling and error trials.</p> <p>For the sake of (some) future compatibility I am using the Context <span class="caps">API</span> as of 3.0-beta4.</p> <p>&gt; <em><span class="caps">EDIT</span>: The method previously illustrated here for altering context conditions via hook_context_load_alter() was flat-out wrong, and will not work. Unless you were to use it to preload the context_ui just to go to the context ui edit page and click save. Then it would do something.</em></p> <h2>Adding a Content Type Condition</h2> <p>In my approach to integrating Feature Servers into OpenAtrium, I decided to pull the Project content type created by the Feature Server module into the casetracker project context. This required a new condition.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_context_default_contexts_alter(). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_context_default_contexts_alter<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$contexts</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$contexts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'spaces-feature-casetracker'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">conditions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'node'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'values'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fserver_project'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'fserver_project'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <h2>Adding a Path Condition</h2> <p>In working out <span class="caps">OA</span> Book Manager, I wanted to add my new admin pages to the book context so the sidebar book navigation would stick around. Do you see where this code is broken?</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_context_default_contexts_alter(). &nbsp;\*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_context_default_contexts_alter<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$contexts</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$contexts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'spaces-feature-book'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">conditions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; <span style="color: #0000ff;">'values'</span> <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'notebook/manage/\*'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'notebook/manage/*'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <p>When manipulating contexts, you need to keep a close lookout for when you are adding new array elements and when you are overriding array elements. By setting the path in this way, I am clearing out any existing path-based conditions. Instead, I should assign the new path element at a deeper part of the array.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_context_default_contexts_alter(). &nbsp;\*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_context_default_contexts_alteer<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$contexts</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$contexts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'spaces-feature-book'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">conditions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'values'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'notebook/manage/\*'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'notebook/manage/\*'</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <p>This code does not blast away existing path conditions.</p> <h2>Adding a Block Reaction</h2> <p>Recently I&#8217;ve been working on creating a dashboard <span class="caps">RSS</span> feed for OpenAtrium. I wanted to add a new block to the user profile page to present some links and use instructions.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_context_load_alter(). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_context_load_alter<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$context</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$context</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'atrium_profile'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #000088;">$block</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'custom-some_new_block'</span> <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'module'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'custom'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'delta'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'some_new_block'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'region'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'right'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'weight'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <span style="color: #000088;">$context</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">reactions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'block'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'blocks'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array_merge"><span style="color: #990000;">array_merge</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$context</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">reactions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'block'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'blocks'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$block</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <p>This time I threw in an array_merge to avoid clobbering the existing&nbsp;blocks.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/context">context</a></div><div class="field-item even"><a href="/category/terms/dont-hack-core">don&#039;t-hack-core</a></div></div></div> Mon, 21 Jun 2010 23:05:01 +0000 Grayside 83 at http://grayside.org http://grayside.org/2010/06/modifying-contexts-old-fashioned-way#comments Optional Spaces Integration for a View http://grayside.org/2010/06/optional-spaces-integration-view <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>If you want to make an exported [node-based] View smoothly integrate with Spaces, you can use the following code to modify the View structure with the &#8220;Content in current space&#8221; filter. This filter does nothing if the View is not itself in a Space, otherwise it restricts all results to content in the same space. Add any conditions you want to control whether the Spaces integration is applied.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Implementation of hook_views_default_views_alter(). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_views_default_views_alter<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$views</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>module_exists<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'spaces'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #000088;">$views</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'view_name_here'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filters'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'current'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'operator'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'all'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'group'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'exposed'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;"><span class="caps">FALSE</span></span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'expose'</span> <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'operator'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;"><span class="caps">FALSE</span></span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'current'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'table'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'spaces'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'field'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'current'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'relationship'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'none'</span><span style="color: #339933;">,</span> &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <p>If you would like to take it a step further, and create OpenAtrium features integration, insert the following:</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$views</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'view_name_here'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'access'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> &nbsp; <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'atrium_feature'</span><span style="color: #339933;">,</span> &nbsp; <span style="color: #0000ff;">'spaces_feature'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'feature_name'</span><span style="color: #339933;">,</span> &nbsp; <span style="color: #0000ff;">'perm'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'access content'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// or any other permission</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div> </div> <p>hook_views_default_views_alter() fires off before the View is cached, so be sure to clear your cache after adding this code to see the results.</p> <p>This code snippet is a finding from my work on <a href="http://grayside.org/2010/06/integrating-features-server-openatrium">OpenAtrium-FeatureServer&nbsp;integration</a>.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/views">views</a></div><div class="field-item even"><a href="/category/terms/spaces">spaces</a></div></div></div> Tue, 15 Jun 2010 21:05:02 +0000 Grayside 82 at http://grayside.org http://grayside.org/2010/06/optional-spaces-integration-view#comments Drush with Bash Aliases http://grayside.org/2010/06/drush-bash-aliases <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>I&#8217;ve been looking for some decent ways of managing the use of modules hosted in random Features Servers. Particularly, how do I use Drush as seamlessly with a Features Server as it works with Drupal.Org?</p> <p>It turns out that Drush has a lot of special options buried in the <em>pm-download (dl)</em> command, the very Drush maneuver most helpful for my goal. Naturally, these options can be included in a Bash Alias for Drush.</p> <div class="geshifilter"> <div class="text geshifilter-text" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal">alias dds='drush --source=http://code.developmentseed.org/fserver dl'</pre></div> </div> <p>This alias specifically searches DevSeed&#8217;s features server for projects. Slide it into your <a href="http://www.linux.org/lessons/beginner/l6/lesson6a.html"><em>.bashrc</em> file</a>. Now a quick <em>$&gt; dds fserver</em> works like a charm.</p> <p>I still think <a href="http://grayside.org/2010/05/drush-and-features-servers">project repositories</a> like Ubuntu&#8217;s package repos (or really, Arch repositories like Core, Extra, and Aur) have a lesson for us. But that can wait on the smoothing out of functionality like <em>&#8211;destination</em>, which allows you to say where a project will be saved, but not with the same grace as Drupal.Org projects and the <em>modules/contrib/</em>&nbsp;directory.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/drush">drush</a></div><div class="field-item odd"><a href="/category/terms/features-servers">features-servers</a></div></div></div> Thu, 10 Jun 2010 06:18:40 +0000 Grayside 80 at http://grayside.org http://grayside.org/2010/06/drush-bash-aliases#comments Integrating the Features Server into OpenAtrium http://grayside.org/2010/06/integrating-features-server-openatrium <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>Working on integrating the <a href="http://code.developmentseed.org/featureserver/node/163">Features Server</a> feature into <a href="http://openatrium.com">OpenAtrium</a>. My intention is to set it up as another Casetracker Project type.</p> <p>OpenAtrium provides a solid case tracker and documentation system, and is a natural fit for the infrastructure of a Drupal.Org-style project ecosphere. Integrating them will allow me to post Features I&#8217;ve created to a place where I might actually have a means to get feedback on my work, let alone provide support.</p> <h2>Project Status of <span class="caps">OA</span> Features Server feature</h2> <ul> <li>Features Project as a Casetracker Project <strong>✓</strong></li> <li>Features Project automatically a Notebook <strong>✓</strong> </li> <li>Converting Projects View to a Site/Group feature. [in progress]</li> <li>Trivial Modification of Features Server code to play nice with OpenAtrium and Atrium Casetracker .<strong>✓</strong> [will ship with patch]</li> </ul> <h2>Conundrums</h2> <ul> <li>Features Server feature uses Context 2.0, <span class="caps">OA</span> uses Context 3.0</li> <li>hook_views_default_views_alter() has limited to no best practices or examples I&#8217;ve been able to find, given it&#8217;s currently documented intention as a site-specific hook. Somehow I don&#8217;t think it&#8217;s role will remain in site-customization in the world of&nbsp;Features.</li> </ul> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item even"><a href="/category/terms/features-servers">features-servers</a></div></div></div> Thu, 03 Jun 2010 16:32:53 +0000 Grayside 77 at http://grayside.org http://grayside.org/2010/06/integrating-features-server-openatrium#comments cat kit | specificity http://grayside.org/2010/05/cat-kit-specificity <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>When you read through <a href="http://drupal.org/project/kit">Kit</a>, one of the themes that keeps cropping up is the concept of specific relevance. How do you know when it is a good idea to include a given variable, permission, or other component in your Feature?</p> <p>The answer boils down to this: <em>Keep your Feature lean and mean. Include only what&#8217;s necessary for a good, mission-complete piece of functionality.</em> The primary reason for this rule strikes me as the worthy goal of avoiding a horde of bloated, conflicting Features that will make an ill-configured wreckage of the sites that try to use them.</p> <p>Behind the fold for further thoughts about what specificity means in a well-built Feature.</p> <p>In thinking about it further (and the way I&#8217;ve used Features so far), I found a couple examples of why specificity is worth thinking about.</p> <h2>1. The Over-Configured Content Type</h2> <p>I created a Feature around a new content type. The Feature itself related to how that content was listed around the site (a couple of Views). I exported every variable related to how I had configured the content type, even though my <a href="http://drupal.org/project/vertical_tabs">Vertical Tabs</a> settings had no specific relevance to the functionality I was seeking to isolate and export.</p> <p>For an internal-use sort of Feature, I&#8217;m sure this does not matter. (Unless you are trying to define all your Vertical Tabs settings in a different Feature). For a publicly-shared feature, you have now introduced a piece of Vertical Tabs configuration which really has no bearing on the reason someone else might have been interested in your Feature.</p> <h2>2. It&#8217;s How I Use It</h2> <p>People disagree on how specialized any given modular website nugget should be. Just look at all the Drupal Modules with overly-themed defaults. Kit specificity in a Feature means the Feature includes only the aspects of theming and site integration necessary for the Feature to make sense, not that your specific use case for that Feature is realized in a shiny exported module.</p> <p>For internal-use&#8230; go for it! Kit is clearly intended as a standard for the growing world of shared Features. Exportables purely for deployment facilitation need not apply. Of course, Kit-compliance from the get-go will surely help you make the unlooked for transition to a publicly published Feature much&nbsp;easier.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/features">features</a></div><div class="field-item even"><a href="/category/terms/kit">kit</a></div></div></div> Tue, 01 Jun 2010 06:52:43 +0000 Grayside 76 at http://grayside.org http://grayside.org/2010/05/cat-kit-specificity#comments cat kit | summarize namespacing http://grayside.org/2010/05/cat-kit-summarize-namespacing <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>I decided a few notes would help me grok the <a href="http://drupal.org/project/kit">Kit Specification</a>. I post them here in case someone else finds them useful.</p> <h2>Shortest Summary</h2> <p>Project Name and Feature Name should be the same. They should have a nice, unique namespace. The human readable version doesn&#8217;t need to show the prefix. Views and other individually exported pieces should be prefixed with the not-necessarily-unique part of the Feature name.</p> <h2>Barely-Shorter Sumary</h2> <p>This summary currently covers the Features Specification 1.0-draft.</p> <h3>Code Namespace</h3> <p><strong>Covers:</strong> Filenames, function names, directory name.<br /> <strong>Rule:</strong> Make the namespace (prefix) unique.</p> <p>&gt; Domain names and Drupal.Org user names make good prefixes. Why? Because they are guaranteed unique by an external authority everyone in the Drupal community is bound to bump into.</p> <h3>Project Namespace</h3> <p><strong>Covers:</strong> Project name, as defined in .info file and a Features Server feature node.<br /> <strong>Rule:</strong> Same as the code namespace for a single-feature project.</p> <h3>Machine Name</h3> <p><strong>Covers</strong>: Generic part of the feature name.<br /> <strong>Rule:</strong> Should be short and descriptive.</p> <p>Features will generally be called <em>&lt;namespace&gt;_&lt;machine name&gt;</em>.</p> <h3>Human Readable Name</h3> <p><strong>Covers</strong>: Name of the feature, such as on the modules page. (As defined by <em>name</em> in .info file.)<br /> <strong>Rule:</strong> Skip the namespace. Stick with a descriptive name.</p> <p>(I interpret this to be a human-readable version of the Machine Name.)</p> <h3>Component Namespace</h3> <p><strong>Covers</strong>: All the bits that are exportable. (Views, Content Types, Rules, etc)<br /> <strong>Rule:</strong> Prefix with the Machine Name.</p> <h2>Example</h2> <p>Here are the namespace selections for a project enhancing the OpenAtrium Notebook.</p> <ul> <li><strong>Namespace</strong>: grayside</li> <li><strong>Project Name</strong>: grayside_oa_book_manager</li> <li><strong>Machine Name</strong>: oa_book_manager</li> <li><strong>Human Readable Name</strong>: <span class="caps">OA</span> Book Manager</li> <li><strong>Component Namespace</strong>: <ul> <li><em>View:</em> oa_book_manager_bulk_update</li> <li><em>Rule:</em>&nbsp;oa_book_manager_new_page_message</li> </ul> </li> </ul> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/features">features</a></div><div class="field-item even"><a href="/category/terms/kit">kit</a></div><div class="field-item odd"><a href="/category/terms/namespace">namespace</a></div></div></div> Sun, 23 May 2010 06:03:15 +0000 Grayside 75 at http://grayside.org http://grayside.org/2010/05/cat-kit-summarize-namespacing#comments Feature Server: Not That Hard http://grayside.org/2010/05/feature-server-not-hard <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>It turns out that running your own Feature Server isn&#8217;t that complicated. Get a Drupal site. Install the <a href="http://code.developmentseed.org/featureserver/node/163">fserver</a> feature. It&#8217;s most exotic requirements are Filefield and Context, and context is just their to facilitate easy block placement of release information.</p> <p>All the feature really does is provide a fancy <span class="caps">XML</span> Views style plugin, a couple content types with their <span class="caps">CCK</span> fields to specify things like version information, and some special file-handling magic to push files and tarballs around.</p> <p>It slid into this blog site very easily, and now I have a very clean way of upload and sharing Drupal code and functionality snippets. But should I leave the fserver as part of my blog? The last thing I need is to release a couple popular features into the wild and have to worry about the Update Status module pinging my words to&nbsp;death.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/features">features</a></div><div class="field-item odd"><a href="/category/terms/features-servers">features-servers</a></div></div></div> Fri, 07 May 2010 06:27:40 +0000 Grayside 71 at http://grayside.org http://grayside.org/2010/05/feature-server-not-hard#comments OpenAtrium Group Manager as Content Administrator http://grayside.org/2010/05/openatrium-group-manager-content-administrator <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>In Drupal, it only takes a couple hours (or perhaps a couple days) to build the concept of a site-wide content manager into your system. It gets mighty tricky to start parceling out administrative tasks for parts of the site.</p> <p>With Organic Groups (the module behind OpenAtrium&#8217;s groups), the solution to this problem has always been messy. But with the advent of Spaces and Group Administrator configuration, it seems like <span class="caps">OA</span> and related sites are within shouting distance of giving Group Managers the power of Content Administration.</p> <p>Between my <a href="/project/oa-change-group"><span class="caps">OA</span> Change Group</a> and <a href="/project/oa-book-manager"><span class="caps">OA</span> Book Manager</a> modules, I&#8217;ve started experimenting with how to bring that kind of capability to light.</p> <p><span class="caps">OA</span> Change Group adds a new subtab to admin/content/node. That works fine, for site-wide administrators. It also allowed me to punt on the whole notion of double-checking that the logged in user has the right to post content to the destination group. But it doesn&#8217;t help group managers, except to the extent that the site admins are ready and willing to take content management tickets.</p> <p><span class="caps">OA</span> Book Manager takes a cue from the content-management-lite Archive feature in <span class="caps">OA</span>, and slaps a sub-tab into the feature it&#8217;s related to. In this case, adding a &#8220;Manage&#8221; tab to the Notebook feature.</p> <p>But if <span class="caps">OA</span> content management is going to remain a cohesive experience for site administrators and group managers alike, a few more best practices need to be worked out, and <span class="caps">OA</span> needs to come packaged with more of a skeletal administration system in the groups themselves so feature-builders know what to be thinking about in working&nbsp;together.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item even"><a href="/category/terms/content-manager">content manager</a></div></div></div> Thu, 06 May 2010 07:38:13 +0000 Grayside 70 at http://grayside.org http://grayside.org/2010/05/openatrium-group-manager-content-administrator#comments Drush and Features Servers http://grayside.org/2010/05/drush-and-features-servers <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>Feature Servers have great potential to help structure the use of code sourced outside the formal ecosphere around Drupal.Org this has it&#8217;s pro&#8217;s and con&#8217;s, but I already see their usefulness in providing a little more structure to issue-queue code exchanges and organization-internal modules. So let&#8217;s bring Drush into this and boost the ease of use of that usefulness another step up.</p> <p><em>For those who need more catching up:</em><br /> Features are a special kind of <a href="http://drupal.org">Drupal</a> module built on the <a href="http://drupal.org/project/features">features</a> project. They allow you to easily export configuration from your site into a module usable on any site. Modules downloaded from a <a href="http://developmentseed.org/blog/2009/jun/24/distributed-feature-servers-drupal">Features Server</a> are the next best thing to one posted to Drupal.org. <a href="http://sf2010.drupal.org/conference/sessions/managing-and-deploying-configuration-exportables-and-features-module">DrupalConSF has a great video</a>.</p> <h3>Current State</h3> <p>The rise of Feature Servers, and perhaps other types of code release repositories would benefit from a little Drush magic. The little-documented option of <strong>&#8211;source</strong> is a starting place:</p> <div class="geshifilter"> <div class="text geshifilter-text" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal">drush --source=http://code.developmentseed.org/fserver/ dl fserver </pre></div> </div> <p>This code will grab the latest, most recommended release of the Feature Server code from DevSeed&#8217;s feature server.</p> <h3>Future Directions</h3> <p>I&#8217;ve started an issue in the <a href="http://drupal.org/node/786916">Drush queue</a> to talk about some kind of repository scheme to help manage the download and file placement of code from individually preferred&nbsp;repositories.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/drush">drush</a></div><div class="field-item even"><a href="/category/terms/features">features</a></div><div class="field-item odd"><a href="/category/terms/features-servers">features-servers</a></div></div></div> Sat, 01 May 2010 07:14:15 +0000 Grayside 65 at http://grayside.org http://grayside.org/2010/05/drush-and-features-servers#comments Single Group Login Redirect http://grayside.org/2010/04/single-group-login-redirect <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p><a href="http://community.openatrium.com">Community.<span class="caps">OA</span></a> had a <a href="https://community.openatrium.com/issues/node/1805">request</a> for functionality that would redirect a user with a single group membership to that group&#8217;s homepage.</p> <p><a href="http://tinkercms.grayside.org/projects/oa-single-group-login-redirect">I packaged that functionality up as a Feature</a>, so you can use it too. The <em>oa_</em> prefix refers to the support for spaces_og/purl to generate a group&nbsp;<span class="caps">URL</span>.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item odd"><a href="/category/terms/drupal6">drupal6</a></div><div class="field-item even"><a href="/category/terms/organic-groups">organic groups</a></div><div class="field-item odd"><a href="/category/terms/rules">rules</a></div><div class="field-item even"><a href="/category/terms/login">login</a></div></div></div> Wed, 28 Apr 2010 21:39:37 +0000 Grayside 64 at http://grayside.org http://grayside.org/2010/04/single-group-login-redirect#comments Changing Node Group Audience http://grayside.org/2010/04/changing-node-group-audience <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>In OpenAtrium, it&#8217;s not easy to change the group affiliation of a node once it has been created. <span class="caps">OA</span> locks down the interface to set group audience specifically to make the interface easier to understand.</p> <p>I have just posted a quick feature that demonstrates how to grant administrators the ability to shuffle nodes around between groups, it can be found in the <a href="https://community.openatrium.com/issues/node/48#comment-3624">issue queue at community.<span class="caps">OA</span></a>.</p> <p>It introduces two things&#8211;a new Action that toggles the group audience of a given node, and a <a href="http://drupal.org/project/views_bulk_operations">Views Bulk Operations</a> View that allows you to apply that action to batches.</p> <p>There is a special column in the View labeled &#8220;Member of Private Group&#8221;. This column lets the administrator know whether the current group is a private group, meaning the content is almost certainly private as well. Any quality of the group a node starts in will be lost once you move a node to a new group, and that includes whether it is private content. Remember that, and use with care!</p> <p>Note: If you preface the <span class="caps">URL</span> of the View with a group namespace, it will limit the content to the nodes of that group.</p> <p><strong>Download feature from my Features Server&nbsp;<a href="http://tinkercms.grayside.org/projects/atrium-groups-change-node-group">here</a></strong></p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item odd"><a href="/category/terms/views">views</a></div><div class="field-item even"><a href="/category/terms/og">og</a></div><div class="field-item odd"><a href="/category/terms/vbo">vbo</a></div><div class="field-item even"><a href="/category/terms/actions">actions</a></div></div></div> Mon, 12 Apr 2010 18:33:31 +0000 Grayside 62 at http://grayside.org http://grayside.org/2010/04/changing-node-group-audience#comments Simple Spaces Recipe for a Static Welcome Widget http://grayside.org/2010/03/simple-spaces-recipe-static-welcome-widget <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>One of the little conundrums in OpenAtrium (and I imagine in Spaces) is building static content for the space. (Or in OpenAtrium terms, getting a nice dashboard box to stay put, yet be customizable by group.)</p> <p>There are countless ways of doing this, but I opted to create a <span class="caps">CCK</span> Textarea field in my group content type (named <em>field_group_welcome_message</em>) and turn on the <span class="caps">PHP</span> filter.</p> <p>Then I created a <a href="http://drupal.org/project/boxes">Box</a> (which is what OpenAtrium uses, could just as well have been a block) using the following snippet:</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$space</span> <span style="color: #339933;">=</span> spaces_get_space<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$space</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">group</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_group_welcome_message</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;"><span class="caps">NULL</span></span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$format</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$space</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">group</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_group_welcome_message</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'format'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> check_markup<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$format</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;"><span class="caps">TRUE</span></span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$space</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">group</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">og_description</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">print</span> <span style="color: #000088;">$text</span><span style="color: #339933;">;</span></pre></div> </div> <p>The bit about <tt>$format</tt> and <tt>check_markup</tt> is only relevant if you turn on input filtering for your textarea. Can&#8217;t figure why you would not do that. <strong><span class="caps">UPDATE</span>: Added a check for a null welcome message. If there is none, the group description will be inserted.</strong></p> <p>Now, whenever anyone goes to edit the group node/group settings, they are also offered the chance to play with the welcome message. You could just as well use this technique to pull out the Body of the group node, if that&#8217;s available. In OpenAtrium it&#8217;s removed, since it doesn&#8217;t fit into the dashboard concept without this kind of magic.</p> <p>You could just as easily build some kind of zany view to achieve the same result, but you&#8217;d still need to do something to mark your target content uniquely. This method seems the most straightforward for the end-user.</p> <p>I will update this another time with information about enabling such a block by&nbsp;default.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item odd"><a href="/category/terms/spaces">spaces</a></div><div class="field-item even"><a href="/category/terms/dashboard">dashboard</a></div><div class="field-item odd"><a href="/category/terms/boxes">boxes</a></div></div></div> Sun, 07 Mar 2010 08:33:50 +0000 Grayside 58 at http://grayside.org http://grayside.org/2010/03/simple-spaces-recipe-static-welcome-widget#comments Moving OpenAtrium Node Form Elements to the Right Column http://grayside.org/2010/03/moving-openatrium-node-form-elements-right-column <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>Previously, I discussed how you could <a href="http://grayside.org/2009/11/cck-fields-and-open-atrium-node-form">move <span class="caps">CCK</span> fields into the node form sidebar</a> by careful fieldgroup naming.</p> <p>If you are of a programmer&#8217;s bent, you might instead try the more flexible programmer&#8217;s solution&#8211;preprocessor function. I dug this out of the atrium_blog feature.</p> <p>This code snippet isolates a nodereference field attached to blog content and pushes it into the sidebar. This should work to move entire fieldgroups of form elements too.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Preprocessor for theme('node_form'). &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> atrium_blog_preprocess_node_form<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_referenced_book_page'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sidebar'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_referenced_book_page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_referenced_book_page'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_referenced_book_page'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <h2>OpenAtrium 1.0-beta8</h2> <p>As of Beta 8, the above code does not seem to work. I haven&#8217;t found the ideal solution, but it&#8217;s match in Beta8 is as follows:<br /> This is the result of Open Atrium&#8217;s move to using the <a href="http://drupal.org/project/nodeformcols">Nodeformcols</a> to facilitate sidebar wrangling.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009933; font-style: italic;">/** &nbsp;* Preprocessor function for node form. &nbsp;* Move <span class="caps">CCK</span> field to the sidebar. &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_preprocess_node_form<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nodeformcols_region_main'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_sidebar_reference'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nodeformcols_region_right'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_sidebar_reference'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nodeformcols_region_main'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_sidebar_reference'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nodeformcols_region_main'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_sidebar_reference'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/node-form">node-form</a></div><div class="field-item odd"><a href="/category/terms/openatrium">openatrium</a></div></div></div> Sat, 06 Mar 2010 20:01:47 +0000 Grayside 57 at http://grayside.org http://grayside.org/2010/03/moving-openatrium-node-form-elements-right-column#comments Atrium Casetracker: Change Which Case Statuses are "Closed" http://grayside.org/2010/02/atrium-casetracker-change-which-case-statuses-are-closed <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>You might wonder how cases are considered &#8220;closed&#8221; for purposes of case filtering in the Case Tracker. It&#8217;s an attempt to be helpful on the Case Tracker&#8217;s part– hide the stuff that is no longer relevant unless the user specifically asks for it. Unfortunately, I don&#8217;t like the defaults on what it considers irrelevant.</p> <p>This filtration occurs in the Atrium Casetracker feature, by filtering out cases that match a hardcoded list of statuses. By changing the hardcoded statuses, we can bring the casetracker in line with any customization you care to make to the state types. Eventually, this kind of functionality will be handled more smoothly by the Casetracker module itself, but that functionality is waiting on the next version of Casetracker. (Personally, I hope there is something like a checkbox on each status to declare it &#8220;inactive&#8221;.)</p> <h2>Changing&nbsp;Code</h2> <p>Visit line 335 of <tt>atrium_casetracker.module</tt>, and you will find the function <tt>atrium_casetracker_get_inactive_states()</tt>. Read down a few lines to find:<br /> <span class="geshifilter"><code class="text geshifilter-text">&nbsp; &nbsp; $search = array('closed', 'deferred', 'duplicate', 'postponed', 'fixed');</code></span></p> <p>I want to drop &#8220;fixed&#8221; because I am not using that as a state and &#8220;deferred and &#8220;postponed&#8221; because I prefer to see delayed tasks so they don&#8217;t get forgotten. Lastly, the difference between Resolved and Closed is kind of hazy to some of my site&#8217;s users, so I changed &#8220;closed&#8221; to &#8220;archived&#8221; and need to reflect that here.</p> <p>It becomes:</p> <p><span class="geshifilter"><code class="text geshifilter-text">&nbsp; &nbsp; $search = array('archived', 'duplicate');</code></span></p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/casetracker">casetracker</a></div><div class="field-item even"><a href="/category/terms/openatrium">openatrium</a></div></div></div> Mon, 08 Feb 2010 21:35:30 +0000 Grayside 53 at http://grayside.org http://grayside.org/2010/02/atrium-casetracker-change-which-case-statuses-are-closed#comments