Page 1 of 1

LISE Instance Item dropdown with blank

Posted: Mon Nov 29, 2021 9:11 pm
by andrewvideouk
Hi guys

I am I am trying to work out how to do a dropdown option and the get the title from a other LISE module. I have it working but the only problem how you add a blank option at the start.

Thank you

Re: LISE Instance Item dropdown with blank

Posted: Mon Nov 29, 2021 11:15 pm
by DIGI3

Re: LISE Instance Item dropdown with blank

Posted: Mon Nov 29, 2021 11:18 pm
by DIGI3
For a temporary workaround, create a dummy LISE entry called "none" (or similar) in your other module, then exclude it from frontend display in your template or module tag.

Re: LISE Instance Item dropdown with blank

Posted: Tue Nov 30, 2021 1:23 am
by andrewvideouk
Hi

I did thought about adding a create a dummy LISE entry but the only problem is that a admin can detele the entry and not understanding why its there.

Could I use a UDT? I am not sure how I do that. I am guessing I would have to call the information from the database and some how pass it to LISE.

Re: LISE Instance Item dropdown with blank

Posted: Tue Nov 30, 2021 1:29 am
by DIGI3
Probably better to edit the .tpl LISE is using for that and put it in module_custom. A UDT would work too, but yeah would take some figuring out.

Re: LISE Instance Item dropdown with blank

Posted: Wed Dec 01, 2021 8:59 pm
by andrewvideouk
I am looking at the file and nothing sticks out what i need to change. Can't see any dropdown stuff.


This might be it? If its this what do I need to do?

Code: Select all


    {if isset($itemObject|default:[])}
      {foreach from=$itemObject->fielddefs item='fielddef'}
        {$fielddef->RenderInput($actionid, $returnid)}
      {/foreach}
    {/if} 
 

Cheers

Code: Select all


{$backlink}
<h3>{$header}</h3>
{$startform}
<div class="pageoverflow">
    <p class="pageinput">
      <input name="{$actionid}submit" class="lise_submit" value="{lang('submit')}" type="submit" />
      <input name="{$actionid}cancel" class="lise_cancel" value="{lang('cancel')}" type="submit" />
      <input name="{$actionid}apply" class="lise_apply" value="{lang('apply')}" type="submit" />
      <input name="{$actionid}save_create" class="lise_save_create" value="{$mod->ModLang('save_create')}" type="submit" />
    </p>
</div>
<!-- start tab -->
<div id="page_tabs">
	<div id="edititem">
		{$title}
	</div>
    {if isset($itemObject|default:[])}
      {foreach from=$itemObject->fielddefs item='fielddef'}
        {if $fielddef->type === 'Tabs'}
          {$fielddef->displayTabHeader()}
        {/if}
      {/foreach}
    {/if}
</div>
<!-- end tab //-->
<!-- start content -->
<div id="page_content"> 
  <div id="edititem_result"></div>
  <div id="edititem_c">

    {if isset($input_active)}
      <div class="pageoverflow">
        <p class="pagetext">{$mod->ModLang('active')}:</p>
        <p class="pageinput">{$input_active}</p>
      </div>
    {/if}

    {if $mod->GetPreference('display_create_date', 0) == 1}
      <div class="pageoverflow">
        <p class='pagetext'>{$mod->ModLang('create_time', '')}: <em style='font-weight: normal;'>{$itemObject->create_time}</em></p>
      </div>
    {/if}

    <div class="pageoverflow">
      <p class="pagetext">{$mod->GetPreference('item_title', '')}*:</p>
      <p class="pageinput">{$input_title}</p>
    </div>
    {if $hide_alias}
      {$input_alias}
    {else}
      <div class="pageoverflow">
        <p class="pagetext">{$mod->ModLang('alias')}:</p>{$alias|default:''}
        <p class="pageinput">{$input_alias}</p>
      </div>
    {/if}
    {if $hide_slug}
      {$input_url}
    {else}
      <div class="pageoverflow">
        <p class="pagetext">{$mod->ModLang('url')}:</p>{$url|default:''}
        <p class="pageinput">{$input_url}</p>
      </div>
    {/if}

    {if !$hide_time_control}
      <div class="pageoverflow">
        <p class="pagetext">{$mod->ModLang('time_control')}:</p>
        <p class="pageinput">{$input_time_control}</p>
      </div>

      <div id="expiryinfo"{if $use_time_control != true} style="display:none;"{/if}>
        <div class="pageoverflow">
          <p class="pagetext">{$mod->ModLang('start_time')}:</p>
          <p class="pageinput">{$input_start_time}</p>
        </div>

        <div class="pageoverflow">
          <p class="pagetext">{$mod->ModLang('end_time')}:</p>
          <p class="pageinput">{$input_end_time}</p>
        </div>
      </div>
    {/if}

    {if isset($itemObject|default:[])}
      {foreach from=$itemObject->fielddefs item='fielddef'}
        {$fielddef->RenderInput($actionid, $returnid)}
      {/foreach}
    {/if} 
 
  </div>

