Beispiel #1
0
 function init()
 {
     require_once BASE_DIR . LIBRARY_DIR . 'php/js/functions.php';
     global $site;
     $answer = '<script type="text/javascript"  src="' . BASE_URL . CONTENT_MODULE_URL . 'text_photos/text_photo/module.js"></script>
  <script type="text/javascript" >
   //<![CDATA[
    function f_mod_text_photo_after_photo_save(){
       eval(document.getElementById(\'mod_text_photo_action_after_photo_save\').value);
    }
    //]]>
  </script>
 <div style="display: none;"><input type="hidden" id="mod_text_photo_action_after_photo_save" value="" /></div>
 <iframe style="display: none; width: 0px; height: 0px; border: 0;" name="mod_text_photo_iframe" onload="f_mod_text_photo_after_photo_save()" width="400" height="200"></iframe> 
  
  ';
     $site->requireConfig('standard/content_management/widgets/' . GROUP_KEY . '/' . MODULE_KEY . '/config.php');
     $layouts = Config::getLayouts();
     $script = '';
     if (!isset($layouts) || sizeof($layouts) == 0) {
         $layouts = array();
         $layouts[] = array('translation' => '', 'name' => 'default');
     }
     foreach ($layouts as $key => $layout) {
         $script .= '<option value="' . addslashes($layout['name']) . '" >' . addslashes($layout['translation']) . '</option>';
     }
     if (sizeof($layouts) <= 1) {
         $script = '<div class="ipCmsModuleLayout hidden"><label class="ipCmsTitle">Layout: </label><select name="layout">' . $script . '</select></div>';
     } else {
         $script = '<div class="ipCmsModuleLayout"><label class="ipCmsTitle">Layout: </label><select name="layout">' . $script . '</select></div>';
     }
     $answer .= "\n    <script type=\"text/javascript\" >\n    //<![CDATA[\n      mod_text_photo_layout = '" . $script . "';\n      configWidgetTextPhotosTextPhotoMceInit = '" . \Library\Php\Js\Functions::htmlToString(Config::getMceInit()) . "';\n     //]]>\n    </script>\n    ";
     return $answer;
 }
Beispiel #2
0
 function init()
 {
     require_once BASE_DIR . LIBRARY_DIR . 'php/js/functions.php';
     global $site;
     $answer = '';
     $answer .= ' <script  type="text/javascript" src="' . BASE_URL . CONTENT_MODULE_URL . 'text_photos/faq/module.js"></script>';
     $answer .= '
  
     <script type="text/javascript" >
     //<![CDATA[
        function ipWidgetFaqShow(id){
          element = document.getElementById("faq" + id);
          if (element.style.display == "none")
             element.style.display = "block";
          else
             element.style.display = "none";
        }
        //]]>
     </script>     
  
 ';
     $site->requireConfig('standard/content_management/widgets/' . GROUP_KEY . '/' . MODULE_KEY . '/config.php');
     $layouts = Config::getLayouts();
     $script = '';
     if (!isset($layouts) || sizeof($layouts) == 0) {
         $layouts = array();
         $layouts[] = array('translation' => '', 'name' => 'default');
     }
     foreach ($layouts as $key => $layout) {
         $script .= '<option value="' . addslashes($layout['name']) . '" >' . addslashes($layout['translation']) . '</option>';
     }
     if (sizeof($layouts) <= 1) {
         $script = '<div class="ipCmsModuleLayout hidden"><label class="ipCmsTitle">Layout: </label><select name="layout">' . $script . '</select></div>';
     } else {
         $script = '<div class="ipCmsModuleLayout"><label class="ipCmsTitle">Layout: </label><select name="layout">' . $script . '</select></div>';
     }
     $answer .= "\n    <script type=\"text/javascript\" >\n    //<![CDATA[\n      mod_faq_layout = '" . $script . "';\n      configWidgetTextPhotosFaqMceInit = '" . \Library\Php\Js\Functions::htmlToString(Config::getMceInit()) . "';\n     //]]>\n    </script>\n    ";
     return $answer;
 }
Beispiel #3
0
    function init()
    {
        require_once BASE_DIR . LIBRARY_DIR . 'php/js/functions.php';
        global $site;
        $answer = '<script type="text/javascript"  src="' . BASE_URL . CONTENT_MODULE_URL . 'text_photos/text_title/module.js"></script>';
        $answer .= '
    <script type="text/javascript">
      //<![CDATA[
        function menu_mod_text_title_select_level(collection_number, level){
          i = 1;
          while(document.getElementById(\'management\' + collection_number + \'_text_title_level_\' + i)){
                  document.getElementById(\'management\' + collection_number + \'_text_title_level_\' + i).src = \'' . BASE_URL . MODULE_DIR . 'standard/content_management/widgets/text_photos/text_title/design/mod_title_h\' + i + \'.gif\';
                  i++;
          }

          document.getElementById(\'management_\' + collection_number + \'_level\').value = level;
          document.getElementById(\'management\' + collection_number + \'_text_title_level_\' + level).src=\'' . BASE_URL . MODULE_DIR . 'standard/content_management/widgets/text_photos/text_title/design/mod_title_h\' + level + \'_act.gif\';
        }
      //]]>
    </script>';
        $site->requireConfig('standard/content_management/widgets/' . GROUP_KEY . '/' . MODULE_KEY . '/config.php');
        $layouts = Config::getLayouts();
        $script = '';
        if (!isset($layouts) || sizeof($layouts) == 0) {
            $layouts = array();
            $layouts[] = array('translation' => '', 'name' => 'default');
        }
        foreach ($layouts as $key => $layout) {
            $script .= '<option value="' . addslashes($layout['name']) . '" >' . addslashes($layout['translation']) . '</option>';
        }
        if (sizeof($layouts) <= 1) {
            $script = '<div class="ipCmsModuleLayout hidden"><label class="ipCmsTitle">Layout: </label><select name="layout">' . $script . '</select></div>';
        } else {
            $script = '<div class="ipCmsModuleLayout"><label class="ipCmsTitle">Layout: </label><select name="layout">' . $script . '</select></div>';
        }
        $answer .= "\n    <script type=\"text/javascript\" >\n    //<![CDATA[\n      mod_text_title_layout = '" . $script . "';\n      configWidgetTextPhotosTextTitleMceInit = '" . \Library\Php\Js\Functions::htmlToString(Config::getMceInit()) . "';\n     //]]>\n    </script>\n    ";
        return $answer;
    }
Beispiel #4
0
 function add_to_modules($mod_management_name, $collection_number, $module_id, $visible)
 {
     //add existing module from database to javascript array
     global $site;
     $site->requireTemplate('standard/content_management/widgets/' . GROUP_KEY . '/' . MODULE_KEY . '/template.php');
     $sql = "select button, thank_you, email_to, email_subject from `" . DB_PREF . "mc_misc_contact_form` where `id` = '" . (int) $module_id . "' ";
     $rs = mysql_query($sql);
     if (!$rs || !($lock = mysql_fetch_assoc($rs))) {
         trigger_error("Can't get module information " . $sql);
     } else {
         $thank_you = $lock['thank_you'];
         $button = $lock['button'];
         $email_to = $lock['email_to'];
         $email_subject = $lock['email_subject'];
         $answer = "";
         $answer .= '<script type="text/javascript">
               //<![CDATA[
               ';
         $answer .= "  var new_module = new content_mod_contact_form();";
         //       $answer .= "  var new_module_name = '".$mod_management_name."' + ".$mod_management_name.".get_modules_array_name() + '[' + ".$mod_management_name.".get_modules.length + ']'; alert('AAA' + new_module_name);";
         $answer .= "  var new_module_name = '" . $mod_management_name . ".' + " . $mod_management_name . ".get_modules_array_name() + '[" . $collection_number . "]';";
         $answer .= "  new_module.init(" . $collection_number . ", " . $module_id . ", " . $visible . ", new_module_name, " . $mod_management_name . ");";
         $answer .= "  new_module.fields = new Array();";
         $fields = array();
         $sql = "select * from `" . DB_PREF . "mc_misc_contact_form_field` where `contact_form` = '" . (int) $module_id . "' order by id asc";
         $rs = mysql_query($sql);
         if (!$rs) {
             $this->set_error("Can't get form fields " . $sql);
         } else {
             while ($lock = mysql_fetch_assoc($rs)) {
                 $answer .= "  var field = new Array();";
                 $answer .= "  field[0] = '" . addslashes($lock['name']) . "';";
                 $answer .= "  field[1] = '" . addslashes($lock['type']) . "';";
                 $answer .= "  field[2] = " . addslashes($lock['required']) . ";";
                 $fieldValues = json_decode($lock['values']);
                 if ($fieldValues) {
                     $fieldValues = \Library\Php\Js\Functions::htmlToString(implode("\n", $fieldValues));
                 } else {
                     $fieldValues = '';
                 }
                 $answer .= "  field[3] = '" . $fieldValues . "';";
                 $answer .= "  new_module.fields.push(field);";
                 $answer .= "  ";
                 switch ($lock['type']) {
                     case 'text':
                         $field = new \Library\Php\Form\FieldText();
                         break;
                     case 'text_multiline':
                         $field = new \Library\Php\Form\FieldTextarea();
                         break;
                     case 'file':
                         $field = new \Library\Php\Form\FieldFile();
                         break;
                     case 'email':
                         $field = new \Library\Php\Form\FieldEmail();
                         break;
                     case 'select':
                         $field = new \Library\Php\Form\FieldSelect();
                         $field->values = $this->prepare_for_select($this->db_values_to_array($lock['values']));
                         break;
                     case 'checkbox':
                         $field = new \Library\Php\Form\FieldCheckbox();
                         break;
                     case 'radio':
                         $field = new \Library\Php\Form\FieldRadio();
                         $field->values = $this->prepare_for_select($this->db_values_to_array($lock['values']));
                         break;
                 }
                 $field->caption = $lock['name'];
                 $field->name = 'field_' . (sizeof($fields) + 1);
                 $field->required = $lock['required'];
                 $fields[] = $field;
             }
         }
         $answer .= "  new_module.preview_html = '" . str_replace('script', "scr' + 'ipt", str_replace("\r", "", str_replace("\n", "' + \n '", str_replace("'", "\\'", Template::generateHtml($fields, $thank_you, $email_to, $button, $email_subject, 'col_' . $collection_number, $this->getLayout($module_id)))))) . "';";
         $answer .= "  new_module.layout = '" . str_replace("\r", "", str_replace("\n", "' + \n '", str_replace("'", "\\'", $this->getLayout($module_id)))) . "';";
         $answer .= "  new_module.thank_you = '" . addslashes($thank_you) . "';";
         $answer .= "  new_module.button = '" . addslashes($button) . "';";
         $answer .= "  new_module.email_to = '" . addslashes($email_to) . "';";
         $answer .= "  new_module.email_subject = '" . addslashes($email_subject) . "';";
         $answer .= "  new_module.set_contact_form('" . $lock['contact_form'] . "');";
         $answer .= "  new_module.set_contact_form('" . $lock['contact_form'] . "');";
         $answer .= "  " . $mod_management_name . ".get_modules().push(new_module);";
         $answer .= "  ";
         $answer .= "  ";
         $answer .= "//]]>";
         $answer .= "</script>";
     }
     return $answer;
 }
Beispiel #5
0
 function add_to_modules($mod_management_name, $collection_number, $module_id, $visible)
 {
     //add existing module from database to javascript array
     global $site;
     $site->requireTemplate('standard/content_management/widgets/' . GROUP_KEY . '/' . MODULE_KEY . '/template.php');
     $sql = "select text from `" . DB_PREF . "mc_misc_html_code` where `id` = '" . (int) $module_id . "' ";
     $rs = mysql_query($sql);
     if (!$rs || !($lock = mysql_fetch_assoc($rs))) {
         trigger_error("Can't get module information " . $sql);
     } else {
         $answer = "";
         $answer .= '<script type="text/javascript">
               //<![CDATA[
               ';
         $answer .= "  var new_module = new content_mod_html_code();";
         //       $answer .= "  var new_module_name = '".$mod_management_name."' + ".$mod_management_name.".get_modules_array_name() + '[' + ".$mod_management_name.".get_modules.length + ']';";
         $answer .= "  var new_module_name = '" . $mod_management_name . ".' + " . $mod_management_name . ".get_modules_array_name() + '[" . $collection_number . "]';";
         $answer .= "  new_module.init(" . $collection_number . ", " . $module_id . ", " . $visible . ", new_module_name, " . $mod_management_name . ");";
         $answer .= "\n      new_module.preview_html = '" . \Library\Php\Js\Functions::htmlToString(Template::generateHtml($lock['text'], true, $this->getLayout($module_id))) . "';\n";
         $answer .= "  new_module.layout = '" . str_replace("\r", "", str_replace("\n", "' + \n '", str_replace("'", "\\'", $this->getLayout($module_id)))) . "';";
         $answer .= "\n       new_module.set_text('" . \Library\Php\Js\Functions::htmlToString($lock['text']) . "');\n";
         $answer .= "  " . $mod_management_name . ".get_modules().push(new_module);";
         $answer .= "  ";
         $answer .= "  ";
         $answer .= " //]]> ";
         $answer .= "</script>";
     }
     return $answer;
 }