<?php if(!defined('PARENT')) { exit; } 
$protocol = 'http';
$protocol2 = 'http';
if (isset($ED->url)) {
  if (substr($ED->url, 0, 5) == 'http:') {
    $ED->url = substr($ED->url, 7);  
  }
  if (substr($ED->url, 0, 6) == 'https:') {
    $protocol = 'https';
    $ED->url = substr($ED->url, 8);
  }
  if (substr($ED->link, 0, 5) == 'http:') {
    $ED->link = substr($ED->link, 7);  
  }
  if (substr($ED->link, 0, 6) == 'https:') {
    $protocol2 = 'https';
    $ED->link = substr($ED->link, 8);
  }
}
?>

    <div class="row">
      <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <ul class="nav nav-tabs">
          <li class="active"><a href="#one" data-toggle="tab"><i class="fa fa-cube fa-fw"></i> <span class="hidden-xs"><?php echo $msw_adm_add; ?></span></a></li>
          <li><a href="#two" data-toggle="tab"><i class="fa fa-file-text-o fa-fw"></i> <span class="hidden-xs"><?php echo $msw_adm_add2; ?></span></a></li>
        </ul>
      </div>
    </div>

    <form method="post" action="?p=<?php echo $cmd; ?>" enctype="multipart/form-data" id="sform">
    <div class="row formarea">
      <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div class="tab-content">
          <div class="tab-pane active in" id="one">
            <div class="panel panel-default">
              <div class="panel-body">
                <div class="form-group">
                  <label><?php echo $msw_adm_add3; ?></label>
                  <input type="text" class="form-control" name="fm[name]" value="<?php echo (isset($ED->name) ? mswSH($ED->name) : ''); ?>">
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_add13; ?></label>
                  <div class="input-group">
                    <div class="input-group-btn bs-dropdown-to-select-group">
                      <button type="button" class="btn btn-default dropdown-toggle as-is bs-dropdown-to-select" data-toggle="dropdown">
                        <span><?php echo $msw_11_admin[8]; ?> (<span class="btn_protocol"><?php echo $protocol; ?></span>)</span>
                        <span class="caret"></span>
                      </button>
                      <ul class="dropdown-menu protocolarea" role="menu">
                        <li<?php echo ($protocol == 'http' ? ' class="active"' : ''); ?>><a href="#" onclick="mswSetProtocol('http','fm[url_protocol]','protocolarea','btn_protocol');return false">http://</a></li>
                        <li<?php echo ($protocol == 'https' ? ' class="active"' : ''); ?>><a href="#" onclick="mswSetProtocol('https','fm[url_protocol]','protocolarea','btn_protocol');return false">https://</a></li>
                      </ul>
                    </div>
                    <input type="hidden" name="fm[url_protocol]" value="<?php echo ($protocol == 'http' ? 'http' : 'https'); ?>">
                    <input type="text" class="form-control" name="fm[url]" value="<?php echo (isset($ED->url) ? mswSH($ED->url) : ''); ?>">
                  </div>
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_add5; ?></label>
                  <textarea class="form-control" name="fm[info]"><?php echo (isset($ED->info) ? tags::filter($ED->info) : ''); ?></textarea>
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_add6; ?></label>
                  <div class="radio">
                    <label><input type="radio" name="fm[en]" value="yes"<?php echo (isset($ED->en) && $ED->en == 'yes' ? ' checked="checked"' : (!isset($ED->en) ? ' checked="checked"' : '')); ?>> <?php echo $msw_common; ?></label>
                  </div>
                  <div class="radio">
                   <label><input type="radio" name="fm[en]" value="no"<?php echo (isset($ED->en) && $ED->en == 'no' ? ' checked="checked"' : ''); ?>> <?php echo $msw_common2; ?></label>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="tab-pane fade" id="two">
            <div class="panel panel-default">
              <div class="panel-body">
                <?php
                $hidden = '';
                // Does file upload exist?
                if (isset($ED->id,$PROMO->id) && $PROMO->file_path) {
                  $hidden = '  style="display:none"';
                ?>
                <div class="form-group infoboxarea">
                  <label><?php echo $msw_adm_add7; ?></label><br>
                  <?php
                  if (MSW_PFDTCT != 'pc') {
                  ?>
                  <div style="margin-bottom:10px"><?php echo $PROMO->file_path; ?> @ <?php echo (file_exists(IPATH . 'content/promo/' . $PROMO->file_path) ? mswFCNV(filesize(IPATH . 'content/promo/' . $PROMO->file_path)) : 'N/A'); ?></div>
                  <?php
                  }
                  ?>
                  <div class="btn-group" role="group">
                    <?php
                    if (MSW_PFDTCT == 'pc') {
                    ?>
                    <button class="btn btn-default" type="button"><?php echo $PROMO->file_path; ?> @ <?php echo (file_exists(IPATH . 'content/promo/' . $PROMO->file_path) ? mswFCNV(filesize(IPATH . 'content/promo/' . $PROMO->file_path)) : 'N/A'); ?></button>
                    <?php
                    }
                    if (file_exists(IPATH . 'content/promo/' . $PROMO->file_path)) {
                    ?>
                    <button class="btn btn-info" type="button" onclick="window.location='../content/promo/<?php echo $PROMO->file_path; ?>'"><i class="fa fa-search fa-fw"></i></button>
                    <?php
                    }
                    ?>
                    <button class="btn btn-danger" id="promo_del_btn" type="button" onclick="rmDL('<?php echo $ED->id; ?>')"><i class="fa fa-times-circle fa-fw"></i></button>
                  </div>
                </div>
                <?php
                }
                ?>
                <div class="form-group uploadboxarea"<?php echo $hidden; ?>>
                  <label><?php echo $msw_adm_add7; ?></label>
                  <div class="input-group" id="fle_1"><label class="input-group-btn"><span class="btn btn-default btn-file"><?php echo $msw_common14; ?> <input type="file" name="fm[file][]" style="display:none"></span></label><input class="form-control" readonly="readonly" type="text"></div>
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_add12; ?></label>
                  <div class="input-group">
                    <div class="input-group-btn bs-dropdown-to-select-group">
                      <button type="button" class="btn btn-default dropdown-toggle as-is bs-dropdown-to-select" data-toggle="dropdown">
                        <span><?php echo $msw_11_admin[8]; ?> (<span class="btn_protocol2"><?php echo $protocol2; ?></span>)</span>
                        <span class="caret"></span>
                      </button>
                      <ul class="dropdown-menu protocolarea2" role="menu">
                        <li<?php echo ($protocol2 == 'http' ? ' class="active"' : ''); ?>><a href="#" onclick="mswSetProtocol('http','fm[link_protocol]','protocolarea2','btn_protocol2');return false">http://</a></li>
                        <li<?php echo ($protocol2 == 'https' ? ' class="active"' : ''); ?>><a href="#" onclick="mswSetProtocol('https','fm[link_protocol]','protocolarea2','btn_protocol2');return false">https://</a></li>
                      </ul>
                    </div>
                    <input type="hidden" name="fm[link_protocol]" value="<?php echo ($protocol2 == 'http' ? 'http' : 'https'); ?>">
                    <input type="text" class="form-control" name="fm[link]" value="<?php echo (isset($ED->link) ? mswSH($ED->link) : ''); ?>">
                  </div>
                </div>
                <div class="form-group">
                  <label><?php echo $msw_adm_add8; ?></label>
                  <textarea class="form-control" name="fm[pinfo]"><?php echo (isset($PROMO->info) ? mswSH($PROMO->info) : ''); ?></textarea>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="act-button">
      <button type="button" class="btn btn-success" onclick="mswMultiAction('<?php echo $cmd . (isset($ED->id) ? '-edit' : ''); ?>')"><i class="fa fa-<?php echo (isset($ED->id) ? 'check' : 'plus'); ?> fa-fw"></i> <span class="hidden-xs"><?php echo (isset($ED->id) ? $msw_common5 : $msw_adm_add4); ?></span></button>
      <?php
      if (isset($ED->id)) {
      ?>
      <input type="hidden" name="fm[id]" value="<?php echo $ED->id; ?>">
      <input type="hidden" name="fm[zip]" value="<?php echo $PROMO->file_path; ?>">
      <button type="button" class="btn btn-default left_20" onclick="mswWin('<?php echo (isset($_GET['rdr']) ? mswSH($_GET['rdr']) : 'product-manage'); ?>')"><i class="fa fa-arrow-left fa-fw"></i> <span class="hidden-xs"><?php echo $msw_common6; ?></span></button>
      <?php
      }
      ?>
    </div>
    </form>