adding repost ability
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 29 Sep 2017 18:59:42 +0000 (14:59 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 29 Sep 2017 18:59:42 +0000 (14:59 -0400)
adding ability to repost an item and update the post date, or not to

classes/data/dataForSale.php
css/admin.css
css/admin.css.map
models/admin/forSale/index.php
models/admin/management/itemsImport.php
models/front/forSale/list.php
scss/admin.scss
setup/databaseScripts/create_database_V0.0.1.sql
views/admin/forSale/edit.html
views/admin/forSale/list.html

index 8d1f583..deb85e3 100644 (file)
@@ -184,6 +184,11 @@ class GlmDataForSale extends GlmDataAbstract
                 'type' => 'datetime',
                 'use' => 'lge'
             ),
+            'updated' => array (
+                'field' => 'updated',
+                'type' => 'datetime',
+                'use' => 'lge'
+            ),
             'visible' => array (
                 'field' => 'visible',
                 'type' => 'checkbox',
@@ -230,6 +235,11 @@ class GlmDataForSale extends GlmDataAbstract
                     'p_orderby' => 'name',
                 'use' => 'a'
             ),
+            'repost' => array (
+                'field' => 'repost',
+                'type' => 'checkbox',
+                'use' => 'a'
+            ),
         );
     }
 
@@ -251,7 +261,52 @@ class GlmDataForSale extends GlmDataAbstract
     {
         return $r;
     }
+    /**
+     * Update timestamps for created, updated, approved
+     *
+     * @param string $field Field to update
+     * @param integer $id ID of For Sale Item
+     *
+     * @return void
+    */
+    public function updateTimestamp($field = false, $id = false,$item = false,$updated = false){
+
+        if (!in_array($field, array('created', 'updated', 'approved')) || !$id) {
+            return false;
+        }
+        if($item){
+            if( $item['fieldData']['repost']['value'] == 1){
+                $sql = "
+                    UPDATE ".$this->table."
+                    SET $field = now()
+                    WHERE id = $id
+                ;";
+                $this->wpdb->query($sql);
+            }else if($item['fieldData']['repost']['value'] == 0 && $updated == NULL){
+                $sql = "
+                    UPDATE ".$this->table."
+                    SET updated = post_date
+                    WHERE id = $id AND updated IS NULL
+                ;";
+                $this->wpdb->query($sql);
+            }
+        }
+    }
+    /**
+     * Checks if Item should be re-posted
+     *
+     * @param string $field Field to update
+     * @param integer $id ID of For Sale Item
+     *
+     * @return void
+     */
+     public function getUpdatedTime($id = false){
+        //  echo '<pre>', print_r($item, true), '</pre>';
+        $sql = "SELECT updated FROM ".$this->table." WHERE id = $id;";
+        $updated = $this->wpdb->get_var($sql);
 
+        return $updated;
+    }
 }
 
 ?>
