Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

Providence: Adding search results to existing set?

edited March 16 in Troubleshooting
When searching for objects you can use the set tools on the left hand site to either:
  • add checked results to existing sets
  • create set from either checked results or from all results

Is it possible to add all results to an existing set rather than to create a new one?

Cheers!

Comments

  • No. That would be nice though.
  • A pity. I'll try to work around it then. Thanks!
  • edited March 29
    I solved it by modifiyng the respective functions. It works but I don't know if it's a dirty hack or not since I don't speak any php or javascript and since I figured it all out through trial-and-error. All I did was reproducing the mechanism from the 'create set from results'-mechanism. Yet as far as I could tell it seems to behave nicely and without any deep impact on the default-code from CA. The two files I modified are:
    •     /var/www/html/themes/default/views/find/Search/search_sets_html.php
    •     /var/www/html/app/lib/ca/BaseFindController.php
    Within search_sets_html.php I added the following bold lines.

    First within <div id="searchSetTools">

        ...
        print caHTMLSelect('set_id', $va_options, array('id' => 'caAddToSetID', 'class' => 
        'searchSetsSelect'), array('value' => null, 'width' => '140px'));
        print " ";
        print caHTMLSelect('set_add_mode',
            array(
                _t('from results') => 'from_results',
                _t('from checked') => 'from_checked'
            ),
            array('id' => 'caAddToSetFromResultsMode', 'class' => 'searchSetsSelect'),
            array('value' => null, 'width' => '140px')
        );

        print caBusyIndicatorIcon($this->request, array('id' => 'caAddToSetIDIndicator'))."\n";
        ...

    and secondly within function caAddItemsToSet()

        ...      
        '<?php print caNavUrl($this->request, $this->request->getModulePath(),
        $this->request->getController(), 'addToSet'); ?>',
        {
            set_id: jQuery('#caAddToSetID').val(),
            mode: jQuery('#caAddToSetFromResultsMode').val(),
            item_ids: caGetSelectedItemIDsToAddToSet().join(';')
        },
        ...


    Then in the file BaseFindController.php I added / modified following bold lines:

    public function addToSet() {

        $vn_added_items_count = $vn_dupe_item_count = 0;
        $ps_rows = $this->request->getParameter('item_ids', pString);

        $vs_mode = $this->request->getParameter('mode', pString);
        if ($vs_mode == 'from_checked') {
            $pa_row_ids = explode(";", $ps_rows);
        } else {
            $pa_row_ids = $this->opo_result_context->getResultList();
        }


        if ($vs_mode == 'from_checked' && (!$ps_rows || !sizeof($pa_row_ids))) {
            $this->view->setVar('error', _t('Nothing was selected'));
            } else {
                $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
            ....


    That's all. I imititated the logic of the set-creation as closely as I could. Don't know if it's of help to anyone. Use at your own risk though!


    Cheers
  • Classic. Forgot to attach the files. I've added my username 'OnoSendai' to the respectively changed lines. Also I had to change their type from .php to .txt since I couldn't upload php files.
Sign In or Register to comment.