[Fusionforge-general] [Fusionforge-commits] r18236 - in trunk/src: common/widget www/widgets

Franck Villaume franck.villaume at trivialdev.com
Tue Oct 15 20:07:25 CEST 2013


Le 15/10/2013 19:45, Franck Villaume a écrit :
> Le 15/10/2013 19:44, Marc-Etienne Vargenau a écrit :
>> Le 15/10/2013 19:37, Franck Villaume a écrit :
>>> Le 15/10/2013 19:04, Marc-Etienne VARGENAU a écrit :
>>>> Author: vargenau
>>>> Date: 2013-10-15 19:04:01 +0200 (Tue, 15 Oct 2013)
>>>> New Revision: 18236
>>>>
>>>> Modified:
>>>>     trunk/src/common/widget/WidgetLayoutManager.class.php
>>>>     trunk/src/www/widgets/updatelayout.php
>>>> Log:
>>>> Replace spaces with underscores in getCategory
>>>>
>>>> Modified: trunk/src/common/widget/WidgetLayoutManager.class.php
>>>> ===================================================================
>>>> --- trunk/src/common/widget/WidgetLayoutManager.class.php
>>>> 2013-10-15 17:00:46 UTC (rev 18235)
>>>> +++ trunk/src/common/widget/WidgetLayoutManager.class.php
>>>> 2013-10-15 17:04:01 UTC (rev 18236)
>>>> @@ -592,7 +592,8 @@
>>>>           foreach($widgets as $widget_name) {
>>>>               if ($widget = Widget::getInstance($widget_name)) {
>>>>                   if ($widget->isAvailable()) {
>>>> -                    $cs = explode(',', $widget->getCategory());
>>>> +                    $category = str_replace(' ', '_',
>>>> $widget->getCategory());
>>>> +                    $cs = explode(',', $category);
>>>>                       foreach($cs as $c) {
>>>>                           if ($c = trim($c)) {
>>>>                               if (!isset($categ[$c])) {
>>>>
>>>> Modified: trunk/src/www/widgets/updatelayout.php
>>>> ===================================================================
>>>> --- trunk/src/www/widgets/updatelayout.php    2013-10-15 17:00:46 UTC
>>>> (rev 18235)
>>>> +++ trunk/src/www/widgets/updatelayout.php    2013-10-15 17:04:01 UTC
>>>> (rev 18236)
>>>> @@ -87,7 +87,8 @@
>>>>                                           break;
>>>>                                       case 'add':
>>>>                                       default:
>>>> -                                        $redirect
>>>> ='/widgets/widgets.php?owner='. $owner_type.$owner_id.'&layout_id='.
>>>> $layout_id.'#filter-widget-categ-'.$widget->getCategory();
>>>> +                                        $category = str_replace(' ',
>>>> '_', $widget->getCategory());
>>>> +                                        $redirect
>>>> ='/widgets/widgets.php?owner='. $owner_type.$owner_id.'&layout_id='.
>>>> $layout_id.'#filter-widget-categ-'.$category;
>>>> $lm->addWidget($owner_id,
>>>> $owner_type, $layout_id, $name, $widget, $request);
>>>>                                           break;
>>>>                                   }
>>>>
>>>
>>>
>>> This commit is probably incomplete. Or am I missing something ?
>>> Now, the listed categories in "Add Widgets" page are using "underscore"
>>> in the displayed name (i.e: Documents Manager is now : 
>>> Documents_Manager).
>>>
>>> What was your purpose here ? Make it cleaner in the code or unreadable
>>> for common user ?
>>
>> Hello Frank,
>>
>> At the beginning, the string was "Document-Manager" (with an hyphen).
>>
>> I replaced the hyphen with a space and translated the string
>> with gettext.
>>
>> After that, the link no longer worked because the anchor contained
>> a space.
>>
>> So this is a fix so that it always works, even if the translation
>> contains a space.
>>
>> If you have a better solution, let us know.
>>
>> Best regards,
>>
>> Marc-Etienne
>>
>
> Ok, I'll take a look to improve the solution.
> Regards.
>
> Franck

426c8d9fe5f094296a7507b9ac99133aaba3e67b

I still wonder why moving from hyphen to underscore.


Regards,
Franck

-- 
TrivialDev Founder
http://trivialdev.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: franck_villaume.vcf
Type: text/x-vcard
Size: 211 bytes
Desc: not available
URL: <http://lists.fusionforge.org/pipermail/fusionforge-general/attachments/20131015/6a41121f/attachment.vcf>


More information about the Fusionforge-general mailing list