Example #1
0
 /**
  * Given the current wizard state, determines the next state.
  */
 public function processState()
 {
     $state = $_POST[LONGTAIL_KEY . "state"];
     if (isset($_POST["breadcrumb"]) && !empty($_POST["breadcrumb"])) {
         $state = $_POST["breadcrumb"];
     }
     switch ($state) {
         case BasicState::getID():
             $state = new BasicState($_POST[LONGTAIL_KEY . "config"]);
             break;
         case AdvancedState::getID():
             $state = new AdvancedState($_POST[LONGTAIL_KEY . "config"]);
             break;
         case LTASState::getID():
             $state = new LTASState($_POST[LONGTAIL_KEY . "config"]);
             break;
         case PluginState::getID():
             $state = new PluginState($_POST[LONGTAIL_KEY . "config"]);
             break;
         default:
             $state = new PlayerState($_POST[LONGTAIL_KEY . "config"]);
             break;
     }
     $this->processPost($state);
 }
Example #2
0
 protected function getBreadcrumbBar(&$form, $form_state)
 {
     $form["Breadcrumbs"] = array("#prefix" => "<div id='breadcrumbs'>", "#suffix" => "</div>");
     $form["Breadcrumbs"][LONGTAIL_KEY . BasicState::getID()] = array("#type" => "radio", "#id" => LONGTAIL_KEY . BasicState::getID(), "#printed" => true, "#name" => "breadcrumb", "#title" => BasicState::getTitle(), "#return_value" => BasicState::getID(), "#default_value" => $this->getID());
     $form["Breadcrumbs"][LONGTAIL_KEY . AdvancedState::getID()] = array("#type" => "radio", "#id" => LONGTAIL_KEY . AdvancedState::getID(), "#name" => "breadcrumb", "#title" => AdvancedState::getTitle(), "#return_value" => AdvancedState::getID(), "#default_value" => $this->getID());
     $form["Breadcrumbs"][LONGTAIL_KEY . LTASState::getID()] = array("#type" => "radio", "#id" => LONGTAIL_KEY . LTASState::getID(), "#name" => "breadcrumb", "#title" => LTASState::getTitle(), "#return_value" => LTASState::getID(), "#default_value" => $this->getID());
     $form["Breadcrumbs"][LONGTAIL_KEY . PluginState::getID()] = array("#type" => "radio", "#id" => LONGTAIL_KEY . PluginState::getID(), "#name" => "breadcrumb", "#title" => PluginState::getTitle(), "#return_value" => PluginState::getID(), "#default_value" => $this->getID());
 }
