comanage-dev - [comanage-dev] r614 - in registry/trunk/app: Config/Schema Controller Lib Model View View/CoLocalizations View/CoTermsAndConditions View/Elements
Subject: COmanage Developers List
List archive
[comanage-dev] r614 - in registry/trunk/app: Config/Schema Controller Lib Model View View/CoLocalizations View/CoTermsAndConditions View/Elements
Chronological Thread
- From:
- To:
- Subject: [comanage-dev] r614 - in registry/trunk/app: Config/Schema Controller Lib Model View View/CoLocalizations View/CoTermsAndConditions View/Elements
- Date: Mon, 7 Oct 2013 15:07:23 -0400
Author: benno
Date: 2013-10-07 15:07:22 -0400 (Mon, 07 Oct 2013)
New Revision: 614
Added:
registry/trunk/app/Controller/CoLocalizationsController.php
registry/trunk/app/Model/CoLocalization.php
registry/trunk/app/View/CoLocalizations/
registry/trunk/app/View/CoLocalizations/add.ctp
registry/trunk/app/View/CoLocalizations/edit.ctp
registry/trunk/app/View/CoLocalizations/fields.inc
registry/trunk/app/View/CoLocalizations/index.ctp
registry/trunk/app/View/CoLocalizations/view.ctp
Modified:
registry/trunk/app/Config/Schema/schema.xml
registry/trunk/app/Controller/AppController.php
registry/trunk/app/Lib/lang.php
registry/trunk/app/Model/Co.php
registry/trunk/app/View/CoTermsAndConditions/fields.inc
registry/trunk/app/View/Elements/dropMenu.ctp
Log:
Add support for dynamic localization (CO-707)
Modified: registry/trunk/app/Config/Schema/schema.xml
===================================================================
--- registry/trunk/app/Config/Schema/schema.xml 2013-09-28 13:56:57 UTC (rev
613)
+++ registry/trunk/app/Config/Schema/schema.xml 2013-10-07 19:07:22 UTC (rev
614)
@@ -982,4 +982,31 @@
<col>co_person_id</col>
</index>
</table>
+
+ <table name="co_localizations">
+ <field name="id" type="I">
+ <key />
+ <autoincrement />
+ </field>
+ <field name="co_id" type="I">
+ <constraint>REFERENCES cm_cos(id)</constraint>
+ </field>
+ <field name="key" type="C" size="40" />
+ <field name="language" type="C" size="16" />
+ <field name="text" type="C" size="256" />
+
+ <index name="co_localizations_i1">
+ <col>co_id</col>
+ </index>
+ <index name="co_localizations_i2">
+ <col>co_id</col>
+ <col>language</col>
+ </index>
+ <index name="co_localizations_i3">
+ <col>co_id</col>
+ <col>key</col>
+ <col>language</col>
+ <unique />
+ </index>
+ </table>
</schema>
Modified: registry/trunk/app/Controller/AppController.php
===================================================================
--- registry/trunk/app/Controller/AppController.php 2013-09-28 13:56:57
UTC (rev 613)
+++ registry/trunk/app/Controller/AppController.php 2013-10-07 19:07:22
UTC (rev 614)
@@ -196,6 +196,25 @@
$this->CoInvite->CoPetition->EnrolleeCoPerson->Identifier->coId
= $coid;
}
+ // Load dynamic texts. We do this here because lang.php doesn't
have access to models yet.
+
+ global $cm_texts;
+ global $cm_lang;
+
+ $this->loadModel('CoLocalization');
+
+ $args = array();
+ $args['conditions']['CoLocalization.co_id'] = $coid;
+ $args['conditions']['CoLocalization.language'] = $cm_lang;
+ $args['fields'] = array('CoLocalization.key',
'CoLocalization.text');
+ $args['contain'] = false;
+
+ $ls = $this->CoLocalization->find('list', $args);
+
+ if(!empty($ls)) {
+ $cm_texts[$cm_lang] = array_merge($cm_texts[$cm_lang], $ls);
+ }
+
// Perform a bit of a sanity check before we get any further
try {
$this->verifyRequestedId();
@@ -1095,6 +1114,9 @@
// Manage CO enrollment flow definitions?
$p['menu']['coef'] = $roles['admin'];
+
+ // Manage CO Localizations
+ $p['menu']['colocalizations'] = $roles['admin'];
// Manage CO Links?
$p['menu']['conavigationlinks'] = $roles['admin'];
Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-09-28 13:56:57 UTC (rev 613)
+++ registry/trunk/app/Lib/lang.php 2013-10-07 19:07:22 UTC (rev 614)
@@ -22,7 +22,7 @@
* @version $Id$
*/
-global $cm_lang, $cm_texts;
+global $cm_lang, $cm_texts, $cm_texts_orig;
// XXX move this to a master config
$cm_lang = "en_US";
@@ -72,6 +72,8 @@
'ct.co_groups.1' => 'Group',
'ct.co_groups.pl' => 'Groups',
'ct.co_invites.1' => 'Invite',
+ 'ct.co_localizations.1' => 'Localization',
+ 'ct.co_localizations.pl' => 'Localizations',
'ct.co_navigation_links.1' => 'Navigation Link',
'ct.co_navigation_links.pl' => 'Navigation Links',
'ct.co_invites.pl' => 'Invites',
@@ -101,7 +103,7 @@
'ct.navigation_links.1' => 'Navigation Link',
'ct.navigation_links.pl' => 'Navigation Links',
'ct.org_identities.1' => 'Organizational Identity',
- 'ct.org_identities.se' => 'Organizational Identity Search',
+ 'ct.org_identities.se' => 'Organizational Identity Search',
'ct.org_identities.pl' => 'Organizational Identities',
'ct.organizations.1' => 'Organization',
'ct.organizations.pl' => 'Organizations',
@@ -404,6 +406,7 @@
'er.id.unk' => 'Unknown Identifier',
'er.inv.exp' => 'Invitation Expired',
'er.inv.nf' => 'Invitation Not Found',
+ 'er.loc.exists' => 'A localization already exists for the key "%1$s" and
language "%2$s"',
'er.nd.already' => 'NSF Demographic data already exists for this person',
'er.nt.email' => 'Notification could not be sent because no email
address was found',
'er.nt.send' => 'Notification to %1$s failed (%2$s)',
@@ -579,6 +582,7 @@
'fd.index' => 'Index',
'fd.inv.for' => 'Invitation for %1$s',
'fd.inv.to' => 'Invitation to %1$s',
+ 'fd.key' => 'Key',
'fd.language' => 'Language',
'fd.lan.desc' => 'Lowercase alphanumeric characters only',
'fd.link.location' => 'Link Location',
@@ -628,6 +632,8 @@
'fd.tc.url.desc' => 'The URL to the Terms and Conditions, which will be
displayed in a popup',
// This must be named fd.model.validation-field
'fd.telephone_number.number' => 'Phone',
+ 'fd.text' => 'Text',
+ 'fd.text.original' => 'Original Translation',
'fd.timestamp' => 'Timestamp',
'fd.title' => 'Title',
'fd.title.none' => 'No Title',
@@ -645,6 +651,7 @@
// Menu
'me.account' => 'My Account',
'me.changepassword' => 'Change Password',
+ 'me.collaborations' => 'Collaborations',
'me.configuration' => 'Configuration',
'me.for' => 'For %1$s',
'me.identity' => 'Identity',
@@ -768,7 +775,8 @@
'se.users.view' => 'Creating users view'
);
-// Attempt to add in any definitions created by plugins
+// Make a copy of the original texts, since CoLocalizations can override them
+$cm_texts_orig = $cm_texts;
/**
* Render localized text
@@ -819,7 +827,6 @@
* @since COmanage Registry v0.8
*/
-
function _bootstrap_plugin_txt()
{
global $cm_lang, $cm_texts;
Modified: registry/trunk/app/Model/Co.php
===================================================================
--- registry/trunk/app/Model/Co.php 2013-09-28 13:56:57 UTC (rev 613)
+++ registry/trunk/app/Model/Co.php 2013-10-07 19:07:22 UTC (rev 614)
@@ -42,6 +42,7 @@
"CoGroup" => array('dependent' => true),
// A CO can have zero or more CO people
"CoIdentifierAssignment" => array('dependent' => true),
+ "CoLocalization" => array('dependent' => true),
"CoPerson" => array('dependent' => true),
// A CO can have zero or more petitions
"CoPetition" => array('dependent' => true),
Property changes on: registry/trunk/app/View/CoLocalizations/add.ctp
___________________________________________________________________
Added: svn:special
+ *
Property changes on: registry/trunk/app/View/CoLocalizations/edit.ctp
___________________________________________________________________
Added: svn:special
+ *
Property changes on: registry/trunk/app/View/CoLocalizations/view.ctp
___________________________________________________________________
Added: svn:special
+ *
Modified: registry/trunk/app/View/CoTermsAndConditions/fields.inc
===================================================================
--- registry/trunk/app/View/CoTermsAndConditions/fields.inc 2013-09-28
13:56:57 UTC (rev 613)
+++ registry/trunk/app/View/CoTermsAndConditions/fields.inc 2013-10-07
19:07:22 UTC (rev 614)
@@ -40,7 +40,7 @@
<tbody>
<tr class="line1">
<td>
- <b><?php print _txt('fd.desc'); ?></b></b><font
class="required">*</font>
+ <b><?php print _txt('fd.desc'); ?></b><font class="required">*</font>
</td>
<td>
<?php print ($e
Modified: registry/trunk/app/View/Elements/dropMenu.ctp
===================================================================
--- registry/trunk/app/View/Elements/dropMenu.ctp 2013-09-28 13:56:57
UTC (rev 613)
+++ registry/trunk/app/View/Elements/dropMenu.ctp 2013-10-07 19:07:22
UTC (rev 614)
@@ -66,7 +66,7 @@
<li class="dropMenu">
<a>
<span>
- <?php print _txt('ct.organizations.pl'); ?>
+ <?php print _txt('me.collaborations'); ?>
</span>
<span class="ui-icon ui-icon-carat-1-s"></span>
</a>
@@ -257,6 +257,18 @@
print "</li>";
}
+ if(isset($permissions['menu']['colocalizations'])) {
+ print "<li>";
+ $args = array();
+ $args['plugin'] = null;
+ $args['controller'] = 'co_localizations';
+ $args['action'] = 'index';
+ $args['co'] = $menuCoId;
+
$this->Html->link(_txt('ct.co_localizations.pl'), $args);
+ print "</li>";
+ }
+
render_plugin_menus($this->Html, $plugins, 'coconfig',
$menuCoId);
print "</ul>";
- [comanage-dev] r614 - in registry/trunk/app: Config/Schema Controller Lib Model View View/CoLocalizations View/CoTermsAndConditions View/Elements, svnlog, 10/07/2013
Archive powered by MHonArc 2.6.16.