Skip to content

Commit

Permalink
Merge branch '9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
jstanden committed Jan 18, 2019
2 parents 1795d03 + 9b68f8b commit c7699c9
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 72 deletions.
2 changes: 1 addition & 1 deletion api/Application.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* - Jeff Standen and Dan Hildebrandt
* Founders at Webgroup Media LLC; Developers of Cerb
*/
define("APP_BUILD", 2019011601);
define("APP_BUILD", 2019011701);
define("APP_VERSION", '9.1.3');

define("APP_MAIL_PATH", APP_STORAGE_PATH . '/mail/');
Expand Down
50 changes: 49 additions & 1 deletion features/cerberusweb.core/api/dao/workspace_tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,11 @@ function getPlaceholderPrompts() {
if(false == (@$placeholder_prompts = yaml_parse($placeholder_prompts, -1)))
return [];

$keys = array_map(function($prompt) { return $prompt['placeholder']; }, $placeholder_prompts);

// Set placeholder names as keys
return array_combine($keys, $placeholder_prompts);

// Handle PHP's single document YAML format
/*
if(
Expand Down Expand Up @@ -656,14 +661,57 @@ function getDashboardPrefsAsWorker(Model_Worker $worker) {

$results = DAO_WorkerDashboardPref::get($this->id, $worker);

// Set values based on prompts

foreach($results as $result) {
$prefs[$result['pref_key']] = $result['pref_value'];
if(false == (@$prompt = $placeholder_prompts[$result['pref_key']]))
continue;

switch($prompt['type']) {
case 'picklist':
if(@$prompt['params']['multiple']) {
$prefs[$result['pref_key']] = json_decode($result['pref_value'], true);

} else {
$prefs[$result['pref_key']] = $result['pref_value'];
}
break;

case 'chooser':
case 'date_range':
default:
$prefs[$result['pref_key']] = $result['pref_value'];
break;
}
}

return $prefs;
}

function setDashboardPrefsAsWorker(array $prefs, Model_Worker $worker) {
$placeholder_prompts = $this->getPlaceholderPrompts();

foreach($prefs as $pref_key => $pref_value) {
if(false == (@$prompt = $placeholder_prompts[$pref_key]))
continue;

switch($prompt['type']) {
case 'chooser':
$prefs[$pref_key] = implode(',', $pref_value);
break;

case 'picklist':
if(@$prompt['params']['multiple']) {
$prefs[$pref_key] = json_encode($pref_value);
}
break;

case 'date_range':
default:
break;
}
}

DAO_WorkerDashboardPref::set($this->id, $prefs, $worker);
}

Expand Down
5 changes: 4 additions & 1 deletion features/cerberusweb.core/api/uri/internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2904,13 +2904,16 @@ function viewDoCopyAction() {
DAO_WorkspaceList::OPTIONS_JSON => json_encode($view->options),
DAO_WorkspaceList::PARAMS_EDITABLE_JSON => json_encode($view->getEditableParams()),
DAO_WorkspaceList::PARAMS_REQUIRED_JSON => json_encode($view->getParamsRequired()),
DAO_WorkspaceList::PARAMS_REQUIRED_QUERY => $view->getParamsRequiredQuery(),
DAO_WorkspaceList::RENDER_LIMIT => $view->renderLimit,
DAO_WorkspaceList::RENDER_SORT_JSON => json_encode($view->getSorts()),
DAO_WorkspaceList::RENDER_SUBTOTALS => $view->renderSubtotals,
DAO_WorkspaceList::WORKSPACE_TAB_ID => $workspace_tab_id,
DAO_WorkspaceList::WORKSPACE_TAB_POS => 99,
];
DAO_WorkspaceList::create($fields);
$new_id = DAO_WorkspaceList::create($fields);

DAO_WorkerViewModel::deleteByViewId('cust_' . $new_id);

$view->render();
}
Expand Down
5 changes: 5 additions & 0 deletions features/cerberusweb.core/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,11 @@
<seg>D.O.B.</seg>
</tuv>
</tu>
<tu tuid="common.done">
<tuv xml:lang="en_US">
<seg>done</seg>
</tuv>
</tu>
<tu tuid="common.download">
<tuv xml:lang="en_US">
<seg>download</seg>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{$uniqid = uniqid()}
{$prompt_value = $tab_prefs.{$prompt.placeholder}|default:$prompt.default}

<div id="{$uniqid}" style="display:inline-block;vertical-align:middle;">
<div class="bubble cerb-filter-editor" style="padding:5px;display:block;">
<b>{$prompt.label}</b>

<div class="cerb-item-container bubbles">
<button type="button" class="cerb-menu--trigger">
<span class="glyphicons glyphicons-search" style="cursor:pointer;"></span>
</button>

{foreach from=$prompt.params.options item=option key=option_key}
{if in_array($option, $prompt_value)}
<div class="bubble">
{if is_string($option_key)}
{$option_key}
{else}
{$option}
{/if}
</div>
{/if}
{/foreach}
</div>

<div class="cerb-popupmenu cerb-float">
<span class="glyphicons glyphicons-circle-remove cerb-button--close" style="font-size:150%;cursor:pointer;position:absolute;top:-5px;right:-5px;"></span>
{foreach from=$prompt.params.options item=option key=option_key}
<div>
<label>
<input type="checkbox" name="prompts[{$prompt.placeholder}][]" value="{$option}" {if in_array($option, $prompt_value)}checked="checked"{/if}>
{if is_string($option_key)}
{$option_key}
{else}
{$option}
{/if}
</label>
</div>
{/foreach}
</div>
</div>
</div>

<script type="text/javascript">
$(function() {
var $filter = $('#{$uniqid}');
var $filter_menu = $filter.find('div.cerb-popupmenu');
var $filter_menu_trigger = $filter.find('button.cerb-menu--trigger')
var $filter_container = $filter.find('div.cerb-item-container');
$filter_menu_trigger
.click(function(e) {
$filter_menu.toggle();
})
;
$filter_menu.on('change', function(e) {
e.stopPropagation();
$filter_container.find('div.bubble').remove();
// Copy selections to the filter bubbles
$filter_menu.find('input:checkbox').each(function() {
var $checkbox = $(this);
if($checkbox.is(':checked')) {
var $bubble = $('<div class="bubble"/>')
.text($.trim($checkbox.parent().text()))
.appendTo($filter_container)
;
}
});
})
$filter.find('.cerb-button--close')
.click(function(e) {
$filter_menu.fadeOut();
})
;
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

<div>
<select name="prompts[{$prompt.placeholder}]">
{foreach from=$prompt.params.options item=option}
{if is_string($option)}
<option value="{$option}" {if $prompt_value == $option}selected='selected'{/if}>{$option}</option>
{elseif is_array($option)}
<option value="{$option.value}" {if $prompt_value == $option.value}selected='selected'{/if}>{$option.label}</option>
{else}
{/if}
{foreach from=$prompt.params.options item=option key=option_key}
<option value="{$option}" {if $prompt_value == $option}selected='selected'{/if}>
{if is_string($option_key)}
{$option_key}
{else}
{$option}
{/if}
</option>
{/foreach}
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
{include file="devblocks:cerberusweb.core::internal/dashboards/prompts/prompt_chooser.tpl" prompt=$prompt}
{elseif $prompt.type == 'date_range'}
{include file="devblocks:cerberusweb.core::internal/dashboards/prompts/prompt_date_range.tpl" prompt=$prompt}
{elseif $prompt.type == 'picklist'}
{include file="devblocks:cerberusweb.core::internal/dashboards/prompts/prompt_picklist.tpl" prompt=$prompt}
{elseif $prompt.type == 'picklist' && !$prompt.params.multiple}
{include file="devblocks:cerberusweb.core::internal/dashboards/prompts/prompt_picklist_single.tpl" prompt=$prompt}
{elseif $prompt.type == 'picklist' && $prompt.params.multiple}
{include file="devblocks:cerberusweb.core::internal/dashboards/prompts/prompt_picklist_multiple.tpl" prompt=$prompt}
{/if}
{/foreach}

Expand Down
10 changes: 0 additions & 10 deletions install/extras/translations/cerb_lang_de_DE.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1818,16 +1818,6 @@
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_status_id">
<tuv xml:lang="de_DE">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_type_id">
<tuv xml:lang="de_DE">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_versions">
<tuv xml:lang="de_DE">
<seg/>
Expand Down
10 changes: 0 additions & 10 deletions install/extras/translations/cerb_lang_es_ES.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1823,16 +1823,6 @@
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_status_id">
<tuv xml:lang="es_ES">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_type_id">
<tuv xml:lang="es_ES">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_versions">
<tuv xml:lang="es_ES">
<seg/>
Expand Down
10 changes: 0 additions & 10 deletions install/extras/translations/cerb_lang_it_IT.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1808,16 +1808,6 @@
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_status_id">
<tuv xml:lang="it_IT">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_type_id">
<tuv xml:lang="it_IT">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_versions">
<tuv xml:lang="it_IT">
<seg/>
Expand Down
10 changes: 0 additions & 10 deletions install/extras/translations/cerb_lang_nl_NL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1813,16 +1813,6 @@
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_status_id">
<tuv xml:lang="nl_NL">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_type_id">
<tuv xml:lang="nl_NL">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_versions">
<tuv xml:lang="nl_NL">
<seg/>
Expand Down
10 changes: 0 additions & 10 deletions install/extras/translations/cerb_lang_pt_PT.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1828,16 +1828,6 @@
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_status_id">
<tuv xml:lang="pt_PT">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_type_id">
<tuv xml:lang="pt_PT">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_versions">
<tuv xml:lang="pt_PT">
<seg/>
Expand Down
10 changes: 0 additions & 10 deletions install/extras/translations/cerb_lang_ru_RU.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1818,16 +1818,6 @@
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_status_id">
<tuv xml:lang="ru_RU">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_type_id">
<tuv xml:lang="ru_RU">
<seg/>
</tuv>
</tu>
<tu tuid="dao.jira_issue.jira_versions">
<tuv xml:lang="ru_RU">
<seg/>
Expand Down

0 comments on commit c7699c9

Please sign in to comment.