Example #3
0
    /**
     * @see AdminState::render()
     */
    public function render()
    {
        $plugins = LongTailFramework::getPlugins();
        $configValues = LongTailFramework::getConfigValues();
        $pluginString = explode(",", $configValues["plugins"]);
        $pluginList = array();
        foreach ($pluginString as $pluginStr) {
            $pluginList[$pluginStr] = $pluginStr;
        }
        ?>
    <div class="wrap">

      <script type="text/javascript">
        jQuery(function () {
          jQuery('#tabs').tabs();
          removeAllTabs();
          jQuery("<?php 
        echo "#" . LONGTAIL_KEY . "plugin_selector_tab";
        ?>
").css("display", "block");
          <?php 
        foreach ($plugins as $plugin) {
            ?>
            <?php 
            if ($plugin->isEnabled()) {
                ?>
              jQuery("<?php 
                echo "#" . LONGTAIL_KEY . "plugin_" . $plugin->getRepository() . "_tab";
                ?>
").css("display", "block");
            <?php 
            }
            ?>
          <?php 
        }
        ?>
          jQuery("#tabs").css("display", "block");
          jQuery(":checkbox").change(function() {
            var name = "#" + jQuery(this)[0].name.replace("enable", "tab");
            var hidden = jQuery(this)[0].name + "_hidden";
            if(jQuery(this)[0].checked) {
              jQuery(name).css("display", "block");
              jQuery(name).val(true);
            } else {
              jQuery(name).css("display", "none");
              jQuery(name).val(false);
            }
          })
        });

        function removeAllTabs() {
          jQuery("#tabNavigation").children().css("display","none");
        }
      </script>

      <form name="<?php 
        echo LONGTAIL_KEY . "form";
        ?>
" method="post" action="">
        <?php 
        parent::getBreadcrumbBar();
        ?>
        <?php 
        $this->selectedPlayer();
        ?>
        <p/>
        <div id="tabs">

          <ul id="tabNavigation">
            <?php 
        $id = LONGTAIL_KEY . "plugin_selector";
        ?>
            <li id="<?php 
        echo $id . "_tab";
        ?>
"><a href="<?php 
        echo "#" . $id;
        ?>
">Plugin Selector</a></li>
            <?php 
        foreach ($plugins as $plugin) {
            ?>
              <?php 
            $id = LONGTAIL_KEY . "plugin_" . $plugin->getRepository();
            ?>
              <li id="<?php 
            echo $id . "_tab";
            ?>
"><a href="<?php 
            echo "#" . $id;
            ?>
"><?php 
            echo $plugin->getTitle();
            ?>
</a></li>
            <?php 
        }
        ?>
          </ul>

          <div id="<?php 
        echo LONGTAIL_KEY . "plugin_selector";
        ?>
">
            <table class="form-table">
              <?php 
        foreach ($plugins as $plugin) {
            ?>
                <?php 
            $name = LONGTAIL_KEY . "plugin_" . $plugin->getRepository() . "_" . "enable";
            ?>
                <?php 
            $value = isset($_POST[$name]) ? $_POST[$name] : $plugin->isEnabled();
            ?>
                <?php 
            unset($_POST[$name]);
            ?>
                <tr valign="top">
                  <th>Enable <?php 
            echo $plugin->getTitle();
            ?>
:</th>
                  <td>
                    <input name="<?php 
            echo $name;
            ?>
" type="checkbox" value="1" <?php 
            checked(true, $value);
            ?>
 />
                    <input name="<?php 
            echo $name . "_hidden";
            ?>
" type="hidden" value="0"/>
                    <span class="description"><?php 
            echo $plugin->getDescription() . "  <a href=" . $plugin->getPage() . JW_PLAYER_GA_VARS . " target=_blank>Learn more...</a>";
            ?>
</span>
                  </td>
                </tr>
                <tr>
                  <td colspan="2"></td>
                </tr>
              <?php 
        }
        ?>
            </table>
          </div>

          <?php 
        foreach ($plugins as $plugin) {
            ?>
            <?php 
            unset($pluginList[$plugin->getRepository()]);
            ?>
            <div id="<?php 
            echo LONGTAIL_KEY . "plugin_" . $plugin->getRepository();
            ?>
">
              <table class="form-table">
                <?php 
            foreach (array_keys($plugin->getFlashVars()) as $plugin_flash_vars) {
                ?>
                  <?php 
                $p_vars = $plugin->getFlashVars();
                ?>
                  <?php 
                foreach ($p_vars[$plugin_flash_vars] as $plugin_flash_var) {
                    ?>
                    <tr valign="top">
                      <?php 
                    $name = LONGTAIL_KEY . "plugin_" . $plugin->getPluginPrefix() . "_" . $plugin_flash_var->getName();
                    ?>
                      <?php 
                    $value = isset($_POST[$name]) ? $_POST[$name] : $plugin_flash_var->getDefaultValue();
                    ?>
                      <?php 
                    unset($_POST[$name]);
                    ?>
                      <th><?php 
                    echo $plugin->getPluginPrefix() . "." . $plugin_flash_var->getName();
                    ?>
:</th>
                      <td>
                        <?php 
                    if ($plugin_flash_var->getType() == FlashVar::SELECT) {
                        ?>
                          <select size="1" name="<?php 
                        echo $name;
                        ?>
">
                            <?php 
                        foreach ($plugin_flash_var->getValues() as $val) {
                            ?>
                              <option value="<?php 
                            echo $val;
                            ?>
" <?php 
                            selected($val, $value);
                            ?>
>
                                <?php 
                            echo htmlentities($val);
                            ?>
                              </option>
                            <?php 
                        }
                        ?>
                          </select>
                        <?php 
                    } else {
                        ?>
                        <input type="text" value="<?php 
                        echo $value;
                        ?>
" name="<?php 
                        echo $name;
                        ?>
" />
                        <?php 
                    }
                    ?>
                        <span class="description"><?php 
                    echo $plugin_flash_var->getDescription();
                    ?>
</span>
                      </td>
                    </tr>
                  <?php 
                }
                ?>
                <?php 
            }
            ?>
              </table>
            </div>
          <?php 
        }
        ?>
        </div>

        <?php 
        $this->getFooter($pluginList);
        ?>
        <?php 
        $this->buttonBar(PluginState::getID(), true, false);
        ?>

      </form>
    </div>
  <?php 
    }
Example #4
0
    protected function getBreadcrumbBar()
    {
        ?>
    <script type="text/javascript">
      jQuery(function() {
        jQuery("#breadcrumbs").buttonset();
      });
    </script>
    <div id="breadcrumbs" style="padding: 14px 15px 3px 0;">
      <input type="radio" id="<?php 
        echo LONGTAIL_KEY . BasicState::getID();
        ?>
" name="breadcrumb" <?php 
        checked(BasicState::getID(), $this->getID());
        ?>
 value="<?php 
        echo BasicState::getID();
        ?>
" onchange="form.submit();"/>
      <label for="<?php 
        echo LONGTAIL_KEY . BasicState::getID();
        ?>
">
        <?php 
        echo BasicState::getTitle();
        ?>
      </label>
      <input type="radio" id="<?php 
        echo LONGTAIL_KEY . AdvancedState::getID();
        ?>
" name="breadcrumb" <?php 
        checked(AdvancedState::getID(), $this->getID());
        ?>
 value="<?php 
        echo AdvancedState::getID();
        ?>
" onchange="form.submit();" />
      <label for="<?php 
        echo LONGTAIL_KEY . AdvancedState::getID();
        ?>
">
        <?php 
        echo AdvancedState::getTitle();
        ?>
      </label>
      <input type="radio" id="<?php 
        echo LONGTAIL_KEY . LTASState::getID();
        ?>
" name="breadcrumb" <?php 
        checked(LTASState::getID(), $this->getID());
        ?>
 value="<?php 
        echo LTASState::getID();
        ?>
" onchange="form.submit();" />
      <label for="<?php 
        echo LONGTAIL_KEY . LTASState::getID();
        ?>
">
        <?php 
        echo LTASState::getTitle();
        ?>
      </label>
      <input type="radio" id="<?php 
        echo LONGTAIL_KEY . PluginState::getID();
        ?>
" name="breadcrumb" <?php 
        checked(PluginState::getID(), $this->getID());
        ?>
 value="<?php 
        echo PluginState::getID();
        ?>
" onchange="form.submit();" />
      <label for="<?php 
        echo LONGTAIL_KEY . PluginState::getID();
        ?>
">
        <?php 
        echo PluginState::getTitle();
        ?>
      </label>
    </div>
  <?php 
    }
Example #5
0
 /**
  * @see AdminState::render()
  * @param $form
  * @param $form_state
  */
 public function render(&$form, $form_state)
 {
     $plugins = LongTailFramework::getPlugins();
     parent::getBreadcrumbBar($form, $form_state);
     $this->selectedPlayer($form, $form_state);
     $id = LONGTAIL_KEY . "plugin_selector";
     $form["JWPlugins"] = array("#prefix" => "<div>", "#suffix" => "</div>");
     $form["JWPlugins"][$id] = array();
     $form["JWPlugins"][$id]["tab"] = array("#id" => "{$id}" . "_tab", "#type" => "item", "#value" => "<a href='#{$id}'>Plugin Selector</a>");
     foreach ($plugins as $plugin) {
         $id = LONGTAIL_KEY . "plugin_" . $plugin->getRepository();
         $form["JWPlugins"][$id] = array();
         $form["JWPlugins"][$id]["tab"] = array("#id" => "{$id}" . "_tab", "#type" => "item", "#value" => "<a href='#{$id}'>" . $plugin->getTitle() . "</a>");
     }
     $id = LONGTAIL_KEY . "plugin_selector";
     $form["JWPlugins"][$id]["body"] = array();
     foreach ($plugins as $plugin) {
         $name = LONGTAIL_KEY . "plugin_" . $plugin->getRepository() . "_" . "enable";
         $value = $form_state["storage"][$name] ? $form_state["storage"][$name] : $plugin->isEnabled();
         $form["JWPlugins"][$id]["body"][$name] = array("#type" => "checkbox", "#title" => "Enable " . $plugin->getTitle(), "#description" => $plugin->getDescription(), "#name" => $name, "#default_value" => $value);
     }
     foreach ($plugins as $plugin) {
         $id = LONGTAIL_KEY . "plugin_" . $plugin->getRepository();
         $form["JWPlugins"][$id]["body"] = array();
         foreach (array_keys($plugin->getFlashVars()) as $plugin_flash_vars) {
             $p_vars = $plugin->getFlashVars();
             foreach ($p_vars[$plugin_flash_vars] as $plugin_flash_var) {
                 $name = LONGTAIL_KEY . "plugin_" . $plugin->getPluginPrefix() . "_" . $plugin_flash_var->getName();
                 $value = $form_state["storage"][$name] ? $form_state["storage"][$name] : $plugin_flash_var->getDefaultValue();
                 $form["JWPlugins"][$id]["body"][$name] = array("#title" => $plugin->getPluginPrefix() . "." . $plugin_flash_var->getName(), "#description" => $plugin_flash_var->getDescription(), "#default_value" => $value);
                 if ($plugin_flash_var->getType() == FlashVar::SELECT) {
                     $form["JWPlugins"][$id]["body"][$name]["#type"] = "select";
                     $options = array();
                     foreach ($plugin_flash_var->getValues() as $val) {
                         $options[$val] = $val;
                     }
                     $form["JWPlugins"][$id]["body"][$name]["#options"] = $options;
                 } else {
                     $form["JWPlugins"][$id]["body"][$name]["#type"] = "textfield";
                 }
             }
         }
     }
     drupal_add_js($this->generateScript($plugins), "inline");
     $this->buttonBar($form, PluginState::getID(), true, false);
 }