Ejemplo n.º 1
0
             $fileType = 'list';
         } else {
             if (substr_count($file, 'SearchForm') > 0 || isset($html_php_mapping_searchform[$file])) {
                 $fileType = 'search';
             } else {
                 if (isset($html_php_mapping_other[$file])) {
                     $fileType = 'other';
                 }
             }
         }
     }
 }
 //HANDLE ANY DELETED FIELDS
 require_once 'modules/DynamicLayout/DeleteFields.php';
 $deleteFields = new DeleteFields();
 $deleteFields->get_trash_file($file);
 //create the slot parser
 require_once 'modules/DynamicLayout/SlotParser.php';
 $sp = new SlotParser();
 //if the last request was a save lets do that
 if (!empty($_REQUEST['save_layout_MSI'])) {
     $file = $sp->save_layout($file);
     header("Location: index.php?module=DynamicLayout&action=index");
     sugar_cleanup(true);
 }
 //if we should be editing rows files lets do that
 if (!empty($_REQUEST['edit_row_MSI'])) {
     require_once 'modules/DynamicLayout/plugins/RowSlotParser.php';
     $rp = new RowSlotParser();
     if (!empty($_REQUEST['add_row_MSI'])) {
         $rp->add_row($file);
Ejemplo n.º 2
0
 function handle_save_swaps()
 {
     $logger = new SlotLogger();
     $logger->open($this->file);
     require_once 'modules/DynamicLayout/DeleteFields.php';
     $df = new DeleteFields();
     $df->get_trash_file($this->file);
     $df->load_deleted_fields();
     $view = $this->contents;
     $counter = 0;
     $return_view = '';
     for ($i = 0; $i < sizeof($this->slots); $i++) {
         $slot = $this->slots[$i];
         $explode = explode($slot[0], $view, 2);
         $explode[0] .= '<slot>';
         $explode[1] = '</slot>' . $explode[1];
         if (!empty($_REQUEST['add_slot_' . $i])) {
             $logger->add_field($i, from_html($_REQUEST['add_slot_' . $i]));
             $return_view .= $explode[0] . from_html($_REQUEST['add_slot_' . $i]);
         } else {
             if ($_REQUEST['form_slot_' . $i] == '-33' || $_REQUEST['form_slot_' . $i] == '-1') {
                 //this is a delete row
                 $return_view .= $explode[0] . '&nbsp;';
                 $logger->swap_fields($i, $_REQUEST['form_slot_' . $i]);
                 $df->delete_field($this->slots[$i][1]);
             } else {
                 if ($_REQUEST['form_slot_' . $i] < 0) {
                     $_REQUEST['form_slot_' . $i] = $i;
                 }
                 $logger->swap_fields($i, $_REQUEST['form_slot_' . $i]);
                 $return_view .= $explode[0] . $this->slots[$_REQUEST['form_slot_' . $i]][1];
             }
         }
         $view = $explode[1];
         $counter++;
     }
     $logger->close();
     $df->save_deleted_fields();
     if (empty($return_view)) {
         return $this->contents;
     }
     return $return_view . $view;
 }