</div>

  <div class="pageoverflow">
    <p class="pagetext">&nbsp;</p>
    <p class="pageinput">
      <input name="{$actionid}submit" class="lise_submit" value="{lang('submit')}" type="submit" />
      <input name="{$actionid}cancel" class="lise_cancel" value="{lang('cancel')}" type="submit" />
      <input name="{$actionid}apply" class="lise_apply" value="{lang('apply')}" type="submit" />
      <input name="{$actionid}save_create" class="lise_save_create" value="{$mod->ModLang('save_create')}" type="submit" />
    </p>
  </div>
{$endform}
<!-- end content //-->
<__script__ type="text/javascript">
var action_id = '{$actionid}';
var item_id = '{$itemObject->item_id|default:-1}';
var ajax_url1 = '{$ajax_get_url}';
var ajax_url2 = '{$ajax_get_alias}';
var manually_changed1 = item_id;
var manually_changed2 = item_id;
var finished_setup = 0;
var ajax_xhr1 = 0;
var ajax_xhr2 = 0;
var ajax_timeout1;
var ajax_timeout2;
ajax_url1 = ajax_url1.replace(/amp;/g,'') + '&suppressoutput=1';
ajax_url2 = ajax_url2.replace(/amp;/g,'') + '&suppressoutput=1';

function ajax_geturl() { 
  var form = $('#lise_edititem form');
  var vtitle = $('#{$actionid}title').val();
  ajax_xhr = $.post(ajax_url1, { title: vtitle, itemid: item_id }, function(retdata){
    $('#{$actionid}url').val(retdata);
    ajax_xhr1 = 0;
});
}

function ajax_get_alias() { 
  var form = $('#lise_edititem form');
  var vtitle = $('#{$actionid}title').val();
  ajax_xhr = $.post(ajax_url2, { title: vtitle }, function(retdata){
    $('#{$actionid}alias').val(retdata);
    ajax_xhr2 = 0;
});
}

function on_change() {
  if( manually_changed1 < 1 && finished_setup == 1) {
    // ajax function to get a unique url given a title.
    if( ajax_timeout1 != undefined ) clearTimeout(ajax_timeout1);
    if( ajax_xhr1 = 0 ) xhr.abort();
    ajax_timeout1 = setTimeout(ajax_geturl,500);
}
  if( manually_changed2 < 1 && finished_setup == 1) {
    // ajax function to get a unique alias given a title.
    if( ajax_timeout2 != undefined ) clearTimeout(ajax_timeout2);
    if( ajax_xhr2 = 0 ) xhr.abort();
    ajax_timeout1 = setTimeout(ajax_get_alias,500);
}
}

jQuery(document).ready(function() {
  
  $('{$actionid}url').keyup(function() {
    var val = $(this).val();
    manually_changed1 = 0
    if( val != '' ) manually_changed1 = 1;
});
  
  $('{$actionid}alias').keyup(function() {
    var val = $(this).val();
    manually_changed1 = 0
    if( val != '' ) manually_changed2 = 1;
});

  $('form').ajaxStart(function() {
    $('*').css('cursor','progress');
});

  $('form').ajaxStop(function() {
    $('*').css('cursor','auto');
});

  $('#{$actionid}title').keyup(function() {
    on_change();
});

  finished_setup = 1;
  
  
  jQuery('[name=m1_apply]').live('click', function() {
    if (typeof tinyMCE != 'undefined') {
      tinyMCE.triggerSave();
  }
  
  var data = jQuery('form').find('input:not([type=submit]), select, textarea').serializeArray();
  
  data.push({
      'name': 'm1_ajax',
      'value': 1
  });
  data.push({
      'name': 'm1_apply',
      'value': 1
  });
  data.push({
      'name': 'showtemplate',
      'value': 'false'
  });
  
  var url = jQuery('form').attr('action');
  
  jQuery.post(url, data, function(resultdata, text) {
      var resp = jQuery(resultdata).find('Response').text();
      var details = jQuery(resultdata).find('Details').text();
      var htmlShow = '';
      if (resp === 'Success' && details !== '') {
        htmlShow = '<div class="pagemcontainer"><p class="pagemessage">' + details + '<\/p><\/div>';
    }
    else {
        htmlShow = '<div class="pageerrorcontainer"><ul class="pageerror">';
        htmlShow += details;
        htmlShow += '<\/ul><\/div>';
    }
    jQuery('#edititem_result').html(htmlShow);
    window.setTimeout(function(){ 
     $('.pagemcontainer').hide(); 
 }, 9000)
}, 'xml');
  return false;
});
});
</__script>