\ No newline at end of file
index a3568e8..f0c1c51 100644 (file)
@@ -1,3 +1,3 @@
-.for-sale-list-wrapper .glm-row{margin:0 !important}#glm-admin-content-container .admin-item-label,#glm-admin-content-container .admin-item-input,#glm-admin-content-container .admin-item-list{padding:6px 0px 6px 2px}#glm-admin-content-container .admin-item-label .admin-item-data,#glm-admin-content-container .admin-item-input .admin-item-data,#glm-admin-content-container .admin-item-list .admin-item-data{margin-bottom:0px !important}.admin-list-edit-item{padding:5px}.admin-list-edit-items{position:absolute;right:0;max-width:100px;float:right}@media (max-width: 641px){.admin-list-edit-items{margin:0 auto;float:none}}.itemTitle-record{float:left}.admin-new-item{margin-bottom:15px}.admin-new-item .admin-new-item-link{padding:5px;background:#3D84D0;color:white;text-decoration:none;border-radius:4px}.no-padding{padding:0}.no-margin{margin:0}#glm-admin-content-container .admin-item-list-header{margin-bottom:20px;padding-bottom:2px;border-bottom:1px solid lightgray}.item-company-list-header,.item-date-list-header,.item-title-list-header{font-weight:bold;font-size:16px}.admin-item-list-row:nth-child(odd){background:#e3e3e5}.item-image{display:block;max-width:200px}.item-image-row{border-bottom:1px solid lightgray;padding-bottom:10px}
+.for-sale-list-wrapper .glm-row{margin:0 !important}.for-sale-list-wrapper .admin-item-label,.for-sale-list-wrapper .admin-item-input,.for-sale-list-wrapper .admin-item-list{padding:6px 0px 6px 2px}.for-sale-list-wrapper .admin-item-label .admin-item-data,.for-sale-list-wrapper .admin-item-input .admin-item-data,.for-sale-list-wrapper .admin-item-list .admin-item-data{margin-bottom:0px !important}.for-sale-list-wrapper .admin-list-edit-item{padding:5px}.for-sale-list-wrapper .admin-list-edit-items{position:absolute;right:0;max-width:100px;float:right}@media (max-width: 641px){.for-sale-list-wrapper .admin-list-edit-items{margin:0 auto;float:none}}.for-sale-list-wrapper .itemTitle-record{float:left}.for-sale-list-wrapper .admin-new-item{margin-bottom:15px}.for-sale-list-wrapper .admin-new-item .admin-new-item-link{padding:5px;background:#3D84D0;color:white;text-decoration:none;border-radius:4px}.for-sale-list-wrapper .no-padding{padding:0}.for-sale-list-wrapper .no-margin{margin:0}.for-sale-list-wrapper .admin-item-list-header{margin-bottom:20px;padding-bottom:2px;border-bottom:1px solid lightgray}.for-sale-list-wrapper .item-company-list-header,.for-sale-list-wrapper .item-date-list-header,.for-sale-list-wrapper .item-title-list-header{font-weight:bold;font-size:16px}.for-sale-list-wrapper .admin-item-list-row:nth-child(odd){background:#e3e3e5}.for-sale-list-wrapper .item-image{display:block;max-width:200px}.for-sale-list-wrapper .item-image-row{border-bottom:1px solid lightgray;padding-bottom:10px}
 
 /*# sourceMappingURL=admin.css.map */
index b315321..d8116e4 100644 (file)
@@ -1 +1 @@
-{"version":3,"file":"admin.css","sources":["admin.scss"],"sourcesContent":[".for-sale-list-wrapper{\n    .glm-row{\n        margin: 0 !important;\n    }\n}\n#glm-admin-content-container .admin-item-label,\n#glm-admin-content-container .admin-item-input,\n#glm-admin-content-container .admin-item-list{\n    padding: 6px 0px 6px 2px;\n    .admin-item-data{\n        margin-bottom: 0px !important;\n    }\n}\n.admin-list-edit-item{\n    // float: right;\n    padding: 5px;\n}\n.admin-list-edit-items{\n    position: absolute;\n    right: 0;\n    // top: 6px;\n    max-width: 100px;\n    float: right;\n    @media(max-width: 641px){\n        margin: 0 auto;\n        float: none;\n    }\n}\n.itemTitle-record{\n    float: left;\n}\n.admin-new-item{\n    margin-bottom: 15px;\n}\n.admin-new-item .admin-new-item-link{\n    padding: 5px;\n    background: #3D84D0;\n    color: white;\n    text-decoration: none;\n    border-radius: 4px;\n}\n.no-padding{\n    padding: 0;\n}\n.no-margin{\n    margin: 0;\n}\n#glm-admin-content-container .admin-item-list-header{\n    margin-bottom: 20px;\n    padding-bottom: 2px;\n    border-bottom: 1px solid lightgray;\n}\n.admin-item-list-row{\n    // padding-bottom: 5px;\n/*    border-bottom: 1px solid lightgray;*/\n}\n.item-company-list-header,.item-date-list-header, .item-title-list-header{\n    font-weight: bold;\n    font-size: 16px;\n}\n.admin-item-list-row:nth-child(odd){\n    background: #e3e3e5;\n}\n.item-image{\n    display: block;\n    max-width: 200px;\n}\n.item-image-row{\n    border-bottom: 1px solid lightgray;\n    padding-bottom: 10px;\n}\n"],"names":[],"mappings":"AAAA,AACI,sBADkB,CAClB,QAAQ,AAAA,CACJ,MAAM,CAAE,YAAY,CACvB,AAEL,AAA6B,4BAAD,CAAC,iBAAiB,CAC9C,AAA6B,4BAAD,CAAC,iBAAiB,CAC9C,AAA6B,4BAAD,CAAC,gBAAgB,AAAA,CACzC,OAAO,CAAE,eAAe,CAI3B,AAPD,AAII,4BAJwB,CAAC,iBAAiB,CAI1C,gBAAgB,CAHpB,AAGI,4BAHwB,CAAC,iBAAiB,CAG1C,gBAAgB,CAFpB,AAEI,4BAFwB,CAAC,gBAAgB,CAEzC,gBAAgB,AAAA,CACZ,aAAa,CAAE,cAAc,CAChC,AAEL,AAAA,qBAAqB,AAAA,CAEjB,OAAO,CAAE,GAAG,CACf,AACD,AAAA,sBAAsB,AAAA,CAClB,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CAER,SAAS,CAAE,KAAK,CAChB,KAAK,CAAE,KAAK,CAKf,AAJG,MAAM,EAAC,SAAS,EAAE,KAAK,EAN3B,AAAA,sBAAsB,AAAA,CAOd,MAAM,CAAE,MAAM,CACd,KAAK,CAAE,IAAI,CAElB,CACD,AAAA,iBAAiB,AAAA,CACb,KAAK,CAAE,IAAI,CACd,AACD,AAAA,eAAe,AAAA,CACX,aAAa,CAAE,IAAI,CACtB,AACD,AAAgB,eAAD,CAAC,oBAAoB,AAAA,CAChC,OAAO,CAAE,GAAG,CACZ,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,KAAK,CACZ,eAAe,CAAE,IAAI,CACrB,aAAa,CAAE,GAAG,CACrB,AACD,AAAA,WAAW,AAAA,CACP,OAAO,CAAE,CAAC,CACb,AACD,AAAA,UAAU,AAAA,CACN,MAAM,CAAE,CAAC,CACZ,AACD,AAA6B,4BAAD,CAAC,uBAAuB,AAAA,CAChD,aAAa,CAAE,IAAI,CACnB,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,mBAAmB,CACrC,AAKD,AAAA,yBAAyB,CAAC,AAAA,sBAAsB,CAAE,AAAA,uBAAuB,AAAA,CACrE,WAAW,CAAE,IAAI,CACjB,SAAS,CAAE,IAAI,CAClB,AACD,AAAA,oBAAoB,AAAA,UAAW,CAAA,AAAA,GAAG,CAAC,CAC/B,UAAU,CAAE,OAAO,CACtB,AACD,AAAA,WAAW,AAAA,CACP,OAAO,CAAE,KAAK,CACd,SAAS,CAAE,KAAK,CACnB,AACD,AAAA,eAAe,AAAA,CACX,aAAa,CAAE,mBAAmB,CAClC,cAAc,CAAE,IAAI,CACvB"}
\ No newline at end of file
+{"version":3,"file":"admin.css","sources":["admin.scss"],"sourcesContent":[".for-sale-list-wrapper{\n    .glm-row{\n        margin: 0 !important;\n    }\n\n    .admin-item-label,\n    .admin-item-input,\n    .admin-item-list{\n        padding: 6px 0px 6px 2px;\n        .admin-item-data{\n            margin-bottom: 0px !important;\n        }\n    }\n    .admin-list-edit-item{\n        // float: right;\n        padding: 5px;\n    }\n    .admin-list-edit-items{\n        position: absolute;\n        right: 0;\n        // top: 6px;\n        max-width: 100px;\n        float: right;\n        @media(max-width: 641px){\n            margin: 0 auto;\n            float: none;\n        }\n    }\n    .itemTitle-record{\n        float: left;\n    }\n    .admin-new-item{\n        margin-bottom: 15px;\n    }\n    .admin-new-item .admin-new-item-link{\n        padding: 5px;\n        background: #3D84D0;\n        color: white;\n        text-decoration: none;\n        border-radius: 4px;\n    }\n    .no-padding{\n        padding: 0;\n    }\n    .no-margin{\n        margin: 0;\n    }\n    .admin-item-list-header{\n        margin-bottom: 20px;\n        padding-bottom: 2px;\n        border-bottom: 1px solid lightgray;\n    }\n    .admin-item-list-row{\n        // padding-bottom: 5px;\n    /*    border-bottom: 1px solid lightgray;*/\n    }\n    .item-company-list-header,.item-date-list-header, .item-title-list-header{\n        font-weight: bold;\n        font-size: 16px;\n    }\n    .admin-item-list-row:nth-child(odd){\n        background: #e3e3e5;\n    }\n    .item-image{\n        display: block;\n        max-width: 200px;\n    }\n    .item-image-row{\n        border-bottom: 1px solid lightgray;\n        padding-bottom: 10px;\n    }\n}"],"names":[],"mappings":"AAAA,AACI,sBADkB,CAClB,QAAQ,AAAA,CACJ,MAAM,CAAE,YAAY,CACvB,AAHL,AAKI,sBALkB,CAKlB,iBAAiB,CALrB,AAMI,sBANkB,CAMlB,iBAAiB,CANrB,AAOI,sBAPkB,CAOlB,gBAAgB,AAAA,CACZ,OAAO,CAAE,eAAe,CAI3B,AAZL,AASQ,sBATc,CAKlB,iBAAiB,CAIb,gBAAgB,CATxB,AASQ,sBATc,CAMlB,iBAAiB,CAGb,gBAAgB,CATxB,AASQ,sBATc,CAOlB,gBAAgB,CAEZ,gBAAgB,AAAA,CACZ,aAAa,CAAE,cAAc,CAChC,AAXT,AAaI,sBAbkB,CAalB,qBAAqB,AAAA,CAEjB,OAAO,CAAE,GAAG,CACf,AAhBL,AAiBI,sBAjBkB,CAiBlB,sBAAsB,AAAA,CAClB,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,CAAC,CAER,SAAS,CAAE,KAAK,CAChB,KAAK,CAAE,KAAK,CAKf,AAJG,MAAM,EAAC,SAAS,EAAE,KAAK,EAvB/B,AAiBI,sBAjBkB,CAiBlB,sBAAsB,AAAA,CAOd,MAAM,CAAE,MAAM,CACd,KAAK,CAAE,IAAI,CAElB,CA3BL,AA4BI,sBA5BkB,CA4BlB,iBAAiB,AAAA,CACb,KAAK,CAAE,IAAI,CACd,AA9BL,AA+BI,sBA/BkB,CA+BlB,eAAe,AAAA,CACX,aAAa,CAAE,IAAI,CACtB,AAjCL,AAkCoB,sBAlCE,CAkClB,eAAe,CAAC,oBAAoB,AAAA,CAChC,OAAO,CAAE,GAAG,CACZ,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,KAAK,CACZ,eAAe,CAAE,IAAI,CACrB,aAAa,CAAE,GAAG,CACrB,AAxCL,AAyCI,sBAzCkB,CAyClB,WAAW,AAAA,CACP,OAAO,CAAE,CAAC,CACb,AA3CL,AA4CI,sBA5CkB,CA4ClB,UAAU,AAAA,CACN,MAAM,CAAE,CAAC,CACZ,AA9CL,AA+CI,sBA/CkB,CA+ClB,uBAAuB,AAAA,CACnB,aAAa,CAAE,IAAI,CACnB,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,mBAAmB,CACrC,AAnDL,AAwDI,sBAxDkB,CAwDlB,yBAAyB,CAxD7B,AAwD8B,sBAxDR,CAwDQ,sBAAsB,CAxDpD,AAwDsD,sBAxDhC,CAwDgC,uBAAuB,AAAA,CACrE,WAAW,CAAE,IAAI,CACjB,SAAS,CAAE,IAAI,CAClB,AA3DL,AA4DI,sBA5DkB,CA4DlB,oBAAoB,AAAA,UAAW,CAAA,AAAA,GAAG,CAAC,CAC/B,UAAU,CAAE,OAAO,CACtB,AA9DL,AA+DI,sBA/DkB,CA+DlB,WAAW,AAAA,CACP,OAAO,CAAE,KAAK,CACd,SAAS,CAAE,KAAK,CACnB,AAlEL,AAmEI,sBAnEkB,CAmElB,eAAe,AAAA,CACX,aAAa,CAAE,mBAAmB,CAClC,cAAc,CAAE,IAAI,CACvB"}
\ No newline at end of file
index 1a8abab..dc8580b 100644 (file)
@@ -41,7 +41,7 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
      * @access public
      */
     public $item_id = false;
-
+    public $table = GLM_MEMBERS_FOR_SALE_PLUGIN_DB_PREFIX;
     /*
      * Constructor
      *
@@ -179,11 +179,7 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
             }
         }
 
-        $item_data = $this->getList($where);
-        
-//        echo '<pre>', print_r($this->getList()), '</pre>';
-        // echo '<pre>', print_r($_REQUEST), '</pre>';
-        
+        $item_data = $this->getList($where,'topic DESC, title');
         switch ($option) {
 
             case 'add':
@@ -193,9 +189,10 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
                 break;
 
             case 'insert':
+    
                 $item = $this->insertEntry();
                 $this->item_id = $item['fieldData']['id'];
-
+                $updated = $this->getUpdatedTime($this->item_id);
                 if ($item['status']) {
                     $haveItem = true;
                     $itemAdded = true;
@@ -205,7 +202,7 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
 
                     // Get this again so we have the created date
                     $item = $this->editEntry($this->item_id);
-                    
+                    $this->updateTimestamp('updated', $this->item_id,$item,$updated);
                     $option = 'edit';
                     $itemAdded = true;
 
@@ -225,20 +222,23 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
                 if ($item['status']) {
                     $haveItem = true;
                 }
-
                 $view_file = 'edit';
                 break;
 
             case 'update':
                 // Try to update this item
+                $updated = $this->getUpdatedTime($this->item_id);
                 $item = $this->updateEntry($this->item_id);
-      
+                
                 // Check if that was successful
                 if ($item['status']) {
                     $itemUpdated = true;
 
                     $item = $this->editEntry($this->item_id);
+                    // print_r($item);
+                  
+                    $this->updateTimestamp('updated', $this->item_id,$item,$updated);
+                    
                 } else {
                     $itemUpdateError = true;
                 }
@@ -257,10 +257,10 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
                     $itemDeleteError = true;
                 }
                 $view_file = "list";
-                $item_data = $this->getList();
+                $item_data = $this->getList($where,'topic DESC, title');
                 break;
             default:
-                $item_data = $this->getList($where, 'title');
+                $item_data = $this->getList($where, 'topic DESC, title');
                 $view_file = 'list';
                 break;
         }
@@ -281,7 +281,6 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
             'option'            => $option,
             'item'              => $item,
             'assetsUrl'         => GLM_MEMBERS_FOR_SALE_PLUGIN_URL . 'assets/',
-            
         );
 
         // Return status, any suggested view, and any data to controller
@@ -292,4 +291,5 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
                 'data' => $templateData
         );
     }
+      
 }
index 3b95cbb..a6b0cb5 100644 (file)
@@ -96,8 +96,6 @@ class GlmMembersAdmin_management_itemsImport
      */
     public function modelAction ($actionData = false)
     {
-
-
         $resultMessage = '';
         $success       = false;
         $haveMembers   = false;
@@ -160,7 +158,7 @@ class GlmMembersAdmin_management_itemsImport
                 $forsale = $stmt->fetchAll(PDO::FETCH_ASSOC);
                $count = 0;
                 foreach($forsale as $key=>$value){
-
+                    
                     $parts = false;
                     $res = false;
                     $image_1 = false;
@@ -169,9 +167,7 @@ class GlmMembersAdmin_management_itemsImport
                     $post_exp = false;
 
                     // process the expiration values
-                    if( $value['post'] == "30days" ){
-                        $post_exp = 30;
-                    } else if( $value['post'] == "60days" ){
+                    if( $value['post'] == "60days" ){
                         $post_exp = 60;
                     } else if( $value['post'] == "90days" ){
                         $post_exp = 90;
@@ -202,7 +198,6 @@ class GlmMembersAdmin_management_itemsImport
                             $image_3 = $ImageUpload->storeImage($res);
                         } 
                     }
-
                     $this->wpdb->insert( $table,
                         array(
                             'old_id'            =>$value['id'],
@@ -218,6 +213,7 @@ class GlmMembersAdmin_management_itemsImport
                             'company'           =>$value['company'],
                             'terms'             =>$value['terms'],
                             'post_date'         =>$value['ds'],
+                            'updated'           =>$value['ds'],
                             'member'            =>$value['member'],
                             'image_1'           =>$image_1['newFileName'],
                             'image_2'           =>$image_2['newFileName'],
@@ -237,6 +233,7 @@ class GlmMembersAdmin_management_itemsImport
                             '%s',
                             '%s',
                             '%s',
+                            '%s',
                             '%d',
                             '%s',
                             '%s',
@@ -259,26 +256,18 @@ class GlmMembersAdmin_management_itemsImport
             
             $url = get_site_url() . '/wp-admin/admin.php?page=glm-members-admin-menu-management&glm_action=itemImport&option=importItems';
             $limit = 200;
-            
-            $count = 0;
-
-            
             $resultMessage =  "<pre>Start: $start</pre>";
             $start += $limit;
             $resultMessage .= "<p><a class='next-import-btn' href=\"". $url . "&limit=$limit&start=$start\">Next</a></p>";
-            
             break;
-        
         default:
             break;
         }
-
         $templateData = array(
             'success'       => $success,
             'option'        => $option,
             'resultMessage' => $resultMessage
         );
-
         // Return status, suggested view, and data to controller
         return array(
             'status'           => true,
index 40b863c..9b14149 100644 (file)
@@ -110,11 +110,9 @@ class GlmMembersFront_forSale_list extends GlmDataForSale
         if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
             $option = $_REQUEST['option'];
         }
-        $where .= "CURDATE() <= DATE_ADD(post_date, INTERVAL item_expiration DAY) AND visible = true";
+        $where .= "CURDATE() <= DATE_ADD(updated, INTERVAL item_expiration DAY) AND visible = true";
 
         $item_data = $this->getList($where);
-    
-
         $view_file = 'list';
 
         // Compile template data
index 83c5277..4fe01fc 100644 (file)
@@ -2,70 +2,71 @@
     .glm-row{
         margin: 0 !important;
     }
-}
-#glm-admin-content-container .admin-item-label,
-#glm-admin-content-container .admin-item-input,
-#glm-admin-content-container .admin-item-list{
-    padding: 6px 0px 6px 2px;
-    .admin-item-data{
-        margin-bottom: 0px !important;
+
+    .admin-item-label,
+    .admin-item-input,
+    .admin-item-list{
+        padding: 6px 0px 6px 2px;
+        .admin-item-data{
+            margin-bottom: 0px !important;
+        }
     }
-}
-.admin-list-edit-item{
-    // float: right;
-    padding: 5px;
-}
-.admin-list-edit-items{
-    position: absolute;
-    right: 0;
-    // top: 6px;
-    max-width: 100px;
-    float: right;
-    @media(max-width: 641px){
-        margin: 0 auto;
-        float: none;
+    .admin-list-edit-item{
+        // float: right;
+        padding: 5px;
     }
-}
-.itemTitle-record{
-    float: left;
-}
-.admin-new-item{
-    margin-bottom: 15px;
-}
-.admin-new-item .admin-new-item-link{
-    padding: 5px;
-    background: #3D84D0;
-    color: white;
-    text-decoration: none;
-    border-radius: 4px;
-}
-.no-padding{
-    padding: 0;
-}
-.no-margin{
-    margin: 0;
-}
-#glm-admin-content-container .admin-item-list-header{
-    margin-bottom: 20px;
-    padding-bottom: 2px;
-    border-bottom: 1px solid lightgray;
-}
-.admin-item-list-row{
-    // padding-bottom: 5px;
-/*    border-bottom: 1px solid lightgray;*/
-}
-.item-company-list-header,.item-date-list-header, .item-title-list-header{
-    font-weight: bold;
-    font-size: 16px;
-}
-.admin-item-list-row:nth-child(odd){
-    background: #e3e3e5;
-}
-.item-image{
-    display: block;
-    max-width: 200px;
-}
-.item-image-row{
-    border-bottom: 1px solid lightgray;
-    padding-bottom: 10px;
-}
+    .admin-list-edit-items{
+        position: absolute;
+        right: 0;
+        // top: 6px;
+        max-width: 100px;
+        float: right;
+        @media(max-width: 641px){
+            margin: 0 auto;
+            float: none;
+        }
+    }
+    .itemTitle-record{
+        float: left;
+    }
+    .admin-new-item{
+        margin-bottom: 15px;
+    }
+    .admin-new-item .admin-new-item-link{
+        padding: 5px;
+        background: #3D84D0;
+        color: white;
+        text-decoration: none;
+        border-radius: 4px;
+    }
+    .no-padding{
+        padding: 0;
+    }
+    .no-margin{
+        margin: 0;
+    }
+    .admin-item-list-header{
+        margin-bottom: 20px;
+        padding-bottom: 2px;
+        border-bottom: 1px solid lightgray;
+    }
+    .admin-item-list-row{
+        // padding-bottom: 5px;
+    /*    border-bottom: 1px solid lightgray;*/
+    }
+    .item-company-list-header,.item-date-list-header, .item-title-list-header{
+        font-weight: bold;
+        font-size: 16px;
+    }
+    .admin-item-list-row:nth-child(odd){
+        background: #e3e3e5;
+    }
+    .item-image{
+        display: block;
+        max-width: 200px;
+    }
+    .item-image-row{
+        border-bottom: 1px solid lightgray;
+        padding-bottom: 10px;
+    }
+}
\ No newline at end of file
index edbbd4a..7e844d3 100644 (file)
@@ -24,24 +24,25 @@ CREATE TABLE {prefix}items (
     contact_name TINYTEXT NULL ,
     contact_phone TINYTEXT NULL ,
     post_date DATETIME NULL DEFAULT NOW(),
+    updated DATETIME NULL,
     visible BOOL NULL,
     terms TEXT NULL,
-    post TEXT NULL,
     item_expiration INT NULL,
     image_1 TINYTEXT NULL ,
     image_2 TINYTEXT NULL ,
     image_3 TINYTEXT NULL ,
     member INT NULL,
+    repost BOOL null,
     PRIMARY KEY (id)
 );
 
 ----
 
 --  default entries in table
-INSERT INTO {prefix}items ( 
-id,old_id,title,descr,topic,contact_email,contact_name,contact_phone,post_date,visible, 
-terms,location,item_expiration,image_3,post,image_1,
-company,member,image_2
-) VALUES ( 1, 1,"TITLE", "DESCR", 1, "CONTACT_EMAIL", "CONTACT_NAME", "CONTACT_PHONE", NOW(), true, "TERMS", "LOCATION", 60, "IMAGE_3.jpg", "POST", 
-"IMAGE_1.jpg", "COMPANY", 1, "IMAGE_2.jpg"
-);
\ No newline at end of file
+-- INSERT INTO {prefix}items ( 
+-- id,old_id,title,descr,topic,contact_email,contact_name,contact_phone,post_date,visible, 
+-- terms,location,item_expiration,image_3,image_1,
+-- company,member,image_2
+-- ) VALUES ( 1, 1,"TITLE", "DESCR", 1, "CONTACT_EMAIL", "CONTACT_NAME", "CONTACT_PHONE", NOW(), true, "TERMS", "LOCATION", 60, "IMAGE_3.jpg",
+-- "IMAGE_1.jpg", "COMPANY", 1, "IMAGE_2.jpg"
+-- );
\ No newline at end of file
index 2d790e6..750b74f 100644 (file)
         <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
             <a id="glm-item-descr" data-show-table="glm-table-descr" class="glm-item-tab nav-tab nav-tab-active">Item Postings</a>
         </h2>
+        <!-- RE-POST -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                    Re-Post<br> (restart expiration interval)
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                    <input id="item-repost" data-id="item-repost" type="checkbox" name="repost" class="repost-checkbox">
+            </div>
+        </div>
         <div class="glm-item-row glm-row">
             <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
                 Topic
@@ -39,7 +48,7 @@
          
             <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
                 <select id="topic" data-id="item-topic" name="topic">
-                    <option value="">Topic</option>
+                    <option disabled value="">Topic</option>
                     {foreach $item.fieldData.topic.list as $topic}
                         <option value="{$topic.value}" {if $item.fieldData.topic.value == {$topic.value}} selected="selected"{/if}>
                         {$topic.name}
index ff20ceb..37db377 100644 (file)
@@ -24,7 +24,7 @@
                         <div class="glm-row admin-item-data">
                             <div class="item-title-list glm-small-12 glm-large-2 glm-columns no-padding">{$data.topic.name}</div>
                             <div class="item-company-list glm-small-12 glm-large-4 glm-columns no-padding">{$data.title}</div>
-                            <div class="item-date-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.post_date.timestamp|date_format:"%Y-%m-%d"}</div>
+                            <div class="item-date-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.updated.timestamp|date_format:"%Y-%m-%d"}</div>
                             <div class="item-date-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.item_expiration.name}</div>
                         </div>
                     </div>